+2015-08-21 Richard Sandiford <richard.sandiford@arm.com>
+
+ * gencodes.c (gencodes): Print the comma for the preceding
+ enum value rather than the current one. Use aliased enum values
+ rather than #defines for compiled-out patterns.
+ (main): Update accordingly. Replace LAST_INSN_CODE with
+ NUM_INSN_CODES.
+ * lra.c (insn_code_data): Update accordingly.
+ (finish_insn_code_data_once, get_static_insn_data): Likewise.
+ * recog.h (target_recog): Likewise.
+ (preprocess_insn_constraints): Change parameter to unsigned int.
+ * recog.c (preprocess_insn_constraints): Likewise.
+ (recog_init): Replace LAST_INSN_CODE with NUM_INSN_CODES.
+ * tree-vect-stmts.c (vectorizable_operation): Simplify.
+
2015-08-21 Markus Trippelsdorf <markus@trippelsdorf.de>
PR rtl-optimization/61657
if (name[0] != 0 && name[0] != '*')
{
if (truth == 0)
- printf ("#define CODE_FOR_%s CODE_FOR_nothing\n", name);
+ printf (",\n CODE_FOR_%s = CODE_FOR_nothing", name);
else
- printf (" CODE_FOR_%s = %d,\n", name, info->index);
+ printf (",\n CODE_FOR_%s = %d", name, info->index);
}
}
if (!init_rtx_reader_args (argc, argv))
return (FATAL_EXIT_CODE);
- puts ("\
+ printf ("\
/* Generated automatically by the program `gencodes'\n\
from the machine description file `md'. */\n\
\n\
#define GCC_INSN_CODES_H\n\
\n\
enum insn_code {\n\
- CODE_FOR_nothing = 0,\n");
+ CODE_FOR_nothing = 0");
/* Read the machine description. */
break;
}
- printf (" LAST_INSN_CODE = %d\n\
-};\n\
+ printf ("\n};\n\
\n\
-#endif /* GCC_INSN_CODES_H */\n", get_num_insn_codes () - 1);
+const unsigned int NUM_INSN_CODES = %d;\n\
+#endif /* GCC_INSN_CODES_H */\n", get_num_insn_codes ());
if (ferror (stdout) || fflush (stdout) || fclose (stdout))
return FATAL_EXIT_CODE;
/* Map INSN_CODE -> the static insn data. This info is valid during
all translation unit. */
-struct lra_static_insn_data *insn_code_data[LAST_INSN_CODE];
+struct lra_static_insn_data *insn_code_data[NUM_INSN_CODES];
/* Debug insns are represented as a special insn with one input
operand which is RTL expression in var_location. */
static void
finish_insn_code_data_once (void)
{
- int i;
-
- for (i = 0; i < LAST_INSN_CODE; i++)
+ for (unsigned int i = 0; i < NUM_INSN_CODES; i++)
{
if (insn_code_data[i] != NULL)
free (insn_code_data[i]);
struct lra_static_insn_data *data;
size_t n_bytes;
- lra_assert (icode < LAST_INSN_CODE);
+ lra_assert (icode < (int) NUM_INSN_CODES);
if (icode >= 0 && (data = insn_code_data[icode]) != NULL)
return data;
lra_assert (nop >= 0 && ndup >= 0 && nalt >= 0);
instruction ICODE. */
const operand_alternative *
-preprocess_insn_constraints (int icode)
+preprocess_insn_constraints (unsigned int icode)
{
- gcc_checking_assert (IN_RANGE (icode, 0, LAST_INSN_CODE));
+ gcc_checking_assert (IN_RANGE (icode, 0, NUM_INSN_CODES - 1));
if (this_target_recog->x_op_alt[icode])
return this_target_recog->x_op_alt[icode];
}
memset (this_target_recog->x_bool_attr_masks, 0,
sizeof (this_target_recog->x_bool_attr_masks));
- for (int i = 0; i < LAST_INSN_CODE; ++i)
+ for (unsigned int i = 0; i < NUM_INSN_CODES; ++i)
if (this_target_recog->x_op_alt[i])
{
free (this_target_recog->x_op_alt[i]);
extern void extract_insn_cached (rtx_insn *);
extern void preprocess_constraints (int, int, const char **,
operand_alternative *);
-extern const operand_alternative *preprocess_insn_constraints (int);
+extern const operand_alternative *preprocess_insn_constraints (unsigned int);
extern void preprocess_constraints (rtx_insn *);
extern rtx_insn *peep2_next_insn (int);
extern int peep2_regno_dead_p (int, int);
/* Target-dependent globals. */
struct target_recog {
bool x_initialized;
- alternative_mask x_bool_attr_masks[LAST_INSN_CODE][BA_LAST + 1];
- operand_alternative *x_op_alt[LAST_INSN_CODE];
+ alternative_mask x_bool_attr_masks[NUM_INSN_CODES][BA_LAST + 1];
+ operand_alternative *x_op_alt[NUM_INSN_CODES];
};
extern struct target_recog default_target_recog;
tree new_temp;
int op_type;
optab optab;
- int icode;
+ bool target_support_p;
tree def;
gimple def_stmt;
enum vect_def_type dt[3]
vec_mode = TYPE_MODE (vectype);
if (code == MULT_HIGHPART_EXPR)
- {
- if (can_mult_highpart_p (vec_mode, TYPE_UNSIGNED (vectype)))
- icode = LAST_INSN_CODE;
- else
- icode = CODE_FOR_nothing;
- }
+ target_support_p = can_mult_highpart_p (vec_mode, TYPE_UNSIGNED (vectype));
else
{
optab = optab_for_tree_code (code, vectype, optab_default);
"no optab.\n");
return false;
}
- icode = (int) optab_handler (optab, vec_mode);
+ target_support_p = (optab_handler (optab, vec_mode)
+ != CODE_FOR_nothing);
}
- if (icode == CODE_FOR_nothing)
+ if (!target_support_p)
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,