summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorVikram S. Adve <vadve@cs.uiuc.edu>2001-09-18 12:44:41 +0000
committerVikram S. Adve <vadve@cs.uiuc.edu>2001-09-18 12:44:41 +0000
commitdf6bbeb59cb29482204c0c4b6be45cf9767494fc (patch)
tree8b0448225b3c547e7e0c33e9e7da5f7f6ec1994a /llvm/lib
parent0d4a68f8aa9d9a9d6775917796ad0859416ada7d (diff)
downloadbcm5719-llvm-df6bbeb59cb29482204c0c4b6be45cf9767494fc.tar.gz
bcm5719-llvm-df6bbeb59cb29482204c0c4b6be45cf9767494fc.zip
Added debugging support.
llvm-svn: 605
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/VMCore/Value.cpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/llvm/lib/VMCore/Value.cpp b/llvm/lib/VMCore/Value.cpp
index a41262d0c64..723a71cd195 100644
--- a/llvm/lib/VMCore/Value.cpp
+++ b/llvm/lib/VMCore/Value.cpp
@@ -83,6 +83,44 @@ User *Value::use_remove(use_iterator &I) {
return i;
}
+void
+Value::dump() const
+{
+ DebugValue(*this);
+}
+
+ostream&
+operator<<(ostream &o, const Value& I)
+{
+ switch (I.getValueType()) {
+ case Value::TypeVal: return o << I.castTypeAsserting();
+ case Value::ConstantVal: WriteToAssembly((const ConstPoolVal*)&I,o);break;
+ case Value::MethodArgumentVal: return o << I.getType() << " "<< I.getName();
+ case Value::InstructionVal:WriteToAssembly((const Instruction *)&I, o);break;
+ case Value::BasicBlockVal: WriteToAssembly((const BasicBlock *)&I, o);break;
+ case Value::MethodVal: WriteToAssembly((const Method *)&I, o);break;
+ case Value::GlobalVal: WriteToAssembly((const GlobalVariable*)&I,o);break;
+ case Value::ModuleVal: WriteToAssembly((const Module *)&I,o); break;
+ default: return o << "<unknown value type: " << I.getValueType() << ">";
+ }
+ return o;
+}
+
+void
+DebugValue(const Value* V)
+{
+ if (V)
+ cerr << *V << endl;
+ else
+ cerr << "<NULL value>" << endl;
+}
+
+void
+DebugValue(const Value& V)
+{
+ cerr << V << endl;
+}
+
//===----------------------------------------------------------------------===//
// User Class
OpenPOWER on IntegriCloud