diff options
author | Ömer Sinan Ağacan <omeragacan@gmail.com> | 2015-12-18 12:21:47 -0500 |
---|---|---|
committer | Ömer Sinan Ağacan <omeragacan@gmail.com> | 2015-12-18 12:41:44 -0500 |
commit | 0e9a331f25c89c6150a43d7d5d27ef5cb6e057ec (patch) | |
tree | 30b76216249131f8dd2195bfcbee454a47cd8680 | |
parent | 4198b81488c300a52c9d60d3740a9d3b738e3ac9 (diff) | |
download | haskell-0e9a331f25c89c6150a43d7d5d27ef5cb6e057ec.tar.gz |
LLVM backend: Show expected LLVM version in warnings/errors
Summary:
Before:
[1 of 1] Compiling Main ( Main.hs, Main.o )
You are using a new version of LLVM that hasn't been tested yet!
We will try though...
After:
[1 of 1] Compiling Main ( Main.hs, Main.o )
You are using an unsupported version of LLVM!
Currently only 3.7 is supported.
We will try though...
Before:
[1 of 1] Compiling Main ( Main.hs, Main.o )
<no location info>:
Warning: Couldn't figure out LLVM version!
Make sure you have installed LLVM
ghc: could not execute: opt
After:
[1 of 1] Compiling Main ( Main.hs, Main.o )
<no location info>: error:
Warning: Couldn't figure out LLVM version!
Make sure you have installed LLVM 3.7
ghc-stage1: could not execute: opt
Reviewers: austin, rwbarton, bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D1658
-rw-r--r-- | compiler/llvmGen/LlvmCodeGen.hs | 3 | ||||
-rw-r--r-- | compiler/llvmGen/LlvmCodeGen/Base.hs | 5 | ||||
-rw-r--r-- | compiler/main/SysTools.hs | 5 |
3 files changed, 11 insertions, 2 deletions
diff --git a/compiler/llvmGen/LlvmCodeGen.hs b/compiler/llvmGen/LlvmCodeGen.hs index 345348470a..3c63aa06d0 100644 --- a/compiler/llvmGen/LlvmCodeGen.hs +++ b/compiler/llvmGen/LlvmCodeGen.hs @@ -54,6 +54,9 @@ llvmCodeGen dflags h us cmm_stream let doWarn = wopt Opt_WarnUnsupportedLlvmVersion dflags when (ver /= supportedLlvmVersion && doWarn) $ putMsg dflags (text "You are using an unsupported version of LLVM!" + $+$ text ("Currently only " ++ + llvmVersionStr supportedLlvmVersion ++ + " is supported.") $+$ text "We will try though...") -- run code generation diff --git a/compiler/llvmGen/LlvmCodeGen/Base.hs b/compiler/llvmGen/LlvmCodeGen/Base.hs index 3367cdaf45..82c1eeaaf0 100644 --- a/compiler/llvmGen/LlvmCodeGen/Base.hs +++ b/compiler/llvmGen/LlvmCodeGen/Base.hs @@ -12,7 +12,7 @@ module LlvmCodeGen.Base ( LiveGlobalRegs, LlvmUnresData, LlvmData, UnresLabel, UnresStatic, - LlvmVersion, supportedLlvmVersion, + LlvmVersion, supportedLlvmVersion, llvmVersionStr, LlvmM, runLlvm, liftStream, withClearVars, varLookup, varInsert, @@ -184,6 +184,9 @@ type LlvmVersion = (Int, Int) supportedLlvmVersion :: LlvmVersion supportedLlvmVersion = sUPPORTED_LLVM_VERSION +llvmVersionStr :: LlvmVersion -> String +llvmVersionStr (major, minor) = show major ++ "." ++ show minor + -- ---------------------------------------------------------------------------- -- * Environment Handling -- diff --git a/compiler/main/SysTools.hs b/compiler/main/SysTools.hs index c7ca4a6481..4166b9b43a 100644 --- a/compiler/main/SysTools.hs +++ b/compiler/main/SysTools.hs @@ -66,6 +66,8 @@ import Util import DynFlags import Exception +import LlvmCodeGen.Base (llvmVersionStr, supportedLlvmVersion) + import Data.IORef import Control.Monad import System.Exit @@ -653,7 +655,8 @@ figureLlvmVersion dflags = do errorMsg dflags $ vcat [ text "Warning:", nest 9 $ text "Couldn't figure out LLVM version!" $$ - text "Make sure you have installed LLVM"] + text ("Make sure you have installed LLVM " ++ + llvmVersionStr supportedLlvmVersion) ] return Nothing) return ver |