ghc-7.6.1.20121125: The GHC API

Safe HaskellNone

RegAlloc.Linear.State

Description

State monad for the linear register allocator.

Synopsis

Documentation

data RA_State freeRegs Source

The register alloctor state

Constructors

RA_State 

Fields

ra_blockassig :: BlockAssignment freeRegs

the current mapping from basic blocks to the register assignments at the beginning of that block.

ra_freeregs :: !freeRegs

free machine registers

ra_assig :: RegMap Loc

assignment of temps to locations

ra_delta :: Int

current stack delta

ra_stack :: StackMap

free stack slots for spilling

ra_us :: UniqSupply

unique supply for generating names for join point fixup blocks.

ra_spills :: [SpillReason]

Record why things were spilled, for -ddrop-asm-stats. Just keep a list here instead of a map of regs -> reasons. We don't want to slow down the allocator if we're not going to emit the stats.

data RegM freeRegs a Source

The register allocator monad type.

Instances

Monad (RegM freeRegs)

The RegM Monad

runR :: BlockAssignment freeRegs -> freeRegs -> RegMap Loc -> StackMap -> UniqSupply -> RegM freeRegs a -> (BlockAssignment freeRegs, StackMap, RegAllocStats, a)Source

Run a computation in the RegM register allocator monad.

spillR :: Instruction instr => Platform -> Reg -> Unique -> RegM freeRegs (instr, Int)Source

loadR :: Instruction instr => Platform -> Reg -> Int -> RegM freeRegs instrSource

getFreeRegsR :: RegM freeRegs freeRegsSource

setFreeRegsR :: freeRegs -> RegM freeRegs ()Source

setAssigR :: RegMap Loc -> RegM freeRegs ()Source

setBlockAssigR :: BlockAssignment freeRegs -> RegM freeRegs ()Source

setDeltaR :: Int -> RegM freeRegs ()Source

recordSpill :: SpillReason -> RegM freeRegs ()Source

Record that a spill instruction was inserted, for profiling.