From: Jan Hubicka Date: Wed, 15 Dec 1999 14:17:59 +0000 (+0100) Subject: flow.c (calculate_loop_depth): Make global, remove prototype, rewrite to use new... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=35836a43fa532226b937874c1289439565f0cb74;p=gcc.git 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ddd8eacf20c..9790ec615f8 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,11 @@ Wed Dec 15 15:05:30 MET 1999 Jan Hubicka + * 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 0d6bb891c19..606f2064c55 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 ce2e328db96..2af69da35a3 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 fbbbb648916..dbe2706bb85 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); });