reorg.c (fill_slots_from_thread): Don't steal delay list from target if condition...
authorJeff Law <law@gcc.gnu.org>
Sun, 1 Mar 1998 17:24:18 +0000 (10:24 -0700)
committerJeff Law <law@gcc.gnu.org>
Sun, 1 Mar 1998 17:24:18 +0000 (10:24 -0700)
        * reorg.c (fill_slots_from_thread): Don't steal delay list from target
        if condition code of jump conflicts with opposite_needed.
        * reorg.c (fill_slots_from_thread): Mark resources referenced in
        opposite_needed thread.  Return delay_list even when cannot get
        any more delay insns from end of subroutine.
        * reorg.c (fill_slots_from_thread): New parameter, delay_list.
        All callers changed.

From-SVN: r18348

gcc/ChangeLog
gcc/reorg.c

index ac4c1945ee80275b380b4ae65a92ce14c2c595e0..f92143ef3fb95da58a06104e7c521ed1106ebc58 100644 (file)
@@ -1,4 +1,18 @@
-Sun Feb 22 16:23:46 1998  Bruno Haible  <bruno@linuix.mathematik.uni-karlsruhe.de>
+Sun Mar  1 18:25:49 1998  Michael P. Hayes  <michaelh@ongaonga.chch.cri.nz>
+
+       * reorg.c (fill_slots_from_thread): Don't steal delay list from target
+       if condition code of jump conflicts with opposite_needed. 
+
+       * reorg.c (fill_slots_from_thread): Mark resources referenced in
+       opposite_needed thread.  Return delay_list even when cannot get
+       any more delay insns from end of subroutine.
+
+Sun Mar  1 18:26:21 1998  Ken Rose (rose@acm.org)
+
+       * reorg.c (fill_slots_from_thread): New parameter, delay_list.
+       All callers changed.
+
+Sun Mar  1 18:25:37 1998  Bruno Haible  <bruno@linuix.mathematik.uni-karlsruhe.de>
 
        * frame.c (start_fde_sort, fde_split, heapsort, fde_merge,
        end_fde_sort): New functions for fast sorting of an FDE array.
index ce834f2c3292c6327a71a08d4940eb11eceec118..9b7b3a5eb1fee1b26e602293cc8a957af4f97f5b 100644 (file)
@@ -1,5 +1,5 @@
 /* Perform instruction reorganizations for delay slot filling.
-   Copyright (C) 1992, 93, 94, 95, 96, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1992, 93, 94, 95, 96, 97, 1998 Free Software Foundation, Inc.
    Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu).
    Hacked by Michael Tiemann (tiemann@cygnus.com).
 
@@ -267,7 +267,7 @@ static rtx next_insn_no_annul       PROTO((rtx));
 static void mark_target_live_regs PROTO((rtx, struct resources *));
 static void fill_simple_delay_slots PROTO((int));
 static rtx fill_slots_from_thread PROTO((rtx, rtx, rtx, rtx, int, int,
-                                        int, int, int *));
+                                        int, int, int *, rtx));
 static void fill_eager_delay_slots PROTO((void));
 static void relax_delay_slots  PROTO((rtx));
 static void make_return_insns  PROTO((rtx));
@@ -275,7 +275,7 @@ static int redirect_with_delay_slots_safe_p PROTO ((rtx, rtx, rtx));
 static int redirect_with_delay_list_safe_p PROTO ((rtx, rtx, rtx));
 \f
 /* Given X, some rtl, and RES, a pointer to a `struct resource', mark
-   which resources are references by the insn.  If INCLUDE_CALLED_ROUTINE
+   which resources are references by the insn.  If INCLUDE_DELAYED_EFFECTS
    is TRUE, resources used by the called routine will be included for
    CALL_INSNs.  */
 
@@ -491,9 +491,10 @@ mark_referenced_resources (x, res, include_delayed_effects)
       }
 }
 \f
