diff options
author | ghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-08-14 15:18:11 +0000 |
---|---|---|
committer | ghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-08-14 15:18:11 +0000 |
commit | 1f1872fdb0abb413ab6da9fd4f6adce363673c02 (patch) | |
tree | 94820a53d64bc84958636e8e87e79b6b817705b9 /gcc/tree-iterator.c | |
parent | aa8c6aad445339e9fdb1e9bbbcf3c9516a69a228 (diff) | |
download | gcc-1f1872fdb0abb413ab6da9fd4f6adce363673c02.tar.gz |
* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@127483 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-iterator.c')
-rw-r--r-- | gcc/tree-iterator.c | 97 |
1 files changed, 60 insertions, 37 deletions
diff --git a/gcc/tree-iterator.c b/gcc/tree-iterator.c index 507e24da997..1e7a682d391 100644 --- a/gcc/tree-iterator.c +++ b/gcc/tree-iterator.c @@ -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" |