Added debugging support.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@601 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Vikram S. Adve 2001-09-18 12:23:40 +00:00
parent ead19d51ba
commit 0b5787ace8

View File

@ -56,22 +56,27 @@ public:
Value(const Type *Ty, ValueTy vty, const string &name = "");
virtual ~Value();
inline const Type *getType() const { return Ty; }
// Support for debugging
void dump() const;
// All values can potentially be typed
inline const Type* getType() const { return Ty; }
// All values can potentially be named...
inline bool hasName() const { return Name != ""; }
inline const string &getName() const { return Name; }
virtual void setName(const string &name, SymbolTable * = 0) { Name = name; }
inline bool hasName() const { return Name != ""; }
inline const string& getName() const { return Name; }
virtual void setName(const string &name, SymbolTable * = 0)
{ Name = name; }
// Methods for determining the subtype of this Value. The getValueType()
// method returns the type of the value directly. The cast*() methods are
// equilivent to using dynamic_cast<>... if the cast is successful, this is
// returned, otherwise you get a null pointer, allowing expressions like this:
// equivalent to using dynamic_cast<>... if the cast is successful, this is
// returned, otherwise you get a null pointer, allowing expressions like:
//
// if (Instruction *I = Val->castInstruction()) { ... }
//
// This section also defines a family of isType, isConstant, isMethodArgument,
// etc functions...
// This section also defines a family of isType, isConstant,
// isMethodArgument, etc functions...
//
// The family of functions Val->cast<type>Asserting() is used in the same
// way as the Val->cast<type>() instructions, but they assert the expected
@ -191,4 +196,13 @@ public:
typedef UseTy<Value> Use;
//----------------------------------------------------------------------
// Debugging support for class Value and its subclasses.
//
void DebugValue (const Value* V);
void DebugValue (const Value& V);
ostream& operator<< (ostream &o, const Value& I);
#endif