summaryrefslogtreecommitdiff
path: root/gcc/reload.c
diff options
context:
space:
mode:
authorRichard Sandiford <rdsandiford@googlemail.com>2014-06-11 16:58:35 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2014-06-11 16:58:35 +0000
commit777e635f1a6cab5d2c6837b1ea903ed0bcbe87d3 (patch)
tree923092a0e7d4f3ea66962e54661707bc328d5327 /gcc/reload.c
parent9e6b7874141cf74a8eb0786d7265296f671feac4 (diff)
downloadgcc-777e635f1a6cab5d2c6837b1ea903ed0bcbe87d3.tar.gz
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/reload.c')
-rw-r--r--gcc/reload.c132
1 files changed, 68 insertions, 64 deletions
diff --git a/gcc/reload.c b/gcc/reload.c
index 87c453c85b8..e4614bb3210 100644
--- a/gcc/reload.c
+++ b/gcc/reload.c
@@ -401,8 +401,8 @@ push_secondary_reload (int in_p, rtx x, int opnum, int optional,
scratch_constraint++;
letter = *scratch_constraint;
scratch_class = (letter == 'r' ? GENERAL_REGS
- : REG_CLASS_FROM_CONSTRAINT ((unsigned char) letter,
- scratch_constraint));
+ : (reg_class_for_constraint
+ (lookup_constraint (scratch_constraint))));
rclass = scratch_class;
mode = insn_data[(int) icode].operand[2].mode;
@@ -560,8 +560,7 @@ scratch_reload_class (enum insn_code icode)
scratch_letter = *scratch_constraint;
if (scratch_letter == 'r')
return GENERAL_REGS;
- rclass = REG_CLASS_FROM_CONSTRAINT ((unsigned char) scratch_letter,
- scratch_constraint);
+ rclass = reg_class_for_constraint (lookup_constraint (scratch_constraint));
gcc_assert (rclass != NO_REGS);
return rclass;
}
@@ -2852,7 +2851,8 @@ find_reloads (rtx insn, int replace, int ind_levels, int live_known,
/* Ignore things like match_operator operands. */
;
else if (constraints[i][0] == 'p'
- || EXTRA_ADDRESS_CONSTRAINT (constraints[i][0], constraints[i]))
+ || (insn_extra_address_constraint
+ (lookup_constraint (constraints[i]))))
{
address_operand_reloaded[i]
= find_reloads_address (recog_data.operand_mode[i], (rtx*) 0,
@@ -3094,6 +3094,8 @@ find_reloads (rtx insn, int replace, int ind_levels, int live_known,
operand. */
int constmemok = 0;
int earlyclobber = 0;
+ enum constraint_num cn;
+ enum reg_class cl;
/* If the predicate accepts a unary operator, it means that
we need to reload the operand, but do not do this for
@@ -3489,71 +3491,74 @@ find_reloads (rtx insn, int replace, int ind_levels, int live_known,
/* Drop through into 'r' case. */
case 'r':
- this_alternative[i]
- = reg_class_subunion[this_alternative[i]][(int) GENERAL_REGS];
+ cl = GENERAL_REGS;
goto reg;
default:
- if (REG_CLASS_FROM_CONSTRAINT (c, p) == NO_REGS)
+ cn = lookup_constraint (p);
+ switch (get_constraint_type (cn))
{
-#ifdef EXTRA_CONSTRAINT_STR
- if (EXTRA_MEMORY_CONSTRAINT (c, p))
- {
- if (force_reload)
- break;
- if (EXTRA_CONSTRAINT_STR (operand, c, p))
- win = 1;
- /* If the address was already reloaded,
- we win as well. */
- else if (MEM_P (operand)
- && address_reloaded[i] == 1)
- win = 1;
- /* Likewise if the address will be reloaded because
- reg_equiv_address is nonzero. For reg_equiv_mem
- we have to check. */
- else if (REG_P (operand)
- && REGNO (operand) >= FIRST_PSEUDO_REGISTER
- && reg_renumber[REGNO (operand)] < 0
- && ((reg_equiv_mem (REGNO (operand)) != 0
- && EXTRA_CONSTRAINT_STR (reg_equiv_mem (REGNO (operand)), c, p))
- || (reg_equiv_address (REGNO (operand)) != 0)))
- win = 1;
-
- /* If we didn't already win, we can reload
- constants via force_const_mem, and other
- MEMs by reloading the address like for 'o'. */
- if (CONST_POOL_OK_P (operand_mode[i], operand)
- || MEM_P (operand))
- badop = 0;
- constmemok = 1;
- offmemok = 1;
- break;
- }
- if (EXTRA_ADDRESS_CONSTRAINT (c, p))
- {
- if (EXTRA_CONSTRAINT_STR (operand, c, p))
- win = 1;
-
- /* If we didn't already win, we can reload
- the address into a base register. */
- this_alternative[i]
- = base_reg_class (VOIDmode, ADDR_SPACE_GENERIC,
- ADDRESS, SCRATCH);
- badop = 0;
- break;
- }
+ case CT_REGISTER:
+ cl = reg_class_for_constraint (cn);
+ if (cl != NO_REGS)
+ goto reg;
+ break;
- if (EXTRA_CONSTRAINT_STR (operand, c, p))
+ case CT_MEMORY:
+ if (force_reload)
+ break;
+ if (constraint_satisfied_p (operand, cn))
+ win = 1;
+ /* If the address was already reloaded,
+ we win as well. */
+ else if (MEM_P (operand) && address_reloaded[i] == 1)
+ win = 1;
+ /* Likewise if the address will be reloaded because
+ reg_equiv_address is nonzero. For reg_equiv_mem
+ we have to check. */
+ else if (REG_P (operand)
+ && REGNO (operand) >= FIRST_PSEUDO_REGISTER
+ && reg_renumber[REGNO (operand)] < 0
+ && ((reg_equiv_mem (REGNO (operand)) != 0
+ && (constraint_satisfied_p
+ (reg_equiv_mem (REGNO (operand)),
+ cn)))
+ || (reg_equiv_address (REGNO (operand))
+ != 0)))
+ win = 1;
+
+ /* If we didn't already win, we can reload
+ constants via force_const_mem, and other
+ MEMs by reloading the address like for 'o'. */
+ if (CONST_POOL_OK_P (operand_mode[i], operand)
+ || MEM_P (operand))
+ badop = 0;
+ constmemok = 1;
+ offmemok = 1;
+ break;
+
+ case CT_ADDRESS:
+ if (constraint_satisfied_p (operand, cn))
+ win = 1;
+
+ /* If we didn't already win, we can reload
+ the address into a base register. */
+ this_alternative[i]
+ = base_reg_class (VOIDmode, ADDR_SPACE_GENERIC,
+ ADDRESS, SCRATCH);
+ badop = 0;
+ break;
+
+ case CT_FIXED_FORM:
+ if (constraint_satisfied_p (operand, cn))
win = 1;
-#endif
break;
}
+ break;
- this_alternative[i]
- = (reg_class_subunion
- [this_alternative[i]]
- [(int) REG_CLASS_FROM_CONSTRAINT (c, p)]);
reg:
+ this_alternative[i]
+ = reg_class_subunion[this_alternative[i]][cl];
if (GET_MODE (operand) == BLKmode)
break;
winreg = 1;
@@ -4687,11 +4692,10 @@ alternative_allows_const_pool_ref (rtx mem ATTRIBUTE_UNUSED,
{
if (c == TARGET_MEM_CONSTRAINT || c == 'o')
return true;
-#ifdef EXTRA_CONSTRAINT_STR
- if (EXTRA_MEMORY_CONSTRAINT (c, constraint)
- && (mem == NULL || EXTRA_CONSTRAINT_STR (mem, c, constraint)))
+ enum constraint_num cn = lookup_constraint (constraint);
+ if (insn_extra_memory_constraint (cn)
+ && (mem == NULL || constraint_satisfied_p (mem, cn)))
return true;
-#endif
}
return false;
}