-- | An architecture independent description of a register's class.
module RegClass
        ( RegClass (..) )

where

import GhcPrelude

import  Outputable
import  Unique


-- | The class of a register.
--      Used in the register allocator.
--      We treat all registers in a class as being interchangable.
--
data RegClass
        = RcInteger
        | RcFloat
        | RcDouble
        deriving RegClass -> RegClass -> Bool
(RegClass -> RegClass -> Bool)
-> (RegClass -> RegClass -> Bool) -> Eq RegClass
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RegClass -> RegClass -> Bool
$c/= :: RegClass -> RegClass -> Bool
== :: RegClass -> RegClass -> Bool
$c== :: RegClass -> RegClass -> Bool
Eq


instance Uniquable RegClass where
    getUnique :: RegClass -> Unique
getUnique RegClass
RcInteger = Int -> Unique
mkRegClassUnique Int
0
    getUnique RegClass
RcFloat   = Int -> Unique
mkRegClassUnique Int
1
    getUnique RegClass
RcDouble  = Int -> Unique
mkRegClassUnique Int
2

instance Outputable RegClass where
    ppr :: RegClass -> SDoc
ppr RegClass
RcInteger       = String -> SDoc
Outputable.text String
"I"
    ppr RegClass
RcFloat         = String -> SDoc
Outputable.text String
"F"
    ppr RegClass
RcDouble        = String -> SDoc
Outputable.text String
"D"