aboutsummaryrefslogtreecommitdiff
path: root/gcc/regrename.c
diff options
context:
space:
mode:
authorThomas Preud'homme <thomas.preudhomme@arm.com>2014-12-05 18:36:57 +0000
committerThomas Preud'homme <thopre01@gcc.gnu.org>2014-12-05 18:36:57 +0000
commit63edbb04b27db1e230d536ad5a07e7cebd6a5ed7 (patch)
tree4445a1a13ee2c2dc663ead126b3330874b434e75 /gcc/regrename.c
parentfda3e2851e6f415354eb4045d288d3e91c4aa1ec (diff)
downloadgcc-63edbb04b27db1e230d536ad5a07e7cebd6a5ed7.zip
gcc-63edbb04b27db1e230d536ad5a07e7cebd6a5ed7.tar.gz
gcc-63edbb04b27db1e230d536ad5a07e7cebd6a5ed7.tar.bz2
regrename.c (find_best_rename_reg): Rename to ...
2014-12-05 Thomas Preud'homme <thomas.preudhomme@arm.com> gcc/ * regrename.c (find_best_rename_reg): Rename to ... (find_rename_reg): This. Also add a parameter to skip tick check. * regrename.h: Likewise. * config/c6x/c6x.c (try_rename_operands): Adapt to above renaming. From-SVN: r218434
Diffstat (limited to 'gcc/regrename.c')
-rw-r--r--gcc/regrename.c28
1 files changed, 17 insertions, 11 deletions
diff --git a/gcc/regrename.c b/gcc/regrename.c
index 66f562b..88321d0 100644
--- a/gcc/regrename.c
+++ b/gcc/regrename.c
@@ -357,11 +357,13 @@ check_new_reg_p (int reg ATTRIBUTE_UNUSED, int new_reg,
/* For the chain THIS_HEAD, compute and return the best register to
rename to. SUPER_CLASS is the superunion of register classes in
the chain. UNAVAILABLE is a set of registers that cannot be used.
- OLD_REG is the register currently used for the chain. */
+ OLD_REG is the register currently used for the chain. BEST_RENAME
+ controls whether the register chosen must be better than the
+ current one or just respect the given constraint. */
int
-find_best_rename_reg (du_head_p this_head, enum reg_class super_class,
- HARD_REG_SET *unavailable, int old_reg)
+find_rename_reg (du_head_p this_head, enum reg_class super_class,
+ HARD_REG_SET *unavailable, int old_reg, bool best_rename)
{
bool has_preferred_class;
enum reg_class preferred_class;
@@ -400,15 +402,19 @@ find_best_rename_reg (du_head_p this_head, enum reg_class super_class,
new_reg))
continue;
+ if (!check_new_reg_p (old_reg, new_reg, this_head, *unavailable))
+ continue;
+
+ if (!best_rename)
+ return new_reg;
+
/* In the first pass, we force the renaming of registers that
don't belong to PREFERRED_CLASS to registers that do, even
though the latters were used not very long ago. */
- if (check_new_reg_p (old_reg, new_reg, this_head,
- *unavailable)
- && ((pass == 0
- && !TEST_HARD_REG_BIT (reg_class_contents[preferred_class],
- best_new_reg))
- || tick[best_new_reg] > tick[new_reg]))
+ if ((pass == 0
+ && !TEST_HARD_REG_BIT (reg_class_contents[preferred_class],
+ best_new_reg))
+ || tick[best_new_reg] > tick[new_reg])
best_new_reg = new_reg;
}
if (pass == 0 && best_new_reg != old_reg)
@@ -480,8 +486,8 @@ rename_chains (void)
if (n_uses < 2)
continue;
- best_new_reg = find_best_rename_reg (this_head, super_class,
- &this_unavailable, reg);
+ best_new_reg = find_rename_reg (this_head, super_class,
+ &this_unavailable, reg, true);
if (dump_file)
{