diff options
author | Zubin Duggal <zubin.duggal@gmail.com> | 2021-06-17 16:25:46 +0530 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-06-20 07:13:07 -0400 |
commit | 6c783817ef089e85642c3383937117cff9d15f67 (patch) | |
tree | 90266d7337b67a7703c88db0a9a668c19f02ff2f | |
parent | 4a65c0f88060785a8bcb25bb13bc53c20948633b (diff) | |
download | haskell-6c783817ef089e85642c3383937117cff9d15f67.tar.gz |
Set min LLVM version to 9 and make version checking use a non-inclusive upper
bound.
We use a non-inclusive upper bound so that setting the upper bound to 13 for
example means that all 12.x versions are accepted.
-rw-r--r-- | compiler/GHC/CmmToLlvm.hs | 6 | ||||
-rw-r--r-- | compiler/GHC/CmmToLlvm/Base.hs | 16 | ||||
-rw-r--r-- | compiler/GHC/SysTools/Tasks.hs | 9 | ||||
-rw-r--r-- | configure.ac | 4 | ||||
-rw-r--r-- | m4/find_llvm_prog.m4 | 2 |
5 files changed, 20 insertions, 17 deletions
diff --git a/compiler/GHC/CmmToLlvm.hs b/compiler/GHC/CmmToLlvm.hs index f82dbf258a..11079c2cf2 100644 --- a/compiler/GHC/CmmToLlvm.hs +++ b/compiler/GHC/CmmToLlvm.hs @@ -64,8 +64,8 @@ llvmCodeGen logger dflags h cmm_stream let doWarn = wopt Opt_WarnUnsupportedLlvmVersion dflags when (not (llvmVersionSupported ver) && doWarn) $ putMsg logger $ "You are using an unsupported version of LLVM!" $$ - "Currently only" <+> text (llvmVersionStr supportedLlvmVersionMin) <+> - "to" <+> text (llvmVersionStr supportedLlvmVersionMax) <+> "is supported." <+> + "Currently only" <+> text (llvmVersionStr supportedLlvmVersionLowerBound) <+> + "to" <+> text (llvmVersionStr supportedLlvmVersionUpperBound) <+> "is supported." <+> "System LLVM version: " <> text (llvmVersionStr ver) $$ "We will try though..." let isS390X = platformArch (targetPlatform dflags) == ArchS390X @@ -78,7 +78,7 @@ llvmCodeGen logger dflags h cmm_stream -- currently don't use the LLVM version to guide code generation -- so this is okay. let llvm_ver :: LlvmVersion - llvm_ver = fromMaybe supportedLlvmVersionMin mb_ver + llvm_ver = fromMaybe supportedLlvmVersionLowerBound mb_ver -- run code generation a <- runLlvm logger dflags llvm_ver bufh $ diff --git a/compiler/GHC/CmmToLlvm/Base.hs b/compiler/GHC/CmmToLlvm/Base.hs index 60779be4ab..2095e3d606 100644 --- a/compiler/GHC/CmmToLlvm/Base.hs +++ b/compiler/GHC/CmmToLlvm/Base.hs @@ -15,7 +15,7 @@ module GHC.CmmToLlvm.Base ( LiveGlobalRegs, LlvmUnresData, LlvmData, UnresLabel, UnresStatic, - LlvmVersion, supportedLlvmVersionMin, supportedLlvmVersionMax, + LlvmVersion, supportedLlvmVersionLowerBound, supportedLlvmVersionUpperBound, llvmVersionSupported, parseLlvmVersion, llvmVersionStr, llvmVersionList, @@ -263,7 +263,6 @@ llvmPtrBits platform = widthInBits $ typeWidth $ gcWord platform -- * Llvm Version -- --- Newtype to avoid using the Eq instance! newtype LlvmVersion = LlvmVersion { llvmVersionNE :: NE.NonEmpty Int } deriving (Eq, Ord) @@ -281,14 +280,17 @@ parseLlvmVersion = where (ver_str, rest) = span isDigit s --- | The LLVM Version that is currently supported. -supportedLlvmVersionMin, supportedLlvmVersionMax :: LlvmVersion -supportedLlvmVersionMin = LlvmVersion (sUPPORTED_LLVM_VERSION_MIN NE.:| []) -supportedLlvmVersionMax = LlvmVersion (sUPPORTED_LLVM_VERSION_MAX NE.:| []) +-- | The (inclusive) lower bound on the LLVM Version that is currently supported. +supportedLlvmVersionLowerBound :: LlvmVersion +supportedLlvmVersionLowerBound = LlvmVersion (sUPPORTED_LLVM_VERSION_MIN NE.:| []) + +-- | The (not-inclusive) upper bound bound on the LLVM Version that is currently supported. +supportedLlvmVersionUpperBound :: LlvmVersion +supportedLlvmVersionUpperBound = LlvmVersion (sUPPORTED_LLVM_VERSION_MAX NE.:| []) llvmVersionSupported :: LlvmVersion -> Bool llvmVersionSupported v = - v > supportedLlvmVersionMin && v <= supportedLlvmVersionMax + v >= supportedLlvmVersionLowerBound && v < supportedLlvmVersionUpperBound llvmVersionStr :: LlvmVersion -> String llvmVersionStr = intercalate "." . map show . llvmVersionList diff --git a/compiler/GHC/SysTools/Tasks.hs b/compiler/GHC/SysTools/Tasks.hs index 6fec3a8839..7c1ea332cf 100644 --- a/compiler/GHC/SysTools/Tasks.hs +++ b/compiler/GHC/SysTools/Tasks.hs @@ -14,7 +14,7 @@ import GHC.Platform import GHC.ForeignSrcLang import GHC.IO (catchException) -import GHC.CmmToLlvm.Base (LlvmVersion, llvmVersionStr, supportedLlvmVersionMin, supportedLlvmVersionMax, llvmVersionStr, parseLlvmVersion) +import GHC.CmmToLlvm.Base (LlvmVersion, llvmVersionStr, supportedLlvmVersionLowerBound, supportedLlvmVersionUpperBound, llvmVersionStr, parseLlvmVersion) import GHC.SysTools.Process import GHC.SysTools.Info @@ -236,10 +236,11 @@ figureLlvmVersion logger dflags = traceToolCommand logger "llc" $ do errorMsg logger $ vcat [ text "Warning:", nest 9 $ text "Couldn't figure out LLVM version!" $$ - text ("Make sure you have installed LLVM between " - ++ llvmVersionStr supportedLlvmVersionMin + text ("Make sure you have installed LLVM between [" + ++ llvmVersionStr supportedLlvmVersionLowerBound ++ " and " - ++ llvmVersionStr supportedLlvmVersionMax) ] + ++ llvmVersionStr supportedLlvmVersionUpperBound + ++ ")") ] return Nothing) diff --git a/configure.ac b/configure.ac index e3763055ec..38de5953b6 100644 --- a/configure.ac +++ b/configure.ac @@ -724,8 +724,8 @@ AC_SUBST(InstallNameToolCmd) # tools we are looking for. In the past, GHC supported a number of # versions of LLVM simultaneously, but that stopped working around # 3.5/3.6 release of LLVM. -LlvmMinVersion=10 -LlvmMaxVersion=12 # inclusive +LlvmMinVersion=9 # inclusive +LlvmMaxVersion=13 # not inclusive AC_SUBST([LlvmMinVersion]) AC_SUBST([LlvmMaxVersion]) sUPPORTED_LLVM_VERSION_MIN=$(echo \($LlvmMinVersion\) | sed 's/\./,/') diff --git a/m4/find_llvm_prog.m4 b/m4/find_llvm_prog.m4 index 79a6a502a5..dc620ae470 100644 --- a/m4/find_llvm_prog.m4 +++ b/m4/find_llvm_prog.m4 @@ -24,7 +24,7 @@ AC_DEFUN([FIND_LLVM_PROG],[ [AC_MSG_RESULT(no) $1="" AC_MSG_NOTICE([We only support llvm $3 to $4 (found $PROG_VERSION).])], - [AX_COMPARE_VERSION([$PROG_VERSION], [gt], [$4], + [AX_COMPARE_VERSION([$PROG_VERSION], [ge], [$4], [AC_MSG_RESULT(no) $1="" AC_MSG_NOTICE([We only support llvm $3 to $4 (found $PROG_VERSION).])], |