From 62f686c44a32027d5d99a701e2e9ec85635246d5 Mon Sep 17 00:00:00 2001 From: vidsinghal Date: Mon, 7 Oct 2024 16:14:30 -0400 Subject: [PATCH] finish refactoring L2/Examples.hs --- gibbon-compiler/src/Gibbon/L2/Examples.hs | 560 +++++++++++----------- 1 file changed, 280 insertions(+), 280 deletions(-) diff --git a/gibbon-compiler/src/Gibbon/L2/Examples.hs b/gibbon-compiler/src/Gibbon/L2/Examples.hs index 3b877b29..79729603 100644 --- a/gibbon-compiler/src/Gibbon/L2/Examples.hs +++ b/gibbon-compiler/src/Gibbon/L2/Examples.hs @@ -646,73 +646,73 @@ addTreesFun = FunDef "addTrees" ["trees354"] addTreesTy addTreesBod (FunMeta Rec where addTreesTy :: ArrowTy2 Ty2 addTreesTy = ArrowTy2 - [LRM "lin351" (VarR "r350") Input, - LRM "lin352" (VarR "r351") Input, - LRM "lout353" (VarR "r754") Output] - [ProdTy [PackedTy "Tree" "lin351", PackedTy "Tree" "lin352"]] + [LRM ("lin351", []) (VarR "r350") Input, + LRM ("lin352", []) (VarR "r351") Input, + LRM ("lout353", []) (VarR "r754") Output] + [ProdTy [PackedTy "Tree" ("lin351", []), PackedTy "Tree" ("lin352", [])]] (S.empty) - (PackedTy "Tree" "lout353") + (PackedTy "Tree" ("lout353", [])) [] False addTreesBod :: Exp2 - addTreesBod = LetE ("tree1",[],PackedTy "Tree" "lin351", + addTreesBod = LetE ("tree1",[],PackedTy "Tree" ("lin351", []), ProjE 0 (VarE "trees354")) $ - LetE ("tree2",[],PackedTy "Tree" "lin352", + LetE ("tree2",[],PackedTy "Tree" ("lin352", []), ProjE 1 (VarE "trees354")) $ CaseE (VarE "tree1") - [("Leaf", [("n355","l356")], + [("Leaf", [("n355",("l356", []))], CaseE (VarE "tree2") - [("Leaf",[("n357","l358")], + [("Leaf",[("n357",("l358", []))], LetE ("n358",[],IntTy,PrimAppE AddP [VarE "n355",VarE "n357"]) $ - LetE ("x359",[],PackedTy "Tree" "lout353", - DataConE "lout353" "Leaf" [VarE "n358"]) $ + LetE ("x359",[],PackedTy "Tree" ("lout353", []), + DataConE ("lout353", []) "Leaf" [VarE "n358"]) $ VarE "x359" )] ), - ("Node", [("x360","l361"), ("y362","l363")], + ("Node", [("x360",("l361", [])), ("y362",("l363", []))], CaseE (VarE "tree2") - [("Node", [("x364","l365"), ("y366","l367")], - Ext $ LetLocE "l368" (AfterConstantLE 1 "lout353") $ - LetE ("tree3",[],ProdTy [PackedTy "Tree" "l361", - PackedTy "Tree" "l365"], + [("Node", [("x364",("l365", [])), ("y366", ("l367", []))], + Ext $ LetLocE ("l368", []) (AfterConstantLE 1 ("lout353", [])) $ + LetE ("tree3",[],ProdTy [PackedTy "Tree" ("l361", []), + PackedTy "Tree" ("l365", [])], MkProdE [VarE "x360", VarE "x364"]) $ - LetE ("x369",[],PackedTy "Tree" "l368", - AppE "addTrees" ["l361","l365","l368"] [VarE "tree3"]) $ - Ext $ LetLocE "l370" (AfterVariableLE "x369" "l368" True) $ - LetE ("tree4",[],ProdTy [PackedTy "Tree" "l363", - PackedTy "Tree" "l367"], + LetE ("x369",[],PackedTy "Tree" ("l368", []), + AppE "addTrees" [("l361", []),("l365", []),("l368", [])] [VarE "tree3"]) $ + Ext $ LetLocE ("l370", []) (AfterVariableLE "x369" ("l368", []) True) $ + LetE ("tree4",[],ProdTy [PackedTy "Tree" ("l363", []), + PackedTy "Tree" ("l367", [])], MkProdE [VarE "y362", VarE "y366"]) $ - LetE ("y371",[],PackedTy "Tree" "l370", - AppE "addTrees" ["l363","l367","l370"] [VarE "tree4"]) $ - LetE ("z372",[],PackedTy "Tree" "lout353", - DataConE "lout353" "Node" [VarE "x369", VarE "y371"]) $ + LetE ("y371",[],PackedTy "Tree" ("l370", []), + AppE "addTrees" [("l363", []),("l367", []),("l370", [])] [VarE "tree4"]) $ + LetE ("z372",[],PackedTy "Tree" ("lout353", []), + DataConE ("lout353", []) "Node" [VarE "x369", VarE "y371"]) $ VarE "z372" )] )] addTreesMainExp :: Exp2 addTreesMainExp = Ext $ LetRegionE (VarR "r400") Undefined Nothing $ - Ext $ LetLocE "l401" (StartOfRegionLE (VarR "r400")) $ - LetE ("x402",[], PackedTy "Tree" "l401", - AppE "buildTree" ["l401"] [LitE 2]) $ + Ext $ LetLocE ("l401", []) (StartOfRegionLE (VarR "r400")) $ + LetE ("x402",[], PackedTy "Tree" ("l401", []), + AppE "buildTree" [("l401", [])] [LitE 2]) $ -- Ext $ LetLocE "l403" (AfterVariableLE "x402" "l401" True) $ Ext $ LetRegionE (VarR "r403") Undefined Nothing $ - Ext $ LetLocE "l403" (StartOfRegionLE (VarR "r403")) $ - LetE ("y404",[], PackedTy "Tree" "l403", - AppE "buildTree" ["l403"] [LitE 2]) $ - LetE ("z405",[], ProdTy [PackedTy "Tree" "l401", PackedTy "Tree" "l403"], + Ext $ LetLocE ("l403", []) (StartOfRegionLE (VarR "r403")) $ + LetE ("y404",[], PackedTy "Tree" ("l403", []), + AppE "buildTree" [("l403", [])] [LitE 2]) $ + LetE ("z405",[], ProdTy [PackedTy "Tree" ("l401", []), PackedTy "Tree" ("l403", [])], MkProdE [VarE "x402", VarE "y404"]) $ Ext $ LetRegionE (VarR "r405") Undefined Nothing $ - Ext $ LetLocE "l406" (StartOfRegionLE (VarR "r405")) $ - LetE ("a407",[],PackedTy "Tree" "l406", - AppE "addTrees" ["l401","l403","l406"] [VarE "z405"]) $ + Ext $ LetLocE ("l406", []) (StartOfRegionLE (VarR "r405")) $ + LetE ("a407",[],PackedTy "Tree" ("l406", []), + AppE "addTrees" [("l401", []),("l403", []),("l406", [])] [VarE "z405"]) $ VarE "a407" addTreesProg :: Prog2 addTreesProg = Prog ddtree (M.fromList [("addTrees", addTreesFun) ,("buildTree", buildTreeFun)]) - (Just (addTreesMainExp, PackedTy "Tree" "l406")) + (Just (addTreesMainExp, PackedTy "Tree" ("l406", []))) -------------------------------------------------------------------------------- @@ -720,38 +720,38 @@ testProdFun :: FunDef2 testProdFun = FunDef "testprod" ["tup130"] testprodTy testprodBod (FunMeta Rec NoInline False) where testprodTy = ArrowTy2 - [LRM "lin131" (VarR "r132") Input, LRM "lout133" (VarR "r755") Output] - [ProdTy [(PackedTy "Tree" "lin131"), IntTy]] + [LRM ("lin131", []) (VarR "r132") Input, LRM ("lout133", []) (VarR "r755") Output] + [ProdTy [(PackedTy "Tree" ("lin131", [])), IntTy]] (S.empty) - (ProdTy [(PackedTy "Tree" "lout133"), IntTy]) + (ProdTy [(PackedTy "Tree" ("lout133", [])), IntTy]) [] False - testprodBod = LetE ("t134",[], PackedTy "Tree" "lin131", ProjE 0 (VarE "tup130")) $ + testprodBod = LetE ("t134",[], PackedTy "Tree" ("lin131", []), ProjE 0 (VarE "tup130")) $ LetE ("i135",[], IntTy, ProjE 1 (VarE "tup130")) $ CaseE (VarE "t134") - [("Leaf",[("n136","l137")], + [("Leaf",[("n136",("l137", []))], LetE ("v138",[],IntTy, PrimAppE AddP [VarE "n136", LitE 1]) $ - LetE ("lf139",[],PackedTy "Tree" "lout133", - DataConE "lout133" "Leaf" [VarE "v138"]) $ - LetE ("tup148",[], ProdTy [PackedTy "Tree" "lout133", IntTy], + LetE ("lf139",[],PackedTy "Tree" ("lout133", []), + DataConE ("lout133", []) "Leaf" [VarE "v138"]) $ + LetE ("tup148",[], ProdTy [PackedTy "Tree" ("lout133", []), IntTy], MkProdE [VarE "lf139", VarE "i135"]) $ VarE "tup148" ), - ("Node",[("x140","l141"), ("y142","l143")], - Ext $ LetLocE "l144" (AfterConstantLE 1 "lout133") $ - LetE ("tup145",[], ProdTy [PackedTy "Tree" "l144", IntTy], - AppE "testprod" ["l141","l144"] + ("Node",[("x140",("l141", [])), ("y142",("l143", []))], + Ext $ LetLocE ("l144", []) (AfterConstantLE 1 ("lout133", [])) $ + LetE ("tup145",[], ProdTy [PackedTy "Tree" ("l144", []), IntTy], + AppE "testprod" [("l141", []),("l144", [])] [MkProdE [VarE "x140", VarE "i135"]]) $ - LetE ("x149",[], PackedTy "Tree" "l144", ProjE 0 (VarE "tup145")) $ - Ext $ LetLocE "l146" (AfterVariableLE "x149" "l144" True) $ - LetE ("tup147",[], ProdTy [PackedTy "Tree" "l146", IntTy], - AppE "testprod" ["l143","l146"] + LetE ("x149",[], PackedTy "Tree" ("l144", []), ProjE 0 (VarE "tup145")) $ + Ext $ LetLocE ("l146", []) (AfterVariableLE "x149" ("l144", []) True) $ + LetE ("tup147",[], ProdTy [PackedTy "Tree" ("l146", []), IntTy], + AppE "testprod" [("l143", []),("l146", [])] [MkProdE [VarE "y142", VarE "i135"]]) $ - LetE ("y150",[], PackedTy "Tree" "l146", ProjE 0 (VarE "tup147")) $ - LetE ("node151",[], PackedTy "Tree" "lout133", - DataConE "lout133" "Node" [VarE "x149", VarE "y150"]) $ - LetE ("tup152",[],ProdTy [PackedTy "Tree" "lout133", IntTy], + LetE ("y150",[], PackedTy "Tree" ("l146", []), ProjE 0 (VarE "tup147")) $ + LetE ("node151",[], PackedTy "Tree" ("lout133", []), + DataConE ("lout133", []) "Node" [VarE "x149", VarE "y150"]) $ + LetE ("tup152",[],ProdTy [PackedTy "Tree" ("lout133", []), IntTy], MkProdE [VarE "node151", VarE "i135"]) $ VarE "tup152") ] @@ -768,8 +768,8 @@ testFlattenProg = Prog M.empty (M.fromList [("intAdd",intAddFun)]) $ Just (testF testFlattenBod :: Exp2 testFlattenBod = Ext $ LetRegionE (VarR "_") Undefined Nothing $ - Ext $ LetLocE "_" (StartOfRegionLE (VarR "_")) $ - Ext $ LetLocE "_" (AfterConstantLE 1 "_") $ + Ext $ LetLocE ("_", []) (StartOfRegionLE (VarR "_")) $ + Ext $ LetLocE ("_", []) (AfterConstantLE 1 ("_", [])) $ LetE ("v170",[],IntTy, LetE ("v171",[],IntTy, AppE "intAdd" [] @@ -789,8 +789,8 @@ stree = fromListDD [DDef (toVar "STree") [] , ("Inner",[ (False, IntTy) , (False, IntTy) -- this should be a boolean. -- for now, 1 is true, 0 is false - , (False, PackedTy "STree" "l") - , (False, PackedTy "STree" "l")]) + , (False, PackedTy "STree" ("l", [])) + , (False, PackedTy "STree" ("l", []))]) ]] {- @@ -814,35 +814,35 @@ sumUpFun = FunDef "sumUp" ["tr1"] sumUpFunTy sumUpFunBod (FunMeta Rec NoInline F where sumUpFunTy :: ArrowTy2 Ty2 sumUpFunTy = ArrowTy2 - [LRM "lin501" (VarR "r500") Input, LRM "lout502" (VarR "r756") Output] - [PackedTy "STree" "lin501"] + [LRM ("lin501", []) (VarR "r500") Input, LRM ("lout502", []) (VarR "r756") Output] + [PackedTy "STree" ("lin501", [])] (S.empty) - (PackedTy "STree" "lout502") + (PackedTy "STree" ("lout502", [])) [] False sumUpFunBod :: Exp2 sumUpFunBod = CaseE (VarE "tr1") - [ ("Leaf", [("n503","l504")], - LetE ("x505",[],PackedTy "STree" "lout502", - DataConE "lout502" "Leaf" [VarE "n503"]) $ + [ ("Leaf", [("n503",("l504", []))], + LetE ("x505",[],PackedTy "STree" ("lout502", []), + DataConE ("lout502", []) "Leaf" [VarE "n503"]) $ VarE "x505") - , ("Inner", [("i506","l507"),("b508","l509"),("x510","l511"),("y512","l513")], - Ext $ LetLocE "l514" (AfterConstantLE 1 "lout502") $ - Ext $ LetLocE "l550" (AfterVariableLE "i506" "l514" True) $ - Ext $ LetLocE "l551" (AfterVariableLE "b508" "l550" True) $ - LetE ("x515",[],PackedTy "STree" "l551", - AppE "sumUp" ["l511","l551"] [VarE "x510"]) $ - Ext $ LetLocE "l516" (AfterVariableLE "x515" "l551" True) $ - LetE ("y517",[],PackedTy "STree" "l516", - AppE "sumUp" ["l513","l516"] [VarE "y512"]) $ - LetE ("v518",[],IntTy, AppE "valueSTree" ["l551"] [VarE "x515"]) $ - LetE ("v519",[],IntTy, AppE "valueSTree" ["l516"] [VarE "y517"]) $ + , ("Inner", [("i506",("l507", [])),("b508", ("l509", [])),("x510", ("l511", [])),("y512", ("l513", []))], + Ext $ LetLocE ("l514", []) (AfterConstantLE 1 ("lout502", [])) $ + Ext $ LetLocE ("l550", []) (AfterVariableLE "i506" ("l514", []) True) $ + Ext $ LetLocE ("l551", []) (AfterVariableLE "b508" ("l550", []) True) $ + LetE ("x515",[],PackedTy "STree" ("l551", []), + AppE "sumUp" [("l511", []),("l551", [])] [VarE "x510"]) $ + Ext $ LetLocE ("l516", []) (AfterVariableLE "x515" ("l551", []) True) $ + LetE ("y517",[],PackedTy "STree" ("l516", []), + AppE "sumUp" [("l513", []),("l516", [])] [VarE "y512"]) $ + LetE ("v518",[],IntTy, AppE "valueSTree" [("l551", [])] [VarE "x515"]) $ + LetE ("v519",[],IntTy, AppE "valueSTree" [("l516", [])] [VarE "y517"]) $ LetE ("v520",[],IntTy, PrimAppE AddP [VarE "v518", VarE "v519"]) $ - LetE ("z521",[],PackedTy "STree" "lout502", - DataConE "lout502" "Inner" [VarE "v520", VarE "b508", + LetE ("z521",[],PackedTy "STree" ("lout502", []), + DataConE ("lout502", []) "Inner" [VarE "v520", VarE "b508", VarE "x515", VarE "y517"]) $ VarE "z521" )] @@ -853,8 +853,8 @@ valueSTreeFun = FunDef "valueSTree" ["tr522"] valueSTreeFunTy valueSTreeFunBod ( where valueSTreeFunTy :: ArrowTy2 Ty2 valueSTreeFunTy = ArrowTy2 - [LRM "lin524" (VarR "r523") Input] - [PackedTy "STree" "lin524"] + [LRM ("lin524", []) (VarR "r523") Input] + [PackedTy "STree" ("lin524", [])] (S.empty) (IntTy) [] @@ -862,10 +862,10 @@ valueSTreeFun = FunDef "valueSTree" ["tr522"] valueSTreeFunTy valueSTreeFunBod ( valueSTreeFunBod :: Exp2 valueSTreeFunBod = CaseE (VarE "tr522") - [ ("Leaf", [("n523","l524")], + [ ("Leaf", [("n523",("l524", []))], VarE "n523") - , ("Inner", [("i525","l526"),("b527","l528"),("x529","l530"),("y531","l532")], + , ("Inner", [("i525",("l526", [])),("b527",("l528", [])),("x529",("l530", [])),("y531",("l532", []))], VarE "i525" )] @@ -875,45 +875,45 @@ buildSTreeFun = FunDef "buildSTree" ["i543"] buildSTreeTy buildSTreeBod (FunMeta where buildSTreeTy :: ArrowTy2 Ty2 buildSTreeTy = ArrowTy2 - [LRM "lout541" (VarR "r540") Output] + [LRM ("lout541", []) (VarR "r540") Output] [IntTy] (S.empty) - (PackedTy "STree" "lout541") + (PackedTy "STree" ("lout541", [])) [] False buildSTreeBod :: Exp2 buildSTreeBod = LetE ("b542",[], BoolTy, PrimAppE EqIntP [VarE "i543", LitE 0]) $ IfE (VarE "b542") - (DataConE "lout541" "Leaf" [LitE 1]) + (DataConE ("lout541", []) "Leaf" [LitE 1]) (LetE ("i548",[], IntTy, PrimAppE SubP [VarE "i543", LitE 1]) $ LetE ("i554",[], IntTy, LitE 0) $ LetE ("b555",[], IntTy, LitE 0) $ - Ext $ LetLocE "l544" (AfterConstantLE 1 "lout541") $ - Ext $ LetLocE "l552" (AfterVariableLE "i554" "l544" True) $ - Ext $ LetLocE "l553" (AfterVariableLE "b555" "l552" True) $ - LetE ("x545",[],PackedTy "STree" "l553", - AppE "buildSTree" ["l553"] [VarE "i548"]) $ - Ext $ LetLocE "l545" (AfterVariableLE "x545" "l553" True) $ - LetE ("y546",[],PackedTy "STree" "l545", - AppE "buildSTree" ["l545"] [VarE "i548"]) $ - LetE ("a547",[],PackedTy "STree" "lout541", - DataConE "lout541" "Inner" [VarE "i554", VarE "b555", + Ext $ LetLocE ("l544", []) (AfterConstantLE 1 ("lout541", [])) $ + Ext $ LetLocE ("l552", []) (AfterVariableLE "i554" ("l544", []) True) $ + Ext $ LetLocE ("l553", []) (AfterVariableLE "b555" ("l552", []) True) $ + LetE ("x545",[],PackedTy "STree" ("l553", []), + AppE "buildSTree" [("l553", [])] [VarE "i548"]) $ + Ext $ LetLocE ("l545", []) (AfterVariableLE "x545" ("l553", []) True) $ + LetE ("y546",[],PackedTy "STree" ("l545", []), + AppE "buildSTree" [("l545", [])] [VarE "i548"]) $ + LetE ("a547",[],PackedTy "STree" ("lout541", []), + DataConE ("lout541", []) "Inner" [VarE "i554", VarE "b555", VarE "x545", VarE "y546"]) $ VarE "a547") buildSTreeMainExp :: Exp2 buildSTreeMainExp = Ext $ LetRegionE (VarR "r530") Undefined Nothing $ - Ext $ LetLocE "l531" (StartOfRegionLE (VarR "r530")) $ - LetE ("x532",[], PackedTy "STree" "l531", - AppE "buildSTree" ["l531"] [LitE 3]) $ + Ext $ LetLocE ("l531", []) (StartOfRegionLE (VarR "r530")) $ + LetE ("x532",[], PackedTy "STree" ("l531", []), + AppE "buildSTree" [("l531", [])] [LitE 3]) $ VarE "x532" buildSTreeProg :: Prog2 buildSTreeProg = Prog stree (M.fromList [("buildSTree", buildSTreeFun)]) - (Just (buildSTreeMainExp, PackedTy "STree" "l531")) + (Just (buildSTreeMainExp, PackedTy "STree" ("l531", []))) -------------------------------------------------------------------------------- @@ -923,8 +923,8 @@ sumSTreeFun = FunDef "sumSTree" ["tr762"] sumSTreeTy sumSTreeBod (FunMeta Rec No where sumSTreeTy :: ArrowTy2 Ty2 sumSTreeTy = ArrowTy2 - [LRM "lin761" (VarR "r760") Input] - [PackedTy "STree" "lin761"] + [LRM ("lin761", []) (VarR "r760") Input] + [PackedTy "STree" ("lin761", [])] (S.empty) (IntTy) [] @@ -932,14 +932,14 @@ sumSTreeFun = FunDef "sumSTree" ["tr762"] sumSTreeTy sumSTreeBod (FunMeta Rec No sumSTreeBod :: Exp2 sumSTreeBod = CaseE (VarE "tr762") - [ ("Leaf", [("n763", "l764")], + [ ("Leaf", [("n763", ("l764", []))], VarE "n763") - , ("Inner", [("i775","l776"),("b777","l778"), - ("x764","l765"), ("y766","l767")], + , ("Inner", [("i775", ("l776", [])),("b777", ("l778", [])), + ("x764", ("l765", [])), ("y766", ("l767", []))], LetE ("sx768", [], IntTy, - AppE "sumSTree" ["l765"] [VarE "x764"]) $ + AppE "sumSTree" [("l765", [])] [VarE "x764"]) $ LetE ("sy769", [], IntTy, - AppE "sumSTree" ["l767"] [VarE "y766"]) $ + AppE "sumSTree" [("l767", [])] [VarE "y766"]) $ LetE ("total770", [], IntTy , PrimAppE AddP [VarE "sx768", VarE "sy769"]) $ VarE "total770" @@ -947,11 +947,11 @@ sumSTreeFun = FunDef "sumSTree" ["tr762"] sumSTreeTy sumSTreeBod (FunMeta Rec No sumSTreeMainExp :: Exp2 sumSTreeMainExp = Ext $ LetRegionE (VarR "r771") Undefined Nothing $ - Ext $ LetLocE "l772" (StartOfRegionLE (VarR "r771")) $ - LetE ("tr773", [], PackedTy "STree" "l772", - AppE "buildSTree" ["l772"] [LitE 3]) $ + Ext $ LetLocE ("l772", []) (StartOfRegionLE (VarR "r771")) $ + LetE ("tr773", [], PackedTy "STree" ("l772", []), + AppE "buildSTree" [("l772", [])] [LitE 3]) $ LetE ("sum774", [], IntTy, - AppE "sumSTree" ["l772"] [VarE "tr773"]) $ + AppE "sumSTree" [("l772", [])] [VarE "tr773"]) $ VarE "sum774" sumSTreeProg :: Prog2 @@ -963,13 +963,13 @@ sumSTreeProg = Prog stree (M.fromList [("buildSTree", buildSTreeFun), sumUpMainExp :: Exp2 sumUpMainExp = Ext $ LetRegionE (VarR "r530") Undefined Nothing $ - Ext $ LetLocE "l531" (StartOfRegionLE (VarR "r530")) $ - LetE ("x532",[], PackedTy "STree" "l531", - AppE "buildSTree" ["l531"] [LitE 2]) $ + Ext $ LetLocE ("l531", []) (StartOfRegionLE (VarR "r530")) $ + LetE ("x532",[], PackedTy "STree" ("l531", []), + AppE "buildSTree" [("l531", [])] [LitE 2]) $ Ext $ LetRegionE (VarR "r536") Undefined Nothing $ - Ext $ LetLocE "l537" (StartOfRegionLE (VarR "r536")) $ - LetE ("z538",[],PackedTy "STree" "l537", - AppE "sumUp" ["l531","l537"] [VarE "x532"]) $ + Ext $ LetLocE ("l537", []) (StartOfRegionLE (VarR "r536")) $ + LetE ("z538",[],PackedTy "STree" ("l537", []), + AppE "sumUp" [("l531", []),("l537", [])] [VarE "x532"]) $ VarE "z538" sumUpProg :: Prog2 @@ -977,7 +977,7 @@ sumUpProg = Prog stree (M.fromList [("sumUp", sumUpFun) ,("valueSTree", valueSTreeFun) ,("buildSTree", buildSTreeFun) ]) - (Just (sumUpMainExp, PackedTy "STree" "l537")) + (Just (sumUpMainExp, PackedTy "STree" ("l537", []))) -------------------------------------------------------------------------------- @@ -1022,36 +1022,36 @@ setEvenFun = FunDef "setEven" ["tr570"] setEvenFunTy setEvenFunBod (FunMeta Rec where setEvenFunTy :: ArrowTy2 Ty2 setEvenFunTy = ArrowTy2 - [LRM "lin571" (VarR "r570") Input, LRM "lout572" (VarR "r757") Output] - [PackedTy "STree" "lin571"] + [LRM ("lin571", []) (VarR "r570") Input, LRM ("lout572", []) (VarR "r757") Output] + [PackedTy "STree" ("lin571", [])] (S.empty) - (PackedTy "STree" "lout572") + (PackedTy "STree" ("lout572", [])) [] False setEvenFunBod :: Exp2 setEvenFunBod = CaseE (VarE "tr570") - [ ("Leaf", [("n573","l574")], - LetE ("x575",[],PackedTy "STree" "lout572", - DataConE "lout572" "Leaf" [VarE "n573"]) $ + [ ("Leaf", [("n573",("l574", []))], + LetE ("x575",[],PackedTy "STree" ("lout572", []), + DataConE ("lout572", []) "Leaf" [VarE "n573"]) $ VarE "x575") - , ("Inner", [("i576","l577"),("b578","l579"),("x580","l581"),("y582","l583")], - Ext $ LetLocE "l584" (AfterConstantLE 1 "lout572") $ - Ext $ LetLocE "l585" (AfterVariableLE "i576" "l584" True) $ - Ext $ LetLocE "l586" (AfterVariableLE "b578" "l585" True) $ - LetE ("x587",[],PackedTy "STree" "l586", - AppE "setEven" ["l581","l586"] [VarE "x580"]) $ - Ext $ LetLocE "l588" (AfterVariableLE "x587" "l586" True) $ - LetE ("y589",[],PackedTy "STree" "l588", - AppE "setEven" ["l583","l588"] [VarE "y582"]) $ - LetE ("v590",[],IntTy, AppE "valueSTree" ["l586"] [VarE "x587"]) $ - LetE ("v591",[],IntTy, AppE "valueSTree" ["l588"] [VarE "y589"]) $ + , ("Inner", [("i576",("l577", [])),("b578",("l579", [])),("x580",("l581", [])),("y582",("l583", []))], + Ext $ LetLocE ("l584", []) (AfterConstantLE 1 ("lout572", [])) $ + Ext $ LetLocE ("l585", []) (AfterVariableLE "i576" ("l584", []) True) $ + Ext $ LetLocE ("l586", []) (AfterVariableLE "b578" ("l585", []) True) $ + LetE ("x587",[],PackedTy "STree" ("l586", []), + AppE "setEven" [("l581", []),("l586", [])] [VarE "x580"]) $ + Ext $ LetLocE ("l588", []) (AfterVariableLE "x587" ("l586", []) True) $ + LetE ("y589",[],PackedTy "STree" ("l588", []), + AppE "setEven" [("l583", []),("l588", [])] [VarE "y582"]) $ + LetE ("v590",[],IntTy, AppE "valueSTree" [("l586", [])] [VarE "x587"]) $ + LetE ("v591",[],IntTy, AppE "valueSTree" [("l588", [])] [VarE "y589"]) $ LetE ("v592",[],IntTy, PrimAppE AddP [VarE "v590", VarE "v591"]) $ LetE ("b593",[],IntTy, AppE "even" [] [VarE "v592"]) $ - LetE ("z594",[],PackedTy "STree" "lout572", - DataConE "lout572" "Inner" [VarE "i576", VarE "b593", + LetE ("z594",[],PackedTy "STree" ("lout572", []), + DataConE ("lout572", []) "Inner" [VarE "i576", VarE "b593", VarE "x587", VarE "y589"]) $ VarE "z594" )] @@ -1059,13 +1059,13 @@ setEvenFun = FunDef "setEven" ["tr570"] setEvenFunTy setEvenFunBod (FunMeta Rec setEvenMainExp :: Exp2 setEvenMainExp = Ext $ LetRegionE (VarR "r592") Undefined Nothing $ - Ext $ LetLocE "l593" (StartOfRegionLE (VarR "r592")) $ - LetE ("x594",[], PackedTy "STree" "l593", - AppE "buildSTree" ["l593"] [LitE 2]) $ + Ext $ LetLocE ("l593", []) (StartOfRegionLE (VarR "r592")) $ + LetE ("x594",[], PackedTy "STree" ("l593", []), + AppE "buildSTree" [("l593", [])] [LitE 2]) $ Ext $ LetRegionE (VarR "r595") Undefined Nothing $ - Ext $ LetLocE "l596" (StartOfRegionLE (VarR "r595")) $ - LetE ("z597",[],PackedTy "STree" "l596", - AppE "setEven" ["l593","l596"] [VarE "x594"]) $ + Ext $ LetLocE ("l596", []) (StartOfRegionLE (VarR "r595")) $ + LetE ("z597",[],PackedTy "STree" ("l596", []), + AppE "setEven" [("l593", []),("l596", [])] [VarE "x594"]) $ VarE "z597" @@ -1075,7 +1075,7 @@ setEvenProg = Prog stree (M.fromList [("setEven" , setEvenFun) ,("buildSTree", buildSTreeFun) ,("valueSTree", valueSTreeFun) ]) - (Just (setEvenMainExp, PackedTy "STree" "l596")) + (Just (setEvenMainExp, PackedTy "STree" ("l596", []))) -------------------------------------------------------------------------------- @@ -1105,42 +1105,42 @@ sumUpSetEvenFun = FunDef "sumUpSetEven" ["tr600"] sumUpSetEvenFunTy sumUpSetEven where sumUpSetEvenFunTy :: ArrowTy2 Ty2 sumUpSetEvenFunTy = ArrowTy2 - [LRM "lin601" (VarR "r600") Input, LRM "lout602" (VarR "r758") Output] - [PackedTy "STree" "lin601"] + [LRM ("lin601", []) (VarR "r600") Input, LRM ("lout602", []) (VarR "r758") Output] + [PackedTy "STree" ("lin601", [])] (S.empty) - (ProdTy [PackedTy "STree" "lout602", IntTy]) + (ProdTy [PackedTy "STree" ("lout602", []), IntTy]) [] False sumUpSetEvenFunBod :: Exp2 sumUpSetEvenFunBod = CaseE (VarE "tr600") - [ ("Leaf", [("n603","l604")], - LetE ("x605",[],PackedTy "STree" "lout602", - DataConE "lout602" "Leaf" [VarE "n603"]) $ - LetE ("tx606",[], ProdTy [PackedTy "STree" "lout602", IntTy], + [ ("Leaf", [("n603",("l604", []))], + LetE ("x605",[],PackedTy "STree" ("lout602", []), + DataConE ("lout602", []) "Leaf" [VarE "n603"]) $ + LetE ("tx606",[], ProdTy [PackedTy "STree" ("lout602", []), IntTy], MkProdE [VarE "x605", VarE "n603"]) $ VarE "tx606") - , ("Inner", [("i607","l608"),("b609","l610"),("x611","l612"),("y613","l622")], - Ext $ LetLocE "l614" (AfterConstantLE 1 "lout602") $ - Ext $ LetLocE "l615" (AfterVariableLE "i607" "l614" True) $ - Ext $ LetLocE "l616" (AfterVariableLE "b609" "l615" True) $ - LetE ("tx617",[], ProdTy [PackedTy "STree" "l616", IntTy], - AppE "sumUpSetEven" ["l612","l616"] [VarE "x611"]) $ - LetE ("x618",[],PackedTy "STree" "l616", ProjE 0 (VarE "tx617")) $ + , ("Inner", [("i607",("l608", [])),("b609", ("l610", [])),("x611", ("l612", [])),("y613", ("l622", []))], + Ext $ LetLocE ("l614", []) (AfterConstantLE 1 ("lout602", [])) $ + Ext $ LetLocE ("l615", []) (AfterVariableLE "i607" ("l614", []) True) $ + Ext $ LetLocE ("l616", []) (AfterVariableLE "b609" ("l615", []) True) $ + LetE ("tx617",[], ProdTy [PackedTy "STree" ("l616", []), IntTy], + AppE "sumUpSetEven" [("l612", []),("l616", [])] [VarE "x611"]) $ + LetE ("x618",[],PackedTy "STree" ("l616", []), ProjE 0 (VarE "tx617")) $ LetE ("v619",[],IntTy, ProjE 1 (VarE "tx617")) $ - Ext $ LetLocE "l620" (AfterVariableLE "x618" "l616" True) $ - LetE ("tx621",[],ProdTy [PackedTy "STree" "l620", IntTy], - AppE "sumUpSetEven" ["l622","l620"] [VarE "y613"]) $ - LetE ("y623",[],PackedTy "STree" "l620", ProjE 0 (VarE "tx621")) $ + Ext $ LetLocE ("l620", []) (AfterVariableLE "x618" ("l616", []) True) $ + LetE ("tx621",[],ProdTy [PackedTy "STree" ("l620", []), IntTy], + AppE "sumUpSetEven" [("l622", []),("l620", [])] [VarE "y613"]) $ + LetE ("y623",[],PackedTy "STree" ("l620", []), ProjE 0 (VarE "tx621")) $ LetE ("v624",[],IntTy, ProjE 1 (VarE "tx621")) $ LetE ("v625",[],IntTy, PrimAppE AddP [VarE "v619", VarE "v624"]) $ LetE ("b626",[],IntTy, AppE "even" [] [VarE "v625"]) $ - LetE ("z627",[],PackedTy "STree" "lout602", - DataConE "lout602" "Inner" [VarE "v625", VarE "b626", + LetE ("z627",[],PackedTy "STree" ("lout602", []), + DataConE ("lout602", []) "Inner" [VarE "v625", VarE "b626", VarE "x618", VarE "y623"]) $ - LetE ("tx638",[], ProdTy [PackedTy "STree" "lout602", IntTy], + LetE ("tx638",[], ProdTy [PackedTy "STree" ("lout602", []), IntTy], MkProdE [VarE "z627", VarE "v625"]) $ VarE "tx638") ] @@ -1148,13 +1148,13 @@ sumUpSetEvenFun = FunDef "sumUpSetEven" ["tr600"] sumUpSetEvenFunTy sumUpSetEven sumUpSetEvenExp :: Exp2 sumUpSetEvenExp = Ext $ LetRegionE (VarR "r628") Undefined Nothing $ - Ext $ LetLocE "l629" (StartOfRegionLE (VarR "r628")) $ - LetE ("z630",[], PackedTy "STree" "l629", - AppE "buildSTree" ["l629"] [LitE 3]) $ + Ext $ LetLocE ("l629", []) (StartOfRegionLE (VarR "r628")) $ + LetE ("z630",[], PackedTy "STree" ("l629", []), + AppE "buildSTree" [("l629", [])] [LitE 3]) $ Ext $ LetRegionE (VarR "r631") Undefined Nothing $ - Ext $ LetLocE "l632" (StartOfRegionLE (VarR "r631")) $ - LetE ("z633",[],ProdTy [PackedTy "STree" "l632", IntTy], - AppE "sumUpSetEven" ["l629","l632"] [VarE "z630"]) $ + Ext $ LetLocE ("l632", []) (StartOfRegionLE (VarR "r631")) $ + LetE ("z633",[],ProdTy [PackedTy "STree" ("l632", []), IntTy], + AppE "sumUpSetEven" [("l629", []),("l632", [])] [VarE "z630"]) $ VarE "z633" @@ -1163,7 +1163,7 @@ sumUpSetEvenProg = Prog stree (M.fromList [("sumUpSetEven", sumUpSetEvenFun) ,("even" , evenFun ) ,("buildSTree" , buildSTreeFun) ]) - (Just (sumUpSetEvenExp, ProdTy [PackedTy "STree" "l632", IntTy])) + (Just (sumUpSetEvenExp, ProdTy [PackedTy "STree" ("l632", []), IntTy])) -------------------------------------------------------------------------------- @@ -1189,8 +1189,8 @@ ddexpr = fromListDD [DDef (toVar "Expr") [] [ ("VARREF", [(False,IntTy)]) , ("INTLIT", [(False,IntTy)]) , ("LETE" , [(False,IntTy), - (False,PackedTy "Expr" "l"), - (False,PackedTy "Expr" "l")]) + (False,PackedTy "Expr" ("l", [])), + (False,PackedTy "Expr" ("l", []))]) ]] copyExprFun :: FunDef2 @@ -1198,29 +1198,29 @@ copyExprFun = FunDef "copyExpr" ["e700"] copyExprFunTy copyExprFunBod (FunMeta R where copyExprFunTy :: ArrowTy2 Ty2 copyExprFunTy = ArrowTy2 - [LRM "lin702" (VarR "r701") Input, - LRM "lout703" (VarR "r759") Output] - [PackedTy "Expr" "lin702"] + [LRM ("lin702", []) (VarR "r701") Input, + LRM ("lout703", []) (VarR "r759") Output] + [PackedTy "Expr" ("lin702", [])] (S.empty) - (PackedTy "Expr" "lout703") + (PackedTy "Expr" ("lout703", [])) [] False copyExprFunBod :: Exp2 copyExprFunBod = CaseE (VarE "e700") - [ ("VARREF", [("v704","l705")], - DataConE "lout703" "VARREF" [VarE "v704"] + [ ("VARREF", [("v704",("l705", []))], + DataConE ("lout703", []) "VARREF" [VarE "v704"] ) - , ("LETE", [("v706","l707"), ("rhs708", "l709"), ("bod710", "l711")], - Ext $ LetLocE "l712" (AfterConstantLE 1 "lout703") $ - Ext $ LetLocE "l713" (AfterVariableLE "v706" "l712" True) $ - LetE ("rhs714",[], PackedTy "Expr" "l713", - AppE "copyExpr" ["l709","l713"] [VarE "rhs708"]) $ - Ext $ LetLocE "l715" (AfterVariableLE "rhs714" "l713" True) $ - LetE ("bod716",[],PackedTy "Expr" "l715", - AppE "copyExpr" ["l711", "l715"] [VarE "bod710"]) $ - LetE ("z717",[],PackedTy "Expr" "lout703", - DataConE "lout703" "LETE" [VarE "v706", VarE "rhs714", VarE "bod716"]) $ + , ("LETE", [("v706",("l707", [])), ("rhs708", ("l709", [])), ("bod710", ("l711", []))], + Ext $ LetLocE ("l712", []) (AfterConstantLE 1 ("lout703", [])) $ + Ext $ LetLocE ("l713", []) (AfterVariableLE "v706" ("l712", []) True) $ + LetE ("rhs714",[], PackedTy "Expr" ("l713", []), + AppE "copyExpr" [("l709", []),("l713", [])] [VarE "rhs708"]) $ + Ext $ LetLocE ("l715", []) (AfterVariableLE "rhs714" ("l713", []) True) $ + LetE ("bod716",[],PackedTy "Expr" ("l715", []), + AppE "copyExpr" [("l711", []), ("l715", [])] [VarE "bod710"]) $ + LetE ("z717",[],PackedTy "Expr" ("lout703", []), + DataConE ("lout703", []) "LETE" [VarE "v706", VarE "rhs714", VarE "bod716"]) $ VarE "z717") ] @@ -1230,45 +1230,45 @@ substFun = FunDef "subst" ["tr653"] substFunTy substFunBod (FunMeta Rec NoInline where substFunTy :: ArrowTy2 Ty2 substFunTy = ArrowTy2 - [LRM "lin651" (VarR "r650") Input, - LRM "lin652" (VarR "r650") Input, - LRM "lout653" (VarR "r760") Output] + [LRM ("lin651", []) (VarR "r650") Input, + LRM ("lin652", []) (VarR "r650") Input, + LRM ("lout653", []) (VarR "r760") Output] [ProdTy [IntTy, - PackedTy "Expr" "lin651", - PackedTy "Expr" "lin652"]] + PackedTy "Expr" ("lin651", []), + PackedTy "Expr" ("lin652", [])]] (S.empty) - (PackedTy "Expr" "lout653") + (PackedTy "Expr" ("lout653", [])) [] False substFunBod :: Exp2 substFunBod = LetE ("old654",[],IntTy, ProjE 0 (VarE "tr653")) $ - LetE ("new655",[],PackedTy "Expr" "lin651", + LetE ("new655",[],PackedTy "Expr" ("lin651", []), ProjE 1 (VarE "tr653")) $ - LetE ("expr656",[],PackedTy "Expr" "lin652", + LetE ("expr656",[],PackedTy "Expr" ("lin652", []), ProjE 2 (VarE "tr653")) $ CaseE (VarE "expr656") - [ ("VARREF", [("v657","l658")], + [ ("VARREF", [("v657",("l658", []))], LetE ("b659",[], BoolTy, PrimAppE EqIntP [VarE "v657", VarE "old654"]) $ IfE (VarE "b659") - (AppE "copyExpr" ["lin651", "lout653"] [VarE "new655"]) - (DataConE "lout653" "VARREF" [VarE "v657"])) - , ("LETE", [("v656","l657"), ("rhs658","l659"), ("bod660", "l661")], + (AppE "copyExpr" [("lin651", []), ("lout653", [])] [VarE "new655"]) + (DataConE ("lout653", []) "VARREF" [VarE "v657"])) + , ("LETE", [("v656",("l657", [])), ("rhs658",("l659", [])), ("bod660", ("l661", []))], LetE ("b662",[],BoolTy, PrimAppE EqIntP [VarE "v656", VarE "old654"]) -- IfE (VarE "b662") - (Ext $ LetLocE "l663" (AfterConstantLE 1 "lout653") $ - Ext $ LetLocE "l664" (AfterVariableLE "v656" "l663" True) $ - LetE ("p668",[], ProdTy [IntTy, PackedTy "Expr" "lin651", PackedTy "Expr" "l659"], + (Ext $ LetLocE ("l663", []) (AfterConstantLE 1 ("lout653", [])) $ + Ext $ LetLocE ("l664", []) (AfterVariableLE "v656" ("l663", []) True) $ + LetE ("p668",[], ProdTy [IntTy, PackedTy "Expr" ("lin651", []), PackedTy "Expr" ("l659", [])], MkProdE [VarE "old654", VarE "new655", VarE "rhs658"]) $ - LetE ("rhs665",[],PackedTy "Expr" "l664", - AppE "subst" ["lin651", "l659", "l664"] [VarE "p668"]) $ - Ext $ LetLocE "l669" (AfterVariableLE "rhs665" "l664" True) $ - LetE ("bod670",[], PackedTy "Expr" "l669", - AppE "copyExpr" ["l661", "l669"] [VarE "bod660"]) $ - LetE ("z671",[], PackedTy "Expr" "lout653", - DataConE "lout653" "LETE" [VarE "v656", VarE "rhs665", VarE "bod670"]) $ + LetE ("rhs665",[],PackedTy "Expr" ("l664", []), + AppE "subst" [("lin651", []), ("l659", []), ("l664", [])] [VarE "p668"]) $ + Ext $ LetLocE ("l669", []) (AfterVariableLE "rhs665" ("l664", []) True) $ + LetE ("bod670",[], PackedTy "Expr" ("l669", []), + AppE "copyExpr" [("l661", []), ("l669", [])] [VarE "bod660"]) $ + LetE ("z671",[], PackedTy "Expr" ("lout653", []), + DataConE ("lout653", []) "LETE" [VarE "v656", VarE "rhs665", VarE "bod670"]) $ VarE "z671") ) ] @@ -1276,44 +1276,44 @@ substFun = FunDef "subst" ["tr653"] substFunTy substFunBod (FunMeta Rec NoInline substMainExp :: Exp2 substMainExp = Ext $ LetRegionE (VarR "r720") Undefined Nothing $ - Ext $ LetLocE "l721" (StartOfRegionLE (VarR "r720")) $ - Ext $ LetLocE "l722" (AfterConstantLE 1 "l721") $ - Ext $ LetLocE "l723" (AfterConstantLE 8 "l722") $ - LetE ("rhs724",[], PackedTy "Expr" "l723", - DataConE "l723" "VARREF" [LitE 1]) $ - Ext $ LetLocE "l724" (AfterVariableLE "rhs724" "l723" True) $ - LetE ("bod725",[], PackedTy "Expr" "l724", - DataConE "l724" "VARREF" [LitE 10]) $ + Ext $ LetLocE ("l721", []) (StartOfRegionLE (VarR "r720")) $ + Ext $ LetLocE ("l722", []) (AfterConstantLE 1 ("l721", [])) $ + Ext $ LetLocE ("l723", []) (AfterConstantLE 8 ("l722", [])) $ + LetE ("rhs724",[], PackedTy "Expr" ("l723", []), + DataConE ("l723", []) "VARREF" [LitE 1]) $ + Ext $ LetLocE ("l724", []) (AfterVariableLE "rhs724" ("l723", []) True) $ + LetE ("bod725",[], PackedTy "Expr" ("l724", []), + DataConE ("l724", []) "VARREF" [LitE 10]) $ LetE ("old726",[],IntTy,LitE 1) $ - LetE ("z727",[], PackedTy "Expr" "l721", - DataConE "l721" "LETE" [VarE "old726", VarE "rhs724", VarE "bod725"]) $ + LetE ("z727",[], PackedTy "Expr" ("l721", []), + DataConE ("l721", []) "LETE" [VarE "old726", VarE "rhs724", VarE "bod725"]) $ Ext $ LetRegionE (VarR "r728") Undefined Nothing $ - Ext $ LetLocE "l729" (StartOfRegionLE (VarR "r728")) $ - LetE ("new730",[],PackedTy "Expr" "l729", - DataConE "l729" "VARREF" [LitE 42]) $ - LetE ("p731",[],ProdTy [IntTy, PackedTy "Expr" "l729", PackedTy "Expr" "l721"], + Ext $ LetLocE ("l729", []) (StartOfRegionLE (VarR "r728")) $ + LetE ("new730",[],PackedTy "Expr" ("l729", []), + DataConE ("l729", []) "VARREF" [LitE 42]) $ + LetE ("p731",[],ProdTy [IntTy, PackedTy "Expr" ("l729", []), PackedTy "Expr" ("l721", [])], MkProdE [VarE "old726", VarE "new730", VarE "z727"]) $ - Ext $ LetLocE "l730" (AfterVariableLE "new730" "l729" True) $ - LetE ("z732",[], PackedTy "Expr" "l730", - AppE "subst" ["l729", "l721", "l730"] [VarE "p731"]) $ + Ext $ LetLocE ("l730", []) (AfterVariableLE "new730" ("l729", []) True) $ + LetE ("z732",[], PackedTy "Expr" ("l730", []), + AppE "subst" [("l729", []), ("l721", []), ("l730", [])] [VarE "p731"]) $ VarE "z732" substProg :: Prog2 substProg = Prog ddexpr (M.fromList [("subst", substFun), ("copyExpr", copyExprFun)]) - (Just (substMainExp, PackedTy "Expr" "l730")) + (Just (substMainExp, PackedTy "Expr" ("l730", []))) -------------------------------------------------------------------------------- ddtree' :: DDefs Ty2 ddtree' = fromListDD [DDef (toVar "Tree") [] [ ("Leaf",[(False,IntTy)]) - , ("Node",[ (False,PackedTy "Tree" "l") - , (False,PackedTy "Tree" "l")]) + , ("Node",[ (False,PackedTy "Tree" ("l", [])) + , (False,PackedTy "Tree" ("l", []))]) , ("Node^", [ (False,CursorTy) - , (False,PackedTy "Tree" "l") - , (False,PackedTy "Tree" "l")]) + , (False,PackedTy "Tree" ("l", [])) + , (False,PackedTy "Tree" ("l", []))]) , (indirectionTag++"1", [(False,CursorTy)]) ]] @@ -1325,44 +1325,44 @@ indrBuildTreeFun = FunDef "indrBuildTree" ["i270"] indrBuildTreeTy indrBuildTree where indrBuildTreeTy :: ArrowTy2 Ty2 indrBuildTreeTy = ArrowTy2 - [LRM "lout272" (VarR "r271") Output] + [LRM ("lout272", []) (VarR "r271") Output] [IntTy] (S.empty) - (PackedTy "Tree" "lout272") + (PackedTy "Tree" ("lout272", [])) [] False indrBuildTreeBod :: Exp2 indrBuildTreeBod = LetE ("b279",[], BoolTy, PrimAppE EqIntP [VarE "i270", LitE 0]) $ IfE (VarE "b279") - (DataConE "lout272" "Leaf" [LitE 1]) + (DataConE ("lout272", []) "Leaf" [LitE 1]) (LetE ("i273",[], IntTy, PrimAppE SubP [VarE "i270", LitE 1]) $ - Ext $ LetLocE "loc_indr" (AfterConstantLE 1 "lout272") $ - Ext $ LetLocE "l274" (AfterConstantLE 8 "loc_indr") $ - LetE ("x275",[],PackedTy "Tree" "l274", - AppE "indrBuildTree" ["l274"] [VarE "i273"]) $ - Ext $ LetLocE "l276" (AfterVariableLE "x275" "l274" True) $ - LetE ("y277",[],PackedTy "Tree" "l276", - AppE "indrBuildTree" ["l276"] [VarE "i273"]) $ + Ext $ LetLocE ("loc_indr", []) (AfterConstantLE 1 ("lout272", [])) $ + Ext $ LetLocE ("l274", []) (AfterConstantLE 8 ("loc_indr", [])) $ + LetE ("x275",[],PackedTy "Tree" ("l274", []), + AppE "indrBuildTree" [("l274", [])] [VarE "i273"]) $ + Ext $ LetLocE ("l276", []) (AfterVariableLE "x275" ("l274", []) True) $ + LetE ("y277",[],PackedTy "Tree" ("l276", []), + AppE "indrBuildTree" [("l276", [])] [VarE "i273"]) $ LetE ("indr_cur",[],CursorTy,Ext (StartOfPkdCursor "y277")) $ -- LetE ("indr_node",[], PackedTy "Tree" "loc_indr", -- DataConE "loc_indr" (indirectionTag++"1") [VarE "indr_cur"]) $ - LetE ("a278",[],PackedTy "Tree" "lout272", - DataConE "lout272" "Node^" [VarE "indr_cur", + LetE ("a278",[],PackedTy "Tree" ("lout272", []), + DataConE ("lout272", []) "Node^" [VarE "indr_cur", VarE "x275", VarE "y277"]) $ VarE "a278") indrBuildTreeMainExp :: Exp2 indrBuildTreeMainExp = Ext $ LetRegionE (VarR "r800") Undefined Nothing $ - Ext $ LetLocE "l801" (StartOfRegionLE (VarR "r800")) $ - LetE ("tr802", [], PackedTy "Tree" "l801", - AppE "indrBuildTree" ["l801"] [LitE 3]) $ + Ext $ LetLocE ("l801", []) (StartOfRegionLE (VarR "r800")) $ + LetE ("tr802", [], PackedTy "Tree" ("l801", []), + AppE "indrBuildTree" [("l801", [])] [LitE 3]) $ VarE "tr802" indrBuildTreeProg :: Prog2 indrBuildTreeProg = Prog ddtree' (M.fromList [("indrBuildTree", indrBuildTreeFun)]) - (Just (indrBuildTreeMainExp, PackedTy "Tree" "l801")) + (Just (indrBuildTreeMainExp, PackedTy "Tree" ("l801", []))) indrRightmostFun :: FunDef2 @@ -1370,8 +1370,8 @@ indrRightmostFun = FunDef "indrRightmost" ["t742"] indrRightmostTy indrRightmost where indrRightmostTy :: ArrowTy2 Ty2 indrRightmostTy = ArrowTy2 - [LRM "lin741" (VarR "r740") Input] - [PackedTy "Tree" "lin741"] + [LRM ("lin741", []) (VarR "r740") Input] + [PackedTy "Tree" ("lin741", [])] S.empty IntTy [] @@ -1379,19 +1379,19 @@ indrRightmostFun = FunDef "indrRightmost" ["t742"] indrRightmostTy indrRightmost indrRightmostBod :: Exp2 indrRightmostBod = CaseE (VarE "t742") - [("Leaf", [("n746","l747")], + [("Leaf", [("n746",("l747", []))], VarE "n746"), - ("Node^", [("indr_y750","lindr_y750"),("x748","l749"), ("y750","l751")], - LetE ("lm752",[],IntTy, AppE "indrRightmost" ["l751"] [VarE "y750"]) $ + ("Node^", [("indr_y750",("lindr_y750", [])),("x748",("l749", [])), ("y750",("l751", []))], + LetE ("lm752",[],IntTy, AppE "indrRightmost" [("l751", [])] [VarE "y750"]) $ VarE "lm752")] indrRightmostMainExp :: Exp2 indrRightmostMainExp = Ext $ LetRegionE (VarR "r753") Undefined Nothing $ - Ext $ LetLocE "l754" (StartOfRegionLE (VarR "r753")) $ - LetE ("tr1", [], PackedTy "Tree" "l754", - AppE "indrBuildTree" ["l754"] [LitE 3]) $ + Ext $ LetLocE ("l754", []) (StartOfRegionLE (VarR "r753")) $ + LetE ("tr1", [], PackedTy "Tree" ("l754", []), + AppE "indrBuildTree" [("l754", [])] [LitE 3]) $ LetE ("a760",[], IntTy, - AppE "indrRightmost" ["l754"] [VarE "tr1"]) $ + AppE "indrRightmost" [("l754", [])] [VarE "tr1"]) $ VarE "a760" indrRightmostProg :: Prog2 @@ -1406,19 +1406,19 @@ indrIDFun = FunDef "indrID" ["tr800"] indrIDTy indrIDBod (FunMeta NotRec NoInlin where indrIDTy :: ArrowTy2 Ty2 indrIDTy = ArrowTy2 - [LRM "lin802" (VarR "r801") Input, LRM "lout803" (VarR "r803") Output] - [PackedTy "Tree" "lin802"] + [LRM ("lin802", []) (VarR "r801") Input, LRM ("lout803", []) (VarR "r803") Output] + [PackedTy "Tree" ("lin802", [])] (S.empty) - (PackedTy "Tree" "lout803") + (PackedTy "Tree" ("lout803", [])) [] False indrIDBod :: Exp2 - indrIDBod = LetE ("a804",[], PackedTy "Tree" "lout803", + indrIDBod = LetE ("a804",[], PackedTy "Tree" ("lout803", []), Ext $ IndirectionE "Tree" (indirectionTag++"1") - ("lout803","r803") - ("lin802", "r801") + (("lout803", []),("r803", [])) + (("lin802", []), ("r801", [])) (LitE 10)) $ VarE "a804" @@ -1427,15 +1427,15 @@ indrIDFun = FunDef "indrID" ["tr800"] indrIDTy indrIDBod (FunMeta NotRec NoInlin indrIDMainExp :: Exp2 indrIDMainExp = Ext $ LetRegionE (VarR "r806") Undefined Nothing $ - Ext $ LetLocE "l807" (StartOfRegionLE (VarR "r806")) $ - LetE ("tr1",[], PackedTy "Tree" "l807", - AppE "indrBuildTree" ["l807"] [LitE 2]) $ + Ext $ LetLocE ("l807", []) (StartOfRegionLE (VarR "r806")) $ + LetE ("tr1",[], PackedTy "Tree" ("l807", []), + AppE "indrBuildTree" [("l807", [])] [LitE 2]) $ Ext $ LetRegionE (VarR "r808") Undefined Nothing $ - Ext $ LetLocE "l809" (StartOfRegionLE (VarR "r808")) $ - LetE ("tr2",[], PackedTy "Tree" "l809", - AppE "indrID" ["l807", "l809"] [VarE "tr1"]) $ + Ext $ LetLocE ("l809", []) (StartOfRegionLE (VarR "r808")) $ + LetE ("tr2",[], PackedTy "Tree" ("l809", []), + AppE "indrID" [("l807", []), ("l809", [])] [VarE "tr1"]) $ LetE ("rmost",[], IntTy, - AppE "indrRightmost" ["l809"] [VarE "tr2"]) $ + AppE "indrRightmost" [("l809", [])] [VarE "tr2"]) $ VarE "rmost" indrIDProg :: Prog2 @@ -1449,15 +1449,15 @@ indrIDProg = Prog ddtree' (M.fromList [("indrBuildTree", indrBuildTreeFun) indrIDSumMainExp :: Exp2 indrIDSumMainExp = Ext $ LetRegionE (VarR "r806") Undefined Nothing $ - Ext $ LetLocE "l807" (StartOfRegionLE (VarR "r806")) $ - LetE ("tr1",[], PackedTy "Tree" "l807", - AppE "buildTree" ["l807"] [LitE 10]) $ + Ext $ LetLocE ("l807", []) (StartOfRegionLE (VarR "r806")) $ + LetE ("tr1",[], PackedTy "Tree" ("l807", []), + AppE "buildTree" [("l807", [])] [LitE 10]) $ Ext $ LetRegionE (VarR "r808") Undefined Nothing $ - Ext $ LetLocE "l809" (StartOfRegionLE (VarR "r808")) $ - LetE ("tr2",[], PackedTy "Tree" "l809", - AppE "indrID" ["l807", "l809"] [VarE "tr1"]) $ + Ext $ LetLocE ("l809", []) (StartOfRegionLE (VarR "r808")) $ + LetE ("tr2",[], PackedTy "Tree" ("l809", []), + AppE "indrID" [("l807", []), ("l809", [])] [VarE "tr1"]) $ LetE ("total",[], IntTy, - AppE "sumTree" ["l809"] [VarE "tr2"]) $ + AppE "sumTree" [("l809", [])] [VarE "tr2"]) $ VarE "total" indrIDSumProg :: Prog2 @@ -1471,6 +1471,6 @@ indrIDSumProg = Prog ddtree' (M.fromList [("buildTree", buildTreeFun) ddsnoclist :: DDefs Ty2 ddsnoclist = fromListDD [DDef (toVar "SnocList") [] [ ("Nil" , []) - , ("Snoc" , [(False,PackedTy "SnocList" "l"), + , ("Snoc" , [(False,PackedTy "SnocList" ("l", [])), (False,IntTy)]) ]]