diff options
author | Richard Sandiford <richard.sandiford@linaro.org> | 2017-08-30 11:08:14 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2017-08-30 11:08:14 +0000 |
commit | 0d4a1197ba24d4f95b5c5f1face695806075a0c6 (patch) | |
tree | 476ff68998ea4b53577993e27e03100cf3381f16 /gcc/genmodes.c | |
parent | 8afacf2c365afa9c3b084728d3bbc5d1fa2fb69e (diff) | |
download | gcc-0d4a1197ba24d4f95b5c5f1face695806075a0c6.zip gcc-0d4a1197ba24d4f95b5c5f1face695806075a0c6.tar.gz gcc-0d4a1197ba24d4f95b5c5f1face695806075a0c6.tar.bz2 |
[1/77] Add an E_ prefix to mode names
Later patches will add wrapper types for specific classes
of mode. E.g. SImode will be a scalar_int_mode, SFmode will be a
scalar_float_mode, etc. This patch prepares for that change by adding
an E_ prefix to the mode enum values. It also adds #defines that map
the unprefixed names to the prefixed names; e.g:
#define QImode E_QImode
Later patches will change this to use things like scalar_int_mode
where appropriate.
The patch continues to use enum values to initialise static data.
This isn't necessary for correctness, but it cuts down on the amount
of load-time initialisation and shouldn't have any downsides.
The patch also changes things like:
cmp_mode == DImode ? DFmode : DImode
to:
cmp_mode == DImode ? E_DFmode : E_DImode
This is because DImode and DFmode will eventually be different
classes, so the original ?: wouldn't be well-formed.
2017-08-30 Richard Sandiford <richard.sandiford@linaro.org>
Alan Hayward <alan.hayward@arm.com>
David Sherwood <david.sherwood@arm.com>
gcc/
* genmodes.c (mode_size_inline): Add an E_ prefix to mode names.
(mode_nunits_inline): Likewise.
(mode_inner_inline): Likewise.
(mode_unit_size_inline): Likewise.
(mode_unit_precision_inline): Likewise.
(emit_insn_modes_h): Likewise. Also emit a #define of the
unprefixed name.
(emit_mode_wider): Add an E_ prefix to mode names.
(emit_mode_complex): Likewise.
(emit_mode_inner): Likewise.
(emit_mode_adjustments): Likewise.
(emit_mode_int_n): Likewise.
* config/aarch64/aarch64-builtins.c (v8qi_UP, v4hi_UP, v4hf_UP)
(v2si_UP, v2sf_UP, v1df_UP, di_UP, df_UP, v16qi_UP, v8hi_UP, v8hf_UP)
(v4si_UP, v4sf_UP, v2di_UP, v2df_UP, ti_UP, oi_UP, ci_UP, xi_UP)
(si_UP, sf_UP, hi_UP, hf_UP, qi_UP): Likewise.
(CRC32_BUILTIN, ENTRY): Likewise.
* config/aarch64/aarch64.c (aarch64_push_regs): Likewise.
(aarch64_pop_regs): Likewise.
(aarch64_process_components): Likewise.
* config/alpha/alpha.c (alpha_emit_conditional_move): Likewise.
* config/arm/arm-builtins.c (v8qi_UP, v4hi_UP, v4hf_UP, v2si_UP)
(v2sf_UP, di_UP, v16qi_UP, v8hi_UP, v8hf_UP, v4si_UP, v4sf_UP)
(v2di_UP, ti_UP, ei_UP, oi_UP, hf_UP, si_UP, void_UP): Likewise.
* config/arm/arm.c (arm_init_libfuncs): Likewise.
* config/i386/i386-builtin-types.awk (ix86_builtin_type_vect_mode):
Likewise.
* config/i386/i386-builtin.def (pcmpestr): Likewise.
(pcmpistr): Likewise.
* config/microblaze/microblaze.c (double_memory_operand): Likewise.
* config/mmix/mmix.c (mmix_output_condition): Likewise.
* config/powerpcspe/powerpcspe.c (rs6000_init_hard_regno_mode_ok):
Likewise.
* config/rl78/rl78.c (mduc_regs): Likewise.
* config/rs6000/rs6000.c (rs6000_init_hard_regno_mode_ok): Likewise.
(htm_expand_builtin): Likewise.
* config/sh/sh.h (REGISTER_NATURAL_MODE): Likewise.
* config/sparc/sparc.c (emit_save_or_restore_regs): Likewise.
* config/xtensa/xtensa.c (print_operand): Likewise.
* expmed.h (NUM_MODE_PARTIAL_INT): Likewise.
(NUM_MODE_VECTOR_INT): Likewise.
* genoutput.c (null_operand): Likewise.
(output_operand_data): Likewise.
* genrecog.c (print_parameter_value): Likewise.
* lra.c (debug_operand_data): Likewise.
Co-Authored-By: Alan Hayward <alan.hayward@arm.com>
Co-Authored-By: David Sherwood <david.sherwood@arm.com>
From-SVN: r251452
Diffstat (limited to 'gcc/genmodes.c')
-rw-r--r-- | gcc/genmodes.c | 60 |
1 files changed, 31 insertions, 29 deletions
diff --git a/gcc/genmodes.c b/gcc/genmodes.c index f7eaeef..4cd0dc1 100644 --- a/gcc/genmodes.c +++ b/gcc/genmodes.c @@ -983,7 +983,7 @@ mode_size_inline (machine_mode mode)\n\ for_all_modes (c, m) if (!m->need_bytesize_adj) - printf (" case %smode: return %u;\n", m->name, m->bytesize); + printf (" case E_%smode: return %u;\n", m->name, m->bytesize); puts ("\ default: return mode_size[mode];\n\ @@ -1013,7 +1013,7 @@ mode_nunits_inline (machine_mode mode)\n\ {"); for_all_modes (c, m) - printf (" case %smode: return %u;\n", m->name, m->ncomponents); + printf (" case E_%smode: return %u;\n", m->name, m->ncomponents); puts ("\ default: return mode_nunits[mode];\n\ @@ -1043,7 +1043,7 @@ mode_inner_inline (machine_mode mode)\n\ {"); for_all_modes (c, m) - printf (" case %smode: return %smode;\n", m->name, + printf (" case E_%smode: return E_%smode;\n", m->name, c != MODE_PARTIAL_INT && m->component ? m->component->name : m->name); @@ -1082,7 +1082,7 @@ mode_unit_size_inline (machine_mode mode)\n\ if (c != MODE_PARTIAL_INT && m2->component) m2 = m2->component; if (!m2->need_bytesize_adj) - printf (" case %smode: return %u;\n", name, m2->bytesize); + printf (" case E_%smode: return %u;\n", name, m2->bytesize); } puts ("\ @@ -1117,9 +1117,9 @@ mode_unit_precision_inline (machine_mode mode)\n\ struct mode_data *m2 = (c != MODE_PARTIAL_INT && m->component) ? m->component : m; if (m2->precision != (unsigned int)-1) - printf (" case %smode: return %u;\n", m->name, m2->precision); + printf (" case E_%smode: return %u;\n", m->name, m2->precision); else - printf (" case %smode: return %u*BITS_PER_UNIT;\n", + printf (" case E_%smode: return %u*BITS_PER_UNIT;\n", m->name, m2->bytesize); } @@ -1151,10 +1151,12 @@ enum machine_mode\n{"); for (c = 0; c < MAX_MODE_CLASS; c++) for (m = modes[c]; m; m = m->next) { - int count_ = printf (" %smode,", m->name); + int count_ = printf (" E_%smode,", m->name); printf ("%*s/* %s:%d */\n", 27 - count_, "", trim_filename (m->file), m->line); printf ("#define HAVE_%smode\n", m->name); + printf ("#define %smode E_%smode\n", + m->name, m->name); } puts (" MAX_MACHINE_MODE,\n"); @@ -1174,11 +1176,11 @@ enum machine_mode\n{"); first = first->next; if (first && last) - printf (" MIN_%s = %smode,\n MAX_%s = %smode,\n\n", + printf (" MIN_%s = E_%smode,\n MAX_%s = E_%smode,\n\n", mode_class_names[c], first->name, mode_class_names[c], last->name); else - printf (" MIN_%s = %smode,\n MAX_%s = %smode,\n\n", + printf (" MIN_%s = E_%smode,\n MAX_%s = E_%smode,\n\n", mode_class_names[c], void_mode->name, mode_class_names[c], void_mode->name); } @@ -1350,7 +1352,7 @@ emit_mode_wider (void) print_decl ("unsigned char", "mode_wider", "NUM_MACHINE_MODES"); for_all_modes (c, m) - tagged_printf ("%smode", + tagged_printf ("E_%smode", m->wider ? m->wider->name : void_mode->name, m->name); @@ -1397,7 +1399,7 @@ emit_mode_wider (void) } if (m2 == void_mode) m2 = 0; - tagged_printf ("%smode", + tagged_printf ("E_%smode", m2 ? m2->name : void_mode->name, m->name); } @@ -1414,7 +1416,7 @@ emit_mode_complex (void) print_decl ("unsigned char", "mode_complex", "NUM_MACHINE_MODES"); for_all_modes (c, m) - tagged_printf ("%smode", + tagged_printf ("E_%smode", m->complex ? m->complex->name : void_mode->name, m->name); @@ -1454,7 +1456,7 @@ emit_mode_inner (void) print_decl ("unsigned char", "mode_inner", "NUM_MACHINE_MODES"); for_all_modes (c, m) - tagged_printf ("%smode", + tagged_printf ("E_%smode", c != MODE_PARTIAL_INT && m->component ? m->component->name : m->name, m->name); @@ -1597,9 +1599,9 @@ emit_mode_adjustments (void) { printf ("\n /* %s:%d */\n s = %s;\n", a->file, a->line, a->adjustment); - printf (" mode_size[%smode] = s;\n", a->mode->name); - printf (" mode_unit_size[%smode] = s;\n", a->mode->name); - printf (" mode_base_align[%smode] = s & (~s + 1);\n", + printf (" mode_size[E_%smode] = s;\n", a->mode->name); + printf (" mode_unit_size[E_%smode] = s;\n", a->mode->name); + printf (" mode_base_align[E_%smode] = s & (~s + 1);\n", a->mode->name); for (m = a->mode->contained; m; m = m->next_cont) @@ -1608,9 +1610,9 @@ emit_mode_adjustments (void) { case MODE_COMPLEX_INT: case MODE_COMPLEX_FLOAT: - printf (" mode_size[%smode] = 2*s;\n", m->name); - printf (" mode_unit_size[%smode] = s;\n", m->name); - printf (" mode_base_align[%smode] = s & (~s + 1);\n", + printf (" mode_size[E_%smode] = 2*s;\n", m->name); + printf (" mode_unit_size[E_%smode] = s;\n", m->name); + printf (" mode_base_align[E_%smode] = s & (~s + 1);\n", m->name); break; @@ -1620,10 +1622,10 @@ emit_mode_adjustments (void) case MODE_VECTOR_UFRACT: case MODE_VECTOR_ACCUM: case MODE_VECTOR_UACCUM: - printf (" mode_size[%smode] = %d*s;\n", + printf (" mode_size[E_%smode] = %d*s;\n", m->name, m->ncomponents); - printf (" mode_unit_size[%smode] = s;\n", m->name); - printf (" mode_base_align[%smode] = (%d*s) & (~(%d*s)+1);\n", + printf (" mode_unit_size[E_%smode] = s;\n", m->name); + printf (" mode_base_align[E_%smode] = (%d*s) & (~(%d*s)+1);\n", m->name, m->ncomponents, m->ncomponents); break; @@ -1642,7 +1644,7 @@ emit_mode_adjustments (void) { printf ("\n /* %s:%d */\n s = %s;\n", a->file, a->line, a->adjustment); - printf (" mode_base_align[%smode] = s;\n", a->mode->name); + printf (" mode_base_align[E_%smode] = s;\n", a->mode->name); for (m = a->mode->contained; m; m = m->next_cont) { @@ -1650,7 +1652,7 @@ emit_mode_adjustments (void) { case MODE_COMPLEX_INT: case MODE_COMPLEX_FLOAT: - printf (" mode_base_align[%smode] = s;\n", m->name); + printf (" mode_base_align[E_%smode] = s;\n", m->name); break; case MODE_VECTOR_INT: @@ -1659,7 +1661,7 @@ emit_mode_adjustments (void) case MODE_VECTOR_UFRACT: case MODE_VECTOR_ACCUM: case MODE_VECTOR_UACCUM: - printf (" mode_base_align[%smode] = %d*s;\n", + printf (" mode_base_align[E_%smode] = %d*s;\n", m->name, m->ncomponents); break; @@ -1677,7 +1679,7 @@ emit_mode_adjustments (void) { printf ("\n /* %s:%d */\n s = %s;\n", a->file, a->line, a->adjustment); - printf (" mode_ibit[%smode] = s;\n", a->mode->name); + printf (" mode_ibit[E_%smode] = s;\n", a->mode->name); } /* Fbit adjustments don't have to propagate. */ @@ -1685,12 +1687,12 @@ emit_mode_adjustments (void) { printf ("\n /* %s:%d */\n s = %s;\n", a->file, a->line, a->adjustment); - printf (" mode_fbit[%smode] = s;\n", a->mode->name); + printf (" mode_fbit[E_%smode] = s;\n", a->mode->name); } /* Real mode formats don't have to propagate anywhere. */ for (a = adj_format; a; a = a->next) - printf ("\n /* %s:%d */\n REAL_MODE_FORMAT (%smode) = %s;\n", + printf ("\n /* %s:%d */\n REAL_MODE_FORMAT (E_%smode) = %s;\n", a->file, a->line, a->mode->name, a->adjustment); puts ("}"); @@ -1768,7 +1770,7 @@ emit_mode_int_n (void) m = mode_sort[i]; printf(" {\n"); tagged_printf ("%u", m->int_n, m->name); - printf ("%smode,", m->name); + printf ("E_%smode,", m->name); printf(" },\n"); } |