diff options
Diffstat (limited to 'compiler/codeGen/StgCmmEnv.hs')
-rw-r--r-- | compiler/codeGen/StgCmmEnv.hs | 28 |
1 files changed, 6 insertions, 22 deletions
diff --git a/compiler/codeGen/StgCmmEnv.hs b/compiler/codeGen/StgCmmEnv.hs index ec4c75f0bc..44d3df84ee 100644 --- a/compiler/codeGen/StgCmmEnv.hs +++ b/compiler/codeGen/StgCmmEnv.hs @@ -19,8 +19,7 @@ module StgCmmEnv ( bindArgsToRegs, bindToReg, rebindToReg, bindArgToReg, idToReg, - getArgAmode, getArgAmode_no_rubbish, - getNonVoidArgAmodes, getNonVoidArgAmodes_no_rubbish, + getArgAmode, getNonVoidArgAmodes, getCgIdInfo, maybeLetNoEscape, ) where @@ -37,7 +36,6 @@ import CLabel import BlockId import CmmExpr import CmmUtils -import Control.Monad import DynFlags import Id import MkGraph @@ -166,19 +164,11 @@ cgLookupPanic id -------------------- -getArgAmode :: NonVoid StgArg -> FCode CmmArg -getArgAmode (NonVoid (StgVarArg var)) = - do { info <- getCgIdInfo var; return (CmmExprArg (idInfoToAmode info)) } -getArgAmode (NonVoid (StgLitArg lit)) = liftM (CmmExprArg . CmmLit) $ cgLit lit -getArgAmode (NonVoid (StgRubbishArg ty)) = return (CmmRubbishArg ty) - -getArgAmode_no_rubbish :: NonVoid StgArg -> FCode CmmExpr -getArgAmode_no_rubbish (NonVoid (StgVarArg var)) = - do { info <- getCgIdInfo var; return (idInfoToAmode info) } -getArgAmode_no_rubbish (NonVoid (StgLitArg lit)) = liftM CmmLit $ cgLit lit -getArgAmode_no_rubbish arg@(NonVoid (StgRubbishArg _)) = pprPanic "getArgAmode_no_rubbish" (ppr arg) - -getNonVoidArgAmodes :: [StgArg] -> FCode [CmmArg] +getArgAmode :: NonVoid StgArg -> FCode CmmExpr +getArgAmode (NonVoid (StgVarArg var)) = idInfoToAmode <$> getCgIdInfo var +getArgAmode (NonVoid (StgLitArg lit)) = CmmLit <$> cgLit lit + +getNonVoidArgAmodes :: [StgArg] -> FCode [CmmExpr] -- NB: Filters out void args, -- so the result list may be shorter than the argument list getNonVoidArgAmodes [] = return [] @@ -188,12 +178,6 @@ getNonVoidArgAmodes (arg:args) ; amodes <- getNonVoidArgAmodes args ; return ( amode : amodes ) } --- This version assumes arguments are not rubbish. I think this assumption holds --- as long as we don't pass unboxed sums to primops and foreign fns. -getNonVoidArgAmodes_no_rubbish :: [StgArg] -> FCode [CmmExpr] -getNonVoidArgAmodes_no_rubbish - = mapM (getArgAmode_no_rubbish . NonVoid) . filter (not . isVoidRep . argPrimRep) - ------------------------------------------------------------------------ -- Interface functions for binding and re-binding names |