]> gcc.gnu.org Git - gcc.git/commitdiff
s390.c (s390_emit_prologue): Do not emit USE insn for GOT register; add REG_MAYBE_DEA...
authorUlrich Weigand <uweigand@de.ibm.com>
Wed, 16 Jan 2002 14:15:25 +0000 (14:15 +0000)
committerUlrich Weigand <uweigand@gcc.gnu.org>
Wed, 16 Jan 2002 14:15:25 +0000 (14:15 +0000)
* config/s390/s390.c (s390_emit_prologue): Do not emit USE
insn for GOT register; add REG_MAYBE_DEAD notes instead.
config/s390/s390.md (call, call_value): Add GOT register to
CALL_INSN_FUNCTION_USAGE where needed.
(call_exp, call_value_exp): New.

From-SVN: r48908

gcc/ChangeLog
gcc/config/s390/s390.c
gcc/config/s390/s390.md

index 03e675b482d8910a3f007bd3a4ab866da91cdf88..5c262ab4a80b7af120f13d3c0957439ab4450181 100644 (file)
@@ -1,3 +1,11 @@
+2002-01-16  Ulrich Weigand  <uweigand@de.ibm.com>
+
+       * config/s390/s390.c (s390_emit_prologue): Do not emit USE
+       insn for GOT register; add REG_MAYBE_DEAD notes instead.
+       config/s390/s390.md (call, call_value): Add GOT register to
+       CALL_INSN_FUNCTION_USAGE where needed.
+       (call_exp, call_value_exp): New.
+
 2002-01-16  Nick Clifton  <nickc@cambridge.redhat.com>
 
        * config/arm/arm.c: General formatting tidy up.
index f1f45ccf8155695db3b3f3c03dd653d95adfc338..2cf2e41fd1f078e04a5a9989d48488aee768dd74 100644 (file)
@@ -2989,11 +2989,13 @@ s390_emit_prologue ()
          got_symbol = force_const_mem (Pmode, got_symbol);
          insn = emit_move_insn (pic_offset_table_rtx,
                                 got_symbol);            
+          REG_NOTES(insn) = gen_rtx_EXPR_LIST (REG_MAYBE_DEAD, NULL_RTX,
+                                               REG_NOTES (insn));
+
          insn = emit_insn (gen_add2_insn (pic_offset_table_rtx,
                                           gen_rtx_REG (Pmode, BASE_REGISTER)));
-
-         /* We need the GOT pointer even if we don't know it ...  */
-         emit_insn (gen_rtx_USE (VOIDmode, pic_offset_table_rtx));
+          REG_NOTES(insn) = gen_rtx_EXPR_LIST (REG_MAYBE_DEAD, NULL_RTX,
+                                               REG_NOTES (insn));
        }
     }      
 }
index 8a8b2eedc2c8320d6b91f1e257a64217b7f6b10b..9a50992f95364909f8a7f3a8e6ddf04acede96a5 100644 (file)
 ;
 
 (define_expand "call"
-  [(parallel [(call (match_operand 0 "" "")
-                    (match_operand 1 "" ""))
-              (clobber (match_operand 2 "" ""))])]
+  [(call (match_operand 0 "" "")
+         (match_operand 1 "" ""))
+   (use (match_operand 2 "" ""))]
   ""
   "
 {
-  /* Abuse operand 2 to hold the return register.  */
-  operands[2] = gen_rtx_REG (Pmode, RETURN_REGNUM);
-
-  /* In 31-bit, we must load the GOT register even if the 
-     compiler doesn't know about it, because the PLT glue 
-     code uses it.  In 64-bit, this is not necessary.  */
-  if (flag_pic && !TARGET_64BIT)
-    current_function_uses_pic_offset_table = 1;
+  int plt_call = 0;
+  rtx insn;
 
   /* Direct function calls need special treatment.  */
   if (GET_CODE (XEXP (operands[0], 0)) == SYMBOL_REF)
 
       /* When calling a global routine in PIC mode, we must
          replace the symbol itself with the PLT stub.  */
-      if (flag_pic && !SYMBOL_REF_FLAG(sym))
+      if (flag_pic && !SYMBOL_REF_FLAG (sym))
         {
           sym = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, sym), 113);
           sym = gen_rtx_CONST (Pmode, sym);
+
+         plt_call = 1;
         }
 
       /* Unless we can use the bras(l) insn, force the 
 
       operands[0] = gen_rtx_MEM (QImode, sym);
     }
+
+  /* Emit insn.  */
+  insn = emit_call_insn (gen_call_exp (operands[0], operands[1],
+                                      gen_rtx_REG (Pmode, RETURN_REGNUM)));
+
+  /* In 31-bit, we must load the GOT register even if the 
+     compiler doesn't know about it, because the PLT glue 
+     code uses it.  In 64-bit, this is not necessary.  */
+  if (plt_call && !TARGET_64BIT)
+    {
+      current_function_uses_pic_offset_table = 1;
+      use_reg (&CALL_INSN_FUNCTION_USAGE (insn), pic_offset_table_rtx);
+    }
+
+  DONE;
 }")
 
