Module Flambda2_to_cmm.To_cmm_result
Result structure used during Flambda to Cmm translation.
An accumulator for the Cmm phrases and GC roots that result from translating statically-allocated blocks and function bodies.
Values of type t contain both older, "archived" data and "current" data which is still being worked on. The archive_data function transfers current data into the archived part, clearing the current data area for subsequent use.
val create :
module_symbol:Flambda2_identifiers.Symbol.t ->
reachable_names:Flambda2_nominal.Name_occurrences.t ->
tCreate a result structure.
reachable_names specifies which names are reachable from outside the compilation unit (same terminology as used in Flambda_cmx).
val symbol : t -> Flambda2_identifiers.Symbol.t -> Cmm.symbolTranslate an existing Symbol.t to a Cmm symbol.
val symbol_of_code_id :
t ->
Flambda2_identifiers.Code_id.t ->
currently_in_inlined_body:bool ->
Cmm.symbolProduce the Cmm function symbol for a piece of code.
val raw_symbol : t -> global:Cmm.is_global -> string -> t * Cmm.symbolCreate a Cmm symbol, not arising from a Symbol.t.
val add_archive_data_items : t -> Cmm.data_item list -> tAdd already-translated Cmm data items into the archived part of the result structure.
val update_data : t -> (Cmm.data_item list -> Cmm.data_item list) -> tUpdate the current data part of the result structure.
val set_data : t -> Cmm.data_item list -> tSet the current data to the given list. Raises a fatal error if the current data is not empty, to avoid inadvertently losing data.
val add_gc_roots : t -> Flambda2_identifiers.Symbol.t list -> tRegister one or more symbols as required GC roots.
val add_function : t -> Cmm.fundecl -> tRegister a function that has been translated to Cmm.
val check_for_module_symbol : t -> Flambda2_identifiers.Symbol.t -> tRecord the given symbol as having been defined. This is used to keep track of whether the module block symbol for the current unit has been defined.
val add_invalid_message_symbol :
t ->
Flambda2_identifiers.Symbol.t ->
message:string ->
tCaching of symbols associated with Invalid messages.
val invalid_message_symbol :
t ->
message:string ->
Flambda2_identifiers.Symbol.t optiontype result = private {data_items : Cmm.phrase list;gc_roots : Cmm.symbol list;functions : Cmm.phrase list;
}