diff options
author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2015-01-12 20:13:56 +0000 |
---|---|---|
committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2015-01-12 20:13:56 +0000 |
commit | ac3128d901a28314eb2166cbdbc83b7d516e822f (patch) | |
tree | aef37a33ed945b9e42375b69a340f0035241d5f3 /llvm/lib/IR/Metadata.cpp | |
parent | 822f041619d6935ae7942fdb3c219e1158bbe555 (diff) | |
download | bcm5719-llvm-ac3128d901a28314eb2166cbdbc83b7d516e822f.tar.gz bcm5719-llvm-ac3128d901a28314eb2166cbdbc83b7d516e822f.zip |
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
Diffstat (limited to 'llvm/lib/IR/Metadata.cpp')
-rw-r--r-- | llvm/lib/IR/Metadata.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
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<Metadata *> MDs, - bool Insert) { - auto &Store = Context.pImpl->MDTuples; - +MDTuple *MDTuple::getImpl(LLVMContext &Context, ArrayRef<Metadata *> 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<Metadata *> MDs, return N; } -MDNode *MDNode::getDistinct(LLVMContext &Context, ArrayRef<Metadata *> MDs) { +MDTuple *MDTuple::getDistinct(LLVMContext &Context, ArrayRef<Metadata *> MDs) { auto *N = new (MDs.size()) MDTuple(Context, MDs, /* AllowRAUW */ false); N->storeDistinctInContext(); return N; |