summaryrefslogtreecommitdiff
path: root/gcc/tree-iterator.h
diff options
context:
space:
mode:
authorKaveh R. Ghazi <ghazi@caip.rutgers.edu>2007-08-14 15:18:11 +0000
committerKaveh Ghazi <ghazi@gcc.gnu.org>2007-08-14 15:18:11 +0000
commit22ea9ec0e8acfd6a8e42aba3437bf61fd6fd04c3 (patch)
tree94820a53d64bc84958636e8e87e79b6b817705b9 /gcc/tree-iterator.h
parentd39d658dbe7c5682da000db60d4ea6209ce6ab66 (diff)
downloadgcc-22ea9ec0e8acfd6a8e42aba3437bf61fd6fd04c3.tar.gz
alias.c (component_uses_parent_alias_set): Constify.
* 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
Diffstat (limited to 'gcc/tree-iterator.h')
-rw-r--r--gcc/tree-iterator.h57
1 files changed, 57 insertions, 0 deletions
diff --git a/gcc/tree-iterator.h b/gcc/tree-iterator.h
index 98f0cf80c49..5b8113a4560 100644
--- a/gcc/tree-iterator.h
+++ b/gcc/tree-iterator.h
@@ -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