diff --git a/backends/BackendPasses.hs b/backends/BackendPasses.hs index 414f812..e0e5679 100644 --- a/backends/BackendPasses.hs +++ b/backends/BackendPasses.hs @@ -35,11 +35,11 @@ import Utils squashArrays :: [Pass] squashArrays = makePassesDep - [ ("Declare array-size arrays", declareSizesArray, prereq ++ [Prop.slicesSimplified, + [ ("Simplify array slices", simplifySlices, prereq, [Prop.slicesSimplified]) + , ("Declare array-size arrays", declareSizesArray, prereq ++ [Prop.slicesSimplified, Prop.arrayConstructorsRemoved], [Prop.arraySizesDeclared]) , ("Add array-size arrays to PROC headers", addSizesFormalParameters, prereq ++ [Prop.arraySizesDeclared], []) , ("Add array-size arrays to PROC calls", addSizesActualParameters, prereq ++ [Prop.arraySizesDeclared], []) - , ("Simplify array slices", simplifySlices, prereq, [Prop.slicesSimplified]) ] where prereq = Prop.agg_namesDone ++ Prop.agg_typesDone ++ Prop.agg_functionsGone ++ [Prop.subscriptsPulledUp, Prop.arrayLiteralsExpanded] diff --git a/frontends/OccamPasses.hs b/frontends/OccamPasses.hs index f2faf45..19cb585 100644 --- a/frontends/OccamPasses.hs +++ b/frontends/OccamPasses.hs @@ -37,7 +37,13 @@ import Types -- | Occam-specific frontend passes. occamPasses :: [Pass] occamPasses = makePassesDep' ((== FrontendOccam) . csFrontend) - [ ("Fold constants", foldConstants, + [ ("Dummy occam pass", dummyOccamPass, + [], + Prop.agg_namesDone ++ [Prop.mainTagged]) + , ("Infer types", inferTypes, + [], + [Prop.inferredTypesRecorded]) + , ("Fold constants", foldConstants, [Prop.inferredTypesRecorded], [Prop.constantsFolded]) , ("Fix the types of array constructors", fixConstructorTypes, @@ -46,9 +52,6 @@ occamPasses = makePassesDep' ((== FrontendOccam) . csFrontend) , ("Check mandatory constants", checkConstants, [Prop.constantsFolded, Prop.arrayConstructorTypesDone], [Prop.constantsChecked]) - , ("Infer types", inferTypes, - [], - [Prop.inferredTypesRecorded]) , ("Resolve ambiguities", resolveAmbiguities, [Prop.inferredTypesRecorded], [Prop.ambiguitiesResolved]) @@ -56,9 +59,6 @@ occamPasses = makePassesDep' ((== FrontendOccam) . csFrontend) [Prop.inferredTypesRecorded, Prop.ambiguitiesResolved], [Prop.expressionTypesChecked, Prop.processTypesChecked, Prop.functionTypesChecked, Prop.retypesChecked]) - , ("Dummy occam pass", dummyOccamPass, - [], - Prop.agg_namesDone ++ [Prop.mainTagged]) ] -- | Fixed the types of array constructors according to the replicator count diff --git a/pass/PassList.hs b/pass/PassList.hs index faed7d2..6052ac8 100644 --- a/pass/PassList.hs +++ b/pass/PassList.hs @@ -47,10 +47,10 @@ commonPasses opts = concat $ , makePassesDep' csUsageChecking [("Usage checking", runPassR usageCheckPass, Prop.agg_namesDone, [Prop.parUsageChecked])] -- If usage checking is turned off, the pass list will break unless we insert this dummy item: , makePassesDep' (not . csUsageChecking) [("Usage checking turned OFF", return, Prop.agg_namesDone, [Prop.parUsageChecked])] + , simplifyComms , simplifyExprs , simplifyProcs , unnest - , simplifyComms , squashArrays ] diff --git a/transformations/SimplifyExprs.hs b/transformations/SimplifyExprs.hs index 245cf7a..6c960ac 100644 --- a/transformations/SimplifyExprs.hs +++ b/transformations/SimplifyExprs.hs @@ -40,10 +40,10 @@ simplifyExprs = makePassesDep Prop.functionTypesChecked], [Prop.functionsRemoved]) , ("Convert AFTER to MINUS", removeAfter, [Prop.expressionTypesChecked], [Prop.afterRemoved]) , ("Expand array literals", expandArrayLiterals, [Prop.expressionTypesChecked, Prop.processTypesChecked], [Prop.arrayLiteralsExpanded]) - , ("Transform array constructors into initialisation code", transformConstr, Prop.agg_namesDone ++ Prop.agg_typesDone - ++ [Prop.subscriptsPulledUp], [Prop.arrayConstructorsRemoved]) , ("Pull up replicator counts for SEQs", pullRepCounts, Prop.agg_namesDone ++ Prop.agg_typesDone, []) , ("Pull up definitions", pullUp False, Prop.agg_namesDone ++ Prop.agg_typesDone ++ [Prop.functionsRemoved, Prop.seqInputsFlattened], [Prop.functionCallsRemoved, Prop.subscriptsPulledUp]) + , ("Transform array constructors into initialisation code", transformConstr, Prop.agg_namesDone ++ Prop.agg_typesDone + ++ [Prop.subscriptsPulledUp], [Prop.arrayConstructorsRemoved]) ] -- ++ makePassesDep' ((== BackendCPPCSP) . csBackend) [("Pull up definitions (C++)", pullUp True, Prop.agg_namesDone ++ [Prop.expressionTypesChecked, Prop.functionsRemoved, Prop.processTypesChecked,Prop.seqInputsFlattened], [Prop.functionCallsRemoved, Prop.subscriptsPulledUp])]