basicblock: annotate BBs with exceptions
authorBernhard Urban <lewurm@gmail.com>
Tue, 4 Sep 2012 18:59:34 +0000 (20:59 +0200)
committerBernhard Urban <lewurm@gmail.com>
Tue, 4 Sep 2012 18:59:34 +0000 (20:59 +0200)
Mate/BasicBlocks.hs
Mate/Types.hs

index 7fefb6015d9a8cbd001050157f737d3729bb8b92..7fd2e4830eca4c7699fafde8030da559f11b4fb5 100644 (file)
@@ -35,6 +35,15 @@ type BBState = Targets
 type AnalyseState = State BBState [OffIns]
 
 
 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: "
 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 :: 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
   where
     (lastblock, is) = takeWhilePlusOne validins omitins insns
     (_, _, insonly) = unzip3 is
index 67ac2a52b1d016cab35d6fa625287344d0eaba9e..de17e3780aa4cf8c695e72ce4a6891fb505a64e8 100644 (file)
@@ -42,6 +42,7 @@ type BlockID = Int
 -- Represents a CFG node
 data BasicBlock = BasicBlock {
   code :: [Instruction],
 -- Represents a CFG node
 data BasicBlock = BasicBlock {
   code :: [Instruction],
+  exception :: B.ByteString,
   successor :: BBEnd }
 
 -- describes (leaving) edges of a CFG node
   successor :: BBEnd }
 
 -- describes (leaving) edges of a CFG node