summaryrefslogtreecommitdiff
path: root/gcc/expr.c
diff options
context:
space:
mode:
authorrms <rms@138bc75d-0d04-0410-961f-82ee72b054a4>1993-03-06 00:48:19 +0000
committerrms <rms@138bc75d-0d04-0410-961f-82ee72b054a4>1993-03-06 00:48:19 +0000
commitaddbe7ac3de025a0b9cccff629461a26a38c6bf1 (patch)
tree7563129dc93fc94c803da35bd194156fcc63d504 /gcc/expr.c
parent9af33e7da568e9a11a240a4cdfcc0d1f484edce3 (diff)
downloadgcc-addbe7ac3de025a0b9cccff629461a26a38c6bf1.tar.gz
(expand_assignment): Special handling for storing in RESULT_DECL.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@3663 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/expr.c')
-rw-r--r--gcc/expr.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/expr.c b/gcc/expr.c
index aa98632678d..3ff238ca1c1 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -2765,6 +2765,16 @@ expand_assignment (to, from, want_value, suggest_reg)
if (to_rtx == 0)
to_rtx = expand_expr (to, NULL_RTX, VOIDmode, 0);
+ /* Don't move directly into a return register. */
+ if (TREE_CODE (to) == RESULT_DECL && GET_CODE (to_rtx) == REG)
+ {
+ rtx temp = expand_expr (from, 0, VOIDmode, 0);
+ emit_move_insn (to_rtx, temp);
+ preserve_temp_slots (to_rtx);
+ free_temp_slots ();
+ return to_rtx;
+ }
+
/* In case we are returning the contents of an object which overlaps
the place the value is being stored, use a safe function when copying
a value through a pointer into a structure value return block. */