2
module LLVM.Target.Native(initializeNativeTarget) where
4
import Control.Concurrent.MVar
5
import System.IO.Unsafe
7
-- TARGET is expanded by CPP to the native target architecture.
8
import LLVM.Target.TARGET
10
-- | Initialize jitter to the native target.
11
-- The operation is idempotent.
12
initializeNativeTarget :: IO ()
13
initializeNativeTarget = do
14
done <- takeMVar refDone
15
when (not done) initializeTarget
18
-- UNSAFE: global variable to keep track of initialization state.
20
refDone = unsafePerformIO $ newMVar False