mirror of
https://github.com/RPCSX/llvm.git
synced 2024-11-25 20:59:51 +00:00
AsmPrinter: Take range in DwarfExpression::AddExpression(), NFC
Previously `DwarfExpression::AddExpression()` relied on default-constructing the end iterators for `DIExpression` -- once the operands are represented explicitly via `MDExpression` (instead of via the strange `StringRef` navigator in `DIHeaderIterator`) this won't work. Explicitly take an iterator for the end of the range. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229572 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
cbc2ca5ec9
commit
4c9121d5d9
@ -527,8 +527,11 @@ DwarfCompileUnit::constructVariableDIEImpl(const DbgVariable &DV,
|
||||
const TargetFrameLowering *TFI =
|
||||
Asm->TM.getSubtargetImpl()->getFrameLowering();
|
||||
int Offset = TFI->getFrameIndexReference(*Asm->MF, FI, FrameReg);
|
||||
assert(Expr != DV.getExpression().end() &&
|
||||
"Wrong number of expressions");
|
||||
DwarfExpr.AddMachineRegIndirect(FrameReg, Offset);
|
||||
DwarfExpr.AddExpression(*(Expr++));
|
||||
DwarfExpr.AddExpression(Expr->begin(), Expr->end());
|
||||
++Expr;
|
||||
}
|
||||
addBlock(*VariableDie, dwarf::DW_AT_location, Loc);
|
||||
|
||||
@ -780,7 +783,7 @@ void DwarfCompileUnit::addComplexAddress(const DbgVariable &DV, DIE &Die,
|
||||
ValidReg = DwarfExpr.AddMachineRegIndirect(Location.getReg(),
|
||||
Location.getOffset());
|
||||
if (ValidReg)
|
||||
DwarfExpr.AddExpression(Expr);
|
||||
DwarfExpr.AddExpression(Expr.begin(), Expr.end());
|
||||
} else
|
||||
ValidReg = DwarfExpr.AddMachineRegExpression(Expr, Location.getReg());
|
||||
|
||||
|
@ -1725,7 +1725,7 @@ void DwarfDebug::emitDebugLocValue(ByteStreamer &Streamer,
|
||||
// Complex address entry.
|
||||
if (Loc.getOffset()) {
|
||||
DwarfExpr.AddMachineRegIndirect(Loc.getReg(), Loc.getOffset());
|
||||
DwarfExpr.AddExpression(Expr, PieceOffsetInBits);
|
||||
DwarfExpr.AddExpression(Expr.begin(), Expr.end(), PieceOffsetInBits);
|
||||
} else
|
||||
DwarfExpr.AddMachineRegExpression(Expr, Loc.getReg(),
|
||||
PieceOffsetInBits);
|
||||
|
@ -240,13 +240,14 @@ bool DwarfExpression::AddMachineRegExpression(DIExpression Expr,
|
||||
return false;
|
||||
|
||||
// Emit remaining elements of the expression.
|
||||
AddExpression(I, PieceOffsetInBits);
|
||||
AddExpression(I, Expr.end(), PieceOffsetInBits);
|
||||
return true;
|
||||
}
|
||||
|
||||
void DwarfExpression::AddExpression(DIExpression::iterator I,
|
||||
DIExpression::iterator E,
|
||||
unsigned PieceOffsetInBits) {
|
||||
for (; I != DIExpression::iterator(); ++I) {
|
||||
for (; I != E; ++I) {
|
||||
switch (*I) {
|
||||
case dwarf::DW_OP_bit_piece: {
|
||||
unsigned OffsetInBits = I->getArg(1);
|
||||
|
@ -96,7 +96,8 @@ public:
|
||||
/// Emit a the operations remaining the DIExpressionIterator I.
|
||||
/// \param PieceOffsetInBits If this is one piece out of a fragmented
|
||||
/// location, this is the offset of the piece inside the entire variable.
|
||||
void AddExpression(DIExpression::iterator I, unsigned PieceOffsetInBits = 0);
|
||||
void AddExpression(DIExpression::iterator I, DIExpression::iterator E,
|
||||
unsigned PieceOffsetInBits = 0);
|
||||
};
|
||||
|
||||
/// DwarfExpression implementation for .debug_loc entries.
|
||||
|
Loading…
Reference in New Issue
Block a user