diff options
author | Devang Patel <dpatel@apple.com> | 2009-10-21 21:25:09 +0000 |
---|---|---|
committer | Devang Patel <dpatel@apple.com> | 2009-10-21 21:25:09 +0000 |
commit | 028fa77d560f18f364ae8a0bfd60597cf1968a93 (patch) | |
tree | a65e98486c6c13ada208388264df476bd2d41c03 /lib/VMCore/AsmWriter.cpp | |
parent | a55d33d96e022896f0cd5b17b81e4e6761770a3c (diff) | |
download | external_llvm-028fa77d560f18f364ae8a0bfd60597cf1968a93.zip external_llvm-028fa77d560f18f364ae8a0bfd60597cf1968a93.tar.gz external_llvm-028fa77d560f18f364ae8a0bfd60597cf1968a93.tar.bz2 |
Do not use SmallVector to store MDNode elements.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84784 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/AsmWriter.cpp')
-rw-r--r-- | lib/VMCore/AsmWriter.cpp | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/lib/VMCore/AsmWriter.cpp b/lib/VMCore/AsmWriter.cpp index b5ae81b..d2a0f90 100644 --- a/lib/VMCore/AsmWriter.cpp +++ b/lib/VMCore/AsmWriter.cpp @@ -818,9 +818,8 @@ void SlotTracker::CreateMetadataSlot(const MDNode *N) { unsigned DestSlot = mdnNext++; mdnMap[N] = DestSlot; - for (MDNode::const_elem_iterator MDI = N->elem_begin(), - MDE = N->elem_end(); MDI != MDE; ++MDI) { - const Value *TV = *MDI; + for (unsigned i = 0, e = N->getNumElements(); i != e; ++i) { + const Value *TV = N->getElement(i); if (TV) if (const MDNode *N2 = dyn_cast<MDNode>(TV)) CreateMetadataSlot(N2); @@ -906,9 +905,8 @@ static void WriteMDNodes(formatted_raw_ostream &Out, TypePrinting &TypePrinter, Out << '!' << i << " = metadata "; const MDNode *Node = Nodes[i]; Out << "!{"; - for (MDNode::const_elem_iterator NI = Node->elem_begin(), - NE = Node->elem_end(); NI != NE;) { - const Value *V = *NI; + for (unsigned mi = 0, me = Node->getNumElements(); mi != me; ++mi) { + const Value *V = Node->getElement(mi); if (!V) Out << "null"; else if (const MDNode *N = dyn_cast<MDNode>(V)) { @@ -916,11 +914,12 @@ static void WriteMDNodes(formatted_raw_ostream &Out, TypePrinting &TypePrinter, Out << '!' << Machine.getMetadataSlot(N); } else { - TypePrinter.print((*NI)->getType(), Out); + TypePrinter.print(V->getType(), Out); Out << ' '; - WriteAsOperandInternal(Out, *NI, &TypePrinter, &Machine); + WriteAsOperandInternal(Out, Node->getElement(mi), + &TypePrinter, &Machine); } - if (++NI != NE) + if (mi + 1 != me) Out << ", "; } |