jon.recoil.org

Module Regalloc_affinity

This module implements a basic variant of affinity: we compute the numbers of moves between temporaries and physical registers, and use this information in register allocators to try to assign a temporary to a physical register with high affinity.

type affinity = {
  1. priority : int;
  2. phys_reg : Regs.Phys_reg.t;
}
type t
val compute : Cfg_with_infos.t -> Regalloc_split.phi_move list -> t

Computes the affinities for the passed CFG, i.e. for each temporary the number of times it moves from/to a given physical register.

type affinities
val get : t -> Reg.t -> affinities

Returns the affinities for the passed temporary in descending order (i.e. from the highest to the lowest affinity), use `next` to get the elements in order.

val next : affinities -> affinity option

Returns the next affinity if there is one, `None` otherwise