Added debugging support.
authorVikram S. Adve <vadve@cs.uiuc.edu>
Tue, 18 Sep 2001 12:23:40 +0000 (12:23 +0000)
committerVikram S. Adve <vadve@cs.uiuc.edu>
Tue, 18 Sep 2001 12:23:40 +0000 (12:23 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@601 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Value.h

index d2bf4cd5f1993f7bcfbcdf63679a495239513a68..2594418ad9b9281380b521766d860283a5e86327 100644 (file)
@@ -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->cast<type>Asserting() is used in the same
   // way as the Val->cast<type>() 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<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