Debug info: Use DW_OP_bit_piece instead of DW_OP_piece in the

intermediate representation. This
- increases consistency by using the same granularity everywhere
- allows for pieces < 1 byte
- DW_OP_piece didn't actually allow storing an offset.

Part of PR22495.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@228631 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Adrian Prantl
2015-02-09 23:57:15 +00:00
parent 76419c0533
commit 4f1b7f3100
18 changed files with 80 additions and 83 deletions

View File

@@ -517,13 +517,13 @@ namespace llvm {
DIExpression createExpression(ArrayRef<uint64_t> Addr = None);
DIExpression createExpression(ArrayRef<int64_t> Addr);
/// createPieceExpression - Create a descriptor to describe one part
/// createBitPieceExpression - Create a descriptor to describe one part
/// of aggregate variable that is fragmented across multiple Values.
///
/// @param OffsetInBytes Offset of the piece in bytes.
/// @param SizeInBytes Size of the piece in bytes.
DIExpression createPieceExpression(unsigned OffsetInBytes,
unsigned SizeInBytes);
/// @param OffsetInBits Offset of the piece in bits.
/// @param SizeInBits Size of the piece in bits.
DIExpression createBitPieceExpression(unsigned OffsetInBits,
unsigned SizeInBits);
/// createFunction - Create a new descriptor for the specified subprogram.
/// See comments in DISubprogram for descriptions of these fields.

View File

@@ -851,11 +851,11 @@ public:
uint64_t getElement(unsigned Idx) const;
/// \brief Return whether this is a piece of an aggregate variable.
bool isVariablePiece() const;
/// \brief Return the offset of this piece in bytes.
uint64_t getPieceOffset() const;
/// \brief Return the size of this piece in bytes.
uint64_t getPieceSize() const;
bool isBitPiece() const;
/// \brief Return the offset of this piece in bits.
uint64_t getBitPieceOffset() const;
/// \brief Return the size of this piece in bits.
uint64_t getBitPieceSize() const;
class iterator;
/// \brief A lightweight wrapper around an element of a DIExpression.
@@ -906,9 +906,9 @@ public:
private:
void increment() {
switch (**this) {
case dwarf::DW_OP_piece: std::advance(I, 3); break;
case dwarf::DW_OP_plus: std::advance(I, 2); break;
case dwarf::DW_OP_deref: std::advance(I, 1); break;
case dwarf::DW_OP_bit_piece: std::advance(I, 3); break;
case dwarf::DW_OP_plus: std::advance(I, 2); break;
case dwarf::DW_OP_deref: std::advance(I, 1); break;
default:
llvm_unreachable("unsupported operand");
}