jon.recoil.org

Module Flambda2_kinds.Flambda_arity

Arities are used to describe the layouts of things like function and continuation parameter lists.

In Flambda 2, variables are always assigned kinds, which are at most register width (e.g. 64-bit integer machine word width, or 128-bit SIMD machine word width). Variables from Lambda which cannot be accommodated in one register, for example if they are of an unboxed product layout, are split by a process called unarization.

Despite this, `Complex arities preserve the information about any unboxed products, for later use (e.g. during Cmm translation to optimize caml_apply).

type _ t

Print an arity to a formatter.

module Component_for_creation : sig ... end

One component per function or continuation parameter, for example. Each component may in turn have an arity describing an unboxed product.

A shorthand for creation of arities where no parameter has an unboxed product layout.

"No parameters". (Not e.g. "one parameter of type void".)

val num_params : _ Flambda2_kinds.Flambda_arity.t -> int

How many parameters, potentially of unboxed product layout, the given arity describes.

val equal_ignoring_subkinds : 'a Flambda2_kinds.Flambda_arity.t -> 'a Flambda2_kinds.Flambda_arity.t -> bool

Comparison of arities, but ignoring subkind information.

It's usually a mistake to use this function, but it's needed for Compare. This is like equal_ignoring_subkinds but also insists on equality of subkind information.

val is_one_param_of_kind_value : _ Flambda2_kinds.Flambda_arity.t -> bool

Returns true iff the given arity describes one parameter of kind Value. (Note that this function does not look inside unboxed products, not even ones with a single component.)

Convert, in a left-to-right depth-first order, an arity into a flattened list of kinds for all parameters.

val unarized_components : [ `Unarized ] Flambda2_kinds.Flambda_arity.t -> Flambda2_kinds.Flambda_kind.With_subkind.t list

Like unarize but works on arities that are known not to contain any unboxed products.

val unarize_per_parameter : [ `Complex ] Flambda2_kinds.Flambda_arity.t -> Flambda2_kinds.Flambda_kind.With_subkind.t list list

Like unarize but returns one list per parameter.

val unarize_t : [ `Complex ] Flambda2_kinds.Flambda_arity.t -> [ `Unarized ] Flambda2_kinds.Flambda_arity.t

Like unarize but returns a value of type t.

Given an arity and an identifier, produce a list of identifiers (with corresponding kinds) whose length matches unarize t, with names derived from the given identifier.

val cardinal_unarized : _ Flambda2_kinds.Flambda_arity.t -> int

The length of the list returned by unarize.

val group_by_parameter : [ `Complex ] Flambda2_kinds.Flambda_arity.t -> 'a list -> 'a list list
val from_lambda_list : Lambda.layout list -> machine_width:Target_system.Machine_width.t -> [ `Complex ] Flambda2_kinds.Flambda_arity.t

Take a list of Lambda layouts, one per parameter, and form the corresponding arity.

val partially_apply : [ `Complex ] Flambda2_kinds.Flambda_arity.t -> num_non_unarized_params_provided:int -> [ `Complex ] Flambda2_kinds.Flambda_arity.t

Remove the first portion of an arity to correspond to a partial application (or other similar situation).

Concatenation of two arities, usually used to add information about more parameters to an existing arity.