OSDN Git Service

* gcc.c-torture/compile/pr11832.c: XFAIL for mips and powerpc-linux,
[pf3gnuchains/gcc-fork.git] / gcc / sched-ebb.c
index b03655d..7e22874 100644 (file)
@@ -9,7 +9,7 @@ This file is part of GCC.
 
 GCC is free software; you can redistribute it and/or modify it under
 the terms of the GNU General Public License as published by the Free
-Software Foundation; either version 2, or (at your option) any later
+Software Foundation; either version 3, or (at your option) any later
 version.
 
 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
@@ -18,9 +18,8 @@ FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 for more details.
 
 You should have received a copy of the GNU General Public License
-along with GCC; see the file COPYING.  If not, write to the Free
-Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301, USA.  */
+along with GCC; see the file COPYING3.  If not see
+<http://www.gnu.org/licenses/>.  */
 \f
 #include "config.h"
 #include "system.h"
@@ -45,6 +44,8 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
 #include "output.h"
 
 \f
+#ifdef INSN_SCHEDULING
+
 /* The number of insns scheduled so far.  */
 static int sched_n_insns;
 
@@ -304,24 +305,26 @@ static struct sched_info ebb_sched_info =
 static basic_block
 earliest_block_with_similiar_load (basic_block last_block, rtx load_insn)
 {
-  dep_link_t back_link;
+  sd_iterator_def back_sd_it;
+  dep_t back_dep;
   basic_block bb, earliest_block = NULL;
 
-  FOR_EACH_DEP_LINK (back_link, INSN_BACK_DEPS (load_insn))
+  FOR_EACH_DEP (load_insn, SD_LIST_BACK, back_sd_it, back_dep)
     {
-      rtx insn1 = DEP_LINK_PRO (back_link);
+      rtx insn1 = DEP_PRO (back_dep);
 
-      if (DEP_LINK_KIND (back_link) == REG_DEP_TRUE)
+      if (DEP_TYPE (back_dep) == REG_DEP_TRUE) 
+       /* Found a DEF-USE dependence (insn1, load_insn).  */
        {
-         /* Found a DEF-USE dependence (insn1, load_insn).  */
-         dep_link_t fore_link;
+         sd_iterator_def fore_sd_it;
+         dep_t fore_dep;
 
-         FOR_EACH_DEP_LINK (fore_link, INSN_FORW_DEPS (insn1))
+         FOR_EACH_DEP (insn1, SD_LIST_FORW, fore_sd_it, fore_dep)
            {
-             rtx insn2 = DEP_LINK_CON (fore_link);
+             rtx insn2 = DEP_CON (fore_dep);
              basic_block insn2_block = BLOCK_FOR_INSN (insn2);
 
-             if (DEP_LINK_KIND (fore_link) == REG_DEP_TRUE)
+             if (DEP_TYPE (fore_dep) == REG_DEP_TRUE)
                {
                  if (earliest_block != NULL
                      && earliest_block->index < insn2_block->index)
@@ -396,23 +399,32 @@ add_deps_for_risky_insns (rtx head, rtx tail)
               rank.  */
            if (! sched_insns_conditions_mutex_p (insn, prev))
              {
-               if (!(current_sched_info->flags & DO_SPECULATION))
+               dep_def _dep, *dep = &_dep;
+
+               init_dep (dep, prev, insn, REG_DEP_ANTI);
+
+               if (!(current_sched_info->flags & USE_DEPS_LIST))
                  {
                    enum DEPS_ADJUST_RESULT res;
-                   
-                   res = add_or_update_back_dep (insn, prev,
-                                                 REG_DEP_ANTI, DEP_ANTI);
-
-                   if (res == DEP_CREATED)
-                     add_forw_dep (DEPS_LIST_FIRST (INSN_BACK_DEPS (insn)));
-                   else
-                     gcc_assert (res != DEP_CHANGED);
+
+                   res = sd_add_or_update_dep (dep, false);
+
+                   /* We can't change an existing dependency with
+                      DEP_ANTI.  */
+                   gcc_assert (res != DEP_CHANGED);
                  }
                else
-                 add_or_update_back_forw_dep (insn, prev, REG_DEP_ANTI,
-                                              set_dep_weak (DEP_ANTI,
-                                                            BEGIN_CONTROL,
-                                                            MAX_DEP_WEAK));
+                 {
+                   if ((current_sched_info->flags & DO_SPECULATION)
+                       && (spec_info->mask & BEGIN_CONTROL))
+                     DEP_STATUS (dep) = set_dep_weak (DEP_ANTI, BEGIN_CONTROL,
+                                                      MAX_DEP_WEAK);
+
+                   sd_add_or_update_dep (dep, false);
+
+                   /* Dep_status could have been changed.
+                      No assertion here.  */
+                 }
              }
 
             break;
@@ -451,14 +463,11 @@ schedule_ebb (rtx head, rtx tail)
     {
       init_deps_global ();
 
-      /* Compute backward dependencies.  */
+      /* Compute dependencies.  */
       init_deps (&tmp_deps);
       sched_analyze (&tmp_deps, head, tail);
       free_deps (&tmp_deps);
 
-      /* Compute forward dependencies.  */
-      compute_forward_dependences (head, tail);
-
       add_deps_for_risky_insns (head, tail);
 
       if (targetm.sched.dependencies_evaluation_hook)
@@ -511,8 +520,12 @@ schedule_ebb (rtx head, rtx tail)
   
   /* Sanity check: verify that all region insns were scheduled.  */
   gcc_assert (sched_n_insns == n_insns);
-  head = current_sched_info->head;
-  tail = current_sched_info->tail;
+
+  /* Free dependencies.  */
+  sched_free_deps (current_sched_info->head, current_sched_info->tail, true);
+
+  gcc_assert (haifa_recovery_bb_ever_added_p
+             || deps_pools_are_empty_p ());
 
   if (EDGE_COUNT (last_bb->preds) == 0)
     /* LAST_BB is unreachable.  */
@@ -685,3 +698,5 @@ fix_recovery_cfg (int bbi ATTRIBUTE_UNUSED, int jump_bbi, int jump_bb_nexti)
   if (jump_bb_nexti == last_bb->index)
     last_bb = BASIC_BLOCK (jump_bbi);
 }
+
+#endif /* INSN_SCHEDULING */