OSDN Git Service

* haifa-sched.c (sched_scan_info): Remove.
authorbernds <bernds@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 27 May 2011 10:47:48 +0000 (10:47 +0000)
committerbernds <bernds@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 27 May 2011 10:47:48 +0000 (10:47 +0000)
(schedule_block): Call sched_extend_luids rather than sched_init_luids
with NULL args.
(extend_bb, init_bb, extend_insn, init_insn, init_insns_in_bb):
Remove functions.
(sched_scan): Remove.
(sched_extend_luids): Renamed from luids_extend_insn and no longer
static.  All callers changed.
(sched_init_insn_luid): Renamed from luids_init_insn and no longer
static.  All callers changed.
(sched_init_luids): Remove all arguments except the first.  All
callers changed.  Don't use sched_scan.
(haifa_init_h_i_d): Likewise.
(haifa_init_insn): Call sched_extend_luids and sched_init_insn_luid
manually rather than using sched_init_luids.  Likewise with
extend_h_i_d, init_h_i_d and haifa_init_h_i_d.
* sel-sched.c (sel_region_target_finish): Call sched_extend_luids
rather than sched_init_luids with NULL args.
* sel-sched-ir.c (new_insns): Remove variable.
(sched_scan): New static function, previously in haifa-sched.c.  Remove
all arguments but the first two; all callers changed.
(sel_init_new_insn): Call sched_extend_luids and sched_init_insn_luid
rather than sched_init_luids.
(sel_init_bbs): Remove second argument.  All callers changed.
(sel_add_bb): Call sched_extend_luids rather than sched_init_luids
with NULL arguments.
(create_insn_rtx_from_pattern): Likewise.
* sel-sched-ir.h (sel_init_bbs): Adjust declaration.
* sched-int.h (sched_init_luids, haifa_init_h_i_d): Likewise.
(sched_init_insn_luid, sched_extend_luids): Declare.
(sched_scan_info_def, sched_scan_info, sched_scan): Remove
declarations.

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

gcc/ChangeLog
gcc/haifa-sched.c
gcc/sched-int.h
gcc/sel-sched-ir.c
gcc/sel-sched-ir.h
gcc/sel-sched.c

index 1415134..9574435 100644 (file)
@@ -1,3 +1,38 @@
+2011-05-27  Bernd Schmidt  <bernds@codesourcery.com>
+
+       * haifa-sched.c (sched_scan_info): Remove.
+       (schedule_block): Call sched_extend_luids rather than sched_init_luids
+       with NULL args.
+       (extend_bb, init_bb, extend_insn, init_insn, init_insns_in_bb):
+       Remove functions.
+       (sched_scan): Remove.
+       (sched_extend_luids): Renamed from luids_extend_insn and no longer
+       static.  All callers changed.
+       (sched_init_insn_luid): Renamed from luids_init_insn and no longer
+       static.  All callers changed.
+       (sched_init_luids): Remove all arguments except the first.  All
+       callers changed.  Don't use sched_scan.
+       (haifa_init_h_i_d): Likewise.
+       (haifa_init_insn): Call sched_extend_luids and sched_init_insn_luid
+       manually rather than using sched_init_luids.  Likewise with
+       extend_h_i_d, init_h_i_d and haifa_init_h_i_d.
+       * sel-sched.c (sel_region_target_finish): Call sched_extend_luids
+       rather than sched_init_luids with NULL args.
+       * sel-sched-ir.c (new_insns): Remove variable.
+       (sched_scan): New static function, previously in haifa-sched.c.  Remove
+       all arguments but the first two; all callers changed.
+       (sel_init_new_insn): Call sched_extend_luids and sched_init_insn_luid
+       rather than sched_init_luids.
+       (sel_init_bbs): Remove second argument.  All callers changed.
+       (sel_add_bb): Call sched_extend_luids rather than sched_init_luids
+       with NULL arguments.
+       (create_insn_rtx_from_pattern): Likewise.
+       * sel-sched-ir.h (sel_init_bbs): Adjust declaration.
+       * sched-int.h (sched_init_luids, haifa_init_h_i_d): Likewise.
+       (sched_init_insn_luid, sched_extend_luids): Declare.
+       (sched_scan_info_def, sched_scan_info, sched_scan): Remove
+       declarations.
+
 2011-05-27  Richard Guenther  <rguenther@suse.de>
 
        PR middle-end/49177
 2011-05-27  Richard Guenther  <rguenther@suse.de>
 
        PR middle-end/49177
index 6b949b4..0cb3290 100644 (file)
@@ -332,8 +332,6 @@ const struct common_sched_info_def haifa_common_sched_info =
     SCHED_PASS_UNKNOWN /* sched_pass_id */
   };
 
     SCHED_PASS_UNKNOWN /* sched_pass_id */
   };
 
-const struct sched_scan_info_def *sched_scan_info;
-
 /* Mapping from instruction UID to its Logical UID.  */
 VEC (int, heap) *sched_luids = NULL;
 
 /* Mapping from instruction UID to its Logical UID.  */
 VEC (int, heap) *sched_luids = NULL;
 
@@ -3336,7 +3334,7 @@ schedule_block (basic_block *target_bb)
         in its md_finish () hook.  These new insns don't have any data
         initialized and to identify them we extend h_i_d so that they'll
         get zero luids.  */
         in its md_finish () hook.  These new insns don't have any data
         initialized and to identify them we extend h_i_d so that they'll
         get zero luids.  */
-      sched_init_luids (NULL, NULL, NULL, NULL);
+      sched_extend_luids ();
     }
 
   if (sched_verbose)
     }
 
   if (sched_verbose)
@@ -3544,10 +3542,10 @@ haifa_sched_init (void)
 
     FOR_EACH_BB (bb)
       VEC_quick_push (basic_block, bbs, bb);
 
     FOR_EACH_BB (bb)
       VEC_quick_push (basic_block, bbs, bb);
-    sched_init_luids (bbs, NULL, NULL, NULL);
+    sched_init_luids (bbs);
     sched_deps_init (true);
     sched_extend_target ();
     sched_deps_init (true);
     sched_extend_target ();
-    haifa_init_h_i_d (bbs, NULL, NULL, NULL);
+    haifa_init_h_i_d (bbs);
 
     VEC_free (basic_block, heap, bbs);
   }
 
     VEC_free (basic_block, heap, bbs);
   }
@@ -5335,105 +5333,9 @@ check_cfg (rtx head, rtx tail)
 
 #endif /* ENABLE_CHECKING */
 
 
 #endif /* ENABLE_CHECKING */
 
-/* Extend per basic block data structures.  */
-static void
-extend_bb (void)
-{
-  if (sched_scan_info->extend_bb)
-    sched_scan_info->extend_bb ();
-}
-
-/* Init data for BB.  */
-static void
-init_bb (basic_block bb)
-{
-  if (sched_scan_info->init_bb)
-    sched_scan_info->init_bb (bb);
-}
-
-/* Extend per insn data structures.  */
-static void
-extend_insn (void)
-{
-  if (sched_scan_info->extend_insn)
-    sched_scan_info->extend_insn ();
-}
-
-/* Init data structures for INSN.  */
-static void
-init_insn (rtx insn)
-{
-  if (sched_scan_info->init_insn)
-    sched_scan_info->init_insn (insn);
-}
-
-/* Init all insns in BB.  */
-static void
-init_insns_in_bb (basic_block bb)
-{
-  rtx insn;
-
-  FOR_BB_INSNS (bb, insn)
-    init_insn (insn);
-}
-
-/* A driver function to add a set of basic blocks (BBS),
-   a single basic block (BB), a set of insns (INSNS) or a single insn (INSN)
-   to the scheduling region.  */
-void
-sched_scan (const struct sched_scan_info_def *ssi,
-           bb_vec_t bbs, basic_block bb, insn_vec_t insns, rtx insn)
-{
-  sched_scan_info = ssi;
-
-  if (bbs != NULL || bb != NULL)
-    {
-      extend_bb ();
-
-      if (bbs != NULL)
-       {
-         unsigned i;
-         basic_block x;
-
-         FOR_EACH_VEC_ELT (basic_block, bbs, i, x)
-           init_bb (x);
-       }
-
-      if (bb != NULL)
-       init_bb (bb);
-    }
-
-  extend_insn ();
-
-  if (bbs != NULL)
-    {
-      unsigned i;
-      basic_block x;
-
-      FOR_EACH_VEC_ELT (basic_block, bbs, i, x)
-       init_insns_in_bb (x);
-    }
-
-  if (bb != NULL)
-    init_insns_in_bb (bb);
-
-  if (insns != NULL)
-    {
-      unsigned i;
-      rtx x;
-
-      FOR_EACH_VEC_ELT (rtx, insns, i, x)
-       init_insn (x);
-    }
-
-  if (insn != NULL)
-    init_insn (insn);
-}
-
-
 /* Extend data structures for logical insn UID.  */
 /* Extend data structures for logical insn UID.  */
