aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Kenner <kenner@gcc.gnu.org>1993-12-25 17:51:12 -0500
committerRichard Kenner <kenner@gcc.gnu.org>1993-12-25 17:51:12 -0500
commit3207b172f70fc5cf1d1f24b0c171755b6f36136d (patch)
treed7690cdd9632b72ae611069ac066661833f7b557 /gcc
parent307b821c36a068b8482454c6167c71cedc53083b (diff)
downloadgcc-3207b172f70fc5cf1d1f24b0c171755b6f36136d.zip
gcc-3207b172f70fc5cf1d1f24b0c171755b6f36136d.tar.gz
gcc-3207b172f70fc5cf1d1f24b0c171755b6f36136d.tar.bz2
(expand_expr, case CONSTRUCTOR): If have a target, don't build
constructor into memory. From-SVN: r6323
Diffstat (limited to 'gcc')
-rw-r--r--gcc/expr.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/gcc/expr.c b/gcc/expr.c
index c0bd5db..d17755d 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -4089,13 +4089,17 @@ expand_expr (exp, target, tmode, modifier)
expand_expr (TREE_VALUE (elt), const0_rtx, VOIDmode, 0);
return const0_rtx;
}
+
/* All elts simple constants => refer to a constant in memory. But
if this is a non-BLKmode mode, let it store a field at a time
since that should make a CONST_INT or CONST_DOUBLE when we
- fold. If we are making an initializer and all operands are
- constant, put it in memory as well. */
+ fold. Likewise, if we have a target we can use, it is best to
+ store directly into the target. If we are making an initializer and
+ all operands are constant, put it in memory as well. */
else if ((TREE_STATIC (exp)
- && (mode == BLKmode || TREE_ADDRESSABLE (exp)))
+ && ((mode == BLKmode
+ && ! (target != 0 && safe_from_p (target, exp)))
+ || TREE_ADDRESSABLE (exp)))
|| (modifier == EXPAND_INITIALIZER && TREE_CONSTANT (exp)))
{
rtx constructor = output_constant_def (exp);