[llvm-commits] [llvm] r93272 - in /llvm/trunk: include/llvm/CodeGen/MachineInstrBuilder.h include/llvm/CodeGen/MachineOperand.h lib/CodeGen/MachineInstr.cpp lib/VMCore/AsmWriter.cpp
Dale Johannesen
dalej at apple.com
Tue Jan 12 16:00:24 PST 2010
Author: johannes
Date: Tue Jan 12 18:00:24 2010
New Revision: 93272
URL: http://llvm.org/viewvc/llvm-project?rev=93272&view=rev
Log:
Further progration of metadata operands. The
dumper doesn't really do what I want yet, but
at least it doesn't crash now.
Modified:
llvm/trunk/include/llvm/CodeGen/MachineInstrBuilder.h
llvm/trunk/include/llvm/CodeGen/MachineOperand.h
llvm/trunk/lib/CodeGen/MachineInstr.cpp
llvm/trunk/lib/VMCore/AsmWriter.cpp
Modified: llvm/trunk/include/llvm/CodeGen/MachineInstrBuilder.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineInstrBuilder.h?rev=93272&r1=93271&r2=93272&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/MachineInstrBuilder.h (original)
+++ llvm/trunk/include/llvm/CodeGen/MachineInstrBuilder.h Tue Jan 12 18:00:24 2010
@@ -22,6 +22,7 @@
namespace llvm {
class TargetInstrDesc;
+class MDNode;
namespace RegState {
enum {
@@ -123,6 +124,11 @@
MI->addOperand(MO);
return *this;
}
+
+ const MachineInstrBuilder &addMetadata(MDNode *MD) const {
+ MI->addOperand(MachineOperand::CreateMetadata(MD));
+ return *this;
+ }
};
/// BuildMI - Builder interface. Specify how to create the initial instruction
Modified: llvm/trunk/include/llvm/CodeGen/MachineOperand.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineOperand.h?rev=93272&r1=93271&r2=93272&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/MachineOperand.h (original)
+++ llvm/trunk/include/llvm/CodeGen/MachineOperand.h Tue Jan 12 18:00:24 2010
@@ -317,7 +317,7 @@
return Contents.OffsetedInfo.Val.SymbolName;
}
- MDNode *getMetadata() const {
+ const MDNode *getMetadata() const {
assert(isMetadata() && "Wrong MachineOperand accessor");
return Contents.MD;
}
Modified: llvm/trunk/lib/CodeGen/MachineInstr.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineInstr.cpp?rev=93272&r1=93271&r2=93272&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineInstr.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineInstr.cpp Tue Jan 12 18:00:24 2010
@@ -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 @@
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");
}
Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/AsmWriter.cpp?rev=93272&r1=93271&r2=93272&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/AsmWriter.cpp (original)
+++ llvm/trunk/lib/VMCore/AsmWriter.cpp Tue Jan 12 18:00:24 2010
@@ -564,6 +564,9 @@
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 @@
return;
}
+ if (!Machine)
+ Machine = createSlotTracker(V);
Out << '!' << Machine->getMetadataSlot(N);
return;
}
More information about the llvm-commits
mailing list