Use frame index, if available for byval argument while lowering dbg_declare. Otherwise let getRegForValue() find register for this argument.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113843 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Devang Patel 2010-09-14 20:29:31 +00:00
parent 6f9eea87f7
commit 6fe75aaaeb

View File

@ -467,24 +467,28 @@ bool FastISel::SelectCall(const User *I) {
return true; return true;
const Value *Address = DI->getAddress(); const Value *Address = DI->getAddress();
if (!Address) if (!Address || isa<UndefValue>(Address) || isa<AllocaInst>(Address))
return true; return true;
if (isa<UndefValue>(Address))
return true; unsigned Reg = 0;
const AllocaInst *AI = dyn_cast<AllocaInst>(Address); unsigned Offset = 0;
// Don't handle byval struct arguments or VLAs, for example. if (const Argument *Arg = dyn_cast<Argument>(Address)) {
if (!AI) { if (Arg->hasByValAttr()) {
// Building the map above is target independent. Generating DBG_VALUE // Byval arguments' frame index is recorded during argument lowering.
// inline is target dependent; do this now. // Use this info directly.
DenseMap<const Value *, unsigned>::iterator It = Offset = FuncInfo.getByValArgumentFrameIndex(Arg);
FuncInfo.ValueMap.find(Address); if (Offset)
if (0 && It != FuncInfo.ValueMap.end()) { Reg = TRI.getFrameRegister(*FuncInfo.MF);
}
}
if (!Reg)
Reg = getRegForValue(Address);
if (Reg)
BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DL, BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DL,
TII.get(TargetOpcode::DBG_VALUE)) TII.get(TargetOpcode::DBG_VALUE))
.addReg(It->second, RegState::Debug).addImm(0).addMetadata(DI->getVariable()); .addReg(Reg, RegState::Debug).addImm(Offset)
} else .addMetadata(DI->getVariable());
(void)TargetSelectInstruction(cast<Instruction>(I));
}
return true; return true;
} }
case Intrinsic::dbg_value: { case Intrinsic::dbg_value: {