Remove the identifyParProcs pass.

All it did was to make a list of the Procs generated by parsToProcs, so
parsToProcs may as well just do the same job itself.

The reason I'd made it a separate pass originally was that I wanted to
optimise out the wrapper when the child of a Par was already a ProcCall.
That optimisation isn't going to be possible any more with the new CCSP,
since wrappers have to fetch their arguments in a different way from
ordinary Procs.
This commit is contained in:
Adam Sampson 2008-03-14 14:53:05 +00:00
parent 26c9e5b57f
commit 5156626ab0
3 changed files with 3 additions and 22 deletions

View File

@ -22,7 +22,6 @@ module BackendPasses where
import Control.Monad.State
import Data.Generics
import qualified Data.Map as Map
import qualified Data.Set as Set
import qualified AST as A
import CompState
@ -44,25 +43,6 @@ squashArrays = makePassesDep
where
prereq = Prop.agg_namesDone ++ Prop.agg_typesDone ++ Prop.agg_functionsGone ++ [Prop.subscriptsPulledUp, Prop.arrayLiteralsExpanded]
-- | Identify processes that we'll need to compute the stack size of.
identifyParProcs :: Data t => t -> PassM t
identifyParProcs = doGeneric `extM` doProcess
where
doGeneric :: Data t => t -> PassM t
doGeneric = makeGeneric identifyParProcs
doProcess :: A.Process -> PassM A.Process
doProcess p@(A.Par _ _ s) = findProcs s >> return p
doProcess p = doGeneric p
findProcs :: A.Structured A.Process -> PassM ()
findProcs (A.Rep _ _ s) = findProcs s
findProcs (A.Spec _ spec s) = doGeneric spec >> findProcs s
findProcs (A.ProcThen _ p s) = doGeneric p >> findProcs s
findProcs (A.Several _ ss) = sequence_ $ map findProcs ss
findProcs (A.Only _ (A.ProcCall _ n _))
= modify (\cs -> cs { csParProcs = Set.insert n (csParProcs cs) })
transformWaitFor :: Data t => t -> PassM t
transformWaitFor = doGeneric `extM` doAlt
where

View File

@ -47,8 +47,7 @@ import Utils
--{{{ passes related to C generation
genCPasses :: [Pass]
genCPasses = makePassesDep' ((== BackendC) . csBackend)
[ ("Identify parallel processes", identifyParProcs, [Prop.parsWrapped], [])
,("Transform wait for guards into wait until guards", transformWaitFor, [], [Prop.waitForRemoved])
[ ("Transform wait for guards into wait until guards", transformWaitFor, [], [Prop.waitForRemoved])
]
--}}}

View File

@ -21,6 +21,7 @@ module SimplifyProcs (simplifyProcs) where
import Control.Monad.State
import Data.Generics
import qualified Data.Set as Set
import qualified AST as A
import CompState
@ -66,6 +67,7 @@ parsToProcs = doGeneric `extM` doProcess
doStructured (A.Only m p)
= do p' <- parsToProcs p
s@(A.Specification _ n _) <- makeNonceProc m p'
modify (\cs -> cs { csParProcs = Set.insert n (csParProcs cs) })
return $ A.Spec m s (A.Only m (A.ProcCall m n []))
doStructured (A.Several m ss)
= liftM (A.Several m) $ mapM doStructured ss