summaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
Diffstat (limited to 'compiler')
-rw-r--r--compiler/GHC/CmmToLlvm.hs6
-rw-r--r--compiler/GHC/CmmToLlvm/Base.hs16
-rw-r--r--compiler/GHC/SysTools/Tasks.hs9
3 files changed, 17 insertions, 14 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)