// Replace each instance of F from the element list of this node with T.
void replaceElement(Value *F, Value *T);
- MDNodeElement *Node;
- unsigned NodeSize;
+ MDNodeElement *Operands;
+ unsigned NumOperands;
protected:
explicit MDNode(LLVMContext &C, Value *const *Vals, unsigned NumVals,
Value *getElement(unsigned i) const;
/// getNumElements - Return number of MDNode elements.
- unsigned getNumElements() const { return NodeSize; }
+ unsigned getNumElements() const { return NumOperands; }
/// isFunctionLocal - Return whether MDNode is local to a function.
/// Note: MDNodes are designated as function-local when created, and keep
MDNode::MDNode(LLVMContext &C, Value *const *Vals, unsigned NumVals,
bool isFunctionLocal)
: MetadataBase(Type::getMetadataTy(C), Value::MDNodeVal) {
- NodeSize = NumVals;
- Node = new MDNodeElement[NodeSize];
- MDNodeElement *Ptr = Node;
+ NumOperands = NumVals;
+ Operands = new MDNodeElement[NumOperands];
+ MDNodeElement *Ptr = Operands;
for (unsigned i = 0; i != NumVals; ++i)
- *Ptr++ = MDNodeElement(Vals[i], this);
+ Ptr[i] = MDNodeElement(Vals[i], this);
+
if (isFunctionLocal)
SubclassData |= FunctionLocalBit;
}
MDNode::~MDNode() {
LLVMContextImpl *pImpl = getType()->getContext().pImpl;
pImpl->MDNodeSet.RemoveNode(this);
- delete [] Node;
- Node = NULL;
+ delete [] Operands;
+ Operands = NULL;
}
/// getElement - Return specified element.
Value *MDNode::getElement(unsigned i) const {
assert(i < getNumElements() && "Invalid element number!");
- return Node[i];
+ return Operands[i];
}
// Replace From element(s) in place.
for (SmallVector<unsigned, 4>::iterator I = Indexes.begin(), E = Indexes.end();
I != E; ++I) {
- unsigned Index = *I;
- Node[Index] = MDNodeElement(To, this);
+ Operands[*I] = MDNodeElement(To, this);
}
// Insert updated "this" into the context's folding node set.