X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Fcmm%2FCmmOpt.hs;h=5f6654e6f9e486cee0b5a99d1e285649c789483a;hb=16dc208aaad7aadaea970e47b8055d7d7f8781e5;hp=aa0c82180905adc0971446f68d5f9e92a5139f01;hpb=207802589da0d23c3f16195f453b24a1e46e322d;p=ghc-hetmet.git diff --git a/compiler/cmm/CmmOpt.hs b/compiler/cmm/CmmOpt.hs index aa0c821..5f6654e 100644 --- a/compiler/cmm/CmmOpt.hs +++ b/compiler/cmm/CmmOpt.hs @@ -6,6 +6,13 @@ -- ----------------------------------------------------------------------------- +{-# OPTIONS -w #-} +-- The above warning supression flag is a temporary kludge. +-- While working on this module you are encouraged to remove it and fix +-- any warnings in the module. See +-- http://hackage.haskell.org/trac/ghc/wiki/Commentary/CodingStyle#Warnings +-- for details + module CmmOpt ( cmmMiniInline, cmmMachOpFold, @@ -18,7 +25,6 @@ import Cmm import CmmUtils import CLabel import MachOp -import SMRep import StaticFlags import UniqFM @@ -140,9 +146,9 @@ lookForInline u expr (stmt:stmts) getStmtUses :: CmmStmt -> UniqFM Int getStmtUses (CmmAssign _ e) = getExprUses e getStmtUses (CmmStore e1 e2) = plusUFM_C (+) (getExprUses e1) (getExprUses e2) -getStmtUses (CmmCall target _ es) +getStmtUses (CmmCall target _ es _ _) = plusUFM_C (+) (uses target) (getExprsUses (map fst es)) - where uses (CmmForeignCall e _) = getExprUses e + where uses (CmmCallee e _) = getExprUses e uses _ = emptyUFM getStmtUses (CmmCondBranch e _) = getExprUses e getStmtUses (CmmSwitch e _) = getExprUses e @@ -161,9 +167,9 @@ getExprsUses es = foldr (plusUFM_C (+)) emptyUFM (map getExprUses es) inlineStmt :: Unique -> CmmExpr -> CmmStmt -> CmmStmt inlineStmt u a (CmmAssign r e) = CmmAssign r (inlineExpr u a e) inlineStmt u a (CmmStore e1 e2) = CmmStore (inlineExpr u a e1) (inlineExpr u a e2) -inlineStmt u a (CmmCall target regs es) - = CmmCall (infn target) regs es' - where infn (CmmForeignCall fn cconv) = CmmForeignCall fn cconv +inlineStmt u a (CmmCall target regs es srt ret) + = CmmCall (infn target) regs es' srt ret + where infn (CmmCallee fn cconv) = CmmCallee fn cconv infn (CmmPrim p) = CmmPrim p es' = [ (inlineExpr u a e, hint) | (e,hint) <- es ] inlineStmt u a (CmmCondBranch e d) = CmmCondBranch (inlineExpr u a e) d @@ -531,12 +537,12 @@ narrowS _ _ = panic "narrowTo" except factorial, but what the hell. -} -cmmLoopifyForC :: CmmTop -> CmmTop -cmmLoopifyForC p@(CmmProc info entry_lbl [] blocks@(BasicBlock top_id _ : _)) +cmmLoopifyForC :: RawCmmTop -> RawCmmTop +cmmLoopifyForC p@(CmmProc info entry_lbl [] (ListGraph blocks@(BasicBlock top_id _ : _))) | null info = p -- only if there's an info table, ignore case alts | otherwise = -- pprTrace "jump_lbl" (ppr jump_lbl <+> ppr entry_lbl) $ - CmmProc info entry_lbl [] blocks' + CmmProc info entry_lbl [] (ListGraph blocks') where blocks' = [ BasicBlock id (map do_stmt stmts) | BasicBlock id stmts <- blocks ]