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
+3 -6
View File
@@ -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);
}