aboutsummaryrefslogtreecommitdiff
path: root/gcc/expr.c
diff options
context:
space:
mode:
authorRichard Kenner <kenner@vlsi1.ultra.nyu.edu>2003-07-13 23:21:23 +0000
committerRichard Kenner <kenner@gcc.gnu.org>2003-07-13 19:21:23 -0400
commit8d2e5f7279ce617a75446bf6d9f1c9c16297ba82 (patch)
tree623cc0afc03bac4f2da57b9e8f91fc43b0d56eb7 /gcc/expr.c
parent1116457a0df4a09fae9daffa1fa143748962f61c (diff)
downloadgcc-8d2e5f7279ce617a75446bf6d9f1c9c16297ba82.zip
gcc-8d2e5f7279ce617a75446bf6d9f1c9c16297ba82.tar.gz
gcc-8d2e5f7279ce617a75446bf6d9f1c9c16297ba82.tar.bz2
expr.c (expand_expr, [...]): If reg...
* expr.c (expand_expr, case COMPONENT_REF): If reg, copy OP0 to MEM both if OFFSET specified and if result BLKmode for ARRAY_RANGE_REF. From-SVN: r69308
Diffstat (limited to 'gcc/expr.c')
-rw-r--r--gcc/expr.c58
1 files changed, 30 insertions, 28 deletions
diff --git a/gcc/expr.c b/gcc/expr.c
index 6a30058..1b7eab1 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -7440,39 +7440,41 @@ expand_expr (tree exp, rtx target, enum machine_mode tmode, enum expand_modifier
op0 = validize_mem (force_const_mem (mode, op0));
}
+ /* Otherwise, if this object not in memory and we either have an
+ offset or a BLKmode result, put it there. This case can't occur in
+ C, but can in Ada if we have unchecked conversion of an expression
+ from a scalar type to an array or record type or for an
+ ARRAY_RANGE_REF whose type is BLKmode. */
+ else if (GET_CODE (op0) != MEM
+ && (offset != 0
+ || (code == ARRAY_RANGE_REF && mode == BLKmode)))
+ {
+ /* If the operand is a SAVE_EXPR, we can deal with this by
+ forcing the SAVE_EXPR into memory. */
+ if (TREE_CODE (TREE_OPERAND (exp, 0)) == SAVE_EXPR)
+ {
+ put_var_into_stack (TREE_OPERAND (exp, 0),
+ /*rescan=*/true);
+ op0 = SAVE_EXPR_RTL (TREE_OPERAND (exp, 0));
+ }
+ else
+ {
+ tree nt
+ = build_qualified_type (TREE_TYPE (tem),
+ (TYPE_QUALS (TREE_TYPE (tem))
+ | TYPE_QUAL_CONST));
+ rtx memloc = assign_temp (nt, 1, 1, 1);
+
+ emit_move_insn (memloc, op0);
+ op0 = memloc;
+ }
+ }
+
if (offset != 0)
{
rtx offset_rtx = expand_expr (offset, NULL_RTX, VOIDmode,
EXPAND_SUM);
- /* If this object is in a register, put it into memory.
- This case can't occur in C, but can in Ada if we have
- unchecked conversion of an expression from a scalar type to
- an array or record type. */
- if (GET_CODE (op0) == REG || GET_CODE (op0) == SUBREG
- || GET_CODE (op0) == CONCAT || GET_CODE (op0) == ADDRESSOF)
- {
- /* If the operand is a SAVE_EXPR, we can deal with this by
- forcing the SAVE_EXPR into memory. */
- if (TREE_CODE (TREE_OPERAND (exp, 0)) == SAVE_EXPR)
- {
- put_var_into_stack (TREE_OPERAND (exp, 0),
- /*rescan=*/true);
- op0 = SAVE_EXPR_RTL (TREE_OPERAND (exp, 0));
- }
- else
- {
- tree nt
- = build_qualified_type (TREE_TYPE (tem),
- (TYPE_QUALS (TREE_TYPE (tem))
- | TYPE_QUAL_CONST));
- rtx memloc = assign_temp (nt, 1, 1, 1);
-
- emit_move_insn (memloc, op0);
- op0 = memloc;
- }
- }
-
if (GET_CODE (op0) != MEM)
abort ();