summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2022-01-26 22:09:43 -0500
committerBen Gamari <ben@smart-cactus.org>2022-01-29 14:52:56 -0500
commit5771b69007f1c218db8ddc1652ffd3c0ba6d0682 (patch)
treeb836629d532848f1df47b58af79b555f3c3514a4
parenta67c2471a0bf18adf2916fbaa6a7e3f676279b7f (diff)
downloadhaskell-5771b69007f1c218db8ddc1652ffd3c0ba6d0682.tar.gz
CmmToAsm: Drop RegPair
SPARC was its last and only user.
-rw-r--r--compiler/GHC/CmmToAsm/AArch64/Instr.hs2
-rw-r--r--compiler/GHC/CmmToAsm/AArch64/Ppr.hs1
-rw-r--r--compiler/GHC/CmmToAsm/AArch64/Regs.hs7
-rw-r--r--compiler/GHC/CmmToAsm/PPC/Instr.hs3
-rw-r--r--compiler/GHC/CmmToAsm/PPC/Ppr.hs1
-rw-r--r--compiler/GHC/CmmToAsm/PPC/Regs.hs5
-rw-r--r--compiler/GHC/CmmToAsm/Reg/Graph/SpillClean.hs3
-rw-r--r--compiler/GHC/CmmToAsm/Reg/Linear/AArch64.hs2
-rw-r--r--compiler/GHC/CmmToAsm/Reg/Linear/PPC.hs6
-rw-r--r--compiler/GHC/CmmToAsm/Reg/Linear/X86.hs7
-rw-r--r--compiler/GHC/CmmToAsm/Reg/Linear/X86_64.hs8
-rw-r--r--compiler/GHC/CmmToAsm/X86/Instr.hs1
-rw-r--r--compiler/GHC/CmmToAsm/X86/Ppr.hs1
-rw-r--r--compiler/GHC/CmmToAsm/X86/Regs.hs6
-rw-r--r--compiler/GHC/Platform/Reg.hs18
15 files changed, 1 insertions, 70 deletions
diff --git a/compiler/GHC/CmmToAsm/AArch64/Instr.hs b/compiler/GHC/CmmToAsm/AArch64/Instr.hs
index a3eba828f0..001ae959c7 100644
--- a/compiler/GHC/CmmToAsm/AArch64/Instr.hs
+++ b/compiler/GHC/CmmToAsm/AArch64/Instr.hs
@@ -164,8 +164,6 @@ regUsageOfInstr platform instr = case instr of
interesting _ (RegVirtual _) = True
interesting _ (RegReal (RealRegSingle (-1))) = False
interesting platform (RegReal (RealRegSingle i)) = freeReg platform i
- interesting _ (RegReal (RealRegPair{}))
- = panic "AArch64.Instr.interesting: no reg pairs on this arch"
-- Save caller save registers
-- This is x0-x18
diff --git a/compiler/GHC/CmmToAsm/AArch64/Ppr.hs b/compiler/GHC/CmmToAsm/AArch64/Ppr.hs
index 9d1dea085a..8d93a56395 100644
--- a/compiler/GHC/CmmToAsm/AArch64/Ppr.hs
+++ b/compiler/GHC/CmmToAsm/AArch64/Ppr.hs
@@ -339,7 +339,6 @@ pprOp plat op = case op of
pprReg :: Width -> Reg -> SDoc
pprReg w r = case r of
RegReal (RealRegSingle i) -> ppr_reg_no w i
- RegReal (RealRegPair{}) -> panic "AArch64.pprReg: no reg pairs on this arch!"
-- virtual regs should not show up, but this is helpful for debugging.
RegVirtual (VirtualRegI u) -> text "%vI_" <> pprUniqueAlways u
RegVirtual (VirtualRegF u) -> text "%vF_" <> pprUniqueAlways u
diff --git a/compiler/GHC/CmmToAsm/AArch64/Regs.hs b/compiler/GHC/CmmToAsm/AArch64/Regs.hs
index fd1669eeac..4fd50b0d3f 100644
--- a/compiler/GHC/CmmToAsm/AArch64/Regs.hs
+++ b/compiler/GHC/CmmToAsm/AArch64/Regs.hs
@@ -129,16 +129,12 @@ realRegSqueeze cls rr
| regNo < 32 -> 1 -- first fp reg is 32
| otherwise -> 0
- RealRegPair{} -> 0
-
RcDouble
-> case rr of
RealRegSingle regNo
| regNo < 32 -> 0
| otherwise -> 1
- RealRegPair{} -> 0
-
_other -> 0
mkVirtualReg :: Unique -> Format -> VirtualReg
@@ -156,9 +152,6 @@ classOfRealReg (RealRegSingle i)
| i < 32 = RcInteger
| otherwise = RcDouble
-classOfRealReg (RealRegPair{})
- = panic "regClass(ppr): no reg pairs on this architecture"
-
regDotColor :: RealReg -> SDoc
regDotColor reg
= case classOfRealReg reg of
diff --git a/compiler/GHC/CmmToAsm/PPC/Instr.hs b/compiler/GHC/CmmToAsm/PPC/Instr.hs
index 524a7153b0..16a28ba666 100644
--- a/compiler/GHC/CmmToAsm/PPC/Instr.hs
+++ b/compiler/GHC/CmmToAsm/PPC/Instr.hs
@@ -391,9 +391,6 @@ regUsageOfInstr platform instr
interesting :: Platform -> Reg -> Bool
interesting _ (RegVirtual _) = True
interesting platform (RegReal (RealRegSingle i)) = freeReg platform i
-interesting _ (RegReal (RealRegPair{}))
- = panic "PPC.Instr.interesting: no reg pairs on this arch"
-
-- | Apply a given mapping to all the register references in this
diff --git a/compiler/GHC/CmmToAsm/PPC/Ppr.hs b/compiler/GHC/CmmToAsm/PPC/Ppr.hs
index 05217768fc..3deccb6663 100644
--- a/compiler/GHC/CmmToAsm/PPC/Ppr.hs
+++ b/compiler/GHC/CmmToAsm/PPC/Ppr.hs
@@ -199,7 +199,6 @@ pprReg :: Reg -> SDoc
pprReg r
= case r of
RegReal (RealRegSingle i) -> ppr_reg_no i
- RegReal (RealRegPair{}) -> panic "PPC.pprReg: no reg pairs on this arch"
RegVirtual (VirtualRegI u) -> text "%vI_" <> pprUniqueAlways u
RegVirtual (VirtualRegHi u) -> text "%vHi_" <> pprUniqueAlways u
RegVirtual (VirtualRegF u) -> text "%vF_" <> pprUniqueAlways u
diff --git a/compiler/GHC/CmmToAsm/PPC/Regs.hs b/compiler/GHC/CmmToAsm/PPC/Regs.hs
index 9d2d49a58f..5c9fab32d4 100644
--- a/compiler/GHC/CmmToAsm/PPC/Regs.hs
+++ b/compiler/GHC/CmmToAsm/PPC/Regs.hs
@@ -100,7 +100,6 @@ realRegSqueeze cls rr
| regNo < 32 -> 1 -- first fp reg is 32
| otherwise -> 0
- RealRegPair{} -> 0
RcDouble
-> case rr of
@@ -108,7 +107,6 @@ realRegSqueeze cls rr
| regNo < 32 -> 0
| otherwise -> 1
- RealRegPair{} -> 0
_other -> 0
@@ -239,9 +237,6 @@ classOfRealReg (RealRegSingle i)
| i < 32 = RcInteger
| otherwise = RcDouble
-classOfRealReg (RealRegPair{})
- = panic "regClass(ppr): no reg pairs on this architecture"
-
showReg :: RegNo -> String
showReg n
| n >= 0 && n <= 31 = "%r" ++ show n
diff --git a/compiler/GHC/CmmToAsm/Reg/Graph/SpillClean.hs b/compiler/GHC/CmmToAsm/Reg/Graph/SpillClean.hs
index a7ffb0555f..60757544be 100644
--- a/compiler/GHC/CmmToAsm/Reg/Graph/SpillClean.hs
+++ b/compiler/GHC/CmmToAsm/Reg/Graph/SpillClean.hs
@@ -516,9 +516,6 @@ instance Uniquable Store where
| RegReal (RealRegSingle i) <- r
= mkRegSingleUnique i
- | RegReal (RealRegPair r1 r2) <- r
- = mkRegPairUnique (r1 * 65535 + r2)
-
| otherwise
= error $ "RegSpillClean.getUnique: found virtual reg during spill clean,"
++ "only real regs expected."
diff --git a/compiler/GHC/CmmToAsm/Reg/Linear/AArch64.hs b/compiler/GHC/CmmToAsm/Reg/Linear/AArch64.hs
index 50299c4e74..ffe4719f0a 100644
--- a/compiler/GHC/CmmToAsm/Reg/Linear/AArch64.hs
+++ b/compiler/GHC/CmmToAsm/Reg/Linear/AArch64.hs
@@ -71,7 +71,6 @@ allocateReg (RealRegSingle r) (FreeRegs g f)
| r < 32 && testBit g r = FreeRegs (clearBit g r) f
| r > 31 = panic $ "Linear.AArch64.allocReg: double allocation of float reg v" ++ show (r - 32) ++ "; " ++ showBits f
| otherwise = pprPanic "Linear.AArch64.allocReg" $ text ("double allocation of gp reg x" ++ show r ++ "; " ++ showBits g)
-allocateReg _ _ = panic "Linear.AArch64.allocReg: bad reg"
-- we start from 28 downwards... the logic is similar to the ppc logic.
-- 31 is Stack Pointer
@@ -134,4 +133,3 @@ releaseReg (RealRegSingle r) (FreeRegs g f)
| r < 32 && testBit g r = pprPanic "Linear.AArch64.releaseReg" (text "can't release non-allocated reg x" <> int r)
| r > 31 = FreeRegs g (setBit f (r - 32))
| otherwise = FreeRegs (setBit g r) f
-releaseReg _ _ = pprPanic "Linear.AArch64.releaseReg" (text "bad reg")
diff --git a/compiler/GHC/CmmToAsm/Reg/Linear/PPC.hs b/compiler/GHC/CmmToAsm/Reg/Linear/PPC.hs
index 1e9a49f8a6..6357f84265 100644
--- a/compiler/GHC/CmmToAsm/Reg/Linear/PPC.hs
+++ b/compiler/GHC/CmmToAsm/Reg/Linear/PPC.hs
@@ -8,7 +8,6 @@ import GHC.Platform.Reg.Class
import GHC.Platform.Reg
import GHC.Utils.Outputable
-import GHC.Utils.Panic
import GHC.Platform
import Data.Word
@@ -38,9 +37,6 @@ releaseReg (RealRegSingle r) (FreeRegs g f)
| r > 31 = FreeRegs g (f .|. (1 `shiftL` (r - 32)))
| otherwise = FreeRegs (g .|. (1 `shiftL` r)) f
-releaseReg _ _
- = panic "RegAlloc.Linear.PPC.releaseReg: bad reg"
-
initFreeRegs :: Platform -> FreeRegs
initFreeRegs platform = foldl' (flip releaseReg) noFreeRegs (allocatableRegs platform)
@@ -59,5 +55,3 @@ allocateReg (RealRegSingle r) (FreeRegs g f)
| r > 31 = FreeRegs g (f .&. complement (1 `shiftL` (r - 32)))
| otherwise = FreeRegs (g .&. complement (1 `shiftL` r)) f
-allocateReg _ _
- = panic "RegAlloc.Linear.PPC.allocateReg: bad reg"
diff --git a/compiler/GHC/CmmToAsm/Reg/Linear/X86.hs b/compiler/GHC/CmmToAsm/Reg/Linear/X86.hs
index ba9b9cc966..c4fb54aaa7 100644
--- a/compiler/GHC/CmmToAsm/Reg/Linear/X86.hs
+++ b/compiler/GHC/CmmToAsm/Reg/Linear/X86.hs
@@ -8,7 +8,6 @@ import GHC.Prelude
import GHC.CmmToAsm.X86.Regs
import GHC.Platform.Reg.Class
import GHC.Platform.Reg
-import GHC.Utils.Panic
import GHC.Platform
import GHC.Utils.Outputable
@@ -24,9 +23,6 @@ releaseReg :: RealReg -> FreeRegs -> FreeRegs
releaseReg (RealRegSingle n) (FreeRegs f)
= FreeRegs (f .|. (1 `shiftL` n))
-releaseReg _ _
- = panic "RegAlloc.Linear.X86.FreeRegs.releaseReg: no reg"
-
initFreeRegs :: Platform -> FreeRegs
initFreeRegs platform
= foldl' (flip releaseReg) noFreeRegs (allocatableRegs platform)
@@ -48,6 +44,3 @@ allocateReg :: RealReg -> FreeRegs -> FreeRegs
allocateReg (RealRegSingle r) (FreeRegs f)
= FreeRegs (f .&. complement (1 `shiftL` r))
-allocateReg _ _
- = panic "RegAlloc.Linear.X86.FreeRegs.allocateReg: no reg"
-
diff --git a/compiler/GHC/CmmToAsm/Reg/Linear/X86_64.hs b/compiler/GHC/CmmToAsm/Reg/Linear/X86_64.hs
index 801b7be146..89553712da 100644
--- a/compiler/GHC/CmmToAsm/Reg/Linear/X86_64.hs
+++ b/compiler/GHC/CmmToAsm/Reg/Linear/X86_64.hs
@@ -8,7 +8,6 @@ import GHC.Prelude
import GHC.CmmToAsm.X86.Regs
import GHC.Platform.Reg.Class
import GHC.Platform.Reg
-import GHC.Utils.Panic
import GHC.Platform
import GHC.Utils.Outputable
@@ -24,9 +23,6 @@ releaseReg :: RealReg -> FreeRegs -> FreeRegs
releaseReg (RealRegSingle n) (FreeRegs f)
= FreeRegs (f .|. (1 `shiftL` n))
-releaseReg _ _
- = panic "RegAlloc.Linear.X86_64.FreeRegs.releaseReg: no reg"
-
initFreeRegs :: Platform -> FreeRegs
initFreeRegs platform
= foldl' (flip releaseReg) noFreeRegs (allocatableRegs platform)
@@ -48,7 +44,3 @@ allocateReg :: RealReg -> FreeRegs -> FreeRegs
allocateReg (RealRegSingle r) (FreeRegs f)
= FreeRegs (f .&. complement (1 `shiftL` r))
-allocateReg _ _
- = panic "RegAlloc.Linear.X86_64.FreeRegs.allocateReg: no reg"
-
-
diff --git a/compiler/GHC/CmmToAsm/X86/Instr.hs b/compiler/GHC/CmmToAsm/X86/Instr.hs
index fa6e110056..8eff3b1952 100644
--- a/compiler/GHC/CmmToAsm/X86/Instr.hs
+++ b/compiler/GHC/CmmToAsm/X86/Instr.hs
@@ -513,7 +513,6 @@ regUsageOfInstr platform instr
interesting :: Platform -> Reg -> Bool
interesting _ (RegVirtual _) = True
interesting platform (RegReal (RealRegSingle i)) = freeReg platform i
-interesting _ (RegReal (RealRegPair{})) = panic "X86.interesting: no reg pairs on this arch"
diff --git a/compiler/GHC/CmmToAsm/X86/Ppr.hs b/compiler/GHC/CmmToAsm/X86/Ppr.hs
index b06e7f0596..8e0fb08c7f 100644
--- a/compiler/GHC/CmmToAsm/X86/Ppr.hs
+++ b/compiler/GHC/CmmToAsm/X86/Ppr.hs
@@ -295,7 +295,6 @@ pprReg platform f r
RegReal (RealRegSingle i) ->
if target32Bit platform then ppr32_reg_no f i
else ppr64_reg_no f i
- RegReal (RealRegPair _ _) -> panic "X86.Ppr: no reg pairs on this arch"
RegVirtual (VirtualRegI u) -> text "%vI_" <> pprUniqueAlways u
RegVirtual (VirtualRegHi u) -> text "%vHi_" <> pprUniqueAlways u
RegVirtual (VirtualRegF u) -> text "%vF_" <> pprUniqueAlways u
diff --git a/compiler/GHC/CmmToAsm/X86/Regs.hs b/compiler/GHC/CmmToAsm/X86/Regs.hs
index b1b45042fb..cc880f6e98 100644
--- a/compiler/GHC/CmmToAsm/X86/Regs.hs
+++ b/compiler/GHC/CmmToAsm/X86/Regs.hs
@@ -96,17 +96,12 @@ realRegSqueeze cls rr
| regNo < firstxmm -> 1
| otherwise -> 0
- RealRegPair{} -> 0
-
RcDouble
-> case rr of
RealRegSingle regNo
| regNo >= firstxmm -> 1
| otherwise -> 0
- RealRegPair{} -> 0
-
-
_other -> 0
-- -----------------------------------------------------------------------------
@@ -249,7 +244,6 @@ classOfRealReg platform reg
| i <= lastint platform -> RcInteger
| i <= lastxmm platform -> RcDouble
| otherwise -> panic "X86.Reg.classOfRealReg registerSingle too high"
- _ -> panic "X86.Regs.classOfRealReg: RegPairs on this arch"
-- | Get the name of the register with this number.
-- NOTE: fixme, we dont track which "way" the XMM registers are used
diff --git a/compiler/GHC/Platform/Reg.hs b/compiler/GHC/Platform/Reg.hs
index 8203b9bbea..8b4757744b 100644
--- a/compiler/GHC/Platform/Reg.hs
+++ b/compiler/GHC/Platform/Reg.hs
@@ -6,7 +6,6 @@
module GHC.Platform.Reg (
RegNo,
Reg(..),
- regPair,
regSingle,
realRegSingle,
isRealReg, takeRealReg,
@@ -143,32 +142,24 @@ getHiVRegFromLo reg
-- the usual way. We know what class they are, because that's part of
-- the processor's architecture.
--
--- RealRegPairs are pairs of real registers that are allocated together
--- to hold a larger value, such as with Double regs on SPARC.
---
data RealReg
= RealRegSingle {-# UNPACK #-} !RegNo
- | RealRegPair {-# UNPACK #-} !RegNo {-# UNPACK #-} !RegNo
deriving (Eq, Show, Ord)
instance Uniquable RealReg where
getUnique reg
= case reg of
RealRegSingle i -> mkRegSingleUnique i
- RealRegPair r1 r2 -> mkRegPairUnique (r1 * 65536 + r2)
instance Outputable RealReg where
ppr reg
= case reg of
RealRegSingle i -> text "%r" <> int i
- RealRegPair r1 r2 -> text "%r(" <> int r1
- <> vbar <> int r2 <> text ")"
regNosOfRealReg :: RealReg -> [RegNo]
regNosOfRealReg rr
= case rr of
RealRegSingle r1 -> [r1]
- RealRegPair r1 r2 -> [r1, r2]
realRegsAlias :: RealReg -> RealReg -> Bool
@@ -178,11 +169,7 @@ realRegsAlias rr1 rr2 =
-- write out all the cases which gives us nice non-allocating code.
case rr1 of
RealRegSingle r1 ->
- case rr2 of RealRegPair r2 r3 -> r1 == r2 || r1 == r3
- RealRegSingle r2 -> r1 == r2
- RealRegPair r1 r2 ->
- case rr2 of RealRegPair r3 r4 -> r1 == r3 || r1 == r4 || r2 == r3 || r2 == r4
- RealRegSingle r3 -> r1 == r3 || r2 == r3
+ case rr2 of RealRegSingle r2 -> r1 == r2
--------------------------------------------------------------------------------
-- | A register, either virtual or real
@@ -197,9 +184,6 @@ regSingle regNo = RegReal (realRegSingle regNo)
realRegSingle :: RegNo -> RealReg
realRegSingle regNo = RealRegSingle regNo
-regPair :: RegNo -> RegNo -> Reg
-regPair regNo1 regNo2 = RegReal $ RealRegPair regNo1 regNo2
-
-- We like to have Uniques for Reg so that we can make UniqFM and UniqSets
-- in the register allocator.