From 84dc1adf521191e1c171e684c7cd28f03475125e Mon Sep 17 00:00:00 2001 From: Roman Leshchinskiy Date: Tue, 16 Sep 2008 03:47:46 +0000 Subject: [PATCH] Improve handling of -fdph-* flags --- compiler/main/DynFlags.hs | 12 +++++++++--- compiler/vectorise/Vectorise.hs | 11 +++-------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs index 3fcb628..9e2d24b 100644 --- a/compiler/main/DynFlags.hs +++ b/compiler/main/DynFlags.hs @@ -21,7 +21,7 @@ module DynFlags ( Option(..), DynLibLoader(..), fFlags, xFlags, - DPHBackend(..), + dphPackage, -- ** Manipulating DynFlags defaultDynFlags, -- DynFlags @@ -892,7 +892,7 @@ data CoreToDo -- These are diff core-to-core passes, | CoreCSE | CoreDoRuleCheck Int{-CompilerPhase-} String -- Check for non-application of rules -- matching this string - | CoreDoVectorisation DPHBackend + | CoreDoVectorisation PackageId | CoreDoNothing -- Useful when building up | CoreDoPasses [CoreToDo] -- lists of these things @@ -947,7 +947,7 @@ getCoreToDo dflags vectorisation = runWhen (dopt Opt_Vectorise dflags) - $ CoreDoPasses [ simpl_gently, CoreDoVectorisation (dphBackend dflags) ] + $ CoreDoPasses [ simpl_gently, CoreDoVectorisation (dphPackage dflags) ] -- By default, we have 2 phases before phase 0. @@ -1888,6 +1888,12 @@ setDPHBackend backend dph_packages DPHPar = ["dph-prim-par", "dph-par"] dph_packages DPHSeq = ["dph-prim-seq", "dph-seq"] +dphPackage :: DynFlags -> PackageId +dphPackage dflags = case dphBackend dflags of + DPHPar -> dphParPackageId + DPHSeq -> dphSeqPackageId + DPHThis -> thisPackage dflags + setMainIs :: String -> DynP () setMainIs arg | not (null main_fn) && isLower (head main_fn) diff --git a/compiler/vectorise/Vectorise.hs b/compiler/vectorise/Vectorise.hs index 8d8bfef..92a19d5 100644 --- a/compiler/vectorise/Vectorise.hs +++ b/compiler/vectorise/Vectorise.hs @@ -10,7 +10,7 @@ import VectCore import DynFlags import HscTypes hiding ( MonadThings(..) ) -import Module ( dphSeqPackageId, dphParPackageId ) +import Module ( PackageId ) import CoreLint ( showPass, endPass ) import CoreSyn import CoreUtils @@ -37,24 +37,19 @@ import FastString import Control.Monad ( liftM, liftM2, zipWithM ) import Data.List ( sortBy, unzip4 ) -vectorise :: DPHBackend -> HscEnv -> UniqSupply -> RuleBase -> ModGuts +vectorise :: PackageId -> HscEnv -> UniqSupply -> RuleBase -> ModGuts -> IO (SimplCount, ModGuts) vectorise backend hsc_env _ _ guts = do showPass dflags "Vectorisation" eps <- hscEPS hsc_env let info = hptVectInfo hsc_env `plusVectInfo` eps_vect_info eps - Just (info', guts') <- initV (backendPackage backend) hsc_env guts info - (vectModule guts) + Just (info', guts') <- initV backend hsc_env guts info (vectModule guts) endPass dflags "Vectorisation" Opt_D_dump_vect (mg_binds guts') return (zeroSimplCount dflags, guts' { mg_vect_info = info' }) where dflags = hsc_dflags hsc_env - backendPackage DPHSeq = dphSeqPackageId - backendPackage DPHPar = dphParPackageId - backendPackage DPHThis = thisPackage dflags - vectModule :: ModGuts -> VM ModGuts vectModule guts = do -- 1.7.10.4