-/* Given X, a part of an insn, and a pointer to a `struct resource', RES,
-   indicate which resources are modified by the insn. If INCLUDE_CALLED_ROUTINE
-   is nonzero, also mark resources potentially set by the called routine.
+/* Given X, a part of an insn, and a pointer to a `struct resource',
+   RES, indicate which resources are modified by the insn. If
+   INCLUDE_DELAYED_EFFECTS is nonzero, also mark resources potentially
+   set by the called routine.
 
    If IN_DEST is nonzero, it means we are inside a SET.  Otherwise,
    objects are being referenced instead of set.
@@ -747,7 +748,7 @@ resource_conflicts_p (res1, res2)
 }
 
 /* Return TRUE if any resource marked in RES, a `struct resources', is
-   referenced by INSN.  If INCLUDE_CALLED_ROUTINE is set, return if the called
+   referenced by INSN.  If INCLUDE_DELAYED_EFFECTS is set, return if the called
    routine is using those resources.
 
    We compute this by computing all the resources referenced by INSN and
@@ -769,7 +770,7 @@ insn_references_resource_p (insn, res, include_delayed_effects)
 }
 
 /* Return TRUE if INSN modifies resources that are marked in RES.
-   INCLUDE_CALLED_ROUTINE is set if the actions of that routine should be
+   INCLUDE_DELAYED_EFFECTS is set if the actions of that routine should be
    included.   CC0 is only modified if it is explicitly set; see comments
    in front of mark_set_resources for details.  */
 
@@ -3335,7 +3336,8 @@ fill_simple_delay_slots (non_jumps_p)
                                    NULL, 1, 1,
                                    own_thread_p (JUMP_LABEL (insn),
                                                  JUMP_LABEL (insn), 0),
-                                   slots_to_fill, &slots_filled);
+                                   slots_to_fill, &slots_filled,
+                                   delay_list);
 
       if (delay_list)
        unfilled_slots_base[i]
@@ -3464,7 +3466,7 @@ fill_simple_delay_slots (non_jumps_p)
 static rtx
 fill_slots_from_thread (insn, condition, thread, opposite_thread, likely,
                        thread_if_true, own_thread,
-                       slots_to_fill, pslots_filled)
+                       slots_to_fill, pslots_filled, delay_list)
      rtx insn;
      rtx condition;
      rtx thread, opposite_thread;
@@ -3472,9 +3474,9 @@ fill_slots_from_thread (insn, condition, thread, opposite_thread, likely,
      int thread_if_true;
      int own_thread;
      int slots_to_fill, *pslots_filled;
+     rtx delay_list;
 {
   rtx new_thread;
-  rtx delay_list = 0;
   struct resources opposite_needed, set, needed;
   rtx trial;
   int lose = 0;
@@ -3491,7 +3493,7 @@ fill_slots_from_thread (insn, condition, thread, opposite_thread, likely,
   /* If our thread is the end of subroutine, we can't get any delay
      insns from that.  */
   if (thread == 0)
-    return 0;
+      return delay_list;
 
   /* If this is an unconditional branch, nothing is needed at the
      opposite thread.  Otherwise, compute what is needed there.  */
@@ -3648,6 +3650,8 @@ fill_slots_from_thread (insn, condition, thread, opposite_thread, likely,
 
                  delay_list = add_to_delay_list (temp, delay_list);
 
+                 mark_set_resources (trial, &opposite_needed, 0, 1);
+
                  if (slots_to_fill == ++(*pslots_filled))
                    {
                      /* Even though we have filled all the slots, we
@@ -3717,7 +3721,9 @@ fill_slots_from_thread (insn, condition, thread, opposite_thread, likely,
     {
       /* If this is the `true' thread, we will want to follow the jump,
         so we can only do this if we have taken everything up to here.  */
-      if (thread_if_true && trial == new_thread)
+      if (thread_if_true && trial == new_thread
+         && ! insn_references_resource_p (XVECEXP (PATTERN (trial), 0, 0),
+                                          &opposite_needed, 0))
        delay_list
          = steal_delay_list_from_target (insn, condition, PATTERN (trial),
                                          delay_list, &set, &needed,
@@ -3916,7 +3922,7 @@ fill_eager_delay_slots ()
            = fill_slots_from_thread (insn, condition, insn_at_target,
                                      fallthrough_insn, prediction == 2, 1,
                                      own_target,
-                                     slots_to_fill, &slots_filled);
+                                     slots_to_fill, &slots_filled, delay_list);
 
          if (delay_list == 0 && own_fallthrough)
            {
@@ -3931,7 +3937,8 @@ fill_eager_delay_slots ()
                = fill_slots_from_thread (insn, condition, fallthrough_insn,
                                          insn_at_target, 0, 0,
                                          own_fallthrough,
-                                         slots_to_fill, &slots_filled);
+                                         slots_to_fill, &slots_filled,
+                                         delay_list);
            }
        }
       else
@@ -3948,7 +3955,8 @@ fill_eager_delay_slots ()
              = fill_slots_from_thread (insn, condition, insn_at_target,
                                        next_active_insn (insn), 0, 1,
                                        own_target,
-                                       slots_to_fill, &slots_filled);
+                                       slots_to_fill, &slots_filled,
+                                       delay_list);
        }
 
       if (delay_list)