This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH INSTALLED]: const typedefs part 14/N


This patch introduces const iterators, the use of which among other things
allowed constifying a bunch of functions.

Bootstrapped on sparc-sun-solaris2.10, no regressions.  Installed

		--Kaveh


2007-08-13  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>

	* alias.c (component_uses_parent_alias_set): Constify.
	* alias.h (component_uses_parent_alias_set): Likewise.
	* cfgrtl.c (print_rtl_with_bb): Likewise.
	* double-int.c (tree_to_double_int, double_int_fits_to_tree_p,
	mpz_get_double_int): Likewise.
	* double-int.h (double_int_fits_to_tree_p, tree_to_double_int,
	mpz_get_double_int): Likewise.
	* expr.c (is_aligning_offset, undefined_operand_subword_p,
	mostly_zeros_p, all_zeros_p, safe_from_p, is_aligning_offset):
	Likewise.
	* expr.h (safe_from_p): Likewise.
	* gimple-low.c (try_catch_may_fallthru, block_may_fallthru):
	Likewise.
	* gimplify.c (should_carry_locus_p, zero_sized_field_decl,
	zero_sized_type, goa_lhs_expr_p): Likewise.
	* omp-low.c (is_variable_sized, use_pointer_for_field): Likewise.
	* rtl.h (print_rtl_with_bb): Likewise.
	* sched-vis.c (print_exp, print_value, print_pattern): Likewise.
	* tree-cfg.c (const_first_stmt, const_last_stmt): New.
	* tree-flow-inline.h (bb_stmt_list): Constify.
	(cbsi_start, cbsi_last, cbsi_end_p, cbsi_next, cbsi_prev,
	cbsi_stmt): New.
	* tree-flow.h (const_block_stmt_iterator, cbsi_start, cbsi_last,
	const_first_stmt, const_last_stmt): New.
	(block_may_fallthru, empty_block_p): Constify.
	* tree-iterator.c (EXPR_FIRST_BODY, EXPR_LAST_BODY,
	EXPR_ONLY_BODY): New.
	(expr_first, expr_last, expr_only): Use macro for body.
	(const_expr_first, const_expr_last, const_expr_only): New.
	* tree-iterator.h (const_tree_stmt_iterator, ctsi_start,
	ctsi_last, ctsi_end_p, ctsi_one_before_end_p, ctsi_next,
	ctsi_prev, ctsi_stmt): New.
	* tree-scalar-evolution.c (get_loop_exit_condition): Constify.
	* tree-scalar-evolution.h (get_loop_exit_condition): Likewise.
	* tree-ssa-loop-niter.c (loop_only_exit_p,
	derive_constant_upper_bound): Likewise.
	* tree-ssa-phiopt.c (empty_block_p): Likewise.
	* tree-ssa-threadupdate.c (redirection_block_p): Likewise.
	* tree-vectorizer.c (slpeel_can_duplicate_loop_p): Likewise.
	* tree-vectorizer.h (slpeel_can_duplicate_loop_p): Likewise.
	* tree-vrp.c (vrp_bitmap_equal_p): Likewise.
	* tree.c (get_type_static_bounds): Likewise.
	* tree.h (const_expr_first, const_expr_last, const_expr_only): New.
	(get_type_static_bounds): Constify.

diff -rup orig/egcc-SVN20070812/gcc/alias.c egcc-SVN20070812/gcc/alias.c
--- orig/egcc-SVN20070812/gcc/alias.c	2007-08-13 14:40:24.141427099 -0400
+++ egcc-SVN20070812/gcc/alias.c	2007-08-13 22:05:37.949744334 -0400
@@ -446,7 +446,7 @@ find_base_decl (tree t)
    assignable alias sets.  */

 bool
