[PATCH] D41134: [compiler-rt] [builtins] Implement __chkstk for arm64 windows

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 14 22:13:47 PST 2017


mstorsjo added inline comments.


================
Comment at: lib/builtins/aarch64/chkstk.S:18
+DEFINE_COMPILERRT_FUNCTION(__chkstk)
+        lsl    x16, x15, #4
+        mov    x17, sp
----------------
compnerd wrote:
> I'm not sure I understand the reasoning for this entirely.  Why the `lsl x16, x15, #4` and then `subs x16, x16, #1000`?  Wouldn't it be equal to just doing `subs x15, x15, #100` each time and entirely avoid the shift?
Yes - except we need to preserve x15 on return as well. So since we need to clobber another register, it doesn't matter which range we use for the subtractions.


================
Comment at: lib/builtins/aarch64/chkstk.S:24
+1:
+        sub    x17, x17, #0x1000
+        subs   x16, x16, #0x1000
----------------
compnerd wrote:
> Can we not use `PAGE_SIZE` here?
Afaik there's no global PAGE_SIZE define, but we could make one within this file and use that for better readability.


https://reviews.llvm.org/D41134





More information about the llvm-commits mailing list