module GHC.Driver.LlvmConfigCache
( LlvmConfigCache
, initLlvmConfigCache
, readLlvmConfigCache
)
where
import GHC.Prelude
import GHC.CmmToLlvm.Config
import System.IO.Unsafe
data LlvmConfigCache = LlvmConfigCache LlvmConfig
initLlvmConfigCache :: FilePath -> IO LlvmConfigCache
initLlvmConfigCache :: FilePath -> IO LlvmConfigCache
initLlvmConfigCache FilePath
top_dir = LlvmConfigCache -> IO LlvmConfigCache
forall a. a -> IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (LlvmConfigCache -> IO LlvmConfigCache)
-> LlvmConfigCache -> IO LlvmConfigCache
forall a b. (a -> b) -> a -> b
$ LlvmConfig -> LlvmConfigCache
LlvmConfigCache (IO LlvmConfig -> LlvmConfig
forall a. IO a -> a
unsafePerformIO (IO LlvmConfig -> LlvmConfig) -> IO LlvmConfig -> LlvmConfig
forall a b. (a -> b) -> a -> b
$ FilePath -> IO LlvmConfig
initLlvmConfig FilePath
top_dir)
readLlvmConfigCache :: LlvmConfigCache -> IO LlvmConfig
readLlvmConfigCache :: LlvmConfigCache -> IO LlvmConfig
readLlvmConfigCache (LlvmConfigCache !LlvmConfig
config) = LlvmConfig -> IO LlvmConfig
forall a. a -> IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure LlvmConfig
config