-static void
-luids_extend_insn (void)
+void
+sched_extend_luids (void)
 {
   int new_luids_max_uid = get_max_uid () + 1;
 
 {
   int new_luids_max_uid = get_max_uid () + 1;
 
@@ -5441,8 +5343,8 @@ luids_extend_insn (void)
 }
 
 /* Initialize LUID for INSN.  */
 }
 
 /* Initialize LUID for INSN.  */
-static void
-luids_init_insn (rtx insn)
+void
+sched_init_insn_luid (rtx insn)
 {
   int i = INSN_P (insn) ? 1 : common_sched_info->luid_for_non_insn (insn);
   int luid;
 {
   int i = INSN_P (insn) ? 1 : common_sched_info->luid_for_non_insn (insn);
   int luid;
@@ -5458,21 +5360,23 @@ luids_init_insn (rtx insn)
   SET_INSN_LUID (insn, luid);
 }
 
   SET_INSN_LUID (insn, luid);
 }
 
-/* Initialize luids for BBS, BB, INSNS and INSN.
+/* Initialize luids for BBS.
    The hook common_sched_info->luid_for_non_insn () is used to determine
    if notes, labels, etc. need luids.  */
 void
    The hook common_sched_info->luid_for_non_insn () is used to determine
    if notes, labels, etc. need luids.  */
 void
-sched_init_luids (bb_vec_t bbs, basic_block bb, insn_vec_t insns, rtx insn)
+sched_init_luids (bb_vec_t bbs)
 {
 {
-  const struct sched_scan_info_def ssi =
+  int i;
+  basic_block bb;
+
+  sched_extend_luids ();
+  FOR_EACH_VEC_ELT (basic_block, bbs, i, bb)
     {
     {
-      NULL, /* extend_bb */
-      NULL, /* init_bb */
-      luids_extend_insn, /* extend_insn */
-      luids_init_insn /* init_insn */
-    };
+      rtx insn;
 
 
-  sched_scan (&ssi, bbs, bb, insns, insn);
+      FOR_BB_INSNS (bb, insn)
+       sched_init_insn_luid (insn);
+    }
 }
 
 /* Free LUIDs.  */
 }
 
 /* Free LUIDs.  */
@@ -5529,19 +5433,21 @@ init_h_i_d (rtx insn)
     }
 }
 
     }
 }
 
-/* Initialize haifa_insn_data for BBS, BB, INSNS and INSN.  */
+/* Initialize haifa_insn_data for BBS.  */
 void
 void
-haifa_init_h_i_d (bb_vec_t bbs, basic_block bb, insn_vec_t insns, rtx insn)
+haifa_init_h_i_d (bb_vec_t bbs)
 {
 {
-  const struct sched_scan_info_def ssi =
+  int i;
+  basic_block bb;
+
+  extend_h_i_d ();
+  FOR_EACH_VEC_ELT (basic_block, bbs, i, bb)
     {
     {
-      NULL, /* extend_bb */
-      NULL, /* init_bb */
-      extend_h_i_d, /* extend_insn */
-      init_h_i_d /* init_insn */
-    };
+      rtx insn;
 
 
-  sched_scan (&ssi, bbs, bb, insns, insn);
+      FOR_BB_INSNS (bb, insn)
+       init_h_i_d (insn);
+    }
 }
 
 /* Finalize haifa_insn_data.  */
 }
 
 /* Finalize haifa_insn_data.  */
