Index: llvm/docs/LangRef.rst =================================================================== --- llvm/docs/LangRef.rst +++ llvm/docs/LangRef.rst @@ -4782,15 +4782,15 @@ of the stack is treated as an address. The second stack entry is treated as an address space identifier. - ``DW_OP_stack_value`` marks a constant value. -- If an expression is marked with ``DW_OP_entry_value`` all register and +- If an expression is marked with ``DW_OP_LLVM_entry_value`` all register and memory read operations refer to the respective value at the function entry. - The first operand of ``DW_OP_entry_value`` is the size of following + The first operand of ``DW_OP_LLVM_entry_value`` is the size of following DWARF expression. - ``DW_OP_entry_value`` may appear after the ``LiveDebugValues`` pass. + ``DW_OP_LLVM_entry_value`` may appear after the ``LiveDebugValues`` pass. LLVM only supports entry values for function parameters that are unmodified throughout a function and that are described as simple register location descriptions. - ``DW_OP_entry_value`` may also appear after the ``AsmPrinter`` pass when + ``DW_OP_LLVM_entry_value`` may also appear after the ``AsmPrinter`` pass when a call site parameter value (``DW_AT_call_site_parameter_value``) is represented as entry value of the parameter. - ``DW_OP_breg`` (or ``DW_OP_bregx``) represents a content on the provided @@ -4841,7 +4841,7 @@ The `ArgumentNotModified` flag marks a function argument whose value is not modified throughout of a function. This flag is used to decide -whether a DW_OP_entry_value can be used in a location description +whether a DW_OP_LLVM_entry_value can be used in a location description after the function prologue. The language frontend is expected to compute this property for each DILocalVariable. The flag should be used only in optimized code. Index: llvm/include/llvm/BinaryFormat/Dwarf.h =================================================================== --- llvm/include/llvm/BinaryFormat/Dwarf.h +++ llvm/include/llvm/BinaryFormat/Dwarf.h @@ -117,9 +117,10 @@ #include "llvm/BinaryFormat/Dwarf.def" DW_OP_lo_user = 0xe0, DW_OP_hi_user = 0xff, - DW_OP_LLVM_fragment = 0x1000, ///< Only used in LLVM metadata. - DW_OP_LLVM_convert = 0x1001, ///< Only used in LLVM metadata. - DW_OP_LLVM_tag_offset = 0x1002, ///< Only used in LLVM metadata. + DW_OP_LLVM_fragment = 0x1000, ///< Only used in LLVM metadata. + DW_OP_LLVM_convert = 0x1001, ///< Only used in LLVM metadata. + DW_OP_LLVM_tag_offset = 0x1002, ///< Only used in LLVM metadata. + DW_OP_LLVM_entry_value = 0x1003, ///< Only used in LLVM metadata. }; enum TypeKind : uint8_t { Index: llvm/include/llvm/CodeGen/MachineInstr.h =================================================================== --- llvm/include/llvm/CodeGen/MachineInstr.h +++ llvm/include/llvm/CodeGen/MachineInstr.h @@ -1036,7 +1036,7 @@ } /// A DBG_VALUE is an entry value iff its debug expression contains the - /// DW_OP_entry_value DWARF operation. + /// DW_OP_LLVM_entry_value operation. bool isDebugEntryValue() const { return isDebugValue() && getDebugExpression()->isEntryValue(); } Index: llvm/include/llvm/IR/DebugInfoMetadata.h =================================================================== --- llvm/include/llvm/IR/DebugInfoMetadata.h +++ llvm/include/llvm/IR/DebugInfoMetadata.h @@ -2570,7 +2570,7 @@ /// (This is the only configuration of entry values that is supported.) bool isEntryValue() const { return getNumElements() > 0 && - getElement(0) == dwarf::DW_OP_entry_value; + getElement(0) == dwarf::DW_OP_LLVM_entry_value; } }; Index: llvm/lib/BinaryFormat/Dwarf.cpp =================================================================== --- llvm/lib/BinaryFormat/Dwarf.cpp +++ llvm/lib/BinaryFormat/Dwarf.cpp @@ -149,6 +149,8 @@ return "DW_OP_LLVM_fragment"; case DW_OP_LLVM_tag_offset: return "DW_OP_LLVM_tag_offset"; + case DW_OP_LLVM_entry_value: + return "DW_OP_LLVM_entry_value"; } } @@ -160,6 +162,7 @@ .Case("DW_OP_LLVM_convert", DW_OP_LLVM_convert) .Case("DW_OP_LLVM_fragment", DW_OP_LLVM_fragment) .Case("DW_OP_LLVM_tag_offset", DW_OP_LLVM_tag_offset) + .Case("DW_OP_LLVM_entry_value", DW_OP_LLVM_entry_value) .Default(0); } Index: llvm/lib/CodeGen/AsmPrinter/DbgEntityHistoryCalculator.cpp =================================================================== --- llvm/lib/CodeGen/AsmPrinter/DbgEntityHistoryCalculator.cpp +++ llvm/lib/CodeGen/AsmPrinter/DbgEntityHistoryCalculator.cpp @@ -41,7 +41,7 @@ static Register isDescribedByReg(const MachineInstr &MI) { assert(MI.isDebugValue()); assert(MI.getNumOperands() == 4); - // If the location of variable is an entry value (DW_OP_entry_value) + // If the location of variable is an entry value (DW_OP_LLVM_entry_value) // do not consider it as a register location. if (MI.getDebugExpression()->isEntryValue()) return 0; Index: llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp =================================================================== --- llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -690,9 +690,10 @@ // Emit the call site parameter's value as an entry value. if (ShouldTryEmitEntryVals) { // Create an entry value expression where the expression following - // the 'DW_OP_entry_value' will be the size of 1 (a register operation). - DIExpression *EntryExpr = DIExpression::get(MF->getFunction().getContext(), - {dwarf::DW_OP_entry_value, 1}); + // the 'DW_OP_LLVM_entry_value' will be the size of 1 (a register + // operation). + DIExpression *EntryExpr = DIExpression::get( + MF->getFunction().getContext(), {dwarf::DW_OP_LLVM_entry_value, 1}); for (auto RegEntry : ForwardedRegWorklist) { unsigned FwdReg = RegEntry; auto EntryValReg = RegsForEntryValues.find(RegEntry); Index: llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp =================================================================== --- llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp +++ llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp @@ -315,7 +315,7 @@ void DwarfExpression::addEntryValueExpression(DIExpressionCursor &ExprCursor) { auto Op = ExprCursor.take(); - assert(Op && Op->getOp() == dwarf::DW_OP_entry_value); + assert(Op && Op->getOp() == dwarf::DW_OP_LLVM_entry_value); assert(!isMemoryLocation() && "We don't support entry values of memory locations yet"); Index: llvm/lib/IR/DebugInfoMetadata.cpp =================================================================== --- llvm/lib/IR/DebugInfoMetadata.cpp +++ llvm/lib/IR/DebugInfoMetadata.cpp @@ -843,7 +843,7 @@ case dwarf::DW_OP_deref_size: case dwarf::DW_OP_plus_uconst: case dwarf::DW_OP_LLVM_tag_offset: - case dwarf::DW_OP_entry_value: + case dwarf::DW_OP_LLVM_entry_value: case dwarf::DW_OP_regx: return 2; default: @@ -890,7 +890,7 @@ return false; break; } - case dwarf::DW_OP_entry_value: { + case dwarf::DW_OP_LLVM_entry_value: { // An entry value operator must appear at the begin and the size // of following expression should be 1, because we support only // entry values of a simple register location. @@ -1050,7 +1050,7 @@ assert(Expr && "Can't prepend ops to this expression"); if (EntryValue) { - Ops.push_back(dwarf::DW_OP_entry_value); + Ops.push_back(dwarf::DW_OP_LLVM_entry_value); // Add size info needed for entry value expression. // Add plus one for target register operand. Ops.push_back(Expr->getNumElements() + 1); Index: llvm/test/DebugInfo/MIR/Hexagon/live-debug-values-bundled-entry-values.mir =================================================================== --- llvm/test/DebugInfo/MIR/Hexagon/live-debug-values-bundled-entry-values.mir +++ llvm/test/DebugInfo/MIR/Hexagon/live-debug-values-bundled-entry-values.mir @@ -98,7 +98,7 @@ # CHECK-NEXT: $r29 = S2_allocframe $r29, 0 # CHECK-NEXT: J2_call @clobber # CHECK-NEXT: } -# CHECK-NEXT: DBG_VALUE $r0, $noreg, !16, !DIExpression(DW_OP_entry_value, 1) +# CHECK-NEXT: DBG_VALUE $r0, $noreg, !16, !DIExpression(DW_OP_LLVM_entry_value, 1) --- name: bar @@ -136,4 +136,4 @@ # CHECK-NEXT: $r29 = S2_allocframe $r29, 0 # CHECK-NEXT: J2_call @clobber # CHECK-NEXT: } -# CHECK-NEXT: DBG_VALUE $r0, $noreg, !22, !DIExpression(DW_OP_entry_value, 1) +# CHECK-NEXT: DBG_VALUE $r0, $noreg, !22, !DIExpression(DW_OP_LLVM_entry_value, 1) Index: llvm/test/DebugInfo/MIR/X86/avoid-single-entry-value-location.mir =================================================================== --- llvm/test/DebugInfo/MIR/X86/avoid-single-entry-value-location.mir +++ llvm/test/DebugInfo/MIR/X86/avoid-single-entry-value-location.mir @@ -61,7 +61,7 @@ DBG_VALUE $edi, $noreg, !16, !DIExpression(), debug-location !18 DBG_VALUE $edi, $noreg, !17, !DIExpression(), debug-location !18 $edi = KILL renamable $edi, implicit killed $rdi, debug-location !18 - DBG_VALUE $rdi, $noreg, !16, !DIExpression(DW_OP_entry_value, 1), debug-location !18 + DBG_VALUE $rdi, $noreg, !16, !DIExpression(DW_OP_LLVM_entry_value, 1), debug-location !18 TAILJMPd64 @fn2, csr_64, implicit $rsp, implicit $ssp, implicit $rsp, implicit $ssp, implicit killed $edi, debug-location !18 ... Index: llvm/test/DebugInfo/MIR/X86/dbgcall-site-interpretation.mir =================================================================== --- llvm/test/DebugInfo/MIR/X86/dbgcall-site-interpretation.mir +++ llvm/test/DebugInfo/MIR/X86/dbgcall-site-interpretation.mir @@ -192,10 +192,10 @@ $rbx = frame-destroy POP64r implicit-def $rsp, implicit $rsp, debug-location !21 CFI_INSTRUCTION def_cfa_offset 24, debug-location !21 $r14 = frame-destroy POP64r implicit-def $rsp, implicit $rsp, debug-location !21 - DBG_VALUE $ecx, $noreg, !17, !DIExpression(DW_OP_entry_value, 1), debug-location !21 + DBG_VALUE $ecx, $noreg, !17, !DIExpression(DW_OP_LLVM_entry_value, 1), debug-location !21 CFI_INSTRUCTION def_cfa_offset 16, debug-location !21 $r15 = frame-destroy POP64r implicit-def $rsp, implicit $rsp, debug-location !21 - DBG_VALUE $esi, $noreg, !15, !DIExpression(DW_OP_entry_value, 1), debug-location !21 + DBG_VALUE $esi, $noreg, !15, !DIExpression(DW_OP_LLVM_entry_value, 1), debug-location !21 CFI_INSTRUCTION def_cfa_offset 8, debug-location !21 RETQ $eax, debug-location !21 Index: llvm/test/DebugInfo/MIR/X86/dbginfo-entryvals.mir =================================================================== --- llvm/test/DebugInfo/MIR/X86/dbginfo-entryvals.mir +++ llvm/test/DebugInfo/MIR/X86/dbginfo-entryvals.mir @@ -14,8 +14,8 @@ # fn2 (a); # u --; #} -# CHECK: DBG_VALUE $edi, $noreg, !14, !DIExpression(DW_OP_entry_value, 1), debug-location {{.*}} -# CHECK: DBG_VALUE $esi, $noreg, !15, !DIExpression(DW_OP_entry_value, 1), debug-location {{.*}} +# CHECK: DBG_VALUE $edi, $noreg, !14, !DIExpression(DW_OP_LLVM_entry_value, 1), debug-location {{.*}} +# CHECK: DBG_VALUE $esi, $noreg, !15, !DIExpression(DW_OP_LLVM_entry_value, 1), debug-location {{.*}} --- | ; ModuleID = 'test.c' Index: llvm/test/DebugInfo/MIR/X86/multiple-param-dbg-value-entry.mir =================================================================== --- llvm/test/DebugInfo/MIR/X86/multiple-param-dbg-value-entry.mir +++ llvm/test/DebugInfo/MIR/X86/multiple-param-dbg-value-entry.mir @@ -7,11 +7,11 @@ # return 123; #} # -# Verify that DW_OP_entry_values are generated for parameters with multiple +# Verify that DW_OP_LLVM_entry_values are generated for parameters with multiple # DBG_VALUEs at entry block. -# CHECK: DBG_VALUE $edi, $noreg, !{{.*}}, !DIExpression(DW_OP_entry_value, 1), debug-location {{.*}} -# CHECK: DBG_VALUE $edx, $noreg, !{{.*}}, !DIExpression(DW_OP_entry_value, 1), debug-location {{.*}} -# CHECK: DBG_VALUE $esi, $noreg, !{{.*}}, !DIExpression(DW_OP_entry_value, 1), debug-location {{.*}} +# CHECK: DBG_VALUE $edi, $noreg, !{{.*}}, !DIExpression(DW_OP_LLVM_entry_value, 1), debug-location {{.*}} +# CHECK: DBG_VALUE $edx, $noreg, !{{.*}}, !DIExpression(DW_OP_LLVM_entry_value, 1), debug-location {{.*}} +# CHECK: DBG_VALUE $esi, $noreg, !{{.*}}, !DIExpression(DW_OP_LLVM_entry_value, 1), debug-location {{.*}} --- | ; ModuleID = 'multiple-param-dbg-value-entry.ll' Index: llvm/test/Verifier/diexpression-dwarf-entry-value.ll =================================================================== --- /dev/null +++ llvm/test/Verifier/diexpression-dwarf-entry-value.ll @@ -0,0 +1,8 @@ +; RUN: not opt -S < %s 2>&1 | FileCheck %s + +; We can only use the internal variant of the entry value operation, +; DW_OP_LLVM_entry_value, in DIExpressions. + +!named = !{!0} +; CHECK: invalid expression +!0 = !DIExpression(DW_OP_entry_value, 1) Index: llvm/test/Verifier/diexpression-entry-value.ll =================================================================== --- llvm/test/Verifier/diexpression-entry-value.ll +++ llvm/test/Verifier/diexpression-entry-value.ll @@ -2,6 +2,6 @@ !named = !{!0, !1, !2} ; CHECK: invalid expression -!0 = !DIExpression(DW_OP_entry_value, 4, DW_OP_constu, 0, DW_OP_stack_value) -!1 = !DIExpression(DW_OP_constu, 0, DW_OP_entry_value, 1, DW_OP_constu, 0) -!2 = !DIExpression(DW_OP_entry_value, 100, DW_OP_constu, 0) +!0 = !DIExpression(DW_OP_LLVM_entry_value, 4, DW_OP_constu, 0, DW_OP_stack_value) +!1 = !DIExpression(DW_OP_constu, 0, DW_OP_LLVM_entry_value, 1, DW_OP_constu, 0) +!2 = !DIExpression(DW_OP_LLVM_entry_value, 100, DW_OP_constu, 0) Index: llvm/test/Verifier/diexpression-valid-entry-value.ll =================================================================== --- llvm/test/Verifier/diexpression-valid-entry-value.ll +++ llvm/test/Verifier/diexpression-valid-entry-value.ll @@ -2,4 +2,4 @@ !named = !{!0} ; CHECK-NOT: invalid expression -!0 = !DIExpression(DW_OP_entry_value, 1) +!0 = !DIExpression(DW_OP_LLVM_entry_value, 1)