rename MDNode instance variables to something meaningful.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92216 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2009-12-28 08:48:12 +00:00
parent 5e9cd43423
commit dfdb5dcf56
2 changed files with 12 additions and 12 deletions

View File

@ -99,8 +99,8 @@ class MDNode : public MetadataBase, public FoldingSetNode {
// 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,
@ -117,7 +117,7 @@ public:
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

View File

@ -87,11 +87,12 @@ void MDNodeElement::allUsesReplacedWith(Value *NV) {
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;
}
@ -122,14 +123,14 @@ MDNode *MDNode::get(LLVMContext &Context, Value*const* Vals, unsigned NumVals,
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];
}
@ -161,8 +162,7 @@ void MDNode::replaceElement(Value *From, Value *To) {
// 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.