aboutsummaryrefslogtreecommitdiffstats
path: root/lib/VMCore/AsmWriter.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2009-09-23 01:33:16 +0000
committerDan Gohman <gohman@apple.com>2009-09-23 01:33:16 +0000
commitcd26ec5f3c089b3b24f80ff200e94e681eb9e1ee (patch)
tree62e9a6dbafa4d84a1045809ed86ea3c1396ccb69 /lib/VMCore/AsmWriter.cpp
parent00133a7d52f32ab9c9ac53e964a5cc68fc626b4d (diff)
downloadexternal_llvm-cd26ec5f3c089b3b24f80ff200e94e681eb9e1ee.zip
external_llvm-cd26ec5f3c089b3b24f80ff200e94e681eb9e1ee.tar.gz
external_llvm-cd26ec5f3c089b3b24f80ff200e94e681eb9e1ee.tar.bz2
Give MachineMemOperand an operator<<, factoring out code from
two different places for printing MachineMemOperands. Drop the virtual from Value::dump and instead give Value a protected virtual hook that can be overridden by subclasses to implement custom printing. This lets printing be more consistent, and simplifies printing of PseudoSourceValue values. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82599 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/AsmWriter.cpp')
-rw-r--r--lib/VMCore/AsmWriter.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/VMCore/AsmWriter.cpp b/lib/VMCore/AsmWriter.cpp
index 0d52e1f..219fe09 100644
--- a/lib/VMCore/AsmWriter.cpp
+++ b/lib/VMCore/AsmWriter.cpp
@@ -1198,6 +1198,11 @@ static void WriteAsOperandInternal(raw_ostream &Out, const Value *V,
return;
}
+ if (V->getValueID() == Value::PseudoSourceValueVal) {
+ V->print(Out);
+ return;
+ }
+
char Prefix = '%';
int Slot;
if (Machine) {
@@ -2076,10 +2081,17 @@ void Value::print(raw_ostream &ROS, AssemblyAnnotationWriter *AAW) const {
} else if (isa<InlineAsm>(this)) {
WriteAsOperand(OS, this, true, 0);
} else {
- llvm_unreachable("Unknown value to print out!");
+ // Otherwise we don't know what it is. Call the virtual function to
+ // allow a subclass to print itself.
+ printCustom(OS);
}
}
+// Value::printCustom - subclasses should override this to implement printing.
+void Value::printCustom(raw_ostream &OS) const {
+ llvm_unreachable("Unknown value to print out!");
+}
+
// Value::dump - allow easy printing of Values from the debugger.
void Value::dump() const { print(errs()); errs() << '\n'; }