aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJan Hubicka <hubicka@freesoft.cz>1999-12-15 15:17:59 +0100
committerJan Hubicka <hubicka@gcc.gnu.org>1999-12-15 14:17:59 +0000
commit35836a43fa532226b937874c1289439565f0cb74 (patch)
tree945b96b3dfced6c58fc828c818aca14d91a14035 /gcc
parentce4bbac71c009c87e902148838b7c4ef6f8be27b (diff)
downloadgcc-35836a43fa532226b937874c1289439565f0cb74.zip
gcc-35836a43fa532226b937874c1289439565f0cb74.tar.gz
gcc-35836a43fa532226b937874c1289439565f0cb74.tar.bz2
flow.c (calculate_loop_depth): Make global, remove prototype, rewrite to use new loop infrastructure.
* flow.c (calculate_loop_depth): Make global, remove prototype, rewrite to use new loop infrastructure. (find_basic_block): Remove calculate_loop_depth call. * toplev.c (rest_of_compilation): Call find_basic_block. * output.h (calculate_loop_depth): Declare. From-SVN: r30955
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/flow.c43
-rw-r--r--gcc/output.h1
-rw-r--r--gcc/toplev.c1
4 files changed, 17 insertions, 34 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index ddd8eac..9790ec6 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,11 @@
Wed Dec 15 15:05:30 MET 1999 Jan Hubicka <hubicka@freesoft.cz>
+ * flow.c (calculate_loop_depth): Make global, remove prototype,
+ rewrite to use new loop infrastructure.
+ (find_basic_block): Remove calculate_loop_depth call.
+ * toplev.c (rest_of_compilation): Call find_basic_block.
+ * output.h (calculate_loop_depth): Declare.
+
* flow.c (dump_flow_info): Dump loop_depth.
(flow_loops_nodes_find): Increase loop_depth for basic block in the
body.
diff --git a/gcc/flow.c b/gcc/flow.c
index 0d6bb89..606f206 100644
--- a/gcc/flow.c
+++ b/gcc/flow.c
@@ -314,7 +314,6 @@ static void merge_blocks_nomove PROTO((basic_block, basic_block));
static int merge_blocks PROTO((edge,basic_block,basic_block));
static void try_merge_blocks PROTO((void));
static void tidy_fallthru_edge PROTO((edge,basic_block,basic_block));
-static void calculate_loop_depth PROTO((rtx));
static int verify_wide_reg_1 PROTO((rtx *, void *));
static void verify_wide_reg PROTO((int, rtx, rtx));
@@ -434,10 +433,6 @@ find_basic_blocks (f, nregs, file, do_cleanup)
mark_critical_edges ();
- /* Discover the loop depth at the start of each basic block to aid
- register allocation. */
- calculate_loop_depth (f);
-
/* Kill the data we won't maintain. */
label_value_list = NULL_RTX;
@@ -2389,37 +2384,17 @@ tidy_fallthru_edge (e, b, c)
/* Discover and record the loop depth at the head of each basic block. */
-static void
-calculate_loop_depth (insns)
- rtx insns;
+void
+calculate_loop_depth (dump)
+ FILE *dump;
{
- basic_block bb;
- rtx insn;
- int i = 0, depth = 1;
+ struct loops loops;
- bb = BASIC_BLOCK (i);
- for (insn = insns; insn ; insn = NEXT_INSN (insn))
- {
- if (insn == bb->head)
- {
- bb->loop_depth = depth;
- if (++i >= n_basic_blocks)
- break;
- bb = BASIC_BLOCK (i);
- }
-
- if (GET_CODE (insn) == NOTE)
- {
- if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_LOOP_BEG)
- depth++;
- else if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_LOOP_END)
- depth--;
-
- /* If we have LOOP_DEPTH == 0, there has been a bookkeeping error. */
- if (depth == 0)
- abort ();
- }
- }
+ /* The loop infrastructure does the real job for us. */
+ flow_loops_find (&loops);
+ if (dump)
+ flow_loops_dump (&loops, dump, 0);
+ flow_loops_free (&loops);
}
/* Perform data flow analysis.
diff --git a/gcc/output.h b/gcc/output.h
index ce2e328..2af69da 100644
--- a/gcc/output.h
+++ b/gcc/output.h
@@ -132,6 +132,7 @@ extern int regno_uninitialized PROTO((int));
extern int regno_clobbered_at_setjmp PROTO((int));
extern void dump_flow_info PROTO((FILE *));
extern void find_basic_blocks PROTO((rtx, int, FILE *, int));
+extern void calculate_loop_depth PROTO((FILE *));
extern void free_basic_block_vars PROTO((int));
extern void set_block_num PROTO((rtx, int));
extern void life_analysis PROTO((rtx, int, FILE *, int));
diff --git a/gcc/toplev.c b/gcc/toplev.c
index fbbbb64..dbe2706 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -4060,6 +4060,7 @@ rest_of_compilation (decl)
(flow_time,
{
find_basic_blocks (insns, max_reg_num (), rtl_dump_file, 1);
+ calculate_loop_depth (rtl_dump_file);
life_analysis (insns, max_reg_num (), rtl_dump_file, 1);
});