From ac3128d901a28314eb2166cbdbc83b7d516e822f Mon Sep 17 00:00:00 2001 From: "Duncan P. N. Exon Smith" Date: Mon, 12 Jan 2015 20:13:56 +0000 Subject: IR: Move creation logic down to MDTuple, NFC Move creation logic for `MDTuple`s down where it belongs. Once there are a few more subclasses, these functions really won't make much sense here (the `friend` relationship was already awkward). For now, leave the `MDNode` versions around, but have it forward down. llvm-svn: 225685 --- llvm/lib/IR/Metadata.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'llvm/lib/IR/Metadata.cpp') diff --git a/llvm/lib/IR/Metadata.cpp b/llvm/lib/IR/Metadata.cpp index 8ff46735757..3d444660c67 100644 --- a/llvm/lib/IR/Metadata.cpp +++ b/llvm/lib/IR/Metadata.cpp @@ -581,15 +581,15 @@ void UniquableMDNode::handleChangedOperand(void *Ref, Metadata *New) { storeDistinctInContext(); } -MDNode *MDNode::getMDNode(LLVMContext &Context, ArrayRef MDs, - bool Insert) { - auto &Store = Context.pImpl->MDTuples; - +MDTuple *MDTuple::getImpl(LLVMContext &Context, ArrayRef MDs, + bool ShouldCreate) { MDTupleInfo::KeyTy Key(MDs); + + auto &Store = Context.pImpl->MDTuples; auto I = Store.find_as(Key); if (I != Store.end()) return *I; - if (!Insert) + if (!ShouldCreate) return nullptr; // Coallocate space for the node and Operands together, then placement new. @@ -599,7 +599,7 @@ MDNode *MDNode::getMDNode(LLVMContext &Context, ArrayRef MDs, return N; } -MDNode *MDNode::getDistinct(LLVMContext &Context, ArrayRef MDs) { +MDTuple *MDTuple::getDistinct(LLVMContext &Context, ArrayRef MDs) { auto *N = new (MDs.size()) MDTuple(Context, MDs, /* AllowRAUW */ false); N->storeDistinctInContext(); return N; -- cgit v1.2.3