diff options
author | Adrian Prantl <aprantl@apple.com> | 2015-02-10 23:18:28 +0000 |
---|---|---|
committer | Adrian Prantl <aprantl@apple.com> | 2015-02-10 23:18:28 +0000 |
commit | ca7e4702211a8cd6c65785089f6f782901323a0b (patch) | |
tree | 9695c25b0aceb425434ab140798e565fcfeb5cb3 /llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp | |
parent | d49691f77989cf74c29e4c7b7217b52ed5beac94 (diff) | |
download | bcm5719-llvm-ca7e4702211a8cd6c65785089f6f782901323a0b.tar.gz bcm5719-llvm-ca7e4702211a8cd6c65785089f6f782901323a0b.zip |
Debug Info: Support variables that are described by more than one MMI
table entry. This happens when SROA splits up an alloca and the resulting
allocas cannot be lowered to SSA values because their address is passed
to a function.
Fixes PR22502.
llvm-svn: 228764
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp index 7e147e8466a..6a8c9b5e43f 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp @@ -516,15 +516,21 @@ DwarfCompileUnit::constructVariableDIEImpl(const DbgVariable &DV, } // .. else use frame index. - int FI = DV.getFrameIndex(); - if (FI != ~0) { + if (DV.getFrameIndex().back() == ~0) + return VariableDie; + + auto Expr = DV.getExpression().begin(); + DIELoc *Loc = new (DIEValueAllocator) DIELoc(); + DIEDwarfExpression DwarfExpr(*Asm, *this, *Loc); + for (auto FI : DV.getFrameIndex()) { unsigned FrameReg = 0; const TargetFrameLowering *TFI = Asm->TM.getSubtargetImpl()->getFrameLowering(); int Offset = TFI->getFrameIndexReference(*Asm->MF, FI, FrameReg); - MachineLocation Location(FrameReg, Offset); - addVariableAddress(DV, *VariableDie, Location); + DwarfExpr.AddMachineRegIndirect(FrameReg, Offset); + DwarfExpr.AddExpression(*(Expr++)); } + addBlock(*VariableDie, dwarf::DW_AT_location, Loc); return VariableDie; } @@ -767,7 +773,8 @@ void DwarfCompileUnit::addComplexAddress(const DbgVariable &DV, DIE &Die, const MachineLocation &Location) { DIELoc *Loc = new (DIEValueAllocator) DIELoc(); DIEDwarfExpression DwarfExpr(*Asm, *this, *Loc); - DIExpression Expr = DV.getExpression(); + assert(DV.getExpression().size() == 1); + DIExpression Expr = DV.getExpression().back(); bool ValidReg; if (Location.getOffset()) { ValidReg = DwarfExpr.AddMachineRegIndirect(Location.getReg(), |