* haifa-sched.c (schedule_block): Do not count USE and CLOBBER
authorlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 29 May 2002 16:53:46 +0000 (16:53 +0000)
committerlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 29 May 2002 16:53:46 +0000 (16:53 +0000)
        insns against the issue rate.

        * sched-deps.c (sched_create_groups_for_libcalls): New function.
        (sched_analyze): Use it.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@54004 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/haifa-sched.c
gcc/sched-deps.c

index 9ff0f27..26ef675 100644 (file)
@@ -1,3 +1,14 @@
+2002-05-29  Dale Johannesen  <dalej@apple.com>
+            Michael Matz  <matz@kde.org>
+            David Edelsohn  <edesohn@gnu.org>
+            Jeff Law <law@redhat.com>
+
+       * haifa-sched.c (schedule_block): Do not count USE and CLOBBER
+       insns against the issue rate.
+
+       * sched-deps.c (sched_create_groups_for_libcalls): New function.
+       (sched_analyze): Use it.
+
 2002-05-29  Chris Lattner  <sabre@nondot.org>
 
         * ssa.c (rename_insn_1): Rename uses of undefined registers to
@@ -3086,7 +3097,7 @@ doc:
        (mips_expand_prologue, mips_expand_epilogue): Update callers.
        (highpart_shift_operator): Attach ATTRIBUTE_UNUSED to mode argument.
 
-Thu May  9 11:50:09 2002  Jeffrey A Law  (law@cygnus.com)
+Thu May  9 11:50:09 2002  Jeffrey A Law  (law@redhat.com)
 
        * athlon.md, k6.md, pentium.md, ppro.md): New files.
        * i386.md: Move scheduling information into new files.
@@ -4276,7 +4287,7 @@ Tue Apr 30 19:15:36 CEST 2002  Jan Hubicka  <jh@suse.cz>
        (scheduling descriptions): Kill uses of fop1.
        (sse, mmx, fp patterns): Set type and mode properly.
 
-Tue Apr 30 09:31:59 2002  Jeffrey A Law  (law@cygnus.com)
+Tue Apr 30 09:31:59 2002  Jeffrey A Law  (law@redhat.com)
 
        * pa.c (override_options): Default to PA8000 scheduling.
        * doc/invoke.texi (HP-PA options): Mention newly added 7300
index 63a3135..a03b9b3 100644 (file)
@@ -2179,7 +2179,10 @@ schedule_block (b, rgn_n_insns)
            can_issue_more =
              (*targetm.sched.variable_issue) (sched_dump, sched_verbose,
                                               insn, can_issue_more);
-         else
+         /* A naked CLOBBER or USE generates no instruction, so do
+            not count them against the issue rate.  */
+         else if (GET_CODE (PATTERN (insn)) != USE
+                  && GET_CODE (PATTERN (insn)) != CLOBBER)
            can_issue_more--;
 
          schedule_insn (insn, &ready, clock_var);
index 0afb21b..7154635 100644 (file)
@@ -88,6 +88,7 @@ static void flush_pending_lists PARAMS ((struct deps *, rtx, int, int));
 static void sched_analyze_1 PARAMS ((struct deps *, rtx, rtx));
 static void sched_analyze_2 PARAMS ((struct deps *, rtx, rtx));
 static void sched_analyze_insn PARAMS ((struct deps *, rtx, rtx, rtx));
+static void sched_create_groups_for_libcalls PARAMS ((rtx, rtx));
 static rtx group_leader PARAMS ((rtx));
 
 static rtx get_condition PARAMS ((rtx));
@@ -1210,6 +1211,57 @@ sched_analyze_insn (deps, x, insn, loop_notes)
     }
 }
 
+/* Find any libcall sequences between HEAD and TAIL inclusive; set
+   SCHED_GROUP_P appropriately for such sequences.  */
+
+static void
+sched_create_groups_for_libcalls (head, tail)
+     rtx head, tail;
+{
+  rtx insn;
+  int tail_seen_p = 0;
+
+  for (insn = head;; insn = NEXT_INSN (insn))
+    {
+      rtx link, end_seq, set, r0, note;
+      if (INSN_P (insn) && GET_CODE (PATTERN (insn)) == CLOBBER
+         && (r0 = XEXP (PATTERN (insn), 0), GET_CODE (r0) == REG)
+         && (link = find_reg_note (insn, REG_LIBCALL, NULL_RTX)) != 0
+         && (end_seq = XEXP (link, 0)) != 0
+         && INSN_P (end_seq)
+         && (set = single_set (end_seq)) != 0
+         && SET_DEST (set) == r0 && SET_SRC (set) == r0
+         && (note = find_reg_note (end_seq, REG_EQUAL, NULL_RTX)) != 0)
+       {
+         /* We found a libcall block between insn and end_seq.
+            The inner insns should be scheduled in a block.  */
+         rtx inner;
+         /* Paranoia.  */
+         if (insn == tail)
+           tail_seen_p = 1;
+         /* We don't want to set this flag on the initial clobber, because
+            the semantic of SCHED_GROUP_P is to make insn be scheduled
+            together with the previous insn.  */
+         for (inner = NEXT_INSN (insn); inner; inner = NEXT_INSN (inner))
+           {
+             if (INSN_P (inner))
+               set_sched_group_p (inner);
+             /* Paranoia.  */
+             if (inner == tail)
+               tail_seen_p = 1;
+             if (inner == end_seq)
+               break;
+           }
+         /* We should be able to skip the whole lib-call block.
+            Remember that one NEXT_INSN is done in the loop-iteration.  */
+         insn = end_seq;
+       }
+      if (insn == tail || tail_seen_p)
+       break;
+    }
+  return;
+}
+
 /* Analyze every insn between HEAD and TAIL inclusive, creating LOG_LINKS
    for every dependency.  */
 
@@ -1357,6 +1409,10 @@ sched_analyze (deps, head, tail)
        {
          if (current_sched_info->use_cselib)
            cselib_finish ();
+
+         if (! reload_completed)
+           sched_create_groups_for_libcalls (head, tail);
+
          return;
        }
     }