stack-clash: Add LR assert to layout_frame.
authorTamar Christina <tamar.christina@arm.com>
Mon, 1 Oct 2018 12:53:34 +0000 (12:53 +0000)
committerTamar Christina <tnfchris@gcc.gnu.org>
Mon, 1 Oct 2018 12:53:34 +0000 (12:53 +0000)
Since stack clash depends on the LR being saved for non-leaf functions this
patch adds an assert such that if this changes we would notice this.

gcc/
PR target/86486
* config/aarch64/aarch64.c (aarch64_layout_frame): Add assert.

From-SVN: r264748

gcc/ChangeLog
gcc/config/aarch64/aarch64.c

index 332f6dc707d449c6943ebb8c94e38a9ede7ae7b1..0d02631f38f4f035faf377584767e41e0c75a9f7 100644 (file)
@@ -1,3 +1,8 @@
+2018-10-01  Tamar Christina  <tamar.christina@arm.com>
+
+       PR target/86486
+       * config/aarch64/aarch64.c (aarch64_layout_frame): Add assert.
+
 2018-10-01  Jeff Law  <law@redhat.com>
            Richard Sandiford <richard.sandiford@linaro.org>
            Tamar Christina  <tamar.christina@arm.com>
index 9fd5cb20d84eac7bdc5f01e8a74b8205594821e3..9507608da9a8d625d04703a180ff9e35f021c666 100644 (file)
@@ -4094,6 +4094,11 @@ aarch64_layout_frame (void)
       offset = 2 * UNITS_PER_WORD;
     }
 
+  /* With stack-clash, LR must be saved in non-leaf functions.  */
+  gcc_assert (crtl->is_leaf
+             || (cfun->machine->frame.reg_offset[R30_REGNUM]
+                 != SLOT_NOT_REQUIRED));
+
   /* Now assign stack slots for them.  */
   for (regno = R0_REGNUM; regno <= R30_REGNUM; regno++)
     if (cfun->machine->frame.reg_offset[regno] == SLOT_REQUIRED)