From 0b5787ace89a97c3584b3bdebd3d85f4060d5ec6 Mon Sep 17 00:00:00 2001 From: "Vikram S. Adve" Date: Tue, 18 Sep 2001 12:23:40 +0000 Subject: [PATCH] Added debugging support. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@601 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Value.h | 40 +++++++++++++++++++++++++++------------- 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/include/llvm/Value.h b/include/llvm/Value.h index d2bf4cd5f19..2594418ad9b 100644 --- a/include/llvm/Value.h +++ b/include/llvm/Value.h @@ -55,30 +55,35 @@ protected: 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->castAsserting() is used in the same // way as the Val->cast() instructions, but they assert the expected // type instead of checking it at runtime. // inline ValueTy getValueType() const { return VTy; } - + // Use a macro to define the functions, otherwise these definitions are just // really long and ugly. #define CAST_FN(NAME, CLASS) \ @@ -128,7 +133,7 @@ public: // concrete types after we are constructed. // virtual void refineAbstractType(const DerivedType *OldTy, const Type *NewTy); - + //---------------------------------------------------------------------- // Methods for handling the vector of uses of this Value. // @@ -191,4 +196,13 @@ public: typedef UseTy 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 -- 2.34.1