aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.h
diff options
context:
space:
mode:
authorBernd Edlinger <bernd.edlinger@hotmail.de>2016-07-27 20:35:35 +0000
committerBernd Edlinger <edlinger@gcc.gnu.org>2016-07-27 20:35:35 +0000
commitec1e2a4097535d7075929d638f4120c5a5694725 (patch)
tree30936762c7a8b046127e013b16d6d42f50e93b71 /gcc/tree.h
parent98060bbea842d8b0f3b5d41efa6ef15c266efcf4 (diff)
downloadgcc-ec1e2a4097535d7075929d638f4120c5a5694725.zip
gcc-ec1e2a4097535d7075929d638f4120c5a5694725.tar.gz
gcc-ec1e2a4097535d7075929d638f4120c5a5694725.tar.bz2
defaults.h (LOG2_BITS_PER_UNIT): Move from here...
2016-07-27 Bernd Edlinger <bernd.edlinger@hotmail.de> * defaults.h (LOG2_BITS_PER_UNIT): Move from here... * tree.h (LOG2_BITS_PER_UNIT): ...to here. (BITS_PER_UNIT_LOG): Remove. (int_bit_position): Use LOG2_BITS_PER_UNIT instead of BITS_PER_UNIT_LOG. * expr.c (expand_assignment): Likewise. * stor-layout.c (initialize_sizetypes): Likewise. c-family: 2016-07-27 Bernd Edlinger <bernd.edlinger@hotmail.de> * c-common.c (check_user_alignment): Use LOG2_BITS_PER_UNIT instead of BITS_PER_UNIT_LOG. From-SVN: r238800
Diffstat (limited to 'gcc/tree.h')
-rw-r--r--gcc/tree.h19
1 files changed, 12 insertions, 7 deletions
diff --git a/gcc/tree.h b/gcc/tree.h
index 14c8f7a..fff65d6 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -4235,6 +4235,8 @@ extern tree bit_position (const_tree);
extern tree byte_position (const_tree);
extern HOST_WIDE_INT int_byte_position (const_tree);
+/* Type for sizes of data-type. */
+
#define sizetype sizetype_tab[(int) stk_sizetype]
#define bitsizetype sizetype_tab[(int) stk_bitsizetype]
#define ssizetype sizetype_tab[(int) stk_ssizetype]
@@ -4244,12 +4246,15 @@ extern HOST_WIDE_INT int_byte_position (const_tree);
#define bitsize_int(L) size_int_kind (L, stk_bitsizetype)
#define sbitsize_int(L) size_int_kind (L, stk_sbitsizetype)
-/* Type for sizes of data-type. */
+/* Log2 of BITS_PER_UNIT. */
-#define BITS_PER_UNIT_LOG \
- ((BITS_PER_UNIT > 1) + (BITS_PER_UNIT > 2) + (BITS_PER_UNIT > 4) \
- + (BITS_PER_UNIT > 8) + (BITS_PER_UNIT > 16) + (BITS_PER_UNIT > 32) \
- + (BITS_PER_UNIT > 64) + (BITS_PER_UNIT > 128) + (BITS_PER_UNIT > 256))
+#if BITS_PER_UNIT == 8
+#define LOG2_BITS_PER_UNIT 3
+#elif BITS_PER_UNIT == 16
+#define LOG2_BITS_PER_UNIT 4
+#else
+#error Unknown BITS_PER_UNIT
+#endif
/* Concatenate two lists (chains of TREE_LIST nodes) X and Y
by making the last node in X point to Y.
@@ -5400,8 +5405,8 @@ extern GTY(()) struct int_n_trees_t int_n_trees[NUM_INT_N_ENTS];
inline HOST_WIDE_INT
int_bit_position (const_tree field)
-{
- return ((wi::to_offset (DECL_FIELD_OFFSET (field)) << BITS_PER_UNIT_LOG)
+{
+ return ((wi::to_offset (DECL_FIELD_OFFSET (field)) << LOG2_BITS_PER_UNIT)
+ wi::to_offset (DECL_FIELD_BIT_OFFSET (field))).to_shwi ();
}