package ocaml-base-compiler
module Index : Identifiable.S
The module Index
is used to filter and group the generated subranges. Inclusion of a computed subrange in the result is conditional upon the existence of an index that can be associated to it. To give a concrete example, the keys associated to ranges might be pseudoregisters, and the indexes variable names (c.f. Available_ranges_vars
). Every register that is not known to hold the value of some variable is dropped from the result.
module Key : sig ... end
The module Key
corresponds to the identifiers that define the ranges in Linearize
instructions. Each instruction should have two sets of keys, available_before
and available_across
, with accessor functions of these names being provided to retrieve them. The notion of "availability" is not prescribed. The availability sets are used to compute subranges associated to each key.
module Range_info :
Compute_ranges_intf.S_range_info
with type key := Key.t
with type index := Index.t
The module Range_info
is used to store additional information on a range that is associated to a range at its creation and can be retrieved from the result. The association between keys and indices is also done here: Range_info.create
serves both as a map between keys and indices; and also as the creator of the Range_info.t
structure. When several subranges are contained in a single range, the associated Range_info.t
will correspond to the first closed subrange.
The module Subrange_state
describes information that needs to be propagated and passed to Subrange_info.create
. The state that will be used for subrange creation is the state at the end of the subrange, not at the beginning.
module Subrange_info :
Compute_ranges_intf.S_subrange_info
with type key := Key.t
with type subrange_state := Subrange_state.t
The module Subrange_info
has a similar purpose to Range_info
, but for subranges. Its distinguishing property is that it can store information about its context using the additional subrange_state
parameter of its create
function.
val available_before : Compute_ranges_intf.L.instruction -> Key.Set.t
How to retrieve from an instruction those keys that are available immediately before the instruction starts executing.
val available_across : Compute_ranges_intf.L.instruction -> Key.Set.t
How to retrieve from an instruction those keys that are available between the points at which the instruction reads its arguments and writes its results.
This must_restart_ranges_upon_any_change
boolean exists because some consumers of the range information may require that two subranges are disjoint rather than including one in another. When this function returns true
, whenever a subrange is opened or closed, all other overlapping subranges will be split in two at the same point.