summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Ericson <git@JohnEricson.me>2019-04-07 22:33:21 -0400
committerMarge Bot <ben+marge-bot@smart-cactus.org>2019-07-14 01:21:11 -0400
commite7ed53c9c347bbf6650f268b516da6e6c156a91a (patch)
tree16d6f1ed782965a11ff98bbda8aa0674fe8521c7
parentf508b7ce56f1e7dc2666de3139f58c02a0567461 (diff)
downloadhaskell-e7ed53c9c347bbf6650f268b516da6e6c156a91a.tar.gz
Remove LLVM_TARGET platform macros
Instead following @angerman's suggestion put them in the config file. Maybe we could re-key llvm-targets someday, but this is good for now.
-rw-r--r--compiler/ghc.mk2
-rw-r--r--compiler/llvmGen/LlvmCodeGen.hs2
-rw-r--r--compiler/main/DriverPipeline.hs2
-rw-r--r--compiler/main/SysTools.hs3
-rw-r--r--hadrian/src/Rules/Generate.hs3
-rw-r--r--includes/ghc.mk1
-rw-r--r--libraries/ghc-boot/GHC/Platform.hs1
7 files changed, 8 insertions, 6 deletions
diff --git a/compiler/ghc.mk b/compiler/ghc.mk
index 4e0fb9095b..f80d7b75df 100644
--- a/compiler/ghc.mk
+++ b/compiler/ghc.mk
@@ -109,7 +109,6 @@ compiler/stage1/$(PLATFORM_H) : mk/config.mk mk/project.mk | $$(dir $$@)/.
@echo "#define BUILD_ARCH \"$(BuildArch_CPP)\"" >> $@
@echo "#define HOST_ARCH \"$(HostArch_CPP)\"" >> $@
@echo "#define TARGET_ARCH \"$(TargetArch_CPP)\"" >> $@
- @echo "#define LLVM_TARGET \"$(LLVMTarget_CPP)\"" >> $@
@echo >> $@
@echo "#define $(BuildOS_CPP)_BUILD_OS 1" >> $@
@echo "#define $(HostOS_CPP)_HOST_OS 1" >> $@
@@ -150,7 +149,6 @@ compiler/stage2/$(PLATFORM_H) : mk/config.mk mk/project.mk | $$(dir $$@)/.
@echo "#define BUILD_ARCH \"$(HostArch_CPP)\"" >> $@
@echo "#define HOST_ARCH \"$(TargetArch_CPP)\"" >> $@
@echo "#define TARGET_ARCH \"$(TargetArch_CPP)\"" >> $@
- @echo "#define LLVM_TARGET \"$(LLVMTarget_CPP)\"" >> $@
@echo >> $@
@echo "#define $(HostOS_CPP)_BUILD_OS 1" >> $@
@echo "#define $(TargetOS_CPP)_HOST_OS 1" >> $@
diff --git a/compiler/llvmGen/LlvmCodeGen.hs b/compiler/llvmGen/LlvmCodeGen.hs
index 88901be4d6..da733f4bb4 100644
--- a/compiler/llvmGen/LlvmCodeGen.hs
+++ b/compiler/llvmGen/LlvmCodeGen.hs
@@ -90,7 +90,7 @@ llvmCodeGen' cmm_stream
where
header :: SDoc
header = sdocWithDynFlags $ \dflags ->
- let target = LLVM_TARGET
+ let target = platformMisc_llvmTarget $ platformMisc dflags
layout = case lookup target (llvmTargets dflags) of
Just (LlvmTarget dl _ _) -> dl
Nothing -> error $ "Failed to lookup the datalayout for " ++ target ++ "; available targets: " ++ show (map fst $ llvmTargets dflags)
diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs
index 17c8f480d9..c33fca6003 100644
--- a/compiler/main/DriverPipeline.hs
+++ b/compiler/main/DriverPipeline.hs
@@ -867,7 +867,7 @@ llvmOptions dflags =
, not (any (isInfixOf "-mcpu") (getOpts dflags opt_lc)) ]
++ [("", "-mattr=" ++ attrs) | not (null attrs) ]
- where target = LLVM_TARGET
+ where target = platformMisc_llvmTarget $ platformMisc dflags
Just (LlvmTarget _ mcpu mattr) = lookup target (llvmTargets dflags)
-- Relocation models
diff --git a/compiler/main/SysTools.hs b/compiler/main/SysTools.hs
index 518d9fdb2f..bfaa6562cc 100644
--- a/compiler/main/SysTools.hs
+++ b/compiler/main/SysTools.hs
@@ -236,6 +236,8 @@ initSysTools top_dir
ld_prog = cc_prog
ld_args = map Option (cc_args ++ words cc_link_args_str)
+ llvmTarget <- getSetting "LLVM target"
+
-- We just assume on command line
lc_prog <- getSetting "LLVM llc command"
lo_prog <- getSetting "LLVM opt command"
@@ -336,6 +338,7 @@ initSysTools top_dir
, platformMisc_ghcThreaded = ghcThreaded
, platformMisc_ghcDebugged = ghcDebugged
, platformMisc_ghcRtsWithLibdw = ghcRtsWithLibdw
+ , platformMisc_llvmTarget = llvmTarget
}
, sPlatformConstants = platformConstants
diff --git a/hadrian/src/Rules/Generate.hs b/hadrian/src/Rules/Generate.hs
index 1949c3bfe2..8593810546 100644
--- a/hadrian/src/Rules/Generate.hs
+++ b/hadrian/src/Rules/Generate.hs
@@ -307,6 +307,7 @@ generateSettings = do
, ("target has subsections via symbols", expr $ lookupValueOrError configFile "haskell-have-subsections-via-symbols")
, ("target has RTS linker", expr $ lookupValueOrError configFile "haskell-have-rts-linker")
, ("Unregisterised", expr $ yesNo <$> flag GhcUnregisterised)
+ , ("LLVM target", getSetting LlvmTarget)
, ("LLVM llc command", expr $ settingsFileSetting SettingsFileSetting_LlcCommand)
, ("LLVM opt command", expr $ settingsFileSetting SettingsFileSetting_OptCommand)
, ("LLVM clang command", expr $ settingsFileSetting SettingsFileSetting_ClangCommand)
@@ -413,7 +414,6 @@ generateGhcBootPlatformH = do
hostVendor <- chooseSetting HostVendor TargetVendor
targetPlatform <- getSetting TargetPlatform
targetArch <- getSetting TargetArch
- llvmTarget <- getSetting LlvmTarget
targetOs <- getSetting TargetOs
targetVendor <- getSetting TargetVendor
return $ unlines
@@ -433,7 +433,6 @@ 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"
diff --git a/includes/ghc.mk b/includes/ghc.mk
index f5773f66c4..ccbd8abbc5 100644
--- a/includes/ghc.mk
+++ b/includes/ghc.mk
@@ -209,6 +209,7 @@ $(includes_SETTINGS) : includes/Makefile | $$(dir $$@)/.
@echo ',("target has subsections via symbols", "$(HaskellHaveSubsectionsViaSymbols)")' >> $@
@echo ',("target has RTS linker", "$(HaskellHaveRTSLinker)")' >> $@
@echo ',("Unregisterised", "$(Unregisterised)")' >> $@
+ @echo ',("LLVM target", "$(LLVMTarget_CPP)")' >> $@
@echo ',("LLVM llc command", "$(SettingsLlcCommand)")' >> $@
@echo ',("LLVM opt command", "$(SettingsOptCommand)")' >> $@
@echo ',("LLVM clang command", "$(SettingsClangCommand)")' >> $@
diff --git a/libraries/ghc-boot/GHC/Platform.hs b/libraries/ghc-boot/GHC/Platform.hs
index 1c4e4eec8b..01d709a199 100644
--- a/libraries/ghc-boot/GHC/Platform.hs
+++ b/libraries/ghc-boot/GHC/Platform.hs
@@ -243,6 +243,7 @@ data PlatformMisc = PlatformMisc
, platformMisc_ghcThreaded :: Bool
, platformMisc_ghcDebugged :: Bool
, platformMisc_ghcRtsWithLibdw :: Bool
+ , platformMisc_llvmTarget :: String
}
data IntegerLibrary