I am investigating the feasibility of using DBG_INSTR_REF
for WebAssembly backend. I have a few basic questions:
-
Instruction referencing for debug info — LLVM 17.0.0git documentation says we should use
MachineFunction::substituteDebugValuesForInst()
when an instruction is replaced andMachineInstr::dropDebugNumber()
when an instruction computing a value is dropped. But it looks there are very few usages of these methods in the codebase, and close to none withinlib/CodeGen
:
aheejin@aheejin:~/llvm-project/llvm/lib$ grep substituteDebugValuesForInst * -R
CodeGen/InlineSpiller.cpp: MF.substituteDebugValuesForInst(*MI, *FoldMI, Ops[0].second);
CodeGen/MachineFunction.cpp:void MachineFunction::substituteDebugValuesForInst(const MachineInstr &Old,
Target/X86/X86FixupLEAs.cpp: MBB.getParent()->substituteDebugValuesForInst(*AluI, *NewMI2, 1);
Target/X86/X86FixupLEAs.cpp: MBB.getParent()->substituteDebugValuesForInst(*I, *NewMI, 1);
Target/X86/X86FixupLEAs.cpp: MBB.getParent()->substituteDebugValuesForInst(*MBI, *NewMI, 1);
Target/X86/X86FixupLEAs.cpp: MBB.getParent()->substituteDebugValuesForInst(*I, *NewMI, 1);
Target/X86/X86FixupLEAs.cpp: MBB.getParent()->substituteDebugValuesForInst(*I, *NewMI, 1);
Target/X86/X86FixupLEAs.cpp: MBB.getParent()->substituteDebugValuesForInst(*I, *NewMI, 1);
Target/X86/X86FixupLEAs.cpp: MBB.getParent()->substituteDebugValuesForInst(*I, *NewMI, 1);
Target/X86/X86FixupLEAs.cpp: MBB.getParent()->substituteDebugValuesForInst(*I, *NewMI, 1);
aheejin@aheejin:~/llvm-project/llvm/lib$ grep dropDebugNumber * -R
Target/X86/X86InstrInfo.cpp: CmpInstr.dropDebugNumber();
Target/X86/X86FloatingPoint.cpp: MI.dropDebugNumber();
Target/X86/X86FloatingPoint.cpp: I->dropDebugNumber();
Target/X86/X86FloatingPoint.cpp: MI.dropDebugNumber();
Target/X86/X86FloatingPoint.cpp: MI.dropDebugNumber();
Target/X86/X86FloatingPoint.cpp: MI.dropDebugNumber();
Target/X86/X86FloatingPoint.cpp: MI.dropDebugNumber();
Target/X86/X86FloatingPoint.cpp: MI.dropDebugNumber();
I was mostly looking for usages for these methods to learn how I should do the required maintenance in each of our WebAssembly backend passes, but found not much. Is this because there is very little maintenance required in the optimization passes to use DBG_INSTR_REF
? There are not many cases of instructions being replaced or dropped?
-
Instruction referencing for debug info — LLVM 17.0.0git documentation says cloning is not yet supported. Is this still the case?
-
I was told in How should I manage DBG_VALUEs when its def moves? - #7 by StephenTozer that I don’t need to move
DBG_INSTR_REF
s along with their defs in transformation passes. Is this true even if aDBG_INSTR_REF
becomes not dominated by its def as a result of the def moving? Is this ‘not dominated’ relationship taken care of at the end, presumably inLiveDebugValues
?
Thank you!