{-# LANGUAGE QuasiQuotes #-}
module Futhark.CodeGen.Backends.MulticoreC.Boilerplate (generateBoilerplate) where
import Data.Text qualified as T
import Futhark.CodeGen.Backends.GenericC qualified as GC
import Futhark.CodeGen.RTS.C (backendsMulticoreH, schedulerH)
import Language.C.Quote.OpenCL qualified as C
generateBoilerplate :: GC.CompilerM op s ()
generateBoilerplate :: forall op s. CompilerM op s ()
generateBoilerplate = do
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ forall op s. Definition -> CompilerM op s ()
GC.earlyDecl [C.cunit|$esc:(T.unpack schedulerH)|]
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ forall op s. Definition -> CompilerM op s ()
GC.earlyDecl [C.cunit|$esc:(T.unpack backendsMulticoreH)|]
forall op s. HeaderSection -> Definition -> CompilerM op s ()
GC.headerDecl HeaderSection
GC.InitDecl [C.cedecl|void futhark_context_config_set_num_threads(struct futhark_context_config *cfg, int n);|]
forall op s. CompilerM op s ()
GC.generateProgramStruct
{-# NOINLINE generateBoilerplate #-}