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.
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));
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;
/* 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);
}
\f
/* Perform data flow analysis.
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));
(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);
});