summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog32
-rw-r--r--gcc/bt-load.c19
-rw-r--r--gcc/cfgcleanup.c8
-rw-r--r--gcc/config/sh/sh.c30
-rw-r--r--gcc/df-problems.c9
-rw-r--r--gcc/global.c22
-rw-r--r--gcc/hard-reg-set.h209
-rw-r--r--gcc/local-alloc.c56
-rw-r--r--gcc/reg-stack.c9
-rw-r--r--gcc/regclass.c86
-rw-r--r--gcc/reload1.c5
-rw-r--r--gcc/struct-equiv.c8
12 files changed, 275 insertions, 218 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 7d46605eb63..d65adea1642 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,35 @@
+2007-05-22 Richard Sandiford <richard@codesourcery.com>
+
+ * hard-reg-set.h (GO_IF_HARD_REG_SUBSET, GO_IF_HARD_REG_EQUAL): Delete
+ in favor of...
+ (hard_reg_subset_p, hard_reg_sets_equal_p, hard_reg_sets_intersect_p)
+ (hard_reg_set_empty_p): ...these new functions.
+ * bt-load.c (choose_btr): Use hard_reg_subset_p instead of
+ GO_IF_HARD_REG_SUBSET.
+ * cfgcleanup.c (old_insns_match_p): Use hard_reg_sets_equal_p
+ instead of GO_IF_HARD_REG_EQUAL.
+ * df-problems.c (df_urec_local_compute): Use hard_reg_set_empty_p
+ instead of GO_IF_HARD_REG_EQUAL.
+ * global.c (find_reg): Use hard_reg_set_empty_p instead of
+ GO_IF_HARD_REG_SUBSET.
+ (modify_reg_pav): Use hard_reg_set_empty_p instead of
+ GO_IF_HARD_REG_EQUAL.
+ * local-alloc.c (find_free_reg): Use hard_reg_subset_p instead
+ of GO_IF_HARD_REG_SUBSET.
+ * reg-stack.c (change_stack, convert_regs_1): Use hard_reg_sets_equal_p
+ instead of GO_IF_HARD_REG_EQUAL.
+ * regclass.c (init_reg_sets_1, reg_scan_mark_refs): Use
+ hard_reg_subset_p instead of GO_IF_HARD_REG_SUBSET.
+ (reg_classes_intersect_p): Use hard_reg_sets_intersect_p instead
+ of GO_IF_HARD_REG_SUBSET,
+ * reload1.c (finish_spills): Use hard_reg_subset_p instead of
+ GO_IF_HARD_REG_SUBSET.
+ * struct-equiv.c (death_notes_match_p): Use hard_reg_sets_equal_p
+ instead of GO_IF_HARD_REG_EQUAL.
+ * config/sh/sh.c (push_regs, calc_live_regs): Use
+ hard_reg_sets_intersect_p instead of hard_regs_intersect_p.
+ (hard_regs_intersect_p): Delete.
+
2007-05-22 Janis Johnson <janis187@us.ibm.com>
* doc/sourcebuild.texi (Test Directives) Add dg-message.
diff --git a/gcc/bt-load.c b/gcc/bt-load.c
index bd1761616c9..f5b07822cce 100644
--- a/gcc/bt-load.c
+++ b/gcc/bt-load.c
@@ -988,20 +988,19 @@ static int
choose_btr (HARD_REG_SET used_btrs)
{
int i;
- GO_IF_HARD_REG_SUBSET (all_btrs, used_btrs, give_up);
- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- {
+ if (!hard_reg_set_subset_p (all_btrs, used_btrs))
+ for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
+ {
#ifdef REG_ALLOC_ORDER
- int regno = reg_alloc_order[i];
+ int regno = reg_alloc_order[i];
#else
- int regno = i;
+ int regno = i;
#endif
- if (TEST_HARD_REG_BIT (all_btrs, regno)
- && !TEST_HARD_REG_BIT (used_btrs, regno))
- return regno;
- }
-give_up:
+ if (TEST_HARD_REG_BIT (all_btrs, regno)
+ && !TEST_HARD_REG_BIT (used_btrs, regno))
+ return regno;
+ }
return -1;
}
diff --git a/gcc/cfgcleanup.c b/gcc/cfgcleanup.c
index 1a337841572..d2738435804 100644
--- a/gcc/cfgcleanup.c
+++ b/gcc/cfgcleanup.c
@@ -974,12 +974,8 @@ old_insns_match_p (int mode ATTRIBUTE_UNUSED, rtx i1, rtx i2)
if (REG_NOTE_KIND (note) == REG_DEAD && STACK_REG_P (XEXP (note, 0)))
SET_HARD_REG_BIT (i2_regset, REGNO (XEXP (note, 0)));
- GO_IF_HARD_REG_EQUAL (i1_regset, i2_regset, done);
-
- return false;
-
- done:
- ;
+ if (!hard_reg_set_equal_p (i1_regset, i2_regset))
+ return false;
}
#endif
diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c
index 261ea7e56a6..b3c46ab4688 100644
--- a/gcc/config/sh/sh.c
+++ b/gcc/config/sh/sh.c
@@ -267,7 +267,6 @@ static bool sh_callee_copies (CUMULATIVE_ARGS *, enum machine_mode,
static int sh_arg_partial_bytes (CUMULATIVE_ARGS *, enum machine_mode,
tree, bool);
static int sh_dwarf_calling_convention (tree);
-static int hard_regs_intersect_p (HARD_REG_SET *, HARD_REG_SET *);
/* Initialize the GCC target structure. */
@@ -5777,7 +5776,7 @@ push_regs (HARD_REG_SET *mask, int interrupt_handler)
and we have to push any floating point register, we need
to switch to the correct precision first. */
if (i == FIRST_FP_REG && interrupt_handler && TARGET_FMOVD
- && hard_regs_intersect_p (mask, &reg_class_contents[DF_REGS]))
+ && hard_reg_set_intersect_p (*mask, reg_class_contents[DF_REGS]))
{
HARD_REG_SET unsaved;
@@ -5987,10 +5986,10 @@ calc_live_regs (HARD_REG_SET *live_regs_mask)
Make sure we save at least one general purpose register when we need
to save target registers. */
if (interrupt_handler
- && hard_regs_intersect_p (live_regs_mask,
- &reg_class_contents[TARGET_REGS])
- && ! hard_regs_intersect_p (live_regs_mask,
- &reg_class_contents[GENERAL_REGS]))
+ && hard_reg_set_intersect_p (*live_regs_mask,
+ reg_class_contents[TARGET_REGS])
+ && ! hard_reg_set_intersect_p (*live_regs_mask,
+ reg_class_contents[GENERAL_REGS]))
{
SET_HARD_REG_BIT (*live_regs_mask, R0_REG);
count += GET_MODE_SIZE (REGISTER_NATURAL_MODE (R0_REG));
@@ -6766,8 +6765,8 @@ sh_expand_epilogue (bool sibcall_p)
int j = (FIRST_PSEUDO_REGISTER - 1) - i;
if (j == FPSCR_REG && current_function_interrupt && TARGET_FMOVD
- && hard_regs_intersect_p (&live_regs_mask,
- &reg_class_contents[DF_REGS]))
+ && hard_reg_set_intersect_p (live_regs_mask,
+ reg_class_contents[DF_REGS]))
fpscr_deferred = 1;
else if (j != PR_REG && TEST_HARD_REG_BIT (live_regs_mask, j))
pop (j);
@@ -10643,21 +10642,6 @@ sh_init_cumulative_args (CUMULATIVE_ARGS * pcum,
}
}
-/* Determine if two hard register sets intersect.
- Return 1 if they do. */
-
-static int
-hard_regs_intersect_p (HARD_REG_SET *a, HARD_REG_SET *b)
-{
- HARD_REG_SET c;
- COPY_HARD_REG_SET (c, *a);
- AND_HARD_REG_SET (c, *b);
- GO_IF_HARD_REG_SUBSET (c, reg_class_contents[(int) NO_REGS], lose);
- return 1;
-lose:
- return 0;
-}
-
/* Replace any occurrence of FROM(n) in X with TO(n). The function does
not enter into CONST_DOUBLE for the replace.
diff --git a/gcc/df-problems.c b/gcc/df-problems.c
index 42710b203cf..385b8fb4725 100644
--- a/gcc/df-problems.c
+++ b/gcc/df-problems.c
@@ -2487,7 +2487,7 @@ df_urec_local_compute (struct dataflow *dflow,
bitmap_iterator bi;
#ifdef STACK_REGS
int i;
- HARD_REG_SET zero, stack_hard_regs, used;
+ HARD_REG_SET stack_hard_regs, used;
struct df_urec_problem_data *problem_data
= (struct df_urec_problem_data *) dflow->problem_data;
@@ -2498,7 +2498,6 @@ df_urec_local_compute (struct dataflow *dflow,
FIXME: This seems like an incredibly poor idea. */
- CLEAR_HARD_REG_SET (zero);
CLEAR_HARD_REG_SET (stack_hard_regs);
for (i = FIRST_STACK_REG; i <= LAST_STACK_REG; i++)
SET_HARD_REG_BIT (stack_hard_regs, i);
@@ -2508,10 +2507,8 @@ df_urec_local_compute (struct dataflow *dflow,
COPY_HARD_REG_SET (used, reg_class_contents[reg_preferred_class (i)]);
IOR_HARD_REG_SET (used, reg_class_contents[reg_alternate_class (i)]);
AND_HARD_REG_SET (used, stack_hard_regs);
- GO_IF_HARD_REG_EQUAL (used, zero, skip);
- bitmap_set_bit (problem_data->stack_regs, i);
- skip:
- ;
+ if (!hard_reg_set_empty_p (used))
+ bitmap_set_bit (problem_data->stack_regs, i);
}
#endif
diff --git a/gcc/global.c b/gcc/global.c
index b6bfa4d9f39..fd947607533 100644
--- a/gcc/global.c
+++ b/gcc/global.c
@@ -1161,10 +1161,8 @@ find_reg (int num, HARD_REG_SET losers, int alt_regs_p, int accept_call_clobbere
preferred registers. */
AND_COMPL_HARD_REG_SET (allocno[num].hard_reg_copy_preferences, used);
- GO_IF_HARD_REG_SUBSET (allocno[num].hard_reg_copy_preferences,
- reg_class_contents[(int) NO_REGS], no_copy_prefs);
-
- if (best_reg >= 0)
+ if (!hard_reg_set_empty_p (allocno[num].hard_reg_copy_preferences)
+ && best_reg >= 0)
{
for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
if (TEST_HARD_REG_BIT (allocno[num].hard_reg_copy_preferences, i)
@@ -1197,13 +1195,10 @@ find_reg (int num, HARD_REG_SET losers, int alt_regs_p, int accept_call_clobbere
}
}
}
- no_copy_prefs:
AND_COMPL_HARD_REG_SET (allocno[num].hard_reg_preferences, used);
- GO_IF_HARD_REG_SUBSET (allocno[num].hard_reg_preferences,
- reg_class_contents[(int) NO_REGS], no_prefs);
-
- if (best_reg >= 0)
+ if (!hard_reg_set_empty_p (allocno[num].hard_reg_preferences)
+ && best_reg >= 0)
{
for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
if (TEST_HARD_REG_BIT (allocno[num].hard_reg_preferences, i)
@@ -2437,10 +2432,9 @@ modify_reg_pav (void)
struct bb_info *bb_info;
#ifdef STACK_REGS
int i;
- HARD_REG_SET zero, stack_hard_regs, used;
+ HARD_REG_SET stack_hard_regs, used;
bitmap stack_regs;
- CLEAR_HARD_REG_SET (zero);
CLEAR_HARD_REG_SET (stack_hard_regs);
for (i = FIRST_STACK_REG; i <= LAST_STACK_REG; i++)
SET_HARD_REG_BIT(stack_hard_regs, i);
@@ -2450,10 +2444,8 @@ modify_reg_pav (void)
COPY_HARD_REG_SET (used, reg_class_contents[reg_preferred_class (i)]);
IOR_HARD_REG_SET (used, reg_class_contents[reg_alternate_class (i)]);
AND_HARD_REG_SET (used, stack_hard_regs);
- GO_IF_HARD_REG_EQUAL(used, zero, skip);
- bitmap_set_bit (stack_regs, i);
- skip:
- ;
+ if (!hard_reg_set_empty_p (used))
+ bitmap_set_bit (stack_regs, i);
}
#endif
FOR_EACH_BB (bb)
diff --git a/gcc/hard-reg-set.h b/gcc/hard-reg-set.h
index db7a1561915..c5b456fea32 100644
--- a/gcc/hard-reg-set.h
+++ b/gcc/hard-reg-set.h
@@ -83,9 +83,12 @@ typedef HARD_REG_ELT_TYPE HARD_REG_SET[HARD_REG_SET_LONGS];
IOR_COMPL_HARD_REG_SET and AND_COMPL_HARD_REG_SET
which use the complement of the set FROM.
- Also define GO_IF_HARD_REG_SUBSET (X, Y, TO):
- if X is a subset of Y, go to TO.
-*/
+ Also define:
+
+ hard_reg_set_subset_p (X, Y), which returns true if X is a subset of Y.
+ hard_reg_set_equal_p (X, Y), which returns true if X and Y are equal.
+ hard_reg_set_intersect_p (X, Y), which returns true if X and Y intersect.
+ hard_reg_set_empty_p (X), which returns true if X is empty. */
#ifdef HARD_REG_SET
@@ -107,9 +110,29 @@ typedef HARD_REG_ELT_TYPE HARD_REG_SET[HARD_REG_SET_LONGS];
#define AND_HARD_REG_SET(TO, FROM) ((TO) &= (FROM))
#define AND_COMPL_HARD_REG_SET(TO, FROM) ((TO) &= ~ (FROM))
-#define GO_IF_HARD_REG_SUBSET(X,Y,TO) if (HARD_CONST (0) == ((X) & ~(Y))) goto TO
-
-#define GO_IF_HARD_REG_EQUAL(X,Y,TO) if ((X) == (Y)) goto TO
+static inline bool
+hard_reg_set_subset_p (const HARD_REG_SET x, const HARD_REG_SET y)
+{
+ return (x & ~y) == HARD_CONST (0);
+}
+
+static inline bool
+hard_reg_set_equal_p (const HARD_REG_SET x, const HARD_REG_SET y)
+{
+ return x == y;
+}
+
+static inline bool
+hard_reg_set_intersect_p (const HARD_REG_SET x, const HARD_REG_SET y)
+{
+ return (x & y) != HARD_CONST (0);
+}
+
+static inline bool
+hard_reg_set_empty_p (const HARD_REG_SET x)
+{
+ return x == HARD_CONST (0);
+}
#else
@@ -168,17 +191,29 @@ do { HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); \
scan_tp_[0] |= ~ scan_fp_[0]; \
scan_tp_[1] |= ~ scan_fp_[1]; } while (0)
-#define GO_IF_HARD_REG_SUBSET(X,Y,TO) \
-do { HARD_REG_ELT_TYPE *scan_xp_ = (X), *scan_yp_ = (Y); \
- if ((0 == (scan_xp_[0] & ~ scan_yp_[0])) \
- && (0 == (scan_xp_[1] & ~ scan_yp_[1]))) \
- goto TO; } while (0)
-
-#define GO_IF_HARD_REG_EQUAL(X,Y,TO) \
-do { HARD_REG_ELT_TYPE *scan_xp_ = (X), *scan_yp_ = (Y); \
- if ((scan_xp_[0] == scan_yp_[0]) \
- && (scan_xp_[1] == scan_yp_[1])) \
- goto TO; } while (0)
+static inline bool
+hard_reg_set_subset_p (const HARD_REG_SET x, const HARD_REG_SET y)
+{
+ return (x[0] & ~y[0]) == 0 && (x[1] & ~y[1]) == 0;
+}
+
+static inline bool
+hard_reg_set_equal_p (const HARD_REG_SET x, const HARD_REG_SET y)
+{
+ return x[0] == y[0] && x[1] == y[1];
+}
+
+static inline bool
+hard_reg_set_intersect_p (const HARD_REG_SET x, const HARD_REG_SET y)
+{
+ return (x[0] & y[0]) != 0 || (x[1] & y[1]) != 0;
+}
+
+static inline bool
+hard_reg_set_empty_p (const HARD_REG_SET x)
+{
+ return x[0] == 0 && x[1] == 0;
+}
#else
#if FIRST_PSEUDO_REGISTER <= 3*HOST_BITS_PER_WIDEST_FAST_INT
@@ -230,19 +265,33 @@ do { HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); \
scan_tp_[1] |= ~ scan_fp_[1]; \
scan_tp_[2] |= ~ scan_fp_[2]; } while (0)
-#define GO_IF_HARD_REG_SUBSET(X,Y,TO) \
-do { HARD_REG_ELT_TYPE *scan_xp_ = (X), *scan_yp_ = (Y); \
- if ((0 == (scan_xp_[0] & ~ scan_yp_[0])) \
- && (0 == (scan_xp_[1] & ~ scan_yp_[1])) \
- && (0 == (scan_xp_[2] & ~ scan_yp_[2]))) \
- goto TO; } while (0)
-
-#define GO_IF_HARD_REG_EQUAL(X,Y,TO) \
-do { HARD_REG_ELT_TYPE *scan_xp_ = (X), *scan_yp_ = (Y); \
- if ((scan_xp_[0] == scan_yp_[0]) \
- && (scan_xp_[1] == scan_yp_[1]) \
- && (scan_xp_[2] == scan_yp_[2])) \
- goto TO; } while (0)
+static inline bool
+hard_reg_set_subset_p (const HARD_REG_SET x, const HARD_REG_SET y)
+{
+ return ((x[0] & ~y[0]) == 0
+ && (x[1] & ~y[1]) == 0
+ && (x[2] & ~y[2]) == 0);
+}
+
+static inline bool
+hard_reg_set_equal_p (const HARD_REG_SET x, const HARD_REG_SET y)
+{
+ return x[0] == y[0] && x[1] == y[1] && x[2] == y[2];
+}
+
+static inline bool
+hard_reg_set_intersect_p (const HARD_REG_SET x, const HARD_REG_SET y)
+{
+ return ((x[0] & y[0]) != 0
+ || (x[1] & y[1]) != 0
+ || (x[2] & y[2]) != 0);
+}
+
+static inline bool
+hard_reg_set_empty_p (const HARD_REG_SET x)
+{
+ return x[0] == 0 && x[1] == 0 && x[2] == 0;
+}
#else
#if FIRST_PSEUDO_REGISTER <= 4*HOST_BITS_PER_WIDEST_FAST_INT
@@ -302,21 +351,35 @@ do { HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); \
scan_tp_[2] |= ~ scan_fp_[2]; \
scan_tp_[3] |= ~ scan_fp_[3]; } while (0)
-#define GO_IF_HARD_REG_SUBSET(X,Y,TO) \
-do { HARD_REG_ELT_TYPE *scan_xp_ = (X), *scan_yp_ = (Y); \
- if ((0 == (scan_xp_[0] & ~ scan_yp_[0])) \
- && (0 == (scan_xp_[1] & ~ scan_yp_[1])) \
- && (0 == (scan_xp_[2] & ~ scan_yp_[2])) \
- && (0 == (scan_xp_[3] & ~ scan_yp_[3]))) \
- goto TO; } while (0)
-
-#define GO_IF_HARD_REG_EQUAL(X,Y,TO) \
-do { HARD_REG_ELT_TYPE *scan_xp_ = (X), *scan_yp_ = (Y); \
- if ((scan_xp_[0] == scan_yp_[0]) \
- && (scan_xp_[1] == scan_yp_[1]) \
- && (scan_xp_[2] == scan_yp_[2]) \
- && (scan_xp_[3] == scan_yp_[3])) \
- goto TO; } while (0)
+static inline bool
+hard_reg_set_subset_p (const HARD_REG_SET x, const HARD_REG_SET y)
+{
+ return ((x[0] & ~y[0]) == 0
+ && (x[1] & ~y[1]) == 0
+ && (x[2] & ~y[2]) == 0
+ && (x[3] & ~y[3]) == 0);
+}
+
+static inline bool
+hard_reg_set_equal_p (const HARD_REG_SET x, const HARD_REG_SET y)
+{
+ return x[0] == y[0] && x[1] == y[1] && x[2] == y[2] && x[3] == y[3];
+}
+
+static inline bool
+hard_reg_set_intersect_p (const HARD_REG_SET x, const HARD_REG_SET y)
+{
+ return ((x[0] & y[0]) != 0
+ || (x[1] & y[1]) != 0
+ || (x[2] & y[2]) != 0
+ || (x[3] & y[3]) != 0);
+}
+
+static inline bool
+hard_reg_set_empty_p (const HARD_REG_SET x)
+{
+ return x[0] == 0 && x[1] == 0 && x[2] == 0 && x[3] == 0;
+}
#else /* FIRST_PSEUDO_REGISTER > 3*HOST_BITS_PER_WIDEST_FAST_INT */
@@ -368,19 +431,49 @@ do { HARD_REG_ELT_TYPE *scan_tp_ = (TO), *scan_fp_ = (FROM); \
for (i = 0; i < HARD_REG_SET_LONGS; i++) \
*scan_tp_++ |= ~ *scan_fp_++; } while (0)
-#define GO_IF_HARD_REG_SUBSET(X,Y,TO) \
-do { HARD_REG_ELT_TYPE *scan_xp_ = (X), *scan_yp_ = (Y); \
- int i; \
- for (i = 0; i < HARD_REG_SET_LONGS; i++) \
- if (0 != (*scan_xp_++ & ~ *scan_yp_++)) break; \
- if (i == HARD_REG_SET_LONGS) goto TO; } while (0)
-
-#define GO_IF_HARD_REG_EQUAL(X,Y,TO) \
-do { HARD_REG_ELT_TYPE *scan_xp_ = (X), *scan_yp_ = (Y); \
- int i; \
- for (i = 0; i < HARD_REG_SET_LONGS; i++) \
- if (*scan_xp_++ != *scan_yp_++) break; \
- if (i == HARD_REG_SET_LONGS) goto TO; } while (0)
+static inline bool
+hard_reg_set_subset_p (const HARD_REG_SET x, const HARD_REG_SET y)
+{
+ int i;
+
+ for (i = 0; i < HARD_REG_SET_LONGS; i++)
+ if ((x[i] & ~y[i]) != 0)
+ return false;
+ return true;
+}
+
+static inline bool
+hard_reg_set_equal_p (const HARD_REG_SET x, const HARD_REG_SET y)
+{
+ int i;
+
+ for (i = 0; i < HARD_REG_SET_LONGS; i++)
+ if (x[i] != y[i])
+ return false;
+ return true;
+}
+
+static inline bool
+hard_reg_set_intersect_p (const HARD_REG_SET x, const HARD_REG_SET y)
+{
+ int i;
+
+ for (i = 0; i < HARD_REG_SET_LONGS; i++)
+ if ((x[i] & y[i]) != 0)
+ return true;
+ return false;
+}
+
+static inline bool
+hard_reg_set_empty_p (const HARD_REG_SET x)
+{
+ int i;
+
+ for (i = 0; i < HARD_REG_SET_LONGS; i++)
+ if (x[i] != 0)
+ return false;
+ return true;
+}
#endif
#endif
diff --git a/gcc/local-alloc.c b/gcc/local-alloc.c
index f46b9c98067..cd1c01d753d 100644
--- a/gcc/local-alloc.c
+++ b/gcc/local-alloc.c
@@ -2286,42 +2286,40 @@ find_free_reg (enum reg_class class, enum machine_mode mode, int qtyno,
IOR_COMPL_HARD_REG_SET (first_used, qty_phys_sugg[qtyno]);
}
- /* If all registers are excluded, we can't do anything. */
- GO_IF_HARD_REG_SUBSET (reg_class_contents[(int) ALL_REGS], first_used, fail);
-
/* If at least one would be suitable, test each hard reg. */
-
- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- {
+ if (!hard_reg_set_subset_p (reg_class_contents[(int) ALL_REGS], first_used))
+ for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
+ {
#ifdef REG_ALLOC_ORDER
- int regno = reg_alloc_order[i];
+ int regno = reg_alloc_order[i];
#else
- int regno = i;
+ int regno = i;
#endif
- if (! TEST_HARD_REG_BIT (first_used, regno)
- && HARD_REGNO_MODE_OK (regno, mode)
- && (qty[qtyno].n_calls_crossed == 0
- || accept_call_clobbered
- || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode)))
- {
- int j;
- int size1 = hard_regno_nregs[regno][mode];
- for (j = 1; j < size1 && ! TEST_HARD_REG_BIT (used, regno + j); j++);
- if (j == size1)
- {
- /* Mark that this register is in use between its birth and death
- insns. */
- post_mark_life (regno, mode, 1, born_index, dead_index);
- return regno;
- }
+ if (!TEST_HARD_REG_BIT (first_used, regno)
+ && HARD_REGNO_MODE_OK (regno, mode)
+ && (qty[qtyno].n_calls_crossed == 0
+ || accept_call_clobbered
+ || !HARD_REGNO_CALL_PART_CLOBBERED (regno, mode)))
+ {
+ int j;
+ int size1 = hard_regno_nregs[regno][mode];
+ j = 1;
+ while (j < size1 && !TEST_HARD_REG_BIT (used, regno + j))
+ j++;
+ if (j == size1)
+ {
+ /* Mark that this register is in use between its birth
+ and death insns. */
+ post_mark_life (regno, mode, 1, born_index, dead_index);
+ return regno;
+ }
#ifndef REG_ALLOC_ORDER
- /* Skip starting points we know will lose. */
- i += j;
+ /* Skip starting points we know will lose. */
+ i += j;
#endif
- }
- }
+ }
+ }
- fail:
/* If we are just trying suggested register, we have just tried copy-
suggested registers, and there are arithmetic-suggested registers,
try them. */
diff --git a/gcc/reg-stack.c b/gcc/reg-stack.c
index 933bff25456..5a8d8bf460f 100644
--- a/gcc/reg-stack.c
+++ b/gcc/reg-stack.c
@@ -2485,9 +2485,7 @@ change_stack (rtx insn, stack old, stack new, enum emit_where where)
/* By now, the only difference should be the order of the stack,
not their depth or liveliness. */
- GO_IF_HARD_REG_EQUAL (old->reg_set, new->reg_set, win);
- gcc_unreachable ();
- win:
+ gcc_assert (hard_reg_set_equal_p (old->reg_set, new->reg_set));
gcc_assert (old->top == new->top);
/* If the stack is not empty (new->top != -1), loop here emitting
@@ -2955,9 +2953,8 @@ convert_regs_1 (basic_block block)
/* Something failed if the stack lives don't match. If we had malformed
asms, we zapped the instruction itself, but that didn't produce the
same pattern of register kills as before. */
- GO_IF_HARD_REG_EQUAL (regstack.reg_set, bi->out_reg_set, win);
- gcc_assert (any_malformed_asm);
- win:
+ gcc_assert (hard_reg_set_equal_p (regstack.reg_set, bi->out_reg_set)
+ || any_malformed_asm);
bi->stack_out = regstack;
bi->done = true;
}
diff --git a/gcc/regclass.c b/gcc/regclass.c
index 60af8acdcac..1067f9384d5 100644
--- a/gcc/regclass.c
+++ b/gcc/regclass.c
@@ -338,20 +338,11 @@ init_reg_sets_1 (void)
COPY_HARD_REG_SET (c, reg_class_contents[i]);
IOR_HARD_REG_SET (c, reg_class_contents[j]);
for (k = 0; k < N_REG_CLASSES; k++)
- {
- GO_IF_HARD_REG_SUBSET (reg_class_contents[k], c,
- subclass1);
- continue;
-
- subclass1:
- /* Keep the largest subclass. */ /* SPEE 900308 */
- GO_IF_HARD_REG_SUBSET (reg_class_contents[k],
- reg_class_contents[(int) reg_class_subunion[i][j]],
- subclass2);
+ if (hard_reg_set_subset_p (reg_class_contents[k], c)
+ && !hard_reg_set_subset_p (reg_class_contents[k],
+ reg_class_contents
+ [(int) reg_class_subunion[i][j]]))
reg_class_subunion[i][j] = (enum reg_class) k;
- subclass2:
- ;
- }
}
}
@@ -369,9 +360,9 @@ init_reg_sets_1 (void)
COPY_HARD_REG_SET (c, reg_class_contents[i]);
IOR_HARD_REG_SET (c, reg_class_contents[j]);
for (k = 0; k < N_REG_CLASSES; k++)
- GO_IF_HARD_REG_SUBSET (c, reg_class_contents[k], superclass);
+ if (hard_reg_set_subset_p (c, reg_class_contents[k]))
+ break;
- superclass:
reg_class_superunion[i][j] = (enum reg_class) k;
}
}
@@ -394,23 +385,21 @@ init_reg_sets_1 (void)
continue;
for (j = i + 1; j < N_REG_CLASSES; j++)
- {
- enum reg_class *p;
-
- GO_IF_HARD_REG_SUBSET (reg_class_contents[i], reg_class_contents[j],
- subclass);
- continue;
- subclass:
- /* Reg class I is a subclass of J.
- Add J to the table of superclasses of I. */
- p = &reg_class_superclasses[i][0];
- while (*p != LIM_REG_CLASSES) p++;
- *p = (enum reg_class) j;
- /* Add I to the table of superclasses of J. */
- p = &reg_class_subclasses[j][0];
- while (*p != LIM_REG_CLASSES) p++;
- *p = (enum reg_class) i;
- }
+ if (hard_reg_set_subset_p (reg_class_contents[i],
+ reg_class_contents[j]))
+ {
+ /* Reg class I is a subclass of J.
+ Add J to the table of superclasses of I. */
+ enum reg_class *p;
+
+ p = &reg_class_superclasses[i][0];
+ while (*p != LIM_REG_CLASSES) p++;
+ *p = (enum reg_class) j;
+ /* Add I to the table of superclasses of J. */
+ p = &reg_class_subclasses[j][0];
+ while (*p != LIM_REG_CLASSES) p++;
+ *p = (enum reg_class) i;
+ }
}
/* Initialize "constant" tables. */
@@ -2502,15 +2491,10 @@ reg_scan_mark_refs (rtx x, rtx insn, int note_flag, unsigned int min_regno)
int
reg_class_subset_p (enum reg_class c1, enum reg_class c2)
{
- if (c1 == c2) return 1;
-
- if (c2 == ALL_REGS)
- win:
- return 1;
- GO_IF_HARD_REG_SUBSET (reg_class_contents[(int) c1],
- reg_class_contents[(int) c2],
- win);
- return 0;
+ return (c1 == c2
+ || c2 == ALL_REGS
+ || hard_reg_set_subset_p (reg_class_contents[(int) c1],
+ reg_class_contents[(int) c2]));
}
/* Return nonzero if there is a register that is in both C1 and C2. */
@@ -2518,21 +2502,11 @@ reg_class_subset_p (enum reg_class c1, enum reg_class c2)
int
reg_classes_intersect_p (enum reg_class c1, enum reg_class c2)
{
- HARD_REG_SET c;
-
- if (c1 == c2) return 1;
-
- if (c1 == ALL_REGS || c2 == ALL_REGS)
- return 1;
-
- COPY_HARD_REG_SET (c, reg_class_contents[(int) c1]);
- AND_HARD_REG_SET (c, reg_class_contents[(int) c2]);
-
- GO_IF_HARD_REG_SUBSET (c, reg_class_contents[(int) NO_REGS], lose);
- return 1;
-
- lose:
- return 0;
+ return (c1 == c2
+ || c1 == ALL_REGS
+ || c2 == ALL_REGS
+ || hard_reg_set_intersect_p (reg_class_contents[(int) c1],
+ reg_class_contents[(int) c2]));
}
#ifdef CANNOT_CHANGE_MODE_CLASS
diff --git a/gcc/reload1.c b/gcc/reload1.c
index dd79b0bcbf2..4d0251db923 100644
--- a/gcc/reload1.c
+++ b/gcc/reload1.c
@@ -3891,9 +3891,8 @@ finish_spills (int global)
AND_HARD_REG_SET (chain->used_spill_regs, used_spill_regs);
/* Make sure we only enlarge the set. */
- GO_IF_HARD_REG_SUBSET (used_by_pseudos2, chain->used_spill_regs, ok);
- gcc_unreachable ();
- ok:;
+ gcc_assert (hard_reg_set_subset_p (used_by_pseudos2,
+ chain->used_spill_regs));
}
}
diff --git a/gcc/struct-equiv.c b/gcc/struct-equiv.c
index ce3efcdb56d..c37378e457d 100644
--- a/gcc/struct-equiv.c
+++ b/gcc/struct-equiv.c
@@ -865,12 +865,8 @@ death_notes_match_p (rtx i1 ATTRIBUTE_UNUSED, rtx i2 ATTRIBUTE_UNUSED,
SET_HARD_REG_BIT (i2_regset, regno);
}
- GO_IF_HARD_REG_EQUAL (i1_regset, i2_regset, done);
-
- return false;
-
- done:
- ;
+ if (!hard_reg_set_equal_p (i1_regset, i2_regset))
+ return false;
}
#endif
return true;