diff options
author | Adrian Prantl <aprantl@apple.com> | 2016-04-08 00:38:37 +0000 |
---|---|---|
committer | Adrian Prantl <aprantl@apple.com> | 2016-04-08 00:38:37 +0000 |
commit | 3e9c88753b7839375ee4aed0c9c064f405c682d8 (patch) | |
tree | d0dfd969dcb6fcc16f0cae0a0adab4f8ec227e9a /llvm/lib/CodeGen/AsmPrinter/DwarfExpression.h | |
parent | 267185ec922b29ddc25684b89ac8fec2d7d027e2 (diff) | |
download | bcm5719-llvm-3e9c88753b7839375ee4aed0c9c064f405c682d8.tar.gz bcm5719-llvm-3e9c88753b7839375ee4aed0c9c064f405c682d8.zip |
DwarfDebug: Support floating point constants in location lists.
This patch closes a gap in the DWARF backend that caused LLVM to drop
debug info for floating point variables that were constant for part of
their scope. Floating point constants are emitted as one or more
DW_OP_constu joined via DW_OP_piece.
This fixes a regression caught by the LLDB testsuite that I introduced
in r262247 when we stopped blindly expanding the range of singular
DBG_VALUEs to span the entire scope and started to emit location lists
with accurate ranges instead.
Also deletes a now-impossible testcase (debug-loc-empty-entries).
<rdar://problem/25448338>
llvm-svn: 265760
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/DwarfExpression.h')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfExpression.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfExpression.h b/llvm/lib/CodeGen/AsmPrinter/DwarfExpression.h index 78ec937a6b6..5de9131d5c4 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfExpression.h +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfExpression.h @@ -61,6 +61,19 @@ public: void AddOpPiece(unsigned SizeInBits, unsigned OffsetInBits = 0); /// Emit a shift-right dwarf expression. void AddShr(unsigned ShiftBy); + /// Emit a DW_OP_stack_value, if supported. + /// + /// The proper way to describe a constant value is + /// DW_OP_constu <const>, DW_OP_stack_value. + /// Unfortunately, DW_OP_stack_value was not available until DWARF-4, + /// so we will continue to generate DW_OP_constu <const> for DWARF-2 + /// and DWARF-3. Technically, this is incorrect since DW_OP_const <const> + /// actually describes a value at a constant addess, not a constant value. + /// However, in the past there was no better way to describe a constant + /// value, so the producers and consumers started to rely on heuristics + /// to disambiguate the value vs. location status of the expression. + /// See PR21176 for more details. + void AddStackValue(); /// Emit an indirect dwarf register operation for the given machine register. /// \return false if no DWARF register exists for MachineReg. @@ -87,6 +100,8 @@ public: void AddSignedConstant(int Value); /// Emit an unsigned constant. void AddUnsignedConstant(unsigned Value); + /// Emit an unsigned constant. + void AddUnsignedConstant(APInt Value); /// \brief Emit an entire expression on top of a machine register location. /// |