summaryrefslogtreecommitdiff
path: root/gcc/expr.c
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@act-europe.fr>2004-03-08 07:48:51 +0100
committerEric Botcazou <ebotcazou@gcc.gnu.org>2004-03-08 06:48:51 +0000
commitd50a16c4335e68f36982ab6e2de8744d6bcd101d (patch)
treefa9e3e9dcafa91608c9e55c39fab6204b9942a22 /gcc/expr.c
parentb1917422afdc729bafd42f01433fd4d0e2cdf760 (diff)
downloadgcc-d50a16c4335e68f36982ab6e2de8744d6bcd101d.tar.gz
expr.c (highest_pow2_factor_for_type): Rename into highest_pow2_factor_for_target.
* expr.c (highest_pow2_factor_for_type): Rename into highest_pow2_factor_for_target. Use DECL_ALIGN instead of TYPE_ALIGN when the target is a COMPONENT_REF. (expand_assignment): Ajust call to highest_pow2_factor_for_type. From-SVN: r79101
Diffstat (limited to 'gcc/expr.c')
-rw-r--r--gcc/expr.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/gcc/expr.c b/gcc/expr.c
index 9bd27402768..d5267505c6b 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -156,7 +156,7 @@ static rtx store_field (rtx, HOST_WIDE_INT, HOST_WIDE_INT, enum machine_mode,
static rtx var_rtx (tree);
static unsigned HOST_WIDE_INT highest_pow2_factor (tree);
-static unsigned HOST_WIDE_INT highest_pow2_factor_for_type (tree, tree);
+static unsigned HOST_WIDE_INT highest_pow2_factor_for_target (tree, tree);
static int is_aligning_offset (tree, tree);
static rtx expand_increment (tree, int, int);
@@ -3800,8 +3800,8 @@ expand_assignment (tree to, tree from, int want_value)
}
to_rtx = offset_address (to_rtx, offset_rtx,
- highest_pow2_factor_for_type (TREE_TYPE (to),
- offset));
+ highest_pow2_factor_for_target (to,
+ offset));
}
if (GET_CODE (to_rtx) == MEM)
@@ -6049,17 +6049,22 @@ highest_pow2_factor (tree exp)
return 1;
}
-/* Similar, except that it is known that the expression must be a multiple
- of the alignment of TYPE. */
+/* Similar, except that the alignment requirements of TARGET are
+ taken into account. Assume it is at least as aligned as its
+ type, unless it is a COMPONENT_REF in which case the layout of
+ the structure gives the alignment. */
static unsigned HOST_WIDE_INT
-highest_pow2_factor_for_type (tree type, tree exp)
+highest_pow2_factor_for_target (tree target, tree exp)
{
- unsigned HOST_WIDE_INT type_align, factor;
+ unsigned HOST_WIDE_INT target_align, factor;
factor = highest_pow2_factor (exp);
- type_align = TYPE_ALIGN (type) / BITS_PER_UNIT;
- return MAX (factor, type_align);
+ if (TREE_CODE (target) == COMPONENT_REF)
+ target_align = DECL_ALIGN (TREE_OPERAND (target, 1)) / BITS_PER_UNIT;
+ else
+ target_align = TYPE_ALIGN (TREE_TYPE (target)) / BITS_PER_UNIT;
+ return MAX (factor, target_align);
}
/* Return an object on the placeholder list that matches EXP, a