From: Richard Sandiford Date: Wed, 3 Jan 2018 21:44:14 +0000 (+0000) Subject: Allow the target to set MAX_BITSIZE_MODE_ANY_MODE X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=98ac791361227ed388237207baf629981cef03f7;p=gcc.git Allow the target to set MAX_BITSIZE_MODE_ANY_MODE The default value of MAX_BITSIZE_MODE_ANY_MODE is calculated from the initial mode sizes specified in the modes.def file. The target needs to be able to override it if ADJUST_BYTESIZE & co. can choose a bigger size. 2018-01-03 Richard Sandiford gcc/ * doc/rtl.texi (MAX_BITSIZE_MODE_ANY_MODE): Describe how the default is calculated and how it can be overridden. * genmodes.c (max_bitsize_mode_any_mode): New variable. (create_modes): Initialize it from MAX_BITSIZE_MODE_ANY_MODE, if defined. (emit_max_int): Use it to set the output MAX_BITSIZE_MODE_ANY_MODE, if nonzero. From-SVN: r256206 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9437ae9fd6c..afc18a8d2ce 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2018-01-03 Richard Sandiford + + * doc/rtl.texi (MAX_BITSIZE_MODE_ANY_MODE): Describe how the default + is calculated and how it can be overridden. + * genmodes.c (max_bitsize_mode_any_mode): New variable. + (create_modes): Initialize it from MAX_BITSIZE_MODE_ANY_MODE, + if defined. + (emit_max_int): Use it to set the output MAX_BITSIZE_MODE_ANY_MODE, + if nonzero. + 2018-01-03 Richard Sandiford Alan Hayward David Sherwood diff --git a/gcc/doc/rtl.texi b/gcc/doc/rtl.texi index 92ea39365f9..7b2d0bf2160 100644 --- a/gcc/doc/rtl.texi +++ b/gcc/doc/rtl.texi @@ -1509,7 +1509,12 @@ compute integer values. @findex MAX_BITSIZE_MODE_ANY_MODE @item MAX_BITSIZE_MODE_ANY_MODE -The bitsize of the largest mode on the target. +The bitsize of the largest mode on the target. The default value is +the largest mode size given in the mode definition file, which is +always correct for targets whose modes have a fixed size. Targets +that might increase the size of a mode beyond this default should define +@code{MAX_BITSIZE_MODE_ANY_MODE} to the actual upper limit in +@file{@var{machine}-modes.def}. @end table @findex byte_mode diff --git a/gcc/genmodes.c b/gcc/genmodes.c index c0964345a93..a70f0967859 100644 --- a/gcc/genmodes.c +++ b/gcc/genmodes.c @@ -792,6 +792,7 @@ make_vector_mode (enum mode_class bclass, static int bits_per_unit; static int max_bitsize_mode_any_int; +static int max_bitsize_mode_any_mode; static void create_modes (void) @@ -811,6 +812,12 @@ create_modes (void) #else max_bitsize_mode_any_int = 0; #endif + +#ifdef MAX_BITSIZE_MODE_ANY_MODE + max_bitsize_mode_any_mode = MAX_BITSIZE_MODE_ANY_MODE; +#else + max_bitsize_mode_any_mode = 0; +#endif } #ifndef NUM_POLY_INT_COEFFS @@ -989,12 +996,18 @@ emit_max_int (void) else printf ("#define MAX_BITSIZE_MODE_ANY_INT %d\n", max_bitsize_mode_any_int); - mmax = 0; - for (j = 0; j < MAX_MODE_CLASS; j++) - for (i = modes[j]; i; i = i->next) - if (mmax < i->bytesize) - mmax = i->bytesize; - printf ("#define MAX_BITSIZE_MODE_ANY_MODE (%d*BITS_PER_UNIT)\n", mmax); + if (max_bitsize_mode_any_mode == 0) + { + mmax = 0; + for (j = 0; j < MAX_MODE_CLASS; j++) + for (i = modes[j]; i; i = i->next) + if (mmax < i->bytesize) + mmax = i->bytesize; + printf ("#define MAX_BITSIZE_MODE_ANY_MODE (%d*BITS_PER_UNIT)\n", mmax); + } + else + printf ("#define MAX_BITSIZE_MODE_ANY_MODE %d\n", + max_bitsize_mode_any_mode); } /* Emit mode_size_inline routine into insn-modes.h header. */