mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[SIL] Use SubstitutionMap in KeyPathInst rather than SubstitutionList.
This commit is contained in:
@@ -2253,31 +2253,28 @@ void KeyPathPattern::Profile(llvm::FoldingSetNodeID &ID,
|
||||
KeyPathInst *
|
||||
KeyPathInst::create(SILDebugLocation Loc,
|
||||
KeyPathPattern *Pattern,
|
||||
SubstitutionList Subs,
|
||||
SubstitutionMap Subs,
|
||||
ArrayRef<SILValue> Args,
|
||||
SILType Ty,
|
||||
SILFunction &F) {
|
||||
assert(Args.size() == Pattern->getNumOperands()
|
||||
&& "number of key path args doesn't match pattern");
|
||||
|
||||
auto totalSize = totalSizeToAlloc<Substitution, Operand>
|
||||
(Subs.size(), Args.size());
|
||||
void *mem = F.getModule().allocateInst(totalSize, alignof(Substitution));
|
||||
auto totalSize = totalSizeToAlloc<Operand>(Args.size());
|
||||
void *mem = F.getModule().allocateInst(totalSize, alignof(KeyPathInst));
|
||||
return ::new (mem) KeyPathInst(Loc, Pattern, Subs, Args, Ty);
|
||||
}
|
||||
|
||||
KeyPathInst::KeyPathInst(SILDebugLocation Loc,
|
||||
KeyPathPattern *Pattern,
|
||||
SubstitutionList Subs,
|
||||
SubstitutionMap Subs,
|
||||
ArrayRef<SILValue> Args,
|
||||
SILType Ty)
|
||||
: InstructionBase(Loc, Ty),
|
||||
Pattern(Pattern), NumSubstitutions(Subs.size()),
|
||||
NumOperands(Pattern->getNumOperands())
|
||||
Pattern(Pattern),
|
||||
NumOperands(Pattern->getNumOperands()),
|
||||
Substitutions(Subs)
|
||||
{
|
||||
auto *subsBuf = getTrailingObjects<Substitution>();
|
||||
std::uninitialized_copy(Subs.begin(), Subs.end(), subsBuf);
|
||||
|
||||
auto *operandsBuf = getTrailingObjects<Operand>();
|
||||
for (unsigned i = 0; i < Args.size(); ++i) {
|
||||
::new ((void*)&operandsBuf[i]) Operand(this, Args[i]);
|
||||
@@ -2289,11 +2286,6 @@ KeyPathInst::KeyPathInst(SILDebugLocation Loc,
|
||||
}
|
||||
}
|
||||
|
||||
MutableArrayRef<Substitution>
|
||||
KeyPathInst::getSubstitutions() {
|
||||
return {getTrailingObjects<Substitution>(), NumSubstitutions};
|
||||
}
|
||||
|
||||
MutableArrayRef<Operand>
|
||||
KeyPathInst::getAllOperands() {
|
||||
return {getTrailingObjects<Operand>(), NumOperands};
|
||||
|
||||
Reference in New Issue
Block a user