summaryrefslogtreecommitdiff
path: root/compiler
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 /compiler
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.
Diffstat (limited to 'compiler')
-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
4 files changed, 5 insertions, 4 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