@@ -1,4 +1,4 @@
1−module CodeGen.IL.Optimizer.TCO (tco) where
1+module CodeGen.IL.Optimizer.TCO (tco, tcoLoop) where
3import Prelude.Compat
3import Prelude.Compat
@@ -11,19 +11,22 @@ import CodeGen.IL.Common
12import qualified Language.PureScript.Constants as C
12import qualified Language.PureScript.Constants as C
15+tcoLoop = "__tco_loop"
14tco :: AST -> AST -> AST
17tco :: AST -> AST -> AST
15tco mn = everywhere convert where
18tco mn = everywhere convert where
16 tcoVar :: Text -> Text
19 tcoVar :: Text -> Text
17− tcoVar arg = "ᵗ" <> arg
20+ tcoVar arg = "__tco_var_" <> arg
19 copyVar :: Text -> Text
22 copyVar :: Text -> Text
20− copyVar arg = "ᶜ" <> arg
23+ copyVar arg = "__copy_" <> arg
22 tcoDone :: Text
25 tcoDone :: Text
23− tcoDone = "ᵗᶜdone"
26+ tcoDone = "__tco_done"
25 tcoResult :: Text
28 tcoResult :: Text
26− tcoResult = "ᵗᶜresult"
29+ tcoResult = "__tco_result"
28 convert :: AST -> AST
31 convert :: AST -> AST
29 convert fn@(Function ss (Just name) args _)
32 convert fn@(Function ss (Just name) args _)