From 60c7a2dde354011c632628b0566f08488759e2ae Mon Sep 17 00:00:00 2001 From: Neil Brown Date: Thu, 6 Mar 2008 09:59:18 +0000 Subject: [PATCH] Added a preliminary pass-list for the work on flattening arrays --- backends/BackendPasses.hs | 15 ++++++++++++--- pass/Properties.hs | 4 ++++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/backends/BackendPasses.hs b/backends/BackendPasses.hs index 2c3841d..30f7a6e 100644 --- a/backends/BackendPasses.hs +++ b/backends/BackendPasses.hs @@ -28,9 +28,21 @@ import qualified AST as A import CompState import Metadata import Pass +import qualified Properties as Prop import Types import Utils +squashArrays :: [Pass] +squashArrays = makePassesDep + [ ("Declare array-size arrays", declareSizesArray, prereq, []) + , ("Add array-size arrays to PROC headers", addSizesFormalParameters, prereq, []) + , ("Add array-size arrays to PROC calls", addSizesActualParameters, prereq, []) + ] + where + prereq = Prop.agg_namesDone ++ Prop.agg_typesDone ++ Prop.agg_functionsGone ++ [Prop.subscriptsPulledUp, Prop.arrayLiteralsExpanded] + +-- Prop.subscriptsPulledUp + -- | Identify processes that we'll need to compute the stack size of. identifyParProcs :: Data t => t -> PassM t identifyParProcs = doGeneric `extM` doProcess @@ -85,9 +97,6 @@ append_sizes n = n {A.nameName = A.nameName n ++ "_sizes"} -- | Declares a _sizes array for every array, statically sized or dynamically sized. -- For each record type it declares a _sizes array too. - --- TODO must make sure that each expression is already pulled out into a variable - declareSizesArray :: Data t => t -> PassM t declareSizesArray = doGeneric `ext1M` doStructured where diff --git a/pass/Properties.hs b/pass/Properties.hs index b35b6ef..6d331d7 100644 --- a/pass/Properties.hs +++ b/pass/Properties.hs @@ -18,6 +18,7 @@ with this program. If not, see . module Properties ( agg_namesDone + , agg_functionsGone , agg_typesDone , afterRemoved , allChansToAnyOrProtocol @@ -79,6 +80,9 @@ agg_namesDone = [declarationsUnique, declarationTypesRecorded, inferredTypesReco agg_typesDone :: [Property] agg_typesDone = [expressionTypesChecked, inferredTypesRecorded, processTypesChecked, typesResolvedInAST, typesResolvedInState] +agg_functionsGone :: [Property] +agg_functionsGone = [functionCallsRemoved, functionsRemoved] + -- Mark out all the checks I still need to implement: checkTODO :: Monad m => A.AST -> m () checkTODO _ = return ()