alias.c (component_uses_parent_alias_set): Constify.
authorKaveh R. Ghazi <ghazi@caip.rutgers.edu>
Tue, 14 Aug 2007 15:18:11 +0000 (15:18 +0000)
committerKaveh Ghazi <ghazi@gcc.gnu.org>
Tue, 14 Aug 2007 15:18:11 +0000 (15:18 +0000)
* 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.

From-SVN: r127483

28 files changed:
gcc/ChangeLog
gcc/alias.c
gcc/alias.h
gcc/cfgrtl.c
gcc/double-int.c
gcc/double-int.h
gcc/expr.c
gcc/expr.h
gcc/gimple-low.c
gcc/gimplify.c
gcc/omp-low.c
gcc/rtl.h
gcc/sched-vis.c
gcc/tree-cfg.c
gcc/tree-flow-inline.h
gcc/tree-flow.h
gcc/tree-iterator.c
gcc/tree-iterator.h
gcc/tree-scalar-evolution.c
gcc/tree-scalar-evolution.h
gcc/tree-ssa-loop-niter.c
gcc/tree-ssa-phiopt.c
gcc/tree-ssa-threadupdate.c
gcc/tree-vectorizer.c
gcc/tree-vectorizer.h
gcc/tree-vrp.c
gcc/tree.c
gcc/tree.h

index f22ca2214d37d56d5c21867e7b4ccef5dae70933..c23de5cd4e8c10ac685022723ed27acc492234b1 100644 (file)
@@ -1,3 +1,50 @@
+2007-08-14  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.
+
 2007-08-14  Rask Ingemann Lambertsen  <rask@sygehus.dk>
 
        PR target/30315
index 36de66333d1de8acd9bb6ac895a79e3aea8fb5f6..ec298423020918442ffd655cb0b216bb42052de1 100644 (file)
@@ -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)
     {
index a0511c14a46efe1c66345e07d9947f0322eb4545..a24549391feaa435009f6ad2e7f50a95bdca7722 100644 (file)
@@ -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
index 81bcd65a6b0e129f42630cbce271a9fdd698bcbc..5d736a5990bd53f30566fa4b22595c2792d091c4 100644 (file)
@@ -1526,9 +1526,9 @@ rtl_dump_bb (basic_block bb, FILE *outf, int indent)
    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
index 2ab505584f8cbf25ba95126b3cb2461396a4191a..7bcf88f2780d87d899ff5024d42ad6f1e08d099c 100644 (file)
@@ -112,7 +112,7 @@ double_int_sext (double_int cst, unsigned prec)
    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_int cst)
    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_int val, bool uns)
    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;
index 9137c27f2058ba296120158c59c50f35608eaf71..e82c37ee6d28e67dfdaccfc0a70eefaf71df0409 100644 (file)
@@ -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, double_int cst2)
 /* 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 */
index 04a96633f61afc6f8fa297bf061bebcb9898844f..dc6615abac09d47700ea43c6dca731e2bd76c9ca 100644 (file)
@@ -146,7 +146,7 @@ static rtx store_field (rtx, HOST_WIDE_INT, HOST_WIDE_INT, enum machine_mode,
 
 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, rtx x, rtx y)
    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, bool allow_flexarr)
 /* 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, rtx target, tree type)
    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
index 64604d75f95a8b72158c288c4fe0753fca3ba90f..2e75916f832e58ca0c599bf3ac5016efbb722689 100644 (file)
@@ -740,7 +740,7 @@ extern rtx expand_mult (enum machine_mode, rtx, rtx, rtx, int);
 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.  */
