genmodes.c (struct mode_data): Add need_bytesize_adj field.
* genmodes.c (struct mode_data): Add need_bytesize_adj field. (blank_mode): Initialize it. (emit_mode_size_inline, emit_mode_nunits_inline, emit_mode_inner_inline): New functions. (emit_insn_modes_h): Call them and surround their output with #if GCC_VERSION >= 4001 ... #endif. * machmode.h (GET_MODE_SIZE, GET_MODE_NUNITS, GET_MODE_INNER): For GCC_VERSION >= 4001 use mode_*_inline routines instead of mode_* arrays if the argument is __builtin_constant_p. * lower-subreg.c (dump_choices): Make sure GET_MODE_SIZE argument is enum machine_mode. fortran/ * trans-types.c (gfc_init_kinds): Make sure GET_MODE_BITSIZE argument is enum machine_mode. From-SVN: r209484
This commit is contained in:
parent
be55bfe6cf
commit
92f0f3ec92
|
@ -1,3 +1,17 @@
|
||||||
|
2014-04-17 Jakub Jelinek <jakub@redhat.com>
|
||||||
|
|
||||||
|
* genmodes.c (struct mode_data): Add need_bytesize_adj field.
|
||||||
|
(blank_mode): Initialize it.
|
||||||
|
(emit_mode_size_inline, emit_mode_nunits_inline,
|
||||||
|
emit_mode_inner_inline): New functions.
|
||||||
|
(emit_insn_modes_h): Call them and surround their output with
|
||||||
|
#if GCC_VERSION >= 4001 ... #endif.
|
||||||
|
* machmode.h (GET_MODE_SIZE, GET_MODE_NUNITS, GET_MODE_INNER):
|
||||||
|
For GCC_VERSION >= 4001 use mode_*_inline routines instead of
|
||||||
|
mode_* arrays if the argument is __builtin_constant_p.
|
||||||
|
* lower-subreg.c (dump_choices): Make sure GET_MODE_SIZE argument
|
||||||
|
is enum machine_mode.
|
||||||
|
|
||||||
2014-04-17 Trevor Saunders <tsaunders@mozilla.com>
|
2014-04-17 Trevor Saunders <tsaunders@mozilla.com>
|
||||||
|
|
||||||
* passes.c (opt_pass::execute): Adjust.
|
* passes.c (opt_pass::execute): Adjust.
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
2014-04-17 Jakub Jelinek <jakub@redhat.com>
|
||||||
|
|
||||||
|
* trans-types.c (gfc_init_kinds): Make sure GET_MODE_BITSIZE
|
||||||
|
argument is enum machine_mode.
|
||||||
|
|
||||||
2014-04-13 Paul Thomas <pault@gcc.gnu.org>
|
2014-04-13 Paul Thomas <pault@gcc.gnu.org>
|
||||||
|
|
||||||
PR fortran/58085
|
PR fortran/58085
|
||||||
|
|
|
@ -373,7 +373,7 @@ gfc_init_kinds (void)
|
||||||
/* The middle end doesn't support constants larger than 2*HWI.
|
/* The middle end doesn't support constants larger than 2*HWI.
|
||||||
Perhaps the target hook shouldn't have accepted these either,
|
Perhaps the target hook shouldn't have accepted these either,
|
||||||
but just to be safe... */
|
but just to be safe... */
|
||||||
bitsize = GET_MODE_BITSIZE (mode);
|
bitsize = GET_MODE_BITSIZE ((enum machine_mode) mode);
|
||||||
if (bitsize > 2*HOST_BITS_PER_WIDE_INT)
|
if (bitsize > 2*HOST_BITS_PER_WIDE_INT)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
109
gcc/genmodes.c
109
gcc/genmodes.c
|
@ -72,6 +72,8 @@ struct mode_data
|
||||||
unsigned int counter; /* Rank ordering of modes */
|
unsigned int counter; /* Rank ordering of modes */
|
||||||
unsigned int ibit; /* the number of integral bits */
|
unsigned int ibit; /* the number of integral bits */
|
||||||
unsigned int fbit; /* the number of fractional bits */
|
unsigned int fbit; /* the number of fractional bits */
|
||||||
|
bool need_bytesize_adj; /* true if this mode need dynamic size
|
||||||
|
adjustment */
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct mode_data *modes[MAX_MODE_CLASS];
|
static struct mode_data *modes[MAX_MODE_CLASS];
|
||||||
|
@ -82,7 +84,7 @@ static const struct mode_data blank_mode = {
|
||||||
0, "<unknown>", MAX_MODE_CLASS,
|
0, "<unknown>", MAX_MODE_CLASS,
|
||||||
-1U, -1U, -1U, -1U,
|
-1U, -1U, -1U, -1U,
|
||||||
0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0,
|
||||||
"<unknown>", 0, 0, 0, 0
|
"<unknown>", 0, 0, 0, 0, false
|
||||||
};
|
};
|
||||||
|
|
||||||
static htab_t modes_by_name;
|
static htab_t modes_by_name;
|
||||||
|
@ -904,6 +906,105 @@ emit_max_int (void)
|
||||||
printf ("#define MAX_BITSIZE_MODE_ANY_MODE (%d*BITS_PER_UNIT)\n", mmax);
|
printf ("#define MAX_BITSIZE_MODE_ANY_MODE (%d*BITS_PER_UNIT)\n", mmax);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Emit mode_size_inline routine into insn-modes.h header. */
|
||||||
|
static void
|
||||||
|
emit_mode_size_inline (void)
|
||||||
|
{
|
||||||
|
int c;
|
||||||
|
struct mode_adjust *a;
|
||||||
|
struct mode_data *m;
|
||||||
|
|
||||||
|
/* Size adjustments must be propagated to all containing modes. */
|
||||||
|
for (a = adj_bytesize; a; a = a->next)
|
||||||
|
{
|
||||||
|
a->mode->need_bytesize_adj = true;
|
||||||
|
for (m = a->mode->contained; m; m = m->next_cont)
|
||||||
|
m->need_bytesize_adj = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
printf ("\
|
||||||
|
#ifdef __cplusplus\n\
|
||||||
|
inline __attribute__((__always_inline__))\n\
|
||||||
|
#else\n\
|
||||||
|
extern __inline__ __attribute__((__always_inline__, __gnu_inline__))\n\
|
||||||
|
#endif\n\
|
||||||
|
unsigned char\n\
|
||||||
|
mode_size_inline (enum machine_mode mode)\n\
|
||||||
|
{\n\
|
||||||
|
extern %sunsigned char mode_size[NUM_MACHINE_MODES];\n\
|
||||||
|
switch (mode)\n\
|
||||||
|
{\n", adj_bytesize ? "" : "const ");
|
||||||
|
|
||||||
|
for_all_modes (c, m)
|
||||||
|
if (!m->need_bytesize_adj)
|
||||||
|
printf (" case %smode: return %u;\n", m->name, m->bytesize);
|
||||||
|
|
||||||
|
puts ("\
|
||||||
|
default: return mode_size[mode];\n\
|
||||||
|
}\n\
|
||||||
|
}\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Emit mode_nunits_inline routine into insn-modes.h header. */
|
||||||
|
static void
|
||||||
|
emit_mode_nunits_inline (void)
|
||||||
|
{
|
||||||
|
int c;
|
||||||
|
struct mode_data *m;
|
||||||
|
|
||||||
|
puts ("\
|
||||||
|
#ifdef __cplusplus\n\
|
||||||
|
inline __attribute__((__always_inline__))\n\
|
||||||
|
#else\n\
|
||||||
|
extern __inline__ __attribute__((__always_inline__, __gnu_inline__))\n\
|
||||||
|
#endif\n\
|
||||||
|
unsigned char\n\
|
||||||
|
mode_nunits_inline (enum machine_mode mode)\n\
|
||||||
|
{\n\
|
||||||
|
extern const unsigned char mode_nunits[NUM_MACHINE_MODES];\n\
|
||||||
|
switch (mode)\n\
|
||||||
|
{");
|
||||||
|
|
||||||
|
for_all_modes (c, m)
|
||||||
|
printf (" case %smode: return %u;\n", m->name, m->ncomponents);
|
||||||
|
|
||||||
|
puts ("\
|
||||||
|
default: return mode_nunits[mode];\n\
|
||||||
|
}\n\
|
||||||
|
}\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Emit mode_inner_inline routine into insn-modes.h header. */
|
||||||
|
static void
|
||||||
|
emit_mode_inner_inline (void)
|
||||||
|
{
|
||||||
|
int c;
|
||||||
|
struct mode_data *m;
|
||||||
|
|
||||||
|
puts ("\
|
||||||
|
#ifdef __cplusplus\n\
|
||||||
|
inline __attribute__((__always_inline__))\n\
|
||||||
|
#else\n\
|
||||||
|
extern __inline__ __attribute__((__always_inline__, __gnu_inline__))\n\
|
||||||
|
#endif\n\
|
||||||
|
unsigned char\n\
|
||||||
|
mode_inner_inline (enum machine_mode mode)\n\
|
||||||
|
{\n\
|
||||||
|
extern const unsigned char mode_inner[NUM_MACHINE_MODES];\n\
|
||||||
|
switch (mode)\n\
|
||||||
|
{");
|
||||||
|
|
||||||
|
for_all_modes (c, m)
|
||||||
|
printf (" case %smode: return %smode;\n", m->name,
|
||||||
|
c != MODE_PARTIAL_INT && m->component
|
||||||
|
? m->component->name : void_mode->name);
|
||||||
|
|
||||||
|
puts ("\
|
||||||
|
default: return mode_inner[mode];\n\
|
||||||
|
}\n\
|
||||||
|
}\n");
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
emit_insn_modes_h (void)
|
emit_insn_modes_h (void)
|
||||||
{
|
{
|
||||||
|
@ -969,6 +1070,12 @@ enum machine_mode\n{");
|
||||||
printf ("#define CONST_MODE_IBIT%s\n", adj_ibit ? "" : " const");
|
printf ("#define CONST_MODE_IBIT%s\n", adj_ibit ? "" : " const");
|
||||||
printf ("#define CONST_MODE_FBIT%s\n", adj_fbit ? "" : " const");
|
printf ("#define CONST_MODE_FBIT%s\n", adj_fbit ? "" : " const");
|
||||||
emit_max_int ();
|
emit_max_int ();
|
||||||
|
puts ("\n#if GCC_VERSION >= 4001\n");
|
||||||
|
emit_mode_size_inline ();
|
||||||
|
emit_mode_nunits_inline ();
|
||||||
|
emit_mode_inner_inline ();
|
||||||
|
puts ("#endif /* GCC_VERSION >= 4001 */");
|
||||||
|
|
||||||
puts ("\
|
puts ("\
|
||||||
\n\
|
\n\
|
||||||
#endif /* insn-modes.h */");
|
#endif /* insn-modes.h */");
|
||||||
|
|
|
@ -1371,7 +1371,7 @@ dump_choices (bool speed_p, const char *description)
|
||||||
fprintf (dump_file, "Choices when optimizing for %s:\n", description);
|
fprintf (dump_file, "Choices when optimizing for %s:\n", description);
|
||||||
|
|
||||||
for (i = 0; i < MAX_MACHINE_MODE; i++)
|
for (i = 0; i < MAX_MACHINE_MODE; i++)
|
||||||
if (GET_MODE_SIZE (i) > UNITS_PER_WORD)
|
if (GET_MODE_SIZE ((enum machine_mode) i) > UNITS_PER_WORD)
|
||||||
fprintf (dump_file, " %s mode %s for copy lowering.\n",
|
fprintf (dump_file, " %s mode %s for copy lowering.\n",
|
||||||
choices[speed_p].move_modes_to_split[i]
|
choices[speed_p].move_modes_to_split[i]
|
||||||
? "Splitting"
|
? "Splitting"
|
||||||
|
|
|
@ -177,7 +177,13 @@ extern const unsigned char mode_class[NUM_MACHINE_MODES];
|
||||||
/* Get the size in bytes and bits of an object of mode MODE. */
|
/* Get the size in bytes and bits of an object of mode MODE. */
|
||||||
|
|
||||||
extern CONST_MODE_SIZE unsigned char mode_size[NUM_MACHINE_MODES];
|
extern CONST_MODE_SIZE unsigned char mode_size[NUM_MACHINE_MODES];
|
||||||
|
#if GCC_VERSION >= 4001
|
||||||
|
#define GET_MODE_SIZE(MODE) \
|
||||||
|
((unsigned short) (__builtin_constant_p (MODE) \
|
||||||
|
? mode_size_inline (MODE) : mode_size[MODE]))
|
||||||
|
#else
|
||||||
#define GET_MODE_SIZE(MODE) ((unsigned short) mode_size[MODE])
|
#define GET_MODE_SIZE(MODE) ((unsigned short) mode_size[MODE])
|
||||||
|
#endif
|
||||||
#define GET_MODE_BITSIZE(MODE) \
|
#define GET_MODE_BITSIZE(MODE) \
|
||||||
((unsigned short) (GET_MODE_SIZE (MODE) * BITS_PER_UNIT))
|
((unsigned short) (GET_MODE_SIZE (MODE) * BITS_PER_UNIT))
|
||||||
|
|
||||||
|
@ -203,7 +209,13 @@ extern const unsigned HOST_WIDE_INT mode_mask_array[NUM_MACHINE_MODES];
|
||||||
/* Return the mode of the inner elements in a vector. */
|
/* Return the mode of the inner elements in a vector. */
|
||||||
|
|
||||||
extern const unsigned char mode_inner[NUM_MACHINE_MODES];
|
extern const unsigned char mode_inner[NUM_MACHINE_MODES];
|
||||||
|
#if GCC_VERSION >= 4001
|
||||||
|
#define GET_MODE_INNER(MODE) \
|
||||||
|
((enum machine_mode) (__builtin_constant_p (MODE) \
|
||||||
|
? mode_inner_inline (MODE) : mode_inner[MODE]))
|
||||||
|
#else
|
||||||
#define GET_MODE_INNER(MODE) ((enum machine_mode) mode_inner[MODE])
|
#define GET_MODE_INNER(MODE) ((enum machine_mode) mode_inner[MODE])
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Get the size in bytes or bites of the basic parts of an
|
/* Get the size in bytes or bites of the basic parts of an
|
||||||
object of mode MODE. */
|
object of mode MODE. */
|
||||||
|
@ -224,7 +236,13 @@ extern const unsigned char mode_inner[NUM_MACHINE_MODES];
|
||||||
/* Get the number of units in the object. */
|
/* Get the number of units in the object. */
|
||||||
|
|
||||||
extern const unsigned char mode_nunits[NUM_MACHINE_MODES];
|
extern const unsigned char mode_nunits[NUM_MACHINE_MODES];
|
||||||
|
#if GCC_VERSION >= 4001
|
||||||
|
#define GET_MODE_NUNITS(MODE) \
|
||||||
|
((unsigned char) (__builtin_constant_p (MODE) \
|
||||||
|
? mode_nunits_inline (MODE) : mode_nunits[MODE]))
|
||||||
|
#else
|
||||||
#define GET_MODE_NUNITS(MODE) mode_nunits[MODE]
|
#define GET_MODE_NUNITS(MODE) mode_nunits[MODE]
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Get the next wider natural mode (eg, QI -> HI -> SI -> DI -> TI). */
|
/* Get the next wider natural mode (eg, QI -> HI -> SI -> DI -> TI). */
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue