aboutsummaryrefslogtreecommitdiff
path: root/gcc/lra-int.h
diff options
context:
space:
mode:
authorVladimir N. Makarov <vmakarov@redhat.com>2025-02-25 15:01:15 -0500
committerVladimir N. Makarov <vmakarov@redhat.com>2025-02-25 15:04:50 -0500
commit2341f675edadd6370147d2bc55ca7761a7ecfaa1 (patch)
tree4b96fc958ea2f747355e8a314a69cd103d80a397 /gcc/lra-int.h
parent0bb431d0a77cf8dc790b9c61539b3eb6ab1710f0 (diff)
downloadgcc-2341f675edadd6370147d2bc55ca7761a7ecfaa1.zip
gcc-2341f675edadd6370147d2bc55ca7761a7ecfaa1.tar.gz
gcc-2341f675edadd6370147d2bc55ca7761a7ecfaa1.tar.bz2
[PR115458][LRA]: Run split sub-pass more times
In this PR case LRA needs to provide too many hard regs for insn reloads, where some reload pseudos require 8 aligned regs for themselves. As the last attempt, LRA tries to split live ranges of hard regs for insn reload pseudos. It is a very rare case. An inheritance pseudo involving a reload pseudo of the insn can be spilled in the assignment sub-pass run right after splitting and we need to run split sub-pass for the inheritance pseudo now. gcc/ChangeLog: PR target/115458 * lra-int.h (LRA_MAX_FAILED_SPLITS): Define and check its value. (lra_split_hard_reg_for): Change prototype. * lra.cc (lra): Try to split hard reg range several times after a failure. * lra-assigns.cc (lra_split_hard_reg_for): Add an arg, a flag of giving up. Report asm error and nullify the asm insn depending on the arg value. gcc/testsuite/ChangeLog: PR target/115458 * g++.target/riscv/pr115458.C: New.
Diffstat (limited to 'gcc/lra-int.h')
-rw-r--r--gcc/lra-int.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/gcc/lra-int.h b/gcc/lra-int.h
index 1f89e06..ad42f48 100644
--- a/gcc/lra-int.h
+++ b/gcc/lra-int.h
@@ -252,6 +252,18 @@ typedef class lra_insn_recog_data *lra_insn_recog_data_t;
for preventing LRA cycling in a bug case. */
#define LRA_MAX_ASSIGNMENT_ITERATION_NUMBER 30
+/* Maximum allowed number of tries to split hard reg live ranges after failure
+ in assignment of reload pseudos. Theoretical bound for the value is the
+ number of the insn reload pseudos plus the number of inheritance pseudos
+ generated from the reload pseudos. This bound can be achieved when all the
+ reload pseudos and the inheritance pseudos require hard reg splitting for
+ their assignment. This is extremely unlikely event. */
+#define LRA_MAX_FAILED_SPLITS 10
+
+#if LRA_MAX_FAILED_SPLITS >= LRA_MAX_ASSIGNMENT_ITERATION_NUMBER
+#error wrong LRA_MAX_FAILED_SPLITS value
+#endif
+
/* The maximal number of inheritance/split passes in LRA. It should
be more 1 in order to perform caller saves transformations and much
less MAX_CONSTRAINT_ITERATION_NUMBER to prevent LRA to do as many
@@ -392,7 +404,7 @@ extern int lra_assignment_iter;
extern int lra_assignment_iter_after_spill;
extern void lra_setup_reg_renumber (int, int, bool);
extern bool lra_assign (bool &);
-extern bool lra_split_hard_reg_for (void);
+extern bool lra_split_hard_reg_for (bool fail_p);
/* lra-coalesce.cc: */