Created
April 5, 2018 13:33
-
-
Save ckoparkar/19f5a62d0331b0360e7f2f2eedbef142 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Prog {ddefs = [("Tree", | |
DDef {tyName = "Tree", | |
dataCons = [("Leaf", [(False, IntTy)]), | |
("Node", | |
[(False, PackedTy "Tree" ()),(False, PackedTy "Tree" ())]), | |
("Node^", | |
[(False, CursorTy),(False, PackedTy "Tree" ()), | |
(False, PackedTy "Tree" ())])]})], | |
fundefs = [("rightmost", | |
FunDef {funName = "rightmost", | |
funArg = ("tr3", PackedTy "Tree" ()), | |
funRetTy = IntTy, | |
funBody = CaseE (VarE "tr3") | |
[("Leaf", [("n4", ())], VarE "n4"), | |
("Node^", | |
[("sz75", ()),("x5", ()),("y6", ())], | |
AppE "rightmost" [] (VarE "y6"))]}), | |
("buildtree", | |
FunDef {funName = "buildtree", | |
funArg = ("n7", IntTy), | |
funRetTy = PackedTy "Tree" (), | |
funBody = LetE ("fltIf9", | |
[], | |
BoolTy, | |
PrimAppE EqIntP [VarE "n7",LitE 0]) | |
(IfE (VarE "fltIf9") | |
(DataConE () "Leaf" [LitE 1]) | |
(LetE ("fltAp11", | |
[], | |
IntTy, | |
PrimAppE SubP [VarE "n7",LitE 1]) | |
(LetE ("fltPkd10", | |
[], | |
PackedTy "Tree" (), | |
AppE "buildtree" [] (VarE "fltAp11")) | |
(LetE ("fltAp13", | |
[], | |
IntTy, | |
PrimAppE SubP [VarE "n7",LitE 1]) | |
(LetE ("fltPkd12", | |
[], | |
PackedTy "Tree" (), | |
AppE "buildtree" | |
[] | |
(VarE "fltAp13")) | |
(LetE ("indr76", | |
[], | |
CursorTy, | |
PrimAppE PEndOf | |
[VarE "fltPkd10"]) | |
(DataConE () | |
"Node^" | |
[VarE "indr76", | |
VarE "fltPkd10", | |
VarE "fltPkd12"])))))))}), | |
("copy_Tree", | |
FunDef {funName = "copy_Tree", | |
funArg = ("arg14", PackedTy "Tree" ()), | |
funRetTy = PackedTy "Tree" (), | |
funBody = CaseE (VarE "arg14") | |
[("Leaf", [("x15", ())], DataConE () "Leaf" [VarE "x15"]), | |
("Node^", | |
[("sz77", ()),("x17", ()),("x18", ())], | |
LetE ("y19", | |
[], | |
PackedTy "Tree" (), | |
AppE "copy_Tree" [] (VarE "x17")) | |
(LetE ("y20", | |
[], | |
PackedTy "Tree" (), | |
AppE "copy_Tree" [] (VarE "x18")) | |
(LetE ("indr78", | |
[], | |
CursorTy, | |
PrimAppE PEndOf [VarE "y19"]) | |
(DataConE () | |
"Node^" | |
[VarE "indr78",VarE "y19", | |
VarE "y20"]))))]})], | |
mainExp = Just LetE ("fltAp8", [], IntTy, PrimAppE SizeParam []) | |
(LetE ("tr00", | |
[], | |
PackedTy "Tree" (), | |
AppE "buildtree" [] (VarE "fltAp8")) | |
(LetE ("n2", | |
[], | |
IntTy, | |
TimeIt (LetE ("x1", | |
[], | |
IntTy, | |
AppE "rightmost" [] (VarE "tr00")) | |
(VarE "x1")) | |
IntTy | |
True) | |
(VarE "n2")))} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Prog {ddefs = [("Tree", | |
DDef {tyName = "Tree", | |
dataCons = [("Leaf", [(False, IntTy)]), | |
("Node", | |
[(False, PackedTy "Tree" "loc92"), | |
(False, PackedTy "Tree" "loc93")]), | |
("Node^", | |
[(False, CursorTy),(False, PackedTy "Tree" "loc94"), | |
(False, PackedTy "Tree" "loc95")]), | |
("INDIRECTION159", [(False, CursorTy)])]})], | |
fundefs = [("rightmost", | |
FunDef {funname = "rightmost", | |
funty = ArrowTy {locVars = [LRM {lrmLoc = "loc96", | |
lrmReg = VarR "r97", | |
lrmMode = Input}], | |
arrIn = PackedTy "Tree" "loc96", | |
arrEffs = [], | |
arrOut = IntTy, | |
locRets = []}, | |
funarg = "tr3", | |
funbod = CaseE (VarE "tr3") | |
[("Leaf", [("n4", "case112")], VarE "n4"), | |
("Node^", | |
[("sz75", "case113"),("x5", "case114"), | |
("y6", "case115")], | |
AppE "rightmost" ["case115"] (VarE "y6"))]}), | |
("buildtree", | |
FunDef {funname = "buildtree", | |
funty = ArrowTy {locVars = [LRM {lrmLoc = "loc98", | |
lrmReg = VarR "r99", | |
lrmMode = Output}], | |
arrIn = IntTy, | |
arrEffs = [], | |
arrOut = PackedTy "Tree" "loc98", | |
locRets = []}, | |
funarg = "n7", | |
funbod = LetE ("fltIf9", | |
[], | |
BoolTy, | |
PrimAppE EqIntP [VarE "n7",LitE 0]) | |
(IfE (VarE "fltIf9") | |
(DataConE "loc98" "Leaf" [LitE 1]) | |
(LetE ("fltAp11", | |
[], | |
IntTy, | |
PrimAppE SubP [VarE "n7",LitE 1]) | |
(Ext (LetRegionE (VarR "r131") | |
(Ext (LetLocE "loc128" | |
(StartOfLE (VarR "r131")) | |
(LetE ("fltPkd10", | |
[], | |
PackedTy "Tree" | |
"loc128", | |
AppE "buildtree" | |
["loc128"] | |
(VarE "fltAp11")) | |
(Ext (LetLocE "loc130" | |
(AfterVariableLE "fltPkd10" | |
"loc128") | |
(LetE ("fltAp13", | |
[], | |
IntTy, | |
PrimAppE SubP | |
[VarE "n7", | |
LitE 1]) | |
(LetE ("fltPkd12", | |
[], | |
PackedTy "Tree" | |
"loc130", | |
AppE "buildtree" | |
["loc130"] | |
(VarE "fltAp13")) | |
(LetE ("indr76", | |
[], | |
CursorTy, | |
PrimAppE PEndOf | |
[VarE "fltPkd10"]) | |
(DataConE "loc98" | |
"Node^" | |
[VarE "indr76", | |
VarE "fltPkd10", | |
VarE "fltPkd12"])))))))))))))}), | |
("copy_Tree", | |
FunDef {funname = "copy_Tree", | |
funty = ArrowTy {locVars = [LRM {lrmLoc = "loc100", | |
lrmReg = VarR "r102", | |
lrmMode = Input}, | |
LRM {lrmLoc = "loc101", | |
lrmReg = VarR "r103", | |
lrmMode = Output}], | |
arrIn = PackedTy "Tree" "loc100", | |
arrEffs = [Traverse "loc100"], | |
arrOut = PackedTy "Tree" "loc101", | |
locRets = []}, | |
funarg = "arg14", | |
funbod = CaseE (VarE "arg14") | |
[("Leaf", | |
[("x15", "case134")], | |
DataConE "loc101" "Leaf" [VarE "x15"]), | |
("Node^", | |
[("sz77", "case139"),("x17", "case140"), | |
("x18", "case141")], | |
Ext (LetRegionE (VarR "r158") | |
(Ext (LetLocE "loc155" | |
(StartOfLE (VarR "r158")) | |
(LetE ("y19", | |
[], | |
PackedTy "Tree" | |
"loc155", | |
AppE "copy_Tree" | |
["case140", | |
"loc155"] | |
(VarE "x17")) | |
(Ext (LetLocE "loc157" | |
(AfterVariableLE "y19" | |
"loc155") | |
(LetE ("y20", | |
[], | |
PackedTy "Tree" | |
"loc157", | |
AppE "copy_Tree" | |
["case141", | |
"loc157"] | |
(VarE "x18")) | |
(LetE ("indr78", | |
[], | |
CursorTy, | |
PrimAppE PEndOf | |
[VarE "y19"]) | |
(DataConE "loc101" | |
"Node^" | |
[VarE "indr78", | |
VarE "y19", | |
VarE "y20"]))))))))))]})], | |
mainExp = Just (LetE ("fltAp8", [], IntTy, PrimAppE SizeParam []) | |
(Ext (LetRegionE (VarR "r109") | |
(Ext (LetLocE "loc108" | |
(StartOfLE (VarR "r109")) | |
(LetE ("tr00", | |
[], | |
PackedTy "Tree" "loc108", | |
AppE "buildtree" | |
["loc108"] | |
(VarE "fltAp8")) | |
(LetE ("n2", | |
[], | |
IntTy, | |
TimeIt (LetE ("x1", | |
[], | |
IntTy, | |
AppE "rightmost" | |
["loc108"] | |
(VarE "tr00")) | |
(VarE "x1")) | |
IntTy | |
True) | |
(VarE "n2"))))))), | |
IntTy)} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment