mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-19 11:02:59 +02:00
Fix delay slot filler for non mips1 targets. Patch by Akira Hatanaka
llvm-svn: 121376
This commit is contained in:
parent
18da80f675
commit
0f5478218e
@ -31,7 +31,7 @@ namespace {
|
|||||||
const TargetInstrInfo *TII;
|
const TargetInstrInfo *TII;
|
||||||
|
|
||||||
static char ID;
|
static char ID;
|
||||||
Filler(TargetMachine &tm)
|
Filler(TargetMachine &tm)
|
||||||
: MachineFunctionPass(ID), TM(tm), TII(tm.getInstrInfo()) { }
|
: MachineFunctionPass(ID), TM(tm), TII(tm.getInstrInfo()) { }
|
||||||
|
|
||||||
virtual const char *getPassName() const {
|
virtual const char *getPassName() const {
|
||||||
@ -55,18 +55,22 @@ namespace {
|
|||||||
/// Currently, we fill delay slots with NOPs. We assume there is only one
|
/// Currently, we fill delay slots with NOPs. We assume there is only one
|
||||||
/// delay slot per delayed instruction.
|
/// delay slot per delayed instruction.
|
||||||
bool Filler::
|
bool Filler::
|
||||||
runOnMachineBasicBlock(MachineBasicBlock &MBB)
|
runOnMachineBasicBlock(MachineBasicBlock &MBB)
|
||||||
{
|
{
|
||||||
bool Changed = false;
|
bool Changed = false;
|
||||||
for (MachineBasicBlock::iterator I = MBB.begin(); I != MBB.end(); ++I)
|
for (MachineBasicBlock::iterator I = MBB.begin(); I != MBB.end(); ++I) {
|
||||||
if (TM.getSubtarget<MipsSubtarget>().isMips1() &&
|
const TargetInstrDesc& Tid = I->getDesc();
|
||||||
I->getDesc().hasDelaySlot()) {
|
if (Tid.hasDelaySlot() &&
|
||||||
|
(TM.getSubtarget<MipsSubtarget>().isMips1() ||
|
||||||
|
Tid.isCall() || Tid.isBranch() || Tid.isReturn())) {
|
||||||
MachineBasicBlock::iterator J = I;
|
MachineBasicBlock::iterator J = I;
|
||||||
++J;
|
++J;
|
||||||
BuildMI(MBB, J, I->getDebugLoc(), TII->get(Mips::NOP));
|
BuildMI(MBB, J, I->getDebugLoc(), TII->get(Mips::NOP));
|
||||||
++FilledSlots;
|
++FilledSlots;
|
||||||
Changed = true;
|
Changed = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return Changed;
|
return Changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user