[gcc r14-3188] MMIX: Handle LRA FP-to-SP-elimination oddity
Hans-Peter Nilsson
hp@gcc.gnu.org
Mon Aug 14 02:06:44 GMT 2023
https://gcc.gnu.org/g:9568ff597e8190b219564b912a4f608c9b95cf13
commit r14-3188-g9568ff597e8190b219564b912a4f608c9b95cf13
Author: Hans-Peter Nilsson <hp@axis.com>
Date: Sun Aug 13 03:14:11 2023 +0200
MMIX: Handle LRA FP-to-SP-elimination oddity
When LRA is in progress, it can try and validate insns
half-way through frame-pointer (FP) to stack-pointer (SP)
elimination. Operands have then been substituted where the
offset is from the SP elimination but the register is the
(hard) frame-pointer:
lra-eliminations.cc:lra_eliminate_regs_1:370:
rtx to = subst_p ? ep->to_rtx : ep->from_rtx;
In this regard reload played nicely. Unfortunately, the
frame_pointer_operand predicate in mmix/predicates.md barfs
on such an address. This broke the use of the MMIX
frame_pointer_operand predicate (and the Yf constraint),
used only in the nonlocal_goto_receiver expansion (which is
used in e.g. code generated for C++ "catch").
Force MMIX frame_pointer_operand to accept an FP+offset for
the duration of lra_in_progress.
* config/mmix/predicates.md (frame_pointer_operand): Handle FP+offset
when lra_in_progress.
Diff:
---
gcc/config/mmix/predicates.md | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/gcc/config/mmix/predicates.md b/gcc/config/mmix/predicates.md
index 4a9b0177a786..64e77fa92d00 100644
--- a/gcc/config/mmix/predicates.md
+++ b/gcc/config/mmix/predicates.md
@@ -171,4 +171,14 @@
(match_code "plus")
(match_code "reg" "0")
(match_code "const_int" "1")
- (match_test "XEXP (op, 0) == stack_pointer_rtx"))))
+ (ior
+ (match_test "XEXP (op, 0) == stack_pointer_rtx")
+ ;; We can temporarily have a FP+offset here, where we (for FP)
+ ;; accept only FP and the equivalent elimination of SP+offset.
+ ;; See lra_eliminate_regs_1 in lra-eliminations.cc c:a line 370:
+ ;; "rtx to = subst_p ? ep->to_rtx : ep->from_rtx;"
+ (and
+ (match_test "lra_in_progress")
+ (ior
+ (match_test "XEXP (op, 0) == hard_frame_pointer_rtx")
+ (match_test "XEXP (op, 0) == frame_pointer_rtx")))))))
More information about the Gcc-cvs
mailing list