Commit e7ed53c9 authored by John Ericson's avatar John Ericson Committed by Marge Bot

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.
parent f508b7ce
...@@ -109,7 +109,6 @@ compiler/stage1/$(PLATFORM_H) : mk/config.mk mk/project.mk | $$(dir $$@)/. ...@@ -109,7 +109,6 @@ compiler/stage1/$(PLATFORM_H) : mk/config.mk mk/project.mk | $$(dir $$@)/.
@echo "#define BUILD_ARCH \"$(BuildArch_CPP)\"" >> $@ @echo "#define BUILD_ARCH \"$(BuildArch_CPP)\"" >> $@
@echo "#define HOST_ARCH \"$(HostArch_CPP)\"" >> $@ @echo "#define HOST_ARCH \"$(HostArch_CPP)\"" >> $@
@echo "#define TARGET_ARCH \"$(TargetArch_CPP)\"" >> $@ @echo "#define TARGET_ARCH \"$(TargetArch_CPP)\"" >> $@
@echo "#define LLVM_TARGET \"$(LLVMTarget_CPP)\"" >> $@
@echo >> $@ @echo >> $@
@echo "#define $(BuildOS_CPP)_BUILD_OS 1" >> $@ @echo "#define $(BuildOS_CPP)_BUILD_OS 1" >> $@
@echo "#define $(HostOS_CPP)_HOST_OS 1" >> $@ @echo "#define $(HostOS_CPP)_HOST_OS 1" >> $@
...@@ -150,7 +149,6 @@ compiler/stage2/$(PLATFORM_H) : mk/config.mk mk/project.mk | $$(dir $$@)/. ...@@ -150,7 +149,6 @@ compiler/stage2/$(PLATFORM_H) : mk/config.mk mk/project.mk | $$(dir $$@)/.
@echo "#define BUILD_ARCH \"$(HostArch_CPP)\"" >> $@ @echo "#define BUILD_ARCH \"$(HostArch_CPP)\"" >> $@
@echo "#define HOST_ARCH \"$(TargetArch_CPP)\"" >> $@ @echo "#define HOST_ARCH \"$(TargetArch_CPP)\"" >> $@
@echo "#define TARGET_ARCH \"$(TargetArch_CPP)\"" >> $@ @echo "#define TARGET_ARCH \"$(TargetArch_CPP)\"" >> $@
@echo "#define LLVM_TARGET \"$(LLVMTarget_CPP)\"" >> $@
@echo >> $@ @echo >> $@
@echo "#define $(HostOS_CPP)_BUILD_OS 1" >> $@ @echo "#define $(HostOS_CPP)_BUILD_OS 1" >> $@
@echo "#define $(TargetOS_CPP)_HOST_OS 1" >> $@ @echo "#define $(TargetOS_CPP)_HOST_OS 1" >> $@
......
...@@ -90,7 +90,7 @@ llvmCodeGen' cmm_stream ...@@ -90,7 +90,7 @@ llvmCodeGen' cmm_stream
where where
header :: SDoc header :: SDoc
header = sdocWithDynFlags $ \dflags -> header = sdocWithDynFlags $ \dflags ->
let target = LLVM_TARGET let target = platformMisc_llvmTarget $ platformMisc dflags
layout = case lookup target (llvmTargets dflags) of layout = case lookup target (llvmTargets dflags) of
Just (LlvmTarget dl _ _) -> dl Just (LlvmTarget dl _ _) -> dl
Nothing -> error $ "Failed to lookup the datalayout for " ++ target ++ "; available targets: " ++ show (map fst $ llvmTargets dflags) Nothing -> error $ "Failed to lookup the datalayout for " ++ target ++ "; available targets: " ++ show (map fst $ llvmTargets dflags)
......
...@@ -867,7 +867,7 @@ llvmOptions dflags = ...@@ -867,7 +867,7 @@ llvmOptions dflags =
, not (any (isInfixOf "-mcpu") (getOpts dflags opt_lc)) ] , not (any (isInfixOf "-mcpu") (getOpts dflags opt_lc)) ]
++ [("", "-mattr=" ++ attrs) | not (null attrs) ] ++ [("", "-mattr=" ++ attrs) | not (null attrs) ]
where target = LLVM_TARGET where target = platformMisc_llvmTarget $ platformMisc dflags
Just (LlvmTarget _ mcpu mattr) = lookup target (llvmTargets dflags) Just (LlvmTarget _ mcpu mattr) = lookup target (llvmTargets dflags)
-- Relocation models -- Relocation models
......
...@@ -236,6 +236,8 @@ initSysTools top_dir ...@@ -236,6 +236,8 @@ initSysTools top_dir
ld_prog = cc_prog ld_prog = cc_prog
ld_args = map Option (cc_args ++ words cc_link_args_str) ld_args = map Option (cc_args ++ words cc_link_args_str)
llvmTarget <- getSetting "LLVM target"
-- We just assume on command line -- We just assume on command line
lc_prog <- getSetting "LLVM llc command" lc_prog <- getSetting "LLVM llc command"
lo_prog <- getSetting "LLVM opt command" lo_prog <- getSetting "LLVM opt command"
...@@ -336,6 +338,7 @@ initSysTools top_dir ...@@ -336,6 +338,7 @@ initSysTools top_dir
, platformMisc_ghcThreaded = ghcThreaded , platformMisc_ghcThreaded = ghcThreaded
, platformMisc_ghcDebugged = ghcDebugged , platformMisc_ghcDebugged = ghcDebugged
, platformMisc_ghcRtsWithLibdw = ghcRtsWithLibdw , platformMisc_ghcRtsWithLibdw = ghcRtsWithLibdw
, platformMisc_llvmTarget = llvmTarget
} }
, sPlatformConstants = platformConstants , sPlatformConstants = platformConstants
......
...@@ -307,6 +307,7 @@ generateSettings = do ...@@ -307,6 +307,7 @@ generateSettings = do
, ("target has subsections via symbols", expr $ lookupValueOrError configFile "haskell-have-subsections-via-symbols") , ("target has subsections via symbols", expr $ lookupValueOrError configFile "haskell-have-subsections-via-symbols")
, ("target has RTS linker", expr $ lookupValueOrError configFile "haskell-have-rts-linker") , ("target has RTS linker", expr $ lookupValueOrError configFile "haskell-have-rts-linker")
, ("Unregisterised", expr $ yesNo <$> flag GhcUnregisterised) , ("Unregisterised", expr $ yesNo <$> flag GhcUnregisterised)
, ("LLVM target", getSetting LlvmTarget)
, ("LLVM llc command", expr $ settingsFileSetting SettingsFileSetting_LlcCommand) , ("LLVM llc command", expr $ settingsFileSetting SettingsFileSetting_LlcCommand)
, ("LLVM opt command", expr $ settingsFileSetting SettingsFileSetting_OptCommand) , ("LLVM opt command", expr $ settingsFileSetting SettingsFileSetting_OptCommand)
, ("LLVM clang command", expr $ settingsFileSetting SettingsFileSetting_ClangCommand) , ("LLVM clang command", expr $ settingsFileSetting SettingsFileSetting_ClangCommand)
...@@ -413,7 +414,6 @@ generateGhcBootPlatformH = do ...@@ -413,7 +414,6 @@ generateGhcBootPlatformH = do
hostVendor <- chooseSetting HostVendor TargetVendor hostVendor <- chooseSetting HostVendor TargetVendor
targetPlatform <- getSetting TargetPlatform targetPlatform <- getSetting TargetPlatform
targetArch <- getSetting TargetArch targetArch <- getSetting TargetArch
llvmTarget <- getSetting LlvmTarget
targetOs <- getSetting TargetOs targetOs <- getSetting TargetOs
targetVendor <- getSetting TargetVendor targetVendor <- getSetting TargetVendor
return $ unlines return $ unlines
...@@ -433,7 +433,6 @@ generateGhcBootPlatformH = do ...@@ -433,7 +433,6 @@ generateGhcBootPlatformH = do
, "#define BUILD_ARCH " ++ show buildArch , "#define BUILD_ARCH " ++ show buildArch
, "#define HOST_ARCH " ++ show hostArch , "#define HOST_ARCH " ++ show hostArch
, "#define TARGET_ARCH " ++ show targetArch , "#define TARGET_ARCH " ++ show targetArch
, "#define LLVM_TARGET " ++ show llvmTarget
, "" , ""
, "#define " ++ buildOs ++ "_BUILD_OS 1" , "#define " ++ buildOs ++ "_BUILD_OS 1"
, "#define " ++ hostOs ++ "_HOST_OS 1" , "#define " ++ hostOs ++ "_HOST_OS 1"
......
...@@ -209,6 +209,7 @@ $(includes_SETTINGS) : includes/Makefile | $$(dir $$@)/. ...@@ -209,6 +209,7 @@ $(includes_SETTINGS) : includes/Makefile | $$(dir $$@)/.
@echo ',("target has subsections via symbols", "$(HaskellHaveSubsectionsViaSymbols)")' >> $@ @echo ',("target has subsections via symbols", "$(HaskellHaveSubsectionsViaSymbols)")' >> $@
@echo ',("target has RTS linker", "$(HaskellHaveRTSLinker)")' >> $@ @echo ',("target has RTS linker", "$(HaskellHaveRTSLinker)")' >> $@
@echo ',("Unregisterised", "$(Unregisterised)")' >> $@ @echo ',("Unregisterised", "$(Unregisterised)")' >> $@
@echo ',("LLVM target", "$(LLVMTarget_CPP)")' >> $@
@echo ',("LLVM llc command", "$(SettingsLlcCommand)")' >> $@ @echo ',("LLVM llc command", "$(SettingsLlcCommand)")' >> $@
@echo ',("LLVM opt command", "$(SettingsOptCommand)")' >> $@ @echo ',("LLVM opt command", "$(SettingsOptCommand)")' >> $@
@echo ',("LLVM clang command", "$(SettingsClangCommand)")' >> $@ @echo ',("LLVM clang command", "$(SettingsClangCommand)")' >> $@
......
...@@ -243,6 +243,7 @@ data PlatformMisc = PlatformMisc ...@@ -243,6 +243,7 @@ data PlatformMisc = PlatformMisc
, platformMisc_ghcThreaded :: Bool , platformMisc_ghcThreaded :: Bool
, platformMisc_ghcDebugged :: Bool , platformMisc_ghcDebugged :: Bool
, platformMisc_ghcRtsWithLibdw :: Bool , platformMisc_ghcRtsWithLibdw :: Bool
, platformMisc_llvmTarget :: String
} }
data IntegerLibrary data IntegerLibrary
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment