stmt.c (expand_return): If asked to return the RESULT_DECL, just call expand_value_re...
authorZack Weinberg <zack@gcc.gnu.org>
Wed, 11 Aug 2004 06:28:00 +0000 (06:28 +0000)
committerZack Weinberg <zack@gcc.gnu.org>
Wed, 11 Aug 2004 06:28:00 +0000 (06:28 +0000)
* stmt.c (expand_return): If asked to return the RESULT_DECL,
just call expand_value_return on result_rtl.

From-SVN: r85795

gcc/ChangeLog
gcc/stmt.c

index ffa4aeeaa88edafe74100446605dfec5cfcdf6ed..b0c3d9c4ff81187bc38cef5962df93df391a108f 100644 (file)
@@ -1,3 +1,8 @@
+2004-08-10  Zack Weinberg  <zack@codesourcery.com>
+
+       * stmt.c (expand_return): If asked to return the RESULT_DECL,
+       just call expand_value_return on result_rtl.
+
 2004-08-10  Richard Henderson  <rth@redhat.com>
 
        * builtins.def (BUILT_IN_STACK_ALLOC): Remove.
        * config/arm/t-bpabi: New file.
        * doc/tm.texi (TARGET_LIBGCC_FUNCS): New entry.
        (TARGET_LIB_INT_CMP_BIASED): Likewise.
-       
+
 2004-08-10  David Edelsohn  <edelsohn@gnu.org>
 
        * config/rs6000/rs6000-protos.h (expand_block_clear): Declare.
        * varasm.c (unlikely_section_label): New global variable.
        (unlikely_text_section_name): New global variable.
        (text_section):  Remove alignment statement.
-       (unlikely_text_section): Remove alignment statement; use 
+       (unlikely_text_section): Remove alignment statement; use
        unlikely_section_label rather than hard-coded string.
        (assemble_start_function): Initialize unlikely_section_label and
        unlikely_text_section_name;  make sure cold section is properly
        ("*tmqi_mem"): Remove SUBREG from pattern.
        ("*anddi3_cconly"): Prevent accidentally matching TM pattern.
        ("*andsi3_cconly"): Likewise.
-       
+
 2004-08-10  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR target/16909
        * tree-cfg.c (bsi_insert_before, bsi_insert_after): Call modify_stmt
        after linking stmt into the program.
        (bsi_remove): Don't call modify_stmt.
-       * tree-complex.c (update_complex_assignment, 
+       * tree-complex.c (update_complex_assignment,
        expand_complex_comparison): Call modify_stmt after changing the stmt.
-       * tree-outof-ssa.c (rewrite_trees): Call modify_stmt only if not 
+       * tree-outof-ssa.c (rewrite_trees): Call modify_stmt only if not
        removing the stmt.
        * tree-ssa-ccp.c (substitute_and_fold): Call modify_stmt after changing
        the stmt, and only if needed.
        (simplify_rhs_and_lookup_avail_expr): Don't take an annotation param.
        (simplify_cond_and_lookup_avail_expr): Use modify_stmt.
        (simplify_switch_and_lookup_avail_expr): Don't take an annotation param.
-       (eliminate_redundant_computations): Don't pass an annotation. Call 
+       (eliminate_redundant_computations): Don't pass an annotation. Call
        modify_stmt rather than setting the annotation directly.
        (record_equivalences_from_stmt): Remove unused local 'j'.
        (cprop_operand): Take a stmt rather than an annotation as a parameter.
        Call modify_stmt.
        (cprop_into_stmt): Pass stmt rather than annotation.
        (update_rhs_and_lookup_avail_expr): Call modify_stmt.
-       * tree-ssa-loop-im.c (schedule_sm): Call get_stmt_ann rather than 
+       * tree-ssa-loop-im.c (schedule_sm): Call get_stmt_ann rather than
        modify_stmt.
        * tree-ssa.c (propagate_into_addr): Dont call modify_stmt.
 
index 86d4fe98dd36e79829bc32a6e6c29f238e361117..9425cffc89eec1738939a045407bd4e492f0d7a4 100644 (file)
@@ -1635,8 +1635,6 @@ expand_return (tree retval)
       expand_null_return ();
       return;
     }
-  else if (TREE_CODE (retval) == RESULT_DECL)
-    retval_rhs = retval;
   else if ((TREE_CODE (retval) == MODIFY_EXPR
            || TREE_CODE (retval) == INIT_EXPR)
           && TREE_CODE (TREE_OPERAND (retval, 0)) == RESULT_DECL)
@@ -1646,6 +1644,11 @@ expand_return (tree retval)
 
   result_rtl = DECL_RTL (DECL_RESULT (current_function_decl));
 
+  /* If we are returning the RESULT_DECL, then the value has already
+     been stored into it, so we don't have to do anything special.  */
+  if (TREE_CODE (retval_rhs) == RESULT_DECL)
+    expand_value_return (result_rtl);
+
   /* If the result is an aggregate that is being returned in one (or more)
      registers, load the registers here.  The compiler currently can't handle
      copying a BLKmode value into registers.  We could put this code in a
@@ -1653,9 +1656,9 @@ expand_return (tree retval)
      call/return), but until this feature is generally usable it is kept here
      (and in expand_call).  */
 
-  if (retval_rhs != 0
-      && TYPE_MODE (TREE_TYPE (retval_rhs)) == BLKmode
-      && REG_P (result_rtl))
+  else if (retval_rhs != 0
+          && TYPE_MODE (TREE_TYPE (retval_rhs)) == BLKmode
+          && REG_P (result_rtl))
     {
       int i;
       unsigned HOST_WIDE_INT bitpos, xbitpos;