Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
GHC
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Gesh
GHC
Commits
bd8ead09
Commit
bd8ead09
authored
27 years ago
by
sof
Browse files
Options
Downloads
Patches
Plain Diff
[project @ 1997-09-04 19:56:48 by sof]
ppr tidy up
parent
7483b805
Loading
Loading
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
ghc/compiler/simplStg/SimplStg.lhs
+9
-12
9 additions, 12 deletions
ghc/compiler/simplStg/SimplStg.lhs
ghc/compiler/stgSyn/StgLint.lhs
+1
-1
1 addition, 1 deletion
ghc/compiler/stgSyn/StgLint.lhs
ghc/compiler/stgSyn/StgSyn.lhs
+14
-11
14 additions, 11 deletions
ghc/compiler/stgSyn/StgSyn.lhs
with
24 additions
and
24 deletions
ghc/compiler/simplStg/SimplStg.lhs
+
9
−
12
View file @
bd8ead09
...
@@ -34,7 +34,8 @@ import Id ( nullIdEnv, lookupIdEnv, addOneToIdEnv,
...
@@ -34,7 +34,8 @@ import Id ( nullIdEnv, lookupIdEnv, addOneToIdEnv,
)
)
import Maybes ( maybeToBool )
import Maybes ( maybeToBool )
import PprType ( GenType{-instance Outputable-} )
import PprType ( GenType{-instance Outputable-} )
import Outputable ( PprStyle, Outputable(..) )
import ErrUtils ( doIfSet )
import Outputable ( PprStyle, Outputable(..), printErrs, pprDumpStyle )
import Pretty ( Doc, ($$), vcat, text, ptext )
import Pretty ( Doc, ($$), vcat, text, ptext )
import UniqSupply ( splitUniqSupply, UniqSupply )
import UniqSupply ( splitUniqSupply, UniqSupply )
import Util ( mapAccumL, panic, assertPanic )
import Util ( mapAccumL, panic, assertPanic )
...
@@ -43,7 +44,6 @@ import Util ( mapAccumL, panic, assertPanic )
...
@@ -43,7 +44,6 @@ import Util ( mapAccumL, panic, assertPanic )
\begin{code}
\begin{code}
stg2stg :: [StgToDo] -- spec of what stg-to-stg passes to do
stg2stg :: [StgToDo] -- spec of what stg-to-stg passes to do
-> FAST_STRING -- module name (profiling only)
-> FAST_STRING -- module name (profiling only)
-> PprStyle -- printing style (for debugging only)
-> UniqSupply -- a name supply
-> UniqSupply -- a name supply
-> [StgBinding] -- input...
-> [StgBinding] -- input...
-> IO
-> IO
...
@@ -51,16 +51,13 @@ stg2stg :: [StgToDo] -- spec of what stg-to-stg passes to do
...
@@ -51,16 +51,13 @@ stg2stg :: [StgToDo] -- spec of what stg-to-stg passes to do
([CostCentre], -- local cost-centres that need to be decl'd
([CostCentre], -- local cost-centres that need to be decl'd
[CostCentre])) -- "extern" cost-centres
[CostCentre])) -- "extern" cost-centres
stg2stg stg_todos module_name
ppr_style
us binds
stg2stg stg_todos module_name us binds
= case (splitUniqSupply us) of { (us4now, us4later) ->
= case (splitUniqSupply us) of { (us4now, us4later) ->
(if do_verbose_stg2stg then
doIfSet do_verbose_stg2stg
hPutStr stderr "VERBOSE STG-TO-STG:\n" >>
(printErrs (text "VERBOSE STG-TO-STG:" $$
hPutStr stderr (show
text "*** Core2Stg:" $$
(($$) (ptext SLIT("*** Core2Stg:"))
vcat (map (ppr pprDumpStyle) (setStgVarInfo False binds)))) >>
(vcat (map (ppr ppr_style) (setStgVarInfo False binds)))
))
else return ()) >>
-- Do the main business!
-- Do the main business!
foldl_mn do_stg_pass (binds, us4now, ([],[])) stg_todos
foldl_mn do_stg_pass (binds, us4now, ([],[])) stg_todos
...
@@ -110,7 +107,7 @@ stg2stg stg_todos module_name ppr_style us binds
...
@@ -110,7 +107,7 @@ stg2stg stg_todos module_name ppr_style us binds
-------------
-------------
stg_linter = if False --LATER: opt_DoStgLinting (ToDo)
stg_linter = if False --LATER: opt_DoStgLinting (ToDo)
then lintStgBindings ppr
_s
tyle
then lintStgBindings ppr
DumpS
tyle
else ( \ whodunnit binds -> binds )
else ( \ whodunnit binds -> binds )
-------------------------------------------
-------------------------------------------
...
@@ -154,7 +151,7 @@ stg2stg stg_todos module_name ppr_style us binds
...
@@ -154,7 +151,7 @@ stg2stg stg_todos module_name ppr_style us binds
(if do_verbose_stg2stg then
(if do_verbose_stg2stg then
hPutStr stderr (show
hPutStr stderr (show
(($$) (text ("*** "++what++":"))
(($$) (text ("*** "++what++":"))
(vcat (map (ppr ppr
_s
tyle) binds2))
(vcat (map (ppr ppr
DumpS
tyle) binds2))
))
))
else return ()) >>
else return ()) >>
let
let
...
...
This diff is collapsed.
Click to expand it.
ghc/compiler/stgSyn/StgLint.lhs
+
1
−
1
View file @
bd8ead09
...
@@ -61,7 +61,7 @@ lintStgBindings sty whodunnit binds
...
@@ -61,7 +61,7 @@ lintStgBindings sty whodunnit binds
ptext SLIT("*** Stg Lint Errors: in "),text whodunnit, ptext SLIT(" ***"),
ptext SLIT("*** Stg Lint Errors: in "),text whodunnit, ptext SLIT(" ***"),
msg sty,
msg sty,
ptext SLIT("*** Offending Program ***"),
ptext SLIT("*** Offending Program ***"),
vcat (map (pprPlain
StgBinding sty
)
binds
)
,
ppr
StgBinding
s
sty binds,
ptext SLIT("*** End of Offense ***")])
ptext SLIT("*** End of Offense ***")])
where
where
lint_binds :: [StgBinding] -> LintM ()
lint_binds :: [StgBinding] -> LintM ()
...
...
This diff is collapsed.
Click to expand it.
ghc/compiler/stgSyn/StgSyn.lhs
+
14
−
11
View file @
bd8ead09
...
@@ -30,7 +30,7 @@ module StgSyn (
...
@@ -30,7 +30,7 @@ module StgSyn (
SYN_IE(StgBinding), SYN_IE(StgExpr), SYN_IE(StgRhs),
SYN_IE(StgBinding), SYN_IE(StgExpr), SYN_IE(StgRhs),
SYN_IE(StgCaseAlts), SYN_IE(StgCaseDefault),
SYN_IE(StgCaseAlts), SYN_IE(StgCaseDefault),
ppr
Plain
StgBinding,
ppr
StgBinding, ppr
StgBinding
s
,
getArgPrimRep,
getArgPrimRep,
isLitLitArg,
isLitLitArg,
stgArity,
stgArity,
...
@@ -498,18 +498,18 @@ Robin Popplestone asked for semi-colon separators on STG binds; here's
...
@@ -498,18 +498,18 @@ Robin Popplestone asked for semi-colon separators on STG binds; here's
hoping he likes terminators instead... Ditto for case alternatives.
hoping he likes terminators instead... Ditto for case alternatives.
\begin{code}
\begin{code}
pprStgBinding :: (Outputable bndr, Outputable bdee, Ord bdee) =>
ppr
Gen
StgBinding :: (Outputable bndr, Outputable bdee, Ord bdee) =>
PprStyle -> GenStgBinding bndr bdee -> Doc
PprStyle -> GenStgBinding bndr bdee -> Doc
pprStgBinding sty (StgNonRec bndr rhs)
ppr
Gen
StgBinding sty (StgNonRec bndr rhs)
= hang (hsep [ppr sty bndr, equals])
= hang (hsep [ppr sty bndr, equals])
4 ((<>) (ppr sty rhs) semi)
4 ((<>) (ppr sty rhs) semi)
pprStgBinding sty (StgCoerceBinding bndr occ)
ppr
Gen
StgBinding sty (StgCoerceBinding bndr occ)
= hang (hsep [ppr sty bndr, equals, ptext SLIT("{-Coerce-}")])
= hang (hsep [ppr sty bndr, equals, ptext SLIT("{-Coerce-}")])
4 ((<>) (ppr sty occ) semi)
4 ((<>) (ppr sty occ) semi)
pprStgBinding sty (StgRec pairs)
ppr
Gen
StgBinding sty (StgRec pairs)
= vcat ((ifPprDebug sty (ptext SLIT("{- StgRec (begin) -}"))) :
= vcat ((ifPprDebug sty (ptext SLIT("{- StgRec (begin) -}"))) :
(map (ppr_bind sty) pairs) ++ [(ifPprDebug sty (ptext SLIT("{- StgRec (end) -}")))])
(map (ppr_bind sty) pairs) ++ [(ifPprDebug sty (ptext SLIT("{- StgRec (end) -}")))])
where
where
...
@@ -517,8 +517,11 @@ pprStgBinding sty (StgRec pairs)
...
@@ -517,8 +517,11 @@ pprStgBinding sty (StgRec pairs)
= hang (hsep [ppr sty bndr, equals])
= hang (hsep [ppr sty bndr, equals])
4 ((<>) (ppr sty expr) semi)
4 ((<>) (ppr sty expr) semi)
pprPlainStgBinding :: PprStyle -> StgBinding -> Doc
pprStgBinding :: PprStyle -> StgBinding -> Doc
pprPlainStgBinding sty b = pprStgBinding sty b
pprStgBinding sty bind = pprGenStgBinding sty bind
pprStgBindings :: PprStyle -> [StgBinding] -> Doc
pprStgBindings sty binds = vcat (map (pprGenStgBinding sty) binds)
\end{code}
\end{code}
\begin{code}
\begin{code}
...
@@ -527,7 +530,7 @@ instance (Outputable bdee) => Outputable (GenStgArg bdee) where
...
@@ -527,7 +530,7 @@ instance (Outputable bdee) => Outputable (GenStgArg bdee) where
instance (Outputable bndr, Outputable bdee, Ord bdee)
instance (Outputable bndr, Outputable bdee, Ord bdee)
=> Outputable (GenStgBinding bndr bdee) where
=> Outputable (GenStgBinding bndr bdee) where
ppr = pprStgBinding
ppr = ppr
Gen
StgBinding
instance (Outputable bndr, Outputable bdee, Ord bdee)
instance (Outputable bndr, Outputable bdee, Ord bdee)
=> Outputable (GenStgExpr bndr bdee) where
=> Outputable (GenStgExpr bndr bdee) where
...
@@ -594,17 +597,17 @@ pprStgExpr sty (StgLet (StgNonRec bndr (StgRhsClosure cc bi free_vars upd_flag a
...
@@ -594,17 +597,17 @@ pprStgExpr sty (StgLet (StgNonRec bndr (StgRhsClosure cc bi free_vars upd_flag a
pprStgExpr sty (StgLet bind expr@(StgLet _ _))
pprStgExpr sty (StgLet bind expr@(StgLet _ _))
= ($$)
= ($$)
(sep [hang (ptext SLIT("let {")) 2 (hsep [pprStgBinding sty bind, ptext SLIT("} in")])])
(sep [hang (ptext SLIT("let {")) 2 (hsep [ppr
Gen
StgBinding sty bind, ptext SLIT("} in")])])
(ppr sty expr)
(ppr sty expr)
-- general case
-- general case
pprStgExpr sty (StgLet bind expr)
pprStgExpr sty (StgLet bind expr)
= sep [hang (ptext SLIT("let {")) 2 (pprStgBinding sty bind),
= sep [hang (ptext SLIT("let {")) 2 (ppr
Gen
StgBinding sty bind),
hang (ptext SLIT("} in ")) 2 (ppr sty expr)]
hang (ptext SLIT("} in ")) 2 (ppr sty expr)]
pprStgExpr sty (StgLetNoEscape lvs_whole lvs_rhss bind expr)
pprStgExpr sty (StgLetNoEscape lvs_whole lvs_rhss bind expr)
= sep [hang (ptext SLIT("let-no-escape {"))
= sep [hang (ptext SLIT("let-no-escape {"))
2 (pprStgBinding sty bind),
2 (ppr
Gen
StgBinding sty bind),
hang ((<>) (ptext SLIT("} in "))
hang ((<>) (ptext SLIT("} in "))
(ifPprDebug sty (
(ifPprDebug sty (
nest 4 (
nest 4 (
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment