aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDale Johannesen <dalej@apple.com>2010-01-13 00:00:24 +0000
committerDale Johannesen <dalej@apple.com>2010-01-13 00:00:24 +0000
commit5f72a5ebc84a1935878b5b2d3166a505c520cdfc (patch)
treea408a1896dfac1301e5aea85056d1eeae4a226d4 /lib
parent994a2045704601932467e5a773a589d8d3aee6f1 (diff)
Further progration of metadata operands. The
dumper doesn't really do what I want yet, but at least it doesn't crash now. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93272 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/CodeGen/MachineInstr.cpp8
-rw-r--r--lib/VMCore/AsmWriter.cpp5
2 files changed, 12 insertions, 1 deletions
diff --git a/lib/CodeGen/MachineInstr.cpp b/lib/CodeGen/MachineInstr.cpp
index f9c20e6473..cf3e3e1601 100644
--- a/lib/CodeGen/MachineInstr.cpp
+++ b/lib/CodeGen/MachineInstr.cpp
@@ -34,6 +34,7 @@
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/ADT/FoldingSet.h"
+#include "llvm/Metadata.h"
using namespace llvm;
//===----------------------------------------------------------------------===//
@@ -278,10 +279,15 @@ void MachineOperand::print(raw_ostream &OS, const TargetMachine *TM) const {
OS << '>';
break;
case MachineOperand::MO_BlockAddress:
- OS << "<";
+ OS << '<';
WriteAsOperand(OS, getBlockAddress(), /*PrintType=*/false);
OS << '>';
break;
+ case MachineOperand::MO_Metadata:
+ OS << '<';
+ WriteAsOperand(OS, getMetadata(), /*PrintType=*/false);
+ OS << '>';
+ break;
default:
llvm_unreachable("Unrecognized operand type");
}
diff --git a/lib/VMCore/AsmWriter.cpp b/lib/VMCore/AsmWriter.cpp
index 7cb5a7c759..92dbd93d35 100644
--- a/lib/VMCore/AsmWriter.cpp
+++ b/lib/VMCore/AsmWriter.cpp
@@ -564,6 +564,9 @@ static SlotTracker *createSlotTracker(const Value *V) {
if (const Function *Func = dyn_cast<Function>(V))
return new SlotTracker(Func);
+ if (isa<MDNode>(V))
+ return new SlotTracker((Function *)0);
+
return 0;
}
@@ -1136,6 +1139,8 @@ static void WriteAsOperandInternal(raw_ostream &Out, const Value *V,
return;
}
+ if (!Machine)
+ Machine = createSlotTracker(V);
Out << '!' << Machine->getMetadataSlot(N);
return;
}