Module Fang_x64.Alloc

val alloc_without_handling_spills : graph -> [ `Allocation of graph | `Spill of Box.Set.t ]

alloc_without_handling_spills g is either a successful allocation of processor registers to temporary boxes or the set of boxes that could not be assigned a register (they were "spilled").

type spilling_handler = Spilling.handler

See SPILLING.handler.

val adjust_for_spills : stack_size:int -> spilling_handler -> asm -> asm list

adjust_for_spills ~stack_size h s is an expansion of an assembly instruction s into multiple instructions which account for the possibility that one of the read- or written-to boxes in s is spilled.

For example, if an instruction needs to read from a box that has spilled, the instruction must be replaced with ones that first populates the box with the value from memory.

val alloc : stack_size:int -> graph -> graph * int

alloc ~stack_size g is a graph where every box has been assigned a processor register. stack_size is the size of the stack in the frame corresponding to g.

The result also includes the stack size of the amended graph.