@@ -5570,10 +5476,12 @@ haifa_init_insn (rtx insn)
 {
   gcc_assert (insn != NULL);
 
 {
   gcc_assert (insn != NULL);
 
-  sched_init_luids (NULL, NULL, NULL, insn);
+  sched_extend_luids ();
+  sched_init_insn_luid (insn);
   sched_extend_target ();
   sched_deps_init (false);
   sched_extend_target ();
   sched_deps_init (false);
-  haifa_init_h_i_d (NULL, NULL, NULL, insn);
+  extend_h_i_d ();
+  init_h_i_d (insn);
 
   if (adding_bb_to_current_region_p)
     {
 
   if (adding_bb_to_current_region_p)
     {
index d5c9509..a18f846 100644 (file)
@@ -39,42 +39,18 @@ enum sched_pass_id_t { SCHED_PASS_UNKNOWN, SCHED_RGN_PASS, SCHED_EBB_PASS,
 
 typedef VEC (basic_block, heap) *bb_vec_t;
 typedef VEC (rtx, heap) *insn_vec_t;
 
 typedef VEC (basic_block, heap) *bb_vec_t;
 typedef VEC (rtx, heap) *insn_vec_t;
-typedef VEC(rtx, heap) *rtx_vec_t;
-
-struct sched_scan_info_def
-{
-  /* This hook notifies scheduler frontend to extend its internal per basic
-     block data structures.  This hook should be called once before a series of
-     calls to bb_init ().  */
-  void (*extend_bb) (void);
-
-  /* This hook makes scheduler frontend to initialize its internal data
-     structures for the passed basic block.  */
-  void (*init_bb) (basic_block);
-
-  /* This hook notifies scheduler frontend to extend its internal per insn data
-     structures.  This hook should be called once before a series of calls to
-     insn_init ().  */
-  void (*extend_insn) (void);
-
-  /* This hook makes scheduler frontend to initialize its internal data
-     structures for the passed insn.  */
-  void (*init_insn) (rtx);
-};
-
-extern const struct sched_scan_info_def *sched_scan_info;
-
-extern void sched_scan (const struct sched_scan_info_def *,
-                       bb_vec_t, basic_block, insn_vec_t, rtx);
+typedef VEC (rtx, heap) *rtx_vec_t;
 
 extern void sched_init_bbs (void);
 
 
 extern void sched_init_bbs (void);
 
-extern void sched_init_luids (bb_vec_t, basic_block, insn_vec_t, rtx);
+extern void sched_extend_luids (void);
+extern void sched_init_insn_luid (rtx);
+extern void sched_init_luids (bb_vec_t);
 extern void sched_finish_luids (void);
 
 extern void sched_extend_target (void);
 
 extern void sched_finish_luids (void);
 
 extern void sched_extend_target (void);
 
-extern void haifa_init_h_i_d (bb_vec_t, basic_block, insn_vec_t, rtx);
+extern void haifa_init_h_i_d (bb_vec_t);
 extern void haifa_finish_h_i_d (void);
 
 /* Hooks that are common to all the schedulers.  */
 extern void haifa_finish_h_i_d (void);
 
 /* Hooks that are common to all the schedulers.  */
index a12617c..de7629a 100644 (file)
@@ -2720,6 +2720,54 @@ deps_init_id (idata_t id, insn_t insn, bool force_unique_p)
 }
 
 \f
 }
 
 \f
+struct sched_scan_info_def
+{
+  /* This hook notifies scheduler frontend to extend its internal per basic
+     block data structures.  This hook should be called once before a series of
+     calls to bb_init ().  */
+  void (*extend_bb) (void);
+
+  /* This hook makes scheduler frontend to initialize its internal data
+     structures for the passed basic block.  */
+  void (*init_bb) (basic_block);
+
+  /* This hook notifies scheduler frontend to extend its internal per insn data
+     structures.  This hook should be called once before a series of calls to
+     insn_init ().  */
+  void (*extend_insn) (void);
+
+  /* This hook makes scheduler frontend to initialize its internal data
+     structures for the passed insn.  */
+  void (*init_insn) (rtx);
+};
+
+/* A driver function to add a set of basic blocks (BBS) to the
+   scheduling region.  */
+static void
+sched_scan (const struct sched_scan_info_def *ssi, bb_vec_t bbs)
+{
+  unsigned i;
+  basic_block bb;
+
+  if (ssi->extend_bb)
+    ssi->extend_bb ();
+
+  if (ssi->init_bb)
+    FOR_EACH_VEC_ELT (basic_block, bbs, i, bb)
+      ssi->init_bb (bb);
+
+  if (ssi->extend_insn)
+    ssi->extend_insn ();
+
+  if (ssi->init_insn)
+    FOR_EACH_VEC_ELT (basic_block, bbs, i, bb)
+      {
+       rtx insn;
+
+       FOR_BB_INSNS (bb, insn)
+         ssi->init_insn (insn);
+      }
+}
 
 /* Implement hooks for collecting fundamental insn properties like if insn is
    an ASM or is within a SCHED_GROUP.  */
 
 /* Implement hooks for collecting fundamental insn properties like if insn is
    an ASM or is within a SCHED_GROUP.  */
@@ -2944,7 +2992,7 @@ sel_init_global_and_expr (bb_vec_t bbs)
       init_global_and_expr_for_insn /* init_insn */
     };
 
       init_global_and_expr_for_insn /* init_insn */
     };
 
-  sched_scan (&ssi, bbs, NULL, NULL, NULL);
+  sched_scan (&ssi, bbs);
 }
 
 /* Finalize region-scope data structures for basic blocks.  */
 }
 
 /* Finalize region-scope data structures for basic blocks.  */
