1 {-# GHC_PRAGMA INTERFACE VERSION 5 #-}
2 interface AsmRegAlloc where
3 import CLabelInfo(CLabel)
4 import FiniteMap(FiniteMap)
5 import OrdList(OrdList)
6 import Outputable(NamedThing, Outputable)
7 import PrimKind(PrimKind)
9 import UniqSet(UniqSet(..))
11 class MachineCode a where
12 regUsage :: a -> RegUsage
13 regLiveness :: a -> RegLiveness -> RegLiveness
14 patchRegs :: a -> (Reg -> Reg) -> a
15 spillReg :: Reg -> Reg -> OrdList a
16 loadReg :: Reg -> Reg -> OrdList a
17 class MachineRegisters a where
19 possibleMRegs :: PrimKind -> a -> [Int]
20 useMReg :: a -> Int# -> a
21 useMRegs :: a -> [Int] -> a
22 freeMReg :: a -> Int# -> a
23 freeMRegs :: a -> [Int] -> a
26 data FutureLive = FL (UniqFM Reg) (FiniteMap CLabel (UniqFM Reg))
29 data Reg = FixedReg Int# | MappedReg Int# | MemoryReg Int PrimKind | UnmappedReg Unique PrimKind
30 data RegLiveness = RL (UniqFM Reg) FutureLive
31 data RegUsage = RU (UniqFM Reg) (UniqFM Reg)
33 type UniqSet a = UniqFM a
35 extractMappedRegNos :: [Reg] -> [Int]
36 mkReg :: Unique -> PrimKind -> Reg
37 runHairyRegAllocate :: (MachineRegisters a, MachineCode b) => a -> [Int] -> OrdList b -> [b]
38 runRegAllocate :: (MachineRegisters a, MachineCode b) => a -> [Int] -> OrdList b -> [b]
41 instance NamedThing Reg
42 instance Outputable Reg