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 ->
Flambda2_to_cmm.To_cmm_result.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 :
Flambda2_to_cmm.To_cmm_result.t ->
Flambda2_identifiers.Symbol.t ->
Cmm.symbolTranslate an existing Symbol.t to a Cmm symbol.
val symbol_of_code_id :
Flambda2_to_cmm.To_cmm_result.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 :
Flambda2_to_cmm.To_cmm_result.t ->
global:Cmm.is_global ->
string ->
Flambda2_to_cmm.To_cmm_result.t * Cmm.symbolCreate a Cmm symbol, not arising from a Symbol.t.
val archive_data :
Flambda2_to_cmm.To_cmm_result.t ->
Flambda2_to_cmm.To_cmm_result.tArchive the current data into the list of already-translated data.
val add_archive_data_items :
Flambda2_to_cmm.To_cmm_result.t ->
Cmm.data_item list ->
Flambda2_to_cmm.To_cmm_result.tAdd already-translated Cmm data items into the archived part of the result structure.
val update_data :
Flambda2_to_cmm.To_cmm_result.t ->
(Cmm.data_item list -> Cmm.data_item list) ->
Flambda2_to_cmm.To_cmm_result.tUpdate the current data part of the result structure.
val set_data :
Flambda2_to_cmm.To_cmm_result.t ->
Cmm.data_item list ->
Flambda2_to_cmm.To_cmm_result.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 :
Flambda2_to_cmm.To_cmm_result.t ->
Flambda2_identifiers.Symbol.t list ->
Flambda2_to_cmm.To_cmm_result.tRegister one or more symbols as required GC roots.
val add_function :
Flambda2_to_cmm.To_cmm_result.t ->
Cmm.fundecl ->
Flambda2_to_cmm.To_cmm_result.tRegister a function that has been translated to Cmm.
val check_for_module_symbol :
Flambda2_to_cmm.To_cmm_result.t ->
Flambda2_identifiers.Symbol.t ->
Flambda2_to_cmm.To_cmm_result.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 :
Flambda2_to_cmm.To_cmm_result.t ->
Flambda2_identifiers.Symbol.t ->
message:string ->
Flambda2_to_cmm.To_cmm_result.tCaching of symbols associated with Invalid messages.
val invalid_message_symbol :
Flambda2_to_cmm.To_cmm_result.t ->
message:string ->
Flambda2_identifiers.Symbol.t optiontype result = private {data_items : Cmm.phrase list;gc_roots : Cmm.symbol list;functions : Cmm.phrase list;
}val to_cmm :
Flambda2_to_cmm.To_cmm_result.t ->
Flambda2_to_cmm.To_cmm_result.resultArchive the current data and then return the translated data present in the given result structure.