summaryrefslogtreecommitdiff
path: root/ghc/Main.hs
diff options
context:
space:
mode:
authorSylvain Henry <sylvain@haskus.fr>2020-06-29 22:36:40 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-07-22 20:19:59 -0400
commitf7cc431341e5b5b31758eecc8504cae8b2390c10 (patch)
tree7404d90376432d5a311a7fc6355b02085a1a5367 /ghc/Main.hs
parent735f9d6bac316a0c1c68a8b49bba465f07b01cdd (diff)
downloadhaskell-f7cc431341e5b5b31758eecc8504cae8b2390c10.tar.gz
Replace HscTarget with Backend
They both have the same role and Backend name is more explicit. Metric Decrease: T3064 Update Haddock submodule
Diffstat (limited to 'ghc/Main.hs')
-rw-r--r--ghc/Main.hs36
1 files changed, 17 insertions, 19 deletions
diff --git a/ghc/Main.hs b/ghc/Main.hs
index 541c07bdfa..2f84bb9e43 100644
--- a/ghc/Main.hs
+++ b/ghc/Main.hs
@@ -16,9 +16,7 @@ module Main (main) where
-- The official GHC API
import qualified GHC
-import GHC ( -- DynFlags(..), HscTarget(..),
- -- GhcMode(..), GhcLink(..),
- Ghc, GhcMonad(..),
+import GHC ( Ghc, GhcMonad(..), Backend (..),
LoadHowMuch(..) )
import GHC.Driver.CmdLine
@@ -152,23 +150,23 @@ main = do
main' :: PostLoadMode -> DynFlags -> [Located String] -> [Warn]
-> Ghc ()
main' postLoadMode dflags0 args flagWarnings = do
- -- set the default GhcMode, HscTarget and GhcLink. The HscTarget
+ -- set the default GhcMode, backend and GhcLink. The backend
-- can be further adjusted on a module by module basis, using only
- -- the -fvia-C and -fasm flags. If the default HscTarget is not
- -- HscC or HscAsm, -fvia-C and -fasm have no effect.
- let dflt_target = hscTarget dflags0
- (mode, lang, link)
+ -- the -fllvm and -fasm flags. If the default backend is not
+ -- LLVM or NCG, -fllvm and -fasm have no effect.
+ let dflt_backend = backend dflags0
+ (mode, bcknd, link)
= case postLoadMode of
- DoInteractive -> (CompManager, HscInterpreted, LinkInMemory)
- DoEval _ -> (CompManager, HscInterpreted, LinkInMemory)
- DoMake -> (CompManager, dflt_target, LinkBinary)
- DoBackpack -> (CompManager, dflt_target, LinkBinary)
- DoMkDependHS -> (MkDepend, dflt_target, LinkBinary)
- DoAbiHash -> (OneShot, dflt_target, LinkBinary)
- _ -> (OneShot, dflt_target, LinkBinary)
+ DoInteractive -> (CompManager, Interpreter, LinkInMemory)
+ DoEval _ -> (CompManager, Interpreter, LinkInMemory)
+ DoMake -> (CompManager, dflt_backend, LinkBinary)
+ DoBackpack -> (CompManager, dflt_backend, LinkBinary)
+ DoMkDependHS -> (MkDepend, dflt_backend, LinkBinary)
+ DoAbiHash -> (OneShot, dflt_backend, LinkBinary)
+ _ -> (OneShot, dflt_backend, LinkBinary)
let dflags1 = dflags0{ ghcMode = mode,
- hscTarget = lang,
+ backend = bcknd,
ghcLink = link,
verbosity = case postLoadMode of
DoEval _ -> 0
@@ -195,8 +193,8 @@ main' postLoadMode dflags0 args flagWarnings = do
(dflags3, fileish_args, dynamicFlagWarnings) <-
GHC.parseDynamicFlags dflags2 args
- let dflags4 = case lang of
- HscInterpreted | not (gopt Opt_ExternalInterpreter dflags3) ->
+ let dflags4 = case bcknd of
+ Interpreter | not (gopt Opt_ExternalInterpreter dflags3) ->
let platform = targetPlatform dflags3
dflags3a = dflags3 { ways = hostFullWays }
dflags3b = foldl gopt_set dflags3a
@@ -383,7 +381,7 @@ checkOptions mode dflags srcs objs = do
else do
case mode of
- StopBefore HCc | hscTarget dflags /= HscC
+ StopBefore HCc | backend dflags /= ViaC
-> throwGhcException $ UsageError $
"the option -C is only available with an unregisterised GHC"
StopBefore (As False) | ghcLink dflags == NoLink