[llvm] [DWARF] Emit line 0 source locations for BB padding nops (PR #99496)
Paul T Robinson via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 26 06:12:45 PDT 2024
================
@@ -3668,3 +3668,19 @@ bool DwarfDebug::alwaysUseRanges(const DwarfCompileUnit &CU) const {
return true;
return false;
}
+
+void DwarfDebug::beginCodeAlignment(const MachineBasicBlock &MBB) {
+ auto *SP = MBB.getParent()->getFunction().getSubprogram();
+
+ bool NoDebug =
+ !SP || SP->getUnit()->getEmissionKind() == DICompileUnit::NoDebug;
+
+ if (NoDebug)
+ return;
+
+ auto PrevLoc = Asm->OutStreamer->getContext().getCurrentDwarfLoc();
+ Asm->OutStreamer->emitDwarfLocDirective(
+ PrevLoc.getFileNum(), 0, PrevLoc.getColumn(), 0, 0, 0, StringRef());
+ MCDwarfLineEntry::make(Asm->OutStreamer.get(),
----------------
pogo59 wrote:
OK, so because in this case we're looking at a .align directive rather than a real instruction, it won't be passing through `emitInstructionImpl()` so we need to call `MCDwarfLineEntry::make()` directly. Sounds reasonable.
https://github.com/llvm/llvm-project/pull/99496
More information about the llvm-commits
mailing list