Use cselib for alias analysis in sched_ebb
authorbernds <bernds@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 8 Aug 2001 10:36:07 +0000 (10:36 +0000)
committerbernds <bernds@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 8 Aug 2001 10:36:07 +0000 (10:36 +0000)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@44716 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/Makefile.in
gcc/sched-deps.c
gcc/sched-ebb.c
gcc/sched-int.h
gcc/sched-rgn.c

index 4b6f709..4b5de19 100644 (file)
@@ -5,6 +5,15 @@
 
        * config/ia64/ia64.md (cond_opsi2_internal, cond_opsi2_internal_b):
        Turn into define_insn_and_split.
+       
+       * sched-deps.c: Include "cselib.h".
+       (add_insn_mem_dependence, sched_analyze_1, sched_analyze_2):
+       Use cselib to turn memory addresses into VALUEs.
+       (sched_analyze): Call cselib_init/cselib_finish if necessary.
+       * sched-int.h (struct sched_info): New member USE_CSELIB.
+       * sched-ebb.c (ebb_sched_info): Initialize it.
+       * sched-rgn.c (rgn_sched_info): Likewise.
+       * Makefile.in (sched-deps.o): Update dependencies.
 
 2001-08-08  Graham Stott  <grahams@redhat.com>
 
index eca0b96..266201b 100644 (file)
@@ -1529,7 +1529,7 @@ haifa-sched.o : haifa-sched.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) sched-int.h \
    $(INSN_ATTR_H) toplev.h $(RECOG_H) except.h $(TM_P_H)
 sched-deps.o : sched-deps.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) sched-int.h \
    $(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h flags.h insn-config.h function.h \
-   $(INSN_ATTR_H) toplev.h $(RECOG_H) except.h $(TM_P_H)
+   $(INSN_ATTR_H) toplev.h $(RECOG_H) except.h cselib.h $(PARAMS_H) $(TM_P_H)
 sched-rgn.o : sched-rgn.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) sched-int.h \
    $(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h flags.h insn-config.h function.h \
    $(INSN_ATTR_H) toplev.h $(RECOG_H) except.h $(TM_P_H)
index 0893ee1..3662b7a 100644 (file)
@@ -39,6 +39,7 @@ the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 #include "recog.h"
 #include "sched-int.h"
 #include "params.h"
+#include "cselib.h"
 
 extern char *reg_known_equiv_p;
 extern rtx *reg_known_value;
@@ -482,6 +483,11 @@ add_insn_mem_dependence (deps, insn_list, mem_list, insn, mem)
   link = alloc_INSN_LIST (insn, *insn_list);
   *insn_list = link;
 
+  if (current_sched_info->use_cselib)
+    {
+      mem = shallow_copy_rtx (mem);
+      XEXP (mem, 0) = cselib_subst_to_values (XEXP (mem, 0));
+    }
   link = alloc_EXPR_LIST (VOIDmode, mem, *mem_list);
   *mem_list = link;
 
@@ -676,6 +682,14 @@ sched_analyze_1 (deps, x, insn)
   else if (GET_CODE (dest) == MEM)
     {
       /* Writing memory.  */
+      rtx t = dest;
+
+      if (current_sched_info->use_cselib)
+       {
+         t = shallow_copy_rtx (dest);
+         cselib_lookup (XEXP (t, 0), Pmode, 1);
+         XEXP (t, 0) = cselib_subst_to_values (XEXP (t, 0));
+       }
 
       if (deps->pending_lists_length > MAX_PENDING_LIST_LENGTH)
        {
@@ -695,7 +709,7 @@ sched_analyze_1 (deps, x, insn)
          pending_mem = deps->pending_read_mems;
          while (pending)
            {
-             if (anti_dependence (XEXP (pending_mem, 0), dest))
+             if (anti_dependence (XEXP (pending_mem, 0), t))
                add_dependence (insn, XEXP (pending, 0), REG_DEP_ANTI);
 
              pending = XEXP (pending, 1);
@@ -706,7 +720,7 @@ sched_analyze_1 (deps, x, insn)
          pending_mem = deps->pending_write_mems;
          while (pending)
            {
-             if (output_dependence (XEXP (pending_mem, 0), dest))
+             if (output_dependence (XEXP (pending_mem, 0), t))
                add_dependence (insn, XEXP (pending, 0), REG_DEP_OUTPUT);
 
              pending = XEXP (pending, 1);
@@ -838,12 +852,19 @@ sched_analyze_2 (deps, x, insn)
        /* Reading memory.  */
        rtx u;
        rtx pending, pending_mem;
+       rtx t = x;
 
+       if (current_sched_info->use_cselib)
+         {
+           t = shallow_copy_rtx (t);
+           cselib_lookup (XEXP (t, 0), Pmode, 1);
+           XEXP (t, 0) = cselib_subst_to_values (XEXP (t, 0));
+         }
        pending = deps->pending_read_insns;
        pending_mem = deps->pending_read_mems;
        while (pending)
          {
-           if (read_dependence (XEXP (pending_mem, 0), x))
+           if (read_dependence (XEXP (pending_mem, 0), t))
              add_dependence (insn, XEXP (pending, 0), REG_DEP_ANTI);
 
            pending = XEXP (pending, 1);
@@ -855,7 +876,7 @@ sched_analyze_2 (deps, x, insn)
        while (pending)
          {
            if (true_dependence (XEXP (pending_mem, 0), VOIDmode,
-                                x, rtx_varies_p))
+                                t, rtx_varies_p))
              add_dependence (insn, XEXP (pending, 0), 0);
 
            pending = XEXP (pending, 1);
@@ -1237,6 +1258,9 @@ sched_analyze (deps, head, tail)
   register rtx u;
   rtx loop_notes = 0;
 
+  if (current_sched_info->use_cselib)
+    cselib_init ();
+
   for (insn = head;; insn = NEXT_INSN (insn))
     {
       if (GET_CODE (insn) == INSN || GET_CODE (insn) == JUMP_INSN)
@@ -1386,8 +1410,14 @@ sched_analyze (deps, head, tail)
          CONST_OR_PURE_CALL_P (loop_notes) = CONST_OR_PURE_CALL_P (insn);
        }
 
+      if (current_sched_info->use_cselib)
+       cselib_process_insn (insn);
       if (insn == tail)
-       return;
+       {
+         if (current_sched_info->use_cselib)
+           cselib_finish ();
+         return;
+       }
     }
   abort ();
 }
index 2ea9029..50e456d 100644 (file)
@@ -193,7 +193,7 @@ static struct sched_info ebb_sched_info =
 
   NULL, NULL,
   NULL, NULL,
-  0
+  0, 1
 };
 \f
 /* Schedule a single extended basic block, defined by the boundaries HEAD
index 0b7ebab..124ba3e 100644 (file)
@@ -146,7 +146,12 @@ struct sched_info
   rtx head, tail;
 
   /* If nonzero, enables an additional sanity check in schedule_block.  */
-  int queue_must_finish_empty;
+  unsigned int queue_must_finish_empty:1;
+  /* Nonzero if we should use cselib for better alias analysis.  This
+     must be 0 if the dependency information is used after sched_analyze
+     has completed, e.g. if we're using it to initialize state for successor
+     blocks in region scheduling.  */
+  unsigned int use_cselib:1;
 };
 
 extern struct sched_info *current_sched_info;
index 93f7b44..daa7ab5 100644 (file)
@@ -2352,7 +2352,7 @@ static struct sched_info region_sched_info =
 
   NULL, NULL,
   NULL, NULL,
-  0
+  0, 0
 };
 
 /* Add dependences so that branches are scheduled to run last in their