From 8e66b377a93e3fc371d0836768740d68ef8fffc5 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Wed, 16 Oct 2019 10:48:00 +0000 Subject: [PATCH] [AArch64] Add an assert to aarch64_layout_frame This patch adds an assert that all the individual *_adjust allocations add up to the full frame size. With that safety net, it seemed slightly clearer to use crtl->outgoing_args_size as the final adjustment where appropriate, to match what's used in the comments. This is a bit overkill on its own, but I need to add more cases for SVE. 2019-10-16 Richard Sandiford gcc/ * 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 where appropriate. From-SVN: r277060 --- gcc/ChangeLog | 7 +++++++ gcc/config/aarch64/aarch64.c | 9 +++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index dbdf07c8889..4733dc4bfb8 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2019-10-16 Richard Sandiford + + * 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 + where appropriate. + 2019-10-16 Richard Sandiford * config/aarch64/aarch64.c (aarch64_layout_frame): Use a local diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index 6d151cb4724..03a9f3f2bbc 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -5476,7 +5476,7 @@ aarch64_layout_frame (void) stp reg3, reg4, [sp, 16] sub sp, sp, outgoing_args_size */ frame.callee_adjust = const_fp_offset; - frame.final_adjust = frame.frame_size - frame.callee_adjust; + frame.final_adjust = crtl->outgoing_args_size; } else { @@ -5487,9 +5487,14 @@ aarch64_layout_frame (void) stp reg3, reg4, [sp, 16] sub sp, sp, outgoing_args_size */ frame.initial_adjust = frame.hard_fp_offset; - frame.final_adjust = frame.frame_size - frame.initial_adjust; + frame.final_adjust = crtl->outgoing_args_size; } + /* Make sure the individual adjustments add up to the full frame size. */ + gcc_assert (known_eq (frame.initial_adjust + + frame.callee_adjust + + frame.final_adjust, frame.frame_size)); + frame.laid_out = true; } -- 2.30.2