This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Natural loop detection
- To: Michael Hayes <m dot hayes at elec dot canterbury dot ac dot nz>
- Subject: Re: Natural loop detection
- From: Richard Henderson <rth at cygnus dot com>
- Date: Sun, 21 Nov 1999 00:57:27 -0800
- Cc: gcc-patches at gcc dot gnu dot org
- References: <14387.49331.113613.131101@ongaonga.elec.canterbury.ac.nz>
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~