Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
Glasgow Haskell Compiler
GHC
Commits
a47cf360
Commit
a47cf360
authored
Sep 15, 2007
by
nr@eecs.harvard.edu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added instance declarations so we can fold over local registers used in Middle and Last nodes
parent
cbdda5e0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
0 deletions
+26
-0
compiler/cmm/ZipCfgCmmRep.hs
compiler/cmm/ZipCfgCmmRep.hs
+26
-0
No files found.
compiler/cmm/ZipCfgCmmRep.hs
View file @
a47cf360
...
...
@@ -151,6 +151,32 @@ fold_cmm_succs _f (LastCall _ Nothing) z = z
fold_cmm_succs
f
(
LastCondBranch
_
te
fe
)
z
=
f
te
(
f
fe
z
)
fold_cmm_succs
f
(
LastSwitch
_
edges
)
z
=
foldl
(
flip
f
)
z
$
catMaybes
edges
----------------------------------------------------------------------
----- Instance declarations for register use
instance
UserOfLocalRegs
Middle
where
foldRegsUsed
f
z
m
=
middle
m
where
middle
(
MidComment
{})
=
z
middle
(
MidAssign
_lhs
expr
)
=
foldRegsUsed
f
z
expr
middle
(
MidStore
addr
rval
)
=
foldRegsUsed
f
(
foldRegsUsed
f
z
addr
)
rval
middle
(
MidUnsafeCall
tgt
_ress
args
)
=
foldRegsUsed
f
(
foldRegsUsed
f
z
tgt
)
args
middle
(
CopyIn
_
_formals
_
)
=
z
middle
(
CopyOut
_
actuals
)
=
foldRegsUsed
f
z
actuals
-- fold = foldRegsUsed
instance
UserOfLocalRegs
Last
where
foldRegsUsed
f
z
m
=
last
m
where
last
(
LastReturn
)
=
z
last
(
LastJump
e
)
=
foldRegsUsed
f
z
e
last
(
LastBranch
_id
)
=
z
last
(
LastCall
tgt
_
)
=
foldRegsUsed
f
z
tgt
last
(
LastCondBranch
e
_
_
)
=
foldRegsUsed
f
z
e
last
(
LastSwitch
e
_tbl
)
=
foldRegsUsed
f
z
e
instance
UserOfLocalRegs
(
ZLast
Last
)
where
foldRegsUsed
f
z
(
LastOther
l
)
=
foldRegsUsed
f
z
l
foldRegsUsed
_f
z
LastExit
=
z
----------------------------------------------------------------------
----- Instance declarations for prettyprinting (avoids recursive imports)
...
...
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