Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Glasgow Haskell Compiler
GHC
Commits
8f08820e
Commit
8f08820e
authored
Jul 21, 2010
by
dterei
Browse files
LLVM: Code and speed improvement to dominateAllocs pass.
parent
58879838
Changes
1
Hide whitespace changes
Inline
Side-by-side
compiler/llvmGen/LlvmCodeGen/CodeGen.hs
View file @
8f08820e
...
...
@@ -26,6 +26,7 @@ import UniqSupply
import
Unique
import
Util
import
Data.List
(
partition
)
import
Control.Monad
(
liftM
)
type
LlvmStatements
=
OrdList
LlvmStatement
...
...
@@ -79,13 +80,10 @@ basicBlocksCodeGen env (block:blocks) (lblocks', ltops')
-- of a function to make sure they dominate all possible paths in the CFG.
dominateAllocs
::
LlvmBasicBlock
->
(
LlvmBasicBlock
,
[
LlvmStatement
])
dominateAllocs
(
BasicBlock
id
stmts
)
=
(
BasicBlock
id
allstmts
,
allallocs
)
where
(
allstmts
,
allallocs
)
=
foldl
split
(
[]
,
[]
)
stmts
split
(
stmts'
,
allocs
)
s
@
(
Assignment
_
(
Alloca
_
_
))
=
(
stmts'
,
allocs
++
[
s
])
split
(
stmts'
,
allocs
)
other
=
(
stmts'
++
[
other
],
allocs
)
=
let
(
allocs
,
stmts'
)
=
partition
isAlloc
stmts
isAlloc
(
Assignment
_
(
Alloca
_
_
))
=
True
isAlloc
_other
=
False
in
(
BasicBlock
id
stmts'
,
allocs
)
-- | Generate code for one block
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment