ghc-7.0.2: The GHC API



State monad for the linear register allocator.



data RA_State Source

The register alloctor state




ra_blockassig :: BlockAssignment

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 a Source

The register allocator monad type.


Monad RegM

The RegM Monad

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

Run a computation in the RegM register allocator monad.

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

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

recordSpill :: SpillReason -> RegM ()Source

Record that a spill instruction was inserted, for profiling.