aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/expmed.h9
-rw-r--r--gcc/genmodes.c13
-rw-r--r--gcc/real.h5
3 files changed, 15 insertions, 12 deletions
diff --git a/gcc/expmed.h b/gcc/expmed.h
index 93cd631..6b13ea9 100644
--- a/gcc/expmed.h
+++ b/gcc/expmed.h
@@ -133,15 +133,6 @@ struct alg_hash_entry {
#define NUM_ALG_HASH_ENTRIES 307
#endif
-#define NUM_MODE_INT \
- (MAX_MODE_INT - MIN_MODE_INT + 1)
-#define NUM_MODE_PARTIAL_INT \
- (MIN_MODE_PARTIAL_INT == E_VOIDmode ? 0 \
- : MAX_MODE_PARTIAL_INT - MIN_MODE_PARTIAL_INT + 1)
-#define NUM_MODE_VECTOR_INT \
- (MIN_MODE_VECTOR_INT == E_VOIDmode ? 0 \
- : MAX_MODE_VECTOR_INT - MIN_MODE_VECTOR_INT + 1)
-
#define NUM_MODE_IP_INT (NUM_MODE_INT + NUM_MODE_PARTIAL_INT)
#define NUM_MODE_IPV_INT (NUM_MODE_IP_INT + NUM_MODE_VECTOR_INT)
diff --git a/gcc/genmodes.c b/gcc/genmodes.c
index c9af4ef..ecc8b44 100644
--- a/gcc/genmodes.c
+++ b/gcc/genmodes.c
@@ -1316,6 +1316,19 @@ enum machine_mode\n{");
NUM_MACHINE_MODES = MAX_MACHINE_MODE\n\
};\n");
+ /* Define a NUM_* macro for each mode class, giving the number of modes
+ in the class. */
+ for (c = 0; c < MAX_MODE_CLASS; c++)
+ {
+ printf ("#define NUM_%s ", mode_class_names[c]);
+ if (modes[c])
+ printf ("(MAX_%s - MIN_%s + 1)\n", mode_class_names[c],
+ mode_class_names[c]);
+ else
+ printf ("0\n");
+ }
+ printf ("\n");
+
/* I can't think of a better idea, can you? */
printf ("#define CONST_MODE_NUNITS%s\n", adj_nunits ? "" : " const");
printf ("#define CONST_MODE_PRECISION%s\n", adj_nunits ? "" : " const");
diff --git a/gcc/real.h b/gcc/real.h
index 015163d..39dd34e 100644
--- a/gcc/real.h
+++ b/gcc/real.h
@@ -178,13 +178,12 @@ struct real_format
decimal float modes indexed by (MODE - first decimal float mode) +
the number of float modes. */
extern const struct real_format *
- real_format_for_mode[MAX_MODE_FLOAT - MIN_MODE_FLOAT + 1
- + MAX_MODE_DECIMAL_FLOAT - MIN_MODE_DECIMAL_FLOAT + 1];
+ real_format_for_mode[NUM_MODE_FLOAT + NUM_MODE_DECIMAL_FLOAT];
#define REAL_MODE_FORMAT(MODE) \
(real_format_for_mode[DECIMAL_FLOAT_MODE_P (MODE) \
? (((MODE) - MIN_MODE_DECIMAL_FLOAT) \
- + (MAX_MODE_FLOAT - MIN_MODE_FLOAT + 1)) \
+ + NUM_MODE_FLOAT) \
: GET_MODE_CLASS (MODE) == MODE_FLOAT \
? ((MODE) - MIN_MODE_FLOAT) \
: (gcc_unreachable (), 0)])