Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Glasgow Haskell Compiler
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Shayne Fletcher
Glasgow Haskell Compiler
Commits
846a43cb
Commit
846a43cb
authored
Feb 03, 2012
by
Simon Marlow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Small improvement to control-flow optimisation
parent
df3f5f93
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
4 deletions
+15
-4
compiler/cmm/CmmContFlowOpt.hs
compiler/cmm/CmmContFlowOpt.hs
+15
-4
No files found.
compiler/cmm/CmmContFlowOpt.hs
View file @
846a43cb
...
@@ -12,14 +12,11 @@ where
...
@@ -12,14 +12,11 @@ where
import
BlockId
import
BlockId
import
Cmm
import
Cmm
import
CmmUtils
import
CmmUtils
import
Digraph
import
Maybes
import
Maybes
import
Outputable
import
Hoopl
import
Hoopl
import
Control.Monad
import
Control.Monad
import
Prelude
hiding
(
succ
,
unzip
,
zip
)
import
Prelude
hiding
(
succ
,
unzip
,
zip
)
import
qualified
Data.IntMap
as
Map
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
--
--
...
@@ -106,16 +103,30 @@ blockConcat g@CmmGraph { g_entry = entry_id }
...
@@ -106,16 +103,30 @@ blockConcat g@CmmGraph { g_entry = entry_id }
,
shouldConcatWith
b'
blk'
,
shouldConcatWith
b'
blk'
=
(
mapInsert
bid
(
splice
head
blk'
)
blocks
,
shortcut_map
)
=
(
mapInsert
bid
(
splice
head
blk'
)
blocks
,
shortcut_map
)
-- calls: if we can shortcut the continuation label, then
-- we must *also* remember to substitute for the label in the
-- code, because we will push it somewhere.
|
Just
b'
<-
callContinuation_maybe
last
|
Just
b'
<-
callContinuation_maybe
last
,
Just
blk'
<-
mapLookup
b'
blocks
,
Just
blk'
<-
mapLookup
b'
blocks
,
Just
dest
<-
canShortcut
blk'
,
Just
dest
<-
canShortcut
blk'
=
(
blocks
,
mapInsert
b'
dest
shortcut_map
)
=
(
blocks
,
mapInsert
b'
dest
shortcut_map
)
-- replaceLabels will substitute dest for b' everywhere, later
-- replaceLabels will substitute dest for b' everywhere, later
|
otherwise
=
unchanged
-- non-calls: see if we can shortcut any of the successors.
|
Nothing
<-
callContinuation_maybe
last
=
(
mapInsert
bid
(
blockJoinTail
head
shortcut_last
)
blocks
,
shortcut_map
)
|
otherwise
=
(
blocks
,
shortcut_map
)
where
where
(
head
,
last
)
=
blockSplitTail
block
(
head
,
last
)
=
blockSplitTail
block
bid
=
entryLabel
block
bid
=
entryLabel
block
shortcut_last
=
mapSuccessors
shortcut
last
shortcut
l
=
case
mapLookup
l
blocks
of
Just
b
|
Just
dest
<-
canShortcut
b
->
dest
_otherwise
->
l
shouldConcatWith
b
block
shouldConcatWith
b
block
|
num_preds
b
==
1
=
True
-- only one predecessor: go for it
|
num_preds
b
==
1
=
True
-- only one predecessor: go for it
...
...
Write
Preview
Markdown
is supported
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