diff --git a/backends/BackendPasses.hs b/backends/BackendPasses.hs index c9b6be1..b66ce11 100644 --- a/backends/BackendPasses.hs +++ b/backends/BackendPasses.hs @@ -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 diff --git a/backends/GenerateC.hs b/backends/GenerateC.hs index e5b993a..fbe24b2 100644 --- a/backends/GenerateC.hs +++ b/backends/GenerateC.hs @@ -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]) ] --}}} diff --git a/transformations/SimplifyProcs.hs b/transformations/SimplifyProcs.hs index 7d0a81b..5c9d96f 100644 --- a/transformations/SimplifyProcs.hs +++ b/transformations/SimplifyProcs.hs @@ -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