aboutsummaryrefslogtreecommitdiff
path: root/gcc/expr.c
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>2001-12-02 11:04:23 -0800
committerRichard Henderson <rth@gcc.gnu.org>2001-12-02 11:04:23 -0800
commit998d7deb143c6511c68e21abb811af9f5524f89d (patch)
tree7dcf60eaed1d63b62946ca9c11cf34b2d9ceaa21 /gcc/expr.c
parent3d55d212918e4f8853365fbf7531d30b9d88a82f (diff)
downloadgcc-998d7deb143c6511c68e21abb811af9f5524f89d.zip
gcc-998d7deb143c6511c68e21abb811af9f5524f89d.tar.gz
gcc-998d7deb143c6511c68e21abb811af9f5524f89d.tar.bz2
rtl.h (mem_attrs): Rename decl to expr; adjust all users.
* rtl.h (mem_attrs): Rename decl to expr; adjust all users. (MEM_EXPR): Rename from MEM_DECL; adjust all users. * emit-rtl.c (set_mem_expr): Rename from set_mem_decl. * expr.h, final.c, reload1.c: Adjust users. * alias.c (nonoverlapping_component_refs_p): New. (decl_for_component_ref, adjust_offset_for_component_ref): New. (nonoverlapping_memrefs_p): Use them. * emit-rtl.c (component_ref_for_mem_expr): New. (set_mem_attributes): Use it. (set_mem_offset): New. * expr.c (expand_assignment): Call set_mem_attributes for inner references; adjust the memory offset as needed. * print-rtl.c (print_mem_expr): New. (print_rtx): Use it. From-SVN: r47534
Diffstat (limited to 'gcc/expr.c')
-rw-r--r--gcc/expr.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/gcc/expr.c b/gcc/expr.c
index eb7f2d3..659ff03 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -3603,7 +3603,6 @@ emit_push_insn (x, mode, type, size, align, partial, reg, extra,
}
emit_move_insn (dest, x);
-
}
if (current_function_check_memory_usage && ! in_check_memory_usage)
@@ -3768,6 +3767,26 @@ expand_assignment (to, from, want_value, suggest_reg)
highest_pow2_factor (offset));
}
+ if (GET_CODE (to_rtx) == MEM)
+ {
+ tree old_expr = MEM_EXPR (to_rtx);
+
+ /* If the field is at offset zero, we could have been given the
+ DECL_RTX of the parent struct. Don't munge it. */
+ to_rtx = shallow_copy_rtx (to_rtx);
+
+ set_mem_attributes (to_rtx, to, 0);
+
+ /* If we changed MEM_EXPR, that means we're now referencing
+ the COMPONENT_REF, which means that MEM_OFFSET must be
+ relative to that field. But we've not yet reflected BITPOS
+ in TO_RTX. This will be done in store_field. Adjust for
+ that by biasing MEM_OFFSET by -bitpos. */
+ if (MEM_EXPR (to_rtx) != old_expr && MEM_OFFSET (to_rtx)
+ && (bitpos / BITS_PER_UNIT) != 0)
+ set_mem_offset (to_rtx, GEN_INT (INTVAL (MEM_OFFSET (to_rtx))
+ - (bitpos / BITS_PER_UNIT)));
+ }
/* Deal with volatile and readonly fields. The former is only done
for MEM. Also set MEM_KEEP_ALIAS_SET_P if needed. */