diff options
author | tomsmeding <tom.smeding@gmail.com> | 2019-12-12 20:38:34 +0100 |
---|---|---|
committer | tomsmeding <tom.smeding@gmail.com> | 2019-12-12 21:02:12 +0100 |
commit | 80fee1089b659a7c7ee3a96d4cf999d369c0eb48 (patch) | |
tree | 8f11401ce0cfb77180628ce51dc7b49a5d3ac86e | |
parent | eee7489ade3862519c1feb7dece04570469a1da3 (diff) |
Liveness: report live variables before AND after instruction
-rw-r--r-- | Liveness.hs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Liveness.hs b/Liveness.hs index 40c555b..a40c7de 100644 --- a/Liveness.hs +++ b/Liveness.hs @@ -22,10 +22,12 @@ livenessAnalysis -> (bb -> [bbid]) -- control flow graph: subsequents of a basic block -> (ins -> set var) -- read set (variables required to be live when entering this instruction) -> (ins -> set var) -- write set (variables made available after this instruction) - -> [[Set var]] -- variables live at the start of that instruction + -> [[(Set var, Set var)]] -- variables live (before, after) that instruction livenessAnalysis bblocks bidOf bbInss bbNexts fread fwrite = let bbEndLive = computeFlow (Map.fromList (map (,Set.empty) bids)) - in zipWith (\fs endlive -> init (scanr id endlive fs)) (mapToList insTransFs) (mapToList bbEndLive) + in zipWith (\fs endlive -> let lives = scanr id endlive fs + in zip lives (tail lives)) + (mapToList insTransFs) (mapToList bbEndLive) where mapToList m = map (m Map.!) bids bids = map bidOf bblocks |