Hi,
int_bit_position is used by ipa-devirt's type walking code. It is currently a bottleneck
since I introduced speculation into contextes (I plan to solve this by changing the
way i cache results). But this patch seems to make sense anyway: we do not need to go
through folding:
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, offset, bitsize_unit_node));
}
Because all the code cares only about constant offsets, we do not need to go through fold_convert,
because all the codes go via int_bit_position that already expects result to be host wide int,
it seems to make sense to implement quick path for that.
Bootstrap/regtest x86_64 in progress, OK?
Honza
* stor-layout.c (int_bit_from_pos): New function.
* stor-layout.h (int_bit_from_pos): Declare.
* tree.c (int_bit_from_pos): Use it.