From 418d1d1ea912eadd5c119a98ec5735c36a9e0221 Mon Sep 17 00:00:00 2001 From: Adrian Prantl Date: Tue, 9 Jul 2013 20:28:37 +0000 Subject: Reapply an improved version of r180816/180817. Change the informal convention of DBG_VALUE machine instructions so that we can express a register-indirect address with an offset of 0. The old convention was that a DBG_VALUE is a register-indirect value if the offset (operand 1) is nonzero. The new convention is that a DBG_VALUE is register-indirect if the first operand is a register and the second operand is an immediate. For plain register values the combination reg, reg is used. MachineInstrBuilder::BuildMI knows how to build the new DBG_VALUES. rdar://problem/13658587 llvm-svn: 185966 --- llvm/lib/CodeGen/SelectionDAG/FastISel.cpp | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) (limited to 'llvm/lib/CodeGen/SelectionDAG/FastISel.cpp') diff --git a/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp b/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp index cb55324aec3..14a2b005c04 100644 --- a/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp @@ -612,11 +612,13 @@ bool FastISel::SelectCall(const User *I) { return true; } + unsigned Offset = 0; Optional Op; if (const Argument *Arg = dyn_cast(Address)) // Some arguments' frame index is recorded during argument lowering. - if (int FI = FuncInfo.getArgumentFrameIndex(Arg)) - Op = MachineOperand::CreateFI(FI); + Offset = FuncInfo.getArgumentFrameIndex(Arg); + if (Offset) + Op = MachineOperand::CreateFI(Offset); if (!Op) if (unsigned Reg = lookUpRegForValue(Address)) Op = MachineOperand::CreateReg(Reg, false); @@ -638,12 +640,16 @@ bool FastISel::SelectCall(const User *I) { Op = MachineOperand::CreateReg(FuncInfo.InitializeRegForValue(Address), false); - if (Op && Op->isReg()) - Op->setIsDebug(true); - if (Op) - BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DL, - TII.get(TargetOpcode::DBG_VALUE)).addOperand(*Op).addImm(0) + if (Op->isReg()) { + Op->setIsDebug(true); + BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DL, + TII.get(TargetOpcode::DBG_VALUE), + /* IsIndirect */ DI->getAddress()->getType()->isPointerTy(), + Op->getReg(), Offset, DI->getVariable()); + } else + BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DL, + TII.get(TargetOpcode::DBG_VALUE)).addOperand(*Op).addImm(0) .addMetadata(DI->getVariable()); else // We can't yet handle anything else here because it would require @@ -676,9 +682,9 @@ bool FastISel::SelectCall(const User *I) { .addFPImm(CF).addImm(DI->getOffset()) .addMetadata(DI->getVariable()); } else if (unsigned Reg = lookUpRegForValue(V)) { - BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DL, II) - .addReg(Reg, RegState::Debug).addImm(DI->getOffset()) - .addMetadata(DI->getVariable()); + bool IsIndirect = DI->getOffset() != 0; + BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DL, II, IsIndirect, + Reg, DI->getOffset(), DI->getVariable()); } else { // We can't yet handle anything else here because it would require // generating code, thus altering codegen because of debug info. -- cgit v1.2.3