mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 19:52:54 +01:00
Stop abusing EmitInstrWithCustomInserter for target-dependent
form of DEBUG_VALUE, as it doesn't have reasonable default behavior for unsupported targets. Add a new hook instead. No functional change. llvm-svn: 102320
This commit is contained in:
parent
115b2b2e36
commit
d27eedab6d
@ -1255,6 +1255,16 @@ public:
|
|||||||
return SDValue();
|
return SDValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// EmitTargetCodeForFrameDebugValue - Emit a target-dependent form of
|
||||||
|
/// DBG_VALUE encoding the address of a frame index. Addresses would
|
||||||
|
/// normally be lowered the same way as other addresses on the target,
|
||||||
|
/// e.g. in load instructions. For targets that do not support this
|
||||||
|
/// the debug info is simply lost.
|
||||||
|
virtual void
|
||||||
|
EmitTargetCodeForFrameDebugValue(MachineBasicBlock* BB, unsigned FrameIx,
|
||||||
|
uint64_t Offset, MDNode *MDPtr,
|
||||||
|
DebugLoc dl) const {}
|
||||||
|
|
||||||
/// LowerOperationWrapper - This callback is invoked by the type legalizer
|
/// LowerOperationWrapper - This callback is invoked by the type legalizer
|
||||||
/// to legalize nodes with an illegal operand type but legal result types.
|
/// to legalize nodes with an illegal operand type but legal result types.
|
||||||
/// It replaces the LowerOperation callback in the type Legalizer.
|
/// It replaces the LowerOperation callback in the type Legalizer.
|
||||||
|
@ -514,6 +514,14 @@ MachineInstr *InstrEmitter::EmitDbgValue(SDDbgValue *SD,
|
|||||||
MDNode* MDPtr = SD->getMDPtr();
|
MDNode* MDPtr = SD->getMDPtr();
|
||||||
DebugLoc DL = SD->getDebugLoc();
|
DebugLoc DL = SD->getDebugLoc();
|
||||||
|
|
||||||
|
if (SD->getKind() == SDDbgValue::FRAMEIX) {
|
||||||
|
// Stack address; this needs to be lowered in target-dependent fashion.
|
||||||
|
// EmitTargetCodeForFrameDebugValue is responsible for allocation.
|
||||||
|
unsigned FrameIx = SD->getFrameIx();
|
||||||
|
TLI->EmitTargetCodeForFrameDebugValue(InsertBB, FrameIx, Offset, MDPtr, DL);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
// Otherwise, we're going to create an instruction here.
|
||||||
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) {
|
||||||
@ -541,15 +549,6 @@ MachineInstr *InstrEmitter::EmitDbgValue(SDDbgValue *SD,
|
|||||||
// dropped.
|
// dropped.
|
||||||
MIB.addReg(0U);
|
MIB.addReg(0U);
|
||||||
}
|
}
|
||||||
} else if (SD->getKind() == SDDbgValue::FRAMEIX) {
|
|
||||||
unsigned FrameIx = SD->getFrameIx();
|
|
||||||
// Stack address; this needs to be lowered in target-dependent fashion.
|
|
||||||
// FIXME test that the target supports this somehow; if not emit Undef.
|
|
||||||
// Create a pseudo for EmitInstrWithCustomInserter's consumption.
|
|
||||||
MIB.addImm(FrameIx).addImm(Offset).addMetadata(MDPtr);
|
|
||||||
abort();
|
|
||||||
TLI->EmitInstrWithCustomInserter(&*MIB, InsertBB, EM);
|
|
||||||
return 0;
|
|
||||||
} else {
|
} else {
|
||||||
// Insert an Undef so we can see what we dropped.
|
// Insert an Undef so we can see what we dropped.
|
||||||
MIB.addReg(0U);
|
MIB.addReg(0U);
|
||||||
|
@ -8622,6 +8622,19 @@ X86TargetLowering::EmitLoweredMingwAlloca(MachineInstr *MI,
|
|||||||
return BB;
|
return BB;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
X86TargetLowering::EmitTargetCodeForFrameDebugValue(MachineBasicBlock* BB,
|
||||||
|
unsigned FrameIx, uint64_t Offset,
|
||||||
|
MDNode *MDPtr, DebugLoc DL) const {
|
||||||
|
// Target dependent DBG_VALUE. Only the frame index case is done here.
|
||||||
|
const TargetInstrInfo *TII = getTargetMachine().getInstrInfo();
|
||||||
|
X86AddressMode AM;
|
||||||
|
AM.BaseType = X86AddressMode::FrameIndexBase;
|
||||||
|
AM.Base.FrameIndex = FrameIx;
|
||||||
|
addFullAddress(BuildMI(BB, DL, TII->get(X86::DBG_VALUE)), AM).
|
||||||
|
addImm(Offset).addMetadata(MDPtr);
|
||||||
|
}
|
||||||
|
|
||||||
MachineBasicBlock *
|
MachineBasicBlock *
|
||||||
X86TargetLowering::EmitInstrWithCustomInserter(MachineInstr *MI,
|
X86TargetLowering::EmitInstrWithCustomInserter(MachineInstr *MI,
|
||||||
MachineBasicBlock *BB,
|
MachineBasicBlock *BB,
|
||||||
@ -8724,21 +8737,6 @@ X86TargetLowering::EmitInstrWithCustomInserter(MachineInstr *MI,
|
|||||||
F->DeleteMachineInstr(MI); // The pseudo instruction is gone now.
|
F->DeleteMachineInstr(MI); // The pseudo instruction is gone now.
|
||||||
return BB;
|
return BB;
|
||||||
}
|
}
|
||||||
// DBG_VALUE. Only the frame index case is done here.
|
|
||||||
case X86::DBG_VALUE: {
|
|
||||||
const TargetInstrInfo *TII = getTargetMachine().getInstrInfo();
|
|
||||||
DebugLoc DL = MI->getDebugLoc();
|
|
||||||
X86AddressMode AM;
|
|
||||||
MachineFunction *F = BB->getParent();
|
|
||||||
AM.BaseType = X86AddressMode::FrameIndexBase;
|
|
||||||
AM.Base.FrameIndex = MI->getOperand(0).getImm();
|
|
||||||
addFullAddress(BuildMI(BB, DL, TII->get(X86::DBG_VALUE)), AM).
|
|
||||||
addImm(MI->getOperand(1).getImm()).
|
|
||||||
addMetadata(MI->getOperand(2).getMetadata());
|
|
||||||
F->DeleteMachineInstr(MI); // Remove pseudo.
|
|
||||||
return BB;
|
|
||||||
}
|
|
||||||
|
|
||||||
// String/text processing lowering.
|
// String/text processing lowering.
|
||||||
case X86::PCMPISTRM128REG:
|
case X86::PCMPISTRM128REG:
|
||||||
return EmitPCMP(MI, BB, 3, false /* in-mem */);
|
return EmitPCMP(MI, BB, 3, false /* in-mem */);
|
||||||
|
@ -453,6 +453,11 @@ namespace llvm {
|
|||||||
/// and some i16 instructions are slow.
|
/// and some i16 instructions are slow.
|
||||||
virtual bool IsDesirableToPromoteOp(SDValue Op, EVT &PVT) const;
|
virtual bool IsDesirableToPromoteOp(SDValue Op, EVT &PVT) const;
|
||||||
|
|
||||||
|
virtual void
|
||||||
|
EmitTargetCodeForFrameDebugValue(MachineBasicBlock* BB,
|
||||||
|
unsigned FrameIx, uint64_t Offset,
|
||||||
|
MDNode *MDPtr, DebugLoc DL) const;
|
||||||
|
|
||||||
virtual MachineBasicBlock *EmitInstrWithCustomInserter(MachineInstr *MI,
|
virtual MachineBasicBlock *EmitInstrWithCustomInserter(MachineInstr *MI,
|
||||||
MachineBasicBlock *MBB,
|
MachineBasicBlock *MBB,
|
||||||
DenseMap<MachineBasicBlock*, MachineBasicBlock*> *EM) const;
|
DenseMap<MachineBasicBlock*, MachineBasicBlock*> *EM) const;
|
||||||
|
Loading…
Reference in New Issue
Block a user