Commit 0e9a331f authored by Ömer Sinan Ağacan's avatar Ömer Sinan Ağacan

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
parent 4198b814
......@@ -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
......
......@@ -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
--
......
......@@ -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
......
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