diff options
author | Ben Gamari <ben@well-typed.com> | 2023-01-20 07:43:55 -0800 |
---|---|---|
committer | Zubin Duggal <zubin.duggal@gmail.com> | 2023-02-07 18:47:10 +0530 |
commit | d5eea69cdc9487d4d40c8336356cadb4db13b8a2 (patch) | |
tree | f198110d353d6bd2c8eff17d670155a807083677 | |
parent | 34baa6e9e1adc10fd38be69493fc988a21c0abfa (diff) | |
download | haskell-d5eea69cdc9487d4d40c8336356cadb4db13b8a2.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.
(cherry picked from commit 7566fd9de38c67360c090f828923d41587af519c)
-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 6718d8fc76..ec75552275 100644 --- a/compiler/GHC/CmmToAsm/AArch64/Instr.hs +++ b/compiler/GHC/CmmToAsm/AArch64/Instr.hs @@ -73,6 +73,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, []) @@ -203,7 +208,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) |