diff options
| author | Markus Lavin <markus.lavin@ericsson.com> | 2019-04-30 07:58:57 +0000 |
|---|---|---|
| committer | Markus Lavin <markus.lavin@ericsson.com> | 2019-04-30 07:58:57 +0000 |
| commit | a475da36eb5013143c19074e3edfc8977ed15b2a (patch) | |
| tree | d759a2c62006e45c13401025225ac6757fa93373 /llvm/lib/IR/DebugInfoMetadata.cpp | |
| parent | 2520530bb05c8b78fd9064a117e63fb0a61a785a (diff) | |
| download | bcm5719-llvm-a475da36eb5013143c19074e3edfc8977ed15b2a.tar.gz bcm5719-llvm-a475da36eb5013143c19074e3edfc8977ed15b2a.zip | |
[DebugInfo] DW_OP_deref_size in PrologEpilogInserter.
The PrologEpilogInserter need to insert a DW_OP_deref_size before
prepending a memory location expression to an already implicit
expression to avoid having the existing expression act on the memory
address instead of the value behind it.
The reason for using DW_OP_deref_size and not plain DW_OP_deref is that
big-endian targets need to read the right size as simply truncating a
larger read would yield the wrong result (LSB bytes are not at the lower
address).
This re-commit fixes issues reported in the first one. Namely deref was
inserted under wrong conditions and additionally the deref_size argument
was incorrectly encoded.
Differential Revision: https://reviews.llvm.org/D59687
llvm-svn: 359535
Diffstat (limited to 'llvm/lib/IR/DebugInfoMetadata.cpp')
| -rw-r--r-- | llvm/lib/IR/DebugInfoMetadata.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/llvm/lib/IR/DebugInfoMetadata.cpp b/llvm/lib/IR/DebugInfoMetadata.cpp index 7158e5764fa..4ef38b6f7fe 100644 --- a/llvm/lib/IR/DebugInfoMetadata.cpp +++ b/llvm/lib/IR/DebugInfoMetadata.cpp @@ -833,6 +833,7 @@ unsigned DIExpression::ExprOperand::getSize() const { case dwarf::DW_OP_LLVM_fragment: return 3; case dwarf::DW_OP_constu: + case dwarf::DW_OP_deref_size: case dwarf::DW_OP_plus_uconst: return 2; default: @@ -889,6 +890,7 @@ bool DIExpression::isValid() const { case dwarf::DW_OP_shr: case dwarf::DW_OP_shra: case dwarf::DW_OP_deref: + case dwarf::DW_OP_deref_size: case dwarf::DW_OP_xderef: case dwarf::DW_OP_lit0: case dwarf::DW_OP_not: @@ -899,6 +901,19 @@ bool DIExpression::isValid() const { return true; } +bool DIExpression::isImplicit() const { + unsigned N = getNumElements(); + if (isValid() && N > 0) { + switch (getElement(N-1)) { + case dwarf::DW_OP_stack_value: return true; + case dwarf::DW_OP_LLVM_fragment: + return N > 1 && getElement(N-2) == dwarf::DW_OP_stack_value; + default: break; + } + } + return false; +} + Optional<DIExpression::FragmentInfo> DIExpression::getFragmentInfo(expr_op_iterator Start, expr_op_iterator End) { for (auto I = Start; I != End; ++I) |

