Module Flambda2_terms.Flambda_primitive
"Primitive" operations: those that perform computation but never affect control flow.
Primitives that accept float, int32, int64 or nativeint values always take (or return) the unboxed versions.
No primitive raises an exception. (Bounds checking is handled separately.)
module Lazy_block_tag : sig ... endmodule Block_kind : sig ... endmodule Array_kind : sig ... endmodule Array_kind_for_length : sig ... endmodule Init_or_assign : sig ... endmodule Array_load_kind : sig ... endmodule Array_set_kind : sig ... endmodule Duplicate_block_kind : sig ... endmodule Duplicate_array_kind : sig ... endmodule Block_access_field_kind : sig ... endmodule Mixed_block_access_field_kind : sig ... endmodule Block_access_kind : sig ... endmodule Bigarray_kind : sig ... endmodule Bigarray_layout : sig ... endval kind_of_string_accessor_width :
Flambda2_terms.Flambda_primitive.string_accessor_width ->
Flambda2_kinds.Flambda_kind.tval byte_width_of_string_accessor_width :
Flambda2_terms.Flambda_primitive.string_accessor_width ->
inttype nullary_primitive = | Invalid of Flambda2_kinds.Flambda_kind.t(*Used when rebuilding a primitive that turns out to be invalid. This is easier to use than turning a whole let-binding into Invalid (which might end up deleting code on the way up, resulting in a typing env out-of-sync with the generated code).
*)| Optimised_out of Flambda2_kinds.Flambda_kind.t(*Used for phantom bindings for which there is not enough information remaining to build a meaningful value. Can only be used in a phantom let-binding.
*)| Probe_is_enabled of {}(*Returns a boolean saying whether the given tracing probe is enabled. Semaphore initialization code may be emitted as a consequence of seeing this instruction, but the emitter checks that all occurrences of
*)enabled_at_initare consistent for a given probename.| Enter_inlined_apply of {}(*Used in classic mode to denote the start of an inlined function body. This is then used in to_cmm to correctly add inlined debuginfo.
*)| Dls_get(*Obtain the domain-local state block.
*)| Tls_get(*Obtain the thread-local state block.
*)| Poll(*Poll for runtime actions. May run pending actions such as signal handlers, finalizers, memprof callbacks, etc, as well as GCs and GC slices, so should not be moved or optimised away.
*)| Cpu_relax(*Arch-specific pause. If poll insertion is disabled, also acts as a polling point.
*)
Primitives taking exactly zero arguments.
Untagged binary integer arithmetic operations.
Swap_byte_endianness on a Tagged_immediate treats the immediate as encoding a 16-bit quantity (described in the least significant 16 bits of the immediate after untagging) and exchanges the two halves of the 16-bit quantity. The higher-order bits are zeroed.
module Reinterpret_64_bit_word : sig ... endReinterpretation operations for 64-bit words.
type unary_primitive = | Block_load of {kind : Flambda2_terms.Flambda_primitive.Block_access_kind.t;mut : Flambda2_terms.Mutability.t;field : Flambda2_numbers.Target_ocaml_int.t;
}| Duplicate_block of {}(*
*)Duplicate_blockmay not be used to change the tag or the mutability of a block.| Duplicate_array of {kind : Flambda2_terms.Flambda_primitive.Duplicate_array_kind.t;source_mutability : Flambda2_terms.Mutability.t;destination_mutability : Flambda2_terms.Mutability.t;
}| Is_int of {}| Is_null| Get_tag| Array_length of Flambda2_terms.Flambda_primitive.Array_kind_for_length.t(*The unarized length of an array. So for an example an array of kind
*)Unboxed_product [tagged_immediate; tagged_immediate]always has a length that is a multiple of two.| Bigarray_length of {}(*This primitive is restricted by type-checking to bigarrays that have at least the correct number of dimensions. More specifically, they come from `%caml_ba_dim_x` primitives (for x=1,2,3), and only exposed in the Bigarray.ArrayX modules (incidentally, `dimension` should then be one of 1,2,3).
*)| String_length of Flambda2_terms.Flambda_primitive.string_or_bytes| Int_as_pointer of Flambda2_term_basics.Alloc_mode.For_allocations.t| Opaque_identity of {middle_end_only : bool;kind : Flambda2_kinds.Flambda_kind.t;
}| Int_arith of Flambda2_kinds.Flambda_kind.Standard_int.t * Flambda2_terms.Flambda_primitive.unary_int_arith_op| Float_arith of Flambda2_terms.Flambda_primitive.float_bitwidth * Flambda2_terms.Flambda_primitive.unary_float_arith_op| Num_conv of {src : Flambda2_kinds.Flambda_kind.Standard_int_or_float.t;dst : Flambda2_kinds.Flambda_kind.Standard_int_or_float.t;
}| Boolean_not| Reinterpret_64_bit_word of Flambda2_terms.Flambda_primitive.Reinterpret_64_bit_word.t| Unbox_number of Flambda2_kinds.Flambda_kind.Boxable_number.t| Box_number of Flambda2_kinds.Flambda_kind.Boxable_number.t * Flambda2_term_basics.Alloc_mode.For_allocations.t| Untag_immediate| Tag_immediate| Project_function_slot of {move_from : Flambda2_identifiers.Function_slot.t;move_to : Flambda2_identifiers.Function_slot.t;
}(*Project a function slot from a set of closures, which is actually achieved by providing a known function slot
*)move_fromand the desired function slotmove_to, which must be within the same set of closures.| Project_value_slot of {project_from : Flambda2_identifiers.Function_slot.t;value_slot : Flambda2_identifiers.Value_slot.t;
}(*Project a value slot from a set of closures -- in other words, read an entry from the closure environment (the captured variables).
*)| Is_boxed_float(*Only valid when the float array optimisation is enabled.
*)| Is_flat_float_array(*Only valid when the float array optimisation is enabled.
*)| End_region of {}(*Ending delimiter of local allocation region, accepting a region name.
*)| End_try_region of {}(*Corresponding delimiter for
*)Begin_try_region.| Obj_dup(*Corresponds to
*)Obj.dup; see the documentation in obj.mli.| Get_header(*Get the header of a block. This primitive is invalid if provided with an immediate value. It should also not be used to read tags above
*)No_scan_tag. Note: The GC color bits in the header are not reliable except for checking if the value is locally allocated Invariant: never read the tag of a possibly-lazy value from ocamlopt-generated code. Tag reads that are allowed to be lazy tags (by the type system) should always go through caml_obj_tag, which is opaque to the compiler.| Peek of Flambda2_kinds.Flambda_kind.Standard_int_or_float.t| Make_lazy of Flambda2_terms.Flambda_primitive.Lazy_block_tag.t
Primitives taking exactly one argument.
type 'signed_or_unsigned comparison_behaviour = | Yielding_bool of 'signed_or_unsigned Flambda2_terms.Flambda_primitive.comparison| Yielding_int_like_compare_functions of 'signed_or_unsigned
Whether a comparison is to yield a boolean result, as given by a particular comparison operator, or whether it is to behave in the manner of "compare" functions that yield tagged immediates -1, 0 or 1.
Binary arithmetic operations on integers.
type binary_primitive = | Block_set of {kind : Flambda2_terms.Flambda_primitive.Block_access_kind.t;init : Flambda2_terms.Flambda_primitive.Init_or_assign.t;field : Flambda2_numbers.Target_ocaml_int.t;
}| Array_load of Flambda2_terms.Flambda_primitive.Array_kind.t * Flambda2_terms.Flambda_primitive.Array_load_kind.t * Flambda2_terms.Mutability.t(*Unarized or SIMD array load.
The array kind preserves unboxed product information but the load kind and index all correspond to the unarized representation. See also
*)Array_length, above.| String_or_bigstring_load of Flambda2_terms.Flambda_primitive.string_like_value * Flambda2_terms.Flambda_primitive.string_accessor_width| Bigarray_load of Flambda2_terms.Flambda_primitive.num_dimensions * Flambda2_terms.Flambda_primitive.Bigarray_kind.t * Flambda2_terms.Flambda_primitive.Bigarray_layout.t| Phys_equal of Flambda2_terms.Flambda_primitive.equality_comparison(*
*)Phys_equalis only for things of kindValue.| Int_arith of Flambda2_kinds.Flambda_kind.Standard_int.t * Flambda2_terms.Flambda_primitive.binary_int_arith_op| Int_shift of Flambda2_kinds.Flambda_kind.Standard_int.t * Flambda2_terms.Flambda_primitive.int_shift_op| Int_comp of Flambda2_kinds.Flambda_kind.Standard_int.t * Flambda2_terms.Flambda_primitive.signed_or_unsigned Flambda2_terms.Flambda_primitive.comparison_behaviour| Float_arith of Flambda2_terms.Flambda_primitive.float_bitwidth * Flambda2_terms.Flambda_primitive.binary_float_arith_op| Float_comp of Flambda2_terms.Flambda_primitive.float_bitwidth * unit Flambda2_terms.Flambda_primitive.comparison_behaviour| Bigarray_get_alignment of int| Atomic_load_field of Flambda2_terms.Flambda_primitive.Block_access_field_kind.t| Poke of Flambda2_kinds.Flambda_kind.Standard_int_or_float.t| Read_offset of Flambda2_kinds.Flambda_kind.With_subkind.t * Asttypes.mutable_flag
Primitives taking exactly two arguments.
type ternary_primitive = | Array_set of Flambda2_terms.Flambda_primitive.Array_kind.t * Flambda2_terms.Flambda_primitive.Array_set_kind.t(*Unarized array update, for mutable arrays. See
*)Array_loadabove for more details on the unarization.| Bytes_or_bigstring_set of Flambda2_terms.Flambda_primitive.bytes_like_value * Flambda2_terms.Flambda_primitive.string_accessor_width| Bigarray_set of Flambda2_terms.Flambda_primitive.num_dimensions * Flambda2_terms.Flambda_primitive.Bigarray_kind.t * Flambda2_terms.Flambda_primitive.Bigarray_layout.t| Atomic_field_int_arith of Flambda2_terms.Flambda_primitive.int_atomic_op| Atomic_set_field of Flambda2_terms.Flambda_primitive.Block_access_field_kind.t| Atomic_exchange_field of Flambda2_terms.Flambda_primitive.Block_access_field_kind.t| Write_offset of Flambda2_kinds.Flambda_kind.With_subkind.t * Flambda2_term_basics.Alloc_mode.For_assignments.t
Primitives taking exactly three arguments.
type quaternary_primitive = | Atomic_compare_and_set_field of Flambda2_terms.Flambda_primitive.Block_access_field_kind.t| Atomic_compare_exchange_field of {atomic_kind : Flambda2_terms.Flambda_primitive.Block_access_field_kind.t;(*The kind of values which the atomic can hold.
*)args_kind : Flambda2_terms.Flambda_primitive.Block_access_field_kind.t;(*The kind of values which the compare-exchange operation is to be used with on this particular occasion. Note that this might be
*)Immediateeven though the atomic is marked asAny_value, for example.
}
Primitives taking exactly four arguments.
type variadic_primitive = | Begin_region of {}(*Starting delimiter of local allocation region, returning a region name. For regions for the "try" part of a "try...with", use
*)Begin_try_region(below) instead.| Begin_try_region of {}(*Starting delimiter of local allocation region, when used for a "try" body.
*)| Make_block of Flambda2_terms.Flambda_primitive.Block_kind.t * Flambda2_terms.Mutability.t * Flambda2_term_basics.Alloc_mode.For_allocations.t| Make_array of Flambda2_terms.Flambda_primitive.Array_kind.t * Flambda2_terms.Mutability.t * Flambda2_term_basics.Alloc_mode.For_allocations.t
Primitives taking zero or more arguments.
type t = | Nullary of Flambda2_terms.Flambda_primitive.nullary_primitive| Unary of Flambda2_terms.Flambda_primitive.unary_primitive * Flambda2_term_basics.Simple.t| Binary of Flambda2_terms.Flambda_primitive.binary_primitive * Flambda2_term_basics.Simple.t * Flambda2_term_basics.Simple.t| Ternary of Flambda2_terms.Flambda_primitive.ternary_primitive * Flambda2_term_basics.Simple.t * Flambda2_term_basics.Simple.t * Flambda2_term_basics.Simple.t| Quaternary of Flambda2_terms.Flambda_primitive.quaternary_primitive * Flambda2_term_basics.Simple.t * Flambda2_term_basics.Simple.t * Flambda2_term_basics.Simple.t * Flambda2_term_basics.Simple.t| Variadic of Flambda2_terms.Flambda_primitive.variadic_primitive * Flambda2_term_basics.Simple.t list
The application of a primitive to its arguments.
type primitive_application = Flambda2_terms.Flambda_primitive.tinclude Flambda2_nominal.Contains_names.S
with type t := Flambda2_terms.Flambda_primitive.t
val free_names :
Flambda2_terms.Flambda_primitive.t ->
Flambda2_nominal.Name_occurrences.tCompute the free names of a term. Such computation covers all kinds of bindable names (variables, continuations, ...)
val apply_renaming :
Flambda2_terms.Flambda_primitive.t ->
Flambda2_nominal.Renaming.t ->
Flambda2_terms.Flambda_primitive.tApply a renaming throughout a term.
include Flambda2_nominal.Contains_ids.S
with type t := Flambda2_terms.Flambda_primitive.t
val ids_for_export :
Flambda2_terms.Flambda_primitive.t ->
Flambda2_nominal.Ids_for_export.tGather all table identifiers to export them.
val args :
Flambda2_terms.Flambda_primitive.t ->
Flambda2_term_basics.Simple.t listmodule Without_args : sig ... endSimpler version (e.g. for Inlining_cost), where only the actual primitive matters, not the arguments.
val arg_kind_of_unary_primitive :
Flambda2_terms.Flambda_primitive.unary_primitive ->
Flambda2_kinds.Flambda_kind.tA description of the kind of values which a unary primitive expects as its arguments.
val args_kind_of_binary_primitive :
Flambda2_terms.Flambda_primitive.binary_primitive ->
Flambda2_kinds.Flambda_kind.t * Flambda2_kinds.Flambda_kind.tval args_kind_of_ternary_primitive :
Flambda2_terms.Flambda_primitive.ternary_primitive ->
Flambda2_kinds.Flambda_kind.t
* Flambda2_kinds.Flambda_kind.t
* Flambda2_kinds.Flambda_kind.tval args_kind_of_quaternary_primitive :
Flambda2_terms.Flambda_primitive.quaternary_primitive ->
Flambda2_kinds.Flambda_kind.t
* Flambda2_kinds.Flambda_kind.t
* Flambda2_kinds.Flambda_kind.t
* Flambda2_kinds.Flambda_kind.ttype arg_kinds = | Variadic_mixed of Flambda2_kinds.Flambda_kind.Mixed_block_shape.t| Variadic_all_of_kind of Flambda2_kinds.Flambda_kind.t| Variadic_zero_or_one of Flambda2_kinds.Flambda_kind.t| Variadic_unboxed_product of Flambda2_kinds.Flambda_kind.t list
val args_kind_of_variadic_primitive :
Flambda2_terms.Flambda_primitive.variadic_primitive ->
Flambda2_terms.Flambda_primitive.arg_kindstype result_kind = | Singleton of Flambda2_kinds.Flambda_kind.t(*The primitive returns a single value of the given kind.
*)| Unit(*The primitive returns the constant unit value.
*)
A description of the kinds of values (or in the case of Unit, the actual value) which a primitive returns.
val result_kind_of_nullary_primitive :
Flambda2_terms.Flambda_primitive.nullary_primitive ->
Flambda2_terms.Flambda_primitive.result_kindval result_kind_of_unary_primitive :
Flambda2_terms.Flambda_primitive.unary_primitive ->
Flambda2_terms.Flambda_primitive.result_kindval result_kind_of_binary_primitive :
Flambda2_terms.Flambda_primitive.binary_primitive ->
Flambda2_terms.Flambda_primitive.result_kindval result_kind_of_ternary_primitive :
Flambda2_terms.Flambda_primitive.ternary_primitive ->
Flambda2_terms.Flambda_primitive.result_kindval result_kind_of_quaternary_primitive :
Flambda2_terms.Flambda_primitive.quaternary_primitive ->
Flambda2_terms.Flambda_primitive.result_kindval result_kind_of_variadic_primitive :
Flambda2_terms.Flambda_primitive.variadic_primitive ->
Flambda2_terms.Flambda_primitive.result_kindval result_kind :
Flambda2_terms.Flambda_primitive.t ->
Flambda2_terms.Flambda_primitive.result_kindDescribe the kind of the result of the given primitive.
val result_kind_of_nullary_primitive' :
Flambda2_terms.Flambda_primitive.nullary_primitive ->
Flambda2_kinds.Flambda_kind.tLike the result_kinds, but returns the appropriate Flambda_kind.
val result_kind_of_unary_primitive' :
Flambda2_terms.Flambda_primitive.unary_primitive ->
Flambda2_kinds.Flambda_kind.tval result_kind_of_binary_primitive' :
Flambda2_terms.Flambda_primitive.binary_primitive ->
Flambda2_kinds.Flambda_kind.tval result_kind_of_ternary_primitive' :
Flambda2_terms.Flambda_primitive.ternary_primitive ->
Flambda2_kinds.Flambda_kind.tval result_kind_of_quaternary_primitive' :
Flambda2_terms.Flambda_primitive.quaternary_primitive ->
Flambda2_kinds.Flambda_kind.tval result_kind_of_variadic_primitive' :
Flambda2_terms.Flambda_primitive.variadic_primitive ->
Flambda2_kinds.Flambda_kind.tval result_kind' :
Flambda2_terms.Flambda_primitive.t ->
Flambda2_kinds.Flambda_kind.tval effects_and_coeffects :
Flambda2_terms.Flambda_primitive.t ->
Flambda2_terms.Effects_and_coeffects.tDescribe the effects and coeffects that the application of the given primitive may have.
val no_effects_or_coeffects : Flambda2_terms.Flambda_primitive.t -> boolReturns true iff the given primitive has neither effects nor coeffects.
val at_most_generative_effects : Flambda2_terms.Flambda_primitive.t -> boolval only_generative_effects : Flambda2_terms.Flambda_primitive.t -> boolReturns true iff the given primitive has generative effects, and no other effects.
module Eligible_for_cse : sig ... endinclude Flambda2_algorithms.Container_types.S
with type t := Flambda2_terms.Flambda_primitive.t
module T :
Flambda2_algorithms.Container_types_intf.Thing
with type t = Flambda2_terms.Flambda_primitive.tinclude Flambda2_algorithms.Container_types_intf.Thing
with type t := Flambda2_terms.Flambda_primitive.T.t
include Stdlib.Hashtbl.HashedType
with type t := Flambda2_terms.Flambda_primitive.T.t
val hash : Flambda2_terms.Flambda_primitive.T.t -> intA hashing function on keys. It must be such that if two keys are equal according to equal, then they have identical hash values as computed by hash. Examples: suitable (equal, hash) pairs for arbitrary key types include
- (
(=),hash) for comparing objects by structure (provided objects do not contain floats) - (
(fun x y -> compare x y = 0),hash) for comparing objects by structure and handlingStdlib.nancorrectly - (
(==),hash) for comparing objects by physical equality (e.g. for mutable or cyclic objects).
include Stdlib.Map.OrderedType
with type t := Flambda2_terms.Flambda_primitive.T.t
val compare :
Flambda2_terms.Flambda_primitive.T.t ->
Flambda2_terms.Flambda_primitive.T.t ->
intA total ordering function over the keys. This is a two-argument function f such that f e1 e2 is zero if the keys e1 and e2 are equal, f e1 e2 is strictly negative if e1 is smaller than e2, and f e1 e2 is strictly positive if e1 is greater than e2. Example: a suitable ordering function is the generic structural comparison function Stdlib.compare.
val print :
Stdlib.Format.formatter ->
Flambda2_terms.Flambda_primitive.T.t ->
unitmodule Set :
Flambda2_algorithms.Container_types_intf.Set
with type elt = Flambda2_terms.Flambda_primitive.tmodule Map :
Flambda2_algorithms.Container_types_intf.Map
with type key = Flambda2_terms.Flambda_primitive.t
and module Set = Flambda2_terms.Flambda_primitive.Setval equal :
Flambda2_terms.Flambda_primitive.t ->
Flambda2_terms.Flambda_primitive.t ->
boolval equal_nullary_primitive :
Flambda2_terms.Flambda_primitive.nullary_primitive ->
Flambda2_terms.Flambda_primitive.nullary_primitive ->
boolval equal_unary_primitive :
Flambda2_terms.Flambda_primitive.unary_primitive ->
Flambda2_terms.Flambda_primitive.unary_primitive ->
boolval equal_binary_primitive :
Flambda2_terms.Flambda_primitive.binary_primitive ->
Flambda2_terms.Flambda_primitive.binary_primitive ->
boolval equal_ternary_primitive :
Flambda2_terms.Flambda_primitive.ternary_primitive ->
Flambda2_terms.Flambda_primitive.ternary_primitive ->
boolval equal_quaternary_primitive :
Flambda2_terms.Flambda_primitive.quaternary_primitive ->
Flambda2_terms.Flambda_primitive.quaternary_primitive ->
boolval equal_variadic_primitive :
Flambda2_terms.Flambda_primitive.variadic_primitive ->
Flambda2_terms.Flambda_primitive.variadic_primitive ->
boolval compare_primitive_application :
compare_simple:
(Flambda2_term_basics.Simple.t -> Flambda2_term_basics.Simple.t -> int) ->
Flambda2_terms.Flambda_primitive.t ->
Flambda2_terms.Flambda_primitive.t ->
intval is_begin_or_end_region : Flambda2_terms.Flambda_primitive.t -> boolval is_begin_region : Flambda2_terms.Flambda_primitive.t -> boolval is_end_region :
Flambda2_terms.Flambda_primitive.t ->
Flambda2_identifiers.Variable.t option