X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=Mate%2FBasicBlocks.hs;h=fbb61f7a06ecf6a471d5b33385953f58228ee19b;hb=f82dbecc763818452667ac568da96b7c5dd7cc97;hp=ce676c224361fcde0af73bfa6e1ddf9e8a1fcbfd;hpb=a92b66dd82f6817efc937acbfcf4c6d4f10ecc29;p=mate.git diff --git a/Mate/BasicBlocks.hs b/Mate/BasicBlocks.hs index ce676c2..fbb61f7 100644 --- a/Mate/BasicBlocks.hs +++ b/Mate/BasicBlocks.hs @@ -41,7 +41,7 @@ printMapBB :: Maybe MapBB -> IO () printMapBB Nothing = putStrLn "No BasicBlock" printMapBB (Just hmap) = do putStr "BlockIDs: " - let keys = fst $ unzip $ M.toList hmap -- M.keys + let keys = M.keys hmap mapM_ (putStr . (flip (++)) ", " . show) keys putStrLn "\n\nBasicBlocks:" printMapBB' keys hmap @@ -106,10 +106,10 @@ parseMethod cls method sig = do testCFG :: Maybe (Method Direct) -> Maybe MapBB -testCFG (Just m) = case attrByName m "Code" of - Nothing -> Nothing - Just bytecode -> Just $ buildCFG $ codeInstructions $ decodeMethod bytecode -testCFG _ = Nothing +testCFG m = do + m' <- m + bytecode <- attrByName m' "Code" + return $ buildCFG $ codeInstructions $ decodeMethod bytecode buildCFG :: [Instruction] -> MapBB