jon.recoil.org

Module Flambda2_to_cmm.To_cmm_result

Result structure used during Flambda to Cmm translation.

type t

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.

Create a result structure.

reachable_names specifies which names are reachable from outside the compilation unit (same terminology as used in Flambda_cmx).

Translate 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.symbol

Produce the Cmm function symbol for a piece of code.

Create a Cmm symbol, not arising from a Symbol.t.

Archive the current data into the list of already-translated data.

Add already-translated Cmm data items into the archived part of the result structure.

Update the current data part of the result structure.

Set the current data to the given list. Raises a fatal error if the current data is not empty, to avoid inadvertently losing data.

Register one or more symbols as required GC roots.

Register a function that has been translated to Cmm.

Record 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.

Caching of symbols associated with Invalid messages.

val invalid_message_symbol : Flambda2_to_cmm.To_cmm_result.t -> message:string -> Flambda2_identifiers.Symbol.t option
type result = private {
  1. data_items : Cmm.phrase list;
  2. gc_roots : Cmm.symbol list;
  3. functions : Cmm.phrase list;
}

Archive the current data and then return the translated data present in the given result structure.