This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 175/236] Remove DEP_PRO/CON scaffolding


gcc/
	* sched-int.h (struct _dep): Strengthen fields "pro" and "con"
	from rtx to rtx_insn *.
	(DEP_PRO): Delete this function and...
	(SET_DEP_PRO): ...this function in favor of...
	(DEP_PRO): ...reinstate this macro.
	(DEP_CON): Delete this function and...
	(SET_DEP_CON): ...this function in favor of...
	(DEP_CON): ...reinstate this old macro.
	(init_dep_1): Strengthen params 2 and 3 from rtx to rtx_insn *.
	(init_dep): Likewise.
	(set_priorities): Likewise for both params.
	(sd_copy_back_deps): Likewise for params 1 and 2.

	* haifa-sched.c (priority): Likewise for param "insn" and local
	"next".
	(set_priorities): Likewise for params "head" and "tail" and local
	"insn".
	(process_insn_forw_deps_be_in_spec): Likewise for param "twin" and
	local "consumer".
	(add_to_speculative_block): Add a checked cast.
	(create_check_block_twin): Drop use of SET_DEP_CON.
	(add_jump_dependencies): Strengthen params "insn" and "jump" from
	rtx to rtx_insn *.

	* sched-deps.c (init_dep_1): Likewise for params "pro" and "con".
	Drop use of SET_DEP_PRO
	(init_dep): Strengthen params "pro" and "con" from rtx to
	rtx_insn *.
	(sd_copy_back_deps): Likewise for params "to" and "from".  Drop
	use of SET_DEP_CON.
	(DEP_PRO): Delete.
	(DEP_CON): Delete.
	(SET_DEP_PRO): Delete.
	(SET_DEP_CON): Delete.

/
	* rtx-classes-status.txt: SET_DEP_PRO and SET_DEP_CON are done.
---
 gcc/haifa-sched.c      | 24 ++++++++++++------------
 gcc/sched-deps.c       | 32 ++++++--------------------------
 gcc/sched-int.h        | 18 ++++++++----------
 rtx-classes-status.txt |  1 -
 4 files changed, 26 insertions(+), 49 deletions(-)

diff --git a/gcc/haifa-sched.c b/gcc/haifa-sched.c
index 28b99de..a27e404 100644
--- a/gcc/haifa-sched.c
+++ b/gcc/haifa-sched.c
@@ -826,7 +826,7 @@ add_delay_dependencies (rtx_insn *insn)
 
 /* Forward declarations.  */
 
-static int priority (rtx);
+static int priority (rtx_insn *);
 static int rank_for_schedule (const void *, const void *);
 static void swap_sort (rtx_insn **, int);
 static void queue_insn (rtx_insn *, int, const char *);
@@ -875,7 +875,7 @@ static void extend_h_i_d (void);
 static void init_h_i_d (rtx);
 static int haifa_speculate_insn (rtx, ds_t, rtx *);
 static void generate_recovery_code (rtx_insn *);
-static void process_insn_forw_deps_be_in_spec (rtx, rtx, ds_t);
+static void process_insn_forw_deps_be_in_spec (rtx, rtx_insn *, ds_t);
 static void begin_speculative_block (rtx_insn *);
 static void add_to_speculative_block (rtx_insn *);
 static void init_before_recovery (basic_block *);
@@ -890,7 +890,7 @@ static void move_succs (vec<edge, va_gc> **, basic_block);
 static void sched_remove_insn (rtx_insn *);
 static void clear_priorities (rtx_insn *, rtx_vec_t *);
 static void calc_priorities (rtx_vec_t);
-static void add_jump_dependencies (rtx, rtx);
+static void add_jump_dependencies (rtx_insn *, rtx_insn *);
 
 #endif /* INSN_SCHEDULING */
 
@@ -1582,7 +1582,7 @@ dep_list_size (rtx insn, sd_list_types_def list)
 
 /* Compute the priority number for INSN.  */
 static int
