mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-24 23:28:41 +00:00
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225685 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -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;
|
||||
|
Reference in New Issue
Block a user