HORIZON HASKELLDocslts/ghc-9.14.x45dd5372026-10-11Search names, modules, packages, or :: a typeCtrl K

GHC 9.14.1 · lts/ghc-9.14.x · 45dd537 · 2026-10-11

Moduleghc-9.14.1GHC2021

GHC.CmmToAsm.RV64.Instr

  • 5 types
  • 106 values
  • Packageghc-9.14.1
  • Exports111
  • LanguageGHC2021
  • LicenceBSD-3-Clause
  • SourceInstr.hs

Stack frame header size in bytes.

The stack frame header is made of the values that are always saved (regardless of the context.) It consists of the saved return address and a pointer to the previous frame. Thus, its size is two stack frame slots which equals two addresses/words (2 * 8 byte).

valuestackAlign :: Int
#

The number of bytes that the stack pointer should be aligned to.

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.

RegUsage = RU [regs] [regs]

valuecallerSavedRegisters :: [Reg]
#

Caller-saved registers (according to calling convention)

These registers may be clobbered after a jump.

valueisJumpishInstr :: Instr -> Bool
#

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.

valuepatchJumpInstr :: Instr -> (BlockId -> BlockId) -> Instr
#

Change the destination of this (potential) jump instruction.

Used in the linear allocator when adding fixup blocks for join points.

Take the source and destination from this (potential) reg -> reg move instruction

We have to be a bit careful here: A MOV can also mean an implicit conversion. This case is filtered out.

valuemkStackAllocInstr :: Platform -> Int -> [Instr]
#

Decrement sp to allocate stack space.

The stack grows downwards, so we decrement the stack pointer by n (bytes). This is dual to mkStackDeallocInstr. sp is the RISCV stack pointer, not to be confused with the STG stack pointer.

valuemkStackDeallocInstr :: Platform -> Int -> [Instr]
#

Increment SP to deallocate stack space.

The stack grows downwards, so we increment the stack pointer by n (bytes). This is dual to mkStackAllocInstr. sp is the RISCV stack pointer, not to be confused with the STG stack pointer.

datadata Instr
#

Constructors

Instances1Instruction

Orphan instances

1 instance