[PATCH] D147506: [DebugLine] save one debug line entry for empty prologue
ChenZheng via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 26 19:36:37 PDT 2023
shchenz added a comment.
> That way if two recordSourceLine calls happen with no instruction between them, no emitDwarfLocDirective is called - but on the next insntruction that's emitted, the source line info would be emitted at that point.
recordSourceLine() {
this->lineInfo = {line, file};
}
beginInstruction() {
if (this->lineInfo) {
emitDwarfLocDirective(this->lineInfo)
this->lineInfo = std::nullopt;
}
...
}
Thanks! I know your point now. This should be able to handle duplicated lines for the empty prologue case. But seems it also has same issue for the case when generating `loc` for instructions. (Currently, when starting to handle instructions, `recordSourceLine` is always called by a new instruction emitting, so there are always instructions between two `recordSourceLine()` calls in `beginInstruction()`). For example:
Inst1; // line1
Inst2; // line2
When handle `Inst1`, in the `DwarfDebug::beginInstruction()`, the line info for `Inst1` is cached to `this->lineInfo()` in `recordSourceLine()` and then `Inst1` is emitted to assembly file. This delay will cause issue, `loc` for `Inst1` is supposed to be in front of `Inst1`. Even at the very beginning of `beginInstruction()` for `Instr2`, we call `emitDwarfLocDirective()` for `Inst1`, it is still put the `.loc` after `Inst1`.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D147506/new/
https://reviews.llvm.org/D147506
More information about the llvm-commits
mailing list