diff --git a/Makefile.am b/Makefile.am index 1ac671f..b87dffe 100644 --- a/Makefile.am +++ b/Makefile.am @@ -134,6 +134,7 @@ tock_SOURCES_hs += data/OrdAST.hs tock_SOURCES_hs += data/TagAST.hs tock_SOURCES_hs += flow/FlowGraph.hs tock_SOURCES_hs += flow/FlowAlgorithms.hs +tock_SOURCES_hs += frontends/OccamPasses.hs tock_SOURCES_hs += frontends/ParseOccam.hs tock_SOURCES_hs += frontends/ParseRain.hs tock_SOURCES_hs += frontends/ParseUtils.hs diff --git a/frontends/OccamPasses.hs b/frontends/OccamPasses.hs new file mode 100644 index 0000000..f49ea5b --- /dev/null +++ b/frontends/OccamPasses.hs @@ -0,0 +1,41 @@ +{- +Tock: a compiler for parallel languages +Copyright (C) 2008 University of Kent + +This program is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation, either version 2 of the License, or (at your +option) any later version. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program. If not, see . +-} + +-- | The occam-specific frontend passes. +module OccamPasses (occamPasses) where + +import Data.Generics + +import CompState +import Pass +import qualified Properties as Prop + +-- | Occam-specific frontend passes. +occamPasses :: [Pass] +occamPasses = makePassesDep' ((== FrontendOccam) . csFrontend) + [ ("Dummy occam pass", dummyOccamPass, + [], + Prop.agg_namesDone ++ [Prop.constantsFolded, Prop.expressionTypesChecked, + Prop.inferredTypesRecorded, Prop.mainTagged, + Prop.processTypesChecked]) + ] + +-- | A dummy pass for things that haven't been separated out into passes yet. +dummyOccamPass :: Data t => t -> PassM t +dummyOccamPass = return + diff --git a/pass/PassList.hs b/pass/PassList.hs index fc9203a..211a104 100644 --- a/pass/PassList.hs +++ b/pass/PassList.hs @@ -31,6 +31,7 @@ import CompState import Errors import GenerateC import GenerateCPPCSP +import OccamPasses import Pass import qualified Properties as Prop import RainPasses @@ -52,10 +53,6 @@ commonPasses opts = concat $ , unnest , simplifyComms , squashArrays - -- The occam frontend does a lot of work for us, so I represent that here: - ,makePassesDep' ((== FrontendOccam) . csFrontend) [("Null occam pass", return, [], - Prop.agg_namesDone ++ [Prop.constantsFolded, Prop.expressionTypesChecked, Prop.inferredTypesRecorded, Prop.mainTagged, Prop.processTypesChecked] - )] ] filterPasses :: CompState -> [Pass] -> [Pass] @@ -63,7 +60,8 @@ filterPasses opts = filter (\p -> passEnabled p opts) getPassList :: CompState -> [Pass] getPassList optsPS = filterPasses optsPS $ concat - [ rainPasses + [ occamPasses + , rainPasses , commonPasses optsPS , genCPasses , genCPPCSPPasses