Fix JIT code emission of X86::MovePCtoStack.
authorEvan Cheng <evan.cheng@apple.com>
Sat, 22 Dec 2007 02:26:46 +0000 (02:26 +0000)
committerEvan Cheng <evan.cheng@apple.com>
Sat, 22 Dec 2007 02:26:46 +0000 (02:26 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45307 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/X86/X86ISelDAGToDAG.cpp
lib/Target/X86/X86InstrInfo.td

index e0183c6e1edaf24263c0a419cb9b5e771c13d8c4..c91b19a6afdff5577a6c25dc2ae2486a30b11d60 100644 (file)
@@ -994,7 +994,9 @@ SDNode *X86DAGToDAGISel::getGlobalBaseReg() {
     unsigned PC = RegMap->createVirtualRegister(X86::GR32RegisterClass);
     
     const TargetInstrInfo *TII = TM.getInstrInfo();
-    BuildMI(FirstMBB, MBBI, TII->get(X86::MovePCtoStack));
+    // Operand of MovePCtoStack is completely ignored by asm printer. It's
+    // only used in JIT code emission as displacement to pc.
+    BuildMI(FirstMBB, MBBI, TII->get(X86::MovePCtoStack)).addImm(0);
     BuildMI(FirstMBB, MBBI, TII->get(X86::POP32r), PC);
     
     // If we're using vanilla 'GOT' PIC style, we should use relative addressing
index f3b51dc127dce22f789de580c4b23df50d22dda1..233907a9a4c1039cfc056f51b9b21b3d15e5ae1e 100644 (file)
@@ -356,8 +356,8 @@ let isCall = 1 in
   let Defs = [EAX, ECX, EDX, FP0, FP1, FP2, FP3, FP4, FP5, FP6, ST0,
               MM0, MM1, MM2, MM3, MM4, MM5, MM6, MM7,
               XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7, EFLAGS] in {
-    def CALLpcrel32 : I<0xE8, RawFrm, (outs), (ins i32imm:$dst, variable_ops),
-                        "call\t${dst:call}", []>;
+    def CALLpcrel32 : Ii32<0xE8, RawFrm, (outs), (ins i32imm:$dst,variable_ops),
+                           "call\t${dst:call}", []>;
     def CALL32r     : I<0xFF, MRM2r, (outs), (ins GR32:$dst, variable_ops),
                         "call\t{*}$dst", [(X86call GR32:$dst)]>;
     def CALL32m     : I<0xFF, MRM2m, (outs), (ins i32mem:$dst, variable_ops),
@@ -408,8 +408,8 @@ def POPFD    : I<0x9D, RawFrm, (outs), (ins), "popf", []>;
 let Defs = [ESP], Uses = [ESP, EFLAGS] in
 def PUSHFD   : I<0x9C, RawFrm, (outs), (ins), "pushf", []>;
 
-def MovePCtoStack : I<0, Pseudo, (outs), (ins piclabel:$label),
-                      "call\t$label", []>;
+def MovePCtoStack : Ii32<0xE8, RawFrm, (outs), (ins piclabel:$label),
+                         "call\t$label", []>;
 
 let isTwoAddress = 1 in                               // GR32 = bswap GR32
   def BSWAP32r : I<0xC8, AddRegFrm,