linearscan-hoopl-0.5.1.0: Makes it easy to use the linearscan register allocator with Hoopl

Safe HaskellNone
LanguageHaskell2010

LinearScan.Hoopl

Documentation

class HooplNode (n v) => NodeAlloc n v r | n -> v, n -> r where Source

Methods

fromVar :: v -> Either PhysReg VarId Source

fromReg :: r -> PhysReg Source

isCall :: n v O O -> Bool Source

isBranch :: n v O C -> Bool Source

retargetBranch :: n v O C -> Label -> Label -> n v O C Source

mkLabelOp :: Label -> n v C O Source

mkJumpOp :: Label -> n v O C Source

getReferences :: n v e x -> [VarInfo] Source

setRegisters :: [(Int, PhysReg)] -> n v e x -> Env (n r e x) Source

mkMoveOps :: PhysReg -> PhysReg -> Env [n r O O] Source

mkSwapOps :: PhysReg -> PhysReg -> Env [n r O O] Source

mkSaveOps :: PhysReg -> Maybe VarId -> Env [n r O O] Source

mkRestoreOps :: Maybe VarId -> PhysReg -> Env [n r O O] Source

op1ToString :: n v e x -> String Source

data NodeV n Source

Constructors

NodeCO 

Fields

getNodeCO :: n C O
 
NodeOO 

Fields

getNodeOO :: n O O
 
NodeOC 

Fields

getNodeOC :: n O C
 

blockInfo :: (NodeAlloc n v r, NonLocal (n v)) => (Label -> Env Int) -> BlockInfo Env (Block (n v) C C) (Block (n r) C C) (NodeV (n v)) (NodeV (n r)) Source

opInfo :: NodeAlloc n v r => OpInfo Env (NodeV (n v)) (NodeV (n r)) Source

newtype SimpleUniqueMonad' a Source

Constructors

SUM' 

Fields

unSUM' :: [Int] -> (a, [Int])
 

allocateHoopl Source

Arguments

:: (NonLocal (n v), NonLocal (n r), NodeAlloc n v r) 
=> Int

Number of machine registers

-> Int

Offset of the spill stack

-> Int

Size of spilled register in bytes

-> Label

Label of graph entry block

-> Graph (n v) C C

Program graph

-> Either String (Graph (n r) C C)