diff options
author | Ömer Sinan Ağacan <omeragacan@gmail.com> | 2019-09-02 13:17:49 +0300 |
---|---|---|
committer | Ömer Sinan Ağacan <omeragacan@gmail.com> | 2019-09-02 13:17:49 +0300 |
commit | 11679e5bec1994775072e8e60f24b4ce104af0a7 (patch) | |
tree | 652009050eb2203a7cf3637a51aaf2cd5262ee89 /compiler/nativeGen | |
parent | 9acba78004d4d4a149b9e1480d1d8c44b7a27cec (diff) | |
download | haskell-11679e5bec1994775072e8e60f24b4ce104af0a7.tar.gz |
Few tweaks in -ddump-debug output, minor refactoring
- Fixes crazy indentation in -ddump-debug output
- We no longer dump empty sections in -ddump-debug when a code block
does not have any generated debug info
- Minor refactoring in Debug.hs and AsmCodeGen.hs
Diffstat (limited to 'compiler/nativeGen')
-rw-r--r-- | compiler/nativeGen/AsmCodeGen.hs | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/compiler/nativeGen/AsmCodeGen.hs b/compiler/nativeGen/AsmCodeGen.hs index fe59a4d789..b735a3e412 100644 --- a/compiler/nativeGen/AsmCodeGen.hs +++ b/compiler/nativeGen/AsmCodeGen.hs @@ -347,7 +347,7 @@ finishNativeGen dflags modLoc bufh@(BufHandle _ _ h) us ngs -- dump global NCG stats for graph coloring allocator let stats = concat (ngs_colorStats ngs) - when (not (null stats)) $ do + unless (null stats) $ do -- build the global register conflict graph let graphGlobal @@ -370,7 +370,7 @@ finishNativeGen dflags modLoc bufh@(BufHandle _ _ h) us ngs -- dump global NCG stats for linear allocator let linearStats = concat (ngs_linearStats ngs) - when (not (null linearStats)) $ + unless (null linearStats) $ dump_stats (Linear.pprStats (concat (ngs_natives ngs)) linearStats) -- write out the imports @@ -419,8 +419,9 @@ cmmNativeGenStream dflags this_mod modLoc ncgImpl h us cmm_stream ngs -- Link native code information into debug blocks -- See Note [What is this unwinding business?] in Debug. let !ldbgs = cmmDebugLink (ngs_labels ngs') (ngs_unwinds ngs') ndbgs - dumpIfSet_dyn dflags Opt_D_dump_debug "Debug Infos" - (vcat $ map ppr ldbgs) + unless (null ldbgs) $ + dumpIfSet_dyn dflags Opt_D_dump_debug "Debug Infos" + (vcat $ map ppr ldbgs) -- Accumulate debug information for emission in finishNativeGen. let ngs'' = ngs' { ngs_debug = ngs_debug ngs' ++ ldbgs, ngs_labels = [] } @@ -477,7 +478,7 @@ cmmNativeGens dflags this_mod modLoc ncgImpl h dbgMap = go map (pprNatCmmDecl ncgImpl) native -- force evaluation all this stuff to avoid space leaks - {-# SCC "seqString" #-} evaluate $ seqString (showSDoc dflags $ vcat $ map ppr imports) + {-# SCC "seqString" #-} evaluate $ seqList (showSDoc dflags $ vcat $ map ppr imports) () let !labels' = if debugLevel dflags > 0 then cmmDebugLabels isMetaInstr native else [] @@ -495,9 +496,6 @@ cmmNativeGens dflags this_mod modLoc ncgImpl h dbgMap = go } go us' cmms ngs' (count + 1) - seqString [] = () - seqString (x:xs) = x `seq` seqString xs - emitNativeCode :: DynFlags -> BufHandle -> SDoc -> IO () emitNativeCode dflags h sdoc = do |