18 -- | Holds a list of source and destination registers used by a
19 -- particular instruction.
21 -- Machine registers that are pre-allocated to stgRegs are filtered
22 -- out, because they are uninteresting from a register allocation
23 -- standpoint. (We wouldn't want them to end up on the free list!)
25 -- As far as we are concerned, the fixed registers simply don't exist
26 -- (for allocation purposes, anyway).
31 -- | No regs read or written to.
36 -- Our flavours of the Cmm types
37 -- Type synonyms for Cmm populated with native code
51 type NatBasicBlock instr
57 -- | Common things that we can do with instructions, on all architectures.
58 -- These are used by the shared parts of the native code generator,
59 -- specifically the register allocators.
61 class Instruction instr where
63 -- | Get the registers that are being used by this instruction.
64 -- regUsage doesn't need to do any trickery for jumps and such.
65 -- Just state precisely the regs read and written by that insn.
66 -- The consequences of control flow transfers, as far as register
67 -- allocation goes, are taken care of by the register allocator.
74 -- | Apply a given mapping to all the register references in this
82 -- | Checks whether this instruction is a jump/branch instruction.
83 -- One that can change the flow of control in a way that the
84 -- register allocator needs to worry about.
89 -- | Give the possible destinations of this jump instruction.
90 -- Must be defined for all jumpish instructions.
95 -- | Change the destination of this jump instruction.
96 -- Used in the linear allocator when adding fixup blocks for join
100 -> (BlockId -> BlockId)
104 -- | An instruction to spill a register into a spill slot.
106 :: Reg -- ^ the reg to spill
107 -> Int -- ^ the current stack delta
108 -> Int -- ^ spill slot to use
112 -- | An instruction to reload a register from a spill slot.
114 :: Reg -- ^ the reg to reload.
115 -> Int -- ^ the current stack delta
116 -> Int -- ^ the spill slot to use
119 -- | See if this instruction is telling us the current C stack delta
124 -- | Check whether this instruction is some meta thing inserted into
125 -- the instruction stream for other purposes.
127 -- Not something that has to be treated as a real machine instruction
128 -- and have its registers allocated.
130 -- eg, comments, delta, ldata, etc.
137 -- | Copy the value in a register to another one.
138 -- Must work for all register classes.
140 :: Reg -- ^ source register
141 -> Reg -- ^ destination register
144 -- | Take the source and destination from this reg -> reg move instruction
145 -- or Nothing if it's not one
150 -- | Make an unconditional jump instruction.
151 -- For architectures with branch delay slots, its ok to put
152 -- a NOP after the jump. Don't fill the delay slot with an
153 -- instruction that references regs or you'll confuse the