rearrange some methods, no functionality change.

llvm-svn: 92219
This commit is contained in:
Chris Lattner 2009-12-28 09:12:35 +00:00
parent d944cf76de
commit f543eff71c
1 changed files with 14 additions and 13 deletions

View File

@ -89,24 +89,27 @@ void MDNodeElement::allUsesReplacedWith(Value *NV) {
// MDNode implementation.
//
/// ~MDNode - Destroy MDNode.
MDNode::~MDNode() {
LLVMContextImpl *pImpl = getType()->getContext().pImpl;
pImpl->MDNodeSet.RemoveNode(this);
delete [] Operands;
Operands = NULL;
}
MDNode::MDNode(LLVMContext &C, Value *const *Vals, unsigned NumVals,
bool isFunctionLocal)
: MetadataBase(Type::getMetadataTy(C), Value::MDNodeVal) {
NumOperands = NumVals;
Operands = new MDNodeElement[NumOperands];
MDNodeElement *Ptr = Operands;
for (unsigned i = 0; i != NumVals; ++i)
Ptr[i].set(Vals[i], this);
Operands[i].set(Vals[i], this);
if (isFunctionLocal)
SubclassData |= FunctionLocalBit;
}
void MDNode::Profile(FoldingSetNodeID &ID) const {
for (unsigned i = 0, e = getNumElements(); i != e; ++i)
ID.AddPointer(getElement(i));
}
MDNode *MDNode::get(LLVMContext &Context, Value*const* Vals, unsigned NumVals,
bool isFunctionLocal) {
LLVMContextImpl *pImpl = Context.pImpl;
@ -124,14 +127,12 @@ MDNode *MDNode::get(LLVMContext &Context, Value*const* Vals, unsigned NumVals,
return N;
}
/// ~MDNode - Destroy MDNode.
MDNode::~MDNode() {
LLVMContextImpl *pImpl = getType()->getContext().pImpl;
pImpl->MDNodeSet.RemoveNode(this);
delete [] Operands;
Operands = NULL;
void MDNode::Profile(FoldingSetNodeID &ID) const {
for (unsigned i = 0, e = getNumElements(); i != e; ++i)
ID.AddPointer(getElement(i));
}
/// getElement - Return specified element.
Value *MDNode::getElement(unsigned i) const {
assert(i < getNumElements() && "Invalid element number!");