ghc-core 0.4.2 → 0.4.3
raw patch · 3 files changed
+11/−7 lines, 3 files
Files
- README +0/−2
- ghc-core.cabal +1/−1
- ghc-core.hs +10/−4
− README
@@ -1,2 +0,0 @@-A convenient command line wrapper over GHC to display GHC's optimised-Core and assembly output in a human readable manner.
ghc-core.cabal view
@@ -1,5 +1,5 @@ name: ghc-core-version: 0.4.2+version: 0.4.3 license: BSD3 license-file: LICENSE author: Don Stewart
ghc-core.hs view
@@ -53,6 +53,7 @@ { optHelp :: Bool , optFormat :: Output , optGhcExe :: String+ , optAsm :: Bool } deriving (Eq, Show) defaultOptions :: Options@@ -60,6 +61,7 @@ { optHelp = False , optFormat = TTY , optGhcExe = "ghc"+ , optAsm = True } formats :: [(String, Output)]@@ -76,6 +78,9 @@ ,Option [] ["with-ghc"] (ReqArg (\x opts -> opts { optGhcExe = x }) "PROGRAM") "Ghc executable to use."+ ,Option [] ["no-asm"]+ (NoArg (\opts -> opts { optAsm = False }))+ "Don't output generated assembly code." ] where fromString f = fromMaybe (formatError f) (lookup f formats)@@ -116,7 +121,8 @@ contents <- readFile fp return (contents, Nothing) _ -> do- strs' <- polish `fmap` compileWithCore (optGhcExe opts) args+ strs' <- polish `fmap` compileWithCore (optGhcExe opts)+ args (optAsm opts) -- TODO this is a bit lazy on my part... x <- readProcess "sh" ["-c","ls /tmp/ghc*/*.s | head -1"] [] case x of@@ -197,9 +203,9 @@ ------------------------------------------------------------------------ -compileWithCore :: String -> [String] -> IO String-compileWithCore ghc opts = do- let args = words "-O2 -keep-tmp-files -ddump-simpl -ddump-asm -ddump-simpl-stats -no-recomp --make"+compileWithCore :: String -> [String] -> Bool -> IO String+compileWithCore ghc opts asm = do+ let args = words $ "-O2 -keep-tmp-files -ddump-simpl -ddump-simpl-stats -no-recomp --make" ++ if asm then " -ddump-asm" else "" x <- readProcess ghc (args ++ opts) [] case x of