From 26b8a5b3feab9d556c92f495a6775acf8cf9f3ec Mon Sep 17 00:00:00 2001 From: simonmar Date: Fri, 12 Jan 2001 11:04:45 +0000 Subject: [PATCH] [project @ 2001-01-12 11:04:45 by simonmar] - Incorporate static STG flags (just -flet-no-escape at the mo) into hsc_minusO_flags and hsc_minusNoO_flags. - Fix -v to be equivalent to -v3 (it was wrongly -v2 before). - Make -v3 output hsc's list of static flags. --- ghc/compiler/main/DriverFlags.hs | 19 +++++++------------ ghc/compiler/main/DriverState.hs | 14 +++++++++----- ghc/compiler/main/Main.hs | 5 ++++- 3 files changed, 20 insertions(+), 18 deletions(-) diff --git a/ghc/compiler/main/DriverFlags.hs b/ghc/compiler/main/DriverFlags.hs index 302a180..128a3a8 100644 --- a/ghc/compiler/main/DriverFlags.hs +++ b/ghc/compiler/main/DriverFlags.hs @@ -1,7 +1,7 @@ {-# OPTIONS -#include "hschooks.h" #-} ----------------------------------------------------------------------------- --- $Id: DriverFlags.hs,v 1.38 2001/01/08 12:31:34 rrt Exp $ +-- $Id: DriverFlags.hs,v 1.39 2001/01/12 11:04:45 simonmar Exp $ -- -- Driver flags -- @@ -18,7 +18,6 @@ import DriverState import DriverUtil import TmpFiles ( v_TmpDir ) import CmdLineOpts -import TmpFiles ( newTempName ) import Config import Util import Panic @@ -26,7 +25,6 @@ import Panic import Exception import IOExts -import Directory ( removeFile ) import IO import Maybe import Monad @@ -349,7 +347,7 @@ setVerbosityAtLeast n = then dfs{ verbosity = n } else dfs) -setVerbosity "" = updDynFlags (\dfs -> dfs{ verbosity = 2 }) +setVerbosity "" = updDynFlags (\dfs -> dfs{ verbosity = 3 }) setVerbosity n | all isDigit n = updDynFlags (\dfs -> dfs{ verbosity = read n }) | otherwise = throwDyn (OtherError "can't parse verbosity flag (-v)") @@ -506,13 +504,10 @@ buildStaticHscOpts = do _ -> error "unknown opt level" -- ToDo: -Ofile - let stg_opts = [ "-flet-no-escape" ] - -- let-no-escape always on for now - -- take into account -fno-* flags by removing the equivalent -f* -- flag from our list. anti_flags <- getStaticOpts v_Anti_opt_C - let basic_opts = opt_C_ ++ optimisation_opts ++ stg_opts + let basic_opts = opt_C_ ++ optimisation_opts filtered_opts = filter (`notElem` anti_flags) basic_opts static <- (do s <- readIORef v_Static; if s then return "-static" @@ -528,9 +523,9 @@ buildStaticHscOpts = do runSomething phase_name cmd = do verb <- dynFlag verbosity - when (verb >= 2) $ putStrLn ("*** " ++ phase_name) - when (verb >= 3) $ putStrLn cmd - hFlush stdout + when (verb >= 2) $ hPutStrLn stderr ("*** " ++ phase_name) + when (verb >= 3) $ hPutStrLn stderr cmd + hFlush stderr -- test for -n flag n <- readIORef v_Dry_run @@ -541,5 +536,5 @@ runSomething phase_name cmd if exit_code /= ExitSuccess then throwDyn (PhaseFailed phase_name exit_code) - else do when (verb >= 3) (putStr "\n") + else do when (verb >= 3) (hPutStr stderr "\n") return () diff --git a/ghc/compiler/main/DriverState.hs b/ghc/compiler/main/DriverState.hs index 6071c10..70a80b8 100644 --- a/ghc/compiler/main/DriverState.hs +++ b/ghc/compiler/main/DriverState.hs @@ -1,5 +1,5 @@ ----------------------------------------------------------------------------- --- $Id: DriverState.hs,v 1.22 2001/01/09 17:16:35 rrt Exp $ +-- $Id: DriverState.hs,v 1.23 2001/01/12 11:04:45 simonmar Exp $ -- -- Settings for the driver -- @@ -244,14 +244,15 @@ GLOBAL_VAR(v_Strictness, True, Bool) GLOBAL_VAR(v_CPR, True, Bool) GLOBAL_VAR(v_CSE, True, Bool) -hsc_minusO2_flags = hsc_minusO_flags -- for now - +-- these are the static flags you get without -O. hsc_minusNoO_flags = [ "-fignore-interface-pragmas", - "-fomit-interface-pragmas" + "-fomit-interface-pragmas", + "-flet-no-escape" ] +-- these are the static flags you get when -O is on. hsc_minusO_flags = [ "-ffoldr-build-on", @@ -259,9 +260,12 @@ hsc_minusO_flags = "-fdo-lambda-eta-expansion", "-fcase-of-case", "-fcase-merge", - "-flet-to-case" + "-flet-to-case", + "-flet-no-escape" ] +hsc_minusO2_flags = hsc_minusO_flags -- for now + getStaticOptimisationFlags 0 = hsc_minusNoO_flags getStaticOptimisationFlags 1 = hsc_minusO_flags getStaticOptimisationFlags n = hsc_minusO2_flags diff --git a/ghc/compiler/main/Main.hs b/ghc/compiler/main/Main.hs index 9487658..a3ad516 100644 --- a/ghc/compiler/main/Main.hs +++ b/ghc/compiler/main/Main.hs @@ -1,6 +1,6 @@ {-# OPTIONS -fno-warn-incomplete-patterns #-} ----------------------------------------------------------------------------- --- $Id: Main.hs,v 1.45 2001/01/09 17:16:36 rrt Exp $ +-- $Id: Main.hs,v 1.46 2001/01/12 11:04:45 simonmar Exp $ -- -- GHC Driver program -- @@ -242,6 +242,9 @@ main = when (verb >= 2) (hPutStrLn stderr ("Using package config file: " ++ conf_file)) + when (verb >= 3) + (hPutStrLn stderr ("Hsc static flags: " ++ unwords static_opts)) + -- initialise the finder pkg_avails <- getPackageInfo initFinder pkg_avails -- 1.7.10.4