X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Fmain%2FDynFlags.hs;h=a176a7345e034375286595744e84abb2bbe01b7c;hb=1df34b328128f4949ef812c8be952ab1f85df7ac;hp=9a8804aa0baa9fe9beff8a3cac05c09dd6945e12;hpb=190f24892156953d73b55401d0467a6f1a88ce5d;p=ghc-hetmet.git diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs index 9a8804a..a176a73 100644 --- a/compiler/main/DynFlags.hs +++ b/compiler/main/DynFlags.hs @@ -69,20 +69,23 @@ import UniqFM ( UniqFM ) import Util ( notNull, splitLongestPrefix, normalisePath ) import Maybes ( fromJust, orElse ) import SrcLoc ( SrcSpan ) +import Outputable +import {-# SOURCE #-} ErrUtils ( Severity(..), Message, mkLocMessage ) -import DATA_IOREF ( readIORef ) -import EXCEPTION ( throwDyn ) -import Monad ( when ) +import Data.IORef ( readIORef ) +import Control.Exception ( throwDyn ) +import Control.Monad ( when ) #ifdef mingw32_TARGET_OS import Data.List ( isPrefixOf ) #else import Util ( split ) #endif -import Char ( isDigit, isUpper ) -import Outputable +import Data.Char ( isDigit, isUpper ) import System.IO ( hPutStrLn, stderr ) -import {-# SOURCE #-} ErrUtils ( Severity(..), Message, mkLocMessage ) + +import Breakpoints ( BkptHandler ) +import Module ( ModuleName ) -- ----------------------------------------------------------------------------- -- DynFlags @@ -121,6 +124,7 @@ data DynFlag | Opt_D_dump_splices | Opt_D_dump_BCOs | Opt_D_dump_vect + | Opt_D_dump_hpc | Opt_D_source_stats | Opt_D_verbose_core2core | Opt_D_verbose_stg2stg @@ -196,6 +200,7 @@ data DynFlag | Opt_SplitObjs | Opt_StgStats | Opt_HideAllPackages + | Opt_Debugging | Opt_PrintBindResult | Opt_Haddock @@ -255,6 +260,8 @@ data DynFlags = DynFlags { ghcUsagePath :: FilePath, -- Filled in by SysTools ghciUsagePath :: FilePath, -- ditto + hpcDir :: String, -- ^ path to store the .mix files + -- options for particular phases opt_L :: [String], opt_P :: [String], @@ -300,6 +307,9 @@ data DynFlags = DynFlags { -- message output log_action :: Severity -> SrcSpan -> PprStyle -> Message -> IO () + + -- breakpoint handling + ,bkptHandler :: Maybe (BkptHandler Module) } data HscTarget @@ -392,6 +402,8 @@ defaultDynFlags = cmdlineFrameworks = [], tmpDir = cDEFAULT_TMPDIR, + hpcDir = ".hpc", + opt_L = [], opt_P = [], opt_F = [], @@ -406,7 +418,8 @@ defaultDynFlags = packageFlags = [], pkgDatabase = Nothing, pkgState = panic "no package state yet: call GHC.setSessionDynFlags", - + + bkptHandler = Nothing, flags = [ Opt_ReadUserPackageConf, @@ -533,9 +546,7 @@ data Option updOptLevel :: Int -> DynFlags -> DynFlags -- Set dynflags appropriate to the optimisation level updOptLevel n dfs - = if (n >= 1) - then dfs2{ hscTarget = HscC, optLevel = n } -- turn on -fvia-C with -O - else dfs2{ optLevel = n } + = dfs2{ optLevel = n } where dfs1 = foldr (flip dopt_unset) dfs remove_dopts dfs2 = foldr (flip dopt_set) dfs1 extra_dopts @@ -875,6 +886,7 @@ dynamic_flags = [ , ( "no-hs-main" , NoArg (setDynFlag Opt_NoHsMain)) , ( "main-is" , SepArg setMainIs ) , ( "haddock" , NoArg (setDynFlag Opt_Haddock) ) + , ( "hpcdir" , SepArg setOptHpcDir ) ------- recompilation checker (DEPRECATED, use -fforce-recomp) ----- , ( "recomp" , NoArg (unSetDynFlag Opt_ForceRecomp) ) @@ -938,6 +950,8 @@ dynamic_flags = [ , ( "ddump-hi", setDumpFlag Opt_D_dump_hi) , ( "ddump-minimal-imports", NoArg (setDynFlag Opt_D_dump_minimal_imports)) , ( "ddump-vect", setDumpFlag Opt_D_dump_vect) + , ( "ddump-hpc", setDumpFlag Opt_D_dump_hpc) + , ( "dcore-lint", NoArg (setDynFlag Opt_DoCoreLinting)) , ( "dstg-lint", NoArg (setDynFlag Opt_DoStgLinting)) , ( "dcmm-lint", NoArg (setDynFlag Opt_DoCmmLinting)) @@ -1041,7 +1055,9 @@ fFlags = [ ( "excess-precision", Opt_ExcessPrecision ), ( "asm-mangling", Opt_DoAsmMangling ), ( "print-bind-result", Opt_PrintBindResult ), - ( "force-recomp", Opt_ForceRecomp ) + ( "force-recomp", Opt_ForceRecomp ), + ( "hpc", Opt_Hpc ), + ( "hpc-tracer", Opt_Hpc_Tracer ) ] @@ -1244,6 +1260,12 @@ setTmpDir dir dflags = dflags{ tmpDir = canonicalise dir } #endif ----------------------------------------------------------------------------- +-- Hpc stuff + +setOptHpcDir :: String -> DynP () +setOptHpcDir arg = upd $ \ d -> d{hpcDir = arg} + +----------------------------------------------------------------------------- -- Via-C compilation stuff machdepCCOpts :: DynFlags -> ([String], -- flags for all C compilations @@ -1333,9 +1355,6 @@ machdepCCOpts dflags -- version. ] ) -#elif mips_TARGET_ARCH - = ( ["-static"], [] ) - #elif sparc_TARGET_ARCH = ( [], ["-w"] ) -- For now, to suppress the gcc warning "call-clobbered