OSDN Git Service

2004-04-05 Caroline Tice <ctice@apple.com>
[pf3gnuchains/gcc-fork.git] / gcc / sched-deps.c
index 82fef76..7802bf2 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 Free Software Foundation, Inc.
+   1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
    Contributed by Michael Tiemann (tiemann@cygnus.com) Enhanced by,
    and currently maintained by, Jim Wilson (wilson@cygnus.com)
 
@@ -44,8 +44,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 #include "cselib.h"
 #include "df.h"
 
-extern char *reg_known_equiv_p;
-extern rtx *reg_known_value;
 
 static regset_head reg_pending_sets_head;
 static regset_head reg_pending_clobbers_head;
@@ -113,10 +111,12 @@ deps_may_trap_p (rtx mem)
 {
   rtx addr = XEXP (mem, 0);
 
-  if (REG_P (addr)
-      && REGNO (addr) >= FIRST_PSEUDO_REGISTER
-      && reg_known_value[REGNO (addr)])
-    addr = reg_known_value[REGNO (addr)];
+  if (REG_P (addr) && REGNO (addr) >= FIRST_PSEUDO_REGISTER)
+    {
+      rtx t = get_reg_known_value (REGNO (addr));
+      if (t)
+       addr = t;
+    }
   return rtx_addr_can_trap_p (addr);
 }
 \f
@@ -171,8 +171,8 @@ get_condition (rtx insn)
 static int
 conditions_mutex_p (rtx cond1, rtx cond2)
 {
-  if (GET_RTX_CLASS (GET_CODE (cond1)) == '<'
-      && GET_RTX_CLASS (GET_CODE (cond2)) == '<'
+  if (COMPARISON_P (cond1)
+      && COMPARISON_P (cond2)
       && GET_CODE (cond1) == reverse_condition (GET_CODE (cond2))
       && XEXP (cond1, 0) == XEXP (cond2, 0)
       && XEXP (cond1, 1) == XEXP (cond2, 1))
@@ -492,7 +492,7 @@ sched_analyze_1 (struct deps *deps, rtx x, rtx insn)
          If so, mark all of them just like the first.  */
       if (regno < FIRST_PSEUDO_REGISTER)
        {
-         int i = HARD_REGNO_NREGS (regno, GET_MODE (dest));
+         int i = hard_regno_nregs[regno][GET_MODE (dest)];
          if (code == SET)
            {
              while (--i >= 0)
@@ -523,10 +523,12 @@ sched_analyze_1 (struct deps *deps, rtx x, rtx insn)
          /* Pseudos that are REG_EQUIV to something may be replaced
             by that during reloading.  We need only add dependencies for
             the address in the REG_EQUIV note.  */
-         if (!reload_completed
-             && reg_known_equiv_p[regno]
-             && GET_CODE (reg_known_value[regno]) == MEM)
-           sched_analyze_2 (deps, XEXP (reg_known_value[regno], 0), insn);
+         if (!reload_completed && get_reg_known_equiv_p (regno))
+           {
+             rtx t = get_reg_known_value (regno);
+             if (GET_CODE (t) == MEM)
+               sched_analyze_2 (deps, XEXP (t, 0), insn);
+           }
 
          /* Don't let it cross a call after scheduling if it doesn't
             already cross one.  */
@@ -545,7 +547,7 @@ sched_analyze_1 (struct deps *deps, rtx x, rtx insn)
          cselib_lookup (XEXP (t, 0), Pmode, 1);
          XEXP (t, 0) = cselib_subst_to_values (XEXP (t, 0));
        }
-      XEXP (t, 0) = canon_rtx (XEXP (t, 0));
+      t = canon_rtx (t);
 
       if (deps->pending_lists_length > MAX_PENDING_LIST_LENGTH)
        {
@@ -639,7 +641,7 @@ sched_analyze_2 (struct deps *deps, rtx x, rtx insn)
        int regno = REGNO (x);
        if (regno < FIRST_PSEUDO_REGISTER)
          {
-           int i = HARD_REGNO_NREGS (regno, GET_MODE (x));
+           int i = hard_regno_nregs[regno][GET_MODE (x)];
            while (--i >= 0)
              SET_REGNO_REG_SET (reg_pending_uses, regno + i);
          }
@@ -659,10 +661,12 @@ sched_analyze_2 (struct deps *deps, rtx x, rtx insn)
            /* Pseudos that are REG_EQUIV to something may be replaced
               by that during reloading.  We need only add dependencies for
               the address in the REG_EQUIV note.  */
-           if (!reload_completed
-               && reg_known_equiv_p[regno]
-               && GET_CODE (reg_known_value[regno]) == MEM)
-             sched_analyze_2 (deps, XEXP (reg_known_value[regno], 0), insn);
+           if (!reload_completed && get_reg_known_equiv_p (regno))
+             {
+               rtx t = get_reg_known_value (regno);
+               if (GET_CODE (t) == MEM)
+                 sched_analyze_2 (deps, XEXP (t, 0), insn);
+             }
 
            /* If the register does not already cross any calls, then add this
               insn to the sched_before_next_call list so that it will still
@@ -687,7 +691,7 @@ sched_analyze_2 (struct deps *deps, rtx x, rtx insn)
            cselib_lookup (XEXP (t, 0), Pmode, 1);
            XEXP (t, 0) = cselib_subst_to_values (XEXP (t, 0));
          }
-        XEXP (t, 0) = canon_rtx (XEXP (t, 0));
+       t = canon_rtx (t);
        pending = deps->pending_read_insns;
        pending_mem = deps->pending_read_mems;
        while (pending)
@@ -1127,7 +1131,13 @@ sched_analyze_insn (struct deps *deps, rtx x, rtx insn, rtx loop_notes)
       tmp = SET_SRC (set);
       if (GET_CODE (tmp) == SUBREG)
        tmp = SUBREG_REG (tmp);
-      if (GET_CODE (tmp) == REG)
+      if ((GET_CODE (tmp) == PLUS
+          || GET_CODE (tmp) == MINUS)
+         && GET_CODE (XEXP (tmp, 0)) == REG
+         && REGNO (XEXP (tmp, 0)) == STACK_POINTER_REGNUM
+         && dest_regno == STACK_POINTER_REGNUM)
+       src_regno = STACK_POINTER_REGNUM;
+      else if (GET_CODE (tmp) == REG)
        src_regno = REGNO (tmp);
       else
        goto end_call_group;
@@ -1156,7 +1166,7 @@ sched_analyze (struct deps *deps, rtx head, rtx tail)
   rtx loop_notes = 0;
 
   if (current_sched_info->use_cselib)
-    cselib_init ();
+    cselib_init (true);
 
   for (insn = head;; insn = NEXT_INSN (insn))
     {
@@ -1267,7 +1277,7 @@ sched_analyze (struct deps *deps, rtx head, rtx tail)
              || NOTE_LINE_NUMBER (insn) == NOTE_INSN_EH_REGION_END)
            rtx_region = GEN_INT (NOTE_EH_HANDLER (insn));
          else
-           rtx_region = GEN_INT (0);
+           rtx_region = const0_rtx;
 
          loop_notes = alloc_EXPR_LIST (REG_SAVE_NOTE,
                                        rtx_region,