mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-11-01 15:17:25 +00:00
Remove support for DIVariable's FlagIndirectVariable and expect
frontends to use a DIExpression with a DW_OP_deref instead. This is not only a much more natural place for this informationl; there is also a technical reason: The FlagIndirectVariable is used to mark a variable that is turned into a reference by virtue of the calling convention; this happens for example to aggregate return values. The inliner, for example, may actually need to undo this indirection to correctly represent the value in its new context. This is impossible to implement because the DIVariable can't be safely modified. We can however safely construct a new DIExpression on the fly. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226476 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -228,14 +228,13 @@ void AsmPrinter::EmitDwarfOpPiece(ByteStreamer &Streamer,
|
||||
|
||||
/// EmitDwarfRegOp - Emit dwarf register operation.
|
||||
void AsmPrinter::EmitDwarfRegOp(ByteStreamer &Streamer,
|
||||
const MachineLocation &MLoc,
|
||||
bool Indirect) const {
|
||||
const MachineLocation &MLoc) const {
|
||||
DebugLocDwarfExpression Expr(*this, Streamer);
|
||||
const TargetRegisterInfo *TRI = TM.getSubtargetImpl()->getRegisterInfo();
|
||||
int Reg = TRI->getDwarfRegNum(MLoc.getReg(), false);
|
||||
if (Reg < 0) {
|
||||
// We assume that pointers are always in an addressable register.
|
||||
if (Indirect || MLoc.isIndirect())
|
||||
if (MLoc.isIndirect())
|
||||
// FIXME: We have no reasonable way of handling errors in here. The
|
||||
// caller might be in the middle of a dwarf expression. We should
|
||||
// probably assert that Reg >= 0 once debug info generation is more
|
||||
@@ -251,9 +250,7 @@ void AsmPrinter::EmitDwarfRegOp(ByteStreamer &Streamer,
|
||||
}
|
||||
|
||||
if (MLoc.isIndirect())
|
||||
Expr.AddRegIndirect(Reg, MLoc.getOffset(), Indirect);
|
||||
else if (Indirect)
|
||||
Expr.AddRegIndirect(Reg, 0, false);
|
||||
Expr.AddRegIndirect(Reg, MLoc.getOffset());
|
||||
else
|
||||
Expr.AddReg(Reg);
|
||||
}
|
||||
|
||||
@@ -737,18 +737,16 @@ void DwarfCompileUnit::addVariableAddress(const DbgVariable &DV, DIE &Die,
|
||||
else if (DV.isBlockByrefVariable())
|
||||
addBlockByrefAddress(DV, Die, dwarf::DW_AT_location, Location);
|
||||
else
|
||||
addAddress(Die, dwarf::DW_AT_location, Location,
|
||||
DV.getVariable().isIndirect());
|
||||
addAddress(Die, dwarf::DW_AT_location, Location);
|
||||
}
|
||||
|
||||
/// Add an address attribute to a die based on the location provided.
|
||||
void DwarfCompileUnit::addAddress(DIE &Die, dwarf::Attribute Attribute,
|
||||
const MachineLocation &Location,
|
||||
bool Indirect) {
|
||||
const MachineLocation &Location) {
|
||||
DIELoc *Loc = new (DIEValueAllocator) DIELoc();
|
||||
|
||||
bool validReg;
|
||||
if (Location.isReg() && !Indirect)
|
||||
if (Location.isReg())
|
||||
validReg = addRegisterOpPiece(*Loc, Location.getReg());
|
||||
else
|
||||
validReg = addRegisterOffset(*Loc, Location.getReg(), Location.getOffset());
|
||||
@@ -756,9 +754,6 @@ void DwarfCompileUnit::addAddress(DIE &Die, dwarf::Attribute Attribute,
|
||||
if (!validReg)
|
||||
return;
|
||||
|
||||
if (!Location.isReg() && Indirect)
|
||||
addUInt(*Loc, dwarf::DW_FORM_data1, dwarf::DW_OP_deref);
|
||||
|
||||
// Now attach the location information to the DIE.
|
||||
addBlock(Die, Attribute, Loc);
|
||||
}
|
||||
@@ -775,16 +770,10 @@ void DwarfCompileUnit::addComplexAddress(const DbgVariable &DV, DIE &Die,
|
||||
DIExpression Expr = DV.getExpression();
|
||||
if (Location.getOffset()) {
|
||||
if (DwarfExpr.AddMachineRegIndirect(Location.getReg(),
|
||||
Location.getOffset())) {
|
||||
Location.getOffset()))
|
||||
DwarfExpr.AddExpression(Expr);
|
||||
assert(!DV.getVariable().isIndirect()
|
||||
&& "double indirection not handled");
|
||||
}
|
||||
} else {
|
||||
if (DwarfExpr.AddMachineRegExpression(Expr, Location.getReg()))
|
||||
if (DV.getVariable().isIndirect())
|
||||
DwarfExpr.EmitOp(dwarf::DW_OP_deref);
|
||||
}
|
||||
} else
|
||||
DwarfExpr.AddMachineRegExpression(Expr, Location.getReg());
|
||||
|
||||
// Now attach the location information to the DIE.
|
||||
addBlock(Die, Attribute, Loc);
|
||||
|
||||
@@ -213,7 +213,7 @@ public:
|
||||
MachineLocation Location);
|
||||
/// Add an address attribute to a die based on the location provided.
|
||||
void addAddress(DIE &Die, dwarf::Attribute Attribute,
|
||||
const MachineLocation &Location, bool Indirect = false);
|
||||
const MachineLocation &Location);
|
||||
|
||||
/// Start with the address based on the location provided, and generate the
|
||||
/// DWARF information necessary to find the actual variable (navigating the
|
||||
|
||||
@@ -1683,14 +1683,12 @@ void DwarfDebug::emitLocPieces(ByteStreamer &Streamer,
|
||||
|
||||
#ifndef NDEBUG
|
||||
DIVariable Var = Piece.getVariable();
|
||||
assert(!Var.isIndirect() && "indirect address for piece");
|
||||
unsigned VarSize = Var.getSizeInBits(Map);
|
||||
assert(PieceSize+PieceOffset <= VarSize/SizeOfByte
|
||||
&& "piece is larger than or outside of variable");
|
||||
assert(PieceSize*SizeOfByte != VarSize
|
||||
&& "piece covers entire variable");
|
||||
#endif
|
||||
|
||||
emitDebugLocValue(Streamer, Piece, PieceOffset*SizeOfByte);
|
||||
}
|
||||
}
|
||||
@@ -1726,7 +1724,7 @@ void DwarfDebug::emitDebugLocValue(ByteStreamer &Streamer,
|
||||
DIExpression Expr = Value.getExpression();
|
||||
if (!Expr || (Expr.getNumElements() == 0))
|
||||
// Regular entry.
|
||||
Asm->EmitDwarfRegOp(Streamer, Loc, DV.isIndirect());
|
||||
Asm->EmitDwarfRegOp(Streamer, Loc);
|
||||
else {
|
||||
// Complex address entry.
|
||||
if (Loc.getOffset()) {
|
||||
@@ -1735,8 +1733,6 @@ void DwarfDebug::emitDebugLocValue(ByteStreamer &Streamer,
|
||||
} else
|
||||
DwarfExpr.AddMachineRegExpression(Expr, Loc.getReg(),
|
||||
PieceOffsetInBits);
|
||||
if (DV.isIndirect())
|
||||
DwarfExpr.EmitOp(dwarf::DW_OP_deref);
|
||||
}
|
||||
}
|
||||
// else ... ignore constant fp. There is not any good way to
|
||||
|
||||
Reference in New Issue
Block a user