diff options
| author | Chris Lattner <sabre@nondot.org> | 2009-12-31 02:27:30 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2009-12-31 02:27:30 +0000 |
| commit | 0d50bddda62ee177b71229bfb6799c7950163097 (patch) | |
| tree | 20c8359797b143a077426fa500f34cdc6a1aaa1f /llvm/lib/VMCore | |
| parent | efb5e394288553c1bc716f4dd219761699eb9e95 (diff) | |
| download | bcm5719-llvm-0d50bddda62ee177b71229bfb6799c7950163097.tar.gz bcm5719-llvm-0d50bddda62ee177b71229bfb6799c7950163097.zip | |
random tidying for MDNode printing.
llvm-svn: 92333
Diffstat (limited to 'llvm/lib/VMCore')
| -rw-r--r-- | llvm/lib/VMCore/AsmWriter.cpp | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/llvm/lib/VMCore/AsmWriter.cpp b/llvm/lib/VMCore/AsmWriter.cpp index 46dce1badcd..90160fcd22a 100644 --- a/llvm/lib/VMCore/AsmWriter.cpp +++ b/llvm/lib/VMCore/AsmWriter.cpp @@ -751,7 +751,8 @@ 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 is a function-local metadata. + // Don't insert if N is a function-local metadata, these are always printed + // inline. if (N->isFunctionLocal()) return; @@ -762,12 +763,10 @@ void SlotTracker::CreateMetadataSlot(const MDNode *N) { unsigned DestSlot = mdnNext++; mdnMap[N] = DestSlot; - for (unsigned i = 0, e = N->getNumOperands(); i != e; ++i) { - const Value *TV = N->getOperand(i); - if (TV) - if (const MDNode *N2 = dyn_cast<MDNode>(TV)) - CreateMetadataSlot(N2); - } + // Recursively add any MDNodes referenced by operands. + for (unsigned i = 0, e = N->getNumOperands(); i != e; ++i) + if (const MDNode *Op = dyn_cast_or_null<MDNode>(N->getOperand(i))) + CreateMetadataSlot(Op); } //===----------------------------------------------------------------------===// @@ -1217,7 +1216,6 @@ public: AssemblyAnnotationWriter *AAW) : Out(o), Machine(Mac), TheModule(M), AnnotationWriter(AAW) { AddModuleTypesToPrinter(TypePrinter, NumberedTypes, M); - // FIXME: Provide MDPrinter if (M) M->getMDKindNames(MDNames); } @@ -1996,8 +1994,7 @@ void AssemblyWriter::writeAllMDNodes() { for (unsigned i = 0, e = Nodes.size(); i != e; ++i) { Out << '!' << i << " = metadata "; - const MDNode *Node = Nodes[i]; - printMDNodeBody(Node); + printMDNodeBody(Nodes[i]); } } |

