diff options
author | Richard Sandiford <rdsandiford@googlemail.com> | 2014-06-11 16:58:35 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2014-06-11 16:58:35 +0000 |
commit | 777e635f1a6cab5d2c6837b1ea903ed0bcbe87d3 (patch) | |
tree | 923092a0e7d4f3ea66962e54661707bc328d5327 /gcc/recog.c | |
parent | 9e6b7874141cf74a8eb0786d7265296f671feac4 (diff) | |
download | gcc-777e635f1a6cab5d2c6837b1ea903ed0bcbe87d3.zip gcc-777e635f1a6cab5d2c6837b1ea903ed0bcbe87d3.tar.gz gcc-777e635f1a6cab5d2c6837b1ea903ed0bcbe87d3.tar.bz2 |
system.h (REG_CLASS_FROM_CONSTRAINT): Poison.
gcc/
* system.h (REG_CLASS_FROM_CONSTRAINT): Poison.
(REG_CLASS_FOR_CONSTRAINT, EXTRA_CONSTRAINT_STR): Likewise.
(EXTRA_MEMORY_CONSTRAINT, EXTRA_ADDRESS_CONSTRAINT): Likewise.
* genpreds.c (print_type_tree): New function.
(write_tm_preds_h): Remove REG_CLASS_FROM_CONSTRAINT,
REG_CLASS_FOR_CONSTRAINT, EXTRA_MEMORY_CONSTRAINT,
EXTRA_ADDRESS_CONSTRAINT and EXTRA_CONSTRAINT_STR.
Write out enum constraint_type and get_constraint_type.
* lra-constraints.c (satisfies_memory_constraint_p): Take a
constraint_num rather than a constraint string.
(satisfies_address_constraint_p): Likewise.
(reg_class_from_constraints): Avoid old constraint macros.
(process_alt_operands, process_address_1): Likewise.
(curr_insn_transform): Likewise.
* ira-costs.c (record_reg_classes): Likewise.
(record_operand_costs): Likewise.
* ira-lives.c (single_reg_class): Likewise.
(ira_implicitly_set_insn_hard_regs): Likewise.
* ira.c (ira_setup_alts, ira_get_dup_out_num): Likewise.
* postreload.c (reload_cse_simplify_operands): Likewise.
* recog.c (asm_operand_ok, preprocess_constraints): Likewise.
(constrain_operands, peep2_find_free_register): Likewise.
* reload.c (push_secondary_reload, scratch_reload_class): Likewise.
(find_reloads, alternative_allows_const_pool_ref): Likewise.
* reload1.c (maybe_fix_stack_asms): Likewise.
* stmt.c (parse_output_constraint, parse_input_constraint): Likewise.
* targhooks.c (default_secondary_reload): Likewise.
* config/m32c/m32c.c (m32c_matches_constraint_p): Avoid reference
to EXTRA_CONSTRAINT_STR.
* config/sparc/constraints.md (U): Likewise REG_CLASS_FROM_CONSTRAINT.
From-SVN: r211471
Diffstat (limited to 'gcc/recog.c')
-rw-r--r-- | gcc/recog.c | 91 |
1 files changed, 55 insertions, 36 deletions
diff --git a/gcc/recog.c b/gcc/recog.c index 0a5d82e..94cdeec 100644 --- a/gcc/recog.c +++ b/gcc/recog.c @@ -1729,6 +1729,7 @@ asm_operand_ok (rtx op, const char *constraint, const char **constraints) while (*constraint) { + enum constraint_num cn; char c = *constraint; int len; switch (c) @@ -1902,27 +1903,37 @@ asm_operand_ok (rtx op, const char *constraint, const char **constraints) result = 1; break; + case 'r': + reg: + if (!result + && GET_MODE (op) != BLKmode + && register_operand (op, VOIDmode)) + result = 1; + break; + default: - /* For all other letters, we first check for a register class, - otherwise it is an EXTRA_CONSTRAINT. */ - if (REG_CLASS_FROM_CONSTRAINT (c, constraint) != NO_REGS) + cn = lookup_constraint (constraint); + switch (get_constraint_type (cn)) { - case 'r': - if (GET_MODE (op) == BLKmode) - break; - if (register_operand (op, VOIDmode)) - result = 1; + case CT_REGISTER: + if (reg_class_for_constraint (cn) != NO_REGS) + goto reg; + break; + + case CT_MEMORY: + /* Every memory operand can be reloaded to fit. */ + result = result || memory_operand (op, VOIDmode); + break; + + case CT_ADDRESS: + /* Every address operand can be reloaded to fit. */ + result = result || address_operand (op, VOIDmode); + break; + + case CT_FIXED_FORM: + result = result || constraint_satisfied_p (op, cn); + break; } -#ifdef EXTRA_CONSTRAINT_STR - else if (EXTRA_MEMORY_CONSTRAINT (c, constraint)) - /* Every memory operand can be reloaded to fit. */ - result = result || memory_operand (op, VOIDmode); - else if (EXTRA_ADDRESS_CONSTRAINT (c, constraint)) - /* Every address operand can be reloaded to fit. */ - result = result || address_operand (op, VOIDmode); - else if (EXTRA_CONSTRAINT_STR (op, c, constraint)) - result = 1; -#endif break; } len = CONSTRAINT_LEN (c, constraint); @@ -2434,13 +2445,21 @@ preprocess_constraints (int n_operands, int n_alternatives, break; default: - if (EXTRA_MEMORY_CONSTRAINT (c, p)) + enum constraint_num cn = lookup_constraint (p); + enum reg_class cl; + switch (get_constraint_type (cn)) { + case CT_REGISTER: + cl = reg_class_for_constraint (cn); + if (cl != NO_REGS) + op_alt[i].cl = reg_class_subunion[op_alt[i].cl][cl]; + break; + + case CT_MEMORY: op_alt[i].memory_ok = 1; break; - } - if (EXTRA_ADDRESS_CONSTRAINT (c, p)) - { + + case CT_ADDRESS: op_alt[i].is_address = 1; op_alt[i].cl = (reg_class_subunion @@ -2448,12 +2467,10 @@ preprocess_constraints (int n_operands, int n_alternatives, [(int) base_reg_class (VOIDmode, ADDR_SPACE_GENERIC, ADDRESS, SCRATCH)]); break; - } - op_alt[i].cl - = (reg_class_subunion - [(int) op_alt[i].cl] - [(int) REG_CLASS_FROM_CONSTRAINT ((unsigned char) c, p)]); + case CT_FIXED_FORM: + break; + } break; } p += CONSTRAINT_LEN (c, p); @@ -2846,9 +2863,12 @@ constrain_operands (int strict) default: { enum reg_class cl; + enum constraint_num cn = (c == 'r' + ? CONSTRAINT__UNKNOWN + : lookup_constraint (p)); cl = (c == 'r' - ? GENERAL_REGS : REG_CLASS_FROM_CONSTRAINT (c, p)); + ? GENERAL_REGS : reg_class_for_constraint (cn)); if (cl != NO_REGS) { if (strict < 0 @@ -2860,11 +2880,11 @@ constrain_operands (int strict) && reg_fits_class_p (op, cl, offset, mode))) win = 1; } -#ifdef EXTRA_CONSTRAINT_STR - else if (EXTRA_CONSTRAINT_STR (op, c, p)) + + else if (constraint_satisfied_p (op, cn)) win = 1; - else if (EXTRA_MEMORY_CONSTRAINT (c, p) + else if (insn_extra_memory_constraint (cn) /* Every memory operand can be reloaded to fit. */ && ((strict < 0 && MEM_P (op)) /* Before reload, accept what reload can turn @@ -2874,7 +2894,7 @@ constrain_operands (int strict) || (reload_in_progress && REG_P (op) && REGNO (op) >= FIRST_PSEUDO_REGISTER))) win = 1; - else if (EXTRA_ADDRESS_CONSTRAINT (c, p) + else if (insn_extra_address_constraint (cn) /* Every address operand can be reloaded to fit. */ && strict < 0) win = 1; @@ -2885,10 +2905,9 @@ constrain_operands (int strict) && REGNO (op) >= FIRST_PSEUDO_REGISTER && reg_renumber[REGNO (op)] < 0 && reg_equiv_mem (REGNO (op)) != 0 - && EXTRA_CONSTRAINT_STR - (reg_equiv_mem (REGNO (op)), c, p)) + && constraint_satisfied_p + (reg_equiv_mem (REGNO (op)), cn)) win = 1; -#endif break; } } @@ -3283,7 +3302,7 @@ peep2_find_free_register (int from, int to, const char *class_str, } cl = (class_str[0] == 'r' ? GENERAL_REGS - : REG_CLASS_FROM_CONSTRAINT (class_str[0], class_str)); + : reg_class_for_constraint (lookup_constraint (class_str))); for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) { |