Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Shayne Fletcher
Glasgow Haskell Compiler
Commits
a6af1f12
Commit
a6af1f12
authored
May 25, 2007
by
Michael D. Adams
Browse files
Move global register saving from the backend to codeGen (CPS specific parts)
parent
bd3a364d
Changes
3
Hide whitespace changes
Inline
Side-by-side
compiler/cmm/CmmBrokenBlock.hs
View file @
a6af1f12
...
...
@@ -81,7 +81,6 @@ data FinalStmt
CmmFormals
-- ^ Results from call
-- (redundant with ContinuationEntry)
CmmActuals
-- ^ Arguments to call
(
Maybe
[
GlobalReg
])
-- ^ registers that must be saved (TODO)
|
FinalSwitch
-- ^ Same as a 'CmmSwitch'
CmmExpr
-- ^ Scrutinee (zero based)
...
...
@@ -130,16 +129,16 @@ breakBlock uniques (BasicBlock ident stmts) entry =
-- Detect this special case to remain an inverse of
-- 'cmmBlockFromBrokenBlock'
[
CmmCall
target
results
arguments
saves
,
[
CmmCall
target
results
arguments
,
CmmBranch
next_id
]
->
[
block
]
where
block
=
do_call
current_id
entry
accum_stmts
exits
next_id
target
results
arguments
saves
(
CmmCall
target
results
arguments
saves
:
stmts
)
->
block
:
rest
target
results
arguments
(
CmmCall
target
results
arguments
:
stmts
)
->
block
:
rest
where
next_id
=
BlockId
$
head
uniques
block
=
do_call
current_id
entry
accum_stmts
exits
next_id
target
results
arguments
saves
target
results
arguments
rest
=
breakBlock'
(
tail
uniques
)
next_id
(
ContinuationEntry
results
)
[]
[]
stmts
(
s
:
stmts
)
->
...
...
@@ -149,9 +148,9 @@ breakBlock uniques (BasicBlock ident stmts) entry =
stmts
do_call
current_id
entry
accum_stmts
exits
next_id
target
results
arguments
saves
=
target
results
arguments
=
BrokenBlock
current_id
entry
accum_stmts
(
next_id
:
exits
)
(
FinalCall
next_id
target
results
arguments
saves
)
(
FinalCall
next_id
target
results
arguments
)
cond_branch_target
(
CmmCondBranch
_
target
)
=
[
target
]
cond_branch_target
_
=
[]
...
...
@@ -169,8 +168,8 @@ cmmBlockFromBrokenBlock (BrokenBlock ident _ stmts _ exit) =
FinalReturn
arguments
->
[
CmmReturn
arguments
]
FinalJump
target
arguments
->
[
CmmJump
target
arguments
]
FinalSwitch
expr
targets
->
[
CmmSwitch
expr
targets
]
FinalCall
branch_target
call_target
results
arguments
saves
->
[
CmmCall
call_target
results
arguments
saves
,
FinalCall
branch_target
call_target
results
arguments
->
[
CmmCall
call_target
results
arguments
,
CmmBranch
branch_target
]
-----------------------------------------------------------------------------
...
...
compiler/cmm/CmmCPS.hs
View file @
a6af1f12
...
...
@@ -265,15 +265,14 @@ continuationToProc formats (Continuation is_entry info label formals blocks) =
arguments
FinalJump
target
arguments
->
exit_function
curr_format
target
arguments
-- TODO: do something about global saves
FinalCall
next
(
CmmForeignCall
target
CmmCallConv
)
results
arguments
saves
->
results
arguments
->
pack_continuation
curr_format
cont_format
++
[
CmmJump
target
arguments
]
where
cont_format
=
maybe
unknown_block
id
$
lookup
(
mkReturnPtLabel
$
getUnique
next
)
formats
FinalCall
next
_
results
arguments
saves
->
panic
"unimplemented CmmCall"
FinalCall
next
_
results
arguments
->
panic
"unimplemented CmmCall"
--------------------------------------------------------------------------------
-- Functions that generate CmmStmt sequences
...
...
compiler/cmm/CmmLive.hs
View file @
a6af1f12
...
...
@@ -171,7 +171,7 @@ cmmStmtLive _ (CmmAssign reg expr) =
(
CmmGlobal
_
)
->
id
cmmStmtLive
_
(
CmmStore
expr1
expr2
)
=
cmmExprLive
expr2
.
cmmExprLive
expr1
cmmStmtLive
_
(
CmmCall
target
results
arguments
_
)
=
cmmStmtLive
_
(
CmmCall
target
results
arguments
)
=
target_liveness
.
foldr
((
.
)
.
cmmExprLive
)
id
(
map
fst
arguments
)
.
addKilled
(
mkUniqSet
$
cmmFormalsToLiveLocals
results
)
where
...
...
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