diff options
author | Geoffrey Mainland <gmainlan@microsoft.com> | 2012-06-20 11:36:27 +0100 |
---|---|---|
committer | Geoffrey Mainland <gmainlan@microsoft.com> | 2013-02-01 22:00:23 +0000 |
commit | d60df8246c208ba37da20a97c974d9318d8ec02b (patch) | |
tree | 46cf1b543f6fc73f45e7344be4deeaa130b4859f /compiler | |
parent | 1ee495b61fffcfa70495a539635c325a0ab5ddf7 (diff) | |
download | haskell-d60df8246c208ba37da20a97c974d9318d8ec02b.tar.gz |
Define __GLASGOW_HASKELL_LLVM__ when using the LLVM back end.
When compiling via LLVM, GHC now defines the CPP symbol __GLASGOW_HASKELL_LLVM__
to the version of LLVM used, e.g., __GLASGOW_HASKELL_LLVM__ is defined to be 30
for LLVM version 3.0.
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/main/DriverPipeline.hs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs index 367e109880..62ff424bb6 100644 --- a/compiler/main/DriverPipeline.hs +++ b/compiler/main/DriverPipeline.hs @@ -2013,10 +2013,13 @@ doCpp dflags raw include_cc_opts input_fn output_fn = do [ "-D__SSE2__=1" | sse2 || sse4_2 ] ++ [ "-D__SSE4_2__=1" | sse4_2 ] + backend_defs <- getBackendDefs dflags + cpp_prog ( map SysTools.Option verbFlags ++ map SysTools.Option include_paths ++ map SysTools.Option hsSourceCppOpts ++ map SysTools.Option target_defs + ++ map SysTools.Option backend_defs ++ map SysTools.Option hscpp_opts ++ map SysTools.Option cc_opts ++ map SysTools.Option sse_defs @@ -2035,6 +2038,14 @@ doCpp dflags raw include_cc_opts input_fn output_fn = do , SysTools.FileOption "" output_fn ]) +getBackendDefs :: DynFlags -> IO [String] +getBackendDefs dflags | hscTarget dflags == HscLlvm = do + llvmVer <- figureLlvmVersion dflags + return [ "-D__GLASGOW_HASKELL_LLVM__="++show llvmVer ] + +getBackendDefs _ = + return [] + hsSourceCppOpts :: [String] -- Default CPP defines in Haskell source hsSourceCppOpts = |