summaryrefslogtreecommitdiff
path: root/compiler/cmm
diff options
context:
space:
mode:
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
commit11679e5bec1994775072e8e60f24b4ce104af0a7 (patch)
tree652009050eb2203a7cf3637a51aaf2cd5262ee89 /compiler/cmm
parent9acba78004d4d4a149b9e1480d1d8c44b7a27cec (diff)
downloadhaskell-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/cmm')
-rw-r--r--compiler/cmm/Debug.hs25
1 files changed, 11 insertions, 14 deletions
diff --git a/compiler/cmm/Debug.hs b/compiler/cmm/Debug.hs
index 4aec63fad6..c874e81620 100644
--- a/compiler/cmm/Debug.hs
+++ b/compiler/cmm/Debug.hs
@@ -1,4 +1,5 @@
{-# LANGUAGE GADTs #-}
+{-# LANGUAGE MultiWayIf #-}
-----------------------------------------------------------------------------
--
@@ -11,7 +12,7 @@
module Debug (
- DebugBlock(..), dblIsEntry,
+ DebugBlock(..),
cmmDebugGen,
cmmDebugLabels,
cmmDebugLink,
@@ -58,8 +59,7 @@ data DebugBlock =
, dblParent :: !(Maybe DebugBlock)
-- ^ The parent of this proc. See Note [Splitting DebugBlocks]
, dblTicks :: ![CmmTickish] -- ^ Ticks defined in this block
- , dblSourceTick
- :: !(Maybe CmmTickish) -- ^ Best source tick covering block
+ , dblSourceTick :: !(Maybe CmmTickish) -- ^ Best source tick covering block
, dblPosition :: !(Maybe Int) -- ^ Output position relative to
-- other blocks. @Nothing@ means
-- the block was optimized out
@@ -67,22 +67,19 @@ data DebugBlock =
, dblBlocks :: ![DebugBlock] -- ^ Nested blocks
}
--- | Is this the entry block?
-dblIsEntry :: DebugBlock -> Bool
-dblIsEntry blk = dblProcedure blk == dblLabel blk
-
instance Outputable DebugBlock where
- ppr blk = (if dblProcedure blk == dblLabel blk
- then text "proc "
- else if dblHasInfoTbl blk
- then text "pp-blk "
- else text "blk ") <>
+ ppr blk = (if | dblProcedure blk == dblLabel blk
+ -> text "proc"
+ | dblHasInfoTbl blk
+ -> text "pp-blk"
+ | otherwise
+ -> text "blk") <+>
ppr (dblLabel blk) <+> parens (ppr (dblCLabel blk)) <+>
(maybe empty ppr (dblSourceTick blk)) <+>
(maybe (text "removed") ((text "pos " <>) . ppr)
(dblPosition blk)) <+>
- (ppr (dblUnwind blk)) <+>
- (if null (dblBlocks blk) then empty else ppr (dblBlocks blk))
+ (ppr (dblUnwind blk)) $+$
+ (if null (dblBlocks blk) then empty else nest 4 (ppr (dblBlocks blk)))
-- | Intermediate data structure holding debug-relevant context information
-- about a block.