Commit aa77c602 authored by Andreas Klebinger's avatar Andreas Klebinger Committed by Ben Gamari

Also suppress uniques in cmm dumps with `-dsuppress-uniques`.

Allows easier structural comparison of Cmm code.

Before:
```
       cxCH: // global
           _suEU::P64 = R1;
           if ((Sp + -16) < SpLim) (likely: False) goto cxCI; else goto
cxCJ;
```

After
```
       _lbl_: // global
           __locVar_::P64 = R1;
           if ((Sp + -16) < SpLim) (likely: False) goto cxBf; else goto
cxBg;
```

Test Plan: Looking at dumps, ci

Reviewers: bgamari, simonmar

Reviewed By: bgamari

Subscribers: rwbarton, thomie, carter

Differential Revision: https://phabricator.haskell.org/D4786
parent 97cea315
......@@ -185,9 +185,13 @@ pprNode node = pp_node <+> pp_debug
pp_node :: SDoc
pp_node = sdocWithDynFlags $ \dflags -> case node of
-- label:
CmmEntry id tscope -> ppr id <> colon <+>
CmmEntry id tscope -> lbl <> colon <+>
(sdocWithDynFlags $ \dflags ->
ppUnless (gopt Opt_SuppressTicks dflags) (text "//" <+> ppr tscope))
where
lbl = if gopt Opt_SuppressUniques dflags
then text "_lbl_"
else ppr id
-- // text
CmmComment s -> text "//" <+> ftext s
......
......@@ -43,6 +43,7 @@ import GhcPrelude
import CmmExpr
import Outputable
import DynFlags
import Data.Maybe
import Numeric ( fromRat )
......@@ -226,14 +227,18 @@ pprReg r
-- We only print the type of the local reg if it isn't wordRep
--
pprLocalReg :: LocalReg -> SDoc
pprLocalReg (LocalReg uniq rep)
pprLocalReg (LocalReg uniq rep) = sdocWithDynFlags $ \dflags ->
-- = ppr rep <> char '_' <> ppr uniq
-- Temp Jan08
= char '_' <> ppr uniq <>
char '_' <> pprUnique dflags uniq <>
(if isWord32 rep -- && not (isGcPtrType rep) -- Temp Jan08 -- sigh
then dcolon <> ptr <> ppr rep
else dcolon <> ptr <> ppr rep)
where
pprUnique dflags unique =
if gopt Opt_SuppressUniques dflags
then text "_locVar_"
else ppr unique
ptr = empty
--if isGcPtrType rep
-- then doubleQuotes (text "ptr")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment