diff options
author | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-09-23 16:08:16 +0000 |
---|---|---|
committer | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-09-23 16:08:16 +0000 |
commit | 40110b5a507c6db23c146473e2de6c78c2fac3a0 (patch) | |
tree | edac9be42c0dfb8002518876a201a76bdd0d3e7f /gcc/tree.h | |
parent | 280b3a05edfbae5dd5ee3cf4713ec73eae240e4c (diff) | |
download | gcc-40110b5a507c6db23c146473e2de6c78c2fac3a0.tar.gz |
* tree.h (int_bit_position): Turn into inline function;
implement using wide int.
* tree.c (int_bit_position): Remove.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@215518 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree.h')
-rw-r--r-- | gcc/tree.h | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/gcc/tree.h b/gcc/tree.h index 93a12d40340..14086f00539 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -3877,7 +3877,6 @@ extern tree size_in_bytes (const_tree); extern HOST_WIDE_INT int_size_in_bytes (const_tree); extern HOST_WIDE_INT max_int_size_in_bytes (const_tree); extern tree bit_position (const_tree); -extern HOST_WIDE_INT int_bit_position (const_tree); extern tree byte_position (const_tree); extern HOST_WIDE_INT int_byte_position (const_tree); @@ -4797,4 +4796,14 @@ extern tree get_inner_reference (tree, HOST_WIDE_INT *, HOST_WIDE_INT *, EXP, an ARRAY_REF or an ARRAY_RANGE_REF. */ extern tree array_ref_low_bound (tree); +/* Like bit_position, but return as an integer. It must be representable in + that way (since it could be a signed value, we don't have the + option of returning -1 like int_size_in_byte can. */ + +inline HOST_WIDE_INT +int_bit_position (const_tree field) +{ + return (wi::lshift (wi::to_offset (DECL_FIELD_OFFSET (field)), BITS_PER_UNIT_LOG) + + wi::to_offset (DECL_FIELD_BIT_OFFSET (field))).to_shwi (); +} #endif /* GCC_TREE_H */ |