From b48d0358542ad050257172d48202f6d59c2d5233 Mon Sep 17 00:00:00 2001 From: Diego Novillo Date: Fri, 7 Sep 2007 12:38:46 -0400 Subject: [PATCH] tree-flow.h (const_block_stmt_iterator): Remove. * tree-flow.h (const_block_stmt_iterator): Remove. Update all users to use block_stmt_iterator. * tree-iterator.h (const_tree_stmt_iterator): Remove. Update all users to use tree_stmt_iterator. From-SVN: r128246 --- gcc/ChangeLog | 7 ++++++ gcc/cfghooks.c | 4 ++-- gcc/cfghooks.h | 8 +++---- gcc/cfgrtl.c | 9 +++---- gcc/tree-cfg.c | 18 +++++++------- gcc/tree-flow-inline.h | 55 ------------------------------------------- gcc/tree-flow.h | 9 +------ gcc/tree-iterator.h | 57 --------------------------------------------- gcc/tree-ssa-phiopt.c | 18 +++++++------- gcc/tree-ssa-threadupdate.c | 24 +++++++++---------- gcc/tree.c | 10 ++++---- gcc/tree.h | 2 +- 12 files changed, 56 insertions(+), 165 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index af0c7af1801..a76df2a2665 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2007-09-07 Diego Novillo + + * tree-flow.h (const_block_stmt_iterator): Remove. + Update all users to use block_stmt_iterator. + * tree-iterator.h (const_tree_stmt_iterator): Remove. + Update all users to use tree_stmt_iterator. + 2007-09-07 Sandra Loosemore * config/mips/mips.c (mips_set_current_function): Temporarily diff --git a/gcc/cfghooks.c b/gcc/cfghooks.c index 921bf6fe291..f5fb18f0875 100644 --- a/gcc/cfghooks.c +++ b/gcc/cfghooks.c @@ -616,7 +616,7 @@ create_empty_bb (basic_block after) /* Checks whether we may merge blocks BB1 and BB2. */ bool -can_merge_blocks_p (const_basic_block bb1, const_basic_block bb2) +can_merge_blocks_p (basic_block bb1, basic_block bb2) { bool ret; @@ -938,7 +938,7 @@ duplicate_block (basic_block bb, edge e, basic_block after) instructions that must stay with the call, 0 otherwise. */ bool -block_ends_with_call_p (const_basic_block bb) +block_ends_with_call_p (basic_block bb) { if (!cfg_hooks->block_ends_with_call_p) internal_error ("%s does not support block_ends_with_call_p", cfg_hooks->name); diff --git a/gcc/cfghooks.h b/gcc/cfghooks.h index e305fd230ee..e581d9cd559 100644 --- a/gcc/cfghooks.h +++ b/gcc/cfghooks.h @@ -61,7 +61,7 @@ struct cfg_hooks bool (*move_block_after) (basic_block b, basic_block a); /* Return true when blocks A and B can be merged into single basic block. */ - bool (*can_merge_blocks_p) (const_basic_block a, const_basic_block b); + bool (*can_merge_blocks_p) (basic_block a, basic_block b); /* Merge blocks A and B. */ void (*merge_blocks) (basic_block a, basic_block b); @@ -89,7 +89,7 @@ struct cfg_hooks /* Say whether a block ends with a call, possibly followed by some other code that must stay with the call. */ - bool (*block_ends_with_call_p) (const_basic_block); + bool (*block_ends_with_call_p) (basic_block); /* Say whether a block ends with a conditional branch. Switches and unconditional branches do not qualify. */ @@ -151,7 +151,7 @@ extern void delete_basic_block (basic_block); extern basic_block split_edge (edge); extern basic_block create_basic_block (void *, void *, basic_block); extern basic_block create_empty_bb (basic_block); -extern bool can_merge_blocks_p (const_basic_block, const_basic_block); +extern bool can_merge_blocks_p (basic_block, basic_block); extern void merge_blocks (basic_block, basic_block); extern edge make_forwarder_block (basic_block, bool (*)(edge), void (*) (basic_block)); @@ -161,7 +161,7 @@ extern void predict_edge (edge e, enum br_predictor predictor, int probability); extern bool predicted_by_p (const_basic_block bb, enum br_predictor predictor); extern bool can_duplicate_block_p (const_basic_block); extern basic_block duplicate_block (basic_block, edge, basic_block); -extern bool block_ends_with_call_p (const_basic_block bb); +extern bool block_ends_with_call_p (basic_block bb); extern bool block_ends_with_condjump_p (const_basic_block bb); extern int flow_call_edges_add (sbitmap); extern void execute_on_growing_pred (edge); diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c index a31488ef7d5..9de8d127aef 100644 --- a/gcc/cfgrtl.c +++ b/gcc/cfgrtl.c @@ -627,9 +627,9 @@ rtl_merge_blocks (basic_block a, basic_block b) /* Return true when block A and B can be merged. */ -static bool -rtl_can_merge_blocks (const_basic_block a, const_basic_block b) +static bool +rtl_can_merge_blocks (basic_block a, basic_block b) { /* If we are partitioning hot/cold basic blocks, we don't want to mess up unconditional or indirect jumps that cross between hot @@ -2535,8 +2535,9 @@ cfg_layout_delete_block (basic_block bb) } /* Return true when blocks A and B can be safely merged. */ + static bool -cfg_layout_can_merge_blocks_p (const_basic_block a, const_basic_block b) +cfg_layout_can_merge_blocks_p (basic_block a, basic_block b) { /* If we are partitioning hot/cold basic blocks, we don't want to mess up unconditional or indirect jumps that cross between hot @@ -2692,7 +2693,7 @@ rtl_make_forwarder_block (edge fallthru ATTRIBUTE_UNUSED) instructions that must stay with the call, 0 otherwise. */ static bool -rtl_block_ends_with_call_p (const_basic_block bb) +rtl_block_ends_with_call_p (basic_block bb) { rtx insn = BB_END (bb); diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index 84000537b2f..069d330e74d 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -105,7 +105,7 @@ static inline void change_bb_for_stmt (tree t, basic_block bb); /* Flowgraph optimization and cleanup. */ static void tree_merge_blocks (basic_block, basic_block); -static bool tree_can_merge_blocks_p (const_basic_block, const_basic_block); +static bool tree_can_merge_blocks_p (basic_block, basic_block); static void remove_bb (basic_block); static edge find_taken_edge_computed_goto (basic_block, tree); static edge find_taken_edge_cond_expr (basic_block, tree); @@ -1136,10 +1136,10 @@ group_case_labels (void) /* Checks whether we can merge block B into block A. */ static bool -tree_can_merge_blocks_p (const_basic_block a, const_basic_block b) +tree_can_merge_blocks_p (basic_block a, basic_block b) { const_tree stmt; - const_block_stmt_iterator bsi; + block_stmt_iterator bsi; tree phi; if (!single_succ_p (a)) @@ -1161,7 +1161,7 @@ tree_can_merge_blocks_p (const_basic_block a, const_basic_block b) cannot merge the blocks. */ /* This CONST_CAST is okay because last_stmt doesn't modify its argument and the return value is assign to a const_tree. */ - stmt = last_stmt (CONST_CAST_BB(a)); + stmt = last_stmt (CONST_CAST_BB (a)); if (stmt && stmt_ends_bb_p (stmt)) return false; @@ -1187,9 +1187,9 @@ tree_can_merge_blocks_p (const_basic_block a, const_basic_block b) } /* Do not remove user labels. */ - for (bsi = cbsi_start (b); !cbsi_end_p (bsi); cbsi_next (&bsi)) + for (bsi = bsi_start (b); !bsi_end_p (bsi); bsi_next (&bsi)) { - stmt = cbsi_stmt (bsi); + stmt = bsi_stmt (bsi); if (TREE_CODE (stmt) != LABEL_EXPR) break; if (!DECL_ARTIFICIAL (LABEL_EXPR_LABEL (stmt))) @@ -6037,10 +6037,10 @@ debug_loop_ir (void) otherwise. */ static bool -tree_block_ends_with_call_p (const_basic_block bb) +tree_block_ends_with_call_p (basic_block bb) { - const_block_stmt_iterator bsi = cbsi_last (bb); - return const_get_call_expr_in (cbsi_stmt (bsi)) != NULL; + block_stmt_iterator bsi = bsi_last (bb); + return const_get_call_expr_in (bsi_stmt (bsi)) != NULL; } diff --git a/gcc/tree-flow-inline.h b/gcc/tree-flow-inline.h index 9fa5139c041..71e607bddce 100644 --- a/gcc/tree-flow-inline.h +++ b/gcc/tree-flow-inline.h @@ -745,21 +745,6 @@ 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. */ @@ -792,22 +777,6 @@ 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 @@ -816,12 +785,6 @@ 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 @@ -830,12 +793,6 @@ 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 @@ -844,12 +801,6 @@ 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 @@ -858,12 +809,6 @@ 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 --git a/gcc/tree-flow.h b/gcc/tree-flow.h index 83956a1a355..636a6f0ba55 100644 --- a/gcc/tree-flow.h +++ b/gcc/tree-flow.h @@ -624,15 +624,8 @@ 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); @@ -965,7 +958,7 @@ extern bool vect_can_force_dr_alignment_p (const_tree, unsigned int); extern tree get_vectype_for_scalar_type (tree); /* In tree-ssa-phiopt.c */ -bool empty_block_p (const_basic_block); +bool empty_block_p (basic_block); basic_block *blocks_in_phiopt_order (void); /* In tree-ssa-loop*.c */ diff --git a/gcc/tree-iterator.h b/gcc/tree-iterator.h index 5b8113a4560..98f0cf80c49 100644 --- a/gcc/tree-iterator.h +++ b/gcc/tree-iterator.h @@ -34,11 +34,6 @@ 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) { @@ -50,17 +45,6 @@ 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) { @@ -72,17 +56,6 @@ 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) { @@ -90,23 +63,11 @@ 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) { @@ -114,23 +75,11 @@ 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) { @@ -143,12 +92,6 @@ 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 --git a/gcc/tree-ssa-phiopt.c b/gcc/tree-ssa-phiopt.c index c3dcf33521f..d001a7a86bf 100644 --- a/gcc/tree-ssa-phiopt.c +++ b/gcc/tree-ssa-phiopt.c @@ -294,21 +294,23 @@ blocks_in_phiopt_order (void) #undef VISITED_P } + /* Return TRUE if block BB has no executable statements, otherwise return FALSE. */ + bool -empty_block_p (const_basic_block bb) +empty_block_p (basic_block bb) { - const_block_stmt_iterator bsi; + block_stmt_iterator bsi; /* BB must have no executable statements. */ - 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); + 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); - if (!cbsi_end_p (bsi)) + if (!bsi_end_p (bsi)) return false; return true; diff --git a/gcc/tree-ssa-threadupdate.c b/gcc/tree-ssa-threadupdate.c index d4d9ee53788..1d5500fe018 100644 --- a/gcc/tree-ssa-threadupdate.c +++ b/gcc/tree-ssa-threadupdate.c @@ -461,26 +461,26 @@ redirect_edges (void **slot, void *data) is one, this is equivalent to a "forwarder" block. */ static bool -redirection_block_p (const_basic_block bb) +redirection_block_p (basic_block bb) { - const_block_stmt_iterator bsi; + block_stmt_iterator bsi; /* Advance to the first executable statement. */ - 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); + 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); /* Check if this is an empty block. */ - if (cbsi_end_p (bsi)) + if (bsi_end_p (bsi)) return true; /* Test that we've reached the terminating control statement. */ - 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); + 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); } /* BB is a block which ends with a COND_EXPR or SWITCH_EXPR and when BB diff --git a/gcc/tree.c b/gcc/tree.c index 9e5a7bd9068..a3e5829b6d2 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -8635,10 +8635,10 @@ walk_tree_without_duplicates_1 (tree *tp, walk_tree_fn func, void *data, empty statements. */ bool -empty_body_p (const_tree stmt) +empty_body_p (tree stmt) { - const_tree_stmt_iterator i; - const_tree body; + tree_stmt_iterator i; + tree body; if (IS_EMPTY_STMT (stmt)) return true; @@ -8649,8 +8649,8 @@ empty_body_p (const_tree stmt) else return false; - for (i = ctsi_start (body); !ctsi_end_p (i); ctsi_next (&i)) - if (!empty_body_p (ctsi_stmt (i))) + for (i = tsi_start (body); !tsi_end_p (i); tsi_next (&i)) + if (!empty_body_p (tsi_stmt (i))) return false; return true; diff --git a/gcc/tree.h b/gcc/tree.h index 5a74cccebba..2d2d80aebff 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -4623,7 +4623,7 @@ extern bool commutative_tree_code (enum tree_code); extern tree upper_bound_in_type (tree, tree); extern tree lower_bound_in_type (tree, tree); extern int operand_equal_for_phi_arg_p (const_tree, const_tree); -extern bool empty_body_p (const_tree); +extern bool empty_body_p (tree); extern tree call_expr_arg (tree, int); extern tree *call_expr_argp (tree, int); extern tree call_expr_arglist (tree); -- 2.11.4.GIT