aboutsummaryrefslogtreecommitdiff
path: root/gcc/lra-constraints.c
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@arm.com>2019-07-31 07:33:11 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2019-07-31 07:33:11 +0000
commita25f3e8efbbc7182fa58c445574848a73856e9b4 (patch)
tree42b669136d615c100af11e64f472bc253a61d708 /gcc/lra-constraints.c
parent68c86af248f736a7fa3c8059c7df41ed5d6dff37 (diff)
downloadgcc-a25f3e8efbbc7182fa58c445574848a73856e9b4.zip
gcc-a25f3e8efbbc7182fa58c445574848a73856e9b4.tar.gz
gcc-a25f3e8efbbc7182fa58c445574848a73856e9b4.tar.bz2
Make lra use per-alternative earlyclobber info
lra_insn_reg and lra_operand_data have both a bitmask of earlyclobber alternatives and an overall boolean. The danger is that we then test the overall boolean when really we should be testing for a particular alternative. This patch gets rid of the boolean and tests the mask against zero when we really do need to test "any alternative might be earlyclobber". (I think the only instance of that is the LRA_UNKNOWN_ALT handling in lra-lives.c:reg_early_clobber_p.) This is needed (and tested) by an upcoming SVE patch. 2019-07-31 Richard Sandiford <richard.sandiford@arm.com> gcc/ * lra-int.h (lra_operand_data): Remove early_clobber field. (lra_insn_reg): Likewise. * lra.c (debug_operand_data): Update accordingly. (setup_operand_alternative): Likewise. (new_insn_reg): Likewise. Remove early_clobber parameter. (collect_non_operand_hard_regs): Update call accordingly. Don't assign to lra_insn_reg::early_clobber. (add_regs_to_insn_regno_info): Remove early_clobber parameter and update calls to new_insn_reg. (lra_update_insn_regno_info): Update calls accordingly. * lra-constraints.c (update_and_check_small_class_inputs): Take the alternative number as a parameter and test whether the operand is earlyclobbered in that particular alternative. (process_alt_operands): Update call accordingly. Use per-alternative checks for earyclobber here too. * lra-lives.c (reg_early_clobber_p): Check early_clobber_alts against zero for IRA_UNKNOWN_ALT. From-SVN: r273921
Diffstat (limited to 'gcc/lra-constraints.c')
-rw-r--r--gcc/lra-constraints.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/gcc/lra-constraints.c b/gcc/lra-constraints.c
index bd9f85d..f258407 100644
--- a/gcc/lra-constraints.c
+++ b/gcc/lra-constraints.c
@@ -1866,11 +1866,12 @@ prohibited_class_reg_set_mode_p (enum reg_class rclass,
alternative. */
static unsigned int curr_small_class_check = 0;
-/* Update number of used inputs of class OP_CLASS for operand NOP.
- Return true if we have more such class operands than the number of
- available regs. */
+/* Update number of used inputs of class OP_CLASS for operand NOP
+ of alternative NALT. Return true if we have more such class operands
+ than the number of available regs. */
static bool
-update_and_check_small_class_inputs (int nop, enum reg_class op_class)
+update_and_check_small_class_inputs (int nop, int nalt,
+ enum reg_class op_class)
{
static unsigned int small_class_check[LIM_REG_CLASSES];
static int small_class_input_nums[LIM_REG_CLASSES];
@@ -1881,7 +1882,7 @@ update_and_check_small_class_inputs (int nop, enum reg_class op_class)
&& hard_reg_set_intersect_p (reg_class_contents[op_class],
ira_no_alloc_regs)
&& (curr_static_id->operand[nop].type != OP_OUT
- || curr_static_id->operand[nop].early_clobber))
+ || TEST_BIT (curr_static_id->operand[nop].early_clobber_alts, nalt)))
{
if (small_class_check[op_class] == curr_small_class_check)
small_class_input_nums[op_class]++;
@@ -2150,7 +2151,8 @@ process_alt_operands (int only_alternative)
/* We should reject matching of an early
clobber operand if the matching operand is
not dying in the insn. */
- if (! curr_static_id->operand[m].early_clobber
+ if (!TEST_BIT (curr_static_id->operand[m]
+ .early_clobber_alts, nalt)
|| operand_reg[nop] == NULL_RTX
|| (find_regno_note (curr_insn, REG_DEAD,
REGNO (op))
@@ -2234,7 +2236,8 @@ process_alt_operands (int only_alternative)
it results in less hard regs required for
the insn than a non-matching earlyclobber
alternative. */
- if (curr_static_id->operand[m].early_clobber)
+ if (TEST_BIT (curr_static_id->operand[m]
+ .early_clobber_alts, nalt))
{
if (lra_dump_file != NULL)
fprintf
@@ -2875,7 +2878,8 @@ process_alt_operands (int only_alternative)
goto fail;
}
- if (update_and_check_small_class_inputs (nop, this_alternative))
+ if (update_and_check_small_class_inputs (nop, nalt,
+ this_alternative))
{
if (lra_dump_file != NULL)
fprintf (lra_dump_file,