OSDN Git Service

(expand_call): Do not reverse args in "equal from" field.
authorhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 12 Apr 2000 15:23:02 +0000 (15:23 +0000)
committerhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 12 Apr 2000 15:23:02 +0000 (15:23 +0000)
(emit_library_call_value_1): Emit_libcall_block for const and pure
function.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@33109 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/calls.c

index 99b9f5b..2a1a135 100644 (file)
@@ -1,3 +1,9 @@
+Wed Apr 12 17:20:41 MET DST 2000  Jan Hubicka  <jh@suse.cz>
+
+       (expand_call): Do not reverse args in "equal from" field.
+       (emit_library_call_value_1): Emit_libcall_block for const and pure
+       function.
+
 Wed Apr 12 16:00:25 2000  J"orn Rennecke <amylaar@cygnus.co.uk>
 
        * reload1.c (reload_combine): Don't enable optimization for fixed
index 611eff0..6424955 100644 (file)
@@ -2833,12 +2833,8 @@ expand_call (exp, target, ignore)
 
          /* Construct an "equal form" for the value which mentions all the
             arguments in order as well as the function name.  */
-         if (PUSH_ARGS_REVERSED)
-           for (i = 0; i < num_actuals; i++)
-             note = gen_rtx_EXPR_LIST (VOIDmode, args[i].initial_value, note);
-         else
-           for (i = num_actuals - 1; i >= 0; i--)
-             note = gen_rtx_EXPR_LIST (VOIDmode, args[i].initial_value, note);
+         for (i = 0; i < num_actuals; i++)
+           note = gen_rtx_EXPR_LIST (VOIDmode, args[i].initial_value, note);
          note = gen_rtx_EXPR_LIST (VOIDmode, funexp, note);
 
          insns = get_insns ();
@@ -3201,6 +3197,7 @@ emit_library_call_value_1 (retval, orgfun, value, no_queue, outmode, nargs, p)
   int old_inhibit_defer_pop = inhibit_defer_pop;
   rtx call_fusage = 0;
   rtx mem_value = 0;
+  rtx valreg;
   int pcc_struct_value = 0;
   int struct_value_size = 0;
   int flags = 0;
@@ -3283,6 +3280,11 @@ emit_library_call_value_1 (retval, orgfun, value, no_queue, outmode, nargs, p)
 
   count = 0;
 
+  /* Now we are about to start emitting insns that can be deleted
+     if a libcall is deleted.  */
+  if (flags & ECF_CONST)
+    start_sequence ();
+
   push_temp_slots ();
 
   /* If there's a structure value address to be passed,
@@ -3667,12 +3669,6 @@ emit_library_call_value_1 (retval, orgfun, value, no_queue, outmode, nargs, p)
       NO_DEFER_POP;
     }
 
-#if 0
-  /* For version 1.37, try deleting this entirely.  */
-  if (! no_queue)
-    emit_queue ();
-#endif
-
   /* Any regs containing parms remain in use through the call.  */
   for (count = 0; count < nargs; count++)
     {
@@ -3697,6 +3693,8 @@ emit_library_call_value_1 (retval, orgfun, value, no_queue, outmode, nargs, p)
   /* Don't allow popping to be deferred, since then
      cse'ing of library calls could delete a call and leave the pop.  */
   NO_DEFER_POP;
+  valreg = (mem_value == 0 && outmode != VOIDmode
+           ? hard_libcall_value (outmode) : NULL_RTX);
 
 #ifdef PREFERRED_STACK_BOUNDARY
   /* Stack must to be properly aligned now.  */
@@ -3718,12 +3716,45 @@ emit_library_call_value_1 (retval, orgfun, value, no_queue, outmode, nargs, p)
                original_args_size.constant, args_size.constant,
               struct_value_size,
               FUNCTION_ARG (args_so_far, VOIDmode, void_type_node, 1),
-              mem_value == 0 && outmode != VOIDmode ? hard_libcall_value (outmode) : NULL_RTX,
+              valreg,
               old_inhibit_defer_pop + 1, call_fusage, flags);
 
   /* Now restore inhibit_defer_pop to its actual original value.  */
   OK_DEFER_POP;
 
+  /* If call is cse'able, make appropriate pair of reg-notes around it.
+     Test valreg so we don't crash; may safely ignore `const'
+     if return type is void.  Disable for PARALLEL return values, because
+     we have no way to move such values into a pseudo register.  */
+  if ((flags & ECF_CONST)
+      && valreg != 0 && GET_CODE (valreg) != PARALLEL)
+    {
+      rtx note = 0;
+      rtx temp = gen_reg_rtx (GET_MODE (valreg));
+      rtx insns;
+      int i;
+
+      /* Construct an "equal form" for the value which mentions all the
+        arguments in order as well as the function name.  */
+      for (i = 0; i < nargs; i++)
+       note = gen_rtx_EXPR_LIST (VOIDmode, argvec[i].value, note);
+      note = gen_rtx_EXPR_LIST (VOIDmode, fun, note);
+
+      insns = get_insns ();
+      end_sequence ();
+
+      emit_libcall_block (insns, temp, valreg, note);
+
+      valreg = temp;
+    }
+  else if (flags & ECF_CONST)
+    {
+      /* Otherwise, just write out the sequence without a note.  */
+      rtx insns = get_insns ();
+
+      end_sequence ();
+      emit_insns (insns);
+    }
   pop_temp_slots ();
 
   /* Copy the value to the right place.  */