OSDN Git Service

(schedule_block): Before scheduling, add code to make all
authorwilson <wilson@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 8 Oct 1996 00:35:03 +0000 (00:35 +0000)
committerwilson <wilson@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 8 Oct 1996 00:35:03 +0000 (00:35 +0000)
call used regs that are not fixed or global live when we see a
CALL_INSN.  During scheduling, change existing code to use same test.

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

gcc/sched.c

index c186cfc..71cf52f 100644 (file)
@@ -3514,6 +3514,26 @@ schedule_block (b, file)
                        sched_note_set (b, XVECEXP (PATTERN (insn), 0, j), 0);
                  }
 
+               /* Each call clobbers (makes live) all call-clobbered regs
+                  that are not global or fixed.  Note that the function-value
+                  reg is a call_clobbered reg.  */
+
+               if (GET_CODE (insn) == CALL_INSN)
+                 {
+                   int j;
+                   for (j = 0; j < FIRST_PSEUDO_REGISTER; j++)
+                     if (call_used_regs[j] && ! global_regs[j]
+                         && ! fixed_regs[j])
+                       {
+                         register int offset = j / REGSET_ELT_BITS;
+                         register REGSET_ELT_TYPE bit
+                           = (REGSET_ELT_TYPE) 1 << (j % REGSET_ELT_BITS);
+
+                         bb_live_regs[offset] |= bit;
+                         bb_dead_regs[offset] &= ~bit;
+                       }
+                 }
+
                for (link = REG_NOTES (insn); link; link = XEXP (link, 1))
                  {
                    if ((REG_NOTE_KIND (link) == REG_DEAD
@@ -3615,6 +3635,26 @@ schedule_block (b, file)
                  sched_note_set (b, XVECEXP (PATTERN (insn), 0, j), 0);
            }
 
+         /* Each call clobbers (makes live) all call-clobbered regs that are
+            not global or fixed.  Note that the function-value reg is a
+            call_clobbered reg.  */
+
+         if (GET_CODE (insn) == CALL_INSN)
+           {
+             int j;
+             for (j = 0; j < FIRST_PSEUDO_REGISTER; j++)
+               if (call_used_regs[j] && ! global_regs[j]
+                   && ! fixed_regs[j])
+                 {
+                   register int offset = j / REGSET_ELT_BITS;
+                   register REGSET_ELT_TYPE bit
+                     = (REGSET_ELT_TYPE) 1 << (j % REGSET_ELT_BITS);
+
+                   bb_live_regs[offset] |= bit;
+                   bb_dead_regs[offset] &= ~bit;
+                 }
+           }
+
          /* Need to know what registers this insn kills.  */
          for (prev = 0, link = REG_NOTES (insn); link; link = next)
            {
@@ -3854,12 +3894,12 @@ schedule_block (b, file)
                {
                  register struct sometimes *p;
 
-                 /* A call kills all call used and global registers, except
-                    for those mentioned in the call pattern which will be
-                    made live again later.  */
+                 /* A call kills all call used registers that are not
+                    global or fixed, except for those mentioned in the call
+                    pattern which will be made live again later.  */
                  for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
-                   if ((call_used_regs[i] && ! fixed_regs[i])
-                       || global_regs[i])
+                   if (call_used_regs[i] && ! global_regs[i]
+                       && ! fixed_regs[i])
                      {
                        register int offset = i / REGSET_ELT_BITS;
                        register REGSET_ELT_TYPE bit