{-# LANGUAGE MultiWayIf #-}
module GHC.Driver.Backend
( Backend (..)
, platformDefaultBackend
, platformNcgSupported
, backendProducesObject
, backendRetainsAllBindings
)
where
import GHC.Prelude
import GHC.Platform
data Backend
= NCG
| LLVM
| ViaC
| Interpreter
| NoBackend
deriving (Backend -> Backend -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Backend -> Backend -> Bool
$c/= :: Backend -> Backend -> Bool
== :: Backend -> Backend -> Bool
$c== :: Backend -> Backend -> Bool
Eq,Eq Backend
Backend -> Backend -> Bool
Backend -> Backend -> Ordering
Backend -> Backend -> Backend
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: Backend -> Backend -> Backend
$cmin :: Backend -> Backend -> Backend
max :: Backend -> Backend -> Backend
$cmax :: Backend -> Backend -> Backend
>= :: Backend -> Backend -> Bool
$c>= :: Backend -> Backend -> Bool
> :: Backend -> Backend -> Bool
$c> :: Backend -> Backend -> Bool
<= :: Backend -> Backend -> Bool
$c<= :: Backend -> Backend -> Bool
< :: Backend -> Backend -> Bool
$c< :: Backend -> Backend -> Bool
compare :: Backend -> Backend -> Ordering
$ccompare :: Backend -> Backend -> Ordering
Ord,Int -> Backend -> ShowS
[Backend] -> ShowS
Backend -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Backend] -> ShowS
$cshowList :: [Backend] -> ShowS
show :: Backend -> String
$cshow :: Backend -> String
showsPrec :: Int -> Backend -> ShowS
$cshowsPrec :: Int -> Backend -> ShowS
Show,ReadPrec [Backend]
ReadPrec Backend
Int -> ReadS Backend
ReadS [Backend]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Backend]
$creadListPrec :: ReadPrec [Backend]
readPrec :: ReadPrec Backend
$creadPrec :: ReadPrec Backend
readList :: ReadS [Backend]
$creadList :: ReadS [Backend]
readsPrec :: Int -> ReadS Backend
$creadsPrec :: Int -> ReadS Backend
Read)
platformDefaultBackend :: Platform -> Backend
platformDefaultBackend :: Platform -> Backend
platformDefaultBackend Platform
platform = if
| Platform -> Bool
platformUnregisterised Platform
platform -> Backend
ViaC
| Platform -> Bool
platformNcgSupported Platform
platform -> Backend
NCG
| Bool
otherwise -> Backend
LLVM
platformNcgSupported :: Platform -> Bool
platformNcgSupported :: Platform -> Bool
platformNcgSupported Platform
platform = if
| Platform -> Bool
platformUnregisterised Platform
platform -> Bool
False
| Bool
ncgValidArch -> Bool
True
| Bool
otherwise -> Bool
False
where
ncgValidArch :: Bool
ncgValidArch = case Platform -> Arch
platformArch Platform
platform of
Arch
ArchX86 -> Bool
True
Arch
ArchX86_64 -> Bool
True
Arch
ArchPPC -> Bool
True
ArchPPC_64 {} -> Bool
True
Arch
ArchSPARC -> Bool
True
Arch
ArchAArch64 -> Bool
True
Arch
_ -> Bool
False
backendProducesObject :: Backend -> Bool
backendProducesObject :: Backend -> Bool
backendProducesObject Backend
ViaC = Bool
True
backendProducesObject Backend
NCG = Bool
True
backendProducesObject Backend
LLVM = Bool
True
backendProducesObject Backend
Interpreter = Bool
False
backendProducesObject Backend
NoBackend = Bool
False
backendRetainsAllBindings :: Backend -> Bool
backendRetainsAllBindings :: Backend -> Bool
backendRetainsAllBindings Backend
Interpreter = Bool
True
backendRetainsAllBindings Backend
NoBackend = Bool
True
backendRetainsAllBindings Backend
ViaC = Bool
False
backendRetainsAllBindings Backend
NCG = Bool
False
backendRetainsAllBindings Backend
LLVM = Bool
False