From e753cf6c364d1e5c06a4463b87eadf869f99dbd3 Mon Sep 17 00:00:00 2001 From: simonpj Date: Wed, 25 Feb 2004 14:51:38 +0000 Subject: [PATCH] [project @ 2004-02-25 14:51:37 by simonpj] Add a -fno-full-laziness flag --- ghc/compiler/main/CmdLineOpts.lhs | 27 +++++++++++++++++---------- ghc/compiler/main/DriverFlags.hs | 1 + ghc/docs/users_guide/flags.sgml | 7 +++++++ 3 files changed, 25 insertions(+), 10 deletions(-) diff --git a/ghc/compiler/main/CmdLineOpts.lhs b/ghc/compiler/main/CmdLineOpts.lhs index cedf8cc..c55f322 100644 --- a/ghc/compiler/main/CmdLineOpts.lhs +++ b/ghc/compiler/main/CmdLineOpts.lhs @@ -282,6 +282,7 @@ data DynFlag -- optimisation opts | Opt_Strictness + | Opt_FullLaziness | Opt_CSE | Opt_IgnoreInterfacePragmas | Opt_OmitInterfacePragmas @@ -373,8 +374,9 @@ defaultDynFlags = DynFlags { Opt_Strictness, -- strictness is on by default, but this only -- applies to -O. - Opt_CSE, - -- similarly for CSE. + Opt_CSE, -- similarly for CSE. + Opt_FullLaziness, -- ...and for full laziness + Opt_DoLambdaEtaExpansion, -- This one is important for a tiresome reason: -- we want to make sure that the bindings for data @@ -478,11 +480,12 @@ opt_1_dopts = [ buildCoreToDo :: DynFlags -> [CoreToDo] buildCoreToDo dflags = core_todo where - opt_level = optLevel dflags - max_iter = maxSimplIterations dflags - strictness = dopt Opt_Strictness dflags - cse = dopt Opt_CSE dflags - rule_check = ruleCheck dflags + opt_level = optLevel dflags + max_iter = maxSimplIterations dflags + strictness = dopt Opt_Strictness dflags + full_laziness = dopt Opt_FullLaziness dflags + cse = dopt Opt_CSE dflags + rule_check = ruleCheck dflags core_todo = if opt_level == 0 then @@ -516,7 +519,9 @@ buildCoreToDo dflags = core_todo -- so that overloaded functions have all their dictionary lambdas manifest CoreDoSpecialising, - CoreDoFloatOutwards (FloatOutSw False False), + if full_laziness then CoreDoFloatOutwards (FloatOutSw False False) + else CoreDoNothing, + CoreDoFloatInwards, CoreDoSimplify (SimplPhase 2) [ @@ -564,8 +569,10 @@ buildCoreToDo dflags = core_todo MaxSimplifierIterations max_iter ], - CoreDoFloatOutwards (FloatOutSw False -- Not lambdas - True), -- Float constants + if full_laziness then + CoreDoFloatOutwards (FloatOutSw False -- Not lambdas + True) -- Float constants + else CoreDoNothing, -- nofib/spectral/hartel/wang doubles in speed if you -- do full laziness late in the day. It only happens -- after fusion and other stuff, so the early pass doesn't diff --git a/ghc/compiler/main/DriverFlags.hs b/ghc/compiler/main/DriverFlags.hs index 7d317ac..63c36ac 100644 --- a/ghc/compiler/main/DriverFlags.hs +++ b/ghc/compiler/main/DriverFlags.hs @@ -464,6 +464,7 @@ fFlags = [ ( "allow-incoherent-instances", Opt_AllowIncoherentInstances ), ( "generics", Opt_Generics ), ( "strictness", Opt_Strictness ), + ( "full-laziness", Opt_FullLaziness ), ( "cse", Opt_CSE ), ( "ignore-interface-pragmas", Opt_IgnoreInterfacePragmas ), ( "omit-interface-pragmas", Opt_OmitInterfacePragmas ), diff --git a/ghc/docs/users_guide/flags.sgml b/ghc/docs/users_guide/flags.sgml index 01c074f..db507f3 100644 --- a/ghc/docs/users_guide/flags.sgml +++ b/ghc/docs/users_guide/flags.sgml @@ -811,6 +811,13 @@ + + Turn off full laziness (floating bindings outwards) + dynamic + - + + + Turn off pre-inlining static -- 1.7.10.4