Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Alexis King
GHC
Commits
b0c0205e
Commit
b0c0205e
authored
Dec 29, 2011
by
Simon Peyton Jones
Browse files
Print more informative sizes in -dshow-passes,
and add intWithCommas to Outputable for printing large Int/Integers
parent
d2761231
Changes
3
Hide whitespace changes
Inline
Side-by-side
compiler/coreSyn/CoreUtils.lhs
View file @
b0c0205e
...
...
@@ -1284,10 +1284,10 @@ data CoreStats = CS { cs_tm, cs_ty, cs_co :: Int }
instance Outputable CoreStats where
ppr (CS { cs_tm = i1, cs_ty = i2, cs_co = i3 })
=
text "size of" <+> vcat
[
text "terms
="
<+> int
i1
, tex
t "types
="
<+> int
i2
, tex
t "coercions
="
<+> int i3
]
ppr (CS { cs_tm = i1, cs_ty = i2, cs_co = i3 })
= braces (sep
[
p
text
(sLit
"terms
:")
<+> int
WithCommas i1 <> comma,
ptext (sLi
t "types
:")
<+> int
WithCommas i2 <> comma,
ptext (sLi
t "coercions
:")
<+> int
WithCommas
i3]
)
plusCS :: CoreStats -> CoreStats -> CoreStats
plusCS (CS { cs_tm = p1, cs_ty = q1, cs_co = r1 })
...
...
compiler/simplCore/CoreMonad.lhs
View file @
b0c0205e
...
...
@@ -162,7 +162,7 @@ dumpPassResult dflags mb_flag hdr extra_info binds rules
| otherwise
= Err.debugTraceMsg dflags 2 $
(text "Result size of" <+> hdr
<+>
equals <+>
int
(coreBindsS
ize
binds))
(
sep [
text "Result size of" <+> hdr
, nest 2 (
equals <+>
ppr
(coreBindsS
tats
binds))
])
-- Report result size
-- This has the side effect of forcing the intermediate to be evaluated
...
...
compiler/utils/Outputable.lhs
View file @
b0c0205e
...
...
@@ -22,7 +22,7 @@ module Outputable (
empty, nest,
char,
text, ftext, ptext,
int, integer, float, double, rational,
int,
intWithCommas,
integer, float, double, rational,
parens, cparen, brackets, braces, quotes, quote, doubleQuotes, angleBrackets,
semi, comma, colon, dcolon, space, equals, dot, arrow, darrow,
lparen, rparen, lbrack, rbrack, lbrace, rbrace, underscore,
...
...
@@ -830,6 +830,15 @@ quotedListWithOr xs = quotedList xs
%************************************************************************
\begin{code}
intWithCommas :: Integral a => a -> SDoc
-- Prints a big integer with commas, eg 345,821
intWithCommas n
| n < 0 = char '-' <> intWithCommas (-n)
| q == 0 = int (fromIntegral r)
| otherwise = intWithCommas q <> comma <> int (fromIntegral r)
where
(q,r) = n `quotRem` 1000
-- | Converts an integer to a verbal index:
--
-- > speakNth 1 = text "first"
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment