machmode.def (Pmode): Redefine if GENERATOR_FILE.

* machmode.def (Pmode): Redefine if GENERATOR_FILE.
        * genrecog.c (maybe_both_true_mode): New.
        (maybe_both_true_2): Use it.
        (write_switch): Don't put Pmode in a switch.
        * rtl.c (mode arrays): Don't explicitly size them.

From-SVN: r44029
This commit is contained in:
Richard Henderson 2001-07-15 17:28:20 -07:00 committed by Richard Henderson
parent 25dfa34d50
commit 9e9f3eded6
4 changed files with 58 additions and 13 deletions

View File

@ -1,3 +1,11 @@
2001-07-15 Richard Henderson <rth@redhat.com>
* machmode.def (Pmode): Redefine if GENERATOR_FILE.
* genrecog.c (maybe_both_true_mode): New.
(maybe_both_true_2): Use it.
(write_switch): Don't put Pmode in a switch.
* rtl.c (mode arrays): Don't explicitly size them.
Sun Jul 15 14:07:36 CEST 2001 Jan Hubicka <jh@suse.cz>
* toplev.c (rest_of_compilation): Fix register_life_up_to_date

View File

@ -238,6 +238,8 @@ static void validate_pattern
static struct decision *add_to_sequence
PARAMS ((rtx, struct decision_head *, const char *, enum routine_type, int));
static int maybe_both_true_mode
PARAMS ((enum machine_mode, enum machine_mode));
static int maybe_both_true_2
PARAMS ((struct decision_test *, struct decision_test *));
static int maybe_both_true_1
@ -1054,6 +1056,29 @@ add_to_sequence (pattern, last, position, insn_type, top)
return sub;
}
/* A subroutine of maybe_both_true; compares two modes.
Returns > 0 for "definitely both true" and < 0 for "maybe both true". */
static int
maybe_both_true_mode (m1, m2)
enum machine_mode m1, m2;
{
enum mode_class other_mode_class;
/* Pmode is not a distinct mode. We do know that it is
either MODE_INT or MODE_PARTIAL_INT though. */
if (m1 == Pmode)
other_mode_class = GET_MODE_CLASS (m2);
else if (m2 == Pmode)
other_mode_class = GET_MODE_CLASS (m1);
else
return m1 == m2;
return (other_mode_class == MODE_INT
|| other_mode_class == MODE_PARTIAL_INT
? -1 : 0);
}
/* A subroutine of maybe_both_true; examines only one test.
Returns > 0 for "definitely both true" and < 0 for "maybe both true". */
@ -1066,7 +1091,7 @@ maybe_both_true_2 (d1, d2)
switch (d1->type)
{
case DT_mode:
return d1->u.mode == d2->u.mode;
return maybe_both_true_mode (d1->u.mode, d2->u.mode);
case DT_code:
return d1->u.code == d2->u.code;
@ -1102,7 +1127,7 @@ maybe_both_true_2 (d1, d2)
{
if (d2->type == DT_mode)
{
if (d1->u.pred.mode != d2->u.mode
if (maybe_both_true_mode (d1->u.pred.mode, d2->u.mode) == 0
/* The mode of an address_operand predicate is the
mode of the memory, not the operand. It can only
be used for testing the predicate, so we must
@ -1884,6 +1909,10 @@ write_switch (start, depth)
|| type == DT_elt_one_int
|| type == DT_elt_zero_wide_safe)
{
/* Pmode may not be a compile-time constant. */
if (type == DT_mode && p->tests->u.mode == Pmode)
return p;
printf (" switch (");
switch (type)
{
@ -1919,6 +1948,10 @@ write_switch (start, depth)
if (nodes_identical_1 (p->tests, q->tests))
goto case_done;
/* Pmode may not be a compile-time constant. */
if (type == DT_mode && p->tests->u.mode == Pmode)
goto case_done;
if (p != start && p->need_label && needs_label == NULL)
needs_label = p;

View File

@ -154,7 +154,14 @@ EXTRA_CC_MODES
#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. */
The tm file specifies which one. It is not a distinct mode. Nevertheless,
while processing the md file, we wish to treat as a distinct mode so that
it is preserved intact through to the insn-foo.c files. This eliminates a
lot of redundancy in ports that support both 32-bit and 64-bit targets. */
#ifdef GENERATOR_FILE
#undef Pmode
DEF_MACHMODE (Pmode, "P", MODE_RANDOM, 0, 0, 0, VOIDmode)
#endif
/*
Local variables:

View File

@ -117,11 +117,8 @@ const char * const rtx_name[] = {
#define DEF_MACHMODE(SYM, NAME, CLASS, BITSIZE, SIZE, UNIT, WIDER) NAME,
const char * const mode_name[(int) MAX_MACHINE_MODE + 1] = {
const char * const mode_name[] = {
#include "machmode.def"
/* Add an extra field to avoid a core dump if someone tries to convert
MAX_MACHINE_MODE to a string. */
""
};
#undef DEF_MACHMODE
@ -130,7 +127,7 @@ const char * const mode_name[(int) MAX_MACHINE_MODE + 1] = {
#define DEF_MACHMODE(SYM, NAME, CLASS, BITSIZE, SIZE, UNIT, WIDER) CLASS,
const enum mode_class mode_class[(int) MAX_MACHINE_MODE] = {
const enum mode_class mode_class[] = {
#include "machmode.def"
};
@ -141,7 +138,7 @@ const enum mode_class mode_class[(int) MAX_MACHINE_MODE] = {
#define DEF_MACHMODE(SYM, NAME, CLASS, BITSIZE, SIZE, UNIT, WIDER) BITSIZE,
const unsigned int mode_bitsize[(int) MAX_MACHINE_MODE] = {
const unsigned int mode_bitsize[] = {
#include "machmode.def"
};
@ -152,7 +149,7 @@ const unsigned int mode_bitsize[(int) MAX_MACHINE_MODE] = {
#define DEF_MACHMODE(SYM, NAME, CLASS, BITSIZE, SIZE, UNIT, WIDER) SIZE,
const unsigned int mode_size[(int) MAX_MACHINE_MODE] = {
const unsigned int mode_size[] = {
#include "machmode.def"
};
@ -163,7 +160,7 @@ const unsigned int mode_size[(int) MAX_MACHINE_MODE] = {
#define DEF_MACHMODE(SYM, NAME, CLASS, BITSIZE, SIZE, UNIT, WIDER) UNIT,
const unsigned int mode_unit_size[(int) MAX_MACHINE_MODE] = {
const unsigned int mode_unit_size[] = {
#include "machmode.def" /* machine modes are documented here */
};
@ -176,7 +173,7 @@ const unsigned int mode_unit_size[(int) MAX_MACHINE_MODE] = {
#define DEF_MACHMODE(SYM, NAME, CLASS, BITSIZE, SIZE, UNIT, WIDER) \
(unsigned char) WIDER,
const unsigned char mode_wider_mode[(int) MAX_MACHINE_MODE] = {
const unsigned char mode_wider_mode[] = {
#include "machmode.def" /* machine modes are documented here */
};
@ -187,7 +184,7 @@ const unsigned char mode_wider_mode[(int) MAX_MACHINE_MODE] = {
/* Indexed by machine mode, gives mask of significant bits in mode. */
const unsigned HOST_WIDE_INT mode_mask_array[(int) MAX_MACHINE_MODE] = {
const unsigned HOST_WIDE_INT mode_mask_array[] = {
#include "machmode.def"
};