diff options
author | Simon Marlow <marlowsd@gmail.com> | 2012-07-04 10:34:48 +0100 |
---|---|---|
committer | Simon Marlow <marlowsd@gmail.com> | 2012-07-04 10:34:48 +0100 |
commit | 99fd2469fba1a38b2a65b4694f337d92e559df01 (patch) | |
tree | 20491590ccb07223afd9d1f6a6546213b0f43577 /compiler/codeGen/CgParallel.hs | |
parent | d260d919eef22654b1af61334feed0545f64cea5 (diff) | |
parent | 0d19922acd724991b7b97871b1404f3db5058b49 (diff) | |
download | haskell-99fd2469fba1a38b2a65b4694f337d92e559df01.tar.gz |
Merge remote-tracking branch 'origin/master' into newcg
* origin/master: (756 commits)
don't crash if argv[0] == NULL (#7037)
-package P was loading all versions of P in GHCi (#7030)
Add a Note, copying text from #2437
improve the --help docs a bit (#7008)
Copy Data.HashTable's hashString into our Util module
Build fix
Build fixes
Parse error: suggest brackets and indentation.
Don't build the ghc DLL on Windows; works around trac #5987
On Windows, detect if DLLs have too many symbols; trac #5987
Add some more Integer rules; fixes #6111
Fix PA dfun construction with silent superclass args
Add silent superclass parameters to the vectoriser
Add silent superclass parameters (again)
Mention Generic1 in the user's guide
Make the GHC API a little more powerful.
tweak llvm version warning message
New version of the patch for #5461.
Fix Word64ToInteger conversion rule.
Implemented feature request on reconfigurable pretty-printing in GHCi (#5461)
...
Conflicts:
compiler/basicTypes/UniqSupply.lhs
compiler/cmm/CmmBuildInfoTables.hs
compiler/cmm/CmmLint.hs
compiler/cmm/CmmOpt.hs
compiler/cmm/CmmPipeline.hs
compiler/cmm/CmmStackLayout.hs
compiler/cmm/MkGraph.hs
compiler/cmm/OldPprCmm.hs
compiler/codeGen/CodeGen.lhs
compiler/codeGen/StgCmm.hs
compiler/codeGen/StgCmmBind.hs
compiler/codeGen/StgCmmLayout.hs
compiler/codeGen/StgCmmUtils.hs
compiler/main/CodeOutput.lhs
compiler/main/HscMain.hs
compiler/nativeGen/AsmCodeGen.lhs
compiler/simplStg/SimplStg.lhs
Diffstat (limited to 'compiler/codeGen/CgParallel.hs')
-rw-r--r-- | compiler/codeGen/CgParallel.hs | 69 |
1 files changed, 32 insertions, 37 deletions
diff --git a/compiler/codeGen/CgParallel.hs b/compiler/codeGen/CgParallel.hs index 2804104708..c86ef9e34a 100644 --- a/compiler/codeGen/CgParallel.hs +++ b/compiler/codeGen/CgParallel.hs @@ -3,78 +3,73 @@ -- (c) The University of Glasgow -2006 -- -- Code generation relaed to GpH --- (a) parallel --- (b) GranSim +-- (a) parallel +-- (b) GranSim -- ----------------------------------------------------------------------------- -{-# OPTIONS -fno-warn-tabs #-} --- The above warning supression flag is a temporary kludge. --- While working on this module you are encouraged to remove it and --- detab the module (please do the detabbing in a separate patch). See --- http://hackage.haskell.org/trac/ghc/wiki/Commentary/CodingStyle#TabsvsSpaces --- for details - module CgParallel( - staticGranHdr,staticParHdr, - granFetchAndReschedule, granYield, - doGranAllocate + staticGranHdr,staticParHdr, + granFetchAndReschedule, granYield, + doGranAllocate ) where import CgMonad import CgCallConv +import DynFlags import Id import OldCmm -import StaticFlags import Outputable import SMRep +import Control.Monad + staticParHdr :: [CmmLit] -- Parallel header words in a static closure staticParHdr = [] -------------------------------------------------------- --- GranSim stuff +-- GranSim stuff -------------------------------------------------------- staticGranHdr :: [CmmLit] -- Gransim header words in a static closure staticGranHdr = [] -doGranAllocate :: CmmExpr -> Code +doGranAllocate :: CmmExpr -> Code -- macro DO_GRAN_ALLOCATE doGranAllocate _hp - | not opt_GranMacros = nopC - | otherwise = panic "doGranAllocate" + = do dflags <- getDynFlags + when (dopt Opt_GranMacros dflags) $ panic "doGranAllocate" ------------------------- granFetchAndReschedule :: [(Id,GlobalReg)] -- Live registers - -> Bool -- Node reqd? - -> Code + -> Bool -- Node reqd? + -> Code -- Emit code for simulating a fetch and then reschedule. granFetchAndReschedule regs node_reqd - | opt_GranMacros && (node `elem` map snd regs || node_reqd) - = do { fetch - ; reschedule liveness node_reqd } - | otherwise - = nopC + = do dflags <- getDynFlags + when (dopt Opt_GranMacros dflags && + (node `elem` map snd regs || node_reqd)) $ + do fetch + reschedule liveness node_reqd where liveness = mkRegLiveness regs 0 0 fetch :: FCode () fetch = panic "granFetch" - -- Was: absC (CMacroStmt GRAN_FETCH []) - --HWL: generate GRAN_FETCH macro for GrAnSim - -- currently GRAN_FETCH and GRAN_FETCH_AND_RESCHEDULE are miai + -- Was: absC (CMacroStmt GRAN_FETCH []) + --HWL: generate GRAN_FETCH macro for GrAnSim + -- currently GRAN_FETCH and GRAN_FETCH_AND_RESCHEDULE are miai reschedule :: StgWord -> Bool -> Code reschedule _liveness _node_reqd = panic "granReschedule" - -- Was: absC (CMacroStmt GRAN_RESCHEDULE [ - -- mkIntCLit (I# (word2Int# liveness_mask)), - -- mkIntCLit (if node_reqd then 1 else 0)]) - + -- Was: absC (CMacroStmt GRAN_RESCHEDULE [ + -- mkIntCLit (I# (word2Int# liveness_mask)), + -- mkIntCLit (if node_reqd then 1 else 0)]) + ------------------------- -- The @GRAN_YIELD@ macro is taken from JSM's code for Concurrent Haskell. It @@ -82,26 +77,26 @@ reschedule _liveness _node_reqd = panic "granReschedule" -- @Continue@ rather than the @EnterNodeCode@ function in the RTS). We emit -- this kind of macro at the beginning of the following kinds of basic bocks: -- \begin{itemize} --- \item Slow entry code where node is not alive (see @CgClosure.lhs@). Normally +-- \item Slow entry code where node is not alive (see @CgClosure.lhs@). Normally -- we use @fetchAndReschedule@ at a slow entry code. -- \item Fast entry code (see @CgClosure.lhs@). -- \item Alternatives in case expressions (@CLabelledCode@ structures), provided --- that they are not inlined (see @CgCases.lhs@). These alternatives will +-- that they are not inlined (see @CgCases.lhs@). These alternatives will -- be turned into separate functions. granYield :: [(Id,GlobalReg)] -- Live registers -> Bool -- Node reqd? - -> Code + -> Code granYield regs node_reqd - | opt_GranMacros && node_reqd = yield liveness - | otherwise = nopC + = do dflags <- getDynFlags + when (dopt Opt_GranMacros dflags && node_reqd) $ yield liveness where liveness = mkRegLiveness regs 0 0 yield :: StgWord -> Code yield _liveness = panic "granYield" - -- Was : absC (CMacroStmt GRAN_YIELD + -- Was : absC (CMacroStmt GRAN_YIELD -- [mkIntCLit (I# (word2Int# liveness_mask))]) |