1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 03:23:01 +02:00

Allow for the possibility that a debug-value points

to a SDNode that didn't have code generated for it.

llvm-svn: 100566
This commit is contained in:
Dale Johannesen 2010-04-06 21:59:56 +00:00
parent 4f6cdc07e9
commit fef6eb4076

View File

@ -517,8 +517,19 @@ MachineInstr *InstrEmitter::EmitDbgValue(SDDbgValue *SD,
const TargetInstrDesc &II = TII->get(TargetOpcode::DBG_VALUE); const TargetInstrDesc &II = TII->get(TargetOpcode::DBG_VALUE);
MachineInstrBuilder MIB = BuildMI(*MF, DL, II); MachineInstrBuilder MIB = BuildMI(*MF, DL, II);
if (SD->getKind() == SDDbgValue::SDNODE) { if (SD->getKind() == SDDbgValue::SDNODE) {
AddOperand(&*MIB, SDValue(SD->getSDNode(), SD->getResNo()), SDNode *Node = SD->getSDNode();
(*MIB).getNumOperands(), &II, VRBaseMap, true /*IsDebug*/); SDValue Op = SDValue(Node, SD->getResNo());
// It's possible we replaced this SDNode with other(s) and therefore
// didn't generate code for it. It's better to catch these cases where
// they happen and transfer the debug info, but trying to guarantee that
// in all cases would be very fragile; this is a safeguard for any
// that were missed.
DenseMap<SDValue, unsigned>::iterator I = VRBaseMap.find(Op);
if (I==VRBaseMap.end())
MIB.addReg(0U); // undef
else
AddOperand(&*MIB, Op, (*MIB).getNumOperands(), &II, VRBaseMap,
true /*IsDebug*/);
} else if (SD->getKind() == SDDbgValue::CONST) { } else if (SD->getKind() == SDDbgValue::CONST) {
Value *V = SD->getConst(); Value *V = SD->getConst();
if (ConstantInt *CI = dyn_cast<ConstantInt>(V)) { if (ConstantInt *CI = dyn_cast<ConstantInt>(V)) {