projects
/
mate.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
62b58a0
)
basicblock: also generate BB #0 when it's labeld with `Nothing' (BBEnd)
author
Bernhard Urban
<lewurm@gmail.com>
Sat, 7 Apr 2012 01:44:21 +0000
(
03:44
+0200)
committer
Bernhard Urban
<lewurm@gmail.com>
Sat, 7 Apr 2012 01:44:21 +0000
(
03:44
+0200)
Mate/BasicBlocks.hs
patch
|
blob
|
history
diff --git
a/Mate/BasicBlocks.hs
b/Mate/BasicBlocks.hs
index e80d388c05f17e977687d0888b89c22a893c9dc9..fdb6b22ab02994a1fa43ad03a236258c23796e6e 100644
(file)
--- a/
Mate/BasicBlocks.hs
+++ b/
Mate/BasicBlocks.hs
@@
-102,7
+102,7
@@
buildCFG xs = buildCFG' H.empty xs' xs'
buildCFG' :: MapBB -> [OffIns] -> [OffIns] -> MapBB
buildCFG' hmap [] _ = hmap
buildCFG' :: MapBB -> [OffIns] -> [OffIns] -> MapBB
buildCFG' hmap [] _ = hmap
-buildCFG' hmap (((off,
Just
entry), _):xs) insns = buildCFG' (insertlist entryi hmap) xs insns
+buildCFG' hmap (((off, entry), _):xs) insns = buildCFG' (insertlist entryi hmap) xs insns
where
insertlist :: [BlockID] -> MapBB -> MapBB
insertlist [] hmap = hmap
where
insertlist :: [BlockID] -> MapBB -> MapBB
insertlist [] hmap = hmap
@@
-114,11
+114,10
@@
buildCFG' hmap (((off, Just entry), _):xs) insns = buildCFG' (insertlist entryi
entryi :: [BlockID]
entryi = (if off == 0 then [0] else []) ++ -- also consider the entrypoint
case entry of
entryi :: [BlockID]
entryi = (if off == 0 then [0] else []) ++ -- also consider the entrypoint
case entry of
- TwoTarget t1 t2 -> [t1, t2]
- OneTarget t -> [t]
- Return -> []
-
-buildCFG' hmap (((_, Nothing), _):xs) insns = buildCFG' hmap xs insns
+ Just (TwoTarget t1 t2) -> [t1, t2]
+ Just (OneTarget t) -> [t]
+ Just (Return) -> []
+ Nothing -> []
parseBasicBlock :: Int -> [OffIns] -> BasicBlock
parseBasicBlock :: Int -> [OffIns] -> BasicBlock