-
Notifications
You must be signed in to change notification settings - Fork 139
/
ProfilingDriver.hs
34 lines (31 loc) · 1.01 KB
/
ProfilingDriver.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
-- | This program calls ghc using the provided command line arguments.
-- Use it to profile the liquidhaskell plugin.
--
-- Build liquidhaskell first with profiling enabled.
--
-- > cabal build --enable-profiling liquidhaskell
--
-- Then build and run this program.
--
-- > cabal run --enable-profiling profiling-driver -- \
-- > -package liquidhaskell -fplugin LiquidHaskell +RTS -p -RTS tests/pos/Bag.hs
--
module Main where
import GHC as G
import Control.Monad
import Control.Monad.IO.Class
import System.Environment
import GHC.Paths (libdir)
import GHC.Utils.Logger as G
main :: IO ()
main = do
xs <- getArgs
runGhc (Just libdir) $ do
df1 <- getSessionDynFlags
let cmdOpts = ["-fforce-recomp"] ++ filter ("--make" /=) xs
logger <- liftIO G.initLogger
(df2, leftovers, _warns) <- G.parseDynamicFlags logger df1 (map G.noLoc cmdOpts)
setSessionDynFlags df2
ts <- mapM (\x-> G.guessTarget x Nothing Nothing) $ map unLoc leftovers
setTargets ts
void $ G.load LoadAllTargets