@@ -3001,7 +3049,7 @@ sel_finish_global_and_expr (void)
          finish_global_and_expr_insn /* init_insn */
        };
 
          finish_global_and_expr_insn /* init_insn */
        };
 
-      sched_scan (&ssi, bbs, NULL, NULL, NULL);
+      sched_scan (&ssi, bbs);
     }
 
     VEC_free (basic_block, heap, bbs);
     }
 
     VEC_free (basic_block, heap, bbs);
@@ -3990,9 +4038,6 @@ finish_region_bb_info (void)
 /* Data for each insn in current region.  */
 VEC (sel_insn_data_def, heap) *s_i_d = NULL;
 
 /* Data for each insn in current region.  */
 VEC (sel_insn_data_def, heap) *s_i_d = NULL;
 
-/* A vector for the insns we've emitted.  */
-static insn_vec_t new_insns = NULL;
-
 /* Extend data structures for insns from current region.  */
 static void
 extend_insn_data (void)
 /* Extend data structures for insns from current region.  */
 static void
 extend_insn_data (void)
@@ -4131,7 +4176,10 @@ sel_init_new_insn (insn_t insn, int flags)
     }
 
   if (flags & INSN_INIT_TODO_LUID)
     }
 
   if (flags & INSN_INIT_TODO_LUID)
-    sched_init_luids (NULL, NULL, NULL, insn);
+    {
+      sched_extend_luids ();
+      sched_init_insn_luid (insn);
+    }
 
   if (flags & INSN_INIT_TODO_SSID)
     {
 
   if (flags & INSN_INIT_TODO_SSID)
     {
@@ -4473,7 +4521,7 @@ init_bb (basic_block bb)
 }
 
 void
 }
 
 void
-sel_init_bbs (bb_vec_t bbs, basic_block bb)
+sel_init_bbs (bb_vec_t bbs)
 {
   const struct sched_scan_info_def ssi =
     {
 {
   const struct sched_scan_info_def ssi =
     {
@@ -4483,7 +4531,7 @@ sel_init_bbs (bb_vec_t bbs, basic_block bb)
       NULL /* init_insn */
     };
 
       NULL /* init_insn */
     };
 
-  sched_scan (&ssi, bbs, bb, new_insns, NULL);
+  sched_scan (&ssi, bbs);
 }
 
 /* Restore notes for the whole region.  */
 }
 
 /* Restore notes for the whole region.  */
