From 4dc9341c04ba95ac73093573f645b49dcff494bf Mon Sep 17 00:00:00 2001 From: Michael Hayes Date: Tue, 30 Nov 1999 10:42:29 +0000 Subject: flow.c (flow_nodes_print, [...]): New functions. * flow.c (flow_nodes_print, flow_loops_cfg_dump): New functions. (flow_loop_nested_p, flow_loops_dump, flow_loops_free): Likewise. (flow_loop_exits_find, flow_loop_nodes_find): Likewise. (flow_depth_first_order_compute, flow_loop_pre_header_find): Likewise. (flow_loop_tree_node_add, flow_loops_tree_build): Likewise. (flow_loop_level_compute, low_loops_level_compute): Likewise. (flow_loops_find, flow_loop_outside_edge_p): Likewise. * basic-block.h: Protect from multiple inclusion. (flow_loops_find, flow_loops_free, flow_loop_dump): Add protoypes. (struct loops, struct loop): Define structures. * sbitmap.c (sbitmap_a_subset_b_p): New function. * sbitmap.h: Protect from multiple inclusion. (sbitmap_a_subset_b_p): Add prototype. * Makefile.in (LOOP_H): New macro. (stmt.o, integrate.o, loop.o, unroll.o): Replace loop.h with LOOP_H. From-SVN: r30720 --- gcc/basic-block.h | 90 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) (limited to 'gcc/basic-block.h') diff --git a/gcc/basic-block.h b/gcc/basic-block.h index 499f86e..ef7276e 100644 --- a/gcc/basic-block.h +++ b/gcc/basic-block.h @@ -18,6 +18,8 @@ along with GNU CC; see the file COPYING. If not, write to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#ifndef _BASIC_BLOCK_H +#define _BASIC_BLOCK_H 1 #include "bitmap.h" #include "sbitmap.h" @@ -222,6 +224,92 @@ extern void remove_fake_edges PROTO ((void)); extern void add_noreturn_fake_exit_edges PROTO ((void)); extern void flow_delete_insn_chain PROTO((rtx, rtx)); + +/* Structure to hold information for each natural loop. */ +struct loop +{ + int num; + + /* Basic block of loop header. */ + basic_block header; + + /* Basic block of loop latch. */ + basic_block latch; + + /* Basic block of loop pre-header or NULL if it does not exist. */ + basic_block pre_header; + + /* Bitmap of blocks contained within the loop. */ + sbitmap nodes; + + /* Number of blocks contained within the loop. */ + int num_nodes; + + /* Array of edges that exit the loop. */ + edge *exits; + + /* Number of edges that exit the loop. */ + int num_exits; + + /* The loop nesting depth. */ + int depth; + + /* The height of the loop (enclosed loop levels) within the loop + hierarchy tree. */ + int level; + + /* The outer (parent) loop or NULL if outermost loop. */ + struct loop *outer; + + /* The first inner (child) loop or NULL if innermost loop. */ + struct loop *inner; + + /* Link to the next (sibling) loop. */ + struct loop *next; + + /* Non-zero if the loop shares a header with another loop. */ + int shared; + + /* Non-zero if the loop is invalid (e.g., contains setjmp.). */ + int invalid; + + /* Auxiliary info specific to a pass. */ + void *info; +}; + + +/* Structure to hold CFG information about natural loops within a function. */ +struct loops +{ + /* Number of natural loops in the function. */ + int num; + + /* Array of natural loop descriptors (scanning this array in reverse order + will find the inner loops before their enclosing outer loops). */ + struct loop *array; + + /* Pointer to root of loop heirachy tree. */ + struct loop *tree; + + /* Information derived from the CFG. */ + struct cfg + { + /* The bitmap vector of dominators or NULL if not computed. */ + sbitmap *dom; + + /* The ordering of the basic blocks in a depth first search. */ + int *dfs_order; + } cfg; + + /* Headers shared by multiple loops that should be merged. */ + sbitmap shared_headers; +}; + +extern int flow_loops_find PROTO ((struct loops *)); +extern void flow_loops_free PROTO ((struct loops *)); +extern void flow_loops_dump PROTO ((const struct loops *, FILE *, int)); + + /* This structure maintains an edge list vector. */ struct edge_list { @@ -295,3 +383,5 @@ extern void compute_available PROTO ((sbitmap *, sbitmap *, /* In emit-rtl.c. */ extern rtx emit_block_insn_after PROTO((rtx, rtx, basic_block)); extern rtx emit_block_insn_before PROTO((rtx, rtx, basic_block)); + +#endif /* _BASIC_BLOCK_H */ -- cgit v1.1