summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/Metadata.cpp
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-01-12 20:13:56 +0000
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-01-12 20:13:56 +0000
commitac3128d901a28314eb2166cbdbc83b7d516e822f (patch)
treeaef37a33ed945b9e42375b69a340f0035241d5f3 /llvm/lib/IR/Metadata.cpp
parent822f041619d6935ae7942fdb3c219e1158bbe555 (diff)
downloadbcm5719-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.cpp12
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;
OpenPOWER on IntegriCloud