expr.c (expand_expr_real_1): Use add_to_hard_reg_set function instead of loop.
authorAnatoly Sokolov <aesok@post.ru>
Sat, 9 Apr 2011 19:10:45 +0000 (23:10 +0400)
committerAnatoly Sokolov <aesok@gcc.gnu.org>
Sat, 9 Apr 2011 19:10:45 +0000 (23:10 +0400)
* expr.c (expand_expr_real_1): Use add_to_hard_reg_set function
instead of loop.
* sel-sched.c (mark_unavailable_hard_regs): Likewise.
* function.c (record_hard_reg_sets): Likewise.
* ira.c (compute_regs_asm_clobbered): Likewise.
* sched-deps.c (sched_analyze_1): Likewise.
* reload1.c (mark_reload_reg_in_use, choose_reload_regs): Likewise.

From-SVN: r172231

gcc/ChangeLog
gcc/expr.c
gcc/function.c
gcc/ira.c
gcc/reload1.c
gcc/sched-deps.c
gcc/sel-sched.c

index ea76776a23eac3d2976d85fa53713d281da2a45d..2ec51f2346c9be52e90743ae6629e30c3ed13efc 100644 (file)
@@ -1,3 +1,13 @@
+2011-04-09  Anatoly Sokolov  <aesok@post.ru>
+
+       * expr.c (expand_expr_real_1): Use add_to_hard_reg_set function
+       instead of loop.
+       * sel-sched.c (mark_unavailable_hard_regs): Likewise.
+       * function.c (record_hard_reg_sets): Likewise.
+       * ira.c (compute_regs_asm_clobbered): Likewise.
+       * sched-deps.c (sched_analyze_1): Likewise.
+       * reload1.c (mark_reload_reg_in_use, choose_reload_regs): Likewise.
+
 2011-04-09  Xinliang David Li  <davidxl@google.com>
 
        PR tree-optimization/PR48484
index 6dc45666dad6b40825ee663dc5e3f621a5bfedc8..491d2b13e6a843d0187b65751b68dc96fa0071a6 100644 (file)
@@ -8451,18 +8451,11 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
       gcc_assert (decl_rtl);
       decl_rtl = copy_rtx (decl_rtl);
       /* Record writes to register variables.  */
-      if (modifier == EXPAND_WRITE && REG_P (decl_rtl)
-         && REGNO (decl_rtl) < FIRST_PSEUDO_REGISTER)
-       {
-           int i = REGNO (decl_rtl);
-           int nregs = hard_regno_nregs[i][GET_MODE (decl_rtl)];
-           while (nregs)
-             {
-               SET_HARD_REG_BIT (crtl->asm_clobbers, i);
-               i++;
-               nregs--;
-             }
-       }
+      if (modifier == EXPAND_WRITE
+         && REG_P (decl_rtl)
+         && HARD_REGISTER_P (decl_rtl))
+        add_to_hard_reg_set (&crtl->asm_clobbers,
+                            GET_MODE (decl_rtl), REGNO (decl_rtl));
 
       /* Ensure variable marked as used even if it doesn't go through
         a parser.  If it hasn't be used yet, write out an external
index 14d21c97a42595d3041aa231a7973882feb37bb3..c292282070ce4ee49bf5235ce0a90497d2f94611 100644 (file)
@@ -2912,12 +2912,8 @@ static void
 record_hard_reg_sets (rtx x, const_rtx pat ATTRIBUTE_UNUSED, void *data)
 {
   HARD_REG_SET *pset = (HARD_REG_SET *)data;
-  if (REG_P (x) && REGNO (x) < FIRST_PSEUDO_REGISTER)
-    {
-      int nregs = hard_regno_nregs[REGNO (x)][GET_MODE (x)];
-      while (nregs-- > 0)
-       SET_HARD_REG_BIT (*pset, REGNO (x) + nregs);
-    }
+  if (REG_P (x) && HARD_REGISTER_P (x))
+    add_to_hard_reg_set (pset, GET_MODE (x), REGNO (x));
 }
 
 /* A subroutine of assign_parms.  Allocate a pseudo to hold the current
index 79deab6344ddf84a15654015bcba774abbc09e78..719473213c8d07400906f12ac6da9a794586eacd 100644 (file)
--- a/gcc/ira.c
+++ b/gcc/ira.c
@@ -1724,16 +1724,10 @@ compute_regs_asm_clobbered (void)
              {
                df_ref def = *def_rec;
                unsigned int dregno = DF_REF_REGNO (def);
-               if (dregno < FIRST_PSEUDO_REGISTER)
-                 {
-                   unsigned int i;
-                   enum machine_mode mode = GET_MODE (DF_REF_REAL_REG (def));
-                   unsigned int end = dregno
-                     + hard_regno_nregs[dregno][mode] - 1;
-
-                   for (i = dregno; i <= end; ++i)
-                     SET_HARD_REG_BIT(crtl->asm_clobbers, i);
-                 }
+               if (HARD_REGISTER_NUM_P (dregno))
+                 add_to_hard_reg_set (&crtl->asm_clobbers,
+                                      GET_MODE (DF_REF_REAL_REG (def)),
+                                      dregno);
              }
        }
     }
index 9b11cfb5c512668039fc6077416e8b581cb71755..b4f3aec12dd0e836cde01327541525724e7cfdc9 100644 (file)
@@ -4958,60 +4958,54 @@ static void
 mark_reload_reg_in_use (unsigned int regno, int opnum, enum reload_type type,
                        enum machine_mode mode)
 {
-  unsigned int nregs = hard_regno_nregs[regno][mode];
-  unsigned int i;
-
-  for (i = regno; i < nregs + regno; i++)
+  switch (type)
     {
-      switch (type)
-       {
-       case RELOAD_OTHER:
-         SET_HARD_REG_BIT (reload_reg_used, i);
-         break;
-
-       case RELOAD_FOR_INPUT_ADDRESS:
-         SET_HARD_REG_BIT (reload_reg_used_in_input_addr[opnum], i);
-         break;
+    case RELOAD_OTHER:
+      add_to_hard_reg_set (&reload_reg_used, mode, regno);
+      break;
 
-       case RELOAD_FOR_INPADDR_ADDRESS:
-         SET_HARD_REG_BIT (reload_reg_used_in_inpaddr_addr[opnum], i);
-         break;
+    case RELOAD_FOR_INPUT_ADDRESS:
+      add_to_hard_reg_set (&reload_reg_used_in_input_addr[opnum], mode, regno);
+      break;
 
-       case RELOAD_FOR_OUTPUT_ADDRESS:
-         SET_HARD_REG_BIT (reload_reg_used_in_output_addr[opnum], i);
-         break;
+    case RELOAD_FOR_INPADDR_ADDRESS:
+      add_to_hard_reg_set (&reload_reg_used_in_inpaddr_addr[opnum], mode, regno);
+      break;
 
-       case RELOAD_FOR_OUTADDR_ADDRESS:
-         SET_HARD_REG_BIT (reload_reg_used_in_outaddr_addr[opnum], i);
-         break;
+    case RELOAD_FOR_OUTPUT_ADDRESS:
+      add_to_hard_reg_set (&reload_reg_used_in_output_addr[opnum], mode, regno);
+      break;
 
-       case RELOAD_FOR_OPERAND_ADDRESS:
-         SET_HARD_REG_BIT (reload_reg_used_in_op_addr, i);
-         break;
+    case RELOAD_FOR_OUTADDR_ADDRESS:
+      add_to_hard_reg_set (&reload_reg_used_in_outaddr_addr[opnum], mode, regno);
+      break;
 
-       case RELOAD_FOR_OPADDR_ADDR:
-         SET_HARD_REG_BIT (reload_reg_used_in_op_addr_reload, i);
-         break;
+    case RELOAD_FOR_OPERAND_ADDRESS:
+      add_to_hard_reg_set (&reload_reg_used_in_op_addr, mode, regno);
+      break;
 
-       case RELOAD_FOR_OTHER_ADDRESS:
-         SET_HARD_REG_BIT (reload_reg_used_in_other_addr, i);
-         break;
+    case RELOAD_FOR_OPADDR_ADDR:
+      add_to_hard_reg_set (&reload_reg_used_in_op_addr_reload, mode, regno);
+      break;
 
-       case RELOAD_FOR_INPUT:
-         SET_HARD_REG_BIT (reload_reg_used_in_input[opnum], i);
-         break;
+    case RELOAD_FOR_OTHER_ADDRESS:
+      add_to_hard_reg_set (&reload_reg_used_in_other_addr, mode, regno);
+      break;
 
-       case RELOAD_FOR_OUTPUT:
-         SET_HARD_REG_BIT (reload_reg_used_in_output[opnum], i);
-         break;
+    case RELOAD_FOR_INPUT:
+      add_to_hard_reg_set (&reload_reg_used_in_input[opnum], mode, regno);
+      break;
 
-       case RELOAD_FOR_INSN:
-         SET_HARD_REG_BIT (reload_reg_used_in_insn, i);
-         break;
-       }
+    case RELOAD_FOR_OUTPUT:
+      add_to_hard_reg_set (&reload_reg_used_in_output[opnum], mode, regno);
+      break;
 
-      SET_HARD_REG_BIT (reload_reg_used_at_all, i);
+    case RELOAD_FOR_INSN:
+      add_to_hard_reg_set (&reload_reg_used_in_insn,  mode, regno);
+      break;
     }
+
+  add_to_hard_reg_set (&reload_reg_used_at_all, mode, regno);
 }
 
 /* Similarly, but show REGNO is no longer in use for a reload.  */
