OSDN Git Service

* config/i386/i386-protos.h (ix86_split_fp_branch): New rtx
[pf3gnuchains/gcc-fork.git] / gcc / global.c
index 5478cd1..5e1ca72 100644 (file)
@@ -24,13 +24,11 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 #include "system.h"
 #include "coretypes.h"
 #include "tm.h"
-
 #include "machmode.h"
 #include "hard-reg-set.h"
 #include "rtl.h"
 #include "tm_p.h"
 #include "flags.h"
-#include "basic-block.h"
 #include "regs.h"
 #include "function.h"
 #include "insn-config.h"
@@ -469,12 +467,12 @@ global_alloc (FILE *file)
        && (! current_function_has_nonlocal_label
            || REG_N_CALLS_CROSSED (i) == 0))
       {
-       if (reg_renumber[i] < 0 && reg_may_share[i] && reg_allocno[reg_may_share[i]] >= 0)
+       if (reg_renumber[i] < 0
+           && reg_may_share[i] && reg_allocno[reg_may_share[i]] >= 0)
          reg_allocno[i] = reg_allocno[reg_may_share[i]];
        else
          reg_allocno[i] = max_allocno++;
-       if (REG_LIVE_LENGTH (i) == 0)
-         abort ();
+       gcc_assert (REG_LIVE_LENGTH (i));
       }
     else
       reg_allocno[i] = -1;
