[tree-ssa] bsi_insert routines

Diego Novillo dnovillo@redhat.com
Sat Mar 15 16:35:00 GMT 2003


On Fri, 14 Mar 2003, Andrew Macleod wrote:

> Comments? OK to check in?
> 
Yup.  I've got a few questions questions below.

> PS. Did I mention how wrong I was when I thought insert_after
> would be easier than insert_before? so much for 'post' is
> always simpler than 'pre' :-)
> 
Heh :)  We really need to change the way we chain statements in
the IL.  Some of the contortions you go through to insert
instructions are really grotesque.  And we thought these changes
weren't going to be a big deal.  blah.

But in theory, when we finally redesign it, we wouldn't need to
change these interfaces, correct?


>   static basic_block make_bind_expr_blocks PARAMS ((tree *, tree, basic_block,
>   						  tree));
>   static inline void add_stmt_to_bb	PARAMS ((tree *, basic_block, tree));
> + static inline void append_stmt_to_bb	PARAMS ((tree *, basic_block, tree));
> + static inline void set_parent_stmt	PARAMS ((tree *, tree));
>   static basic_block create_bb		PARAMS ((void));
>   
Minor formatting nitpick.  Could you wrap these declarations to 80
columns?

> +    is now contained in a new node, so the head pointer must be updated in
> +    a that different block. If its the only statement in that block, then
>
s/its/it's/

> + void
> + bsi_insert_after (curr_bsi, t, mode)
> +      block_stmt_iterator *curr_bsi;
> +      tree t;
> +      enum bsi_iterator_update mode;
> [ ... ]
> +   /* Now update the required SSA bits.  */
> +   modify_stmt (inserted_stmt);
> +   get_stmt_operands (inserted_stmt);
> + 
Hmm, do we need to eagerly call get_stmt_operands here?  Wouldn't
it be better if we just mark the statement modified?  The next
pass that needs the operands will call get_stmt_operands.  I'm
thinking about inserting a chain of statements.  Or would this be
handled by the routines to insert statement lists?


> + void
> + bsi_insert_before (curr_bsi, t, mode)
> +      block_stmt_iterator *curr_bsi;
> +      tree t;
> +      enum bsi_iterator_update mode;
> [ ... ]
> + 
> +   /* Now update the required SSA bits.  */
> +   modify_stmt (inserted_stmt);
> +   get_stmt_operands (inserted_stmt);
> + 
Same here and in edge insertion.


Diego.



More information about the Gcc-patches mailing list