================
@@ -0,0 +1,265 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
UTC_ARGS: --version 6
+; RUN: llc -mtriple=thumbv6m-none-eabi -verify-machineinstrs < %s | FileCheck
%s
+
+; The -fstack-limit-variable=<var> prologue is emitted only for functions that
+; carry the "stack-limit-variable"="<var>" attribute and have a non-empty stack
+; frame. It loads <var>, computes the free space (sp - limit), compares it
+; against the frame size and traps with "svc #255" when it is too small.
+; Thumb1 has no movw/movt or wide encodings, so the sequence loads the limit's
+; address from the constant pool and does the arithmetic in two low registers
+; (r2/r3). Under AAPCS arguments are assigned r0, r1, r2, r3 in order, so
+; r2/r3 are the argument registers least likely to be live on entry. Each is
+; used directly if dead and preserved with push/pop only if it still carries a
+; live argument.
+
+declare void @sink(ptr)
+
+; A small frame: the required size fits in the 8-bit "cmp" immediate.
+define void @needs_check() #0 {
+; CHECK-LABEL: needs_check:
+; CHECK: @ %bb.0:
+; CHECK-NEXT: mov r3, sp
----------------
zyma98 wrote:
Yes, it's possible to avoid copying `sp`. Thanks for the suggestion. Please see
the new commit for the change.
https://github.com/llvm/llvm-project/pull/208076
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits