bottomIsGuaranteed, workerExists,
)
import CoreSyn ( CoreExpr, CoreBinding, GenCoreExpr, GenCoreBinding(..) )
-import CoreUnfold ( calcUnfoldingGuidance, UnfoldingGuidance(..), Unfolding )
-import FreeVars ( addExprFVs )
+import CoreUnfold ( calcUnfoldingGuidance, UnfoldingGuidance(..), Unfolding,
+ okToUnfoldInHiFile
+ )
+import FreeVars ( exprFreeVars )
import Name ( isLocallyDefined, isWiredInName, modAndOcc, nameModule, pprOccName,
OccName, occNameString, nameOccName, nameString, isExported,
Name {-instance NamedThing-}, Provenance, NamedThing(..)
Nothing -> return Nothing -- not producing any .hi file
Just fn -> do
if_hdl <- openFile fn WriteMode
- hPutStrLn if_hdl ("_interface_ "++ _UNPK_ mod ++ ' ':show (PROJECTVERSION :: Int))
+ hPutStrLn if_hdl ("_interface_ "++ _UNPK_ mod ++ ' ':show (opt_HiVersion :: Int))
return (Just if_hdl)
endIface Nothing = return ()
mod = nameModule (availName avail)
-- Print one module's worth of stuff
+ do_one_module :: (Module, [AvailInfo]) -> SDoc
do_one_module (mod_name, avails@(avail1:_))
= hsep [pp_hif (ifaceFlavour (availName avail1)),
pprModule mod_name,
unfolding_is_ok
= case inline_pragma of
- IMustBeINLINEd -> True
- IWantToBeINLINEd -> True
- IMustNotBeINLINEd -> False
- NoPragmaInfo -> case guidance of
+ IMustBeINLINEd -> definitely_ok_to_unfold
+ IWantToBeINLINEd -> definitely_ok_to_unfold
+ IDontWantToBeINLINEd -> False
+ IMustNotBeINLINEd -> False
+ NoPragmaInfo -> case guidance of
UnfoldNever -> False -- Too big
- other -> True
+ other -> definitely_ok_to_unfold
+ definitely_ok_to_unfold = okToUnfoldInHiFile rhs
guidance = calcUnfoldingGuidance opt_InterfaceUnfoldThreshold rhs
------------ Specialisations --------------
find_fvs expr = free_vars
where
- (_,free_vars) = addExprFVs interesting emptyIdSet expr
- interesting bound id = isLocallyDefined id &&
- not (id `elementOfIdSet` bound) &&
- not (omitIfaceSigForId id)
+ free_vars = exprFreeVars interesting expr
+ interesting id = isLocallyDefined id &&
+ not (omitIfaceSigForId id)
\end{code}
\begin{code}