aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Stallman <rms@gnu.org>1993-06-26 20:45:13 +0000
committerRichard Stallman <rms@gnu.org>1993-06-26 20:45:13 +0000
commitcd1db1088e0d55527415056906f5fab878253b0f (patch)
tree9d13e1457b242ede6b0fd6cf871f68e8dac2713b /gcc
parentfff26804c900ea7c3efbbf7da8ae17a424f3a39c (diff)
downloadgcc-cd1db1088e0d55527415056906f5fab878253b0f.zip
gcc-cd1db1088e0d55527415056906f5fab878253b0f.tar.gz
gcc-cd1db1088e0d55527415056906f5fab878253b0f.tar.bz2
(expand_assignment): If FROM is scalar function call,
expand_expr FROM before TO. From-SVN: r4759
Diffstat (limited to 'gcc')
-rw-r--r--gcc/expr.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/gcc/expr.c b/gcc/expr.c
index 89be859..f123917 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -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). */