+(define_expand "call_exp"
+  [(parallel [(call (match_operand 0 "" "")
+                    (match_operand 1 "" ""))
+              (clobber (match_operand 2 "" ""))])]
+  ""
+  "")
+
 (define_insn "brasl"
   [(call (mem:QI (match_operand:DI 0 "bras_sym_operand" "X"))
          (match_operand:SI 1 "const_int_operand" "n"))
 ;
 
 (define_expand "call_value"
-  [(parallel [(set (match_operand 0 "" "")
-                   (call (match_operand 1 "" "")
-                         (match_operand 2 "" "")))
-              (clobber (match_operand 3 "" ""))])]
+  [(set (match_operand 0 "" "")
+        (call (match_operand 1 "" "")
+              (match_operand 2 "" "")))
+   (use (match_operand 3 "" ""))]
   ""
   "
 {
-  /* Abuse operand 3 to hold the return register.  */
-  operands[3] = gen_rtx_REG (Pmode, RETURN_REGNUM);
-
-  /* In 31-bit, we must load the GOT register even if the 
-     compiler doesn't know about it, because the PLT glue 
-     code uses it.  In 64-bit, this is not necessary.  */
-  if (flag_pic && !TARGET_64BIT)
-    current_function_uses_pic_offset_table = 1;
+  int plt_call = 0;
+  rtx insn;
 
   /* Direct function calls need special treatment.  */
   if (GET_CODE (XEXP (operands[1], 0)) == SYMBOL_REF)
 
       /* When calling a global routine in PIC mode, we must
          replace the symbol itself with the PLT stub.  */
-      if (flag_pic && !SYMBOL_REF_FLAG(sym))
+      if (flag_pic && !SYMBOL_REF_FLAG (sym))
         {
           sym = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, sym), 113);
           sym = gen_rtx_CONST (Pmode, sym);
+
+         plt_call = 1;
         }
 
       /* Unless we can use the bras(l) insn, force the 
 
       operands[1] = gen_rtx_MEM (QImode, sym);
     }
+
+  /* Emit insn.  */
+  insn = emit_call_insn (
+           gen_call_value_exp (operands[0], operands[1], operands[2],
+                               gen_rtx_REG (Pmode, RETURN_REGNUM)));
+
+  /* In 31-bit, we must load the GOT register even if the 
+     compiler doesn't know about it, because the PLT glue 
+     code uses it.  In 64-bit, this is not necessary.  */
+  if (plt_call && !TARGET_64BIT)
+    {
+      current_function_uses_pic_offset_table = 1;
+      use_reg (&CALL_INSN_FUNCTION_USAGE (insn), pic_offset_table_rtx);
+    }
+
+  DONE;
 }")
 
+(define_expand "call_value_exp"
+  [(parallel [(set (match_operand 0 "" "")
+                   (call (match_operand 1 "" "")
+                         (match_operand 2 "" "")))
+              (clobber (match_operand 3 "" ""))])]
+  ""
+  "")
+
 (define_insn "brasl_r"
   [(set (match_operand 0 "register_operand" "=df")
         (call (mem:QI (match_operand:DI 1 "bras_sym_operand" "X"))
This page took 0.090686 seconds and 5 git commands to generate.