rtl.c: Define CONST_DOUBLE_FORMAT to the appropriate format for a CONST_DOUBLE...

1999-08-27 13:27 -0700  Zack Weinberg  <zack@bitmover.com>

	* rtl.c: Define CONST_DOUBLE_FORMAT to the appropriate format
	for a CONST_DOUBLE, at compile time.  Initialize rtx_length
	and class_narrowest_mode at compile time.  Kill init_rtl.
	Mark rtx_length, mode_class, mode_size, mode_unit_size,
	mode_wider_mode, mode_mask_array, class_narrowest_mode, and
	rtx_format as const.  Kill all references to EXTRA_CC_MODES or
	EXTRA_CC_NAMES.
	* rtl.def (CONST_DOUBLE): Use CONST_DOUBLE_FORMAT macro for
	format.
	* rtl.h: Declare rtx_length and rtx_format as const.
	* machmode.def: Define CC().  Use CC() to define CCmode.  If
	EXTRA_CC_MODES is defined, expand it here.
	* machmode.h: Declare mode_class, mode_size, mode_unit_size,
	mode_wider_mode, mode_mask_array, and class_narrowest_mode as
	const.  Kill all references to EXTRA_CC_MODES.

	* toplev.c: Don't prototype or call init_rtl.
	* optabs.c: Don't call init_mov_optab.
	* genemit.c: Don't generate init_mov_optab.  Don't call
	init_rtl.
	* gengenrtl.c: Duplicate calculation of CONST_DOUBLE_FORMAT
	here.
	* genattr.c, genattrtab.c, gencodes.c, genconfig.c,
	genextract.c, genflags.c, genopinit.c, genoutput.c, genpeep.c,
	genrecog.c: Don't call init_rtl.

	* arc.h, arm.h, c4x.h, i386.h, i960.h, m88k.h, pa.h, pdp11.h,
	rs6000.h, sparc.h: Don't define EXTRA_CC_NAMES.  Use CC() in
	definition of EXTRA_CC_MODES.

	* md.texi: Kill ref to EXTRA_CC_NAMES.
	* tm.texi: Document new way to define EXTRA_CC_MODES.

	* genrecog.c: Do not look up the name of a define_split.
	(Unrelated bugfix.)

From-SVN: r28937
This commit is contained in:
Zack Weinberg 1999-08-27 20:37:06 +00:00 committed by Zack Weinberg
parent b780db794f
commit aa0b446591
32 changed files with 192 additions and 237 deletions

View File

@ -1,3 +1,41 @@
1999-08-27 13:27 -0700 Zack Weinberg <zack@bitmover.com>
* rtl.c: Define CONST_DOUBLE_FORMAT to the appropriate format
for a CONST_DOUBLE, at compile time. Initialize rtx_length
and class_narrowest_mode at compile time. Kill init_rtl.
Mark rtx_length, mode_class, mode_size, mode_unit_size,
mode_wider_mode, mode_mask_array, class_narrowest_mode, and
rtx_format as const. Kill all references to EXTRA_CC_MODES or
EXTRA_CC_NAMES.
* rtl.def (CONST_DOUBLE): Use CONST_DOUBLE_FORMAT macro for
format.
* rtl.h: Declare rtx_length and rtx_format as const.
* machmode.def: Define CC(). Use CC() to define CCmode. If
EXTRA_CC_MODES is defined, expand it here.
* machmode.h: Declare mode_class, mode_size, mode_unit_size,
mode_wider_mode, mode_mask_array, and class_narrowest_mode as
const. Kill all references to EXTRA_CC_MODES.
* toplev.c: Don't prototype or call init_rtl.
* optabs.c: Don't call init_mov_optab.
* genemit.c: Don't generate init_mov_optab. Don't call
init_rtl.
* gengenrtl.c: Duplicate calculation of CONST_DOUBLE_FORMAT
here.
* genattr.c, genattrtab.c, gencodes.c, genconfig.c,
genextract.c, genflags.c, genopinit.c, genoutput.c, genpeep.c,
genrecog.c: Don't call init_rtl.
* arc.h, arm.h, c4x.h, i386.h, i960.h, m88k.h, pa.h, pdp11.h,
rs6000.h, sparc.h: Don't define EXTRA_CC_NAMES. Use CC() in
definition of EXTRA_CC_MODES.
* md.texi: Kill ref to EXTRA_CC_NAMES.
* tm.texi: Document new way to define EXTRA_CC_MODES.
* genrecog.c: Do not look up the name of a define_split.
(Unrelated bugfix.)
Fri Aug 27 17:03:42 1999 Nick Clifton <nickc@cygnus.com>
* config/v850/v850.md: Fix typo introduced by previous delta.

