This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Natural loop detection


On Thu, Nov 18, 1999 at 10:04:03PM +1300, Michael Hayes wrote:
> 	* flow.c (flow_nodes_print, flow_loops_cfg_dump, flow_loop_nested_p,
> 		flow_loops_dump, flow_loops_free, flow_loop_exits_find, 
> 		flow_loop_nodes_find, flow_depth_first_order_compute, 
> 		flow_loop_pre_header_find, flow_loop_tree_node_add,
> 		flow_loops_tree_build, flow_loop_level_compute, 
> 		flow_loops_level_compute, flow_loops_find,
> 		flow_loop_outside_edge_p): New functions to find natural
> 		loops in the CFG and to build loop heirachy tree.

FWIW, I think it makes more sense for this code to live in
loop.c than flow.c.  I like the code quite a lot.  We've needed
this for a long time.

There are some minor changes that could be made to the
data structure though...

> + /* Structure to hold information for each natural loop.  */
> + struct loop
> + {
> +   /* Basic block number of loop header.  */
> +   int header;

I prefer using basic block pointers over indicies, even
if it does take up slightly more room on 64-bit hosts.

> +   /* Bitmap of blocks contained within the loop.  */
> +   sbitmap nodes;
> + 
> +   /* Bitmap of blocks that exit the loop.  */
> +   sbitmap exits;

We'd probably be better off with bitmaps over sbitmaps.
These are likely to be very sparse -- particularly `exits'.

Other comments?


r~


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]