aboutsummaryrefslogtreecommitdiff
path: root/gcc/emit-rtl.c
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>2002-07-29 12:53:34 -0700
committerRichard Henderson <rth@gcc.gnu.org>2002-07-29 12:53:34 -0700
commit6f1087be10e5765a7dde63dca95fecf7f359d021 (patch)
tree2f03e25d0a8da1b034e4545a18f1ffde2c8ca534 /gcc/emit-rtl.c
parent61ccbcfd47fc677635169421f8ecb079fa99c5f8 (diff)
downloadgcc-6f1087be10e5765a7dde63dca95fecf7f359d021.zip
gcc-6f1087be10e5765a7dde63dca95fecf7f359d021.tar.gz
gcc-6f1087be10e5765a7dde63dca95fecf7f359d021.tar.bz2
emit-rtl.c (set_mem_attributes_minus_bitpos): Rename from set_mem_attributes and add BITPOS argument.
* emit-rtl.c (set_mem_attributes_minus_bitpos): Rename from set_mem_attributes and add BITPOS argument. Subtract it from OFFSET when same is adjusted. (set_mem_attributes): New wrapper function. * expr.c (expand_assignment): Use set_mem_attributes_minus_bitpos; remove offset adjustment hack. * expr.h (set_mem_attributes_minus_bitpos): Declare. From-SVN: r55846
Diffstat (limited to 'gcc/emit-rtl.c')
-rw-r--r--gcc/emit-rtl.c29
1 files changed, 26 insertions, 3 deletions
diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
index 67c4cfb..0bba4a2 100644
--- a/gcc/emit-rtl.c
+++ b/gcc/emit-rtl.c
@@ -1679,19 +1679,22 @@ component_ref_for_mem_expr (ref)
/* Given REF, a MEM, and T, either the type of X or the expression
corresponding to REF, set the memory attributes. OBJECTP is nonzero
- if we are making a new object of this type. */
+ if we are making a new object of this type. BITPOS is nonzero if
+ there is an offset outstanding on T that will be applied later. */
void
-set_mem_attributes (ref, t, objectp)
+set_mem_attributes_minus_bitpos (ref, t, objectp, bitpos)
rtx ref;
tree t;
int objectp;
+ HOST_WIDE_INT bitpos;
{
HOST_WIDE_INT alias = MEM_ALIAS_SET (ref);
tree expr = MEM_EXPR (ref);
rtx offset = MEM_OFFSET (ref);
rtx size = MEM_SIZE (ref);
unsigned int align = MEM_ALIGN (ref);
+ HOST_WIDE_INT apply_bitpos = 0;
tree type;
/* It can happen that type_for_mode was given a mode for which there
@@ -1760,6 +1763,7 @@ set_mem_attributes (ref, t, objectp)
{
expr = t;
offset = const0_rtx;
+ apply_bitpos = bitpos;
size = (DECL_SIZE_UNIT (t)
&& host_integerp (DECL_SIZE_UNIT (t), 1)
? GEN_INT (tree_low_cst (DECL_SIZE_UNIT (t), 1)) : 0);
@@ -1784,6 +1788,7 @@ set_mem_attributes (ref, t, objectp)
{
expr = component_ref_for_mem_expr (t);
offset = const0_rtx;
+ apply_bitpos = bitpos;
/* ??? Any reason the field size would be different than
the size we got from the type? */
}
@@ -1817,13 +1822,17 @@ set_mem_attributes (ref, t, objectp)
if (aoff && aoff < align)
align = aoff;
offset = GEN_INT (ioff);
+ apply_bitpos = bitpos;
}
}
else if (TREE_CODE (t) == COMPONENT_REF)
{
expr = component_ref_for_mem_expr (t);
if (host_integerp (off_tree, 1))
- offset = GEN_INT (tree_low_cst (off_tree, 1));
+ {
+ offset = GEN_INT (tree_low_cst (off_tree, 1));
+ apply_bitpos = bitpos;
+ }
/* ??? Any reason the field size would be different than
the size we got from the type? */
}
@@ -1847,6 +1856,11 @@ set_mem_attributes (ref, t, objectp)
}
}
+ /* If we modified OFFSET based on T, then subtract the outstanding
+ bit position offset. */
+ if (apply_bitpos)
+ offset = plus_constant (offset, -(apply_bitpos / BITS_PER_UNIT));
+
/* Now set the attributes we computed above. */
MEM_ATTRS (ref)
= get_mem_attrs (alias, expr, offset, size, align, GET_MODE (ref));
@@ -1863,6 +1877,15 @@ set_mem_attributes (ref, t, objectp)
MEM_IN_STRUCT_P (ref) = 1;
}
+void
+set_mem_attributes (ref, t, objectp)
+ rtx ref;
+ tree t;
+ int objectp;
+{
+ set_mem_attributes_minus_bitpos (ref, t, objectp, 0);
+}
+
/* Set the alias set of MEM to SET. */
void