This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [tree-ssa] gsi_iterator rework
- From: Diego Novillo <dnovillo at redhat dot com>
- To: Andrew MacLeod <amacleod at redhat dot com>
- Cc: gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 2 Dec 2002 11:36:25 -0500
- Subject: Re: [tree-ssa] gsi_iterator rework
- Organization: Red Hat Canada
- References: <1038842071.15915.518.camel@p4>
On Mon, 02 Dec 2002, Andrew Macleod wrote:
> * gimplify.c (simplify_cleanup_point_expr): gsi_stmt can return NULL,
> use gsi_end.
> * tree-cfg.c (make_blocks): Use gsi_end, gsi_stmt can return NULL. Set
> basic_block for empty_stmt_node containers.
> (make_edges): Stmt's can be NULL.
> (make_ctrl_stmt_edges, make_exit_edges, make_loop_expr_edges,
> make_cond_expr_edges, make_goto_expr_edges, is_nonlocal_label_block,
> block_invalidates_loop, cleanup_control_flow, cleanup_cond_expr_graph,
> cleanup_switch_expr_graph, disconnect_unreachable_case_labels,
> find_taken_edge, tree_cfg2dot, successor_block, is_latch_block,
> switch_parent, first_stmt, last_stmt): Check for first_stmt() or
> last_stmt() returning NULL.
> (remove_tree_bb, first_exec_stmt): Use gsi_end.
> (last_stmt_ptr): Iterate to find last execuatbel stmt_ptr in a block.
> (gsi_start_bb): Return first non-empty stmt, if there is one.
> (set_bb_for_stmt): Don't decend into an empty_stmt_node.
> * tree-dfa.c (find_tree_refs): Use gsi_end.
> (collect_dfa_stats): Use gsi_end_bb.
> * tree-flow-inline.h (gsi_step_bb): split.
> (gsi_step_in_bb): gsi_step with explicit bb specified. Never return
> empty_stmt_node.
> (gsi_start_bb): Move to tree-cfg.c.
> (gsi_end_bb): New. Have we reached the end of a basic block.
> * tree-flow.h (gsi_start_bb): Make external.
> (gsi_end_bb, gsi_step_in_bb): New prototypes.
> * tree-simple.h (gsi_end): renamed from gsi_after_end.
> (gsi_stmt): Return NULL if stmt is an empty_stmt_node or error mark.
> * tree-ssa-ccp.c (simulate_block, substitute_and_fold): Use gsi_end.
> * tree-ssa-dce.c (mark_control_parent_necessary, find_useful_stmts,
> remove_dead_stmts): Use gsi_end_bb.
> (process_worklist): Check for NULL last_stmt.
> * tree-ssa-pre.c (finalize_1): Use gsi_end_bb, gsi_stmt can be NULL.
>
Looks OK. Thanks. A few notes below.
>
> ! /* Finally, if no edges were created above, this is a regular
> ! basic block that only needs a fallthru edge. */
> ! }
> if (bb->succ == NULL)
> make_edge (bb, successor_block (bb), EDGE_FALLTHRU);
> }
>
This comment should be moved outside the braces. It applies to
the 'if (bb->succ...)' statement.
> {
> enum tree_code head_code, end_code;
> const char *head_name, *end_name;
> ! int head_line = 0;
> ! int end_line = 0;
>
Nitpick. We render unknown line numbers as -1.
> last_stmt_ptr (bb)
> basic_block bb;
> {
> ! gimple_stmt_iterator i, last;
> !
> ! /* FIXME. Do we still Need this routine once we supply an insert? */
> ! abort();
>
Better not put this abort(). tree-ssa-pre.c still uses this
function. Once we create gsi_insert_* we can remove it.
Diego.