@@ -669,7 +667,7 @@ allocno_compare (const void *v1p, const void *v2p)
 static void
 global_conflicts (void)
 {
-  int i;
+  unsigned i;
   basic_block b;
   rtx insn;
   int *block_start_allocnos;
@@ -695,25 +693,25 @@ global_conflicts (void)
         since one hard reg can be used with various sizes.
         Therefore, we must require that all the hard regs
         implicitly live as part of a multi-word hard reg
-        are explicitly marked in basic_block_live_at_start.  */
+        be explicitly marked in basic_block_live_at_start.  */
 
       {
        regset old = b->global_live_at_start;
        int ax = 0;
+       reg_set_iterator rsi;
 
        REG_SET_TO_HARD_REG_SET (hard_regs_live, old);
-       EXECUTE_IF_SET_IN_REG_SET (old, FIRST_PSEUDO_REGISTER, i,
-                                  {
-                                    int a = reg_allocno[i];
-                                    if (a >= 0)
-                                      {
-                                        SET_ALLOCNO_LIVE (a);
-                                        block_start_allocnos[ax++] = a;
-                                      }
-                                    else if ((a = reg_renumber[i]) >= 0)
-                                      mark_reg_live_nc
-                                        (a, PSEUDO_REGNO_MODE (i));
-                                  });
+       EXECUTE_IF_SET_IN_REG_SET (old, FIRST_PSEUDO_REGISTER, i, rsi)
+         {
+           int a = reg_allocno[i];
+           if (a >= 0)
+             {
+               SET_ALLOCNO_LIVE (a);
+               block_start_allocnos[ax++] = a;
+             }
+           else if ((a = reg_renumber[i]) >= 0)
+             mark_reg_live_nc (a, PSEUDO_REGNO_MODE (i));
+         }
 
        /* Record that each allocno now live conflicts with each hard reg
           now live.
@@ -734,7 +732,7 @@ global_conflicts (void)
                   evaluates X.
 
                3. Either X or Y is not evaluated on the path to P
-                  (ie it is used uninitialized) and thus the
+                  (i.e. it is used uninitialized) and thus the
                   conflict can be ignored.
 
            In cases #1 and #2 the conflict will be recorded when we
@@ -748,8 +746,9 @@ global_conflicts (void)
           regs live across such edges.  */
        {
          edge e;
+         edge_iterator ei;
 
-         for (e = b->pred; e ; e = e->pred_next)
+         FOR_EACH_EDGE (e, ei, b->preds)
            if (e->flags & EDGE_ABNORMAL)
              break;
 
@@ -1805,9 +1804,8 @@ build_insn_chain (rtx first)
   struct insn_chain **p = &reload_insn_chain;
   struct insn_chain *prev = 0;
   basic_block b = ENTRY_BLOCK_PTR->next_bb;
-  regset_head live_relevant_regs_head;
 
-  live_relevant_regs = INITIALIZE_REG_SET (live_relevant_regs_head);
+  live_relevant_regs = ALLOC_REG_SET (&reg_obstack);
 
   for (; first; first = NEXT_INSN (first))
     {
@@ -1815,18 +1813,18 @@ build_insn_chain (rtx first)
 
       if (first == BB_HEAD (b))
        {
-         int i;
+         unsigned i;
+         bitmap_iterator bi;
 
          CLEAR_REG_SET (live_relevant_regs);
 
-         EXECUTE_IF_SET_IN_BITMAP
-           (b->global_live_at_start, 0, i,
-            {
-              if (i < FIRST_PSEUDO_REGISTER
-                  ? ! TEST_HARD_REG_BIT (eliminable_regset, i)
-                  : reg_renumber[i] >= 0)
-                SET_REGNO_REG_SET (live_relevant_regs, i);
-            });
+         EXECUTE_IF_SET_IN_BITMAP (b->global_live_at_start, 0, i, bi)
+           {
+             if (i < FIRST_PSEUDO_REGISTER
+                 ? ! TEST_HARD_REG_BIT (eliminable_regset, i)
+                 : reg_renumber[i] >= 0)
+               SET_REGNO_REG_SET (live_relevant_regs, i);
+           }
        }
 
       if (!NOTE_P (first) && !BARRIER_P (first))
@@ -1886,14 +1884,15 @@ build_insn_chain (rtx first)
         the previous real insn is a JUMP_INSN.  */
       if (b == EXIT_BLOCK_PTR)
        {
-         for (first = NEXT_INSN (first) ; first; first = NEXT_INSN (first))
-           if (INSN_P (first)
-               && GET_CODE (PATTERN (first)) != USE
-               && ! ((GET_CODE (PATTERN (first)) == ADDR_VEC
-                      || GET_CODE (PATTERN (first)) == ADDR_DIFF_VEC)
-                     && prev_real_insn (first) != 0
-                     && JUMP_P (prev_real_insn (first))))
-             abort ();
+#ifdef ENABLE_CHECKING
+         for (first = NEXT_INSN (first); first; first = NEXT_INSN (first))
+           gcc_assert (!INSN_P (first)
+                       || GET_CODE (PATTERN (first)) == USE
+                       || ((GET_CODE (PATTERN (first)) == ADDR_VEC
+                            || GET_CODE (PATTERN (first)) == ADDR_DIFF_VEC)
+                           && prev_real_insn (first) != 0
+                           && JUMP_P (prev_real_insn (first))));
+#endif
          break;
        }
     }
@@ -2304,8 +2303,8 @@ modify_bb_reg_pav (basic_block bb, basic_block pred, bool changed_p)
   bb_pavin = bb_info->pavin;
   bb_pavout = bb_info->pavout;
   if (pred->index != ENTRY_BLOCK)
-    bitmap_a_or_b (bb_pavin, bb_pavin, BB_INFO (pred)->pavout);
-  changed_p |= bitmap_union_of_diff (bb_pavout, bb_info->avloc,
+    bitmap_ior_into (bb_pavin, BB_INFO (pred)->pavout);
+  changed_p |= bitmap_ior_and_compl (bb_pavout, bb_info->avloc,
                                     bb_pavin, bb_info->killed);
   return changed_p;
 }
@@ -2338,12 +2337,14 @@ calculate_reg_pav (void)
       sbitmap_zero (wset);
       for (i = 0; i < nel; i++)
        {
+         edge_iterator ei;
+
          bb = bb_array [i];
          changed_p = 0;
-         for (e = bb->pred; e; e = e->pred_next)
+         FOR_EACH_EDGE (e, ei, bb->preds)
            changed_p = modify_bb_reg_pav (bb, e->src, changed_p);
          if (changed_p)
-           for (e = bb->succ; e; e = e->succ_next)
+           FOR_EACH_EDGE (e, ei, bb->succs)
              {
                succ = e->dest;
                if (succ->index != EXIT_BLOCK && !TEST_BIT (wset, succ->index))
@@ -2401,14 +2402,14 @@ modify_reg_pav (void)
         insn if the pseudo-register is used first time in given BB
         and not lived at the BB start.  To prevent this we don't
         change life information for such pseudo-registers.  */
-      bitmap_a_or_b (bb_info->pavin, bb_info->pavin, bb_info->earlyclobber);
+      bitmap_ior_into (bb_info->pavin, bb_info->earlyclobber);
 #ifdef STACK_REGS
       /* We can not use the same stack register for uninitialized
         pseudo-register and another living pseudo-register because if the
         uninitialized pseudo-register dies, subsequent pass reg-stack
         will be confused (it will believe that the other register
         dies).  */
-      bitmap_a_or_b (bb_info->pavin, bb_info->pavin, stack_regs);
+      bitmap_ior_into (bb_info->pavin, stack_regs);
 #endif
     }
 #ifdef STACK_REGS
@@ -2440,10 +2441,8 @@ make_accurate_live_analysis (void)
     {
       bb_info = BB_INFO (bb);
       
-      bitmap_a_and_b (bb->global_live_at_start, bb->global_live_at_start,
-                     bb_info->pavin);
-      bitmap_a_and_b (bb->global_live_at_end, bb->global_live_at_end,
-                     bb_info->pavout);
+      bitmap_and_into (bb->global_live_at_start, bb_info->pavin);
+      bitmap_and_into (bb->global_live_at_end, bb_info->pavout);
     }
   free_bb_info ();
 }