This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix alpha and arm bootstrap failures


Hi Richard and Brad,

I wonder if you could test the following patch to see whether it
fixes your bootstrap failures on the alpha and the arm.

My controversial approach is that the code below that attaches
REG_EQUAL notes to libcalls with the intent of allowing them to
be CSE'd is incorrect and inappropriate.  Rather than list the
function name and arguments in an expression list, the correct
approach is for higher-level routines, such as prepare_float_lib_cmp,
to store "REG_EQUAL (gt:DF (...) (...))" on the libcall insn.
This will not only allow it to be CSE and GCSE, but enable numerous
other optimizations and RTL simplifications.

The current code is clearly abusing the REG_EQUAL notes...


Let me know if it solves your problems, in which case I'll repost
it to gcc-patches with a ChangeLog for formal approval.


Roger


Index: calls.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/calls.c,v
retrieving revision 1.258
diff -c -3 -p -r1.258 calls.c
*** calls.c	23 Feb 2003 22:19:39 -0000	1.258
--- calls.c	25 Feb 2003 19:41:12 -0000
*************** expand_call (exp, target, ignore)
*** 3105,3111 ****
  	    }
  	  else
  	    {
- 	      rtx note = 0;
  	      rtx temp = gen_reg_rtx (GET_MODE (valreg));

  	      /* Mark the return value as a pointer if needed.  */
--- 3105,3110 ----
*************** expand_call (exp, target, ignore)
*** 3113,3136 ****
  		mark_reg_pointer (temp,
  				  TYPE_ALIGN (TREE_TYPE (TREE_TYPE (exp))));

- 	      /* Construct an "equal form" for the value which mentions all the
- 		 arguments in order as well as the function name.  */
- 	      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 ();
  	      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;
  	    }
--- 3112,3121 ----
  		mark_reg_pointer (temp,
  				  TYPE_ALIGN (TREE_TYPE (TREE_TYPE (exp))));

  	      insns = get_insns ();
  	      end_sequence ();

! 	      emit_libcall_block (insns, temp, valreg, NULL_RTX);

  	      valreg = temp;
  	    }
*************** emit_library_call_value_1 (retval, orgfu
*** 4091,4099 ****
  	}
        else
  	{
- 	  rtx note = 0;
  	  rtx temp;
- 	  int i;

  	  if (GET_CODE (valreg) == PARALLEL)
  	    {
--- 4076,4082 ----
*************** emit_library_call_value_1 (retval, orgfu
*** 4104,4126 ****

  	  temp = gen_reg_rtx (GET_MODE (valreg));

- 	  /* 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;
  	}
--- 4087,4096 ----

  	  temp = gen_reg_rtx (GET_MODE (valreg));

  	  insns = get_insns ();
  	  end_sequence ();

! 	  emit_libcall_block (insns, temp, valreg, NULL_RTX);

  	  valreg = temp;
  	}

Roger
--
Roger Sayle,                         E-mail: roger at eyesopen dot com
OpenEye Scientific Software,         WWW: http://www.eyesopen.com/
Suite 1107, 3600 Cerrillos Road,     Tel: (+1) 505-473-7385
Santa Fe, New Mexico, 87507.         Fax: (+1) 505-473-0833


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]