-priority (rtx insn)
+priority (rtx_insn *insn)
 {
   if (! INSN_P (insn))
     return 0;
@@ -1631,7 +1631,7 @@ priority (rtx insn)
 
 	      FOR_EACH_DEP (twin, SD_LIST_FORW, sd_it, dep)
 		{
-		  rtx next;
+		  rtx_insn *next;
 		  int next_priority;
 
 		  next = DEP_CON (dep);
@@ -6561,9 +6561,9 @@ schedule_block (basic_block *target_bb, state_t init_state)
 /* Set_priorities: compute priority of each insn in the block.  */
 
 int
-set_priorities (rtx head, rtx tail)
+set_priorities (rtx_insn *head, rtx_insn *tail)
 {
-  rtx insn;
+  rtx_insn *insn;
   int n_insn;
   int sched_max_insns_priority =
 	current_sched_info->sched_max_insns_priority;
@@ -7281,7 +7281,7 @@ generate_recovery_code (rtx_insn *insn)
    Tries to add speculative dependencies of type FS between instructions
    in deps_list L and TWIN.  */
 static void
-process_insn_forw_deps_be_in_spec (rtx insn, rtx twin, ds_t fs)
+process_insn_forw_deps_be_in_spec (rtx insn, rtx_insn *twin, ds_t fs)
 {
   sd_iterator_def sd_it;
   dep_t dep;
@@ -7289,7 +7289,7 @@ process_insn_forw_deps_be_in_spec (rtx insn, rtx twin, ds_t fs)
   FOR_EACH_DEP (insn, SD_LIST_FORW, sd_it, dep)
     {
       ds_t ds;
-      rtx consumer;
+      rtx_insn *consumer;
 
       consumer = DEP_CON (dep);
 
@@ -7479,7 +7479,7 @@ add_to_speculative_block (rtx_insn *insn)
       {
 	dep_def _new_dep, *new_dep = &_new_dep;
 
-	init_dep (new_dep, insn, twin, REG_DEP_OUTPUT);
+	init_dep (new_dep, insn, as_a <rtx_insn *> (twin), REG_DEP_OUTPUT);
 	sd_add_dep (new_dep, false);
       }
 
@@ -7889,7 +7889,7 @@ create_check_block_twin (rtx_insn *insn, bool mutate_p)
 
       if (rec != EXIT_BLOCK_PTR_FOR_FN (cfun))
 	{
-	  SET_DEP_CON (new_dep) = twin;
+	  DEP_CON (new_dep) = twin;
 	  sd_add_dep (new_dep, false);
 	}
     }
@@ -8368,7 +8368,7 @@ calc_priorities (rtx_vec_t roots)
 /* Add dependences between JUMP and other instructions in the recovery
    block.  INSN is the first insn the recovery block.  */
 static void
-add_jump_dependencies (rtx insn, rtx jump)
+add_jump_dependencies (rtx_insn *insn, rtx_insn *jump)
 {
   do
     {
diff --git a/gcc/sched-deps.c b/gcc/sched-deps.c
index f299891..8e77fc8 100644
--- a/gcc/sched-deps.c
+++ b/gcc/sched-deps.c
@@ -101,10 +101,10 @@ dk_to_ds (enum reg_note dk)
 
 /* Init DEP with the arguments.  */
 void
-init_dep_1 (dep_t dep, rtx pro, rtx con, enum reg_note type, ds_t ds)
+init_dep_1 (dep_t dep, rtx_insn *pro, rtx_insn *con, enum reg_note type, ds_t ds)
 {
-  SET_DEP_PRO (dep) = pro;
-  SET_DEP_CON (dep) = con;
+  DEP_PRO (dep) = pro;
+  DEP_CON (dep) = con;
   DEP_TYPE (dep) = type;
   DEP_STATUS (dep) = ds;
   DEP_COST (dep) = UNKNOWN_DEP_COST;
@@ -117,7 +117,7 @@ init_dep_1 (dep_t dep, rtx pro, rtx con, enum reg_note type, ds_t ds)
    While most of the scheduler (including targets) only need the major type
    of the dependency, it is convenient to hide full dep_status from them.  */
 void
-init_dep (dep_t dep, rtx pro, rtx con, enum reg_note kind)
+init_dep (dep_t dep, rtx_insn *pro, rtx_insn *con, enum reg_note kind)
 {
   ds_t ds;
 
@@ -1403,7 +1403,7 @@ sd_unresolve_dep (sd_iterator_def sd_it)
 /* Make TO depend on all the FROM's producers.
    If RESOLVED_P is true add dependencies to the resolved lists.  */
 void
-sd_copy_back_deps (rtx to, rtx from, bool resolved_p)
+sd_copy_back_deps (rtx_insn *to, rtx_insn *from, bool resolved_p)
 {
   sd_list_types_def list_type;
   sd_iterator_def sd_it;
@@ -1416,7 +1416,7 @@ sd_copy_back_deps (rtx to, rtx from, bool resolved_p)
       dep_def _new_dep, *new_dep = &_new_dep;
 
       copy_dep (new_dep, dep);
-      SET_DEP_CON (new_dep) = to;
+      DEP_CON (new_dep) = to;
       sd_add_dep (new_dep, resolved_p);
     }
 }
@@ -4902,24 +4902,4 @@ find_modifiable_mems (rtx_insn *head, rtx_insn *tail)
 	     success_in_block);
 }
 
-rtx_insn *DEP_PRO (dep_t dep)
-{
-  return as_a_nullable <rtx_insn *> (dep->pro);
-}
-
-rtx_insn *DEP_CON (dep_t dep)
-{
-  return as_a_nullable <rtx_insn *> (dep->con);
-}
-
-rtx& SET_DEP_PRO (dep_t dep)
-{
-  return dep->pro;
-}
-
-rtx& SET_DEP_CON (dep_t dep)
-{
-  return dep->con;
-}
-
 #endif /* INSN_SCHEDULING */
diff --git a/gcc/sched-int.h b/gcc/sched-int.h
index 7ac0c8e..e7d93ffd 100644
--- a/gcc/sched-int.h
+++ b/gcc/sched-int.h
@@ -218,10 +218,10 @@ struct dep_replacement
 struct _dep
 {
   /* Producer.  */
-  rtx pro;
+  rtx_insn *pro;
 
   /* Consumer.  */
-  rtx con;
+  rtx_insn *con;
 
   /* If nonnull, holds a pointer to information about how to break the
      dependency by making a replacement in one of the insns.  There is
@@ -250,10 +250,8 @@ struct _dep
 typedef struct _dep dep_def;
 typedef dep_def *dep_t;
 
-extern rtx_insn *DEP_PRO (dep_t dep);
-extern rtx_insn *DEP_CON (dep_t dep);
-extern rtx& SET_DEP_PRO (dep_t dep);
-extern rtx& SET_DEP_CON (dep_t dep);
+#define DEP_PRO(D) ((D)->pro)
+#define DEP_CON(D) ((D)->con)
 #define DEP_TYPE(D) ((D)->type)
 #define DEP_STATUS(D) ((D)->status)
 #define DEP_COST(D) ((D)->cost)
@@ -263,8 +261,8 @@ extern rtx& SET_DEP_CON (dep_t dep);
 
 /* Functions to work with dep.  */
 
-extern void init_dep_1 (dep_t, rtx, rtx, enum reg_note, ds_t);
-extern void init_dep (dep_t, rtx, rtx, enum reg_note);
+extern void init_dep_1 (dep_t, rtx_insn *, rtx_insn *, enum reg_note, ds_t);
+extern void init_dep (dep_t, rtx_insn *, rtx_insn *, enum reg_note);
 
 extern void sd_debug_dep (dep_t);
 
@@ -1349,7 +1347,7 @@ extern int no_real_insns_p (const_rtx, const_rtx);
 extern int insn_cost (rtx);
 extern int dep_cost_1 (dep_t, dw_t);
 extern int dep_cost (dep_t);
-extern int set_priorities (rtx, rtx);
+extern int set_priorities (rtx_insn *, rtx_insn *);
 
 extern void sched_setup_bb_reg_pressure_info (basic_block, rtx);
 extern bool schedule_block (basic_block *, state_t);
@@ -1615,7 +1613,7 @@ extern void sd_add_dep (dep_t, bool);
 extern enum DEPS_ADJUST_RESULT sd_add_or_update_dep (dep_t, bool);
 extern void sd_resolve_dep (sd_iterator_def);
 extern void sd_unresolve_dep (sd_iterator_def);
-extern void sd_copy_back_deps (rtx, rtx, bool);
+extern void sd_copy_back_deps (rtx_insn *, rtx_insn *, bool);
 extern void sd_delete_dep (sd_iterator_def);
 extern void sd_debug_lists (rtx, sd_list_types_def);
 
diff --git a/rtx-classes-status.txt b/rtx-classes-status.txt
index 347114b..787e992 100644
--- a/rtx-classes-status.txt
+++ b/rtx-classes-status.txt
@@ -12,5 +12,4 @@ TODO: "Scaffolding" to be removed
 =================================
 * DF_REF_INSN
 * SET_BB_HEAD, SET_BB_END, SET_BB_HEADER
-* SET_DEP_PRO, SET_DEP_CON
 * SET_NEXT_INSN, SET_PREV_INSN
-- 
1.8.5.3


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]