sched-deps.c (set_sched_group_p): Delete.
authorEric Christopher <echristo@gcc.gnu.org>
Mon, 15 Nov 2004 22:23:29 +0000 (22:23 +0000)
committerEric Christopher <echristo@gcc.gnu.org>
Mon, 15 Nov 2004 22:23:29 +0000 (22:23 +0000)
2004-11-15  Eric Christopher  <echristo@redhat.com>

* sched-deps.c (set_sched_group_p): Delete.
(delete_all_dependencies): New function.
(fixup_sched_groups): Use. New function.
(sched_analyze_insn): Use.

From-SVN: r90698

gcc/ChangeLog
gcc/sched-deps.c

index fbcf2dfa20b6eb87a80adde2e7a2b2be3da04fce..a50706dbb66d97cb4870b991ba7bb2dddc0c8aeb 100644 (file)
@@ -1,3 +1,10 @@
+2004-11-15  Eric Christopher  <echristo@redhat.com>
+
+       * sched-deps.c (set_sched_group_p): Delete.
+       (delete_all_dependencies): New function.
+       (fixup_sched_groups): Use. New function.
+       (sched_analyze_insn): Use.
+
 2004-11-15  Joseph S. Myers  <joseph@codesourcery.com>
 
        * c-common.c (binary_op_error): Don't allow LROTATE_EXPR,
 
 2004-11-13  Kelley Cook  <kcook@gcc.gnu.org>
 
-       * doc/install.texi (automake): Correctly document that everything now 
+       * doc/install.texi (automake): Correctly document that everything now
        will use automake 1.9.3.
 
 2004-11-13  Hans-Peter Nilsson  <hp@bitrange.com>
        * doc/install.texi: Likewise.
        * doc/makefile.texi: Likewise.
        * doc/sourcebuild.texi: Likewise.
-       
+
 2004-11-13  Kazu Hirata  <kazu@cs.umass.edu>
 
        * tree-ssa-loop-manip.c: Fix a comment typo.
 2004-11-12  Devang Patel  <dpatel@apple.com>
 
        * optabs.c (vector_compare_rtx): Use COMPARISON_CLASS_P.
-       
+
 2004-11-12  Devang Patel  <dpatel@apple.com>
 
        * tree-if-conv.c (clean_predicate_lists): Use loop header
        and latch directly.
-       
+
 2004-11-12  Richard Henderson  <rth@redhat.com>
 
        PR 17778
        * passes.c (rest_of_decl_compilation): Do not look at DECL_RTL
        when deciding whether to pass a variable to
        cgraph_varpool_finalize_decl or assemble_variable.
-       * toplev.c (check_global_declarations): Do not clear DECL_RTL. 
+       * toplev.c (check_global_declarations): Do not clear DECL_RTL.
 
 2004-11-12  Kazu Hirata  <kazu@cs.umass.edu>
 
 2004-11-12  Sebastian Pop  <pop@cri.ensmp.fr>
 
        PR middle-end/18005
-       * tree-data-ref.c (estimate_niter_from_size_of_data): Ensure 
+       * tree-data-ref.c (estimate_niter_from_size_of_data): Ensure
        that arguments of EXACT_DIV_EXPR are INTEGER_CST.
 
 2004-11-12  Steven Bosscher  <stevenb@suse.de>
 
 2004-11-11  Sebastian Pop  <pop@cri.ensmp.fr>
 
-       * tree-scalar-evolution.c (follow_ssa_edge_in_condition_phi): 
+       * tree-scalar-evolution.c (follow_ssa_edge_in_condition_phi):
        Give up as soon as the evolution is known not computable.
 
 2004-11-11  Nathan Sidwell  <nathan@codesourcery.com>
index 5dc920556ce8652d048893487821afe4e8b9ece6..0d916c6e956a118ac91441bbe6eaaa80e1775edf 100644 (file)
@@ -94,7 +94,8 @@ static bitmap_head *forward_dependency_cache;
 static int deps_may_trap_p (rtx);
 static void add_dependence_list (rtx, rtx, enum reg_note);
 static void add_dependence_list_and_free (rtx, rtx *, enum reg_note);
-static void set_sched_group_p (rtx);
+static void delete_all_dependences (rtx);
+static void fixup_sched_groups (rtx);
 
 static void flush_pending_lists (struct deps *, rtx, int, int);
 static void sched_analyze_1 (struct deps *, rtx, rtx);
