aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2008-12-03 21:37:21 +0000
committerDan Gohman <gohman@apple.com>2008-12-03 21:37:21 +0000
commitd71703deec9e3fe90833e82e0c8b6bf7e5af55fd (patch)
treefc1e18f70a58f40a047e8051090cc01842a5e1dd
parent544e0d0e52e68e8bb0c4ce18bd6584602353ce1c (diff)
Have PseudoSourceValue override Value::dump, so that it works
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
-rw-r--r--include/llvm/CodeGen/PseudoSourceValue.h6
-rw-r--r--lib/CodeGen/PseudoSourceValue.cpp4
-rw-r--r--lib/VMCore/AsmWriter.cpp3
3 files changed, 11 insertions, 2 deletions
diff --git a/include/llvm/CodeGen/PseudoSourceValue.h b/include/llvm/CodeGen/PseudoSourceValue.h
index dccf735ed0..3ad2502fe0 100644
--- a/include/llvm/CodeGen/PseudoSourceValue.h
+++ b/include/llvm/CodeGen/PseudoSourceValue.h
@@ -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.
diff --git a/lib/CodeGen/PseudoSourceValue.cpp b/lib/CodeGen/PseudoSourceValue.cpp
index 5247906c46..d0ea7069d4 100644
--- a/lib/CodeGen/PseudoSourceValue.cpp
+++ b/lib/CodeGen/PseudoSourceValue.cpp
@@ -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];
}
diff --git a/lib/VMCore/AsmWriter.cpp b/lib/VMCore/AsmWriter.cpp
index 2f6c1cc0f2..41929faed5 100644
--- a/lib/VMCore/AsmWriter.cpp
+++ b/lib/VMCore/AsmWriter.cpp
@@ -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!");
}
}