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
33c0b416
Commit
33c0b416
authored
27 years ago
by
sof
Browse files
Options
Downloads
Patches
Plain Diff
[project @ 1997-09-09 18:04:55 by sof]
tidied up, use BinderInfo.isOneFunOcc etc.
parent
375001f6
Loading
Loading
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ghc/compiler/simplCore/OccurAnal.lhs
+20
-21
20 additions, 21 deletions
ghc/compiler/simplCore/OccurAnal.lhs
with
20 additions
and
21 deletions
ghc/compiler/simplCore/OccurAnal.lhs
+
20
−
21
View file @
33c0b416
...
@@ -163,27 +163,29 @@ tagBinder usage binder =
...
@@ -163,27 +163,29 @@ tagBinder usage binder =
usage' = usage `delOneFromIdEnv` binder
usage' = usage `delOneFromIdEnv` binder
us = usage_of usage binder
us = usage_of usage binder
cont =
cont =
if isNullIdEnv usage' then --
b
ogus test to force evaluation.
if isNullIdEnv usage' then --
B
ogus test to force evaluation.
(usage', (binder, us))
(usage', (binder, us))
else
else
(usage', (binder, us))
(usage', (binder, us))
in
in
case us of { DeadCode -> cont; _ -> cont }
if isDeadOcc us then -- Ditto
cont
-- (binder, usage_of usage binder)
else
cont
usage_of usage binder
usage_of usage binder
| isExported binder =
ManyOcc 0
-- Visible-elsewhere things count as many
| isExported binder =
noBinderInfo
-- Visible-elsewhere things count as many
| otherwise
| otherwise
= case (lookupIdEnv usage binder) of
= case (lookupIdEnv usage binder) of
Nothing ->
D
ead
Cod
e
Nothing ->
d
ead
Occurrenc
e
Just info -> info
Just info -> info
isNeeded env usage binder
isNeeded env usage binder
= case (usage_of usage binder) of
= if isDeadOcc (usage_of usage binder) then
DeadCode -> keepUnusedBinding env binder -- Maybe keep it anyway
keepUnusedBinding env binder -- Maybe keep it anyway
other -> True
else
True
\end{code}
\end{code}
...
@@ -492,18 +494,10 @@ reOrderRec env (CyclicSCC binds)
...
@@ -492,18 +494,10 @@ reOrderRec env (CyclicSCC binds)
bad_choice ((bndr, occ_info), rhs)
bad_choice ((bndr, occ_info), rhs)
= var_rhs rhs -- Dont pick var RHS
= var_rhs rhs -- Dont pick var RHS
|| inlineMe env bndr -- Dont pick INLINE thing
|| inlineMe env bndr -- Dont pick INLINE thing
||
one_o
cc occ_info
-- Dont pick single-occ thing
||
isOneFunO
cc occ_info -- Dont pick single-occ thing
|| not_fun_ty (idType bndr) -- Dont pick data-ty thing
|| not_fun_ty (idType bndr) -- Dont pick data-ty thing
not_fun_ty ty = not (maybeToBool (getFunTy_maybe rho_ty))
-- isOneFunOcc looks for one textual occurrence, whether inside lambda or whatever.
where
(_, rho_ty) = splitForAllTy ty
-- A variable RHS
var_rhs (Var v) = True
var_rhs other_rhs = False
-- One textual occurrence, whether inside lambda or whatever
-- We stick to just FunOccs because if we're not going to be able
-- We stick to just FunOccs because if we're not going to be able
-- to inline the thing on this round it might be better to pick
-- to inline the thing on this round it might be better to pick
-- this one as the loop breaker. Real example (the Enum Ordering instance
-- this one as the loop breaker. Real example (the Enum Ordering instance
...
@@ -516,8 +510,13 @@ reOrderRec env (CyclicSCC binds)
...
@@ -516,8 +510,13 @@ reOrderRec env (CyclicSCC binds)
-- On the other hand we *could* simplify those case expressions if
-- On the other hand we *could* simplify those case expressions if
-- we didn't stupidly choose d as the loop breaker.
-- we didn't stupidly choose d as the loop breaker.
one_occ (OneOcc fun_or_arg _ _ _ _) = isFun fun_or_arg
not_fun_ty ty = not (maybeToBool (getFunTy_maybe rho_ty))
one_occ other_bind = False
where
(_, rho_ty) = splitForAllTy ty
-- A variable RHS
var_rhs (Var v) = True
var_rhs other_rhs = False
\end{code}
\end{code}
@occAnalRhs@ deals with the question of bindings where the Id is marked
@occAnalRhs@ deals with the question of bindings where the Id is marked
...
...
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