[PATCH] D45341: [DebugInfo] Convert intrinsic llvm.dbg.label to MachineInstr.
Hsiangkai Wang via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 11 07:04:32 PDT 2018
HsiangKai added a comment.
In https://reviews.llvm.org/D45341#1060380, @aprantl wrote:
> Thanks, this looks mostly fine! Have you considered just allowing the DBG_VALUE MachineInstr to carry a DILabel insetad of just DILocalVariables? Would that simplify the code or make it harder to understand?
The formats of DBG_VALUE are
DBG_VALUE Reg, 0, DILocalVariable, DIExpression
DBG_VALUE FrameIndex, Imm, DILocalVariable, DIExpression
DBG_VALUE Imm, Imm, DILocalVariable, DIExpression
When processing DBG_VALUE, there are assumptions about these operands. Take a snippet from lib/CodeGen/PrologEpilogInserter.cpp as an example,
if (MI.isDebugValue()) {
assert(i == 0 && "Frame indices can only appear as the first "
"operand of a DBG_VALUE machine instruction");
unsigned Reg;
int64_t Offset =
TFI->getFrameIndexReference(Fn, MI.getOperand(0).getIndex(), Reg);
MI.getOperand(0).ChangeToRegister(Reg, false /*isDef*/);
auto *DIExpr = DIExpression::prepend(MI.getDebugExpression(),
DIExpression::NoDeref, Offset);
MI.getOperand(3).setMetadata(DIExpr);
continue;
}
If we add the possibility of operand(0) as DILabel, it will complicate the implementation.
I think to create DBG_LABEL is easier to understand and easier to maintain.
Repository:
rL LLVM
https://reviews.llvm.org/D45341
More information about the llvm-commits
mailing list