import JVM.Assembler
import Mate.Utilities
+import Mate.Types
-type BlockID = Int
--- Represents a CFG node
-data BasicBlock = BasicBlock {
- -- inputs :: [Variable],
- -- outputs :: [Variable],
- code :: [Instruction],
- successor :: BBEnd }
-
--- describes (leaving) edges of a CFG node
-data BBEnd = Return | FallThrough BlockID | OneTarget BlockID | TwoTarget BlockID BlockID deriving Show
-
-type MapBB = M.Map BlockID BasicBlock
-
--- for immediate representation for determine BBs
+-- for immediate representation to determine BBs
type Offset = (Int, Maybe BBEnd) -- (offset in bytecode, offset to jump target)
type OffIns = (Offset, Instruction)
cio' (off,_) (x:xs) = case x of
IF _ w16 -> twotargets w16
IF_ICMP _ w16 -> twotargets w16
+ IF_ACMP _ w16 -> twotargets w16
GOTO w16 -> onetarget w16
IRETURN -> notarget
+ ARETURN -> notarget
RETURN -> notarget
_ -> ((off, Nothing), x):next
where