Bogus libcalls with multiple REG_RETVAL notes

Bernd Schmidt bernds@redhat.co.uk
Fri Sep 15 05:11:00 GMT 2000


Currently, gcc will in most cases generate libcalls incorrectly: it creates
two insns with a REG_RETVAL note.  One of them is the weird "equal form"
generated in calls.c, and the other one the regular one generated by the
callers of emit_library_call.

AFAICT the code in emit_library_call_value_1 to create the reg note with
the equal form is totally bogus and should be deleted.  That gives us
rtl that looks similar to what earlier compilers emitted.

I've found one place where we don't create a libcall sequence after
calling emit_library_call, and that's in prepare_float_lib_cmp.  That's
a possibility for further optimization.


Bernd

	* calls.c (emit_library_call_value_1): Don't create a libcall
	sequence here; our caller will in most cases do it.

Index: calls.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/calls.c,v
retrieving revision 1.155
diff -u -p -r1.155 calls.c
--- calls.c	2000/09/07 01:17:00	1.155
+++ calls.c	2000/09/15 10:58:23
@@ -3580,11 +3580,6 @@ emit_library_call_value_1 (retval, orgfu
 
   count = 0;
 
-  /* Now we are about to start emitting insns that can be deleted
-     if a libcall is deleted.  */
-  if (flags & (ECF_CONST | ECF_PURE))
-    start_sequence ();
-
   push_temp_slots ();
 
   /* If there's a structure value address to be passed,
@@ -4022,45 +4017,6 @@ emit_library_call_value_1 (retval, orgfu
   /* 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 | ECF_PURE))
-      && 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 ();
-
-      if (flags & ECF_PURE)
-	note = gen_rtx_EXPR_LIST (VOIDmode,
-	   gen_rtx_USE (VOIDmode,
-			gen_rtx_MEM (BLKmode,
-				     gen_rtx_SCRATCH (VOIDmode))), note);
-
-      emit_libcall_block (insns, temp, valreg, note);
-
-      valreg = temp;
-    }
-  else if (flags & (ECF_CONST | ECF_PURE))
-    {
-      /* 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.  */



More information about the Gcc-patches mailing list