This patch enables AsmPrinter support for complex expression with entry values. It shouldn't AsmPrinter's call whether these are safe or not but the pass who introduces the DW_OP_LLVM_entry_value. This patch on its own has no effect on clang.
Details
Diff Detail
Event Timeline
llvm/test/DebugInfo/MIR/X86/complex-entryvalue.mir | ||
---|---|---|
86 | The 1 is for the number of expression operands (including the DBG_VALUE value operand, i.e. in this case $edi) that the DW_OP_LLVM_entry_value covers. The actual byte size operand of the to-be-emitted DW_OP_entry_value operation is then calculated by getTemporaryBufferSize() in finalizeEntryValue(). |
llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp | ||
---|---|---|
300 | DW_OP_entry_value could be used in the expressions representing DW_AT_call_value within DW_TAG_call_site_parameter, and I think we should be printing the DW_OP_stack_value in these. | |
llvm/test/DebugInfo/MIR/X86/complex-entryvalue.mir | ||
47–83 | NIt: we can get rid of these |
llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp | ||
---|---|---|
300 | mistake: we should not be |
llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp | ||
---|---|---|
300 | Oh I overlooked it, it is still checking !isParameterValue(). This looks good to me... |
llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp | ||
---|---|---|
300 | I am just wondering, do we need the changes from D87357 regarding the DwarfExpression::addExpression()? case dwarf::DW_OP_plus_uconst: - assert(!isRegisterLocation()); + assert(!isRegisterLocation() || isEntryValue()); emitOp(dwarf::DW_OP_plus_uconst); emitUnsigned(Op->getArg(0)); break; |
llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp | ||
---|---|---|
300 | For the very narrow use-case I am interested in (https://reviews.llvm.org/D96549) this doesn't have effect, but it won't hurt when that patch lands either. |
It seems reasonable to me to split out AsmPrinter support for complex entry values from the change(s) to start emitting them. @djtodoro any concerns?
llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp | ||
---|---|---|
287 | Maybe expand the comment with: | |
llvm/test/DebugInfo/MIR/X86/complex-entryvalue.mir | ||
86 | Sorry about that, I inexplicably skipped over the $edi operand on my first pass through. |
I completely agree :) And it is safe.
I assume you pushed a wrong patch? :)
llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp | ||
---|---|---|
300 | Sure. That sounds good to me. |
Maybe expand the comment with:
+ // Also handle the start of an entry value expression, even if it's complex.