summaryrefslogtreecommitdiffstats
path: root/llvm/lib/VMCore/AsmWriter.cpp
diff options
context:
space:
mode:
authorVictor Hernandez <vhernandez@apple.com>2009-12-18 20:09:14 +0000
committerVictor Hernandez <vhernandez@apple.com>2009-12-18 20:09:14 +0000
commit0471abd58bf916538dc6e4e1099ddbcf0d7af820 (patch)
treeee4e23a25cd2a7834db78d1dbde345e01c4922a0 /llvm/lib/VMCore/AsmWriter.cpp
parent45281870ef126385ec4e7d838ee78cbb9b6919ea (diff)
downloadbcm5719-llvm-0471abd58bf916538dc6e4e1099ddbcf0d7af820.tar.gz
bcm5719-llvm-0471abd58bf916538dc6e4e1099ddbcf0d7af820.zip
Formalize MDNode's function-localness:
- an MDNode is designated as function-local when created, and continues to be even if its operands are modified not to refer to function-local IR - function-localness is designated via lowest bit in SubclassData - getLocalFunction() descends MDNode tree to see if it is consistently function-local Add verification of MDNodes to checks that MDNodes are consistently function-local. Update AsmWriter to use isFunctionLocal(). llvm-svn: 91708
Diffstat (limited to 'llvm/lib/VMCore/AsmWriter.cpp')
-rw-r--r--llvm/lib/VMCore/AsmWriter.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/llvm/lib/VMCore/AsmWriter.cpp b/llvm/lib/VMCore/AsmWriter.cpp
index c765d968fcd..13905ea1906 100644
--- a/llvm/lib/VMCore/AsmWriter.cpp
+++ b/llvm/lib/VMCore/AsmWriter.cpp
@@ -813,10 +813,9 @@ void SlotTracker::CreateFunctionSlot(const Value *V) {
void SlotTracker::CreateMetadataSlot(const MDNode *N) {
assert(N && "Can't insert a null Value into SlotTracker!");
- // Don't insert if N contains an instruction.
- for (unsigned i = 0, e = N->getNumElements(); i != e; ++i)
- if (N->getElement(i) && isa<Instruction>(N->getElement(i)))
- return;
+ // Don't insert if N is a function-local metadata.
+ if (N->isFunctionLocal())
+ return;
ValueMap::iterator I = mdnMap.find(N);
if (I != mdnMap.end())
@@ -1232,7 +1231,7 @@ static void WriteAsOperandInternal(raw_ostream &Out, const Value *V,
}
if (const MDNode *N = dyn_cast<MDNode>(V)) {
- if (Machine->getMetadataSlot(N) == -1) {
+ if (N->isFunctionLocal()) {
// Print metadata inline, not via slot reference number.
Out << "!{";
for (unsigned mi = 0, me = N->getNumElements(); mi != me; ++mi) {
OpenPOWER on IntegriCloud