#include "HsVersions.h"
module SimplMonad (
- SmplM(..),
+ SYN_IE(SmplM),
initSmpl, returnSmpl, thenSmpl, thenSmpl_,
mapSmpl, mapAndUnzipSmpl,
-- Cloning
cloneId, cloneIds, cloneTyVarSmpl, newIds, newId
-
- -- and to make the interface self-sufficient...
) where
-import Ubiq{-uitous-}
+IMP_Ubiq(){-uitous-}
+IMPORT_1_3(Ix)
-import SmplLoop -- well, cheating sort of
+IMPORT_DELOOPER(SmplLoop) -- well, cheating sort of
-import Id ( mkSysLocal )
+import Id ( mkSysLocal, mkIdWithNewUniq )
+import CoreUnfold ( SimpleUnfolding )
import SimplEnv
import SrcLoc ( mkUnknownSrcLoc )
+import TyVar ( cloneTyVar )
import UniqSupply ( getUnique, getUniques, splitUniqSupply,
UniqSupply
)
import Util ( zipWithEqual, panic )
infixr 9 `thenSmpl`, `thenSmpl_`
-
-cloneTyVar = panic "cloneTyVar (SimplMonad)"
-mkIdWithNewUniq = panic "mkIdWithNewUniq (SimplMonad)"
\end{code}
%************************************************************************
| CaseOfError
| TyBetaReduction
| BetaReduction
+ | SpecialisationDone
{- BEGIN F/B ENTRIES -}
-- the 8 rules
| FoldrBuild -- foldr f z (build g) ==>
| Foldr_Cons_Nil -- foldr (:) [] => id
| Foldr_Cons -- foldr (:) => flip (++)
- | Str_FoldrStr -- foldr f z "hello" => unpackFoldrPS# f z "hello"
- | Str_UnpackCons -- unpackFoldrPS# (:) z "hello" => unpackAppendPS# z "hello"
- | Str_UnpackNil -- unpackAppendPS# [] "hello" => "hello"
+ | Str_FoldrStr -- foldr f z "hello" => unpackFoldrPS__ f z "hello"
+ | Str_UnpackCons -- unpackFoldrPS# (:) z "hello" => unpackAppendPS__ z "hello"
+ | Str_UnpackNil -- unpackAppendPS__ [] "hello" => "hello"
{- END F/B ENTRIES -}
deriving (Eq, Ord, Ix)
showsPrec p CaseOfError = showString "CaseOfError "
showsPrec p TyBetaReduction = showString "TyBetaReduction "
showsPrec p BetaReduction = showString "BetaReduction "
+ showsPrec p SpecialisationDone
+ = showString "Specialisation "
+
-- Foldr/Build Stuff:
showsPrec p FoldrBuild = showString "FoldrBuild "
showsPrec p FoldrAugment = showString "FoldrAugment "
(CaseOfError, 0),
(TyBetaReduction,0),
(BetaReduction,0),
+ (SpecialisationDone,0),
-- Foldr/Build Stuff:
(FoldrBuild, 0),
(FoldrAugment, 0),
tickN :: TickType -> Int -> SmplM ()
+tickN tick_type 0 us counts
+ = ((), counts)
tickN tick_type IBOX(increment) us (SimplCount n stuff)
= ((), SimplCount (n _ADD_ increment)
#ifdef OMIT_SIMPL_COUNTS
#else
combineSimplCounts (SimplCount n1 stuff1) (SimplCount n2 stuff2)
= SimplCount (n1 _ADD_ n2)
- (zipWithEqual (\ (t1,c1) (t2,c2) -> (t1,c1+c2)) stuff1 stuff2)
+ (zipWithEqual "combineSimplCounts" (\ (t1,c1) (t2,c2) -> (t1,c1+c2)) stuff1 stuff2)
#endif
\end{code}
newIds :: [Type] -> SmplM [Id]
newIds tys us sc
- = (zipWithEqual mk_id tys uniqs, sc)
+ = (zipWithEqual "newIds" mk_id tys uniqs, sc)
where
uniqs = getUniques (length tys) us
mk_id ty uniq = mkSysLocal SLIT("s") uniq ty mkUnknownSrcLoc