summaryrefslogtreecommitdiff
path: root/Liveness.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Liveness.hs')
-rw-r--r--Liveness.hs6
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