X-Git-Url: http://wien.tomnetworks.com/gitweb/?p=mate.git;a=blobdiff_plain;f=Mate%2FBasicBlocks.hs;fp=Mate%2FBasicBlocks.hs;h=7fd2e4830eca4c7699fafde8030da559f11b4fb5;hp=7fefb6015d9a8cbd001050157f737d3729bb8b92;hb=2ac2a68eb5b709caa636d1a9a56a40268d378550;hpb=0328da2d1c6b4a6ee41a4bd2aa7caee888195317 diff --git a/Mate/BasicBlocks.hs b/Mate/BasicBlocks.hs index 7fefb60..7fd2e48 100644 --- a/Mate/BasicBlocks.hs +++ b/Mate/BasicBlocks.hs @@ -35,6 +35,15 @@ type BBState = Targets type AnalyseState = State BBState [OffIns] +noException :: B.ByteString +noException = B.empty + +emptyBasicBlock :: BasicBlock +emptyBasicBlock = BasicBlock + { code = [] + , exception = noException + , successor = Return } + printMapBB :: MapBB -> IO () printMapBB hmap = do printfBb "BlockIDs: " @@ -144,7 +153,7 @@ buildCFG' hmap ((off, entry, _):xs) insns = buildCFG' (insertlist entryi hmap) x parseBasicBlock :: Int -> [OffIns] -> BasicBlock -parseBasicBlock i insns = BasicBlock insonly endblock +parseBasicBlock i insns = emptyBasicBlock { code = insonly, successor = endblock } where (lastblock, is) = takeWhilePlusOne validins omitins insns (_, _, insonly) = unzip3 is