diff options
Diffstat (limited to 'gcc/genmodes.c')
-rw-r--r-- | gcc/genmodes.c | 34 |
1 files changed, 14 insertions, 20 deletions
diff --git a/gcc/genmodes.c b/gcc/genmodes.c index 64074629ea1..9f3799a6739 100644 --- a/gcc/genmodes.c +++ b/gcc/genmodes.c @@ -486,9 +486,11 @@ make_complex_modes (enum mode_class cl, /* For all modes in class CL, construct vector modes of width WIDTH, having as many components as necessary. */ -#define VECTOR_MODES(C, W) make_vector_modes (MODE_##C, W, __FILE__, __LINE__) +#define VECTOR_MODES_WITH_PREFIX(PREFIX, C, W) \ + make_vector_modes (MODE_##C, #PREFIX, W, __FILE__, __LINE__) +#define VECTOR_MODES(C, W) VECTOR_MODES_WITH_PREFIX (V, C, W) static void ATTRIBUTE_UNUSED -make_vector_modes (enum mode_class cl, unsigned int width, +make_vector_modes (enum mode_class cl, const char *prefix, unsigned int width, const char *file, unsigned int line) { struct mode_data *m; @@ -519,8 +521,8 @@ make_vector_modes (enum mode_class cl, unsigned int width, if (cl == MODE_INT && m->precision == 1) continue; - if ((size_t)snprintf (buf, sizeof buf, "V%u%s", ncomponents, m->name) - >= sizeof buf) + if ((size_t) snprintf (buf, sizeof buf, "%s%u%s", prefix, + ncomponents, m->name) >= sizeof buf) { error ("%s:%d: mode name \"%s\" is too long", m->file, m->line, m->name); @@ -533,13 +535,14 @@ make_vector_modes (enum mode_class cl, unsigned int width, } } -/* Create a vector of booleans with COUNT elements and BYTESIZE bytes - in total. */ -#define VECTOR_BOOL_MODE(COUNT, BYTESIZE) \ - make_vector_bool_mode (COUNT, BYTESIZE, __FILE__, __LINE__) +/* Create a vector of booleans called NAME with COUNT elements and + BYTESIZE bytes in total. */ +#define VECTOR_BOOL_MODE(NAME, COUNT, BYTESIZE) \ + make_vector_bool_mode (#NAME, COUNT, BYTESIZE, __FILE__, __LINE__) static void ATTRIBUTE_UNUSED -make_vector_bool_mode (unsigned int count, unsigned int bytesize, - const char *file, unsigned int line) +make_vector_bool_mode (const char *name, unsigned int count, + unsigned int bytesize, const char *file, + unsigned int line) { struct mode_data *m = find_mode ("BI"); if (!m) @@ -548,16 +551,7 @@ make_vector_bool_mode (unsigned int count, unsigned int bytesize, return; } - char buf[8]; - if ((size_t) snprintf (buf, sizeof buf, "V%uBI", count) >= sizeof buf) - { - error ("%s:%d: number of vector elements is too high", - file, line); - return; - } - - struct mode_data *v = new_mode (MODE_VECTOR_BOOL, - xstrdup (buf), file, line); + struct mode_data *v = new_mode (MODE_VECTOR_BOOL, name, file, line); v->component = m; v->ncomponents = count; v->bytesize = bytesize; |