View File

@ -1047,9 +1047,9 @@ do { \
/* Some insns set all condition code flags, some only set the ZNC flags, and
some only set the ZN flags. */
#define EXTRA_CC_MODES CCZNCmode, CCZNmode
#define EXTRA_CC_NAMES "CCZNC", "CCZN"
#define EXTRA_CC_MODES \
CC(CCZNCmode, "CCZNC") \
CC(CCZNmode, "CCZN")
/* Given a comparison code (EQ, NE, etc.) and the first operand of a COMPARE,
return the mode to be used for the comparison. */

View File

@ -1889,14 +1889,23 @@ extern int making_const_table;
CC_Zmode should be used if only the Z flag is set correctly
CCmode should be used otherwise. */
#define EXTRA_CC_MODES CC_NOOVmode, CC_Zmode, CC_SWPmode, \
CCFPmode, CCFPEmode, CC_DNEmode, CC_DEQmode, CC_DLEmode, \
CC_DLTmode, CC_DGEmode, CC_DGTmode, CC_DLEUmode, CC_DLTUmode, \
CC_DGEUmode, CC_DGTUmode, CC_Cmode
#define EXTRA_CC_NAMES "CC_NOOV", "CC_Z", "CC_SWP", "CCFP", "CCFPE", \
"CC_DNE", "CC_DEQ", "CC_DLE", "CC_DLT", "CC_DGE", "CC_DGT", "CC_DLEU", \
"CC_DLTU", "CC_DGEU", "CC_DGTU", "CC_C"
#define EXTRA_CC_MODES \
CC(CC_NOOVmode, "CC_NOOV") \
CC(CC_Zmode, "CC_Z") \
CC(CC_SWPmode, "CC_SWP") \
CC(CCFPmode, "CCFP") \
CC(CCFPEmode, "CCFPE") \
CC(CC_DNEmode, "CC_DNE") \
CC(CC_DEQmode, "CC_DEQ") \
CC(CC_DLEmode, "CC_DLE") \
CC(CC_DLTmode, "CC_DLT") \
CC(CC_DGEmode, "CC_DGE") \
CC(CC_DGTmode, "CC_DGT") \
CC(CC_DLEUmode, "CC_DLEU") \
CC(CC_DLTUmode, "CC_DLTU") \
CC(CC_DGEUmode, "CC_DGEU") \
CC(CC_DGTUmode, "CC_DGTU") \
CC(CC_Cmode, "CC_C")
#define SELECT_CC_MODE(OP,X,Y) arm_select_cc_mode ((OP), (X), (Y))

View File

@ -1532,11 +1532,7 @@ extern struct rtx_def *c4x_function_arg();
load instructions after an add, subtract, neg, abs or multiply.
We must emit a compare insn to check the result against 0. */
#define EXTRA_CC_MODES CC_NOOVmode
/* Define the names for the modes specified above. */
#define EXTRA_CC_NAMES "CC_NOOV"
#define EXTRA_CC_MODES CC(CC_NOOVmode, "CC_NOOV")
/* CC_NOOVmode should be used when the first operand is a PLUS, MINUS, NEG
or MULT.

View File

@ -2299,10 +2299,7 @@ while (0)
For the i386, we need separate modes when floating-point equality
comparisons are being done. */
#define EXTRA_CC_MODES CCFPEQmode
/* Define the names for the modes specified above. */
#define EXTRA_CC_NAMES "CCFPEQ"
#define EXTRA_CC_MODES CC(CCFPEQmode, "CCFPEQ")
/* Given a comparison code (EQ, NE, etc.) and the first operand of a COMPARE,
return the mode to be used for the comparison.

View File

@ -1237,10 +1237,9 @@ extern struct rtx_def *gen_compare_reg ();
Also, signed and unsigned comparisons are distinguished, as
are operations which are compatible with chkbit insns. */
#define EXTRA_CC_MODES CC_UNSmode, CC_CHKmode
/* Define the names for the modes specified above. */
#define EXTRA_CC_NAMES "CC_UNS", "CC_CHK"
#define EXTRA_CC_MODES \
CC(CC_UNSmode, "CC_UNS") \
CC(CC_CHKmode, "CC_CHK")
/* Given a comparison code (EQ, NE, etc.) and the first operand of a COMPARE,
return the mode to be used for the comparison. For floating-point, CCFPmode

View File

@ -1252,9 +1252,7 @@ extern struct rtx_def *m88k_va_arg ();
/*** Addressing Modes ***/
#define EXTRA_CC_MODES CCEVENmode
#define EXTRA_CC_NAMES "CCEVEN"
#define EXTRA_CC_MODES CC(CCEVENmode, "CCEVEN")
#define SELECT_CC_MODE(OP,X,Y) CCmode

View File

@ -1710,10 +1710,7 @@ while (0)
/* Add any extra modes needed to represent the condition code.
HPPA floating comparisons produce condition codes. */
#define EXTRA_CC_MODES CCFPmode
/* Define the names for the modes specified above. */
#define EXTRA_CC_NAMES "CCFP"
#define EXTRA_CC_MODES CC(CCFPmode, "CCFP")
/* Given a comparison code (EQ, NE, etc.) and the first operand of a COMPARE,
return the mode to be used for the comparison. For floating-point, CCFPmode

View File

@ -944,10 +944,7 @@ extern int may_call_alloca;
/* Add any extra modes needed to represent the condition code.
CCFPmode is used for FPU, but should we use a separate reg? */
#define EXTRA_CC_MODES CCFPmode
/* the name for the mode above */
#define EXTRA_CC_NAMES "CCFPmode"
#define EXTRA_CC_MODES CC(CCFPmode, "CCFP")
/* Give a comparison code (EQ, NE etc) and the first operand of a COMPARE,
return the mode to be used for the comparison. For floating-point, CCFPmode

View File

@ -2412,10 +2412,10 @@ do { \
use a mode for the case when we are comparing the results of two
comparisons. */
#define EXTRA_CC_MODES CCUNSmode, CCFPmode, CCEQmode
/* Define the names for the modes specified above. */
#define EXTRA_CC_NAMES "CCUNS", "CCFP", "CCEQ"
#define EXTRA_CC_MODES \
CC(CCUNSmode, "CCUNS") \
CC(CCFPmode, "CCFP") \
CC(CCEQmode, "CCEQ")
/* Given a comparison code (EQ, NE, etc.) and the first operand of a COMPARE,
return the mode to be used for the comparison. For floating-point, CCFPmode

View File

@ -2566,11 +2566,12 @@ do { \
CCXmode and CCX_NOOVmode are only used by v9. */
#define EXTRA_CC_MODES CCXmode, CC_NOOVmode, CCX_NOOVmode, CCFPmode, CCFPEmode
/* Define the names for the modes specified above. */
#define EXTRA_CC_NAMES "CCX", "CC_NOOV", "CCX_NOOV", "CCFP", "CCFPE"
#define EXTRA_CC_MODES \
CC(CCXmode, "CCX") \
CC(CC_NOOVmode, "CC_NOOV") \
CC(CCX_NOOVmode, "CCX_NOOV") \
CC(CCFPmode, "CCFP") \
CC(CCFPEmode, "CCFPE")
/* Given a comparison code (EQ, NE, etc.) and the first operand of a COMPARE,
return the mode to be used for the comparison. For floating-point,

View File

@ -258,8 +258,6 @@ main (argc, argv)
exit (FATAL_EXIT_CODE);
}
init_rtl ();
printf ("/* Generated automatically by the program `genattr'\n\
from the machine description file `md'. */\n\n");

View File

@ -5982,8 +5982,6 @@ main (argc, argv)
exit (FATAL_EXIT_CODE);
}
init_rtl ();
/* Set up true and false rtx's */
true_rtx = rtx_alloc (CONST_INT);
XWINT (true_rtx, 0) = 1;

View File

@ -101,8 +101,6 @@ main (argc, argv)
exit (FATAL_EXIT_CODE);
}
init_rtl ();
printf ("/* Generated automatically by the program `gencodes'\n\
from the machine description file `md'. */\n\n");

View File

@ -290,8 +290,6 @@ main (argc, argv)
exit (FATAL_EXIT_CODE);
}
init_rtl ();
printf ("/* Generated automatically by the program `genconfig'\n\
from the machine description file `md'. */\n\n");

View File

@ -643,40 +643,6 @@ output_add_clobbers ()
printf ("}\n");
}
/* Write a function, init_mov_optab, that is called to set up entries
in mov_optab for EXTRA_CC_MODES. */
static void
output_init_mov_optab ()
{
#ifdef EXTRA_CC_NAMES
static char *cc_names[] = { EXTRA_CC_NAMES };
char *p;
size_t i;
printf ("\nvoid\ninit_mov_optab ()\n{\n");
for (i = 0; i < sizeof cc_names / sizeof cc_names[0]; i++)
{
printf ("#ifdef HAVE_mov");
for (p = cc_names[i]; *p; p++)
printf ("%c", *p >= 'A' && *p <= 'Z' ? *p - 'A' + 'a' : *p);
printf ("\n");
printf (" if (HAVE_mov");
for (p = cc_names[i]; *p; p++)
printf ("%c", *p >= 'A' && *p <= 'Z' ? *p - 'A' + 'a' : *p);
printf (")\n");
printf (" mov_optab->handlers[(int) %smode].insn_code = CODE_FOR_mov",
cc_names[i]);
for (p = cc_names[i]; *p; p++)
printf ("%c", *p >= 'A' && *p <= 'Z' ? *p - 'A' + 'a' : *p);
printf (";\n#endif\n");
}
printf ("}\n");
#endif
}
PTR
xmalloc (size)
size_t size;
@ -726,8 +692,6 @@ main (argc, argv)
exit (FATAL_EXIT_CODE);
}
init_rtl ();
/* Assign sequential codes to all entries in the machine description
in parallel with the tables in insn-output.c. */
@ -790,9 +754,6 @@ from the machine description file `md'. */\n\n");
/* Write out the routine to add CLOBBERs to a pattern. */
output_add_clobbers ();
/* Write the routine to initialize mov_optab for the EXTRA_CC_MODES. */
output_init_mov_optab ();
fflush (stdout);
exit (ferror (stdout) != 0 ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE);
/* NOTREACHED */

View File

@ -402,8 +402,6 @@ main (argc, argv)
exit (FATAL_EXIT_CODE);
}
init_rtl ();
/* Assign sequential codes to all entries in the machine description
in parallel with the tables in insn-output.c. */

View File

@ -227,8 +227,6 @@ main (argc, argv)
exit (FATAL_EXIT_CODE);
}
init_rtl ();
printf ("/* Generated automatically by the program `genflags'\n\
from the machine description file `md'. */\n\n");

View File

@ -26,6 +26,27 @@ Boston, MA 02111-1307, USA. */
#include "rtl.h"
#undef abort
#include "real.h"
/* Calculate the format for CONST_DOUBLE. This depends on the relative
widths of HOST_WIDE_INT and REAL_VALUE_TYPE.
We only need to go out to e0wwww, since min(HOST_WIDE_INT)==32 and
max(LONG_DOUBLE_TYPE_SIZE)==128.
This is duplicated in rtl.c.
A number of places assume that there are always at least two 'w'
slots in a CONST_DOUBLE, so we provide them even if one would suffice. */
#if HOST_BITS_PER_WIDE_INT >= LONG_DOUBLE_TYPE_SIZE
#define CONST_DOUBLE_FORMAT "e0ww"
#elif HOST_BITS_PER_WIDE_INT*2 >= LONG_DOUBLE_TYPE_SIZE
#define CONST_DOUBLE_FORMAT "e0ww"
#elif HOST_BITS_PER_WIDE_INT*3 >= LONG_DOUBLE_TYPE_SIZE
#define CONST_DOUBLE_FORMAT "e0www"
#elif HOST_BITS_PER_WIDE_INT*4 >= LONG_DOUBLE_TYPE_SIZE
#define CONST_DOUBLE_FORMAT "e0wwww"
#else
#define CONST_DOUBLE_FORMAT /* nothing - will cause syntax error */
#endif
struct rtx_definition
{

View File

@ -326,8 +326,6 @@ main (argc, argv)
exit (FATAL_EXIT_CODE);
}
init_rtl ();
printf ("/* Generated automatically by the program `genopinit'\n\
from the machine description file `md'. */\n\n");

View File

@ -162,10 +162,6 @@ struct data *end_of_insn_data;
int have_constraints;
/* Nonzero if some error has occurred. We will make all errors fatal, but
might as well continue until we see all of them. */
static int have_error;
static char * name_for_index PROTO((int));
static void output_prologue PROTO((void));
@ -951,8 +947,6 @@ main (argc, argv)
exit (FATAL_EXIT_CODE);
}
init_rtl ();
output_prologue ();
next_code_number = 0;
next_index_number = 0;

View File

@ -431,8 +431,6 @@ main (argc, argv)
exit (FATAL_EXIT_CODE);
}
init_rtl ();
printf ("/* Generated automatically by the program `genpeep'\n\
from the machine description file `md'. */\n\n");

View File

@ -213,7 +213,7 @@ make_insn_sequence (insn, type)
{
static const char *last_real_name = "insn";
static int last_real_code = 0;
char *name;
char *name = 0;
if (insn_name_ptr_size <= next_insn_code)
{
@ -226,7 +226,8 @@ make_insn_sequence (insn, type)
insn_name_ptr_size = new_size;
}
name = XSTR (insn, 0);
if (type == RECOG)
name = XSTR (insn, 0);
if (!name || name[0] == '\0')
{
name = xmalloc (strlen (last_real_name) + 10);
@ -1733,7 +1734,6 @@ main (argc, argv)
exit (FATAL_EXIT_CODE);
}
init_rtl ();
next_insn_code = 0;
next_index = 0;

View File

@ -106,11 +106,20 @@ DEF_MACHMODE (BLKmode, "BLK", MODE_RANDOM, 0, 0, VOIDmode)
/* The modes for representing the condition codes come last. CCmode is
always defined. Additional modes for the condition code can be specified
in the EXTRA_CC_MODES macro. Everything but the names of the modes
are copied from CCmode. For these modes, GET_MODE_WIDER_MODE points
to the next defined CC mode, if any. */
in the EXTRA_CC_MODES macro.
All MODE_CC modes are the same width as SImode and have VOIDmode as their
next wider mode.
*/
DEF_MACHMODE (CCmode, "CC", MODE_CC, 4, 4, VOIDmode)
#define CC(E, M) DEF_MACHMODE (E, M, MODE_CC, 4, 4, VOIDmode)
CC (CCmode, "CC")
#ifdef EXTRA_CC_MODES
EXTRA_CC_MODES
#endif
#undef CC
/* The symbol Pmode stands for one of the above machine modes (usually SImode).
The tm file specifies which one. It is not a distinct mode. */

View File

@ -42,10 +42,6 @@ Boston, MA 02111-1307, USA. */
enum machine_mode {
#include "machmode.def"
#ifdef EXTRA_CC_MODES
EXTRA_CC_MODES,
#endif
MAX_MACHINE_MODE };
#undef DEF_MACHMODE
@ -65,7 +61,7 @@ enum mode_class { MODE_RANDOM, MODE_INT, MODE_FLOAT, MODE_PARTIAL_INT, MODE_CC,
/* Get the general kind of object that mode MODE represents
(integer, floating, complex, etc.) */
extern enum mode_class mode_class[];
extern const enum mode_class mode_class[];
#define GET_MODE_CLASS(MODE) (mode_class[(int) (MODE)])
/* Nonzero if MODE is an integral mode. */
@ -86,12 +82,12 @@ extern enum mode_class mode_class[];
/* Get the size in bytes of an object of mode MODE. */
extern int mode_size[];
extern const int mode_size[];
#define GET_MODE_SIZE(MODE) (mode_size[(int) (MODE)])
/* Get the size in bytes of the basic parts of an object of mode MODE. */
extern int mode_unit_size[];
extern const int mode_unit_size[];
#define GET_MODE_UNIT_SIZE(MODE) (mode_unit_size[(int) (MODE)])
/* Get the number of units in the object. */
@ -109,7 +105,7 @@ extern int mode_unit_size[];
/* Get a bitmask containing 1 for all bits in a word
that fit within mode MODE. */
extern unsigned HOST_WIDE_INT mode_mask_array[];
extern const unsigned HOST_WIDE_INT mode_mask_array[];
#define GET_MODE_MASK(MODE) mode_mask_array[(int) (MODE)]
@ -117,7 +113,7 @@ extern unsigned HOST_WIDE_INT mode_mask_array[];
/* Get the next wider natural mode (eg, QI -> HI -> SI -> DI -> TI). */
extern unsigned char mode_wider_mode[];
extern const unsigned char mode_wider_mode[];
#define GET_MODE_WIDER_MODE(MODE) ((enum machine_mode)mode_wider_mode[(int) (MODE)])
/* Return the mode for data of a given size SIZE and mode class CLASS.
@ -149,7 +145,7 @@ extern enum machine_mode get_best_mode PROTO((int, int, int, enum machine_mode,
/* For each class, get the narrowest mode in that class. */
extern enum machine_mode class_narrowest_mode[];
extern const enum machine_mode class_narrowest_mode[];
#define GET_CLASS_NARROWEST_MODE(CLASS) class_narrowest_mode[(int) (CLASS)]
/* Define the integer modes whose sizes are BITS_PER_UNIT and BITS_PER_WORD

View File

@ -2787,7 +2787,6 @@ is in class @code{MODE_CC}. Normally, it will be @code{CCmode}. If
additional modes are required (as for the add example mentioned above in
the Sparc), define the macro @code{EXTRA_CC_MODES} to list the
additional modes required (@pxref{Condition Code}). Also define
@code{EXTRA_CC_NAMES} to list the names of those modes and
@code{SELECT_CC_MODE} to choose a mode given an operand of a compare.
If it is known during RTL generation that a different mode will be

View File

@ -4612,10 +4612,6 @@ init_optabs ()
fixtrunctab[i][j][1] = fixtrunctab[i][j][0];
#endif
#ifdef EXTRA_CC_MODES
init_mov_optab ();
#endif
/* Initialize the optabs with the names of the library functions. */
init_integral_libfuncs (add_optab, "add", '3');
init_floating_libfuncs (add_optab, "add", '3');

131
gcc/rtl.c
View File

@ -41,11 +41,36 @@ Boston, MA 02111-1307, USA. */
extern struct obstack *rtl_obstack;
/* Indexed by rtx code, gives number of operands for an rtx with that code.
Does NOT include rtx header data (code and links).
This array is initialized in init_rtl. */
int rtx_length[NUM_RTX_CODE + 1];
/* Calculate the format for CONST_DOUBLE. This depends on the relative
widths of HOST_WIDE_INT and REAL_VALUE_TYPE.
We only need to go out to e0wwww, since min(HOST_WIDE_INT)==32 and
max(LONG_DOUBLE_TYPE_SIZE)==128.
This is duplicated in gengenrtl.c.
A number of places assume that there are always at least two 'w'
slots in a CONST_DOUBLE, so we provide them even if one would suffice. */
#if HOST_BITS_PER_WIDE_INT >= LONG_DOUBLE_TYPE_SIZE
#define CONST_DOUBLE_FORMAT "e0ww"
#elif HOST_BITS_PER_WIDE_INT*2 >= LONG_DOUBLE_TYPE_SIZE
#define CONST_DOUBLE_FORMAT "e0ww"
#elif HOST_BITS_PER_WIDE_INT*3 >= LONG_DOUBLE_TYPE_SIZE
#define CONST_DOUBLE_FORMAT "e0www"
#elif HOST_BITS_PER_WIDE_INT*4 >= LONG_DOUBLE_TYPE_SIZE
#define CONST_DOUBLE_FORMAT "e0wwww"
#else
#define CONST_DOUBLE_FORMAT /* nothing - will cause syntax error */
#endif
/* Indexed by rtx code, gives number of operands for an rtx with that code.
Does NOT include rtx header data (code and links). */
#define DEF_RTL_EXPR(ENUM, NAME, FORMAT, CLASS) sizeof FORMAT - 1 ,
const int rtx_length[NUM_RTX_CODE + 1] = {
#include "rtl.def"
};
#undef DEF_RTL_EXPR
/* Indexed by rtx code, gives the name of that kind of rtx, as a C string. */
@ -64,10 +89,6 @@ const char * const rtx_name[] = {
const char * const mode_name[(int) MAX_MACHINE_MODE + 1] = {
#include "machmode.def"
#ifdef EXTRA_CC_MODES
EXTRA_CC_NAMES,
#endif
/* Add an extra field to avoid a core dump if someone tries to convert
MAX_MACHINE_MODE to a string. */
""
@ -80,7 +101,7 @@ const char * const mode_name[(int) MAX_MACHINE_MODE + 1] = {
#define DEF_MACHMODE(SYM, NAME, CLASS, SIZE, UNIT, WIDER) CLASS,
enum mode_class mode_class[(int) MAX_MACHINE_MODE] = {
const enum mode_class mode_class[(int) MAX_MACHINE_MODE] = {
#include "machmode.def"
};
@ -91,7 +112,7 @@ enum mode_class mode_class[(int) MAX_MACHINE_MODE] = {
#define DEF_MACHMODE(SYM, NAME, CLASS, SIZE, UNIT, WIDER) SIZE,
int mode_size[(int) MAX_MACHINE_MODE] = {
const int mode_size[(int) MAX_MACHINE_MODE] = {
#include "machmode.def"
};
@ -102,7 +123,7 @@ int mode_size[(int) MAX_MACHINE_MODE] = {
#define DEF_MACHMODE(SYM, NAME, CLASS, SIZE, UNIT, WIDER) UNIT,
int mode_unit_size[(int) MAX_MACHINE_MODE] = {
const int mode_unit_size[(int) MAX_MACHINE_MODE] = {
#include "machmode.def" /* machine modes are documented here */
};
@ -115,7 +136,7 @@ int mode_unit_size[(int) MAX_MACHINE_MODE] = {
#define DEF_MACHMODE(SYM, NAME, CLASS, SIZE, UNIT, WIDER) \
(unsigned char) WIDER,
unsigned char mode_wider_mode[(int) MAX_MACHINE_MODE] = {
const unsigned char mode_wider_mode[(int) MAX_MACHINE_MODE] = {
#include "machmode.def" /* machine modes are documented here */
};
@ -126,19 +147,30 @@ unsigned char mode_wider_mode[(int) MAX_MACHINE_MODE] = {
/* Indexed by machine mode, gives mask of significant bits in mode. */
unsigned HOST_WIDE_INT mode_mask_array[(int) MAX_MACHINE_MODE] = {
const unsigned HOST_WIDE_INT mode_mask_array[(int) MAX_MACHINE_MODE] = {
#include "machmode.def"
};
/* Indexed by mode class, gives the narrowest mode for each class. */
/* Indexed by mode class, gives the narrowest mode for each class.
The Q modes are always of width 1 (2 for complex) - it is impossible
for any mode to be narrower. */
enum machine_mode class_narrowest_mode[(int) MAX_MODE_CLASS];
const enum machine_mode class_narrowest_mode[(int) MAX_MODE_CLASS] = {
/* MODE_RANDOM */ VOIDmode,
/* MODE_INT */ QImode,
/* MODE_FLOAT */ QFmode,
/* MODE_PARTIAL_INT */ PQImode,
/* MODE_CC */ CCmode,
/* MODE_COMPLEX_INT */ CQImode,
/* MODE_COMPLEX_FLOAT */ QCmode
};
/* Indexed by rtx code, gives a sequence of operand-types for
rtx's of that code. The sequence is a C string in which
each character describes one operand. */
const char *rtx_format[] = {
const char * const rtx_format[] = {
/* "*" undefined.
can cause a warning message
"0" field is unused (or used in a phase-dependent manner)
@ -901,71 +933,6 @@ read_rtx (infile)
return return_rtx;
}
/* This is called once per compilation, before any rtx's are constructed.
It initializes the vector `rtx_length', the extra CC modes, if any,
and computes certain commonly-used modes. */
void
init_rtl ()
{
int min_class_size[(int) MAX_MODE_CLASS];
enum machine_mode mode;
int i;
for (i = 0; i < NUM_RTX_CODE; i++)
rtx_length[i] = strlen (GET_RTX_FORMAT(i));
/* Make CONST_DOUBLE bigger, if real values are bigger than
it normally expects to have room for.
Note that REAL_VALUE_TYPE is not defined by default,
since tree.h is not included. But the default dfn as `double'
would do no harm. */
#ifdef REAL_VALUE_TYPE
i = sizeof (REAL_VALUE_TYPE) / sizeof (rtunion) + 2;
if (rtx_length[(int) CONST_DOUBLE] < i)
{
char *s = (char *) xmalloc (i + 1);
rtx_length[(int) CONST_DOUBLE] = i;
rtx_format[(int) CONST_DOUBLE] = s;
*s++ = 'e';
*s++ = '0';
/* Set the GET_RTX_FORMAT of CONST_DOUBLE to a string
of as many `w's as we now have elements. Subtract two from
the size to account for the 'e' and the '0'. */
for (i = 2; i < rtx_length[(int) CONST_DOUBLE]; i++)
*s++ = 'w';
*s++ = 0;
}
#endif
#ifdef EXTRA_CC_MODES
for (i = (int) CCmode + 1; i < (int) MAX_MACHINE_MODE; i++)
{
mode_class[i] = MODE_CC;
mode_mask_array[i] = mode_mask_array[(int) CCmode];
mode_size[i] = mode_size[(int) CCmode];
mode_unit_size[i] = mode_unit_size[(int) CCmode];
mode_wider_mode[i - 1] = i;
mode_wider_mode[i] = (unsigned char)VOIDmode;
}
#endif
/* Find the narrowest mode for each class. */
for (i = 0; i < (int) MAX_MODE_CLASS; i++)
min_class_size[i] = 1000;
for (mode = VOIDmode; (int) mode < (int) MAX_MACHINE_MODE;
mode = (enum machine_mode) ((int) mode + 1))
{
if (GET_MODE_SIZE (mode) < min_class_size[(int) GET_MODE_CLASS (mode)])
{
class_narrowest_mode[(int) GET_MODE_CLASS (mode)] = mode;
min_class_size[(int) GET_MODE_CLASS (mode)] = GET_MODE_SIZE (mode);
}
}
}
/* These are utility functions used by fatal-error functions all over the
code. rtl.c happens to be linked by all the programs that need them,
@ -980,7 +947,7 @@ static const char *
trim_filename (name)
const char *name;
{
static const char *this_file = __FILE__;
static const char this_file[] = __FILE__;
const char *p = name, *q = this_file;
while (*p == *q && *p != 0 && *q != 0) p++, q++;

View File

@ -509,14 +509,15 @@ DEF_RTL_EXPR(TRAP_IF, "trap_if", "ee", 'x')
/* numeric integer constant */
DEF_RTL_EXPR(CONST_INT, "const_int", "w", 'o')
/* numeric double constant.
Operand 0 is the MEM that stores this constant in memory,
or various other things (see comments at immed_double_const in varasm.c).
Operand 1 is a chain of all CONST_DOUBLEs in use in the current function.
Remaining operands hold the actual value.
The number of operands may be more than 2 if cross-compiling;
see init_rtl. */
DEF_RTL_EXPR(CONST_DOUBLE, "const_double", "e0ww", 'o')
/* numeric floating point constant.
Operand 0 ('e') is the MEM that stores this constant in memory, or
various other things (see comments at immed_double_const in
varasm.c).
Operand 1 ('0') is a chain of all CONST_DOUBLEs in use in the
current function.
Remaining operands hold the actual value. They are all 'w' and
there may be from 1 to 4; see rtl.c. */
DEF_RTL_EXPR(CONST_DOUBLE, "const_double", CONST_DOUBLE_FORMAT, 'o')
/* String constant. Used only for attributes right now. */
DEF_RTL_EXPR(CONST_STRING, "const_string", "s", 'o')

View File

@ -48,13 +48,13 @@ enum rtx_code {
#define NUM_RTX_CODE ((int)LAST_AND_UNUSED_RTX_CODE)
/* The cast here, saves many elsewhere. */
extern int rtx_length[];
extern const int rtx_length[];
#define GET_RTX_LENGTH(CODE) (rtx_length[(int) (CODE)])
extern const char * const rtx_name[];
#define GET_RTX_NAME(CODE) (rtx_name[(int) (CODE)])
extern const char *rtx_format[];
extern const char * const rtx_format[];
#define GET_RTX_FORMAT(CODE) (rtx_format[(int) (CODE)])
extern const char rtx_class[];

View File

@ -4498,27 +4498,24 @@ two places, the @file{md} file and in @code{NOTICE_UPDATE_CC}.
@findex EXTRA_CC_MODES
@item EXTRA_CC_MODES
A list of names to be used for additional modes for condition code
values in registers (@pxref{Jump Patterns}). These names are added
to @code{enum machine_mode} and all have class @code{MODE_CC}. By
convention, they should start with @samp{CC} and end with @samp{mode}.
A list of additional modes for condition code values in registers
(@pxref{Jump Patterns}). This macro should expand to a sequence of
calls of the macro @code{CC} separated by white space. @code{CC} takes
two arguments. The first is the enumeration name of the mode, which
should begin with @samp{CC} and end with @samp{mode}. The second is a C
string giving the printable name of the mode; it should be the same as
the first argument, but with the trailing @samp{mode} removed.
You should only define this macro if your machine does not use @code{cc0}
and only if additional modes are required.
@findex EXTRA_CC_NAMES
@item EXTRA_CC_NAMES
A list of C strings giving the names for the modes listed in
@code{EXTRA_CC_MODES}. For example, the Sparc defines this macro and
@code{EXTRA_CC_MODES} as
You should only define this macro if additional modes are required.
A sample definition of @code{EXTRA_CC_MODES} is:
@smallexample
#define EXTRA_CC_MODES CC_NOOVmode, CCFPmode, CCFPEmode
#define EXTRA_CC_NAMES "CC_NOOV", "CCFP", "CCFPE"
#define EXTRA_CC_MODES \
CC(CC_NOOVmode, "CC_NOOV") \
CC(CCFPmode, "CCFP") \
CC(CCFPEmode, "CCFPE")
@end smallexample
This macro is not required if @code{EXTRA_CC_MODES} is not defined.
@findex SELECT_CC_MODE
@item SELECT_CC_MODE (@var{op}, @var{x}, @var{y})
Returns a mode from class @code{MODE_CC} to be used when comparison

View File

@ -153,7 +153,6 @@ extern void finish_parse ();
extern void init_decl_processing ();
extern void init_obstacks ();
extern void init_tree_codes ();
extern void init_rtl ();
extern void init_regs ();
extern void init_optabs ();
extern void init_stmt ();
@ -2895,7 +2894,6 @@ compile_file (name)
init_obstacks ();
init_tree_codes ();
name = init_parse (name);
init_rtl ();
init_emit_once (debug_info_level == DINFO_LEVEL_NORMAL
|| debug_info_level == DINFO_LEVEL_VERBOSE
|| flag_test_coverage