OSDN Git Service

Replace calls to abort in CRIS port.
[pf3gnuchains/gcc-fork.git] / gcc / sched-deps.c
index 5e23a93..6b54fc8 100644 (file)
@@ -1,7 +1,7 @@
 /* Instruction scheduling pass.  This file computes dependencies between
    instructions.
    Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998,
-   1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+   1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
    Contributed by Michael Tiemann (tiemann@cygnus.com) Enhanced by,
    and currently maintained by, Jim Wilson (wilson@cygnus.com)
 
@@ -76,7 +76,7 @@ static enum reg_pending_barrier_mode reg_pending_barrier;
 static bitmap_head *true_dependency_cache;
 static bitmap_head *anti_dependency_cache;
 static bitmap_head *output_dependency_cache;
-int cache_size;
+static int cache_size;
 
 /* To speed up checking consistency of formed forward insn
    dependencies we use the following cache.  Another possible solution
@@ -507,11 +507,10 @@ sched_analyze_1 (struct deps *deps, rtx x, rtx insn)
     }
 
   while (GET_CODE (dest) == STRICT_LOW_PART || GET_CODE (dest) == SUBREG
-        || GET_CODE (dest) == ZERO_EXTRACT || GET_CODE (dest) == SIGN_EXTRACT)
+        || GET_CODE (dest) == ZERO_EXTRACT)
     {
       if (GET_CODE (dest) == STRICT_LOW_PART
         || GET_CODE (dest) == ZERO_EXTRACT
-        || GET_CODE (dest) == SIGN_EXTRACT
         || read_modify_subreg_p (dest))
         {
          /* These both read and modify the result.  We must handle
@@ -522,7 +521,7 @@ sched_analyze_1 (struct deps *deps, rtx x, rtx insn)
 
          sched_analyze_2 (deps, XEXP (dest, 0), insn);
        }
-      if (GET_CODE (dest) == ZERO_EXTRACT || GET_CODE (dest) == SIGN_EXTRACT)
+      if (GET_CODE (dest) == ZERO_EXTRACT)
        {
          /* The second and third arguments are values read by this insn.  */
          sched_analyze_2 (deps, XEXP (dest, 1), insn);
@@ -535,6 +534,15 @@ sched_analyze_1 (struct deps *deps, rtx x, rtx insn)
     {
       regno = REGNO (dest);
 
+#ifdef STACK_REGS
+      /* Treat all writes to a stack register as modifying the TOS.  */
+      if (regno >= FIRST_STACK_REG && regno <= LAST_STACK_REG)
+       {
+         SET_REGNO_REG_SET (reg_pending_uses, FIRST_STACK_REG);
+         regno = FIRST_STACK_REG;
+       }
+#endif
+
       /* A hard reg in a wide mode may really be multiple registers.
          If so, mark all of them just like the first.  */
       if (regno < FIRST_PSEUDO_REGISTER)
@@ -685,6 +693,16 @@ sched_analyze_2 (struct deps *deps, rtx x, rtx insn)
     case REG:
       {
        int regno = REGNO (x);
+
+#ifdef STACK_REGS
+      /* Treat all reads of a stack register as modifying the TOS.  */
+      if (regno >= FIRST_STACK_REG && regno <= LAST_STACK_REG)
+       {
+         SET_REGNO_REG_SET (reg_pending_sets, FIRST_STACK_REG);
+         regno = FIRST_STACK_REG;
+       }
+#endif
+
        if (regno < FIRST_PSEUDO_REGISTER)
          {
            int i = hard_regno_nregs[regno][GET_MODE (x)];
@@ -976,18 +994,14 @@ sched_analyze_insn (struct deps *deps, rtx x, rtx insn, rtx loop_notes)
     {
       rtx link;
 
-      /* Update loop_notes with any notes from this insn.  Also determine
-        if any of the notes on the list correspond to instruction scheduling
-        barriers (loop, eh & setjmp notes, but not range notes).  */
+      /* Update loop_notes with any notes from this insn.  */
       link = loop_notes;
       while (XEXP (link, 1))
        {
-         if (INTVAL (XEXP (link, 0)) == NOTE_INSN_LOOP_BEG
-             || INTVAL (XEXP (link, 0)) == NOTE_INSN_LOOP_END
-             || INTVAL (XEXP (link, 0)) == NOTE_INSN_EH_REGION_BEG
-             || INTVAL (XEXP (link, 0)) == NOTE_INSN_EH_REGION_END)
-           reg_pending_barrier = MOVE_BARRIER;
+         gcc_assert (INTVAL (XEXP (link, 0)) == NOTE_INSN_LOOP_BEG
+                     || INTVAL (XEXP (link, 0)) == NOTE_INSN_LOOP_END);
 
+         reg_pending_barrier = MOVE_BARRIER;
          link = XEXP (link, 1);
        }
       XEXP (link, 1) = REG_NOTES (insn);
@@ -1323,26 +1337,19 @@ sched_analyze (struct deps *deps, rtx head, rtx tail)
            deps->in_post_call_group_p = post_call;
        }
 
+      /* EH_REGION insn notes can not appear until well after we complete
+        scheduling.  */
+      if (NOTE_P (insn))
+       gcc_assert (NOTE_LINE_NUMBER (insn) != NOTE_INSN_EH_REGION_BEG
+                   && NOTE_LINE_NUMBER (insn) != NOTE_INSN_EH_REGION_END);
+
       /* See comments on reemit_notes as to why we do this.
         ??? Actually, the reemit_notes just say what is done, not why.  */
 
       if (NOTE_P (insn)
-              && (NOTE_LINE_NUMBER (insn) == NOTE_INSN_LOOP_BEG
-                  || NOTE_LINE_NUMBER (insn) == NOTE_INSN_LOOP_END
-                  || NOTE_LINE_NUMBER (insn) == NOTE_INSN_EH_REGION_BEG
-                  || NOTE_LINE_NUMBER (insn) == NOTE_INSN_EH_REGION_END))
+         && (NOTE_LINE_NUMBER (insn) == NOTE_INSN_LOOP_BEG
+             || NOTE_LINE_NUMBER (insn) == NOTE_INSN_LOOP_END))
        {
-         rtx rtx_region;
-
-         if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_EH_REGION_BEG
-             || NOTE_LINE_NUMBER (insn) == NOTE_INSN_EH_REGION_END)
-           rtx_region = GEN_INT (NOTE_EH_HANDLER (insn));
-         else
-           rtx_region = const0_rtx;
-
-         loop_notes = alloc_EXPR_LIST (REG_SAVE_NOTE,
-                                       rtx_region,
-                                       loop_notes);
          loop_notes = alloc_EXPR_LIST (REG_SAVE_NOTE,
                                        GEN_INT (NOTE_LINE_NUMBER (insn)),
                                        loop_notes);
@@ -1591,9 +1598,9 @@ free_dependency_caches (void)
 void
 init_deps_global (void)
 {
-  reg_pending_sets = OBSTACK_ALLOC_REG_SET (&reg_obstack);
-  reg_pending_clobbers = OBSTACK_ALLOC_REG_SET (&reg_obstack);
-  reg_pending_uses = OBSTACK_ALLOC_REG_SET (&reg_obstack);
+  reg_pending_sets = ALLOC_REG_SET (&reg_obstack);
+  reg_pending_clobbers = ALLOC_REG_SET (&reg_obstack);
+  reg_pending_uses = ALLOC_REG_SET (&reg_obstack);
   reg_pending_barrier = NOT_A_BARRIER;
 }