diff --git a/lib/Target/Mips/MipsInstrInfo.td b/lib/Target/Mips/MipsInstrInfo.td index 82a15efa46b..cc216c391dd 100644 --- a/lib/Target/Mips/MipsInstrInfo.td +++ b/lib/Target/Mips/MipsInstrInfo.td @@ -598,9 +598,10 @@ class SetCC_I op, string instr_asm, PatFrag cond_op, Operand Od, IIAlu>; // Jump -class JumpFJ op, string instr_asm, SDPatternOperator operator>: - FJ { +class JumpFJ op, DAGOperand opnd, string instr_asm, + SDPatternOperator operator, SDPatternOperator targetoperator>: + FJ { let isTerminator=1; let isBarrier=1; let hasDelaySlot = 1; @@ -1003,7 +1004,7 @@ def SC_P8 : SCBase<0x38, "sc", CPURegs, mem64>, } /// Jump and Branch Instructions -def J : JumpFJ<0x02, "j", br>, +def J : JumpFJ<0x02, jmptarget, "j", br, bb>, Requires<[RelocStatic, HasStandardEncoding]>, IsBranch; def JR : IndirectBranch; def B : UncondBranch<0x04, "b">; @@ -1022,7 +1023,7 @@ def JAL : JumpLink<0x03, "jal">; def JALR : JumpLinkReg<0x00, 0x09, "jalr", CPURegs>; def BGEZAL : BranchLink<"bgezal", 0x11, CPURegs>; def BLTZAL : BranchLink<"bltzal", 0x10, CPURegs>; -def TAILCALL : JumpFJ<0x02, "j", br>, IsTailCall; +def TAILCALL : JumpFJ<0x02, calltarget, "j", MipsTailCall, imm>, IsTailCall; def TAILCALL_R : JumpFR, IsTailCall; def RET : RetBase; @@ -1133,6 +1134,11 @@ def : MipsPat<(MipsJmpLink (i32 texternalsym:$dst)), //def : MipsPat<(MipsJmpLink CPURegs:$dst), // (JALR CPURegs:$dst)>; +// Tail call +def : MipsPat<(MipsTailCall (iPTR tglobaladdr:$dst)), + (TAILCALL tglobaladdr:$dst)>; +def : MipsPat<(MipsTailCall (iPTR texternalsym:$dst)), + (TAILCALL texternalsym:$dst)>; // hi/lo relocs def : MipsPat<(MipsHi tglobaladdr:$in), (LUi tglobaladdr:$in)>; def : MipsPat<(MipsHi tblockaddress:$in), (LUi tblockaddress:$in)>;