This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Patch: make `minus_one_node' globally available
- To: gcc-patches at gcc dot gnu dot org
- Subject: Patch: make `minus_one_node' globally available
- From: "Kaveh R. Ghazi" <ghazi at caip dot rutgers dot edu>
- Date: Sat, 27 Jan 2001 20:13:32 -0500 (EST)
I thought it would be useful to have a minus_one_node available to all
front-ends, so I moved it out of the cp dir into the top level dir and
used it in one place I found in stmt.c as a test. (Plus some future
work I'm considering might make use of it.)
Bootstrap/testsuite on sparc-sun-solaris2.7, no regressions.
Ok to install?
--Kaveh
2001-01-27 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* stmt.c (estimate_case_costs): Use minus_one_node.
* tree.c (build_common_tree_nodes_2): Set minus_one_node.
* tree.h (tree_index): Add new element TI_MINUS_ONE.
(minus_one_node): Define.
cp:
* cp-tree.h (cp_tree_index): Delete CPTI_MINUS_ONE.
(minus_one_node): Delete.
* init.c (init_init_processing): Don't set minus_one_node.
diff -rup orig/egcs-CVS20010125/gcc/stmt.c egcs-CVS20010125/gcc/stmt.c
--- orig/egcs-CVS20010125/gcc/stmt.c Sat Jan 20 16:23:43 2001
+++ egcs-CVS20010125/gcc/stmt.c Sat Jan 27 09:32:44 2001
@@ -5760,7 +5760,7 @@ static int
estimate_case_costs (node)
case_node_ptr node;
{
- tree min_ascii = build_int_2 (-1, -1);
+ tree min_ascii = minus_one_node;
tree max_ascii = convert (TREE_TYPE (node->high), build_int_2 (127, 0));
case_node_ptr n;
int i;
diff -rup orig/egcs-CVS20010125/gcc/tree.c egcs-CVS20010125/gcc/tree.c
--- orig/egcs-CVS20010125/gcc/tree.c Sat Jan 27 09:22:07 2001
+++ egcs-CVS20010125/gcc/tree.c Sat Jan 27 09:26:41 2001
@@ -4786,6 +4786,7 @@ build_common_tree_nodes_2 (short_double)
/* Define these next since types below may used them. */
integer_zero_node = build_int_2 (0, 0);
integer_one_node = build_int_2 (1, 0);
+ minus_one_node = build_int_2 (-1, -1);
size_zero_node = size_int (0);
size_one_node = size_int (1);
diff -rup orig/egcs-CVS20010125/gcc/tree.h egcs-CVS20010125/gcc/tree.h
--- orig/egcs-CVS20010125/gcc/tree.h Wed Jan 10 22:17:43 2001
+++ egcs-CVS20010125/gcc/tree.h Sat Jan 27 09:28:54 2001
@@ -1715,6 +1715,7 @@ enum tree_index
TI_INTEGER_ZERO,
TI_INTEGER_ONE,
+ TI_MINUS_ONE,
TI_NULL_POINTER,
TI_SIZE_ZERO,
@@ -1770,6 +1771,7 @@ extern tree global_trees[TI_MAX];
#define integer_zero_node global_trees[TI_INTEGER_ZERO]
#define integer_one_node global_trees[TI_INTEGER_ONE]
+#define minus_one_node global_trees[TI_MINUS_ONE]
#define size_zero_node global_trees[TI_SIZE_ZERO]
#define size_one_node global_trees[TI_SIZE_ONE]
#define bitsize_zero_node global_trees[TI_BITSIZE_ZERO]
diff -rup orig/egcs-CVS20010125/gcc/cp/cp-tree.h egcs-CVS20010125/gcc/cp/cp-tree.h
--- orig/egcs-CVS20010125/gcc/cp/cp-tree.h Mon Jan 22 16:23:44 2001
+++ egcs-CVS20010125/gcc/cp/cp-tree.h Sat Jan 27 09:28:15 2001
@@ -635,7 +635,6 @@ enum cp_tree_index
CPTI_EMPTY_EXCEPT_SPEC,
CPTI_NULL,
CPTI_JCLASS,
- CPTI_MINUS_ONE,
CPTI_TERMINATE,
CPTI_ATEXIT,
CPTI_DSO_HANDLE,
@@ -767,9 +766,6 @@ extern tree cp_global_trees[CPTI_MAX];
/* If non-NULL, a POINTER_TYPE equivalent to (java::lang::Class*). */
#define jclass_node cp_global_trees[CPTI_JCLASS]
-
-/* A node for `(int) -1'. */
-#define minus_one_node cp_global_trees[CPTI_MINUS_ONE]
/* The declaration for `std::terminate'. */
#define terminate_node cp_global_trees[CPTI_TERMINATE]
diff -rup orig/egcs-CVS20010125/gcc/cp/init.c egcs-CVS20010125/gcc/cp/init.c
--- orig/egcs-CVS20010125/gcc/cp/init.c Fri Jan 19 16:24:29 2001
+++ egcs-CVS20010125/gcc/cp/init.c Sat Jan 27 09:27:22 2001
@@ -65,8 +65,6 @@ void init_init_processing ()
{
tree fields[1];
- minus_one_node = build_int_2 (-1, -1);
-
/* Define the structure that holds header information for
arrays allocated via operator new. */
BI_header_type = make_aggr_type (RECORD_TYPE);