-component_uses_parent_alias_set (tree t)
+component_uses_parent_alias_set (const_tree t)
 {
   while (1)
     {
diff -rup orig/egcc-SVN20070812/gcc/alias.h egcc-SVN20070812/gcc/alias.h
--- orig/egcc-SVN20070812/gcc/alias.h	2007-08-11 20:02:48.000000000 -0400
+++ egcc-SVN20070812/gcc/alias.h	2007-08-13 22:06:07.214001610 -0400
@@ -26,7 +26,7 @@ typedef HOST_WIDE_INT alias_set_type;
 extern alias_set_type new_alias_set (void);
 extern alias_set_type get_varargs_alias_set (void);
 extern alias_set_type get_frame_alias_set (void);
-extern bool component_uses_parent_alias_set (tree);
+extern bool component_uses_parent_alias_set (const_tree);
 extern bool alias_set_subset_of (alias_set_type, alias_set_type);

 /* This alias set can be used to force a memory to conflict with all
diff -rup orig/egcc-SVN20070812/gcc/cfgrtl.c egcc-SVN20070812/gcc/cfgrtl.c
--- orig/egcc-SVN20070812/gcc/cfgrtl.c	2007-07-26 23:04:12.000000000 -0400
+++ egcc-SVN20070812/gcc/cfgrtl.c	2007-08-13 22:33:39.452693558 -0400
@@ -1526,9 +1526,9 @@ rtl_dump_bb (basic_block bb, FILE *outf,
    basic block.  */

 void
-print_rtl_with_bb (FILE *outf, rtx rtx_first)
+print_rtl_with_bb (FILE *outf, const_rtx rtx_first)
 {
-  rtx tmp_rtx;
+  const_rtx tmp_rtx;
   if (rtx_first == 0)
     fprintf (outf, "(nil)\n");
   else
diff -rup orig/egcc-SVN20070812/gcc/double-int.c egcc-SVN20070812/gcc/double-int.c
--- orig/egcc-SVN20070812/gcc/double-int.c	2007-08-06 20:02:31.000000000 -0400
+++ egcc-SVN20070812/gcc/double-int.c	2007-08-13 21:08:35.160820022 -0400
@@ -112,7 +112,7 @@ double_int_sext (double_int cst, unsigne
    is unsigned.  */

 double_int
-tree_to_double_int (tree cst)
+tree_to_double_int (const_tree cst)
 {
   /* We do not need to call double_int_restrict here to ensure the semantics as
      described, as this is the default one for trees.  */
@@ -304,7 +304,7 @@ double_int_to_tree (tree type, double_in
    to be the same as the signedness of TYPE.  */

 bool
-double_int_fits_to_tree_p (tree type, double_int cst)
+double_int_fits_to_tree_p (const_tree type, double_int cst)
 {
   double_int ext = double_int_ext (cst,
 				   TYPE_PRECISION (type),
@@ -442,7 +442,7 @@ mpz_set_double_int (mpz_t result, double
    appropriate minimum or maximum TYPE bound.  */

 double_int
-mpz_get_double_int (tree type, mpz_t val, bool wrap)
+mpz_get_double_int (const_tree type, mpz_t val, bool wrap)
 {
   unsigned HOST_WIDE_INT *vp;
   size_t count, numb;
diff -rup orig/egcc-SVN20070812/gcc/double-int.h egcc-SVN20070812/gcc/double-int.h
--- orig/egcc-SVN20070812/gcc/double-int.h	2007-07-26 23:03:44.000000000 -0400
+++ egcc-SVN20070812/gcc/double-int.h	2007-08-13 21:08:53.825144828 -0400
@@ -60,8 +60,8 @@ union tree_node;
 /* Constructors and conversions.  */

 union tree_node *double_int_to_tree (union tree_node *, double_int);
-bool double_int_fits_to_tree_p (union tree_node *, double_int);
-double_int tree_to_double_int (union tree_node *);
+bool double_int_fits_to_tree_p (const union tree_node *, double_int);
+double_int tree_to_double_int (const union tree_node *);

 /* Constructs double_int from integer CST.  The bits over the precision of
    HOST_WIDE_INT are filled with the sign bit.  */
@@ -179,7 +179,7 @@ double_int_equal_p (double_int cst1, dou
 /* Conversion to and from GMP integer representations.  */

 void mpz_set_double_int (mpz_t, double_int, bool);
-double_int mpz_get_double_int (tree, mpz_t, bool);
+double_int mpz_get_double_int (const_tree, mpz_t, bool);


 #endif /* DOUBLE_INT_H */
diff -rup orig/egcc-SVN20070812/gcc/expr.c egcc-SVN20070812/gcc/expr.c
--- orig/egcc-SVN20070812/gcc/expr.c	2007-08-11 20:02:47.000000000 -0400
+++ egcc-SVN20070812/gcc/expr.c	2007-08-13 21:43:44.150012567 -0400
@@ -146,7 +146,7 @@ static rtx store_field (rtx, HOST_WIDE_I

 static unsigned HOST_WIDE_INT highest_pow2_factor_for_target (const_tree, const_tree);

-static int is_aligning_offset (tree, tree);
+static int is_aligning_offset (const_tree, const_tree);
 static void expand_operands (tree, tree, rtx, rtx*, rtx*,
 			     enum expand_modifier);
 static rtx reduce_to_bit_field_precision (rtx, rtx, tree);
@@ -3141,7 +3141,7 @@ emit_move_ccmode (enum machine_mode mode
    undefined bits of a paradoxical subreg.  */

 static bool
-undefined_operand_subword_p (rtx op, int i)
+undefined_operand_subword_p (const_rtx op, int i)
 {
   enum machine_mode innermode, innermostmode;
   int offset;
@@ -4908,7 +4908,7 @@ count_type_elements (const_tree type, bo
 /* Return 1 if EXP contains mostly (3/4)  zeros.  */

 static int
-mostly_zeros_p (tree exp)
+mostly_zeros_p (const_tree exp)
 {
   if (TREE_CODE (exp) == CONSTRUCTOR)

@@ -4931,7 +4931,7 @@ mostly_zeros_p (tree exp)
 /* Return 1 if EXP contains all zeros.  */

 static int
-all_zeros_p (tree exp)
+all_zeros_p (const_tree exp)
 {
   if (TREE_CODE (exp) == CONSTRUCTOR)

@@ -6243,7 +6243,7 @@ force_operand (rtx value, rtx target)
    searches for optimization opportunities.  */

 int
-safe_from_p (rtx x, tree exp, int top_p)
+safe_from_p (const_rtx x, tree exp, int top_p)
 {
   rtx exp_rtl = 0;
   int i, nops;
@@ -9215,7 +9215,7 @@ reduce_to_bit_field_precision (rtx exp,
    aligned more than BIGGEST_ALIGNMENT.  */

 static int
-is_aligning_offset (tree offset, tree exp)
+is_aligning_offset (const_tree offset, const_tree exp)
 {
   /* Strip off any conversions.  */
   while (TREE_CODE (offset) == NON_LVALUE_EXPR
diff -rup orig/egcc-SVN20070812/gcc/expr.h egcc-SVN20070812/gcc/expr.h
--- orig/egcc-SVN20070812/gcc/expr.h	2007-07-27 04:18:51.000000000 -0400
+++ egcc-SVN20070812/gcc/expr.h	2007-08-13 21:42:11.227286028 -0400
@@ -740,7 +740,7 @@ extern rtx expand_mult (enum machine_mod
 extern rtx expand_mult_highpart_adjust (enum machine_mode, rtx, rtx, rtx, rtx, int);

 extern rtx assemble_static_space (unsigned HOST_WIDE_INT);
-extern int safe_from_p (rtx, tree, int);
+extern int safe_from_p (const_rtx, tree, int);

 /* Call this once to initialize the contents of the optabs
    appropriately for the current target machine.  */
diff -rup orig/egcc-SVN20070812/gcc/gimple-low.c egcc-SVN20070812/gcc/gimple-low.c
--- orig/egcc-SVN20070812/gcc/gimple-low.c	2007-08-01 23:05:32.000000000 -0400
+++ egcc-SVN20070812/gcc/gimple-low.c	2007-08-13 17:35:26.551212940 -0400
@@ -344,7 +344,7 @@ lower_bind_expr (tree_stmt_iterator *tsi
    This is a subroutine of block_may_fallthru.  */

 static bool
-try_catch_may_fallthru (tree stmt)
+try_catch_may_fallthru (const_tree stmt)
 {
   tree_stmt_iterator i;

@@ -394,9 +394,9 @@ try_catch_may_fallthru (tree stmt)
    If we're wrong, we'll just delete the extra code later.  */

 bool
-block_may_fallthru (tree block)
+block_may_fallthru (const_tree block)
 {
-  tree stmt = expr_last (block);
+  const_tree stmt = const_expr_last (block);

   switch (stmt ? TREE_CODE (stmt) : ERROR_MARK)
     {
diff -rup orig/egcc-SVN20070812/gcc/gimplify.c egcc-SVN20070812/gcc/gimplify.c
--- orig/egcc-SVN20070812/gcc/gimplify.c	2007-08-11 20:02:48.000000000 -0400
+++ egcc-SVN20070812/gcc/gimplify.c	2007-08-13 17:44:36.064832892 -0400
@@ -761,7 +761,7 @@ gimple_add_tmp_var (tree tmp)
 /* Determines whether to assign a locus to the statement STMT.  */

 static bool
-should_carry_locus_p (tree stmt)
+should_carry_locus_p (const_tree stmt)
 {
   /* Don't emit a line note for a label.  We particularly don't want to
      emit one for the break label, since it doesn't actually correspond
@@ -2891,7 +2891,7 @@ gimplify_init_ctor_eval_range (tree obje
 /* Return true if FDECL is accessing a field that is zero sized.  */

 static bool
-zero_sized_field_decl (tree fdecl)
+zero_sized_field_decl (const_tree fdecl)
 {
   if (TREE_CODE (fdecl) == FIELD_DECL && DECL_SIZE (fdecl)
       && integer_zerop (DECL_SIZE (fdecl)))
@@ -2902,7 +2902,7 @@ zero_sized_field_decl (tree fdecl)
 /* Return true if TYPE is zero sized.  */

 static bool
-zero_sized_type (tree type)
+zero_sized_type (const_tree type)
 {
   if (AGGREGATE_TYPE_P (type) && TYPE_SIZE (type)
       && integer_zerop (TYPE_SIZE (type)))
@@ -5181,7 +5181,7 @@ gimplify_omp_workshare (tree *expr_p, tr
    EXPR is this stabilized form.  */

 static bool
-goa_lhs_expr_p (tree expr, tree addr)
+goa_lhs_expr_p (const_tree expr, const_tree addr)
 {
   /* Also include casts to other type variants.  The C front end is fond
      of adding these for e.g. volatile variables.  This is like
diff -rup orig/egcc-SVN20070812/gcc/omp-low.c egcc-SVN20070812/gcc/omp-low.c
--- orig/egcc-SVN20070812/gcc/omp-low.c	2007-08-01 23:05:32.000000000 -0400
+++ egcc-SVN20070812/gcc/omp-low.c	2007-08-13 17:48:06.267894064 -0400
@@ -428,7 +428,7 @@ determine_parallel_type (struct omp_regi
 /* Return true if EXPR is variable sized.  */

 static inline bool
-is_variable_sized (tree expr)
+is_variable_sized (const_tree expr)
 {
   return !TREE_CONSTANT (TYPE_SIZE_UNIT (TREE_TYPE (expr)));
 }
@@ -481,7 +481,7 @@ maybe_lookup_field (tree var, omp_contex
    if DECL is to be shared.  */

 static bool
-use_pointer_for_field (tree decl, bool shared_p)
+use_pointer_for_field (const_tree decl, bool shared_p)
 {
   if (AGGREGATE_TYPE_P (TREE_TYPE (decl)))
     return true;
diff -rup orig/egcc-SVN20070812/gcc/rtl.h egcc-SVN20070812/gcc/rtl.h
--- orig/egcc-SVN20070812/gcc/rtl.h	2007-08-13 14:40:24.203965338 -0400
+++ egcc-SVN20070812/gcc/rtl.h	2007-08-13 22:42:43.487729859 -0400
@@ -2130,7 +2130,7 @@ extern rtx move_by_pieces (rtx, rtx, uns
 			   unsigned int, int);

 /* In cfgrtl.c */
-extern void print_rtl_with_bb (FILE *, rtx);
+extern void print_rtl_with_bb (FILE *, const_rtx);

 /* In cfg.c.  */
 extern void dump_reg_info (FILE *);
diff -rup orig/egcc-SVN20070812/gcc/sched-vis.c egcc-SVN20070812/gcc/sched-vis.c
--- orig/egcc-SVN20070812/gcc/sched-vis.c	2007-07-26 23:04:10.000000000 -0400
+++ egcc-SVN20070812/gcc/sched-vis.c	2007-08-13 22:42:31.532053379 -0400
@@ -33,9 +33,9 @@ along with GCC; see the file COPYING3.
 #include "tree-pass.h"

 static char *safe_concat (char *, char *, const char *);
-static void print_exp (char *, rtx, int);
-static void print_value (char *, rtx, int);
-static void print_pattern (char *, rtx, int);
+static void print_exp (char *, const_rtx, int);
+static void print_value (char *, const_rtx, int);
+static void print_pattern (char *, const_rtx, int);

 #define BUF_LEN 2048

@@ -63,7 +63,7 @@ safe_concat (char *buf, char *cur, const
    may be stored in objects representing values.  */

 static void
-print_exp (char *buf, rtx x, int verbose)
+print_exp (char *buf, const_rtx x, int verbose)
 {
   char tmp[BUF_LEN];
   const char *st[4];
@@ -426,7 +426,7 @@ print_exp (char *buf, rtx x, int verbose
    registers, labels, symbols and memory accesses.  */

 static void
-print_value (char *buf, rtx x, int verbose)
+print_value (char *buf, const_rtx x, int verbose)
 {
   char t[BUF_LEN];
   char *cur = buf;
@@ -528,7 +528,7 @@ print_value (char *buf, rtx x, int verbo
 /* The next step in insn detalization, its pattern recognition.  */

 static void
-print_pattern (char *buf, rtx x, int verbose)
+print_pattern (char *buf, const_rtx x, int verbose)
 {
   char t1[BUF_LEN], t2[BUF_LEN], t3[BUF_LEN];

diff -rup orig/egcc-SVN20070812/gcc/tree-cfg.c egcc-SVN20070812/gcc/tree-cfg.c
--- orig/egcc-SVN20070812/gcc/tree-cfg.c	2007-08-13 14:40:24.217113949 -0400
+++ egcc-SVN20070812/gcc/tree-cfg.c	2007-08-13 18:26:53.826436597 -0400
@@ -2592,6 +2592,12 @@ first_stmt (basic_block bb)
   return !bsi_end_p (i) ? bsi_stmt (i) : NULL_TREE;
 }

+const_tree
+const_first_stmt (const_basic_block bb)
+{
+  const_block_stmt_iterator i = cbsi_start (bb);
+  return !cbsi_end_p (i) ? cbsi_stmt (i) : NULL_TREE;
+}

 /* Return the last statement in basic block BB.  */

@@ -2602,6 +2608,12 @@ last_stmt (basic_block bb)
   return !bsi_end_p (b) ? bsi_stmt (b) : NULL_TREE;
 }

+const_tree
+const_last_stmt (const_basic_block bb)
+{
+  const_block_stmt_iterator b = cbsi_last (bb);
+  return !cbsi_end_p (b) ? cbsi_stmt (b) : NULL_TREE;
+}

 /* Return the last statement of an otherwise empty block.  Return NULL
    if the block is totally empty, or if it contains more than one
diff -rup orig/egcc-SVN20070812/gcc/tree-flow-inline.h egcc-SVN20070812/gcc/tree-flow-inline.h
--- orig/egcc-SVN20070812/gcc/tree-flow-inline.h	2007-08-10 14:11:36.000000000 -0400
+++ egcc-SVN20070812/gcc/tree-flow-inline.h	2007-08-13 18:07:34.440084929 -0400
@@ -713,7 +713,7 @@ phi_ssa_name_p (const_tree t)
 /* Returns the list of statements in BB.  */

 static inline tree
-bb_stmt_list (basic_block bb)
+bb_stmt_list (const_basic_block bb)
 {
   gcc_assert (!(bb->flags & BB_RTL));
   return bb->il.tree->stmt_list;
@@ -745,6 +745,21 @@ bsi_start (basic_block bb)
   return bsi;
 }

+static inline const_block_stmt_iterator
+cbsi_start (const_basic_block bb)
+{
+  const_block_stmt_iterator bsi;
+  if (bb->index < NUM_FIXED_BLOCKS)
+    {
+      bsi.tsi.ptr = NULL;
+      bsi.tsi.container = NULL;
+    }
+  else
+    bsi.tsi = ctsi_start (bb_stmt_list (bb));
+  bsi.bb = bb;
+  return bsi;
+}
+
 /* Return a block statement iterator that points to the first non-label
    statement in block BB.  */

@@ -777,6 +792,22 @@ bsi_last (basic_block bb)
   return bsi;
 }

+static inline const_block_stmt_iterator
+cbsi_last (const_basic_block bb)
+{
+  const_block_stmt_iterator bsi;
+
+  if (bb->index < NUM_FIXED_BLOCKS)
+    {
+      bsi.tsi.ptr = NULL;
+      bsi.tsi.container = NULL;
+    }
+  else
+    bsi.tsi = ctsi_last (bb_stmt_list (bb));
+  bsi.bb = bb;
+  return bsi;
+}
+
 /* Return true if block statement iterator I has reached the end of
    the basic block.  */
 static inline bool
@@ -785,6 +816,12 @@ bsi_end_p (block_stmt_iterator i)
   return tsi_end_p (i.tsi);
 }

+static inline bool
+cbsi_end_p (const_block_stmt_iterator i)
+{
+  return ctsi_end_p (i.tsi);
+}
+
 /* Modify block statement iterator I so that it is at the next
    statement in the basic block.  */
 static inline void
@@ -793,6 +830,12 @@ bsi_next (block_stmt_iterator *i)
   tsi_next (&i->tsi);
 }

+static inline void
+cbsi_next (const_block_stmt_iterator *i)
+{
+  ctsi_next (&i->tsi);
+}
+
 /* Modify block statement iterator I so that it is at the previous
    statement in the basic block.  */
 static inline void
@@ -801,6 +844,12 @@ bsi_prev (block_stmt_iterator *i)
   tsi_prev (&i->tsi);
 }

+static inline void
+cbsi_prev (const_block_stmt_iterator *i)
+{
+  ctsi_prev (&i->tsi);
+}
+
 /* Return the statement that block statement iterator I is currently
    at.  */
 static inline tree
@@ -809,6 +858,12 @@ bsi_stmt (block_stmt_iterator i)
   return tsi_stmt (i.tsi);
 }

+static inline const_tree
+cbsi_stmt (const_block_stmt_iterator i)
+{
+  return ctsi_stmt (i.tsi);
+}
+
 /* Return a pointer to the statement that block statement iterator I
    is currently at.  */
 static inline tree *
diff -rup orig/egcc-SVN20070812/gcc/tree-flow.h egcc-SVN20070812/gcc/tree-flow.h
--- orig/egcc-SVN20070812/gcc/tree-flow.h	2007-08-13 14:40:24.229257049 -0400
+++ egcc-SVN20070812/gcc/tree-flow.h	2007-08-13 20:48:23.079223221 -0400
@@ -628,8 +628,15 @@ typedef struct {
   basic_block bb;
 } block_stmt_iterator;

+typedef struct {
+  const_tree_stmt_iterator tsi;
+  const_basic_block bb;
+} const_block_stmt_iterator;
+
 static inline block_stmt_iterator bsi_start (basic_block);
+static inline const_block_stmt_iterator cbsi_start (const_basic_block);
 static inline block_stmt_iterator bsi_last (basic_block);
+static inline const_block_stmt_iterator cbsi_last (const_basic_block);
 static inline block_stmt_iterator bsi_after_labels (basic_block);
 block_stmt_iterator bsi_for_stmt (tree);
 static inline bool bsi_end_p (block_stmt_iterator);
@@ -737,7 +744,9 @@ extern void print_loop_ir (FILE *);
 extern void cleanup_dead_labels (void);
 extern void group_case_labels (void);
 extern tree first_stmt (basic_block);
+extern const_tree const_first_stmt (const_basic_block);
 extern tree last_stmt (basic_block);
+extern const_tree const_last_stmt (const_basic_block);
 extern tree last_and_only_stmt (basic_block);
 extern edge find_taken_edge (basic_block, tree);
 extern basic_block label_to_block_fn (struct function *, tree);
@@ -819,7 +828,7 @@ extern tree phi_reverse (tree);
 /* In gimple-low.c  */
 extern void record_vars_into (tree, tree);
 extern void record_vars (tree);
-extern bool block_may_fallthru (tree);
+extern bool block_may_fallthru (const_tree);

 /* In tree-ssa-alias.c  */
 extern void dump_may_aliases_for (FILE *, tree);
@@ -959,7 +968,7 @@ extern bool vect_can_force_dr_alignment_
 extern tree get_vectype_for_scalar_type (tree);

 /* In tree-ssa-phiopt.c */
-bool empty_block_p (basic_block);
+bool empty_block_p (const_basic_block);
 basic_block *blocks_in_phiopt_order (void);

 /* In tree-ssa-loop*.c  */
diff -rup orig/egcc-SVN20070812/gcc/tree-iterator.c egcc-SVN20070812/gcc/tree-iterator.c
--- orig/egcc-SVN20070812/gcc/tree-iterator.c	2007-07-26 23:04:07.000000000 -0400
+++ egcc-SVN20070812/gcc/tree-iterator.c	2007-08-13 17:37:36.376830649 -0400
@@ -299,66 +299,89 @@ tsi_split_statement_list_before (tree_st
 /* Return the first expression in a sequence of COMPOUND_EXPRs,
    or in a STATEMENT_LIST.  */

+#define EXPR_FIRST_BODY do { \
+  if (expr == NULL_TREE) \
+    return expr; \
+  if (TREE_CODE (expr) == STATEMENT_LIST) \
+    { \
+      struct tree_statement_list_node *n = STATEMENT_LIST_HEAD (expr); \
+      return n ? n->stmt : NULL_TREE; \
+    } \
+  while (TREE_CODE (expr) == COMPOUND_EXPR) \
+    expr = TREE_OPERAND (expr, 0); \
+  return expr; \
+} while (0)
+
 tree
 expr_first (tree expr)
 {
-  if (expr == NULL_TREE)
-    return expr;
+  EXPR_FIRST_BODY;
+}

-  if (TREE_CODE (expr) == STATEMENT_LIST)
-    {
-      struct tree_statement_list_node *n = STATEMENT_LIST_HEAD (expr);
-      return n ? n->stmt : NULL_TREE;
-    }
-
-  while (TREE_CODE (expr) == COMPOUND_EXPR)
-    expr = TREE_OPERAND (expr, 0);
-  return expr;
+const_tree
+const_expr_first (const_tree expr)
+{
+  EXPR_FIRST_BODY;
 }

 /* Return the last expression in a sequence of COMPOUND_EXPRs,
    or in a STATEMENT_LIST.  */

+#define EXPR_LAST_BODY do { \
+  if (expr == NULL_TREE) \
+    return expr;\
+  if (TREE_CODE (expr) == STATEMENT_LIST) \
+    { \
+      struct tree_statement_list_node *n = STATEMENT_LIST_TAIL (expr); \
+      return n ? n->stmt : NULL_TREE; \
+    } \
+  while (TREE_CODE (expr) == COMPOUND_EXPR) \
+    expr = TREE_OPERAND (expr, 1); \
+  return expr; \
+} while (0)
+
 tree
 expr_last (tree expr)
 {
-  if (expr == NULL_TREE)
-    return expr;
+  EXPR_LAST_BODY;
+}

-  if (TREE_CODE (expr) == STATEMENT_LIST)
-    {
-      struct tree_statement_list_node *n = STATEMENT_LIST_TAIL (expr);
-      return n ? n->stmt : NULL_TREE;
-    }
-
-  while (TREE_CODE (expr) == COMPOUND_EXPR)
-    expr = TREE_OPERAND (expr, 1);
-  return expr;
+const_tree
+const_expr_last (const_tree expr)
+{
+  EXPR_LAST_BODY;
 }

 /* If EXPR is a single statement return it.  If EXPR is a
    STATEMENT_LIST containing exactly one statement S, return S.
    Otherwise, return NULL.  */

+#define EXPR_ONLY_BODY do { \
+  if (expr == NULL_TREE) \
+    return NULL_TREE; \
+  if (TREE_CODE (expr) == STATEMENT_LIST) \
+    { \
+      struct tree_statement_list_node *n = STATEMENT_LIST_TAIL (expr); \
+      if (n && STATEMENT_LIST_HEAD (expr) == n) \
+	return n->stmt; \
+      else \
+	return NULL_TREE; \
+    } \
+  if (TREE_CODE (expr) == COMPOUND_EXPR) \
+    return NULL_TREE; \
+  return expr; \
+} while (0)
+
 tree
 expr_only (tree expr)
 {
-  if (expr == NULL_TREE)
-    return NULL_TREE;
-
-  if (TREE_CODE (expr) == STATEMENT_LIST)
-    {
-      struct tree_statement_list_node *n = STATEMENT_LIST_TAIL (expr);
-      if (n && STATEMENT_LIST_HEAD (expr) == n)
-	return n->stmt;
-      else
-	return NULL_TREE;
-    }
-
-  if (TREE_CODE (expr) == COMPOUND_EXPR)
-    return NULL_TREE;
+  EXPR_ONLY_BODY;
+}

-  return expr;
+const_tree
+const_expr_only (const_tree expr)
+{
+  EXPR_ONLY_BODY;
 }

 #include "gt-tree-iterator.h"
diff -rup orig/egcc-SVN20070812/gcc/tree-iterator.h egcc-SVN20070812/gcc/tree-iterator.h
--- orig/egcc-SVN20070812/gcc/tree-iterator.h	2007-07-26 23:04:07.000000000 -0400
+++ egcc-SVN20070812/gcc/tree-iterator.h	2007-08-13 17:11:10.847834970 -0400
@@ -34,6 +34,11 @@ typedef struct {
   tree container;
 } tree_stmt_iterator;

+typedef struct {
+  struct tree_statement_list_node *ptr;
+  const_tree container;
+} const_tree_stmt_iterator;
+
 static inline tree_stmt_iterator
 tsi_start (tree t)
 {
@@ -45,6 +50,17 @@ tsi_start (tree t)
   return i;
 }

+static inline const_tree_stmt_iterator
+ctsi_start (const_tree t)
+{
+  const_tree_stmt_iterator i;
+
+  i.ptr = STATEMENT_LIST_HEAD (t);
+  i.container = t;
+
+  return i;
+}
+
 static inline tree_stmt_iterator
 tsi_last (tree t)
 {
@@ -56,6 +72,17 @@ tsi_last (tree t)
   return i;
 }

+static inline const_tree_stmt_iterator
+ctsi_last (tree t)
+{
+  const_tree_stmt_iterator i;
+
+  i.ptr = STATEMENT_LIST_TAIL (t);
+  i.container = t;
+
+  return i;
+}
+
 static inline bool
 tsi_end_p (tree_stmt_iterator i)
 {
@@ -63,11 +90,23 @@ tsi_end_p (tree_stmt_iterator i)
 }

 static inline bool
+ctsi_end_p (const_tree_stmt_iterator i)
+{
+  return i.ptr == NULL;
+}
+
+static inline bool
 tsi_one_before_end_p (tree_stmt_iterator i)
 {
   return i.ptr != NULL && i.ptr->next == NULL;
 }

+static inline bool
+ctsi_one_before_end_p (const_tree_stmt_iterator i)
+{
+  return i.ptr != NULL && i.ptr->next == NULL;
+}
+
 static inline void
 tsi_next (tree_stmt_iterator *i)
 {
@@ -75,11 +114,23 @@ tsi_next (tree_stmt_iterator *i)
 }

 static inline void
+ctsi_next (const_tree_stmt_iterator *i)
+{
+  i->ptr = i->ptr->next;
+}
+
+static inline void
 tsi_prev (tree_stmt_iterator *i)
 {
   i->ptr = i->ptr->prev;
 }

+static inline void
+ctsi_prev (const_tree_stmt_iterator *i)
+{
+  i->ptr = i->ptr->prev;
+}
+
 static inline tree *
 tsi_stmt_ptr (tree_stmt_iterator i)
 {
@@ -92,6 +143,12 @@ tsi_stmt (tree_stmt_iterator i)
   return i.ptr->stmt;
 }

+static inline const_tree
+ctsi_stmt (const_tree_stmt_iterator i)
+{
+  return i.ptr->stmt;
+}
+
 enum tsi_iterator_update
 {
   TSI_NEW_STMT,		/* Only valid when single statement is added, move
diff -rup orig/egcc-SVN20070812/gcc/tree-scalar-evolution.c egcc-SVN20070812/gcc/tree-scalar-evolution.c
--- orig/egcc-SVN20070812/gcc/tree-scalar-evolution.c	2007-08-13 14:40:24.238742980 -0400
+++ egcc-SVN20070812/gcc/tree-scalar-evolution.c	2007-08-13 16:57:34.662323517 -0400
@@ -932,7 +932,7 @@ analyzable_condition (const_tree expr)
    analyze, then give up.  */

 tree
-get_loop_exit_condition (struct loop *loop)
+get_loop_exit_condition (const struct loop *loop)
 {
   tree res = NULL_TREE;
   edge exit_edge = single_exit (loop);
diff -rup orig/egcc-SVN20070812/gcc/tree-scalar-evolution.h egcc-SVN20070812/gcc/tree-scalar-evolution.h
--- orig/egcc-SVN20070812/gcc/tree-scalar-evolution.h	2007-08-13 14:40:24.239486190 -0400
+++ egcc-SVN20070812/gcc/tree-scalar-evolution.h	2007-08-13 16:52:32.833142437 -0400
@@ -23,7 +23,7 @@ along with GCC; see the file COPYING3.

 extern tree number_of_latch_executions (struct loop *);
 extern tree number_of_exit_cond_executions (struct loop *);
-extern tree get_loop_exit_condition (struct loop *);
+extern tree get_loop_exit_condition (const struct loop *);

 extern void scev_initialize (void);
 extern void scev_reset (void);
diff -rup orig/egcc-SVN20070812/gcc/tree-ssa-loop-niter.c egcc-SVN20070812/gcc/tree-ssa-loop-niter.c
--- orig/egcc-SVN20070812/gcc/tree-ssa-loop-niter.c	2007-07-26 23:03:29.000000000 -0400
+++ egcc-SVN20070812/gcc/tree-ssa-loop-niter.c	2007-08-13 21:04:46.640343072 -0400
@@ -1673,7 +1673,7 @@ simplify_using_outer_evolutions (struct
 /* Returns true if EXIT is the only possible exit from LOOP.  */

 static bool
-loop_only_exit_p (struct loop *loop, edge exit)
+loop_only_exit_p (const struct loop *loop, const_edge exit)
 {
   basic_block *body;
   block_stmt_iterator bsi;
@@ -2171,7 +2171,7 @@ find_loop_niter_by_eval (struct loop *lo
    be nonnegative.  */

 static double_int
-derive_constant_upper_bound (tree val)
+derive_constant_upper_bound (const_tree val)
 {
   tree type = TREE_TYPE (val);
   tree op0, op1, subtype, maxt;
diff -rup orig/egcc-SVN20070812/gcc/tree-ssa-phiopt.c egcc-SVN20070812/gcc/tree-ssa-phiopt.c
--- orig/egcc-SVN20070812/gcc/tree-ssa-phiopt.c	2007-07-26 23:03:57.000000000 -0400
+++ egcc-SVN20070812/gcc/tree-ssa-phiopt.c	2007-08-13 20:47:08.660634812 -0400
@@ -297,18 +297,18 @@ blocks_in_phiopt_order (void)
 /* Return TRUE if block BB has no executable statements, otherwise return
    FALSE.  */
 bool
-empty_block_p (basic_block bb)
+empty_block_p (const_basic_block bb)
 {
-  block_stmt_iterator bsi;
+  const_block_stmt_iterator bsi;

   /* BB must have no executable statements.  */
-  bsi = bsi_start (bb);
-  while (!bsi_end_p (bsi)
-	  && (TREE_CODE (bsi_stmt (bsi)) == LABEL_EXPR
-	      || IS_EMPTY_STMT (bsi_stmt (bsi))))
-    bsi_next (&bsi);
+  bsi = cbsi_start (bb);
+  while (!cbsi_end_p (bsi)
+	  && (TREE_CODE (cbsi_stmt (bsi)) == LABEL_EXPR
+	      || IS_EMPTY_STMT (cbsi_stmt (bsi))))
+    cbsi_next (&bsi);

-  if (!bsi_end_p (bsi))
+  if (!cbsi_end_p (bsi))
     return false;

   return true;
diff -rup orig/egcc-SVN20070812/gcc/tree-ssa-threadupdate.c egcc-SVN20070812/gcc/tree-ssa-threadupdate.c
--- orig/egcc-SVN20070812/gcc/tree-ssa-threadupdate.c	2007-08-13 14:40:24.244338102 -0400
+++ egcc-SVN20070812/gcc/tree-ssa-threadupdate.c	2007-08-13 20:46:18.981372296 -0400
@@ -461,26 +461,26 @@ redirect_edges (void **slot, void *data)
    is one, this is equivalent to a "forwarder" block.  */

 static bool
-redirection_block_p (basic_block bb)
+redirection_block_p (const_basic_block bb)
 {
-  block_stmt_iterator bsi;
+  const_block_stmt_iterator bsi;

   /* Advance to the first executable statement.  */
-  bsi = bsi_start (bb);
-  while (!bsi_end_p (bsi)
-          && (TREE_CODE (bsi_stmt (bsi)) == LABEL_EXPR
-              || IS_EMPTY_STMT (bsi_stmt (bsi))))
-    bsi_next (&bsi);
+  bsi = cbsi_start (bb);
+  while (!cbsi_end_p (bsi)
+          && (TREE_CODE (cbsi_stmt (bsi)) == LABEL_EXPR
+              || IS_EMPTY_STMT (cbsi_stmt (bsi))))
+    cbsi_next (&bsi);

   /* Check if this is an empty block.  */
-  if (bsi_end_p (bsi))
+  if (cbsi_end_p (bsi))
     return true;

   /* Test that we've reached the terminating control statement.  */
-  return bsi_stmt (bsi)
-	 && (TREE_CODE (bsi_stmt (bsi)) == COND_EXPR
-	     || TREE_CODE (bsi_stmt (bsi)) == GOTO_EXPR
-	     || TREE_CODE (bsi_stmt (bsi)) == SWITCH_EXPR);
+  return cbsi_stmt (bsi)
+	 && (TREE_CODE (cbsi_stmt (bsi)) == COND_EXPR
+	     || TREE_CODE (cbsi_stmt (bsi)) == GOTO_EXPR
+	     || TREE_CODE (cbsi_stmt (bsi)) == SWITCH_EXPR);
 }

 /* BB is a block which ends with a COND_EXPR or SWITCH_EXPR and when BB
diff -rup orig/egcc-SVN20070812/gcc/tree-vectorizer.c egcc-SVN20070812/gcc/tree-vectorizer.c
--- orig/egcc-SVN20070812/gcc/tree-vectorizer.c	2007-08-09 19:22:01.000000000 -0400
+++ egcc-SVN20070812/gcc/tree-vectorizer.c	2007-08-13 16:51:54.136064791 -0400
@@ -948,7 +948,7 @@ slpeel_add_loop_guard (basic_block guard
  */

 bool
-slpeel_can_duplicate_loop_p (struct loop *loop, edge e)
+slpeel_can_duplicate_loop_p (const struct loop *loop, const_edge e)
 {
   edge exit_e = single_exit (loop);
   edge entry_e = loop_preheader_edge (loop);
diff -rup orig/egcc-SVN20070812/gcc/tree-vectorizer.h egcc-SVN20070812/gcc/tree-vectorizer.h
--- orig/egcc-SVN20070812/gcc/tree-vectorizer.h	2007-07-26 23:03:55.000000000 -0400
+++ egcc-SVN20070812/gcc/tree-vectorizer.h	2007-08-13 16:51:51.566163509 -0400
@@ -448,7 +448,7 @@ extern bitmap vect_memsyms_to_rename;
 extern struct loop *slpeel_tree_peel_loop_to_edge
   (struct loop *, edge, tree, tree, bool, unsigned int);
 extern void slpeel_make_loop_iterate_ntimes (struct loop *, tree);
-extern bool slpeel_can_duplicate_loop_p (struct loop *, edge);
+extern bool slpeel_can_duplicate_loop_p (const struct loop *, const_edge);
 #ifdef ENABLE_CHECKING
 extern void slpeel_verify_cfg_after_peeling (struct loop *, struct loop *);
 #endif
diff -rup orig/egcc-SVN20070812/gcc/tree-vrp.c egcc-SVN20070812/gcc/tree-vrp.c
--- orig/egcc-SVN20070812/gcc/tree-vrp.c	2007-08-03 20:02:11.000000000 -0400
+++ egcc-SVN20070812/gcc/tree-vrp.c	2007-08-13 16:50:18.106091780 -0400
@@ -518,7 +518,7 @@ vrp_operand_equal_p (tree val1, tree val
 /* Return true, if the bitmaps B1 and B2 are equal.  */

 static inline bool
-vrp_bitmap_equal_p (bitmap b1, bitmap b2)
+vrp_bitmap_equal_p (const_bitmap b1, const_bitmap b2)
 {
   return (b1 == b2
 	  || (b1 && b2
diff -rup orig/egcc-SVN20070812/gcc/tree.c egcc-SVN20070812/gcc/tree.c
--- orig/egcc-SVN20070812/gcc/tree.c	2007-08-10 14:11:31.000000000 -0400
+++ egcc-SVN20070812/gcc/tree.c	2007-08-13 21:27:36.316169297 -0400
@@ -6319,7 +6319,7 @@ int_fits_type_p (const_tree c, const_tre
    precision of the type are returned instead.  */

 void
-get_type_static_bounds (tree type, mpz_t min, mpz_t max)
+get_type_static_bounds (const_tree type, mpz_t min, mpz_t max)
 {
   if (!POINTER_TYPE_P (type) && TYPE_MIN_VALUE (type)
       && TREE_CODE (TYPE_MIN_VALUE (type)) == INTEGER_CST)
diff -rup orig/egcc-SVN20070812/gcc/tree.h egcc-SVN20070812/gcc/tree.h
--- orig/egcc-SVN20070812/gcc/tree.h	2007-08-11 20:02:46.000000000 -0400
+++ egcc-SVN20070812/gcc/tree.h	2007-08-13 21:27:38.716624503 -0400
@@ -4297,8 +4297,11 @@ extern tree non_lvalue (tree);
 extern tree convert (tree, tree);
 extern unsigned int expr_align (const_tree);
 extern tree expr_first (tree);
+extern const_tree const_expr_first (const_tree);
 extern tree expr_last (tree);
+extern const_tree const_expr_last (const_tree);
 extern tree expr_only (tree);
+extern const_tree const_expr_only (const_tree);
 extern tree size_in_bytes (tree);
 extern HOST_WIDE_INT int_size_in_bytes (const_tree);
 extern HOST_WIDE_INT max_int_size_in_bytes (tree);
@@ -4789,7 +4792,7 @@ extern int objects_must_conflict_p (tree
 /* In tree.c */
 extern int really_constant_p (const_tree);
 extern int int_fits_type_p (const_tree, const_tree);
-extern void get_type_static_bounds (tree, mpz_t, mpz_t);
+extern void get_type_static_bounds (const_tree, mpz_t, mpz_t);
 extern bool variably_modified_type_p (tree, tree);
 extern int tree_log2 (const_tree);
 extern int tree_floor_log2 (const_tree);


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]