Have PseudoSourceValue override Value::dump, so that it works
authorDan Gohman <gohman@apple.com>
Wed, 3 Dec 2008 21:37:21 +0000 (21:37 +0000)
committerDan Gohman <gohman@apple.com>
Wed, 3 Dec 2008 21:37:21 +0000 (21:37 +0000)
on PseudoSourceValue values. This also fixes a FIXME in
lib/VMCode/AsmWriter.cpp.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60507 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/CodeGen/PseudoSourceValue.h
lib/CodeGen/PseudoSourceValue.cpp
lib/VMCore/AsmWriter.cpp

index dccf735ed029e8ca87fa2d59501798cf0df0a026..3ad2502fe08a1ad6ebc7d200d5495e49d5859f94 100644 (file)
@@ -28,6 +28,12 @@ namespace llvm {
   public:
     PseudoSourceValue();
 
+    /// dump - Support for debugging, callable in GDB: V->dump()
+    //
+    virtual void dump() const;
+
+    /// print - Implement operator<< on PseudoSourceValue.
+    ///
     virtual void print(raw_ostream &OS) const;
 
     /// isConstant - Test whether this PseudoSourceValue has a constant value.
index 5247906c46dbf95bc0be63094ca0e0a01c104389..d0ea7069d4bbbe64d003a7b6d2e2553e6a23f738 100644 (file)
@@ -41,6 +41,10 @@ static const char *const PSVNames[] = {
 PseudoSourceValue::PseudoSourceValue() :
   Value(PointerType::getUnqual(Type::Int8Ty), PseudoSourceValueVal) {}
 
+void PseudoSourceValue::dump() const {
+  print(errs()); errs() << '\n'; errs().flush();
+}
+
 void PseudoSourceValue::print(raw_ostream &OS) const {
   OS << PSVNames[this - *PSVs];
 }
index 2f6c1cc0f27b71a32a42a652d82c452e9f9729a1..41929faed50ce219f4c3cbd106da8e4946b0de56 100644 (file)
@@ -1759,8 +1759,7 @@ void Value::print(raw_ostream &OS, AssemblyAnnotationWriter *AAW) const {
   } else if (isa<InlineAsm>(this)) {
     WriteAsOperand(OS, this, true, 0);
   } else {
-    // FIXME: PseudoSourceValue breaks this!
-    //assert(0 && "Unknown value to print out!");
+    assert(0 && "Unknown value to print out!");
   }
 }