{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE PatternSynonyms #-}

-- | Register classes for architectures which don't have any vector registers.
module GHC.Platform.Reg.Class.NoVectors
  ( RegClass ( RcInteger, RcFloat )
  , pprRegClass, allRegClasses
  )

where

import GHC.Utils.Outputable ( SDoc, text )
import GHC.Platform.Reg.Class ( RegClass(..) )

pattern RcInteger, RcFloat :: RegClass
pattern $mRcInteger :: forall {r}. RegClass -> ((# #) -> r) -> ((# #) -> r) -> r
$bRcInteger :: RegClass
RcInteger = RegClass 0
pattern $mRcFloat :: forall {r}. RegClass -> ((# #) -> r) -> ((# #) -> r) -> r
$bRcFloat :: RegClass
RcFloat   = RegClass 1
{-# COMPLETE RcInteger, RcFloat #-}

pprRegClass :: RegClass -> SDoc
pprRegClass :: RegClass -> SDoc
pprRegClass = \case
  RegClass
RcInteger -> String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"I"
  RegClass
RcFloat   -> String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"F"

allRegClasses :: [RegClass]
allRegClasses :: [RegClass]
allRegClasses = [RegClass
RcInteger, RegClass
RcFloat]