diff options
| author | Simon Dardis <simon.dardis@imgtec.com> | 2016-08-18 13:22:43 +0000 |
|---|---|---|
| committer | Simon Dardis <simon.dardis@imgtec.com> | 2016-08-18 13:22:43 +0000 |
| commit | ea3431598e552fdfb7cd69f92fecc661d64fa2b1 (patch) | |
| tree | 7d3f9520e0b820906b5f64c905f34612d766a221 /llvm/lib/Target/Mips/MipsInstrInfo.td | |
| parent | 83f6bbc1546fbc7736efb8c13d2590f5c3fd3647 (diff) | |
| download | bcm5719-llvm-ea3431598e552fdfb7cd69f92fecc661d64fa2b1.tar.gz bcm5719-llvm-ea3431598e552fdfb7cd69f92fecc661d64fa2b1.zip | |
[mips] Correct tail call encoding for MIPSR6
r277708 enabled tails calls for MIPS but used the 'jr' instruction when the
jump target was held in a register. For MIPSR6, 'jalr $zero, $reg' should
have been used. Additionally, add missing patterns for external and global
symbols for tail calls.
Reviewers: dsanders, vkalintiris
Differential Review: https://reviews.llvm.org/D23301
llvm-svn: 279064
Diffstat (limited to 'llvm/lib/Target/Mips/MipsInstrInfo.td')
| -rw-r--r-- | llvm/lib/Target/Mips/MipsInstrInfo.td | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/llvm/lib/Target/Mips/MipsInstrInfo.td b/llvm/lib/Target/Mips/MipsInstrInfo.td index ff8a5fba732..4dd8a5c719a 100644 --- a/llvm/lib/Target/Mips/MipsInstrInfo.td +++ b/llvm/lib/Target/Mips/MipsInstrInfo.td @@ -1370,14 +1370,12 @@ let isCall=1, hasDelaySlot=1, isCTI=1, Defs = [RA] in { let isCall = 1, isTerminator = 1, isReturn = 1, isBarrier = 1, hasDelaySlot = 1, hasExtraSrcRegAllocReq = 1, isCTI = 1, Defs = [AT] in { - class TailCall<Instruction JumpInst> : + class TailCall<Instruction JumpInst, DAGOperand Opnd> : PseudoSE<(outs), (ins calltarget:$target), [], II_J>, - PseudoInstExpansion<(JumpInst jmptarget:$target)>; + PseudoInstExpansion<(JumpInst Opnd:$target)>; - class TailCallReg<RegisterOperand RO, Instruction JRInst, - RegisterOperand ResRO = RO> : - PseudoSE<(outs), (ins RO:$rs), [(MipsTailCall RO:$rs)], II_JR>, - PseudoInstExpansion<(JRInst ResRO:$rs)>; + class TailCallReg<RegisterOperand RO> : + MipsPseudo<(outs), (ins RO:$rs), [(MipsTailCall RO:$rs)], II_JR>; } class BAL_BR_Pseudo<Instruction RealInst> : @@ -1919,11 +1917,12 @@ def BLTZALL : MMRel, BGEZAL_FT<"bltzall", brtarget, GPR32Opnd, 0>, BGEZAL_FM<0x12>, ISA_MIPS2_NOT_32R6_64R6; def BAL_BR : BAL_BR_Pseudo<BGEZAL>; -let AdditionalPredicates = [NotInMicroMips] in { -def TAILCALL : TailCall<J>, ISA_MIPS1_NOT_32R6_64R6; -def TAILCALLREG : TailCallReg<GPR32Opnd, JR>, ISA_MIPS1_NOT_32R6_64R6, GPR_32; +let Predicates = [NotInMicroMips] in { + def TAILCALL : TailCall<J, jmptarget>; } +def TAILCALLREG : TailCallReg<GPR32Opnd>; + // Indirect branches are matched as PseudoIndirectBranch/PseudoIndirectBranch64 // then are expanded to JR, JR64, JALR, or JALR64 depending on the ISA. class PseudoIndirectBranchBase<RegisterOperand RO> : |

