From 998d7deb143c6511c68e21abb811af9f5524f89d Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Sun, 2 Dec 2001 11:04:23 -0800 Subject: 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 --- gcc/expr.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'gcc/expr.c') 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. */ -- cgit v1.1