@@ -369,18 +370,54 @@ add_dependence_list_and_free (rtx insn, rtx *listp, enum reg_note dep_type)
     }
 }
 
-/* Set SCHED_GROUP_P and care for the rest of the bookkeeping that
-   goes along with that.  */
+/* Clear all dependencies for an insn.  */
 
 static void
-set_sched_group_p (rtx insn)
+delete_all_dependences (rtx insn)
 {
-  rtx prev;
+  /* Clear caches, if they exist, as well as free the dependence.  */
 
-  SCHED_GROUP_P (insn) = 1;
+#ifdef INSN_SCHEDULING
+  if (true_dependency_cache != NULL)
+    {
+      bitmap_clear (&true_dependency_cache[INSN_LUID (insn)]);
+      bitmap_clear (&anti_dependency_cache[INSN_LUID (insn)]);
+      bitmap_clear (&output_dependency_cache[INSN_LUID (insn)]);
+    }
+#endif
+
+  free_INSN_LIST_list (&LOG_LINKS (insn));
+}
+
+/* All insns in a scheduling group except the first should only have
+   dependencies on the previous insn in the group.  So we find the
+   first instruction in the scheduling group by walking the dependence
+   chains backwards. Then we add the dependencies for the group to
+   the previous nonnote insn.  */
+
+static void
+fixup_sched_groups (rtx insn)
+{
+  rtx link;
 
-  prev = prev_nonnote_insn (insn);
-  add_dependence (insn, prev, REG_DEP_ANTI);
+  for (link = LOG_LINKS (insn); link ; link = XEXP (link, 1))
+    {
+      rtx i = insn;
+      do
+       {
+         i = prev_nonnote_insn (i);
+
+         if (XEXP (link, 0) == i)
+           goto next_link;
+       } while (SCHED_GROUP_P (i));
+      add_dependence (i, XEXP (link, 0), REG_NOTE_KIND (link));
+    next_link:;
+    }
+
+  delete_all_dependences (insn);
+
+  if (BLOCK_FOR_INSN (insn) == BLOCK_FOR_INSN (prev_nonnote_insn (insn)))
+    add_dependence (insn, prev_nonnote_insn (insn), REG_DEP_ANTI);
 }
 \f
 /* Process an insn's memory dependencies.  There are four kinds of
@@ -643,7 +680,7 @@ sched_analyze_2 (struct deps *deps, rtx x, rtx insn)
 #ifdef HAVE_cc0
     case CC0:
       /* User of CC0 depends on immediately preceding insn.  */
-      set_sched_group_p (insn);
+      SCHED_GROUP_P (insn) = 1;
        /* Don't move CC0 setter to another block (it can set up the
         same flag for previous CC0 users which is safe).  */
       CANT_MOVE (prev_nonnote_insn (insn)) = 1;
@@ -1112,7 +1149,7 @@ sched_analyze_insn (struct deps *deps, rtx x, rtx insn, rtx loop_notes)
 
   if (deps->libcall_block_tail_insn)
     {
-      set_sched_group_p (insn);
+      SCHED_GROUP_P (insn) = 1;
       CANT_MOVE (insn) = 1;
     }
 
@@ -1158,15 +1195,10 @@ sched_analyze_insn (struct deps *deps, rtx x, rtx insn, rtx loop_notes)
       if (src_regno < FIRST_PSEUDO_REGISTER
          || dest_regno < FIRST_PSEUDO_REGISTER)
        {
-         /* If we are inside a post-call group right at the start of the
-            scheduling region, we must not add a dependency.  */
          if (deps->in_post_call_group_p == post_call_initial)
-           {
-             SCHED_GROUP_P (insn) = 1;
-             deps->in_post_call_group_p = post_call;
-           }
-         else
-           set_sched_group_p (insn);
+           deps->in_post_call_group_p = post_call;
+
+         SCHED_GROUP_P (insn) = 1;
          CANT_MOVE (insn) = 1;
        }
       else
@@ -1175,6 +1207,10 @@ sched_analyze_insn (struct deps *deps, rtx x, rtx insn, rtx loop_notes)
          deps->in_post_call_group_p = not_post_call;
        }
     }
+
+  /* Fixup the dependencies in the sched group.  */
+  if (SCHED_GROUP_P (insn))
+    fixup_sched_groups (insn);
 }
 
 /* Analyze every insn between HEAD and TAIL inclusive, creating LOG_LINKS