mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[StackNesting] NFC: Added helper.
Just pull the notion that the alloc corresponds to operand 0 into a helper method.
This commit is contained in:
@@ -153,10 +153,17 @@ private:
|
||||
/// Returns the location bit number for a stack deallocation instruction.
|
||||
int bitNumberForDealloc(SILInstruction *DeallocInst) {
|
||||
assert(DeallocInst->isDeallocatingStack());
|
||||
auto *AllocInst = cast<SingleValueInstruction>(DeallocInst->getOperand(0));
|
||||
auto *AllocInst = getAllocForDealloc(DeallocInst);
|
||||
return bitNumberForAlloc(AllocInst);
|
||||
}
|
||||
|
||||
/// Returns the stack allocation instruction for a stack deallocation
|
||||
/// instruction.
|
||||
SingleValueInstruction *getAllocForDealloc(SILInstruction *Dealloc) const {
|
||||
return cast<SingleValueInstruction>(
|
||||
Dealloc->getOperand(0)->getDefiningInstruction());
|
||||
}
|
||||
|
||||
/// Insert deallocations at block boundaries.
|
||||
Changes insertDeallocsAtBlockBoundaries();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user