(expand_assignment): If FROM is scalar function call,
authorRichard Stallman <rms@gnu.org>
Sat, 26 Jun 1993 20:45:13 +0000 (20:45 +0000)
committerRichard Stallman <rms@gnu.org>
Sat, 26 Jun 1993 20:45:13 +0000 (20:45 +0000)
expand_expr FROM before TO.

From-SVN: r4759

gcc/expr.c

index 89be8598eb7b21e43460e8f213f152eae93d0702..f12391783ff69c1f48b47c36e28ae8f377323d1d 100644 (file)
@@ -2205,6 +2205,22 @@ expand_assignment (to, from, want_value, suggest_reg)
              : result);
     }
 
+  /* If the rhs is a function call and its value is not an aggregate,
+     call the function before we start to compute the lhs.
+     This is needed for correct code for cases such as
+     val = setjmp (buf) on machines where reference to val
+     requires loading up part of an address in a separate insn.  */
+  if (TREE_CODE (from) == CALL_EXPR && ! aggregate_value_p (from))
+    {
+      rtx value = expand_expr (from, NULL_RTX, VOIDmode, 0);
+      if (to_rtx == 0)
+       to_rtx = expand_expr (to, NULL_RTX, VOIDmode, 0);
+      emit_move_insn (to_rtx, value);
+      preserve_temp_slots (to_rtx);
+      free_temp_slots ();
+      return to_rtx;
+    }
+
   /* Ordinary treatment.  Expand TO to get a REG or MEM rtx.
      Don't re-expand if it was expanded already (in COMPONENT_REF case).  */