diff options
author | Ben Gamari <ben@well-typed.com> | 2023-01-20 07:43:55 -0800 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2023-01-31 15:51:45 -0500 |
commit | 7566fd9de38c67360c090f828923d41587af519c (patch) | |
tree | 4bb64b6c54a4ca5b75ccd3e50c996f50130b42c0 | |
parent | 30989d137b8f3a8fddbfd116e04b48f23c24f86c (diff) | |
download | haskell-7566fd9de38c67360c090f828923d41587af519c.tar.gz |
nativeGen/AArch64: Fix graph-colouring allocator
Previously various `Instr` queries used by the graph-colouring allocator
failed to handle a few pseudo-instructions. This manifested in compiler
panicks while compiling `SHA`, which uses `-fregs-graph`.
Fixes #22798.
-rw-r--r-- | compiler/GHC/CmmToAsm/AArch64/Instr.hs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/compiler/GHC/CmmToAsm/AArch64/Instr.hs b/compiler/GHC/CmmToAsm/AArch64/Instr.hs index b1ecb14b80..d9bec45439 100644 --- a/compiler/GHC/CmmToAsm/AArch64/Instr.hs +++ b/compiler/GHC/CmmToAsm/AArch64/Instr.hs @@ -72,6 +72,11 @@ instance Outputable RegUsage where regUsageOfInstr :: Platform -> Instr -> RegUsage regUsageOfInstr platform instr = case instr of ANN _ i -> regUsageOfInstr platform i + COMMENT{} -> usage ([], []) + PUSH_STACK_FRAME -> usage ([], []) + POP_STACK_FRAME -> usage ([], []) + DELTA{} -> usage ([], []) + -- 1. Arithmetic Instructions ------------------------------------------------ ADD dst src1 src2 -> usage (regOp src1 ++ regOp src2, regOp dst) CMN l r -> usage (regOp l ++ regOp r, []) @@ -200,7 +205,11 @@ callerSavedRegisters patchRegsOfInstr :: Instr -> (Reg -> Reg) -> Instr patchRegsOfInstr instr env = case instr of -- 0. Meta Instructions - ANN d i -> ANN d (patchRegsOfInstr i env) + ANN d i -> ANN d (patchRegsOfInstr i env) + COMMENT{} -> instr + PUSH_STACK_FRAME -> instr + POP_STACK_FRAME -> instr + DELTA{} -> instr -- 1. Arithmetic Instructions ---------------------------------------------- ADD o1 o2 o3 -> ADD (patchOp o1) (patchOp o2) (patchOp o3) CMN o1 o2 -> CMN (patchOp o1) (patchOp o2) |