mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[DebugInfo] [SILGen] Always use emitDebugDescription (NFCI)
This commit is contained in:
@@ -133,11 +133,11 @@ be dereferenced.
|
||||
debug_value %0 : $*T, var, name "value", expr op_deref
|
||||
```
|
||||
|
||||
SILGen can use `SILBuilder::createDebugValue` and
|
||||
`SILBuilder::createDebugValueAddr` to create debug values, respectively without
|
||||
and with an op_deref, or use `SILBuilder::emitDebugDescription` which will
|
||||
automatically choose the correct one depending on the type of the SSA value. As
|
||||
there are no pointers in Swift, this should always do the right thing.
|
||||
SILGen should always use `SILBuilder::emitDebugDescription` to create debug
|
||||
values, which will automatically add an op_deref depending on the type of the
|
||||
SSA value. As there are no pointers in Swift, this will always do the right
|
||||
thing. In SIL passes, use `SILBuilder::createDebugValue` to create debug values,
|
||||
or `SILBuilder::createDebugValueAddr` to add an op_deref.
|
||||
|
||||
> [!Warning]
|
||||
> At the optimizer level, Swift `Unsafe*Pointer` types can be simplified
|
||||
|
||||
@@ -1085,7 +1085,7 @@ public:
|
||||
}
|
||||
|
||||
/// Create a debug_value according to the type of \p src
|
||||
SILInstruction *emitDebugDescription(SILLocation Loc, SILValue src,
|
||||
DebugValueInst *emitDebugDescription(SILLocation Loc, SILValue src,
|
||||
SILDebugVariable Var) {
|
||||
if (src->getType().isAddress())
|
||||
return createDebugValueAddr(Loc, src, Var);
|
||||
|
||||
@@ -1163,7 +1163,7 @@ void SILGenFunction::emitClassConstructorInitializer(ConstructorDecl *ctor) {
|
||||
SILLocation PrologueLoc(selfDecl);
|
||||
PrologueLoc.markAsPrologue();
|
||||
SILDebugVariable DbgVar(selfDecl->isLet(), ++ArgNo);
|
||||
B.createDebugValue(PrologueLoc, selfArg.getValue(), DbgVar);
|
||||
B.emitDebugDescription(PrologueLoc, selfArg.getValue(), DbgVar);
|
||||
}
|
||||
|
||||
if (selfClassDecl->isRootDefaultActor() && !isDelegating) {
|
||||
@@ -1719,7 +1719,7 @@ void SILGenFunction::emitIVarInitializer(SILDeclRef ivarInitializer) {
|
||||
PrologueLoc.markAsPrologue();
|
||||
// Hard-code self as argument number 1.
|
||||
SILDebugVariable DbgVar(selfDecl->isLet(), 1);
|
||||
B.createDebugValue(PrologueLoc, selfArg, DbgVar);
|
||||
B.emitDebugDescription(PrologueLoc, selfArg, DbgVar);
|
||||
selfArg = B.createMarkUninitialized(selfDecl, selfArg,
|
||||
MarkUninitializedInst::RootSelf);
|
||||
assert(selfTy.hasReferenceSemantics() && "can't emit a value type ctor here");
|
||||
|
||||
@@ -77,7 +77,7 @@ SILValue SILGenFunction::emitSelfDeclForDestructor(VarDecl *selfDecl) {
|
||||
VarLocs[selfDecl] = VarLoc::get(selfValue);
|
||||
SILLocation PrologueLoc(selfDecl);
|
||||
PrologueLoc.markAsPrologue();
|
||||
B.createDebugValue(PrologueLoc, selfValue, dv);
|
||||
B.emitDebugDescription(PrologueLoc, selfValue, dv);
|
||||
return selfValue;
|
||||
}
|
||||
|
||||
@@ -697,7 +697,7 @@ private:
|
||||
"all paths or manually turn it off");
|
||||
};
|
||||
auto completeUpdate = [&](ManagedValue value) -> void {
|
||||
SGF.B.createDebugValue(loc, value.getValue(), varinfo);
|
||||
SGF.B.emitDebugDescription(loc, value.getValue(), varinfo);
|
||||
SGF.VarLocs[pd] = SILGenFunction::VarLoc::get(value.getValue());
|
||||
calledCompletedUpdate = true;
|
||||
};
|
||||
@@ -950,7 +950,7 @@ private:
|
||||
}
|
||||
|
||||
DebugValueInst *debugInst
|
||||
= SGF.B.createDebugValueAddr(loc, debugOperand, varinfo);
|
||||
= SGF.B.emitDebugDescription(loc, debugOperand, varinfo);
|
||||
|
||||
if (argrv.getValue() != debugOperand) {
|
||||
if (auto valueInst =
|
||||
@@ -1001,9 +1001,9 @@ private:
|
||||
// Emit debug information for the argument.
|
||||
SILDebugVariable DebugVar(PD->isLet(), ArgNo);
|
||||
if (argrv.getType().isAddress())
|
||||
SGF.B.createDebugValueAddr(loc, argrv.getValue(), DebugVar);
|
||||
SGF.B.emitDebugDescription(loc, argrv.getValue(), DebugVar);
|
||||
else
|
||||
SGF.B.createDebugValue(loc, argrv.getValue(), DebugVar);
|
||||
SGF.B.emitDebugDescription(loc, argrv.getValue(), DebugVar);
|
||||
}
|
||||
};
|
||||
} // end anonymous namespace
|
||||
@@ -1265,9 +1265,9 @@ static void emitCaptureArguments(SILGenFunction &SGF,
|
||||
if (auto *AllocStack = dyn_cast<AllocStackInst>(arg)) {
|
||||
AllocStack->setArgNo(ArgNo);
|
||||
} else if (box || ty.isAddress()) {
|
||||
SGF.B.createDebugValueAddr(Loc, arg, DbgVar);
|
||||
SGF.B.emitDebugDescription(Loc, arg, DbgVar);
|
||||
} else {
|
||||
SGF.B.createDebugValue(Loc, arg, DbgVar);
|
||||
SGF.B.emitDebugDescription(Loc, arg, DbgVar);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1537,7 +1537,7 @@ uint16_t SILGenFunction::emitBasicProlog(
|
||||
RegularLocation loc = RegularLocation::getAutoGeneratedLocation();
|
||||
if (throwsLoc.isValid())
|
||||
loc = throwsLoc;
|
||||
B.createDebugValue(loc, undef.getValue(), dbgVar);
|
||||
B.emitDebugDescription(loc, undef.getValue(), dbgVar);
|
||||
}
|
||||
|
||||
for (auto &i : *B.getInsertionBB()) {
|
||||
|
||||
Reference in New Issue
Block a user