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