For now, convert DEP_PRO and DEP_CON into functions.  We will eventually
change them back to macros once the relevant fields are of type
rtx_insn *.

gcc/
        * sched-int.h (DEP_PRO): struct _dep's "pro" and "con" fields will
        eventually be rtx_insn *, but to help with transition, for now,
        convert from an access macro into a pair of functions: DEP_PRO
        returning an rtx_insn * and...
        (SET_DEP_PRO): New function, for use where DEP_PRO is used as an
        lvalue, returning an rtx&.
        (DEP_CON): Analogous changes to DEP_PRO above.
        (SET_DEP_CON): Likewise.

        * haifa-sched.c (create_check_block_twin): Replace DEP_CON used as
        an lvalue to SET_DEP_CON.
        * sched-deps.c (init_dep_1): Likewise for DEP_PRO and DEP_CON.
        (sd_copy_back_deps): Likewise for DEP_CON.
        (DEP_PRO): New function, adding a checked cast for now.
        (DEP_CON): Likewise.
        (SET_DEP_PRO): New function.
        (SET_DEP_CON): Likewise.

/
        * rtx-classes-status.txt: Add SET_DEP_PRO, SET_DEP_CON.
---
 gcc/haifa-sched.c      |  2 +-
 gcc/sched-deps.c       | 26 +++++++++++++++++++++++---
 gcc/sched-int.h        |  6 ++++--
 rtx-classes-status.txt |  1 +
 4 files changed, 29 insertions(+), 6 deletions(-)

diff --git a/gcc/haifa-sched.c b/gcc/haifa-sched.c
index 59c7fc9..caee1b8 100644
--- a/gcc/haifa-sched.c
+++ b/gcc/haifa-sched.c
@@ -7886,7 +7886,7 @@ create_check_block_twin (rtx insn, bool mutate_p)
 
       if (rec != EXIT_BLOCK_PTR_FOR_FN (cfun))
        {
-         DEP_CON (new_dep) = twin;
+         SET_DEP_CON (new_dep) = twin;
          sd_add_dep (new_dep, false);
        }
     }
diff --git a/gcc/sched-deps.c b/gcc/sched-deps.c
index efc4223..d59cffc 100644
--- a/gcc/sched-deps.c
+++ b/gcc/sched-deps.c
@@ -103,8 +103,8 @@ dk_to_ds (enum reg_note dk)
 void
 init_dep_1 (dep_t dep, rtx pro, rtx con, enum reg_note type, ds_t ds)
 {
-  DEP_PRO (dep) = pro;
-  DEP_CON (dep) = con;
+  SET_DEP_PRO (dep) = pro;
+  SET_DEP_CON (dep) = con;
   DEP_TYPE (dep) = type;
   DEP_STATUS (dep) = ds;
   DEP_COST (dep) = UNKNOWN_DEP_COST;
@@ -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);
-      DEP_CON (new_dep) = to;
+      SET_DEP_CON (new_dep) = to;
       sd_add_dep (new_dep, resolved_p);
     }
 }
@@ -4895,4 +4895,24 @@ find_modifiable_mems (rtx head, rtx 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 fe00496..3680889 100644
--- a/gcc/sched-int.h
+++ b/gcc/sched-int.h
@@ -250,8 +250,10 @@ struct _dep
 typedef struct _dep dep_def;
 typedef dep_def *dep_t;
 
-#define DEP_PRO(D) ((D)->pro)
-#define DEP_CON(D) ((D)->con)
+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_TYPE(D) ((D)->type)
 #define DEP_STATUS(D) ((D)->status)
 #define DEP_COST(D) ((D)->cost)
diff --git a/rtx-classes-status.txt b/rtx-classes-status.txt
index 68bbe54..2a8773f 100644
--- a/rtx-classes-status.txt
+++ b/rtx-classes-status.txt
@@ -12,4 +12,5 @@ TODO: "Scaffolding" to be removed
 =================================
 * DF_REF_INSN
 * SET_BB_HEAD, SET_BB_END, SET_BB_HEADER, SET_BB_FOOTER
+* SET_DEP_PRO, SET_DEP_CON
 * SET_NEXT_INSN, SET_PREV_INSN
-- 
1.8.5.3

Reply via email to