(*REG_SET): Delete old implementation; use bitmap.h.
authorRichard Kenner <kenner@gcc.gnu.org>
Mon, 14 Jul 1997 10:49:30 +0000 (06:49 -0400)
committerRichard Kenner <kenner@gcc.gnu.org>
Mon, 14 Jul 1997 10:49:30 +0000 (06:49 -0400)
(regset_{size,bytes}): Delete.
(regs_live_at_setjmp): Declare.
(EXECUTE_IF_SET_AND_RESET_IN_REG_SET): Delete.

From-SVN: r14421

gcc/basic-block.h

index acd5ba7cf72ddb50be1210087b1e97203dc38198..4614b700380820d9037271a03be4b69043d84492 100644 (file)
@@ -19,98 +19,38 @@ the Free Software Foundation, 59 Temple Place - Suite 330,
 Boston, MA 02111-1307, USA.  */
 
 
-/* Number of bits in each actual element of a regset.  We get slightly
-   better code for reg%bits and reg/bits if bits is unsigned, assuming
-   it is a power of 2.  */
-
-#define REGSET_ELT_BITS ((unsigned) HOST_BITS_PER_WIDE_INT)
-
-/* Type to use for a regset element.  Note that lots of code assumes
-   that the initial part of a regset that contains information on the
-   hard registers is the same format as a HARD_REG_SET.  */
-
-#define REGSET_ELT_TYPE unsigned HOST_WIDE_INT
-
-/* Define the type for a pointer to a set with a bit for each
-   (hard or pseudo) register.  */
-
-typedef REGSET_ELT_TYPE *regset;
-
-/* Size of a regset for the current function,
-   in (1) bytes and (2) elements.  */
-
-extern int regset_bytes;
-extern int regset_size;
-
-/* clear a register set */
-#define CLEAR_REG_SET(TO)                                              \
-do { register REGSET_ELT_TYPE *scan_tp_ = (TO);                                \
-     register int i_;                                                  \
-     for (i_ = 0; i_ < regset_size; i_++)                              \
-       *scan_tp_++ = 0; } while (0)
-
-/* copy a register to another register */
-#define COPY_REG_SET(TO, FROM)                                         \
-do { register REGSET_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM);    \
-     register int i_;                                                  \
-     for (i_ = 0; i_ < regset_size; i_++)                              \
-       *scan_tp_++ = *scan_fp_++; } while (0)
-
-/* complent a register set, storing it in a second register set.  */
-#define COMPL_REG_SET(TO, FROM)                                                \
-do { register REGSET_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM);    \
-     register int i_;                                                  \
-     for (i_ = 0; i_ < regset_size; i_++)                              \
-       *scan_tp_++ = ~ *scan_fp_++; } while (0)
-
-/* and a register set with a second register set.  */
-#define AND_REG_SET(TO, FROM)                                          \
-do { register REGSET_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM);    \
-     register int i_;                                                  \
-     for (i_ = 0; i_ < regset_size; i_++)                              \
-       *scan_tp_++ &= *scan_fp_++; } while (0)
-
-/* and the complement of a register set to a register set.  */
-#define AND_COMPL_REG_SET(TO, FROM)                                    \
-do { register REGSET_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM);    \
-     register int i_;                                                  \
-     for (i_ = 0; i_ < regset_size; i_++)                              \
-       *scan_tp_++ &= ~ *scan_fp_++; } while (0)
-
-/* inclusive or a register set with a second register set.  */
-#define IOR_REG_SET(TO, FROM)                                          \
-do { register REGSET_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM);    \
-     register int i_;                                                  \
-     for (i_ = 0; i_ < regset_size; i_++)                              \
-       *scan_tp_++ |= *scan_fp_++; } while (0)
-
-/* complement two register sets and or in the result into a third.  */
-#define IOR_AND_COMPL_REG_SET(TO, FROM1, FROM2)                                \
-do { register REGSET_ELT_TYPE *scan_tp_ = (TO);                                \
-     register REGSET_ELT_TYPE *scan_fp1_ = (FROM1);                    \
-     register REGSET_ELT_TYPE *scan_fp2_ = (FROM2);                    \
-     register int i_;                                                  \
-     for (i_ = 0; i_ < regset_size; i_++)                              \
-       *scan_tp_++ |= *scan_fp1_++ & ~ *scan_fp2_++; } while (0)
+#include "bitmap.h"
+
+typedef bitmap regset;         /* Head of register set linked list.  */
+
+/* Clear a register set by freeing up the linked list.  */
+#define CLEAR_REG_SET(HEAD) bitmap_clear (HEAD)
+
+/* Copy a register set to another register set.  */
+#define COPY_REG_SET(TO, FROM) bitmap_copy (TO, FROM)
+
+/* `and' a register set with a second register set.  */
+#define AND_REG_SET(TO, FROM) bitmap_operation (TO, TO, FROM, BITMAP_AND)
+
+/* `and' the complement of a register set with a register set.  */
+#define AND_COMPL_REG_SET(TO, FROM) \
+  bitmap_operation (TO, TO, FROM, BITMAP_AND_COMPL)
+
+/* Inclusive or a register set with a second register set.  */
+#define IOR_REG_SET(TO, FROM) bitmap_operation (TO, TO, FROM, BITMAP_IOR)
+
+/* Or into TO the register set FROM1 `and'ed with the complement of FROM2.  */
+#define IOR_AND_COMPL_REG_SET(TO, FROM1, FROM2) \
+  bitmap_ior_and_compl (TO, FROM1, FROM2)
 
 /* Clear a single register in a register set.  */
