mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Rename SILBuilder::emitDestroyAddr => SILBuilder::emitDestroyAddrAndFold.
Now it matches SILBuilder::emit{StrongRelease,ReleaseValue}AndFold which perform
the same operation but on object types.
Swift SVN r27806
This commit is contained in:
@@ -1140,7 +1140,7 @@ public:
|
|||||||
/// Try to fold a destroy_addr operation into the previous instructions, or
|
/// Try to fold a destroy_addr operation into the previous instructions, or
|
||||||
/// generate an explicit one if that fails. If this inserts a new
|
/// generate an explicit one if that fails. If this inserts a new
|
||||||
/// instruction, it returns it, otherwise it returns null.
|
/// instruction, it returns it, otherwise it returns null.
|
||||||
DestroyAddrInst *emitDestroyAddr(SILLocation Loc, SILValue Operand);
|
DestroyAddrInst *emitDestroyAddrAndFold(SILLocation Loc, SILValue Operand);
|
||||||
|
|
||||||
/// Perform a strong_release instruction at the current location, attempting
|
/// Perform a strong_release instruction at the current location, attempting
|
||||||
/// to fold it locally into nearby retain instructions or emitting an explicit
|
/// to fold it locally into nearby retain instructions or emitting an explicit
|
||||||
|
|||||||
@@ -92,7 +92,8 @@ SILBasicBlock *SILBuilder::splitBlockForFallthrough() {
|
|||||||
/// emitDestroyAddr - Try to fold a destroy_addr operation into the previous
|
/// emitDestroyAddr - Try to fold a destroy_addr operation into the previous
|
||||||
/// instructions, or generate an explicit one if that fails. If this inserts a
|
/// instructions, or generate an explicit one if that fails. If this inserts a
|
||||||
/// new instruction, it returns it, otherwise it returns null.
|
/// new instruction, it returns it, otherwise it returns null.
|
||||||
DestroyAddrInst *SILBuilder::emitDestroyAddr(SILLocation Loc, SILValue Operand){
|
DestroyAddrInst *SILBuilder::emitDestroyAddrAndFold(SILLocation Loc,
|
||||||
|
SILValue Operand) {
|
||||||
// Check to see if the instruction immediately before the insertion point is a
|
// Check to see if the instruction immediately before the insertion point is a
|
||||||
// copy_addr from the specified operand. If so, we can fold this into the
|
// copy_addr from the specified operand. If so, we can fold this into the
|
||||||
// copy_addr as a take.
|
// copy_addr as a take.
|
||||||
|
|||||||
@@ -887,12 +887,12 @@ namespace {
|
|||||||
|
|
||||||
void emitDestroyAddress(SILBuilder &B, SILLocation loc,
|
void emitDestroyAddress(SILBuilder &B, SILLocation loc,
|
||||||
SILValue addr) const override {
|
SILValue addr) const override {
|
||||||
B.emitDestroyAddr(loc, addr);
|
B.emitDestroyAddrAndFold(loc, addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void emitDestroyRValue(SILBuilder &B, SILLocation loc,
|
void emitDestroyRValue(SILBuilder &B, SILLocation loc,
|
||||||
SILValue value) const override {
|
SILValue value) const override {
|
||||||
B.emitDestroyAddr(loc, value);
|
B.emitDestroyAddrAndFold(loc, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void emitRetainValue(SILBuilder &B, SILLocation loc,
|
void emitRetainValue(SILBuilder &B, SILLocation loc,
|
||||||
|
|||||||
@@ -220,7 +220,7 @@ static ManagedValue emitBuiltinDestroy(SILGenFunction &gen,
|
|||||||
|
|
||||||
// Destroy the value indirectly. Canonicalization will promote to loads
|
// Destroy the value indirectly. Canonicalization will promote to loads
|
||||||
// and releases if appropriate.
|
// and releases if appropriate.
|
||||||
gen.B.emitDestroyAddr(loc, addr);
|
gen.B.emitDestroyAddrAndFold(loc, addr);
|
||||||
|
|
||||||
return ManagedValue::forUnmanaged(gen.emitEmptyTuple(loc));
|
return ManagedValue::forUnmanaged(gen.emitEmptyTuple(loc));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -218,7 +218,7 @@ public:
|
|||||||
|
|
||||||
void emit(SILGenFunction &gen, CleanupLocation l) override {
|
void emit(SILGenFunction &gen, CleanupLocation l) override {
|
||||||
if (v.getType().isAddress())
|
if (v.getType().isAddress())
|
||||||
gen.B.emitDestroyAddr(l, v);
|
gen.B.emitDestroyAddrAndFold(l, v);
|
||||||
else
|
else
|
||||||
gen.B.emitReleaseValueOperation(l, v);
|
gen.B.emitReleaseValueOperation(l, v);
|
||||||
}
|
}
|
||||||
@@ -1193,7 +1193,7 @@ void SILGenFunction::destroyLocalVariable(SILLocation silLoc, VarDecl *vd) {
|
|||||||
if (!Val.getType().isAddress())
|
if (!Val.getType().isAddress())
|
||||||
B.emitReleaseValueOperation(silLoc, Val);
|
B.emitReleaseValueOperation(silLoc, Val);
|
||||||
else
|
else
|
||||||
B.emitDestroyAddr(silLoc, Val);
|
B.emitDestroyAddrAndFold(silLoc, Val);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SILGenFunction::deallocateUninitializedLocalVariable(SILLocation silLoc,
|
void SILGenFunction::deallocateUninitializedLocalVariable(SILLocation silLoc,
|
||||||
|
|||||||
@@ -134,7 +134,7 @@ void SILGenFunction::emitClassMemberDestruction(SILValue selfValue,
|
|||||||
if (!ti.isTrivial()) {
|
if (!ti.isTrivial()) {
|
||||||
SILValue addr = B.createRefElementAddr(cleanupLoc, selfValue, vd,
|
SILValue addr = B.createRefElementAddr(cleanupLoc, selfValue, vd,
|
||||||
ti.getLoweredType().getAddressType());
|
ti.getLoweredType().getAddressType());
|
||||||
B.emitDestroyAddr(cleanupLoc, addr);
|
B.emitDestroyAddrAndFold(cleanupLoc, addr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -433,7 +433,7 @@ static bool rewriteAllocBoxAsAllocStack(AllocBoxInst *ABI,
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
SILBuilderWithScope<1> BuildDestroy(LastRelease);
|
SILBuilderWithScope<1> BuildDestroy(LastRelease);
|
||||||
BuildDestroy.emitDestroyAddr(Loc, PointerResult);
|
BuildDestroy.emitDestroyAddrAndFold(Loc, PointerResult);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1581,7 +1581,7 @@ SILValue LifetimeChecker::handleConditionalInitAssign() {
|
|||||||
// Emit a destroy_addr in the taken block.
|
// Emit a destroy_addr in the taken block.
|
||||||
B.setInsertionPoint(TrueBB->begin());
|
B.setInsertionPoint(TrueBB->begin());
|
||||||
SILValue EltPtr = TheMemory.emitElementAddress(Elt, Loc, B);
|
SILValue EltPtr = TheMemory.emitElementAddress(Elt, Loc, B);
|
||||||
if (auto *DA = B.emitDestroyAddr(Loc, EltPtr))
|
if (auto *DA = B.emitDestroyAddrAndFold(Loc, EltPtr))
|
||||||
Releases.push_back(DA);
|
Releases.push_back(DA);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1654,7 +1654,7 @@ handleConditionalDestroys(SILValue ControlVariableAddr) {
|
|||||||
// destroy its value at releases position.
|
// destroy its value at releases position.
|
||||||
B.setInsertionPoint(Release);
|
B.setInsertionPoint(Release);
|
||||||
SILValue EltPtr = TheMemory.emitElementAddress(Elt, Loc, B);
|
SILValue EltPtr = TheMemory.emitElementAddress(Elt, Loc, B);
|
||||||
if (auto *DA = B.emitDestroyAddr(Release->getLoc(), EltPtr))
|
if (auto *DA = B.emitDestroyAddrAndFold(Release->getLoc(), EltPtr))
|
||||||
Releases.push_back(DA);
|
Releases.push_back(DA);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -1701,7 +1701,7 @@ handleConditionalDestroys(SILValue ControlVariableAddr) {
|
|||||||
// Set up the conditional destroy block.
|
// Set up the conditional destroy block.
|
||||||
B.setInsertionPoint(CondDestroyBlock->begin());
|
B.setInsertionPoint(CondDestroyBlock->begin());
|
||||||
SILValue EltPtr = TheMemory.emitElementAddress(Elt, Loc, B);
|
SILValue EltPtr = TheMemory.emitElementAddress(Elt, Loc, B);
|
||||||
if (auto *DA = B.emitDestroyAddr(Loc, EltPtr))
|
if (auto *DA = B.emitDestroyAddrAndFold(Loc, EltPtr))
|
||||||
Releases.push_back(DA);
|
Releases.push_back(DA);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -632,7 +632,7 @@ void swift::releasePartialApplyCapturedArg(SILBuilder &Builder, SILLocation Loc,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
SILInstruction *NewInst = Builder.emitDestroyAddr(Loc, Arg);
|
SILInstruction *NewInst = Builder.emitDestroyAddrAndFold(Loc, Arg);
|
||||||
Callbacks.CreatedNewInst(NewInst);
|
Callbacks.CreatedNewInst(NewInst);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user