summaryrefslogtreecommitdiff
path: root/Main.hs
diff options
context:
space:
mode:
authortomsmeding <tom.smeding@gmail.com>2019-11-30 09:07:55 +0100
committertomsmeding <tom.smeding@gmail.com>2019-11-30 10:20:57 +0100
commitd4a795139f6e642441f0b497663d35f025a9480c (patch)
tree16459ec77c9d84f79406f8714f07af85b29f4623 /Main.hs
parentecd369e0fbdc71c74ccd327899f8915045a01630 (diff)
TODO note in Main about stackification
Diffstat (limited to 'Main.hs')
-rw-r--r--Main.hs11
1 files changed, 11 insertions, 0 deletions
diff --git a/Main.hs b/Main.hs
index c378dde..2173653 100644
--- a/Main.hs
+++ b/Main.hs
@@ -38,6 +38,17 @@ parseOptions' (_, Just _) (_:_) = putStrLn "At most one filename argument expect
parseOptions :: [String] -> IO (Options, Maybe FilePath)
parseOptions = parseOptions' (Options False False, Nothing)
+-- TODO: Note about stackification. Temporaries need to be pushed before
+-- a call if they're live after it and they could, conceivably, be wrongly
+-- mutated by the called function otherwise. This has a couple of
+-- interesting consequences:
+-- 1. No temporaries ever need to be pushed from the global context, or
+-- "main function", since they can never be wrongly mutated: that
+-- requires re-entering the function in which they were defined, but one
+-- can never re-enter the "main function".
+-- 2. No temporaries ever need to be pushed before a tail call; since no
+-- local variables are live after it (obviously). (Global variables are
+-- covered by point (1.).)
liveness :: IRProgram -> Map.Map Int [Set.Set Int]
liveness (IRProgram bbs _ _) =
let sets = livenessAnalysis bbs bidOf itemsOf outEdges fread fwrite