-#define CLEAR_REGNO_REG_SET(TO, REG)                                   \
-do {                                                                   \
-  register REGSET_ELT_TYPE *tp_ = (TO);                                        \
-  tp_[ (REG) / REGSET_ELT_BITS ]                                       \
-    &= ~ ((REGSET_ELT_TYPE) 1 << ((REG) % REGSET_ELT_BITS)); } while (0);
+#define CLEAR_REGNO_REG_SET(HEAD, REG) bitmap_clear_bit (HEAD, REG)
 
 /* Set a single register in a register set.  */
-#define SET_REGNO_REG_SET(TO, REG)                                     \
-do {                                                                   \
-  register REGSET_ELT_TYPE *tp_ = (TO);                                        \
-  tp_[ (REG) / REGSET_ELT_BITS ]                                       \
-    |= ((REGSET_ELT_TYPE) 1 << ((REG) % REGSET_ELT_BITS)); } while (0);
+#define SET_REGNO_REG_SET(HEAD, REG) bitmap_set_bit (HEAD, REG)
 
 /* Return true if a register is set in a register set.  */
-#define REGNO_REG_SET_P(TO, REG)                                       \
- (((TO)[ (REG) / REGSET_ELT_BITS ]                                     \
-   & (((REGSET_ELT_TYPE)1) << (REG) % REGSET_ELT_BITS)) != 0)
+#define REGNO_REG_SET_P(TO, REG) bitmap_bit_p (TO, REG)
 
 /* Copy the hard registers in a register set to the hard register set.  */
 #define REG_SET_TO_HARD_REG_SET(TO, FROM)                              \
