MC/X86: Lower TAILCALLd[64] to JMP_1, to allow relaxation and to avoid same
authorDaniel Dunbar <daniel@zuster.org>
Wed, 19 May 2010 15:26:43 +0000 (15:26 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Wed, 19 May 2010 15:26:43 +0000 (15:26 +0000)
prefix byte problem as in r104062.
 - As a total hack to keep the TAILCALL markers in the output, which some tests depend on, this invents a new TAILJMP_1 instruction.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104120 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/X86/AsmPrinter/X86MCInstLower.cpp
lib/Target/X86/X86InstrInfo.td

index ec90fd6fe8d66984aca391624197258ce4278810..4edeca979872d6ed4f268b7b6daee3207af762f0 100644 (file)
@@ -379,6 +379,16 @@ void X86MCInstLower::Lower(const MachineInstr *MI, MCInst &OutMI) const {
     break;
   }
 
+  // TAILJMPd, TAILJMPd64 - Lower to the correct jump instructions.
+  case X86::TAILJMPd:
+  case X86::TAILJMPd64: {
+    MCOperand Saved = OutMI.getOperand(0);
+    OutMI = MCInst();
+    OutMI.setOpcode(X86::TAILJMP_1);
+    OutMI.addOperand(Saved);
+    break;
+  }
+
   // The assembler backend wants to see branches in their small form and relax
   // them to their large form.  The JIT can only handle the large form because
   // it does not do relaxation.  For now, translate the large form to the
index 818ccb0c440d031f90870870d6cd578e947eacac..a767b54f9621ee3e78f57fc688c2579deb714e22 100644 (file)
@@ -712,6 +712,13 @@ let isCall = 1, isTerminator = 1, isReturn = 1, isBarrier = 1 in
   let mayLoad = 1 in
   def TAILJMPm : I<0xFF, MRM4m, (outs), (ins i32mem_TC:$dst, variable_ops),
                    "jmp{l}\t{*}$dst  # TAILCALL", []>;
+
+  // FIXME: This is a hack so that MCInst lowering can preserve the TAILCALL
+  // marker on instructions, while still being able to relax.
+  let isCodeGenOnly = 1 in {
+    def TAILJMP_1 : Ii8PCRel<0xEB, RawFrm, (outs), (ins brtarget8:$dst),
+                         "jmp\t$dst  # TAILCALL", []>;
+  }
 }
 
 //===----------------------------------------------------------------------===//