@@ -5040,9 +5088,9 @@ static void
 sel_add_bb (basic_block bb)
 {
   /* Extend luids so that new notes will receive zero luids.  */
 sel_add_bb (basic_block bb)
 {
   /* Extend luids so that new notes will receive zero luids.  */
-  sched_init_luids (NULL, NULL, NULL, NULL);
+  sched_extend_luids ();
   sched_init_bbs ();
   sched_init_bbs ();
-  sel_init_bbs (last_added_blocks, NULL);
+  sel_init_bbs (last_added_blocks);
 
   /* When bb is passed explicitly, the vector should contain
      the only element that equals to bb; otherwise, the vector
 
   /* When bb is passed explicitly, the vector should contain
      the only element that equals to bb; otherwise, the vector
@@ -5583,7 +5631,7 @@ create_insn_rtx_from_pattern (rtx pattern, rtx label)
 
   end_sequence ();
 
 
   end_sequence ();
 
-  sched_init_luids (NULL, NULL, NULL, NULL);
+  sched_extend_luids ();
   sched_extend_target ();
   sched_deps_init (false);
 
   sched_extend_target ();
   sched_deps_init (false);
 
index b0c52eb..838c0d1 100644 (file)
@@ -1602,7 +1602,7 @@ extern bool sel_bb_empty_p (basic_block);
 extern bool in_current_region_p (basic_block);
 extern basic_block fallthru_bb_of_jump (rtx);
 
 extern bool in_current_region_p (basic_block);
 extern basic_block fallthru_bb_of_jump (rtx);
 
-extern void sel_init_bbs (bb_vec_t, basic_block);
+extern void sel_init_bbs (bb_vec_t);
 extern void sel_finish_bbs (void);
 
 extern struct succs_info * compute_succs_info (insn_t, short);
 extern void sel_finish_bbs (void);
 
 extern struct succs_info * compute_succs_info (insn_t, short);
index b176dea..3f22a3c 100644 (file)
@@ -6868,7 +6868,7 @@ sel_region_init (int rgn)
   for (i = 0; i < current_nr_blocks; i++)
     VEC_quick_push (basic_block, bbs, BASIC_BLOCK (BB_TO_BLOCK (i)));
 
   for (i = 0; i < current_nr_blocks; i++)
     VEC_quick_push (basic_block, bbs, BASIC_BLOCK (BB_TO_BLOCK (i)));
 
-  sel_init_bbs (bbs, NULL);
+  sel_init_bbs (bbs);
 
   if (flag_sel_sched_pipelining)
     setup_current_loop_nest (rgn, &bbs);
 
   if (flag_sel_sched_pipelining)
     setup_current_loop_nest (rgn, &bbs);
@@ -6877,13 +6877,13 @@ sel_region_init (int rgn)
 
   /* Initialize luids and dependence analysis which both sel-sched and haifa
      need.  */
 
   /* Initialize luids and dependence analysis which both sel-sched and haifa
      need.  */
-  sched_init_luids (bbs, NULL, NULL, NULL);
+  sched_init_luids (bbs);
   sched_deps_init (false);
 
   /* Initialize haifa data.  */
   rgn_setup_sched_infos ();
   sel_set_sched_flags ();
   sched_deps_init (false);
 
   /* Initialize haifa data.  */
   rgn_setup_sched_infos ();
   sel_set_sched_flags ();
-  haifa_init_h_i_d (bbs, NULL, NULL, NULL);
+  haifa_init_h_i_d (bbs);
 
   sel_compute_priorities (rgn);
   init_deps_global ();
 
   sel_compute_priorities (rgn);
   init_deps_global ();
@@ -7215,7 +7215,7 @@ sel_region_target_finish (bool reset_sched_cycles_p)
 
          /* Extend luids so that insns generated by the target will
             get zero luid.  */
 
          /* Extend luids so that insns generated by the target will
             get zero luid.  */
-         sched_init_luids (NULL, NULL, NULL, NULL);
+         sched_extend_luids ();
        }
     }
 
        }
     }