Skip to content

Commit f352266

Browse files
committed
Hoist BoundsChecking
1 parent 2f97ff8 commit f352266

File tree

10 files changed

+2256
-1541
lines changed

10 files changed

+2256
-1541
lines changed

gibbon-compiler/examples/simple_tests/list.hs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,11 @@ sumList lst = case lst of
3535

3636
gibbon_main = let
3737
lst = mkList 20000
38-
lst' = iterate (add1 lst)
39-
-- _ = printPacked lst'
38+
--lst' = iterate (add1 lst)
39+
_ = printPacked lst
40+
_ = printsym (quote "NEWLINE")
4041
--(val, lst'') = fieldDep lst'
41-
in sumList lst' --() --printPacked lst' --val --sumList lst'
42+
in sumList lst --() --printPacked lst' --val --sumList lst'
4243

4344

4445

gibbon-compiler/gibbon.cabal

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ library
9393
Gibbon.Passes.RearrangeFree
9494
Gibbon.Passes.Codegen
9595
Gibbon.Passes.CalculateBounds
96-
Gibbon.Passes.CorrectLocExprs
96+
Gibbon.Passes.HoistExpressions
9797
Gibbon.Passes.ReorderLetExprs
9898
Gibbon.Passes.AddCastInstructions
9999

@@ -181,6 +181,7 @@ test-suite test-gibbon
181181
InferLocations
182182
Unariser
183183
InferRegionScope
184+
HoistBoundsCheck
184185
AddRAN
185186
L1.Typecheck
186187
L1.Interp

gibbon-compiler/src/Gibbon/Compiler.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ import Gibbon.Passes.RearrangeFree (rearrangeFree)
9494
import Gibbon.Passes.Codegen (codegenProg)
9595
import Gibbon.Passes.AddCastInstructions (addCasts)
9696
import Gibbon.Passes.Fusion2 (fusion2)
97-
import Gibbon.Passes.CorrectLocExprs (delayExpr)
97+
import Gibbon.Passes.HoistExpressions (hoistBoundsCheckProg)
9898
import Gibbon.Passes.ReorderLetExprs (reorderLetExprs)
9999
import Gibbon.Pretty
100100
import Gibbon.L1.GenSML
@@ -836,7 +836,7 @@ Also see Note [Adding dummy traversals] and Note [Adding random access nodes].
836836
-- typechecker doesn't know how to handle.
837837
-- l2' <- go "threadRegions" threadRegions l2'
838838
l2' <- go "threadRegions2" threadRegions2 l2'
839-
l2' <- go "delayExprs" delayExpr l2'
839+
l2' <- go "hoistBoundsCheck" hoistBoundsCheckProg l2'
840840

841841
-- L2 -> L3
842842
-- TODO: Compose L3.TcM with (ReaderT Config)

gibbon-compiler/src/Gibbon/NewL2/Syntax.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,7 @@ depList = L.map (\(a,b) -> (a,a,b)) . M.toList . go M.empty
568568
allFreeVars :: Exp2 -> S.Set FreeVarsTy
569569
allFreeVars ex =
570570
case ex of
571-
AppE _ locs args -> S.fromList (map (fromLocVarToFreeVarsTy . toLocVar) locs) `S.union` (S.unions (map allFreeVars args))
571+
AppE _ locs args -> S.fromList (map (fromLocArgToFreeVarsTy) locs) `S.union` (S.unions (map allFreeVars args))
572572
PrimAppE _ args -> (S.unions (map allFreeVars args))
573573
LetE (v,locs,_,rhs) bod -> (S.fromList (map (fromLocVarToFreeVarsTy . toLocVar) locs) `S.union` (allFreeVars rhs) `S.union` (allFreeVars bod))
574574
`S.difference` S.singleton (fromVarToFreeVarsTy v)

gibbon-compiler/src/Gibbon/Passes/CorrectLocExprs.hs

Lines changed: 0 additions & 171 deletions
This file was deleted.

0 commit comments

Comments
 (0)