Commit 98ac7913 by Richard Sandiford Committed by Richard Sandiford

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  <richard.sandiford@linaro.org>

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
parent b187677b
2018-01-03 Richard Sandiford <richard.sandiford@linaro.org> 2018-01-03 Richard Sandiford <richard.sandiford@linaro.org>
* 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 <richard.sandiford@linaro.org>
Alan Hayward <alan.hayward@arm.com> Alan Hayward <alan.hayward@arm.com>
David Sherwood <david.sherwood@arm.com> David Sherwood <david.sherwood@arm.com>
......
...@@ -1509,7 +1509,12 @@ compute integer values. ...@@ -1509,7 +1509,12 @@ compute integer values.
@findex MAX_BITSIZE_MODE_ANY_MODE @findex MAX_BITSIZE_MODE_ANY_MODE
@item 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 @end table
@findex byte_mode @findex byte_mode
......
...@@ -792,6 +792,7 @@ make_vector_mode (enum mode_class bclass, ...@@ -792,6 +792,7 @@ make_vector_mode (enum mode_class bclass,
static int bits_per_unit; static int bits_per_unit;
static int max_bitsize_mode_any_int; static int max_bitsize_mode_any_int;
static int max_bitsize_mode_any_mode;
static void static void
create_modes (void) create_modes (void)
...@@ -811,6 +812,12 @@ create_modes (void) ...@@ -811,6 +812,12 @@ create_modes (void)
#else #else
max_bitsize_mode_any_int = 0; max_bitsize_mode_any_int = 0;
#endif #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 #ifndef NUM_POLY_INT_COEFFS
...@@ -989,12 +996,18 @@ emit_max_int (void) ...@@ -989,12 +996,18 @@ emit_max_int (void)
else else
printf ("#define MAX_BITSIZE_MODE_ANY_INT %d\n", max_bitsize_mode_any_int); printf ("#define MAX_BITSIZE_MODE_ANY_INT %d\n", max_bitsize_mode_any_int);
mmax = 0; if (max_bitsize_mode_any_mode == 0)
for (j = 0; j < MAX_MODE_CLASS; j++) {
for (i = modes[j]; i; i = i->next) mmax = 0;
if (mmax < i->bytesize) for (j = 0; j < MAX_MODE_CLASS; j++)
mmax = i->bytesize; for (i = modes[j]; i; i = i->next)
printf ("#define MAX_BITSIZE_MODE_ANY_MODE (%d*BITS_PER_UNIT)\n", mmax); 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. */ /* Emit mode_size_inline routine into insn-modes.h header. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment