summaryrefslogtreecommitdiff
path: root/compiler/GHC/CmmToLlvm
diff options
context:
space:
mode:
authorZubin Duggal <zubin.duggal@gmail.com>2021-06-17 16:25:46 +0530
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-06-20 07:13:07 -0400
commit6c783817ef089e85642c3383937117cff9d15f67 (patch)
tree90266d7337b67a7703c88db0a9a668c19f02ff2f /compiler/GHC/CmmToLlvm
parent4a65c0f88060785a8bcb25bb13bc53c20948633b (diff)
downloadhaskell-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.
Diffstat (limited to 'compiler/GHC/CmmToLlvm')
-rw-r--r--compiler/GHC/CmmToLlvm/Base.hs16
1 files changed, 9 insertions, 7 deletions
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