Commit 4dc9341c by Michael Hayes Committed by Michael Hayes

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
parent edecd81f
1999-11-30 Michael Hayes <m.hayes@elec.canterbury.ac.nz>
* 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.
Tue Nov 30 01:34:47 1999 Philippe De Muyter <phdm@macqel.be> Tue Nov 30 01:34:47 1999 Philippe De Muyter <phdm@macqel.be>
* cppinit.c (CAT): The argument list of this macro may not contain * cppinit.c (CAT): The argument list of this macro may not contain
......
...@@ -748,6 +748,7 @@ DEMANGLE_H = $(srcdir)/../include/demangle.h ...@@ -748,6 +748,7 @@ DEMANGLE_H = $(srcdir)/../include/demangle.h
RECOG_H = recog.h RECOG_H = recog.h
EXPR_H = expr.h insn-codes.h EXPR_H = expr.h insn-codes.h
REGS_H = regs.h varray.h $(MACHMODE_H) REGS_H = regs.h varray.h $(MACHMODE_H)
LOOP_H = loop.h varray.h
# #
# Language makefile fragments. # Language makefile fragments.
...@@ -1484,7 +1485,7 @@ function.o : function.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h \ ...@@ -1484,7 +1485,7 @@ function.o : function.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h \
insn-config.h $(RECOG_H) output.h toplev.h except.h hash.h ggc.h insn-config.h $(RECOG_H) output.h toplev.h except.h hash.h ggc.h
stmt.o : stmt.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h function.h \ stmt.o : stmt.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h function.h \
insn-flags.h insn-config.h insn-codes.h hard-reg-set.h $(EXPR_H) except.h \ insn-flags.h insn-config.h insn-codes.h hard-reg-set.h $(EXPR_H) except.h \
loop.h $(RECOG_H) toplev.h output.h varray.h ggc.h $(LOOP_H) $(RECOG_H) toplev.h output.h varray.h ggc.h
except.o : except.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h \ except.o : except.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h \
function.h insn-flags.h $(EXPR_H) $(REGS_H) hard-reg-set.h \ function.h insn-flags.h $(EXPR_H) $(REGS_H) hard-reg-set.h \
insn-config.h $(RECOG_H) output.h except.h toplev.h intl.h ggc.h insn-config.h $(RECOG_H) output.h except.h toplev.h intl.h ggc.h
...@@ -1527,7 +1528,7 @@ emit-rtl.o : emit-rtl.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h \ ...@@ -1527,7 +1528,7 @@ emit-rtl.o : emit-rtl.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h \
real.o : real.c $(CONFIG_H) system.h $(TREE_H) toplev.h real.o : real.c $(CONFIG_H) system.h $(TREE_H) toplev.h
integrate.o : integrate.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h \ integrate.o : integrate.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h \
integrate.h insn-flags.h insn-config.h $(EXPR_H) real.h $(REGS_H) \ integrate.h insn-flags.h insn-config.h $(EXPR_H) real.h $(REGS_H) \
intl.h function.h output.h $(RECOG_H) except.h toplev.h loop.h intl.h function.h output.h $(RECOG_H) except.h toplev.h $(LOOP_H)
jump.o : jump.c $(CONFIG_H) system.h $(RTL_H) flags.h hard-reg-set.h $(REGS_H) \ jump.o : jump.c $(CONFIG_H) system.h $(RTL_H) flags.h hard-reg-set.h $(REGS_H) \
insn-config.h insn-flags.h $(RECOG_H) $(EXPR_H) real.h except.h function.h \ insn-config.h insn-flags.h $(RECOG_H) $(EXPR_H) real.h except.h function.h \
toplev.h insn-attr.h toplev.h insn-attr.h
...@@ -1550,11 +1551,11 @@ lcm.o : lcm.c $(CONFIG_H) system.h $(RTL_H) $(REGS_H) hard-reg-set.h flags.h \ ...@@ -1550,11 +1551,11 @@ lcm.o : lcm.c $(CONFIG_H) system.h $(RTL_H) $(REGS_H) hard-reg-set.h flags.h \
profile.o : profile.c $(CONFIG_H) system.h $(RTL_H) flags.h insn-flags.h \ profile.o : profile.c $(CONFIG_H) system.h $(RTL_H) flags.h insn-flags.h \
gcov-io.h $(TREE_H) output.h $(REGS_H) toplev.h function.h insn-config.h \ gcov-io.h $(TREE_H) output.h $(REGS_H) toplev.h function.h insn-config.h \
ggc.h ggc.h
loop.o : loop.c $(CONFIG_H) system.h $(RTL_H) flags.h loop.h insn-config.h \ loop.o : loop.c $(CONFIG_H) system.h $(RTL_H) flags.h $(LOOP_H) insn-config.h \
insn-flags.h $(REGS_H) hard-reg-set.h $(RECOG_H) $(EXPR_H) real.h \ insn-flags.h $(REGS_H) hard-reg-set.h $(RECOG_H) $(EXPR_H) real.h \
$(BASIC_BLOCK_H) function.h toplev.h varray.h except.h $(BASIC_BLOCK_H) function.h toplev.h varray.h except.h
unroll.o : unroll.c $(CONFIG_H) system.h $(RTL_H) insn-config.h function.h \ unroll.o : unroll.c $(CONFIG_H) system.h $(RTL_H) insn-config.h function.h \
integrate.h $(REGS_H) $(RECOG_H) flags.h $(EXPR_H) loop.h toplev.h varray.h integrate.h $(REGS_H) $(RECOG_H) flags.h $(EXPR_H) $(LOOP_H) toplev.h varray.h
flow.o : flow.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h insn-config.h \ flow.o : flow.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h insn-config.h \
$(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h output.h toplev.h $(RECOG_H) \ $(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h output.h toplev.h $(RECOG_H) \
insn-flags.h function.h except.h insn-flags.h function.h except.h
......
...@@ -18,6 +18,8 @@ along with GNU CC; see the file COPYING. If not, write to ...@@ -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, the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */ Boston, MA 02111-1307, USA. */
#ifndef _BASIC_BLOCK_H
#define _BASIC_BLOCK_H 1
#include "bitmap.h" #include "bitmap.h"
#include "sbitmap.h" #include "sbitmap.h"
...@@ -222,6 +224,92 @@ extern void remove_fake_edges PROTO ((void)); ...@@ -222,6 +224,92 @@ extern void remove_fake_edges PROTO ((void));
extern void add_noreturn_fake_exit_edges PROTO ((void)); extern void add_noreturn_fake_exit_edges PROTO ((void));
extern void flow_delete_insn_chain PROTO((rtx, rtx)); 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. */ /* This structure maintains an edge list vector. */
struct edge_list struct edge_list
{ {
...@@ -295,3 +383,5 @@ extern void compute_available PROTO ((sbitmap *, sbitmap *, ...@@ -295,3 +383,5 @@ extern void compute_available PROTO ((sbitmap *, sbitmap *,
/* In emit-rtl.c. */ /* In emit-rtl.c. */
extern rtx emit_block_insn_after PROTO((rtx, rtx, basic_block)); extern rtx emit_block_insn_after PROTO((rtx, rtx, basic_block));
extern rtx emit_block_insn_before PROTO((rtx, rtx, basic_block)); extern rtx emit_block_insn_before PROTO((rtx, rtx, basic_block));
#endif /* _BASIC_BLOCK_H */
...@@ -265,6 +265,25 @@ sbitmap_a_or_b (dst, a, b) ...@@ -265,6 +265,25 @@ sbitmap_a_or_b (dst, a, b)
} }
return changed; return changed;
} }
/* Return non-zero if A is a subset of B. */
int
sbitmap_a_subset_b_p (a, b)
sbitmap a, b;
{
int i;
sbitmap_ptr ap, bp;
ap = a->elms;
bp = b->elms;
for (i = 0; i < a->size; i++)
{
if ((*ap | *bp) != *bp)
return 0;
ap++; bp++;
}
return 1;
}
/* Set DST to be (A or (B and C)). /* Set DST to be (A or (B and C)).
Return non-zero if any change is made. */ Return non-zero if any change is made. */
......
...@@ -18,6 +18,9 @@ along with GNU CC; see the file COPYING. If not, write to ...@@ -18,6 +18,9 @@ along with GNU CC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330, the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */ Boston, MA 02111-1307, USA. */
#ifndef _SBITMAP_H
#define _SBITMAP_H 1
/* It's not clear yet whether using bitmap.[ch] will be a win. /* It's not clear yet whether using bitmap.[ch] will be a win.
It should be straightforward to convert so for now we keep things simple It should be straightforward to convert so for now we keep things simple
while more important issues are dealt with. */ while more important issues are dealt with. */
...@@ -109,6 +112,7 @@ extern int sbitmap_a_or_b_and_c PROTO ((sbitmap, sbitmap, sbitmap, sbitmap)); ...@@ -109,6 +112,7 @@ extern int sbitmap_a_or_b_and_c PROTO ((sbitmap, sbitmap, sbitmap, sbitmap));
extern int sbitmap_a_and_b_or_c PROTO ((sbitmap, sbitmap, sbitmap, sbitmap)); extern int sbitmap_a_and_b_or_c PROTO ((sbitmap, sbitmap, sbitmap, sbitmap));
extern int sbitmap_a_and_b PROTO ((sbitmap, sbitmap, sbitmap)); extern int sbitmap_a_and_b PROTO ((sbitmap, sbitmap, sbitmap));
extern int sbitmap_a_or_b PROTO ((sbitmap, sbitmap, sbitmap)); extern int sbitmap_a_or_b PROTO ((sbitmap, sbitmap, sbitmap));
extern int sbitmap_a_subset_b_p PROTO ((sbitmap, sbitmap));
struct int_list; struct int_list;
extern void sbitmap_intersect_of_predsucc PROTO ((sbitmap, sbitmap *, extern void sbitmap_intersect_of_predsucc PROTO ((sbitmap, sbitmap *,
...@@ -129,3 +133,4 @@ extern void sbitmap_intersection_of_preds PROTO ((sbitmap, sbitmap *, int)); ...@@ -129,3 +133,4 @@ extern void sbitmap_intersection_of_preds PROTO ((sbitmap, sbitmap *, int));
extern void sbitmap_union_of_succs PROTO ((sbitmap, sbitmap *, int)); extern void sbitmap_union_of_succs PROTO ((sbitmap, sbitmap *, int));
extern void sbitmap_union_of_preds PROTO ((sbitmap, sbitmap *, int)); extern void sbitmap_union_of_preds PROTO ((sbitmap, sbitmap *, int));
#endif /* _SBITMAP_H */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment