llvm/lib/BinaryFormat
David Stenberg 633cd24e87 [DebugInfo] Add a DW_OP_LLVM_entry_value operation
Summary:
Internally in LLVM's metadata we use DW_OP_entry_value operations with
the same semantics as DWARF; that is, its operand specifies the number
of bytes that the entry value covers.

At the time of emitting entry values we don't know the emitted size of
the DWARF expression that the entry value will cover. Currently the size
is hardcoded to 1 in DIExpression, and other values causes the verifier
to fail. As the size is 1, that effectively means that we can only have
valid entry values for registers that can be encoded in one byte, which
are the registers with DWARF numbers 0 to 31 (as they can be encoded as
single-byte DW_OP_reg0..DW_OP_reg31 rather than a multi-byte
DW_OP_regx). It is a bit confusing, but it seems like llvm-dwarfdump
will print an operation "correctly", even if the byte size is less than
that, which may make it seem that we emit correct DWARF for registers
with DWARF numbers > 31. If you instead use readelf for such cases, it
will interpret the number of specified bytes as a DWARF expression. This
seems like a limitation in llvm-dwarfdump.

As suggested in D66746, a way forward would be to add an internal
variant of DW_OP_entry_value, DW_OP_LLVM_entry_value, whose operand
instead specifies the number of operations that the entry value covers,
and we then translate that into the byte size at the time of emission.

In this patch that internal operation is added. This patch keeps the
limitation that a entry value can only be applied to simple register
locations, but it will fix the issue with the size operand being
incorrect for DWARF numbers > 31.

Reviewers: aprantl, vsk, djtodoro, NikolaPrica

Reviewed By: aprantl

Subscribers: jyknight, fedor.sergeev, hiraditya, llvm-commits

Tags: #debug-info, #llvm

Differential Revision: https://reviews.llvm.org/D67492

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@374881 91177308-0d34-0410-b5e6-96231b3b80d8
2019-10-15 11:31:21 +00:00
..
AMDGPUMetadataVerifier.cpp [AMDGPU] Added a new metadata for multi grid sync implicit argument 2019-07-05 16:05:17 +00:00
CMakeLists.txt [Object] Add basic minidump support 2019-03-21 09:18:59 +00:00
Dwarf.cpp [DebugInfo] Add a DW_OP_LLVM_entry_value operation 2019-10-15 11:31:21 +00:00
LLVMBuild.txt Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
Magic.cpp [BinaryFormat] Teach identify_magic about Tapi files. 2019-08-21 21:00:16 +00:00
Minidump.cpp [Object] Add basic minidump support 2019-03-21 09:18:59 +00:00
MsgPackDocument.cpp [MsgPack] New MsgPackDocument class 2019-03-13 18:54:47 +00:00
MsgPackDocumentYAML.cpp [MsgPack][AMDGPU] Fix unflushed raw_string_ostream bugs on windows expensive checks bot 2019-03-18 19:00:46 +00:00
MsgPackReader.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
MsgPackWriter.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
Wasm.cpp [WebAssembly] Fix list of relocations with addends in lld 2019-06-26 00:52:42 +00:00