packages feed

apple-0.3.0.0: src/Asm/Ar/P.hs

module Asm.Ar.P ( bundle ) where

import           Asm.Ar
import           Asm.L
import           CF
import           Class.E
import           Data.Copointed
import           Data.Tuple.Extra (both)

bundle :: (E reg, E freg, Copointed (arch reg freg f2), Arch arch reg freg f2)
       => [arch reg freg f2 ()]
       -> ([arch reg freg f2 (UD, Liveness, Maybe (Int,Int))], [arch reg freg f2 (UD, Liveness, Maybe (Int,Int))])
bundle isns =
    let cfIsns = fmap udd isns; lIsns = mkLive isns
        mvIsns = fmap (both toInt).mI<$>isns
        mvFIsns = fmap (both toInt).mf<$>isns
        combine x y z = let tup = (x, copoint y, z) in tup <$ y
    in (zipWith3 combine cfIsns lIsns mvIsns, zipWith3 combine cfIsns lIsns mvFIsns)