[Git][ghc/ghc][wip/T21964] ncg/aarch64: Don't use x18 register on AArch64/Darwin

Ben Gamari (@bgamari) gitlab at gitlab.haskell.org
Tue Aug 9 17:37:06 UTC 2022



Ben Gamari pushed to branch wip/T21964 at Glasgow Haskell Compiler / GHC


Commits:
c53512f3 by normalcoder at 2022-08-09T13:36:59-04:00
ncg/aarch64: Don't use x18 register on AArch64/Darwin

Apple's ABI documentation [1] says: "The platforms reserve register x18.
Don’t use this register." While this wasn't problematic in previous
Darwin releases, macOS 13 appears to start zeroing this register
periodically. See #21964.

[1] https://developer.apple.com/documentation/xcode/writing-arm64-code-for-apple-platforms

- - - - -


1 changed file:

- compiler/CodeGen.Platform.h


Changes:

=====================================
compiler/CodeGen.Platform.h
=====================================
@@ -926,6 +926,14 @@ freeReg 29 = False
 -- ip0 -- used for spill offset computations
 freeReg 16 = False
 
+#if defined(darwin_HOST_OS)
+-- x18 is the platform register on darwin, and can not be used
+-- More about ARM64 ABI that Apple platforms support:
+-- https://developer.apple.com/documentation/xcode/writing-arm64-code-for-apple-platforms
+-- https://github.com/Siguza/ios-resources/blob/master/bits/arm64.md
+freeReg 18 = False
+#endif
+
 # if defined(REG_Base)
 freeReg REG_Base  = False
 # endif



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/c53512f3c61297e3465f2ce322d4bd92ab2213ff

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/c53512f3c61297e3465f2ce322d4bd92ab2213ff
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20220809/551c7969/attachment-0001.html>


More information about the ghc-commits mailing list