i386.c (call, call_value): Make sure that resulting call_insn does have proper second...
authorJan Hubicka <jh@suse.cz>
Mon, 9 Apr 2001 11:18:39 +0000 (13:18 +0200)
committerJan Hubicka <hubicka@gcc.gnu.org>
Mon, 9 Apr 2001 11:18:39 +0000 (11:18 +0000)
* i386.c (call, call_value): Make sure that resulting call_insn
does have proper second operand.

From-SVN: r41201

gcc/ChangeLog
gcc/config/i386/i386-protos.h
gcc/config/i386/i386.h
gcc/config/i386/i386.md

index 2c95ae3d57412366260a68f4ac2b086744095a17..235e319fe90d61f54b6d8f46e5497c39673796a0 100644 (file)
@@ -1,3 +1,8 @@
+Sun Apr  8 00:43:27 CEST 2001  Jan Hubicka  <jh@suse.cz>
+
+       * i386.c (call, call_value): Make sure that resulting call_insn
+       does have proper second operand.
+
 Sun Apr  8 22:50:49 2001  Christopher Faylor <cgf@cygnus.com>
 
        * config/i386/xm-cygwin.h (GET_ENV_PATH_LIST): Eliminate obsolete
index 28fc3ffebfe1035944fe8d9f8e296cce5804182e..f5e937182982480ceb2ff185f9a558fd09ede415 100644 (file)
@@ -118,6 +118,7 @@ extern void ix86_expand_branch PARAMS ((enum rtx_code, rtx));
 extern int ix86_expand_setcc PARAMS ((enum rtx_code, rtx));
 extern int ix86_expand_int_movcc PARAMS ((rtx[]));
 extern int ix86_expand_fp_movcc PARAMS ((rtx[]));
+extern void x86_initialize_trampoline PARAMS ((rtx, rtx, rtx));
 extern void ix86_split_long_move PARAMS ((rtx[]));
 extern void ix86_split_ashldi PARAMS ((rtx *, rtx));
 extern void ix86_split_ashrdi PARAMS ((rtx *, rtx));
index 8ccf8911212990fe9261a67b49fab94b64b2093e..c44882781bc32a8784b648ab5088824353fc8118 100644 (file)
@@ -1704,23 +1704,14 @@ pop{l} %0"                                                      \
 
 /* Length in units of the trampoline for entering a nested function.  */
 
-#define TRAMPOLINE_SIZE 10
+#define TRAMPOLINE_SIZE (TARGET_64BIT ? 23 : 10)
 
 /* Emit RTL insns to initialize the variable parts of a trampoline.
    FNADDR is an RTX for the address of the function's pure code.
    CXT is an RTX for the static chain value for the function.  */
 
 #define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT)                      \
-{                                                                      \
-  /* Compute offset from the end of the jmp to the target function.  */        \
-  rtx disp = expand_binop (SImode, sub_optab, FNADDR,                  \
-                          plus_constant (TRAMP, 10),                   \
-                          NULL_RTX, 1, OPTAB_DIRECT);                  \
-  emit_move_insn (gen_rtx_MEM (QImode, TRAMP), GEN_INT (0xb9));                \
-  emit_move_insn (gen_rtx_MEM (SImode, plus_constant (TRAMP, 1)), CXT); \
-  emit_move_insn (gen_rtx_MEM (QImode, plus_constant (TRAMP, 5)), GEN_INT (0xe9));\
-  emit_move_insn (gen_rtx_MEM (SImode, plus_constant (TRAMP, 6)), disp); \
-}
+   x86_initialize_trampoline (TRAMP, FNADDR, CXT)
 \f
 /* Definitions for register eliminations.
 
index 5aa3e493ea4e2574216c2572145b7f1acf2026d5..dd104230d5c77daa09033eb0a539b310dcfd9ef5 100644 (file)
 
 (define_expand "call"
   [(call (match_operand:QI 0 "" "")
-        (match_operand 2 "" ""))]
+        (match_operand 1 "" ""))
+   (use (match_operand 2 "" ""))]
   ;; Operand 1 not used on the i386.
   ""
   "
 {
+  rtx insn;
   /* Static functions and indirect calls don't need
      current_function_uses_pic_offset_table.  */
   if (flag_pic
     XEXP (operands[0], 0) = copy_to_mode_reg (Pmode, XEXP (operands[0], 0));
   if (TARGET_64BIT && INTVAL (operands[2]) >= 0)
     {
-      rtx insn;
       rtx reg = gen_rtx_REG (QImode, 0);
       emit_move_insn (reg, operands[2]);
-      insn = emit_call_insn (gen_call_exp (operands[0], operands[2]));
+      insn = emit_call_insn (gen_call_exp (operands[0], operands[1]));
       use_reg (&CALL_INSN_FUNCTION_USAGE (insn), reg);
       DONE;
     }
+   insn = emit_call_insn (gen_call_exp (operands[0], operands[1]));
+   DONE;
 }")
 
 (define_expand "call_exp"
 (define_expand "call_value"
   [(set (match_operand 0 "" "")
        (call (match_operand:QI 1 "" "")
-             (match_operand:SI 3 "" "")))]
+             (match_operand:SI 2 "" "")))
+   (use (match_operand:SI 3 "" ""))]
   ;; Operand 2 not used on the i386.
   ""
   "
 {
+  rtx insn;
   /* Static functions and indirect calls don't need
      current_function_uses_pic_offset_table.  */
   if (flag_pic
     XEXP (operands[1], 0) = copy_to_mode_reg (Pmode, XEXP (operands[1], 0));
   if (TARGET_64BIT && INTVAL (operands[3]) >= 0)
     {
-      rtx insn;
       rtx reg = gen_rtx_REG (QImode, 0);
       emit_move_insn (reg, operands[3]);
       insn = emit_call_insn (gen_call_value_exp (operands[0], operands[1],
-                                                operands[3]));
+                                                operands[2]));
       use_reg (&CALL_INSN_FUNCTION_USAGE (insn), reg);
       DONE;
     }
+  insn = emit_call_insn (gen_call_value_exp (operands[0], operands[1],
+                                            operands[2]));
+  DONE;
 }")
 
 (define_expand "call_value_exp"