aboutsummaryrefslogtreecommitdiff
path: root/gcc/stor-layout.c
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2012-05-14 08:46:33 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2012-05-14 08:46:33 +0000
commit9cbbba287d1ca590c503682d72df99fa2800b985 (patch)
tree24a9b1d109a3426404acbce3f2ac87147420a614 /gcc/stor-layout.c
parent5341ab80950eb02944ac1a9e25814833d51cf649 (diff)
downloadgcc-9cbbba287d1ca590c503682d72df99fa2800b985.zip
gcc-9cbbba287d1ca590c503682d72df99fa2800b985.tar.gz
gcc-9cbbba287d1ca590c503682d72df99fa2800b985.tar.bz2
stor-layout.c (bit_from_pos): Distribute conversion to bitsizetype into a PLUS_EXPR byte offset.
* stor-layout.c (bit_from_pos): Distribute conversion to bitsizetype into a PLUS_EXPR byte offset. * tree-ssa-pre.c (can_value_number_call): Delete. (compute_avail): Skip all statements with side effects. <GIMPLE_CALL>: Skip calls to internal functions. From-SVN: r187450
Diffstat (limited to 'gcc/stor-layout.c')
-rw-r--r--gcc/stor-layout.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c
index cb47a52..a592bda 100644
--- a/gcc/stor-layout.c
+++ b/gcc/stor-layout.c
@@ -786,25 +786,29 @@ start_record_layout (tree t)
}
/* Return the combined bit position for the byte offset OFFSET and the
- bit position BITPOS. */
+ bit position BITPOS.
+
+ These functions operate on byte and bit positions present in FIELD_DECLs
+ and assume that these expressions result in no (intermediate) overflow.
+ This assumption is necessary to fold the expressions as much as possible,
+ so as to avoid creating artificially variable-sized types in languages
+ supporting variable-sized types like Ada. */
tree
bit_from_pos (tree offset, tree bitpos)
{
+ if (TREE_CODE (offset) == PLUS_EXPR)
+ offset = size_binop (PLUS_EXPR,
+ fold_convert (bitsizetype, TREE_OPERAND (offset, 0)),
+ fold_convert (bitsizetype, TREE_OPERAND (offset, 1)));
+ else
+ offset = fold_convert (bitsizetype, offset);
return size_binop (PLUS_EXPR, bitpos,
- size_binop (MULT_EXPR,
- fold_convert (bitsizetype, offset),
- bitsize_unit_node));
+ size_binop (MULT_EXPR, offset, bitsize_unit_node));
}
/* Return the combined truncated byte position for the byte offset OFFSET and
- the bit position BITPOS.
-
- These functions operate on byte and bit positions as present in FIELD_DECLs
- and assume that these expressions result in no (intermediate) overflow.
- This assumption is necessary to fold the expressions as much as possible,
- so as to avoid creating artificially variable-sized types in languages
- supporting variable-sized types like Ada. */
+ the bit position BITPOS. */
tree
byte_from_pos (tree offset, tree bitpos)