function.c Grrrr

Jeffrey A Law law@cygnus.com
Thu Nov 11 23:35:00 GMT 1999


You have to be careful when you call hard_function_value.  If the value
wasn't supposed to be returned in a register (consider a large structure)
hard_function_value will abort.  

So this returns most of the original logic and arranges to call
hard_function_value only when we know we're returning a value in a
register.

	* function.c (diddle_return_value): Only clal hard_function_value
	when the return value is supposed to be in a register.

Index: function.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/function.c,v
retrieving revision 1.134
diff -c -3 -p -r1.134 function.c
*** function.c	1999/11/12 03:46:21	1.134
--- function.c	1999/11/12 07:24:30
*************** void
*** 6200,6218 ****
  diddle_return_value (code)
       enum rtx_code code;
  {
-   rtx return_reg;
    tree decl_result = DECL_RESULT (current_function_decl);
  
!   if (DECL_RTL (decl_result))
      {
-       /* Use hard_function_value to avoid creating a reference to a BLKmode 
- 	 register in the USE/CLOBBER insn.  */
-       return_reg = hard_function_value (TREE_TYPE (decl_result),
- 					current_function_decl);
- 
        if (GET_CODE (return_reg) == REG
  	  && REGNO (return_reg) < FIRST_PSEUDO_REGISTER)
! 	emit_insn (gen_rtx_fmt_e (code, VOIDmode, return_reg));
        else if (GET_CODE (return_reg) == PARALLEL)
  	{
  	  int i;
--- 6200,6219 ----
  diddle_return_value (code)
       enum rtx_code code;
  {
    tree decl_result = DECL_RESULT (current_function_decl);
+   rtx return_reg = DECL_RTL (decl_result);
  
!   if (return_reg)
      {
        if (GET_CODE (return_reg) == REG
  	  && REGNO (return_reg) < FIRST_PSEUDO_REGISTER)
! 	{
! 	  /* Use hard_function_value to avoid creating a reference to a BLKmode 
! 	     register in the USE/CLOBBER insn.  */
! 	  return_reg = hard_function_value (TREE_TYPE (decl_result),
! 					    current_function_decl);
! 	  emit_insn (gen_rtx_fmt_e (code, VOIDmode, return_reg));
! 	}
        else if (GET_CODE (return_reg) == PARALLEL)
  	{
  	  int i;




More information about the Gcc-patches mailing list