[patch] Move predictions list out of basic block

Richard Guenther richard.guenther@gmail.com
Sun Apr 22 20:42:00 GMT 2007


On 4/22/07, Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz> wrote:
> Hello,
>
> > I wonder why we don't have a tree_bb_info struct like we have
> > rtl_bb_info - the phi_nodes pointer would fit there as well as
> > the stmt_list?
>
> here is the patch that implements the idea, bootstrapped & regtested on
> i686.  Memory-wise, it probably won't save much (as function bodies are
> stored in gimple), though.
>
> It would be possible to really save the two pointers by letting
> il.tree point to the list of stmts in block, and having phi nodes
> stored in TREE_CHAIN field of the list of statements.  It is a bit
> hacky idea, though.

   union basic_block_il_dependent {
+       /* In gimple, we store the list of statements of the block here.
+        TREE_CHAIN of this field contains the list of phi nodes of
+        the block.  */
+       struct tree_bb_info * GTY ((tag ("0"))) tree;

The comment matches this idea, not the implementation ;)

Otherwise this looks good.  Please give others 24 hours to comment.
You didn't say how you tested this patch?

Thanks,
Richard.

>
> > Also can we get at the loop_depth via loop_father?
>
> Not necessarily, loops are not present all the time.  However,
> loop_depth field is almost unused, so it should be possible to move it
> away from bb.
>
> > Also gcov count and frequency look like duplicated information.
>
> Execept for possible slowdowns, I think it would be possible to
> keep just counts (and remember the maximum count of a block in a
> function in cfun).  But I am sure Honza considered this and from
> some reason (maybe the slowdowns?) it is not possible?

Yeah, maybe it's not worth doing.

> Zdenek
>
>         * tree-phinodes.c (reserve_phi_args_for_new_edge, remove_phi_node):
>         Use phi_nodes_ptr.
>         (create_phi_node): Use set_phi_nodes.
>         * omp-low.c (expand_omp_parallel): Use bb_stmt_list.
>         * tree-if-conv.c (process_phi_nodes): Use set_phi_nodes.
>         (combine_blocks):  Use bb_stmt_list and set_bb_stmt_list.
>         * tree-flow-inline.h (phi_nodes, set_phi_nodes,
>         (bsi_start, bsi_last): Use bb_stmt_list.
>         (phi_nodes_ptr, bb_stmt_list, set_bb_stmt_list): New functions.
>         * cfgexpand.c (expand_gimple_basic_block): Use bb_stmt_list.
>         Traverse the statements using tsi iterator.
>         * basic-block.h (struct basic_block_def): Fields stmt_list
>         and phi_nodes moved to ...
>         (struct tree_bb_info): ... new structure.
>         * tree-cfg.c (create_bb): Allocate il.tree.  Use set_bb_stmt_list.
>         (tree_merge_blocks): Use bb_stmt_list and set_bb_stmt_list.
>         (remove_bb): Handle blocks with NULL stmt list.  Clear il.tree field.
>         (tree_verify_flow_info): Verify that il.tree is not set for
>         entry and exit block.
>         (tree_split_block): Use set_bb_stmt_list.
>



More information about the Gcc-patches mailing list