@@ -6946,11 +6940,7 @@ choose_reload_regs (struct insn_chain *chain)
                               nregno + nr);
 
          if (i >= 0)
-           {
-             nr = hard_regno_nregs[i][rld[r].mode];
-             while (--nr >= 0)
-               SET_HARD_REG_BIT (reg_is_output_reload, i + nr);
-           }
+           add_to_hard_reg_set (&reg_is_output_reload, rld[r].mode, i);
 
          gcc_assert (rld[r].when_needed == RELOAD_OTHER
                      || rld[r].when_needed == RELOAD_FOR_OUTPUT
index 393e651f3df6c6d0d558f7c3579df60593954cf6..6abef8b9f4db63fba69cd8c136751f311806186b 100644 (file)
@@ -1,7 +1,8 @@
 /* Instruction scheduling pass.  This file computes dependencies between
    instructions.
    Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998,
-   1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+   1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
+   2011
    Free Software Foundation, Inc.
    Contributed by Michael Tiemann (tiemann@cygnus.com) Enhanced by,
    and currently maintained by, Jim Wilson (wilson@cygnus.com)
@@ -2259,16 +2260,12 @@ sched_analyze_1 (struct deps_desc *deps, rtx x, rtx insn)
       /* Treat all writes to a stack register as modifying the TOS.  */
       if (regno >= FIRST_STACK_REG && regno <= LAST_STACK_REG)
        {
-         int nregs;
-
          /* Avoid analyzing the same register twice.  */
          if (regno != FIRST_STACK_REG)
            sched_analyze_reg (deps, FIRST_STACK_REG, mode, code, insn);
 
-         nregs = hard_regno_nregs[FIRST_STACK_REG][mode];
-         while (--nregs >= 0)
-           SET_HARD_REG_BIT (implicit_reg_pending_uses,
-                             FIRST_STACK_REG + nregs);
+         add_to_hard_reg_set (&implicit_reg_pending_uses, mode,
+                              FIRST_STACK_REG);
        }
 #endif
     }
index e298208ddb573e10a371980a417860ec22fa4c14..8a012acec9d313ab0d1ac5423a3534f7f9a62a76 100644 (file)
@@ -1263,17 +1263,12 @@ mark_unavailable_hard_regs (def_t def, struct reg_rename *reg_rename_p,
      FIXME: it is enough to do this once per all original defs.  */
   if (frame_pointer_needed)
     {
-      int i;
-
-      for (i = hard_regno_nregs[FRAME_POINTER_REGNUM][Pmode]; i--;)
-       SET_HARD_REG_BIT (reg_rename_p->unavailable_hard_regs,
-                          FRAME_POINTER_REGNUM + i);
+      add_to_hard_reg_set (&reg_rename_p->unavailable_hard_regs,
+                          Pmode, FRAME_POINTER_REGNUM);
 
-#if !HARD_FRAME_POINTER_IS_FRAME_POINTER
-      for (i = hard_regno_nregs[HARD_FRAME_POINTER_REGNUM][Pmode]; i--;)
-       SET_HARD_REG_BIT (reg_rename_p->unavailable_hard_regs,
-                          HARD_FRAME_POINTER_REGNUM + i);
-#endif
+      if (!HARD_FRAME_POINTER_IS_FRAME_POINTER)
+        add_to_hard_reg_set (&reg_rename_p->unavailable_hard_regs, 
+                            Pmode, HARD_FRAME_POINTER_IS_FRAME_POINTER);
     }
 
 #ifdef STACK_REGS