diff options
author | Chris Lattner <sabre@nondot.org> | 2009-12-31 01:22:29 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-12-31 01:22:29 +0000 |
commit | 9b493028dff3c67f1d1419d8a3067a8f0a65f5dc (patch) | |
tree | 81a35c6e167e2eeab8dc901740d29de36c25b176 /llvm/lib/VMCore | |
parent | 8cb6c3476db18e9ba0ba6b6614945cb96e153ca2 (diff) | |
download | bcm5719-llvm-9b493028dff3c67f1d1419d8a3067a8f0a65f5dc.tar.gz bcm5719-llvm-9b493028dff3c67f1d1419d8a3067a8f0a65f5dc.zip |
rename "elements" of metadata to "operands". "Elements" are
things that occur in types. "operands" are things that occur
in values.
llvm-svn: 92322
Diffstat (limited to 'llvm/lib/VMCore')
-rw-r--r-- | llvm/lib/VMCore/AsmWriter.cpp | 38 | ||||
-rw-r--r-- | llvm/lib/VMCore/IntrinsicInst.cpp | 4 | ||||
-rw-r--r-- | llvm/lib/VMCore/Metadata.cpp | 70 | ||||
-rw-r--r-- | llvm/lib/VMCore/Verifier.cpp | 4 |
4 files changed, 58 insertions, 58 deletions
diff --git a/llvm/lib/VMCore/AsmWriter.cpp b/llvm/lib/VMCore/AsmWriter.cpp index c0918c22c8f..e44b182d6dc 100644 --- a/llvm/lib/VMCore/AsmWriter.cpp +++ b/llvm/lib/VMCore/AsmWriter.cpp @@ -648,8 +648,8 @@ void SlotTracker::processModule() { I = TheModule->named_metadata_begin(), E = TheModule->named_metadata_end(); I != E; ++I) { const NamedMDNode *NMD = I; - for (unsigned i = 0, e = NMD->getNumElements(); i != e; ++i) { - MDNode *MD = dyn_cast_or_null<MDNode>(NMD->getElement(i)); + for (unsigned i = 0, e = NMD->getNumOperands(); i != e; ++i) { + MDNode *MD = dyn_cast_or_null<MDNode>(NMD->getOperand(i)); if (MD) CreateMetadataSlot(MD); } @@ -722,8 +722,8 @@ void SlotTracker::processMDNode() { void SlotTracker::processNamedMDNode() { ST_DEBUG("begin processNamedMDNode!\n"); mdnNext = 0; - for (unsigned i = 0, e = TheNamedMDNode->getNumElements(); i != e; ++i) { - MDNode *MD = dyn_cast_or_null<MDNode>(TheNamedMDNode->getElement(i)); + for (unsigned i = 0, e = TheNamedMDNode->getNumOperands(); i != e; ++i) { + MDNode *MD = dyn_cast_or_null<MDNode>(TheNamedMDNode->getOperand(i)); if (MD) CreateMetadataSlot(MD); } @@ -819,8 +819,8 @@ void SlotTracker::CreateMetadataSlot(const MDNode *N) { unsigned DestSlot = mdnNext++; mdnMap[N] = DestSlot; - for (unsigned i = 0, e = N->getNumElements(); i != e; ++i) { - const Value *TV = N->getElement(i); + 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); @@ -872,9 +872,9 @@ static const char *getPredicateText(unsigned predicate) { static void WriteMDNodeComment(const MDNode *Node, formatted_raw_ostream &Out) { - if (Node->getNumElements() < 1) + if (Node->getNumOperands() < 1) return; - ConstantInt *CI = dyn_cast_or_null<ConstantInt>(Node->getElement(0)); + ConstantInt *CI = dyn_cast_or_null<ConstantInt>(Node->getOperand(0)); if (!CI) return; unsigned Val = CI->getZExtValue(); unsigned Tag = Val & ~LLVMDebugVersionMask; @@ -908,8 +908,8 @@ static void WriteMDNodes(formatted_raw_ostream &Out, TypePrinting &TypePrinter, Out << '!' << i << " = metadata "; const MDNode *Node = Nodes[i]; Out << "!{"; - for (unsigned mi = 0, me = Node->getNumElements(); mi != me; ++mi) { - const Value *V = Node->getElement(mi); + for (unsigned mi = 0, me = Node->getNumOperands(); mi != me; ++mi) { + const Value *V = Node->getOperand(mi); if (!V) Out << "null"; else if (const MDNode *N = dyn_cast<MDNode>(V)) { @@ -919,7 +919,7 @@ static void WriteMDNodes(formatted_raw_ostream &Out, TypePrinting &TypePrinter, else { TypePrinter.print(V->getType(), Out); Out << ' '; - WriteAsOperandInternal(Out, Node->getElement(mi), + WriteAsOperandInternal(Out, Node->getOperand(mi), &TypePrinter, &Machine); } if (mi + 1 != me) @@ -1231,14 +1231,14 @@ static void WriteAsOperandInternal(raw_ostream &Out, const Value *V, if (N->isFunctionLocal()) { // Print metadata inline, not via slot reference number. Out << "!{"; - for (unsigned mi = 0, me = N->getNumElements(); mi != me; ++mi) { - const Value *Val = N->getElement(mi); + for (unsigned mi = 0, me = N->getNumOperands(); mi != me; ++mi) { + const Value *Val = N->getOperand(mi); if (!Val) Out << "null"; else { - TypePrinter->print(N->getElement(0)->getType(), Out); + TypePrinter->print(N->getOperand(0)->getType(), Out); Out << ' '; - WriteAsOperandInternal(Out, N->getElement(0), TypePrinter, Machine); + WriteAsOperandInternal(Out, N->getOperand(0), TypePrinter, Machine); } if (mi + 1 != me) Out << ", "; @@ -1478,9 +1478,9 @@ void AssemblyWriter::printModule(const Module *M) { E = M->named_metadata_end(); I != E; ++I) { const NamedMDNode *NMD = I; Out << "!" << NMD->getName() << " = !{"; - for (unsigned i = 0, e = NMD->getNumElements(); i != e; ++i) { + for (unsigned i = 0, e = NMD->getNumOperands(); i != e; ++i) { if (i) Out << ", "; - MDNode *MD = dyn_cast_or_null<MDNode>(NMD->getElement(i)); + MDNode *MD = dyn_cast_or_null<MDNode>(NMD->getOperand(i)); Out << '!' << Machine.getMetadataSlot(MD); } Out << "}\n"; @@ -2138,9 +2138,9 @@ void Value::print(raw_ostream &ROS, AssemblyAnnotationWriter *AAW) const { TypePrinting TypePrinter; SlotTable.initialize(); OS << "!" << N->getName() << " = !{"; - for (unsigned i = 0, e = N->getNumElements(); i != e; ++i) { + for (unsigned i = 0, e = N->getNumOperands(); i != e; ++i) { if (i) OS << ", "; - MDNode *MD = dyn_cast_or_null<MDNode>(N->getElement(i)); + MDNode *MD = dyn_cast_or_null<MDNode>(N->getOperand(i)); if (MD) OS << '!' << SlotTable.getMetadataSlot(MD); else diff --git a/llvm/lib/VMCore/IntrinsicInst.cpp b/llvm/lib/VMCore/IntrinsicInst.cpp index 5f33d0eebb9..b508f6b4ca9 100644 --- a/llvm/lib/VMCore/IntrinsicInst.cpp +++ b/llvm/lib/VMCore/IntrinsicInst.cpp @@ -61,11 +61,11 @@ Value *DbgInfoIntrinsic::StripCast(Value *C) { Value *DbgStopPointInst::getFileName() const { // Once the operand indices are verified, update this assert assert(LLVMDebugVersion == (7 << 16) && "Verify operand indices"); - return getContext()->getElement(3); + return getContext()->getOperand(3); } Value *DbgStopPointInst::getDirectory() const { // Once the operand indices are verified, update this assert assert(LLVMDebugVersion == (7 << 16) && "Verify operand indices"); - return getContext()->getElement(4); + return getContext()->getOperand(4); } diff --git a/llvm/lib/VMCore/Metadata.cpp b/llvm/lib/VMCore/Metadata.cpp index 413a1b6170d..8e9aab93a14 100644 --- a/llvm/lib/VMCore/Metadata.cpp +++ b/llvm/lib/VMCore/Metadata.cpp @@ -48,16 +48,16 @@ MDString *MDString::get(LLVMContext &Context, const char *Str) { } //===----------------------------------------------------------------------===// -// MDNodeElement implementation. +// MDNodeOperand implementation. // -// Use CallbackVH to hold MDNode elements. +// Use CallbackVH to hold MDNode operands. namespace llvm { -class MDNodeElement : public CallbackVH { +class MDNodeOperand : public CallbackVH { MDNode *Parent; public: - MDNodeElement(Value *V, MDNode *P) : CallbackVH(V), Parent(P) {} - ~MDNodeElement() {} + MDNodeOperand(Value *V, MDNode *P) : CallbackVH(V), Parent(P) {} + ~MDNodeOperand() {} void set(Value *V) { setValPtr(V); @@ -69,12 +69,12 @@ public: } // end namespace llvm. -void MDNodeElement::deleted() { - Parent->replaceElement(this, 0); +void MDNodeOperand::deleted() { + Parent->replaceOperand(this, 0); } -void MDNodeElement::allUsesReplacedWith(Value *NV) { - Parent->replaceElement(this, NV); +void MDNodeOperand::allUsesReplacedWith(Value *NV) { + Parent->replaceOperand(this, NV); } @@ -83,11 +83,11 @@ void MDNodeElement::allUsesReplacedWith(Value *NV) { // MDNode implementation. // -/// getOperandPtr - Helper function to get the MDNodeElement's coallocated on +/// getOperandPtr - Helper function to get the MDNodeOperand's coallocated on /// the end of the MDNode. -static MDNodeElement *getOperandPtr(MDNode *N, unsigned Op) { - assert(Op < N->getNumElements() && "Invalid operand number"); - return reinterpret_cast<MDNodeElement*>(N+1)+Op; +static MDNodeOperand *getOperandPtr(MDNode *N, unsigned Op) { + assert(Op < N->getNumOperands() && "Invalid operand number"); + return reinterpret_cast<MDNodeOperand*>(N+1)+Op; } MDNode::MDNode(LLVMContext &C, Value *const *Vals, unsigned NumVals, @@ -99,9 +99,9 @@ MDNode::MDNode(LLVMContext &C, Value *const *Vals, unsigned NumVals, setValueSubclassData(getSubclassDataFromValue() | FunctionLocalBit); // Initialize the operand list, which is co-allocated on the end of the node. - for (MDNodeElement *Op = getOperandPtr(this, 0), *E = Op+NumOperands; + for (MDNodeOperand *Op = getOperandPtr(this, 0), *E = Op+NumOperands; Op != E; ++Op, ++Vals) - new (Op) MDNodeElement(*Vals, this); + new (Op) MDNodeOperand(*Vals, this); } @@ -115,9 +115,9 @@ MDNode::~MDNode() { } // Destroy the operands. - for (MDNodeElement *Op = getOperandPtr(this, 0), *E = Op+NumOperands; + for (MDNodeOperand *Op = getOperandPtr(this, 0), *E = Op+NumOperands; Op != E; ++Op) - Op->~MDNodeElement(); + Op->~MDNodeOperand(); } // destroy - Delete this node. Only when there are no uses. @@ -139,8 +139,8 @@ MDNode *MDNode::get(LLVMContext &Context, Value*const* Vals, unsigned NumVals, void *InsertPoint; MDNode *N = pImpl->MDNodeSet.FindNodeOrInsertPos(ID, InsertPoint); if (!N) { - // Coallocate space for the node and elements together, then placement new. - void *Ptr = malloc(sizeof(MDNode)+NumVals*sizeof(MDNodeElement)); + // Coallocate space for the node and Operands together, then placement new. + void *Ptr = malloc(sizeof(MDNode)+NumVals*sizeof(MDNodeOperand)); N = new (Ptr) MDNode(Context, Vals, NumVals, isFunctionLocal); // InsertPoint will have been set by the FindNodeOrInsertPos call. @@ -149,19 +149,19 @@ MDNode *MDNode::get(LLVMContext &Context, Value*const* Vals, unsigned NumVals, return N; } -/// getElement - Return specified element. -Value *MDNode::getElement(unsigned i) const { +/// getOperand - Return specified operand. +Value *MDNode::getOperand(unsigned i) const { return *getOperandPtr(const_cast<MDNode*>(this), i); } void MDNode::Profile(FoldingSetNodeID &ID) const { - for (unsigned i = 0, e = getNumElements(); i != e; ++i) - ID.AddPointer(getElement(i)); + for (unsigned i = 0, e = getNumOperands(); i != e; ++i) + ID.AddPointer(getOperand(i)); } -// Replace value from this node's element list. -void MDNode::replaceElement(MDNodeElement *Op, Value *To) { +// Replace value from this node's operand list. +void MDNode::replaceOperand(MDNodeOperand *Op, Value *To) { Value *From = *Op; if (From == To) @@ -233,10 +233,10 @@ NamedMDNode::NamedMDNode(LLVMContext &C, const Twine &N, NamedMDNode *NamedMDNode::Create(const NamedMDNode *NMD, Module *M) { assert(NMD && "Invalid source NamedMDNode!"); SmallVector<MetadataBase *, 4> Elems; - Elems.reserve(NMD->getNumElements()); + Elems.reserve(NMD->getNumOperands()); - for (unsigned i = 0, e = NMD->getNumElements(); i != e; ++i) - Elems.push_back(NMD->getElement(i)); + for (unsigned i = 0, e = NMD->getNumOperands(); i != e; ++i) + Elems.push_back(NMD->getOperand(i)); return new NamedMDNode(NMD->getContext(), NMD->getName().data(), Elems.data(), Elems.size(), M); } @@ -246,19 +246,19 @@ NamedMDNode::~NamedMDNode() { delete &getNMDOps(Operands); } -/// getNumElements - Return number of NamedMDNode elements. -unsigned NamedMDNode::getNumElements() const { +/// getNumOperands - Return number of NamedMDNode operands. +unsigned NamedMDNode::getNumOperands() const { return (unsigned)getNMDOps(Operands).size(); } -/// getElement - Return specified element. -MetadataBase *NamedMDNode::getElement(unsigned i) const { - assert(i < getNumElements() && "Invalid element number!"); +/// getOperand - Return specified operand. +MetadataBase *NamedMDNode::getOperand(unsigned i) const { + assert(i < getNumOperands() && "Invalid Operand number!"); return getNMDOps(Operands)[i]; } -/// addElement - Add metadata element. -void NamedMDNode::addElement(MetadataBase *M) { +/// addOperand - Add metadata Operand. +void NamedMDNode::addOperand(MetadataBase *M) { getNMDOps(Operands).push_back(TrackingVH<MetadataBase>(M)); } diff --git a/llvm/lib/VMCore/Verifier.cpp b/llvm/lib/VMCore/Verifier.cpp index b7e87711ae4..30528bfebde 100644 --- a/llvm/lib/VMCore/Verifier.cpp +++ b/llvm/lib/VMCore/Verifier.cpp @@ -1538,8 +1538,8 @@ void Verifier::VerifyFunctionLocalMetadata(MDNode *N, Function *F, if (!Visited.insert(N)) return; - for (unsigned i = 0, e = N->getNumElements(); i != e; ++i) { - Value *V = N->getElement(i); + for (unsigned i = 0, e = N->getNumOperands(); i != e; ++i) { + Value *V = N->getOperand(i); if (!V) continue; Function *ActualF = 0; |