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:
Adrian Prantl
2015-01-19 17:57:29 +00:00
parent 4b96323e81
commit e240cc0b4b
18 changed files with 45 additions and 69 deletions

View File

@ -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);