summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSven Tennie <sven.tennie@wire.com>2023-04-15 12:18:18 +0000
committerSven Tennie <sven.tennie@gmail.com>2023-05-03 15:46:32 +0000
commitce03892ec20c695313d852794ae21627b4764754 (patch)
tree4ed593d4c59d1d1e5f4c9df2c4c54ff26da26b1b
parent00a8a5ff9abf5bb1a0c2a9225c7bca5ec3bdf306 (diff)
downloadhaskell-wip/supersven/aarch64_stackFrameSize.tar.gz
Adjust AArch64 stackFrameHeaderSizewip/supersven/aarch64_stackFrameSize
The prologue of each stack frame are the saved LR and FP registers, 8 byte each. I.e. the size of the stack frame header is 2 * 8 byte.
-rw-r--r--compiler/GHC/CmmToAsm/AArch64/Instr.hs13
1 files changed, 6 insertions, 7 deletions
diff --git a/compiler/GHC/CmmToAsm/AArch64/Instr.hs b/compiler/GHC/CmmToAsm/AArch64/Instr.hs
index 6c5a6194fa..7bf78becb6 100644
--- a/compiler/GHC/CmmToAsm/AArch64/Instr.hs
+++ b/compiler/GHC/CmmToAsm/AArch64/Instr.hs
@@ -32,9 +32,9 @@ import Data.Maybe (fromMaybe)
import GHC.Stack
--- | TODO: verify this!
-stackFrameHeaderSize :: Platform -> Int
-stackFrameHeaderSize _ = 64
+-- | LR and FP (8 byte each) are the prologue of each stack frame
+stackFrameHeaderSize :: Int
+stackFrameHeaderSize = 2 * 8
-- | All registers are 8 byte wide.
spillSlotSize :: Int
@@ -49,14 +49,13 @@ stackAlign = 16
maxSpillSlots :: NCGConfig -> Int
maxSpillSlots config
-- = 0 -- set to zero, to see when allocMoreStack has to fire.
- = let platform = ncgPlatform config
- in ((ncgSpillPreallocSize config - stackFrameHeaderSize platform)
+ = ((ncgSpillPreallocSize config - stackFrameHeaderSize)
`div` spillSlotSize) - 1
-- | Convert a spill slot number to a *byte* offset, with no sign.
spillSlotToOffset :: NCGConfig -> Int -> Int
-spillSlotToOffset config slot
- = stackFrameHeaderSize (ncgPlatform config) + spillSlotSize * slot
+spillSlotToOffset _ slot
+ = stackFrameHeaderSize + spillSlotSize * slot
-- | Get the registers that are being used by this instruction.
-- regUsage doesn't need to do any trickery for jumps and such.