From 950c1ecaffcb6e8d7cefb20b8372691182c6c304 Mon Sep 17 00:00:00 2001 From: simonmar Date: Wed, 13 Mar 2002 13:51:35 +0000 Subject: [PATCH 1/1] [project @ 2002-03-13 13:51:34 by simonmar] Fix the -fasm/-fvia-C auto-selection again: now we're back to the proper behaviour, namely -fasm is the default unless you specify -O or -fvia-C, but only on arch's that support it. I screwed it up in the previous commit, but it exposed a bug in the NCG so it wasn't all bad :) --- ghc/compiler/main/CmdLineOpts.lhs | 9 ++++++++- ghc/compiler/main/DriverState.hs | 8 +------- ghc/compiler/main/Main.hs | 9 +++++---- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/ghc/compiler/main/CmdLineOpts.lhs b/ghc/compiler/main/CmdLineOpts.lhs index 7137d63..2589fd0 100644 --- a/ghc/compiler/main/CmdLineOpts.lhs +++ b/ghc/compiler/main/CmdLineOpts.lhs @@ -20,6 +20,7 @@ module CmdLineOpts ( -- Manipulating DynFlags defaultDynFlags, -- DynFlags + defaultHscLang, -- HscLang dopt, -- DynFlag -> DynFlags -> Bool dopt_set, dopt_unset, -- DynFlags -> DynFlag -> DynFlags dopt_CoreToDo, -- DynFlags -> [CoreToDo] @@ -335,9 +336,15 @@ data HscLang | HscNothing deriving (Eq, Show) +defaultHscLang + | cGhcWithNativeCodeGen == "YES" && + (prefixMatch "i386" cTARGETPLATFORM || + prefixMatch "sparc" cTARGETPLATFORM) = HscAsm + | otherwise = HscC + defaultDynFlags = DynFlags { coreToDo = [], stgToDo = [], - hscLang = HscC, + hscLang = defaultHscLang, hscOutName = "", hscStubHOutName = "", hscStubCOutName = "", extCoreName = "", diff --git a/ghc/compiler/main/DriverState.hs b/ghc/compiler/main/DriverState.hs index 16dcfcb..6ff0da9 100644 --- a/ghc/compiler/main/DriverState.hs +++ b/ghc/compiler/main/DriverState.hs @@ -1,5 +1,5 @@ ----------------------------------------------------------------------------- --- $Id: DriverState.hs,v 1.70 2002/02/16 18:15:14 sof Exp $ +-- $Id: DriverState.hs,v 1.71 2002/03/13 13:51:35 simonmar Exp $ -- -- Settings for the driver -- @@ -121,12 +121,6 @@ can_split = prefixMatch "i386" cTARGETPLATFORM ----------------------------------------------------------------------------- -- Compiler output options -defaultHscLang - | cGhcWithNativeCodeGen == "YES" && - (prefixMatch "i386" cTARGETPLATFORM || - prefixMatch "sparc" cTARGETPLATFORM) = HscAsm - | otherwise = HscC - GLOBAL_VAR(v_Output_dir, Nothing, Maybe String) GLOBAL_VAR(v_Output_file, Nothing, Maybe String) GLOBAL_VAR(v_Output_hi, Nothing, Maybe String) diff --git a/ghc/compiler/main/Main.hs b/ghc/compiler/main/Main.hs index bfeed98..0c60aff 100644 --- a/ghc/compiler/main/Main.hs +++ b/ghc/compiler/main/Main.hs @@ -1,7 +1,7 @@ {-# OPTIONS -fno-warn-incomplete-patterns -optc-DNON_POSIX_SOURCE #-} ----------------------------------------------------------------------------- --- $Id: Main.hs,v 1.99 2002/03/12 16:45:59 simonmar Exp $ +-- $Id: Main.hs,v 1.100 2002/03/13 13:51:35 simonmar Exp $ -- -- GHC Driver program -- @@ -30,7 +30,7 @@ import SysTools ( getPackageConfigPath, initSysTools, cleanTempFiles ) import Packages ( showPackages ) import DriverPipeline ( doLink, doMkDLL, genPipeline, pipeLoop ) -import DriverState ( buildCoreToDo, buildStgToDo, defaultHscLang, +import DriverState ( buildCoreToDo, buildStgToDo, findBuildTag, getPackageInfo, unregFlags, v_GhcMode, v_GhcModeFlag, GhcMode(..), v_Cmdline_libraries, v_Keep_tmp_files, v_Ld_inputs, @@ -48,7 +48,8 @@ import DriverUtil ( add, handle, handleDyn, later, splitFilename, unknownFlagErr, getFileSuffix ) import CmdLineOpts ( dynFlag, restoreDynFlags, saveDynFlags, setDynFlags, getDynFlags, dynFlag, - DynFlags(..), HscLang(..), v_Static_hsc_opts + DynFlags(..), HscLang(..), v_Static_hsc_opts, + defaultHscLang ) import Outputable import Util @@ -194,7 +195,7 @@ main = dyn_flags <- getDynFlags let lang = case mode of DoInteractive -> HscInterpreted - _other -> defaultHscLang + _other -> hscLang dyn_flags setDynFlags (dyn_flags{ coreToDo = core_todo, stgToDo = stg_todo, -- 1.7.10.4