aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@arm.com>2019-10-16 10:50:53 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2019-10-16 10:50:53 +0000
commit9b17a646d90ad0cc30daf8432aa60ad0d751d914 (patch)
treeda3f70de7c8756fd0a84aed6a4d9e1918b84726e /gcc
parent8e66b377a93e3fc371d0836768740d68ef8fffc5 (diff)
downloadgcc-9b17a646d90ad0cc30daf8432aa60ad0d751d914.zip
gcc-9b17a646d90ad0cc30daf8432aa60ad0d751d914.tar.gz
gcc-9b17a646d90ad0cc30daf8432aa60ad0d751d914.tar.bz2
[AArch64] Improve poly_int handling in aarch64_layout_frame
I'd used known_lt when converting these conditions to poly_int, but on reflection that was a bad choice. The code isn't just doing a range check; it specifically needs constants that will fit in a certain encoding. 2019-10-16 Richard Sandiford <richard.sandiford@arm.com> gcc/ * config/aarch64/aarch64.c (aarch64_layout_frame): Use is_constant rather than known_lt when choosing frame layouts. From-SVN: r277061
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/config/aarch64/aarch64.c10
2 files changed, 11 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 4733dc4..c54f216 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,10 @@
2019-10-16 Richard Sandiford <richard.sandiford@arm.com>
+ * config/aarch64/aarch64.c (aarch64_layout_frame): Use is_constant
+ rather than known_lt when choosing frame layouts.
+
+2019-10-16 Richard Sandiford <richard.sandiford@arm.com>
+
* config/aarch64/aarch64.c (aarch64_layout_frame): Assert
that all the adjustments add up to the full frame size.
Use crtl->outgoing_args_size directly as the final adjustment
diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index 03a9f3f..0537e7f 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -5447,7 +5447,7 @@ aarch64_layout_frame (void)
else if (frame.wb_candidate1 != INVALID_REGNUM)
max_push_offset = 256;
- HOST_WIDE_INT const_size, const_fp_offset;
+ HOST_WIDE_INT const_size, const_outgoing_args_size, const_fp_offset;
if (frame.frame_size.is_constant (&const_size)
&& const_size < max_push_offset
&& known_eq (crtl->outgoing_args_size, 0))
@@ -5457,16 +5457,18 @@ aarch64_layout_frame (void)
stp reg3, reg4, [sp, 16] */
frame.callee_adjust = const_size;
}
- else if (known_lt (crtl->outgoing_args_size + frame.saved_regs_size, 512)
+ else if (crtl->outgoing_args_size.is_constant (&const_outgoing_args_size)
+ && const_outgoing_args_size + frame.saved_regs_size < 512
&& !(cfun->calls_alloca
- && known_lt (frame.hard_fp_offset, max_push_offset)))
+ && frame.hard_fp_offset.is_constant (&const_fp_offset)
+ && const_fp_offset < max_push_offset))
{
/* Frame with small outgoing arguments:
sub sp, sp, frame_size
stp reg1, reg2, [sp, outgoing_args_size]
stp reg3, reg4, [sp, outgoing_args_size + 16] */
frame.initial_adjust = frame.frame_size;
- frame.callee_offset = frame.frame_size - frame.hard_fp_offset;
+ frame.callee_offset = const_outgoing_args_size;
}
else if (frame.hard_fp_offset.is_constant (&const_fp_offset)
&& const_fp_offset < max_push_offset)