diff options
| author | Reed Kotler <rkotler@mips.com> | 2013-02-24 06:16:39 +0000 |
|---|---|---|
| committer | Reed Kotler <rkotler@mips.com> | 2013-02-24 06:16:39 +0000 |
| commit | e2bead7a2da7fffe56cf126ca86e06b19386adf4 (patch) | |
| tree | 1843f936fc69aa1e84e8041857a9e74fd4f058b7 /llvm/lib | |
| parent | db74ffbe72d3d343c05e815d77163cfbbc7a3070 (diff) | |
| download | bcm5719-llvm-e2bead7a2da7fffe56cf126ca86e06b19386adf4.tar.gz bcm5719-llvm-e2bead7a2da7fffe56cf126ca86e06b19386adf4.zip | |
Make psuedo FEXT_T8I816_ins a custom inserter. It should be expanded
as early as possible; which means during instruction selection.
llvm-svn: 175984
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Target/Mips/Mips16InstrInfo.cpp | 22 | ||||
| -rw-r--r-- | llvm/lib/Target/Mips/Mips16InstrInfo.td | 1 | ||||
| -rw-r--r-- | llvm/lib/Target/Mips/MipsISelLowering.cpp | 30 | ||||
| -rw-r--r-- | llvm/lib/Target/Mips/MipsISelLowering.h | 3 |
4 files changed, 34 insertions, 22 deletions
diff --git a/llvm/lib/Target/Mips/Mips16InstrInfo.cpp b/llvm/lib/Target/Mips/Mips16InstrInfo.cpp index eacc8fc04a5..c04d49ed476 100644 --- a/llvm/lib/Target/Mips/Mips16InstrInfo.cpp +++ b/llvm/lib/Target/Mips/Mips16InstrInfo.cpp @@ -135,48 +135,26 @@ bool Mips16InstrInfo::expandPostRAPseudo(MachineBasicBlock::iterator MI) const { switch(MI->getDesc().getOpcode()) { default: return false; - case Mips::BteqzT8CmpX16: - ExpandFEXT_T8I816_ins(MBB, MI, Mips::BteqzX16, Mips::CmpRxRy16); - break; case Mips::BteqzT8CmpiX16: ExpandFEXT_T8I8I16_ins(MBB, MI, Mips::BteqzX16, Mips::CmpiRxImm16, Mips::CmpiRxImmX16); break; - case Mips::BteqzT8SltX16: - ExpandFEXT_T8I816_ins(MBB, MI, Mips::BteqzX16, Mips::SltRxRy16); - break; case Mips::BteqzT8SltiX16: ExpandFEXT_T8I8I16_ins(MBB, MI, Mips::BteqzX16, Mips::SltiRxImm16, Mips::SltiRxImmX16); break; - case Mips::BteqzT8SltuX16: - // TBD: figure out a way to get this or remove the instruction - // altogether. - ExpandFEXT_T8I816_ins(MBB, MI, Mips::BteqzX16, Mips::SltuRxRy16); - break; case Mips::BteqzT8SltiuX16: ExpandFEXT_T8I8I16_ins(MBB, MI, Mips::BteqzX16, Mips::SltiuRxImm16, Mips::SltiuRxImmX16); break; - case Mips::BtnezT8CmpX16: - ExpandFEXT_T8I816_ins(MBB, MI, Mips::BtnezX16, Mips::CmpRxRy16); - break; case Mips::BtnezT8CmpiX16: ExpandFEXT_T8I8I16_ins(MBB, MI, Mips::BtnezX16, Mips::CmpiRxImm16, Mips::CmpiRxImmX16); break; - case Mips::BtnezT8SltX16: - ExpandFEXT_T8I816_ins(MBB, MI, Mips::BtnezX16, Mips::SltRxRy16); - break; case Mips::BtnezT8SltiX16: ExpandFEXT_T8I8I16_ins(MBB, MI, Mips::BtnezX16, Mips::SltiRxImm16, Mips::SltiRxImmX16); break; - case Mips::BtnezT8SltuX16: - // TBD: figure out a way to get this or remove the instruction - // altogether. - ExpandFEXT_T8I816_ins(MBB, MI, Mips::BtnezX16, Mips::SltuRxRy16); - break; case Mips::BtnezT8SltiuX16: ExpandFEXT_T8I8I16_ins(MBB, MI, Mips::BtnezX16, Mips::SltiuRxImm16, Mips::SltiuRxImmX16); diff --git a/llvm/lib/Target/Mips/Mips16InstrInfo.td b/llvm/lib/Target/Mips/Mips16InstrInfo.td index 1a50faff11e..01be7e7137d 100644 --- a/llvm/lib/Target/Mips/Mips16InstrInfo.td +++ b/llvm/lib/Target/Mips/Mips16InstrInfo.td @@ -225,6 +225,7 @@ class FEXT_T8I816_ins<string asmstr, string asmstr2>: !strconcat(asmstr2, !strconcat("\t$rx, $ry\n\t", !strconcat(asmstr, "\t$imm"))),[]> { let isCodeGenOnly=1; + let usesCustomInserter = 1; } // diff --git a/llvm/lib/Target/Mips/MipsISelLowering.cpp b/llvm/lib/Target/Mips/MipsISelLowering.cpp index 68fa28b35b3..1a0d97bf6d2 100644 --- a/llvm/lib/Target/Mips/MipsISelLowering.cpp +++ b/llvm/lib/Target/Mips/MipsISelLowering.cpp @@ -1429,6 +1429,20 @@ MachineBasicBlock *MipsTargetLowering::EmitSeliT16 } + +MachineBasicBlock + *MipsTargetLowering::EmitFEXT_T8I816_ins(unsigned BtOpc, unsigned CmpOpc, + MachineInstr *MI, + MachineBasicBlock *BB) const { + const TargetInstrInfo *TII = getTargetMachine().getInstrInfo(); + unsigned regX = MI->getOperand(0).getReg(); + unsigned regY = MI->getOperand(1).getReg(); + MachineBasicBlock *target = MI->getOperand(2).getMBB(); + BuildMI(*BB, MI, MI->getDebugLoc(), TII->get(CmpOpc)).addReg(regX).addReg(regY); + BuildMI(*BB, MI, MI->getDebugLoc(), TII->get(BtOpc)).addMBB(target); + MI->eraseFromParent(); // The pseudo instruction is gone now. + return BB; +} MachineBasicBlock * MipsTargetLowering::EmitInstrWithCustomInserter(MachineInstr *MI, MachineBasicBlock *BB) const { @@ -1568,6 +1582,22 @@ MipsTargetLowering::EmitInstrWithCustomInserter(MachineInstr *MI, return EmitSelT16(Mips::BtnezX16, Mips::SltRxRy16, MI, BB); case Mips::SelTBtneZSltu: return EmitSelT16(Mips::BtnezX16, Mips::SltuRxRy16, MI, BB); + case Mips::BteqzT8CmpX16: + return EmitFEXT_T8I816_ins(Mips::BteqzX16, Mips::CmpRxRy16, MI, BB); + case Mips::BteqzT8SltX16: + return EmitFEXT_T8I816_ins(Mips::BteqzX16, Mips::SltRxRy16, MI, BB); + case Mips::BteqzT8SltuX16: + // TBD: figure out a way to get this or remove the instruction + // altogether. + return EmitFEXT_T8I816_ins(Mips::BteqzX16, Mips::SltuRxRy16, MI, BB); + case Mips::BtnezT8CmpX16: + return EmitFEXT_T8I816_ins(Mips::BtnezX16, Mips::CmpRxRy16, MI, BB); + case Mips::BtnezT8SltX16: + return EmitFEXT_T8I816_ins(Mips::BtnezX16, Mips::SltRxRy16, MI, BB); + case Mips::BtnezT8SltuX16: + // TBD: figure out a way to get this or remove the instruction + // altogether. + return EmitFEXT_T8I816_ins(Mips::BtnezX16, Mips::SltuRxRy16, MI, BB); } } diff --git a/llvm/lib/Target/Mips/MipsISelLowering.h b/llvm/lib/Target/Mips/MipsISelLowering.h index 2896de5d57a..ac05c832109 100644 --- a/llvm/lib/Target/Mips/MipsISelLowering.h +++ b/llvm/lib/Target/Mips/MipsISelLowering.h @@ -413,6 +413,9 @@ namespace llvm { MachineBasicBlock *EmitSelT16(unsigned Opc1, unsigned Opc2, MachineInstr *MI, MachineBasicBlock *BB) const; + MachineBasicBlock *EmitFEXT_T8I816_ins(unsigned BtOpc, unsigned CmpOpc, + MachineInstr *MI, + MachineBasicBlock *BB) const; }; } |

