aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2003-07-24 16:48:13 -0400
committerJason Merrill <jason@gcc.gnu.org>2003-07-24 16:48:13 -0400
commitde7df9ebdc66ea3a978327f5a039d939a9523a72 (patch)
treed426fb98d29071f56b15614831aba8bebbb69f6c /gcc/tree.c
parent6907ddd3babc97c39c88ef55b7d8da4f5d439d56 (diff)
downloadgcc-de7df9ebdc66ea3a978327f5a039d939a9523a72.zip
gcc-de7df9ebdc66ea3a978327f5a039d939a9523a72.tar.gz
gcc-de7df9ebdc66ea3a978327f5a039d939a9523a72.tar.bz2
tree.h (boolean_type_node): Move from C/C++/Java frontends.
* tree.h (boolean_type_node): Move from C/C++/Java frontends. (boolean_true_node, boolean_false_node): Likewise. (enum tree_index): Add TI_BOOLEAN_{TYPE,FALSE,TRUE}. * tree.c (build_common_tree_nodes): Init boolean_type_node. (build_common_tree_nodes_2): Init boolean_{true,false}_node. * stor-layout.c (set_sizetype): Handle an early BOOLEAN_TYPE. * c-common.h (truthvalue_type_node): Renamed from boolean_type_node. (truthvalue_true_node): Renamed from boolean_true_node. (truthvalue_false_node): Renamed from boolean_false_node. * c-decl.c: Just set truthvalue_* to integer_*. * c-*.[ch]: s/boolean/truthvalue/. s/c_bool/boolean/. * cp/decl.c: Just set truthvalue_* to boolean_*. * java/java-tree.h: Move boolean_type_node et al to the back end. From-SVN: r69758
Diffstat (limited to 'gcc/tree.c')
-rw-r--r--gcc/tree.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/gcc/tree.c b/gcc/tree.c
index 4a63396..7ac0402 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -4754,6 +4754,16 @@ build_common_tree_nodes (int signed_char)
long_long_integer_type_node = make_signed_type (LONG_LONG_TYPE_SIZE);
long_long_unsigned_type_node = make_unsigned_type (LONG_LONG_TYPE_SIZE);
+ /* Define a boolean type. This type only represents boolean values but
+ may be larger than char depending on the value of BOOL_TYPE_SIZE.
+ Front ends which want to override this size (i.e. Java) can redefine
+ boolean_type_node before calling build_common_tree_nodes_2. */
+ boolean_type_node = make_unsigned_type (BOOL_TYPE_SIZE);
+ TREE_SET_CODE (boolean_type_node, BOOLEAN_TYPE);
+ TYPE_MAX_VALUE (boolean_type_node) = build_int_2 (1, 0);
+ TREE_TYPE (TYPE_MAX_VALUE (boolean_type_node)) = boolean_type_node;
+ TYPE_PRECISION (boolean_type_node) = 1;
+
intQI_type_node = make_signed_type (GET_MODE_BITSIZE (QImode));
intHI_type_node = make_signed_type (GET_MODE_BITSIZE (HImode));
intSI_type_node = make_signed_type (GET_MODE_BITSIZE (SImode));
@@ -4784,6 +4794,9 @@ build_common_tree_nodes_2 (int short_double)
bitsize_one_node = bitsize_int (1);
bitsize_unit_node = bitsize_int (BITS_PER_UNIT);
+ boolean_false_node = TYPE_MIN_VALUE (boolean_type_node);
+ boolean_true_node = TYPE_MAX_VALUE (boolean_type_node);
+
void_type_node = make_node (VOID_TYPE);
layout_type (void_type_node);