OSDN Git Service

Improve error for undefined name in imported package.
[pf3gnuchains/gcc-fork.git] / gcc / modulo-sched.c
index e3dc3aa..28be942 100644 (file)
@@ -211,7 +211,7 @@ static int get_sched_window (partial_schedule_ptr, ddg_node_ptr,
 static bool try_scheduling_node_in_cycle (partial_schedule_ptr, ddg_node_ptr,
                                          int, int, sbitmap, int *, sbitmap,
                                          sbitmap);
-static bool remove_node_from_ps (partial_schedule_ptr, ps_insn_ptr);
+static void remove_node_from_ps (partial_schedule_ptr, ps_insn_ptr);
 
 #define SCHED_ASAP(x) (((node_sched_params_ptr)(x)->aux.info)->asap)
 #define SCHED_TIME(x) (((node_sched_params_ptr)(x)->aux.info)->time)
@@ -834,8 +834,7 @@ optimize_sc (partial_schedule_ptr ps, ddg_ptr g)
        if (next_ps_i->node->cuid == g->closing_branch->cuid)
          break;
 
-      gcc_assert (next_ps_i);
-      gcc_assert (remove_node_from_ps (ps, next_ps_i));
+      remove_node_from_ps (ps, next_ps_i);
       success =
        try_scheduling_node_in_cycle (ps, g->closing_branch,
                                      g->closing_branch->cuid, c,
@@ -1485,8 +1484,8 @@ sms_schedule (void)
           if (dump_file)
             {
              fprintf (dump_file,
-                      "SMS succeeded %d %d (with ii, sc)\n", ps->ii,
-                      stage_count);
+                      "%s:%d SMS succeeded %d %d (with ii, sc)\n",
+                      insn_file (tail), insn_line (tail), ps->ii, stage_count);
              print_partial_schedule (ps, dump_file);
            }
  
@@ -1662,44 +1661,41 @@ get_sched_window (partial_schedule_ptr ps, ddg_node_ptr u_node,
   count_preds = 0;
   count_succs = 0;
 
+  if (dump_file && (psp_not_empty || pss_not_empty))
+    {
+      fprintf (dump_file, "\nAnalyzing dependencies for node %d (INSN %d)"
+              "; ii = %d\n\n", u_node->cuid, INSN_UID (u_node->insn), ii);
+      fprintf (dump_file, "%11s %11s %11s %11s %5s\n",
+              "start", "early start", "late start", "end", "time");
+      fprintf (dump_file, "=========== =========== =========== ==========="
+              " =====\n");
+    }
   /* Calculate early_start and limit end.  Both bounds are inclusive.  */
   if (psp_not_empty)
     for (e = u_node->in; e != 0; e = e->next_in)
       {
        ddg_node_ptr v_node = e->src;
 
-       if (dump_file)
-         {
-           fprintf (dump_file, "\nProcessing edge: ");
-           print_ddg_edge (dump_file, e);
-           fprintf (dump_file,
-                    "\nScheduling %d (%d) in psp_not_empty,"
-                    " checking p %d (%d): ", u_node->cuid,
-                    INSN_UID (u_node->insn), v_node->cuid, INSN_UID
-                    (v_node->insn));
-         }
-
        if (TEST_BIT (sched_nodes, v_node->cuid))
          {
            int p_st = SCHED_TIME (v_node);
+           int earliest = p_st + e->latency - (e->distance * ii);
+           int latest = (e->data_type == MEM_DEP ? p_st + ii - 1 : INT_MAX);
 
-           early_start = MAX (early_start,
-                              p_st + e->latency - (e->distance * ii));
+           if (dump_file)
+             {
+               fprintf (dump_file, "%11s %11d %11s %11d %5d",
+                        "", earliest, "", latest, p_st);
+               print_ddg_edge (dump_file, e);
+               fprintf (dump_file, "\n");
+             }
 
-           if (e->data_type == MEM_DEP)
-             end = MIN (end, p_st + ii - 1);
+           early_start = MAX (early_start, earliest);
+           end = MIN (end, latest);
 
            if (e->type == TRUE_DEP && e->data_type == REG_DEP)
              count_preds++;
-
-           if (dump_file)
-             fprintf (dump_file,
-                      "pred st = %d; early_start = %d; latency: %d;"
-                      " end: %d\n", p_st, early_start, e->latency, end);
-
          }
-       else if (dump_file)
-         fprintf (dump_file, "the node is not scheduled\n");
       }
 
   /* Calculate late_start and limit start.  Both bounds are inclusive.  */
@@ -1708,40 +1704,37 @@ get_sched_window (partial_schedule_ptr ps, ddg_node_ptr u_node,
       {
        ddg_node_ptr v_node = e->dest;
 
-       if (dump_file)
-         {
-           fprintf (dump_file, "\nProcessing edge:");
-           print_ddg_edge (dump_file, e);
-           fprintf (dump_file,
-                    "\nScheduling %d (%d) in pss_not_empty,"
-                    " checking s %d (%d): ", u_node->cuid,
-                    INSN_UID (u_node->insn), v_node->cuid, INSN_UID
-                    (v_node->insn));
-         }
-
        if (TEST_BIT (sched_nodes, v_node->cuid))
          {
            int s_st = SCHED_TIME (v_node);
+           int earliest = (e->data_type == MEM_DEP ? s_st - ii + 1 : INT_MIN);
+           int latest = s_st - e->latency + (e->distance * ii);
 
-           late_start = MIN (late_start,
-                             s_st - e->latency + (e->distance * ii));
+           if (dump_file)
+             {
+               fprintf (dump_file, "%11d %11s %11d %11s %5d",
+                        earliest, "", latest, "", s_st);
+               print_ddg_edge (dump_file, e);
+               fprintf (dump_file, "\n");
+             }
 
-           if (e->data_type == MEM_DEP)
-             start = MAX (start, s_st - ii + 1);
+           start = MAX (start, earliest);
+           late_start = MIN (late_start, latest);
 
            if (e->type == TRUE_DEP && e->data_type == REG_DEP)
              count_succs++;
-
-           if (dump_file)
-             fprintf (dump_file,
-                      "succ st = %d; late_start = %d; latency = %d;"
-                      " start=%d", s_st, late_start, e->latency, start);
-
          }
-       else if (dump_file)
-         fprintf (dump_file, "the node is not scheduled\n");
       }
 
+  if (dump_file && (psp_not_empty || pss_not_empty))
+    {
+      fprintf (dump_file, "----------- ----------- ----------- -----------"
+              " -----\n");
+      fprintf (dump_file, "%11d %11d %11d %11d %5s %s\n",
+              start, early_start, late_start, end, "",
+              "(max, max, min, min)");
+    }
+
   /* Get a target scheduling window no bigger than ii.  */
   if (early_start == INT_MIN && late_start == INT_MAX)
     early_start = SCHED_ASAP (u_node);
@@ -1753,6 +1746,10 @@ get_sched_window (partial_schedule_ptr ps, ddg_node_ptr u_node,
   start = MAX (start, early_start);
   end = MIN (end, late_start);
 
+  if (dump_file && (psp_not_empty || pss_not_empty))
+    fprintf (dump_file, "%11s %11d %11d %11s %5s final window\n",
+            "", start, end, "", "");
+
   /* If there are at least as many successors as predecessors, schedule the
      node close to its successors.  */
   if (pss_not_empty && count_succs >= count_preds)
@@ -1960,8 +1957,8 @@ sms_schedule_by_order (ddg_ptr g, int mii, int maxii, int *nodes_order)
                                 &step, &end) == 0)
             {
               if (dump_file)
-                fprintf (dump_file, "\nTrying to schedule node %d \
-                        INSN = %d  in (%d .. %d) step %d\n", u, (INSN_UID
+                fprintf (dump_file, "\nTrying to schedule node %d "
+                        "INSN = %d  in (%d .. %d) step %d\n", u, (INSN_UID
                         (g->nodes[u].insn)), start, end, step);
 
               gcc_assert ((step > 0 && start < end)
@@ -2721,22 +2718,18 @@ create_ps_insn (ddg_node_ptr node, int cycle)
 }
 
 
-/* Removes the given PS_INSN from the partial schedule.  Returns false if the
-   node is not found in the partial schedule, else returns true.  */
-static bool
+/* Removes the given PS_INSN from the partial schedule.  */  
+static void 
 remove_node_from_ps (partial_schedule_ptr ps, ps_insn_ptr ps_i)
 {
   int row;
 
-  if (!ps || !ps_i)
-    return false;
-
+  gcc_assert (ps && ps_i);
+  
   row = SMODULO (ps_i->cycle, ps->ii);
   if (! ps_i->prev_in_row)
     {
-      if (ps_i != ps->rows[row])
-       return false;
-
+      gcc_assert (ps_i == ps->rows[row]);
       ps->rows[row] = ps_i->next_in_row;
       if (ps->rows[row])
        ps->rows[row]->prev_in_row = NULL;
@@ -2750,7 +2743,7 @@ remove_node_from_ps (partial_schedule_ptr ps, ps_insn_ptr ps_i)
    
   ps->rows_length[row] -= 1; 
   free (ps_i);
-  return true;
+  return;
 }
 
 /* Unlike what literature describes for modulo scheduling (which focuses