diff options
| author | Markus Lavin <markus.lavin@ericsson.com> | 2019-03-19 13:16:28 +0000 |
|---|---|---|
| committer | Markus Lavin <markus.lavin@ericsson.com> | 2019-03-19 13:16:28 +0000 |
| commit | b86ce219f4dabe1ac5ceee79651b05308672064e (patch) | |
| tree | f0d7bec6c91a9d5f21b3ae0d496c9c929eca5f41 /llvm/lib/CodeGen/AsmPrinter/DIE.cpp | |
| parent | baa506319abdb87e759d57bd3305f13cf79fdaae (diff) | |
| download | bcm5719-llvm-b86ce219f4dabe1ac5ceee79651b05308672064e.tar.gz bcm5719-llvm-b86ce219f4dabe1ac5ceee79651b05308672064e.zip | |
[DebugInfo] Introduce DW_OP_LLVM_convert
Introduce a DW_OP_LLVM_convert Dwarf expression pseudo op that allows
for a convenient way to perform type conversions on the Dwarf expression
stack. As an additional bonus it paves the way for using other Dwarf
v5 ops that need to reference a base_type.
The new DW_OP_LLVM_convert is used from lib/Transforms/Utils/Local.cpp
to perform sext/zext on debug values but mainly the patch is about
preparing terrain for adding other Dwarf v5 ops that need to reference a
base_type.
For Dwarf v5 the op maps to DW_OP_convert and for earlier versions a
complex shift & mask pattern is generated to emulate sext/zext.
This is a recommit of r356442 with trivial fixes for the failing tests.
Differential Revision: https://reviews.llvm.org/D56587
llvm-svn: 356451
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/DIE.cpp')
| -rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DIE.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DIE.cpp b/llvm/lib/CodeGen/AsmPrinter/DIE.cpp index dfc4156243d..f4134da48ca 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DIE.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DIE.cpp @@ -506,6 +506,23 @@ LLVM_DUMP_METHOD void DIELabel::print(raw_ostream &O) const { O << "Lbl: " << Label->getName(); } //===----------------------------------------------------------------------===// +// DIEBaseTypeRef Implementation +//===----------------------------------------------------------------------===// + +void DIEBaseTypeRef::EmitValue(const AsmPrinter *AP, dwarf::Form Form) const { + uint64_t Offset = CU->ExprRefedBaseTypes[Index].Die->getOffset(); + assert(Offset < (1ULL << (ULEB128PadSize * 7)) && "Offset wont fit"); + AP->EmitULEB128(Offset, nullptr, ULEB128PadSize); +} + +unsigned DIEBaseTypeRef::SizeOf(const AsmPrinter *AP, dwarf::Form Form) const { + return ULEB128PadSize; +} + +LLVM_DUMP_METHOD +void DIEBaseTypeRef::print(raw_ostream &O) const { O << "BaseTypeRef: " << Index; } + +//===----------------------------------------------------------------------===// // DIEDelta Implementation //===----------------------------------------------------------------------===// |

