Safe Haskell | None |
---|---|
Language | Haskell2010 |
- data RegUsage = RU [Reg] [Reg]
- noUsage :: RegUsage
- data GenBasicBlock i = BasicBlock BlockId [i]
- blockId :: GenBasicBlock i -> BlockId
- newtype ListGraph i = ListGraph [GenBasicBlock i]
- type NatCmm instr = GenCmmGroup CmmStatics (BlockEnv CmmStatics) (ListGraph instr)
- type NatCmmDecl statics instr = GenCmmDecl statics (BlockEnv CmmStatics) (ListGraph instr)
- type NatBasicBlock instr = GenBasicBlock instr
- topInfoTable :: GenCmmDecl a (BlockEnv i) (ListGraph b) -> Maybe i
- entryBlocks :: GenCmmDecl a (BlockEnv i) (ListGraph b) -> [BlockId]
- class Instruction instr where
Documentation
Holds a list of source and destination registers used by a particular instruction.
Machine registers that are pre-allocated to stgRegs are filtered out, because they are uninteresting from a register allocation standpoint. (We wouldn't want them to end up on the free list!)
As far as we are concerned, the fixed registers simply don't exist (for allocation purposes, anyway).
data GenBasicBlock i Source #
BasicBlock BlockId [i] |
Outputable instr => Outputable (GenBasicBlock instr) # | |
blockId :: GenBasicBlock i -> BlockId Source #
The branch block id is that of the first block in the branch, which is that branch's entry point
Outputable instr => Outputable (ListGraph instr) # | |
type NatCmm instr = GenCmmGroup CmmStatics (BlockEnv CmmStatics) (ListGraph instr) Source #
type NatCmmDecl statics instr = GenCmmDecl statics (BlockEnv CmmStatics) (ListGraph instr) Source #
type NatBasicBlock instr = GenBasicBlock instr Source #
topInfoTable :: GenCmmDecl a (BlockEnv i) (ListGraph b) -> Maybe i Source #
Returns the info table associated with the CmmDecl's entry point, if any.
entryBlocks :: GenCmmDecl a (BlockEnv i) (ListGraph b) -> [BlockId] Source #
Return the list of BlockIds in a CmmDecl that are entry points for this proc (i.e. they may be jumped to from outside this proc).
class Instruction instr where Source #
Common things that we can do with instructions, on all architectures. These are used by the shared parts of the native code generator, specifically the register allocators.
regUsageOfInstr, patchRegsOfInstr, isJumpishInstr, jumpDestsOfInstr, patchJumpInstr, mkSpillInstr, mkLoadInstr, takeDeltaInstr, isMetaInstr, mkRegRegMoveInstr, takeRegRegMoveInstr, mkJumpInstr, mkStackAllocInstr, mkStackDeallocInstr
regUsageOfInstr :: Platform -> instr -> RegUsage Source #
Get the registers that are being used by this instruction. regUsage doesn't need to do any trickery for jumps and such. Just state precisely the regs read and written by that insn. The consequences of control flow transfers, as far as register allocation goes, are taken care of by the register allocator.
patchRegsOfInstr :: instr -> (Reg -> Reg) -> instr Source #
Apply a given mapping to all the register references in this instruction.
isJumpishInstr :: instr -> Bool Source #
Checks whether this instruction is a jump/branch instruction. One that can change the flow of control in a way that the register allocator needs to worry about.
jumpDestsOfInstr :: instr -> [BlockId] Source #
Give the possible destinations of this jump instruction. Must be defined for all jumpish instructions.
patchJumpInstr :: instr -> (BlockId -> BlockId) -> instr Source #
Change the destination of this jump instruction. Used in the linear allocator when adding fixup blocks for join points.
mkSpillInstr :: DynFlags -> Reg -> Int -> Int -> instr Source #
An instruction to spill a register into a spill slot.
mkLoadInstr :: DynFlags -> Reg -> Int -> Int -> instr Source #
An instruction to reload a register from a spill slot.
takeDeltaInstr :: instr -> Maybe Int Source #
See if this instruction is telling us the current C stack delta
isMetaInstr :: instr -> Bool Source #
Check whether this instruction is some meta thing inserted into the instruction stream for other purposes.
Not something that has to be treated as a real machine instruction and have its registers allocated.
eg, comments, delta, ldata, etc.
mkRegRegMoveInstr :: Platform -> Reg -> Reg -> instr Source #
Copy the value in a register to another one. Must work for all register classes.
takeRegRegMoveInstr :: instr -> Maybe (Reg, Reg) Source #
Take the source and destination from this reg -> reg move instruction or Nothing if it's not one
mkJumpInstr :: BlockId -> [instr] Source #
Make an unconditional jump instruction. For architectures with branch delay slots, its ok to put a NOP after the jump. Don't fill the delay slot with an instruction that references regs or you'll confuse the linear allocator.
mkStackAllocInstr :: Platform -> Int -> instr Source #
mkStackDeallocInstr :: Platform -> Int -> instr Source #
Instruction Instr # | Instruction instance for powerpc |
Instruction Instr # | instance for sparc instruction set |
Instruction Instr # | Instruction instance for x86 instruction set. |
Instruction instr => Instruction (InstrSR instr) # | |