index 93532b95626985ed7a60d505ce4abba859aeb4a9..ba539ac7e5025c29787bfad90cf1ff2897d91661 100644 (file)
@@ -344,7 +344,7 @@ lower_bind_expr (tree_stmt_iterator *tsi, struct lower_data *data)
    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)
     {
index 15c9b91ceb509c27408d78530f20273ccc9012d9..cea79919965934f6bc015b32517bcae98d36b0db 100644 (file)
@@ -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 object, tree lower, tree upper,
 /* 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, tree *pre_p)
    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 
index bc1c82193cbe16dfffb400a757d5aaef6ffc974d..5aaa7fe86823f2acb6dfe24bd1bf5cfdbbe91586 100644 (file)
@@ -428,7 +428,7 @@ determine_parallel_type (struct omp_region *region)
 /* 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_context *ctx)
    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;
index 8bbbfaea122129e1228d027f6638a7807d44711b..ff884b314a4f208c256da5bcc1a74ddbfe9c2b21 100644 (file)
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -2130,7 +2130,7 @@ extern rtx move_by_pieces (rtx, rtx, unsigned HOST_WIDE_INT,
                           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 *);
index 1d9dd4bf62549fb886787fd1dd1613275a9879fa..7ce0f0cc6407a610634583f3bbd45257a143b9db 100644 (file)
@@ -33,9 +33,9 @@ along with GCC; see the file COPYING3.  If not see
 #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 char *str)
    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 verbose)
 /* 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];
 
index f5939f77c20c90f163e7b04b04293fb9e8a02871..8cf3112a5a547ebcccc2553124d777e64e61d1b4 100644 (file)
@@ -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
index 1e52d1f4fc576d69b107a19d1e9fc5ecf29aba30..63d4021c2bc547c654711a9c35071caa1458609c 100644 (file)
@@ -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 *
index ad0d18b8e937e9ff69fda539ee935d2d7ada7bbf..7e60dae42a82d6d3a509d78d242e67c00ccc4a8a 100644 (file)
@@ -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_p (tree, unsigned int);
 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  */
index 507e24da99795facb7f03ff4289ebb7cbf8940a2..1e7a682d3915a2f37244d763b47989ffa6e678fe 100644 (file)
@@ -299,66 +299,89 @@ tsi_split_statement_list_before (tree_stmt_iterator *i)
 /* 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;
-
-  if (TREE_CODE (expr) == STATEMENT_LIST)
-    {
-      struct tree_statement_list_node *n = STATEMENT_LIST_HEAD (expr);
-      return n ? n->stmt : NULL_TREE;
-    }
+  EXPR_FIRST_BODY;
+}
 
-  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;
-
-  if (TREE_CODE (expr) == STATEMENT_LIST)
-    {
-      struct tree_statement_list_node *n = STATEMENT_LIST_TAIL (expr);
-      return n ? n->stmt : NULL_TREE;
-    }
+  EXPR_LAST_BODY;
+}
 
-  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"
index 98f0cf80c491f51708996fc70727a25ceeedc123..5b8113a4560c602e3316e903d641954f346661e2 100644 (file)
@@ -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,30 +72,65 @@ 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)
 {
   return i.ptr == NULL;
 }
 
+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)
 {
   i->ptr = i->ptr->next;
 }
 
+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
index a3a08efcee948f30c024e0f9a38bfbf0047e1529..cc80794c5d9cab5d0f42ca51b0cdb033ca377c62 100644 (file)
@@ -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);
index 797033ffb0ee975152d184762c41786ec0f679dd..a2ba5848046480ffd1abf728124da44556d3f86b 100644 (file)
@@ -23,7 +23,7 @@ along with GCC; see the file COPYING3.  If not see
 
 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);
index 147d9a3fbde61d05c61de7b08b6f54855316b4be..6d1834ec5e4ba7147e5ba048c3ada85b27b85132 100644 (file)
@@ -1673,7 +1673,7 @@ simplify_using_outer_evolutions (struct loop *loop, tree expr)
 /* 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 *loop, edge *exit)
    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;
index 14613b08d9cacd672f7413ca10c5e147dc8b3f0c..c3dcf33521f5444404268a753ac5f904101c9505 100644 (file)
@@ -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;
index 1d5500fe018a3221e9718aa86b11215bf6424272..d4d9ee53788ee8680967abed60f972d4dbdcf5fa 100644 (file)
@@ -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
index 396146d803a0bdf3c2c74057f9e3be406df4228c..6834e25684e4588f4c9cf2f09d57ec2e00ea8df4 100644 (file)
@@ -948,7 +948,7 @@ slpeel_add_loop_guard (basic_block guard_bb, tree cond, basic_block exit_bb,
  */
 
 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);
index d5267d1f5ca40aff63742a260bbe6f4f7227cb9f..40f22056ee9d65c6aed7ce81924f392ddea10960 100644 (file)
@@ -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
index 11e955f80534db30129ad81943e2dcc887fa3c1e..e1124b955d4dd0d2ea39f3a04d8779f613d08604 100644 (file)
@@ -518,7 +518,7 @@ vrp_operand_equal_p (tree val1, tree val2)
 /* 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
index 3ca006e687f9a4a9c919410294caedb63e721edb..8e8fe211234e67eeed3335085e3c94418821aa93 100644 (file)
@@ -6319,7 +6319,7 @@ int_fits_type_p (const_tree c, const_tree type)
    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)
index 6f6c53564b41f5a7df0dc9ec8177917ef2d2d470..fc0ca50bc86b90b2a14df9a9cda8fc0d60497ae0 100644 (file)
@@ -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, 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);