[commit: ghc] wip/nfs-locking: Add support for llvm-targets (6d14f09)

git at git.haskell.org git at git.haskell.org
Fri Oct 27 01:26:59 UTC 2017


Repository : ssh://git@git.haskell.org/ghc

On branch  : wip/nfs-locking
Link       : http://ghc.haskell.org/trac/ghc/changeset/6d14f09c81f490704d2798693236f0db68e6e438/ghc

>---------------------------------------------------------------

commit 6d14f09c81f490704d2798693236f0db68e6e438
Author: Andrey Mokhov <andrey.mokhov at gmail.com>
Date:   Sat Sep 9 11:39:57 2017 +0100

    Add support for llvm-targets
    
    See #412


>---------------------------------------------------------------

6d14f09c81f490704d2798693236f0db68e6e438
 cfg/system.config.in   | 1 +
 src/Base.hs            | 1 +
 src/Oracles/Setting.hs | 2 ++
 src/Rules/Generate.hs  | 5 ++++-
 4 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/cfg/system.config.in b/cfg/system.config.in
index 34ef7b9..0b05259 100644
--- a/cfg/system.config.in
+++ b/cfg/system.config.in
@@ -63,6 +63,7 @@ target-platform-full  = @TargetPlatformFull@
 target-arch           = @TargetArch_CPP@
 target-os             = @TargetOS_CPP@
 target-vendor         = @TargetVendor_CPP@
+llvm-target           = @LLVMTarget_CPP@
 
 cross-compiling       = @CrossCompiling@
 
diff --git a/src/Base.hs b/src/Base.hs
index 942b272..76e8f2b 100644
--- a/src/Base.hs
+++ b/src/Base.hs
@@ -106,6 +106,7 @@ inplaceLibCopyTargets :: [FilePath]
 inplaceLibCopyTargets = map (inplaceLibPath -/-)
     [ "ghc-usage.txt"
     , "ghci-usage.txt"
+    , "llvm-targets"
     , "platformConstants"
     , "settings"
     , "template-hsc.h" ]
diff --git a/src/Oracles/Setting.hs b/src/Oracles/Setting.hs
index 8af8f38..5f148d4 100644
--- a/src/Oracles/Setting.hs
+++ b/src/Oracles/Setting.hs
@@ -46,6 +46,7 @@ data Setting = BuildArch
              | TargetPlatform
              | TargetPlatformFull
              | TargetVendor
+             | LlvmTarget
              | FfiIncludeDir
              | FfiLibDir
              | GmpIncludeDir
@@ -104,6 +105,7 @@ setting key = lookupValueOrError configFile $ case key of
     TargetPlatform     -> "target-platform"
     TargetPlatformFull -> "target-platform-full"
     TargetVendor       -> "target-vendor"
+    LlvmTarget         -> "llvm-target"
     FfiIncludeDir      -> "ffi-include-dir"
     FfiLibDir          -> "ffi-lib-dir"
     GmpIncludeDir      -> "gmp-include-dir"
diff --git a/src/Rules/Generate.hs b/src/Rules/Generate.hs
index b23b72d..413abe5 100644
--- a/src/Rules/Generate.hs
+++ b/src/Rules/Generate.hs
@@ -11,9 +11,9 @@ import Oracles.ModuleFiles
 import Oracles.Setting
 import Rules.Gmp
 import Rules.Libffi
+import Target
 import Settings
 import Settings.Packages.Rts
-import Target
 import Utilities
 
 -- | Track this file to rebuild generated files whenever it changes.
@@ -145,6 +145,7 @@ copyRules :: Rules ()
 copyRules = do
     (inplaceLibPath -/- "ghc-usage.txt")     <~ return "driver"
     (inplaceLibPath -/- "ghci-usage.txt"  )  <~ return "driver"
+    (inplaceLibPath -/- "llvm-targets")      <~ return "."
     (inplaceLibPath -/- "platformConstants") <~ (buildRoot <&> (-/- generatedDir))
     (inplaceLibPath -/- "settings")          <~ return "."
     (inplaceLibPath -/- "template-hsc.h")    <~ return (pkgPath hsc2hs)
@@ -394,6 +395,7 @@ generateGhcBootPlatformH = do
     hostVendor     <- chooseSetting HostVendor    TargetVendor
     targetPlatform <- getSetting TargetPlatform
     targetArch     <- getSetting TargetArch
+    llvmTarget     <- getSetting LlvmTarget
     targetOs       <- getSetting TargetOs
     targetVendor   <- getSetting TargetVendor
     return $ unlines
@@ -414,6 +416,7 @@ generateGhcBootPlatformH = do
         , "#define BUILD_ARCH "  ++ show buildArch
         , "#define HOST_ARCH "   ++ show hostArch
         , "#define TARGET_ARCH " ++ show targetArch
+        , "#define LLVM_TARGET " ++ show llvmTarget
         , ""
         , "#define " ++ buildOs  ++ "_BUILD_OS 1"
         , "#define " ++ hostOs   ++ "_HOST_OS 1"



More information about the ghc-commits mailing list