module CoreLint (
lintCoreBindings,
lintUnfolding,
- beginPass, endPass, endPassWithRules
+ showPass, endPass, endPassWithRules
) where
#include "HsVersions.h"
import IO ( hPutStr, hPutStrLn, stdout )
-import CmdLineOpts ( DynFlags, dopt_D_show_passes, dopt_DoCoreLinting,
- opt_PprStyle_Debug )
import CoreSyn
import Rules ( RuleBase, pprRuleBase )
import CoreFVs ( idFreeVars, mustHaveLocalBinding )
import Subst ( mkTyVarSubst, substTy )
import Name ( getSrcLoc )
import PprCore
-import ErrUtils ( doIfSet_dyn, dumpIfSet, ghcExit, Message,
+import ErrUtils ( doIfSet_dyn, dumpIfSet, ghcExit, Message, showPass,
ErrMsg, addErrLocHdrLine, pprBagOfErrors,
WarnMsg, pprBagOfWarnings)
import SrcLoc ( SrcLoc, noSrcLoc )
isUnboxedTupleType,
hasMoreBoxityInfo
)
-import TyCon ( TyCon, isPrimTyCon, tyConDataCons )
+import TyCon ( isPrimTyCon )
import BasicTypes ( RecFlag(..), isNonRec )
+import CmdLineOpts
import Maybe
import Outputable
and do Core Lint when necessary.
\begin{code}
-beginPass :: DynFlags -> String -> IO ()
-beginPass dflags pass_name
- | dopt_D_show_passes dflags
- = hPutStrLn stdout ("*** " ++ pass_name)
- | otherwise
- = return ()
-
-
endPass :: DynFlags -> String -> Bool -> [CoreBind] -> IO [CoreBind]
endPass dflags pass_name dump_flag binds
= do
-- Report result size if required
-- This has the side effect of forcing the intermediate to be evaluated
- if dopt_D_show_passes dflags then
+ if dopt Opt_D_show_passes dflags then
hPutStrLn stdout (" Result size = " ++ show (coreBindsSize binds))
else
return ()
lintCoreBindings :: DynFlags -> String -> [CoreBind] -> IO ()
lintCoreBindings dflags whoDunnit binds
- | not (dopt_DoCoreLinting dflags)
+ | not (dopt Opt_DoCoreLinting dflags)
= return ()
lintCoreBindings dflags whoDunnit binds
returnL ()
lint_bind (NonRec bndr rhs) = lintSingleBinding NonRecursive (bndr,rhs)
- done_lint = doIfSet_dyn dflags dopt_D_show_passes
+ done_lint = doIfSet_dyn dflags Opt_D_show_passes
(hPutStr stdout ("*** Core Linted result of " ++ whoDunnit ++ "\n"))
warn warnings
= vcat [
-> (Maybe Message, Maybe Message) -- (Nothing,_) => OK
lintUnfolding dflags locn vars expr
- | not (dopt_DoCoreLinting dflags)
+ | not (dopt Opt_DoCoreLinting dflags)
= (Nothing, Nothing)
| otherwise