X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Fcmm%2FCmmContFlowOpt.hs;h=8f4e3f5ce87118671c90a7d3b3d6c1ee1ee51dfc;hb=08652e67c4d5d9a40687f93c286021a867c1bca0;hp=7581d81fdb04e3eea1e3e43a1332faf78360d47f;hpb=c0a5a5d2e41341046aaf37c1d2155372e7ed3ee8;p=ghc-hetmet.git diff --git a/compiler/cmm/CmmContFlowOpt.hs b/compiler/cmm/CmmContFlowOpt.hs index 7581d81..8f4e3f5 100644 --- a/compiler/cmm/CmmContFlowOpt.hs +++ b/compiler/cmm/CmmContFlowOpt.hs @@ -1,4 +1,4 @@ -{-# OPTIONS -Wall -fno-warn-name-shadowing #-} + module CmmContFlowOpt ( runCmmOpts, cmmCfgOpts, cmmCfgOptsZ , branchChainElimZ, removeUnreachableBlocksZ @@ -85,7 +85,7 @@ branchChainElimZ g@(G.LGraph eid _) lookup id = G.lookupBlockEnv env id `orElse` id isLoneBranchZ :: CmmBlock -> Either (G.BlockId, G.BlockId) CmmBlock -isLoneBranchZ (G.Block id (G.ZLast (G.LastOther (LastBranch target [])))) +isLoneBranchZ (G.Block id (G.ZLast (G.LastOther (LastBranch target)))) | id /= target = Left (id,target) isLoneBranchZ other = Right other -- ^ An infinite loop is not a link in a branch chain! @@ -93,12 +93,12 @@ isLoneBranchZ other = Right other replaceLabelsZ :: BlockEnv G.BlockId -> CmmGraph -> CmmGraph replaceLabelsZ env = replace_eid . G.map_nodes id id last where - replace_eid (G.LGraph eid blocks) = G.LGraph (lookup eid) blocks - last (LastBranch id args) = LastBranch (lookup id) args - last (LastCondBranch e ti fi) = LastCondBranch e (lookup ti) (lookup fi) - last (LastSwitch e tbl) = LastSwitch e (map (fmap lookup) tbl) - last (LastCall tgt args (Just id)) = LastCall tgt args (Just $ lookup id) - last exit_jump_return = exit_jump_return + replace_eid (G.LGraph eid blocks) = G.LGraph (lookup eid) blocks + last (LastBranch id) = LastBranch (lookup id) + last (LastCondBranch e ti fi) = LastCondBranch e (lookup ti) (lookup fi) + last (LastSwitch e tbl) = LastSwitch e (map (fmap lookup) tbl) + last (LastCall tgt (Just id)) = LastCall tgt (Just $ lookup id) + last exit_jump_return = exit_jump_return lookup id = G.lookupBlockEnv env id `orElse` id ---------------------------------------------------------------- mkClosureBlockEnv :: [(BlockId, BlockId)] -> BlockEnv BlockId