@@ -125,137 +65,30 @@ do {                                                                      \
 /* Loop over all registers in REGSET, starting with MIN, setting REGNUM to the
    register number and executing CODE for all registers that are set. */
 #define EXECUTE_IF_SET_IN_REG_SET(REGSET, MIN, REGNUM, CODE)           \
-do {                                                                   \
-  register int i_ = (MIN) / REGSET_ELT_BITS;                           \
-  register int shift_ = (MIN) % REGSET_ELT_BITS;                       \
-  register REGSET_ELT_TYPE *scan_rs_ = (REGSET) + i_;                  \
-  for ( ; i_ < regset_size; i_++)                                      \
-    {                                                                  \
-      REGSET_ELT_TYPE word_ = *scan_rs_++;                             \
-      if (word_)                                                       \
-       {                                                               \
-         REGSET_ELT_TYPE j_;                                           \
-         REGNUM = (i_ * REGSET_ELT_BITS) + shift_;                     \
-         for (j_ = ((REGSET_ELT_TYPE)1) << shift_;                     \
-              j_ != 0;                                                 \
-              (j_ <<= 1), REGNUM++)                                    \
-           {                                                           \
-             if (word_ & j_)                                           \
-               {                                                       \
-                 CODE;                                                 \
-                 word_ &= ~ j_;                                        \
-                 if (!word_)                                           \
-                   break;                                              \
-               }                                                       \
-           }                                                           \
-       }                                                               \
-      shift_ = 0;                                                      \
-    }                                                                  \
-} while (0)
-
-/* Like EXECUTE_IF_SET_IN_REG_SET, but also clear the register set.  */
-#define EXECUTE_IF_SET_AND_RESET_IN_REG_SET(REGSET, MIN, REGNUM, CODE) \
-do {                                                                   \
-  register int i_ = (MIN) / REGSET_ELT_BITS;                           \
-  register int shift_ = (MIN) % REGSET_ELT_BITS;                       \
-  register REGSET_ELT_TYPE *scan_rs_ = (REGSET) + i_;                  \
-  for ( ; i_ < regset_size; i_++)                                      \
-    {                                                                  \
-      REGSET_ELT_TYPE word_ = *scan_rs_++;                             \
-      if (word_)                                                       \
-       {                                                               \
-         REGSET_ELT_TYPE j_;                                           \
-         REGNUM = (i_ * REGSET_ELT_BITS) + shift_;                     \
-         scan_rs_[-1] = 0;                                             \
-         for (j_ = ((REGSET_ELT_TYPE)1) << shift_;                     \
-              j_ != 0;                                                 \
-              (j_ <<= 1), REGNUM++)                                    \
-           {                                                           \
-             if (word_ & j_)                                           \
-               {                                                       \
-                 CODE;                                                 \
-                 word_ &= ~ j_;                                        \
-                 if (!word_)                                           \
-                   break;                                              \
-               }                                                       \
-           }                                                           \
-       }                                                               \
-      shift_ = 0;                                                      \
-    }                                                                  \
-} while (0)
-
-/* Loop over all registers in REGSET1 and REGSET2, starting with MIN, setting
-   REGNUM to the register number and executing CODE for all registers that are
-   set in both regsets. */
-#define EXECUTE_IF_AND_IN_REG_SET(REGSET1, REGSET2, MIN, REGNUM, CODE) \
-do {                                                                   \
-  register int i_ = (MIN) / REGSET_ELT_BITS;                           \
-  register int shift_ = (MIN) % REGSET_ELT_BITS;                       \
-  register REGSET_ELT_TYPE *scan_rs1_ = (REGSET1) + i_;                        \
-  register REGSET_ELT_TYPE *scan_rs2_ = (REGSET2) + i_;                        \
-  for ( ; i_ < regset_size; i_++)                                      \
-    {                                                                  \
-      REGSET_ELT_TYPE word_ = *scan_rs1_++ & *scan_rs2_++;             \
-      if (word_)                                                       \
-       {                                                               \
-         REGSET_ELT_TYPE j_;                                           \
-         REGNUM = (i_ * REGSET_ELT_BITS) + shift_;                     \
-         for (j_ = ((REGSET_ELT_TYPE)1) << shift_;                     \
-              j_ != 0;                                                 \
-              (j_ <<= 1), REGNUM++)                                    \
-           {                                                           \
-             if (word_ & j_)                                           \
-               {                                                       \
-                 CODE;                                                 \
-                 word_ &= ~ j_;                                        \
-                 if (!word_)                                           \
-                   break;                                              \
-               }                                                       \
-           }                                                           \
-       }                                                               \
-      shift_ = 0;                                                      \
-    }                                                                  \
-} while (0)
+  EXECUTE_IF_SET_IN_BITMAP (REGSET, MIN, REGNUM, CODE)
 
 /* Loop over all registers in REGSET1 and REGSET2, starting with MIN, setting
    REGNUM to the register number and executing CODE for all registers that are
    set in the first regset and not set in the second. */
 #define EXECUTE_IF_AND_COMPL_IN_REG_SET(REGSET1, REGSET2, MIN, REGNUM, CODE) \
-do {                                                                   \
-  register int i_ = (MIN) / REGSET_ELT_BITS;                           \
-  register int shift_ = (MIN) % REGSET_ELT_BITS;                       \
-  register REGSET_ELT_TYPE *scan_rs1_ = (REGSET1) + i_;                        \
-  register REGSET_ELT_TYPE *scan_rs2_ = (REGSET2) + i_;                        \
-  for ( ; i_ < regset_size; i_++)                                      \
-    {                                                                  \
-      REGSET_ELT_TYPE word_ = *scan_rs1_++ & ~ *scan_rs2_++;           \
-      if (word_)                                                       \
-       {                                                               \
-         REGSET_ELT_TYPE j_;                                           \
-         REGNUM = (i_ * REGSET_ELT_BITS) + shift_;                     \
-         for (j_ = ((REGSET_ELT_TYPE)1) << shift_;                     \
-              j_ != 0;                                                 \
-              (j_ <<= 1), REGNUM++)                                    \
-           {                                                           \
-             if (word_ & j_)                                           \
-               {                                                       \
-                 CODE;                                                 \
-                 word_ &= ~ j_;                                        \
-                 if (!word_)                                           \
-                   break;                                              \
-               }                                                       \
-           }                                                           \
-       }                                                               \
-      shift_ = 0;                                                      \
-    }                                                                  \
-} while (0)
+  EXECUTE_IF_AND_COMPL_IN_BITMAP (REGSET1, REGSET2, MIN, REGNUM, CODE)
 
 /* Allocate a register set with oballoc.  */
-#define OBSTACK_ALLOC_REG_SET(OBSTACK)                                 \
-  ((regset) obstack_alloc (OBSTACK, regset_bytes))
+#define OBSTACK_ALLOC_REG_SET(OBSTACK) BITMAP_OBSTACK_ALLOC (OBSTACK)
 
 /* Allocate a register set with alloca.  */
-#define ALLOCA_REG_SET() ((regset) alloca (regset_bytes))
+#define ALLOCA_REG_SET() BITMAP_ALLOCA ()
+
+/* Do any cleanup needed on a regset when it is no longer used.  */
+#define FREE_REG_SET(REGSET) BITMAP_FREE(REGSET)
+
+/* Do any one-time initializations needed for regsets.  */
+#define INIT_ONCE_REG_SET() BITMAP_INIT_ONCE ()
+
+/* Grow any tables needed when the number of registers is calculated
+   or extended.  For the linked list allocation, nothing needs to
+   be done, other than zero the statistics on the first allocation.  */
+#define MAX_REGNO_REG_SET(NUM_REGS, NEW_P, RENUMBER_P)
 
 /* Number of basic blocks in the current function.  */
 
@@ -274,6 +107,10 @@ extern rtx *basic_block_end;
 
 extern regset *basic_block_live_at_start;
 
+/* What registers are live at the setjmp call.  */
+
+extern regset regs_live_at_setjmp;
+
 /* Indexed by n, gives number of basic block that  (REG n) is used in.
    If the value is REG_BLOCK_GLOBAL (-2),
    it means (REG n) is used in more than one basic block.