package ocaml-base-compiler

  1. Overview
  2. Docs
type label = Cmm.label

N.B. Backends vary in their treatment of call gc and checkbound points. If the positioning of any labels associated with these is important for some new feature in the compiler, the relevant backends' behaviour should be checked.

type integer_comparison =
  1. | Isigned of Cmm.comparison
  2. | Iunsigned of Cmm.comparison
type integer_operation =
  1. | Iadd
  2. | Isub
  3. | Imul
  4. | Imulh
  5. | Idiv
  6. | Imod
  7. | Iand
  8. | Ior
  9. | Ixor
  10. | Ilsl
  11. | Ilsr
  12. | Iasr
  13. | Icomp of integer_comparison
  14. | Icheckbound of {
    1. label_after_error : label option;
    2. spacetime_index : int;
    }
    (*

    For Spacetime only, Icheckbound operations take two arguments, the second being the pointer to the trie node for the current function (and the first being as per non-Spacetime mode).

    *)
type test =
  1. | Itruetest
  2. | Ifalsetest
  3. | Iinttest of integer_comparison
  4. | Iinttest_imm of integer_comparison * int
  5. | Ifloattest of Cmm.comparison * bool
  6. | Ioddtest
  7. | Ieventest
type operation =
  1. | Imove
  2. | Ispill
  3. | Ireload
  4. | Iconst_int of nativeint
  5. | Iconst_float of int64
  6. | Iconst_symbol of string
  7. | Icall_ind of {
    1. label_after : label;
    }
  8. | Icall_imm of {
    1. func : string;
    2. label_after : label;
    }
  9. | Itailcall_ind of {
    1. label_after : label;
    }
  10. | Itailcall_imm of {
    1. func : string;
    2. label_after : label;
    }
  11. | Iextcall of {
    1. func : string;
    2. alloc : bool;
    3. label_after : label;
    }
  12. | Istackoffset of int
  13. | Iload of Cmm.memory_chunk * Arch.addressing_mode
  14. | Istore of Cmm.memory_chunk * Arch.addressing_mode * bool
  15. | Ialloc of {
    1. words : int;
    2. label_after_call_gc : label option;
    3. spacetime_index : int;
    }
    (*

    For Spacetime only, Ialloc instructions take one argument, being the pointer to the trie node for the current function.

    *)
  16. | Iintop of integer_operation
  17. | Iintop_imm of integer_operation * int
  18. | Inegf
  19. | Iabsf
  20. | Iaddf
  21. | Isubf
  22. | Imulf
  23. | Idivf
  24. | Ifloatofint
  25. | Iintoffloat
  26. | Ispecific of Arch.specific_operation
  27. | Iname_for_debugger of {
    1. ident : Ident.t;
    2. which_parameter : int option;
    3. provenance : unit option;
    4. is_assignment : bool;
    }
    (*

    Iname_for_debugger has the following semantics: (a) The argument register(s) is/are deemed to contain the value of the given identifier. (b) If is_assignment is true, any information about other Reg.ts that have been previously deemed to hold the value of that identifier is forgotten.

    *)
type instruction = {
  1. desc : instruction_desc;
  2. next : instruction;
  3. arg : Reg.t array;
  4. res : Reg.t array;
  5. dbg : Debuginfo.t;
  6. mutable live : Reg.Set.t;
  7. mutable available_before : Reg_availability_set.t;
  8. mutable available_across : Reg_availability_set.t option;
}
and instruction_desc =
  1. | Iend
  2. | Iop of operation
  3. | Ireturn
  4. | Iifthenelse of test * instruction * instruction
  5. | Iswitch of int array * instruction array
  6. | Iloop of instruction
  7. | Icatch of Cmm.rec_flag * (int * instruction) list * instruction
  8. | Iexit of int
  9. | Itrywith of instruction * instruction
  10. | Iraise of Cmm.raise_kind
type spacetime_part_of_shape =
  1. | Direct_call_point of {
    1. callee : string;
    }
  2. | Indirect_call_point
  3. | Allocation_point
type spacetime_shape = (spacetime_part_of_shape * Cmm.label) list

A description of the layout of a Spacetime profiling node associated with a given function. Each call and allocation point instrumented within the function is marked with a label in the code and assigned a place within the node. This information is stored within the executable and extracted when the user saves a profile. The aim is to minimise runtime memory usage within the nodes and increase performance.

type fundecl = {
  1. fun_name : string;
  2. fun_args : Reg.t array;
  3. fun_body : instruction;
  4. fun_fast : bool;
  5. fun_dbg : Debuginfo.t;
  6. fun_spacetime_shape : spacetime_shape option;
}
val dummy_instr : instruction
val end_instr : unit -> instruction
val instr_cons : instruction_desc -> Reg.t array -> Reg.t array -> instruction -> instruction
val instr_cons_debug : instruction_desc -> Reg.t array -> Reg.t array -> Debuginfo.t -> instruction -> instruction
val instr_iter : (instruction -> unit) -> instruction -> unit
val spacetime_node_hole_pointer_is_live_before : instruction -> bool
val operation_can_raise : operation -> bool
OCaml

Innovation. Community. Security.