summaryrefslogtreecommitdiff
path: root/gcc/hard-reg-set.h
diff options
context:
space:
mode:
authorrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2007-05-22 19:33:37 +0000
committerrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2007-05-22 19:33:37 +0000
commitddc556d140656052c5583cc83c8d795107786dfc (patch)
treecfa4aaeabd4b1bbd0608b1fb3976bc0540f8ed3a /gcc/hard-reg-set.h
parentd98c6d3671297d88cfa3b70a45e684bd04edf072 (diff)
downloadgcc-ddc556d140656052c5583cc83c8d795107786dfc.tar.gz
gcc/
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@124954 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/hard-reg-set.h')
-rw-r--r--gcc/hard-reg-set.h209
1 files changed, 151 insertions, 58 deletions
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