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.
llvm-svn: 228631
diff --git a/llvm/lib/IR/DebugInfo.cpp b/llvm/lib/IR/DebugInfo.cpp
index ad661c5..31f1e19 100644
--- a/llvm/lib/IR/DebugInfo.cpp
+++ b/llvm/lib/IR/DebugInfo.cpp
@@ -147,18 +147,18 @@
return getHeaderFieldAs<int64_t>(I);
}
-bool DIExpression::isVariablePiece() const {
+bool DIExpression::isBitPiece() const {
unsigned N = getNumElements();
- return N >=3 && getElement(N-3) == dwarf::DW_OP_piece;
+ return N >=3 && getElement(N-3) == dwarf::DW_OP_bit_piece;
}
-uint64_t DIExpression::getPieceOffset() const {
- assert(isVariablePiece() && "not a piece");
+uint64_t DIExpression::getBitPieceOffset() const {
+ assert(isBitPiece() && "not a piece");
return getElement(getNumElements()-2);
}
-uint64_t DIExpression::getPieceSize() const {
- assert(isVariablePiece() && "not a piece");
+uint64_t DIExpression::getBitPieceSize() const {
+ assert(isBitPiece() && "not a piece");
return getElement(getNumElements()-1);
}
@@ -612,7 +612,7 @@
for (auto Op : *this)
switch (Op) {
- case DW_OP_piece:
+ case DW_OP_bit_piece:
// Must be the last element of the expression.
return std::distance(Op.getBase(), DIHeaderFieldIterator()) == 3;
case DW_OP_plus:
@@ -1417,7 +1417,7 @@
OS << " " << Op.getArg(1);
break;
}
- case DW_OP_piece: {
+ case DW_OP_bit_piece: {
OS << " offset=" << Op.getArg(1) << ", size=" << Op.getArg(2);
break;
}