{-# LANGUAGE MultiWayIf #-}
module GHC.Driver.Backend
(
Backend
, ncgBackend
, llvmBackend
, jsBackend
, viaCBackend
, interpreterBackend
, noBackend
, allBackends
, PrimitiveImplementation(..)
, DefunctionalizedCodeOutput(..)
, DefunctionalizedPostHscPipeline(..)
, DefunctionalizedAssemblerProg(..)
, DefunctionalizedAssemblerInfoGetter(..)
, DefunctionalizedCDefs(..)
, BackendName
, backendDescription
, backendWritesFiles
, backendPipelineOutput
, backendCanReuseLoadedCode
, backendGeneratesCode
, backendGeneratesCodeForHsBoot
, backendSupportsInterfaceWriting
, backendRespectsSpecialise
, backendWantsGlobalBindings
, backendHasNativeSwitch
, backendPrimitiveImplementation
, backendSimdValidity
, backendSupportsEmbeddedBlobs
, backendNeedsPlatformNcgSupport
, backendSupportsUnsplitProcPoints
, backendSwappableWithViaC
, backendUnregisterisedAbiOnly
, backendGeneratesHc
, backendSptIsDynamic
, backendWantsBreakpointTicks
, backendForcesOptimization0
, backendNeedsFullWays
, backendSpecialModuleSource
, backendSupportsHpc
, backendSupportsCImport
, backendSupportsCExport
, backendAssemblerProg
, backendAssemblerInfoGetter
, backendCDefs
, backendCodeOutput
, backendUseJSLinker
, backendPostHscPipeline
, backendNormalSuccessorPhase
, backendName
, backendValidityOfCImport
, backendValidityOfCExport
, platformDefaultBackend
, platformNcgSupported
)
where
import GHC.Prelude
import GHC.Driver.Backend.Internal (BackendName(..))
import GHC.Driver.Phases
import GHC.Utils.Error
import GHC.Utils.Panic
import GHC.Driver.Pipeline.Monad
import GHC.Platform
platformDefaultBackend :: Platform -> Backend
platformDefaultBackend :: Platform -> Backend
platformDefaultBackend Platform
platform = if
| Platform -> Bool
platformUnregisterised Platform
platform -> Backend
viaCBackend
| Platform -> Bool
platformNcgSupported Platform
platform -> Backend
ncgBackend
| Platform -> Bool
platformJSSupported Platform
platform -> Backend
jsBackend
| Bool
otherwise -> Backend
llvmBackend
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
ArchAArch64 -> Bool
True
Arch
ArchWasm32 -> Bool
True
Arch
_ -> Bool
False
platformJSSupported :: Platform -> Bool
platformJSSupported :: Platform -> Bool
platformJSSupported Platform
platform
| Platform -> Arch
platformArch Platform
platform forall a. Eq a => a -> a -> Bool
== Arch
ArchJavaScript = Bool
True
| Bool
otherwise = Bool
False
newtype Backend = Named BackendName
instance Show Backend where
show :: Backend -> String
show = Backend -> String
backendDescription
ncgBackend, llvmBackend, viaCBackend, interpreterBackend, jsBackend, noBackend
:: Backend
ncgBackend :: Backend
ncgBackend = BackendName -> Backend
Named BackendName
NCG
llvmBackend :: Backend
llvmBackend = BackendName -> Backend
Named BackendName
LLVM
jsBackend :: Backend
jsBackend = BackendName -> Backend
Named BackendName
JavaScript
viaCBackend :: Backend
viaCBackend = BackendName -> Backend
Named BackendName
ViaC
interpreterBackend :: Backend
interpreterBackend = BackendName -> Backend
Named BackendName
Interpreter
noBackend :: Backend
noBackend = BackendName -> Backend
Named BackendName
NoBackend
data PrimitiveImplementation
= LlvmPrimitives
| NcgPrimitives
| JSPrimitives
| GenericPrimitives
deriving Int -> PrimitiveImplementation -> ShowS
[PrimitiveImplementation] -> ShowS
PrimitiveImplementation -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PrimitiveImplementation] -> ShowS
$cshowList :: [PrimitiveImplementation] -> ShowS
show :: PrimitiveImplementation -> String
$cshow :: PrimitiveImplementation -> String
showsPrec :: Int -> PrimitiveImplementation -> ShowS
$cshowsPrec :: Int -> PrimitiveImplementation -> ShowS
Show
data DefunctionalizedAssemblerProg
= StandardAssemblerProg
| JSAssemblerProg
| DarwinClangAssemblerProg
data DefunctionalizedAssemblerInfoGetter
= StandardAssemblerInfoGetter
| JSAssemblerInfoGetter
| DarwinClangAssemblerInfoGetter
data DefunctionalizedCodeOutput
= NcgCodeOutput
| ViaCCodeOutput
| LlvmCodeOutput
| JSCodeOutput
data DefunctionalizedPostHscPipeline
= NcgPostHscPipeline
| ViaCPostHscPipeline
| LlvmPostHscPipeline
| JSPostHscPipeline
| NoPostHscPipeline
data DefunctionalizedCDefs
= NoCDefs
| LlvmCDefs
backendDescription :: Backend -> String
backendDescription :: Backend -> String
backendDescription (Named BackendName
NCG) = String
"native code generator"
backendDescription (Named BackendName
LLVM) = String
"LLVM"
backendDescription (Named BackendName
ViaC) = String
"compiling via C"
backendDescription (Named BackendName
JavaScript) = String
"compiling to JavaScript"
backendDescription (Named BackendName
Interpreter) = String
"byte-code interpreter"
backendDescription (Named BackendName
NoBackend) = String
"no code generated"
backendWritesFiles :: Backend -> Bool
backendWritesFiles :: Backend -> Bool
backendWritesFiles (Named BackendName
NCG) = Bool
True
backendWritesFiles (Named BackendName
LLVM) = Bool
True
backendWritesFiles (Named BackendName
ViaC) = Bool
True
backendWritesFiles (Named BackendName
JavaScript) = Bool
True
backendWritesFiles (Named BackendName
Interpreter) = Bool
False
backendWritesFiles (Named BackendName
NoBackend) = Bool
False
backendPipelineOutput :: Backend -> PipelineOutput
backendPipelineOutput :: Backend -> PipelineOutput
backendPipelineOutput (Named BackendName
NCG) = PipelineOutput
Persistent
backendPipelineOutput (Named BackendName
LLVM) = PipelineOutput
Persistent
backendPipelineOutput (Named BackendName
ViaC) = PipelineOutput
Persistent
backendPipelineOutput (Named BackendName
JavaScript) = PipelineOutput
Persistent
backendPipelineOutput (Named BackendName
Interpreter) = PipelineOutput
NoOutputFile
backendPipelineOutput (Named BackendName
NoBackend) = PipelineOutput
NoOutputFile
backendCanReuseLoadedCode :: Backend -> Bool
backendCanReuseLoadedCode :: Backend -> Bool
backendCanReuseLoadedCode (Named BackendName
NCG) = Bool
False
backendCanReuseLoadedCode (Named BackendName
LLVM) = Bool
False
backendCanReuseLoadedCode (Named BackendName
ViaC) = Bool
False
backendCanReuseLoadedCode (Named BackendName
JavaScript) = Bool
False
backendCanReuseLoadedCode (Named BackendName
Interpreter) = Bool
True
backendCanReuseLoadedCode (Named BackendName
NoBackend) = Bool
False
backendGeneratesCode :: Backend -> Bool
backendGeneratesCode :: Backend -> Bool
backendGeneratesCode (Named BackendName
NCG) = Bool
True
backendGeneratesCode (Named BackendName
LLVM) = Bool
True
backendGeneratesCode (Named BackendName
ViaC) = Bool
True
backendGeneratesCode (Named BackendName
JavaScript) = Bool
True
backendGeneratesCode (Named BackendName
Interpreter) = Bool
True
backendGeneratesCode (Named BackendName
NoBackend) = Bool
False
backendGeneratesCodeForHsBoot :: Backend -> Bool
backendGeneratesCodeForHsBoot :: Backend -> Bool
backendGeneratesCodeForHsBoot (Named BackendName
NCG) = Bool
True
backendGeneratesCodeForHsBoot (Named BackendName
LLVM) = Bool
True
backendGeneratesCodeForHsBoot (Named BackendName
ViaC) = Bool
True
backendGeneratesCodeForHsBoot (Named BackendName
JavaScript) = Bool
True
backendGeneratesCodeForHsBoot (Named BackendName
Interpreter) = Bool
False
backendGeneratesCodeForHsBoot (Named BackendName
NoBackend) = Bool
False
backendSupportsInterfaceWriting :: Backend -> Bool
backendSupportsInterfaceWriting :: Backend -> Bool
backendSupportsInterfaceWriting (Named BackendName
NCG) = Bool
True
backendSupportsInterfaceWriting (Named BackendName
LLVM) = Bool
True
backendSupportsInterfaceWriting (Named BackendName
ViaC) = Bool
True
backendSupportsInterfaceWriting (Named BackendName
JavaScript) = Bool
True
backendSupportsInterfaceWriting (Named BackendName
Interpreter) = Bool
True
backendSupportsInterfaceWriting (Named BackendName
NoBackend) = Bool
False
backendRespectsSpecialise :: Backend -> Bool
backendRespectsSpecialise :: Backend -> Bool
backendRespectsSpecialise (Named BackendName
NCG) = Bool
True
backendRespectsSpecialise (Named BackendName
LLVM) = Bool
True
backendRespectsSpecialise (Named BackendName
ViaC) = Bool
True
backendRespectsSpecialise (Named BackendName
JavaScript) = Bool
True
backendRespectsSpecialise (Named BackendName
Interpreter) = Bool
False
backendRespectsSpecialise (Named BackendName
NoBackend) = Bool
False
backendWantsGlobalBindings :: Backend -> Bool
backendWantsGlobalBindings :: Backend -> Bool
backendWantsGlobalBindings (Named BackendName
NCG) = Bool
False
backendWantsGlobalBindings (Named BackendName
LLVM) = Bool
False
backendWantsGlobalBindings (Named BackendName
ViaC) = Bool
False
backendWantsGlobalBindings (Named BackendName
JavaScript) = Bool
False
backendWantsGlobalBindings (Named BackendName
Interpreter) = Bool
True
backendWantsGlobalBindings (Named BackendName
NoBackend) = Bool
True
backendHasNativeSwitch :: Backend -> Bool
backendHasNativeSwitch :: Backend -> Bool
backendHasNativeSwitch (Named BackendName
NCG) = Bool
False
backendHasNativeSwitch (Named BackendName
LLVM) = Bool
True
backendHasNativeSwitch (Named BackendName
ViaC) = Bool
True
backendHasNativeSwitch (Named BackendName
JavaScript) = Bool
True
backendHasNativeSwitch (Named BackendName
Interpreter) = Bool
False
backendHasNativeSwitch (Named BackendName
NoBackend) = Bool
False
backendPrimitiveImplementation :: Backend -> PrimitiveImplementation
backendPrimitiveImplementation :: Backend -> PrimitiveImplementation
backendPrimitiveImplementation (Named BackendName
NCG) = PrimitiveImplementation
NcgPrimitives
backendPrimitiveImplementation (Named BackendName
LLVM) = PrimitiveImplementation
LlvmPrimitives
backendPrimitiveImplementation (Named BackendName
JavaScript) = PrimitiveImplementation
JSPrimitives
backendPrimitiveImplementation (Named BackendName
ViaC) = PrimitiveImplementation
GenericPrimitives
backendPrimitiveImplementation (Named BackendName
Interpreter) = PrimitiveImplementation
GenericPrimitives
backendPrimitiveImplementation (Named BackendName
NoBackend) = PrimitiveImplementation
GenericPrimitives
backendSimdValidity :: Backend -> Validity' String
backendSimdValidity :: Backend -> Validity' String
backendSimdValidity (Named BackendName
NCG) = forall a. a -> Validity' a
NotValid forall a b. (a -> b) -> a -> b
$ [String] -> String
unlines [String
"SIMD vector instructions require the LLVM back-end.",String
"Please use -fllvm."]
backendSimdValidity (Named BackendName
LLVM) = forall a. Validity' a
IsValid
backendSimdValidity (Named BackendName
ViaC) = forall a. a -> Validity' a
NotValid forall a b. (a -> b) -> a -> b
$ [String] -> String
unlines [String
"SIMD vector instructions require the LLVM back-end.",String
"Please use -fllvm."]
backendSimdValidity (Named BackendName
JavaScript) = forall a. a -> Validity' a
NotValid forall a b. (a -> b) -> a -> b
$ [String] -> String
unlines [String
"SIMD vector instructions require the LLVM back-end.",String
"Please use -fllvm."]
backendSimdValidity (Named BackendName
Interpreter) = forall a. a -> Validity' a
NotValid forall a b. (a -> b) -> a -> b
$ [String] -> String
unlines [String
"SIMD vector instructions require the LLVM back-end.",String
"Please use -fllvm."]
backendSimdValidity (Named BackendName
NoBackend) = forall a. a -> Validity' a
NotValid forall a b. (a -> b) -> a -> b
$ [String] -> String
unlines [String
"SIMD vector instructions require the LLVM back-end.",String
"Please use -fllvm."]
backendSupportsEmbeddedBlobs :: Backend -> Bool
backendSupportsEmbeddedBlobs :: Backend -> Bool
backendSupportsEmbeddedBlobs (Named BackendName
NCG) = Bool
True
backendSupportsEmbeddedBlobs (Named BackendName
LLVM) = Bool
False
backendSupportsEmbeddedBlobs (Named BackendName
ViaC) = Bool
False
backendSupportsEmbeddedBlobs (Named BackendName
JavaScript) = Bool
False
backendSupportsEmbeddedBlobs (Named BackendName
Interpreter) = Bool
False
backendSupportsEmbeddedBlobs (Named BackendName
NoBackend) = Bool
False
backendNeedsPlatformNcgSupport :: Backend -> Bool
backendNeedsPlatformNcgSupport :: Backend -> Bool
backendNeedsPlatformNcgSupport (Named BackendName
NCG) = Bool
True
backendNeedsPlatformNcgSupport (Named BackendName
LLVM) = Bool
False
backendNeedsPlatformNcgSupport (Named BackendName
ViaC) = Bool
False
backendNeedsPlatformNcgSupport (Named BackendName
JavaScript) = Bool
False
backendNeedsPlatformNcgSupport (Named BackendName
Interpreter) = Bool
False
backendNeedsPlatformNcgSupport (Named BackendName
NoBackend) = Bool
False
backendSupportsUnsplitProcPoints :: Backend -> Bool
backendSupportsUnsplitProcPoints :: Backend -> Bool
backendSupportsUnsplitProcPoints (Named BackendName
NCG) = Bool
True
backendSupportsUnsplitProcPoints (Named BackendName
LLVM) = Bool
False
backendSupportsUnsplitProcPoints (Named BackendName
ViaC) = Bool
False
backendSupportsUnsplitProcPoints (Named BackendName
JavaScript) = Bool
False
backendSupportsUnsplitProcPoints (Named BackendName
Interpreter) = Bool
False
backendSupportsUnsplitProcPoints (Named BackendName
NoBackend) = Bool
False
backendSwappableWithViaC :: Backend -> Bool
backendSwappableWithViaC :: Backend -> Bool
backendSwappableWithViaC (Named BackendName
NCG) = Bool
True
backendSwappableWithViaC (Named BackendName
LLVM) = Bool
True
backendSwappableWithViaC (Named BackendName
ViaC) = Bool
False
backendSwappableWithViaC (Named BackendName
JavaScript) = Bool
False
backendSwappableWithViaC (Named BackendName
Interpreter) = Bool
False
backendSwappableWithViaC (Named BackendName
NoBackend) = Bool
False
backendUnregisterisedAbiOnly :: Backend -> Bool
backendUnregisterisedAbiOnly :: Backend -> Bool
backendUnregisterisedAbiOnly (Named BackendName
NCG) = Bool
False
backendUnregisterisedAbiOnly (Named BackendName
LLVM) = Bool
False
backendUnregisterisedAbiOnly (Named BackendName
ViaC) = Bool
True
backendUnregisterisedAbiOnly (Named BackendName
JavaScript) = Bool
False
backendUnregisterisedAbiOnly (Named BackendName
Interpreter) = Bool
False
backendUnregisterisedAbiOnly (Named BackendName
NoBackend) = Bool
False
backendGeneratesHc :: Backend -> Bool
backendGeneratesHc :: Backend -> Bool
backendGeneratesHc (Named BackendName
NCG) = Bool
False
backendGeneratesHc (Named BackendName
LLVM) = Bool
False
backendGeneratesHc (Named BackendName
ViaC) = Bool
True
backendGeneratesHc (Named BackendName
JavaScript) = Bool
False
backendGeneratesHc (Named BackendName
Interpreter) = Bool
False
backendGeneratesHc (Named BackendName
NoBackend) = Bool
False
backendSptIsDynamic :: Backend -> Bool
backendSptIsDynamic :: Backend -> Bool
backendSptIsDynamic (Named BackendName
NCG) = Bool
False
backendSptIsDynamic (Named BackendName
LLVM) = Bool
False
backendSptIsDynamic (Named BackendName
ViaC) = Bool
False
backendSptIsDynamic (Named BackendName
JavaScript) = Bool
False
backendSptIsDynamic (Named BackendName
Interpreter) = Bool
True
backendSptIsDynamic (Named BackendName
NoBackend) = Bool
False
backendWantsBreakpointTicks :: Backend -> Bool
backendWantsBreakpointTicks :: Backend -> Bool
backendWantsBreakpointTicks (Named BackendName
NCG) = Bool
False
backendWantsBreakpointTicks (Named BackendName
LLVM) = Bool
False
backendWantsBreakpointTicks (Named BackendName
ViaC) = Bool
False
backendWantsBreakpointTicks (Named BackendName
JavaScript) = Bool
False
backendWantsBreakpointTicks (Named BackendName
Interpreter) = Bool
True
backendWantsBreakpointTicks (Named BackendName
NoBackend) = Bool
False
backendForcesOptimization0 :: Backend -> Bool
backendForcesOptimization0 :: Backend -> Bool
backendForcesOptimization0 (Named BackendName
NCG) = Bool
False
backendForcesOptimization0 (Named BackendName
LLVM) = Bool
False
backendForcesOptimization0 (Named BackendName
ViaC) = Bool
False
backendForcesOptimization0 (Named BackendName
JavaScript) = Bool
False
backendForcesOptimization0 (Named BackendName
Interpreter) = Bool
True
backendForcesOptimization0 (Named BackendName
NoBackend) = Bool
False
backendNeedsFullWays :: Backend -> Bool
backendNeedsFullWays :: Backend -> Bool
backendNeedsFullWays (Named BackendName
NCG) = Bool
False
backendNeedsFullWays (Named BackendName
LLVM) = Bool
False
backendNeedsFullWays (Named BackendName
ViaC) = Bool
False
backendNeedsFullWays (Named BackendName
JavaScript) = Bool
False
backendNeedsFullWays (Named BackendName
Interpreter) = Bool
True
backendNeedsFullWays (Named BackendName
NoBackend) = Bool
False
backendSpecialModuleSource :: Backend -> Bool -> Maybe String
backendSpecialModuleSource :: Backend -> Bool -> Maybe String
backendSpecialModuleSource (Named BackendName
NCG) = forall a b. a -> b -> a
const forall a. Maybe a
Nothing
backendSpecialModuleSource (Named BackendName
LLVM) = forall a b. a -> b -> a
const forall a. Maybe a
Nothing
backendSpecialModuleSource (Named BackendName
ViaC) = forall a b. a -> b -> a
const forall a. Maybe a
Nothing
backendSpecialModuleSource (Named BackendName
JavaScript) = forall a b. a -> b -> a
const forall a. Maybe a
Nothing
backendSpecialModuleSource (Named BackendName
Interpreter) = \Bool
b -> if Bool
b then forall a. a -> Maybe a
Just String
"interpreted" else forall a. Maybe a
Nothing
backendSpecialModuleSource (Named BackendName
NoBackend) = forall a b. a -> b -> a
const (forall a. a -> Maybe a
Just String
"nothing")
backendSupportsHpc :: Backend -> Bool
backendSupportsHpc :: Backend -> Bool
backendSupportsHpc (Named BackendName
NCG) = Bool
True
backendSupportsHpc (Named BackendName
LLVM) = Bool
True
backendSupportsHpc (Named BackendName
ViaC) = Bool
True
backendSupportsHpc (Named BackendName
JavaScript) = Bool
False
backendSupportsHpc (Named BackendName
Interpreter) = Bool
False
backendSupportsHpc (Named BackendName
NoBackend) = Bool
True
backendSupportsCImport :: Backend -> Bool
backendSupportsCImport :: Backend -> Bool
backendSupportsCImport (Named BackendName
NCG) = Bool
True
backendSupportsCImport (Named BackendName
LLVM) = Bool
True
backendSupportsCImport (Named BackendName
ViaC) = Bool
True
backendSupportsCImport (Named BackendName
JavaScript) = Bool
True
backendSupportsCImport (Named BackendName
Interpreter) = Bool
True
backendSupportsCImport (Named BackendName
NoBackend) = Bool
True
backendSupportsCExport :: Backend -> Bool
backendSupportsCExport :: Backend -> Bool
backendSupportsCExport (Named BackendName
NCG) = Bool
True
backendSupportsCExport (Named BackendName
LLVM) = Bool
True
backendSupportsCExport (Named BackendName
ViaC) = Bool
True
backendSupportsCExport (Named BackendName
JavaScript) = Bool
True
backendSupportsCExport (Named BackendName
Interpreter) = Bool
False
backendSupportsCExport (Named BackendName
NoBackend) = Bool
True
backendAssemblerProg :: Backend -> DefunctionalizedAssemblerProg
backendAssemblerProg :: Backend -> DefunctionalizedAssemblerProg
backendAssemblerProg (Named BackendName
NCG) = DefunctionalizedAssemblerProg
StandardAssemblerProg
backendAssemblerProg (Named BackendName
LLVM) = DefunctionalizedAssemblerProg
DarwinClangAssemblerProg
backendAssemblerProg (Named BackendName
ViaC) = DefunctionalizedAssemblerProg
StandardAssemblerProg
backendAssemblerProg (Named BackendName
JavaScript) = DefunctionalizedAssemblerProg
JSAssemblerProg
backendAssemblerProg (Named BackendName
Interpreter) = DefunctionalizedAssemblerProg
StandardAssemblerProg
backendAssemblerProg (Named BackendName
NoBackend) = DefunctionalizedAssemblerProg
StandardAssemblerProg
backendAssemblerInfoGetter :: Backend -> DefunctionalizedAssemblerInfoGetter
backendAssemblerInfoGetter :: Backend -> DefunctionalizedAssemblerInfoGetter
backendAssemblerInfoGetter (Named BackendName
NCG) = DefunctionalizedAssemblerInfoGetter
StandardAssemblerInfoGetter
backendAssemblerInfoGetter (Named BackendName
LLVM) = DefunctionalizedAssemblerInfoGetter
DarwinClangAssemblerInfoGetter
backendAssemblerInfoGetter (Named BackendName
ViaC) = DefunctionalizedAssemblerInfoGetter
StandardAssemblerInfoGetter
backendAssemblerInfoGetter (Named BackendName
JavaScript) = DefunctionalizedAssemblerInfoGetter
JSAssemblerInfoGetter
backendAssemblerInfoGetter (Named BackendName
Interpreter) = DefunctionalizedAssemblerInfoGetter
StandardAssemblerInfoGetter
backendAssemblerInfoGetter (Named BackendName
NoBackend) = DefunctionalizedAssemblerInfoGetter
StandardAssemblerInfoGetter
backendCDefs :: Backend -> DefunctionalizedCDefs
backendCDefs :: Backend -> DefunctionalizedCDefs
backendCDefs (Named BackendName
NCG) = DefunctionalizedCDefs
NoCDefs
backendCDefs (Named BackendName
LLVM) = DefunctionalizedCDefs
LlvmCDefs
backendCDefs (Named BackendName
ViaC) = DefunctionalizedCDefs
NoCDefs
backendCDefs (Named BackendName
JavaScript) = DefunctionalizedCDefs
NoCDefs
backendCDefs (Named BackendName
Interpreter) = DefunctionalizedCDefs
NoCDefs
backendCDefs (Named BackendName
NoBackend) = DefunctionalizedCDefs
NoCDefs
backendCodeOutput :: Backend -> DefunctionalizedCodeOutput
backendCodeOutput :: Backend -> DefunctionalizedCodeOutput
backendCodeOutput (Named BackendName
NCG) = DefunctionalizedCodeOutput
NcgCodeOutput
backendCodeOutput (Named BackendName
LLVM) = DefunctionalizedCodeOutput
LlvmCodeOutput
backendCodeOutput (Named BackendName
ViaC) = DefunctionalizedCodeOutput
ViaCCodeOutput
backendCodeOutput (Named BackendName
JavaScript) = DefunctionalizedCodeOutput
JSCodeOutput
backendCodeOutput (Named BackendName
Interpreter) = forall a. HasCallStack => String -> a
panic String
"backendCodeOutput: interpreterBackend"
backendCodeOutput (Named BackendName
NoBackend) = forall a. HasCallStack => String -> a
panic String
"backendCodeOutput: noBackend"
backendUseJSLinker :: Backend -> Bool
backendUseJSLinker :: Backend -> Bool
backendUseJSLinker (Named BackendName
NCG) = Bool
False
backendUseJSLinker (Named BackendName
LLVM) = Bool
False
backendUseJSLinker (Named BackendName
ViaC) = Bool
False
backendUseJSLinker (Named BackendName
JavaScript) = Bool
True
backendUseJSLinker (Named BackendName
Interpreter) = Bool
False
backendUseJSLinker (Named BackendName
NoBackend) = Bool
False
backendPostHscPipeline :: Backend -> DefunctionalizedPostHscPipeline
backendPostHscPipeline :: Backend -> DefunctionalizedPostHscPipeline
backendPostHscPipeline (Named BackendName
NCG) = DefunctionalizedPostHscPipeline
NcgPostHscPipeline
backendPostHscPipeline (Named BackendName
LLVM) = DefunctionalizedPostHscPipeline
LlvmPostHscPipeline
backendPostHscPipeline (Named BackendName
ViaC) = DefunctionalizedPostHscPipeline
ViaCPostHscPipeline
backendPostHscPipeline (Named BackendName
JavaScript) = DefunctionalizedPostHscPipeline
JSPostHscPipeline
backendPostHscPipeline (Named BackendName
Interpreter) = DefunctionalizedPostHscPipeline
NoPostHscPipeline
backendPostHscPipeline (Named BackendName
NoBackend) = DefunctionalizedPostHscPipeline
NoPostHscPipeline
backendNormalSuccessorPhase :: Backend -> Phase
backendNormalSuccessorPhase :: Backend -> Phase
backendNormalSuccessorPhase (Named BackendName
NCG) = Bool -> Phase
As Bool
False
backendNormalSuccessorPhase (Named BackendName
LLVM) = Phase
LlvmOpt
backendNormalSuccessorPhase (Named BackendName
ViaC) = Phase
HCc
backendNormalSuccessorPhase (Named BackendName
JavaScript) = Phase
StopLn
backendNormalSuccessorPhase (Named BackendName
Interpreter) = Phase
StopLn
backendNormalSuccessorPhase (Named BackendName
NoBackend) = Phase
StopLn
backendName :: Backend -> BackendName
backendName :: Backend -> BackendName
backendName (Named BackendName
NCG) = BackendName
NCG
backendName (Named BackendName
LLVM) = BackendName
LLVM
backendName (Named BackendName
ViaC) = BackendName
ViaC
backendName (Named BackendName
JavaScript) = BackendName
JavaScript
backendName (Named BackendName
Interpreter) = BackendName
Interpreter
backendName (Named BackendName
NoBackend) = BackendName
NoBackend
allBackends :: [Backend]
allBackends :: [Backend]
allBackends = [ Backend
ncgBackend
, Backend
llvmBackend
, Backend
viaCBackend
, Backend
jsBackend
, Backend
interpreterBackend
, Backend
noBackend
]
backendValidityOfCImport, backendValidityOfCExport :: Backend -> Validity' [Backend]
backendValidityOfCImport :: Backend -> Validity' [Backend]
backendValidityOfCImport Backend
backend =
if Backend -> Bool
backendSupportsCImport Backend
backend then
forall a. Validity' a
IsValid
else
forall a. a -> Validity' a
NotValid forall a b. (a -> b) -> a -> b
$ forall a. (a -> Bool) -> [a] -> [a]
filter Backend -> Bool
backendSupportsCImport [Backend]
allBackends
backendValidityOfCExport :: Backend -> Validity' [Backend]
backendValidityOfCExport Backend
backend =
if Backend -> Bool
backendSupportsCExport Backend
backend then
forall a. Validity' a
IsValid
else
forall a. a -> Validity' a
NotValid forall a b. (a -> b) -> a -> b
$ forall a. (a -> Bool) -> [a] -> [a]
filter Backend -> Bool
backendSupportsCExport [Backend]
allBackends