diff options
author | Michael D. Adams <t-madams@microsoft.com> | 2007-05-18 18:00:04 +0000 |
---|---|---|
committer | Michael D. Adams <t-madams@microsoft.com> | 2007-05-18 18:00:04 +0000 |
commit | b4fd46494dc922a8e1134c9396cada1f10e74e55 (patch) | |
tree | 065f3b3a25174430c52f4e2a6b094fd00c086161 /compiler/cmm/Dataflow.hs | |
parent | a20e8369c11f0f71444f2b849e47eaab6fff1315 (diff) | |
download | haskell-b4fd46494dc922a8e1134c9396cada1f10e74e55.tar.gz |
Second working draft of a CPS algorithm for C--.
This is a safety check-in, before I begin a cleanup.
Diffstat (limited to 'compiler/cmm/Dataflow.hs')
-rw-r--r-- | compiler/cmm/Dataflow.hs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/compiler/cmm/Dataflow.hs b/compiler/cmm/Dataflow.hs index 96565c3c58..093a8a6430 100644 --- a/compiler/cmm/Dataflow.hs +++ b/compiler/cmm/Dataflow.hs @@ -1,4 +1,4 @@ -module Dataflow (cmmLivenessComment, cmmLiveness, CmmLive) where +module Dataflow {-(fixedpoint, cmmLivenessComment, cmmLiveness, CmmLive)-} where import Cmm import PprCmm () @@ -36,6 +36,9 @@ cmmBranchTargets (BasicBlock _ stmts) = -- The variables that were made live and killed respectively type CmmLive = UniqSet LocalReg + +type BlockEntryLiveness = BlockEnv CmmLive -- The variables live on entry to each block + addLive new_live live = live `unionUniqSets` new_live addKilled new_killed live = live `minusUniqSet` new_killed @@ -106,7 +109,7 @@ cmmBlockUpdate blocks node _ state = cmmBlockDependants :: UniqFM {-BlockId-} (UniqSet BlockId) -> BlockId -> [BlockId] cmmBlockDependants sources ident = - uniqSetToList $ lookupWithDefaultUFM sources emptyUFM ident + uniqSetToList $ lookupWithDefaultUFM sources emptyUniqSet ident cmmBlockSourcesAndTargets :: [CmmBasicBlock] @@ -124,7 +127,7 @@ cmmBlockNames :: [CmmBasicBlock] -> UniqFM {-BlockId-} CmmBasicBlock cmmBlockNames blocks = listToUFM $ map block_name blocks where block_name b = (blockId b, b) -cmmLiveness :: [CmmBasicBlock] -> UniqFM {-BlockId-} CmmLive +cmmLiveness :: [CmmBasicBlock] -> BlockEnv CmmLive cmmLiveness blocks = fixedpoint (cmmBlockDependants sources) (cmmBlockUpdate blocks') (map blockId blocks) (listToUFM [(blockId b, emptyUniqSet) | b <- blocks]) where |