Move the dummy occam pass into an OccamPasses module.

(The plan is to gradually replace it with real passes.)
This commit is contained in:
Adam Sampson 2008-03-15 14:40:17 +00:00
parent 79a5799b8f
commit 89040a97b0
3 changed files with 45 additions and 5 deletions

View File

@ -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

41
frontends/OccamPasses.hs Normal file
View File

@ -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 <http://www.gnu.org/licenses/>.
-}
-- | 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

View File

@ -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