OSDN Git Service

* flow.c (calculate_loop_depth): Make global, remove prototype,
authorhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 15 Dec 1999 14:17:59 +0000 (14:17 +0000)
committerhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 15 Dec 1999 14:17:59 +0000 (14:17 +0000)
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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@30955 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/flow.c
gcc/output.h
gcc/toplev.c

index ddd8eac..9790ec6 100644 (file)
@@ -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.
index 0d6bb89..606f206 100644 (file)
@@ -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);
 }
 \f
 /* Perform data flow analysis.
index ce2e328..2af69da 100644 (file)
@@ -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));
index fbbbb64..dbe2706 100644 (file)
@@ -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);
         });