From 4cc8d9d2df6f618f133f6d5ec1019333a0d942e5 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Tue, 27 May 2014 10:06:22 +0000 Subject: system.h (TEST_BIT): New macro. gcc/ * system.h (TEST_BIT): New macro. * recog.h (alternative_mask): New type. (ALL_ALTERNATIVES, ALTERNATIVE_BIT): New macros. (recog_data_d): Replace alternative_enabled_p array with enabled_alternatives. (target_recog): New structure. (default_target_recog, this_target_recog): Declare. (get_enabled_alternatives, recog_init): Likewise. * recog.c (default_target_recog, this_target_recog): New variables. (get_enabled_alternatives): New function. (extract_insn): Use it. (recog_init): New function. (preprocess_constraints, constrain_operands): Adjust for change to recog_data. * postreload.c (reload_cse_simplify_operands): Likewise. * reload.c (find_reloads): Likewise. * ira-costs.c (record_reg_classes): Likewise. * ira-lives.c (single_reg_class): Likewise. Fix bug in which all alternatives after a disabled one would be skipped. (ira_implicitly_set_insn_hard_regs): Likewise. * ira.c (ira_setup_alts): Adjust for change to recog_data. * lra-int.h (lra_insn_recog_data): Replace alternative_enabled_p with enabled_alternatives. * lra.c (free_insn_recog_data): Update accordingly. (lra_update_insn_recog_data): Likewise. (lra_set_insn_recog_data): Likewise. Use get_enabled_alternatives. * lra-constraints.c (process_alt_operands): Likewise. Handle only_alternative as part of the enabled mask. * target-globals.h (this_target_recog): Declare. (target_globals): Add a recog field. (restore_target_globals): Restore this_target_recog. * target-globals.c: Include recog.h. (default_target_globals): Initialize recog field. (save_target_globals): Likewise. * reginfo.c (reinit_regs): Call recog_init. * toplev.c (backend_init_target): Likewise. From-SVN: r210964 --- gcc/recog.h | 42 ++++++++++++++++++++++++++++++++++++------ 1 file changed, 36 insertions(+), 6 deletions(-) (limited to 'gcc/recog.h') diff --git a/gcc/recog.h b/gcc/recog.h index 89e87a9..8c8d55f 100644 --- a/gcc/recog.h +++ b/gcc/recog.h @@ -20,8 +20,17 @@ along with GCC; see the file COPYING3. If not see #ifndef GCC_RECOG_H #define GCC_RECOG_H -/* Random number that should be large enough for all purposes. */ +/* Random number that should be large enough for all purposes. Also define + a type that has at least MAX_RECOG_ALTERNATIVES + 1 bits, with the extra + bit giving an invalid value that can be used to mean "uninitialized". */ #define MAX_RECOG_ALTERNATIVES 30 +typedef unsigned int alternative_mask; + +/* A mask of all alternatives. */ +#define ALL_ALTERNATIVES ((alternative_mask) -1) + +/* A mask containing just alternative X. */ +#define ALTERNATIVE_BIT(X) ((alternative_mask) 1 << (X)) /* Types of operands. */ enum op_type { @@ -235,11 +244,11 @@ struct recog_data_d /* True if insn is ASM_OPERANDS. */ bool is_asm; - /* Specifies whether an insn alternative is enabled using the - `enabled' attribute in the insn pattern definition. For back - ends not using the `enabled' attribute the array fields are - always set to `true' in expand_insn. */ - bool alternative_enabled_p [MAX_RECOG_ALTERNATIVES]; + /* Specifies whether an insn alternative is enabled using the `enabled' + attribute in the insn pattern definition. For back ends not using + the `enabled' attribute the bits are always set to 1 in expand_insn. + Bits beyond the last alternative are also set to 1. */ + alternative_mask enabled_alternatives; /* In case we are caching, hold insn data was generated for. */ rtx insn; @@ -361,4 +370,25 @@ struct insn_data_d extern const struct insn_data_d insn_data[]; extern int peep2_current_count; +#ifndef GENERATOR_FILE +#include "insn-codes.h" + +/* Target-dependent globals. */ +struct target_recog { + bool x_initialized; + alternative_mask x_enabled_alternatives[LAST_INSN_CODE]; +}; + +extern struct target_recog default_target_recog; +#if SWITCHABLE_TARGET +extern struct target_recog *this_target_recog; +#else +#define this_target_recog (&default_target_recog) +#endif + +alternative_mask get_enabled_alternatives (rtx); + +void recog_init (); +#endif + #endif /* GCC_RECOG_H */ -- cgit v1.1