diff options
author | Ben Gamari <ben@well-typed.com> | 2023-01-20 07:43:55 -0800 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2023-01-20 13:55:57 -0500 |
commit | 5733140152fa8b30c8bd4461559cfcd71b78a5ad (patch) | |
tree | a3a26d5c03727231dd824ea823a27659aacc86cd | |
parent | 46aa8d3aec69691485ef71b23ffd9adce578602b (diff) | |
download | haskell-5733140152fa8b30c8bd4461559cfcd71b78a5ad.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) |