module GHC.Driver.Backend
( Backend (..)
, platformDefaultBackend
, platformNcgSupported
)
where
import GHC.Prelude
import GHC.Platform
data Backend
= NCG
| LLVM
| ViaC
| Interpreter
deriving (Eq,Ord,Show,Read)
platformDefaultBackend :: Platform -> Backend
platformDefaultBackend platform = if
| platformUnregisterised platform -> ViaC
| platformNcgSupported platform -> NCG
| otherwise -> LLVM
platformNcgSupported :: Platform -> Bool
platformNcgSupported platform = if
| platformUnregisterised platform -> False
| ncgValidArch -> True
| otherwise -> False
where
ncgValidArch = case platformArch platform of
ArchX86 -> True
ArchX86_64 -> True
ArchPPC -> True
ArchPPC_64 {} -> True
ArchSPARC -> True
_ -> False