jon.recoil.org

Module DSL.Acc

val set_emit_string : emit_string:(string -> unit) -> unit
val set_emit_instruction : emit_instruction:(Instruction.t -> unit) -> unit

Set a callback to receive instructions for binary emission (JIT).

val clear_emit_instruction : unit -> unit

Clear the binary emission callback.

val ins : ('num, 'operands) Instruction_name.t -> ('num, 'operands) many -> unit

Passes the instruction to the function provided to set_emit_string. Also passes to set_emit_instruction callback if set. (Can't directly reference Emitaux due to a circular dependency.)

type measurement = private {
  1. count : int;
  2. min_max_displacement : int option;
}
val with_measuring : f:(unit -> unit) -> measurement

Execute f with emission disabled, counting how many instructions would be emitted and tracking the minimum max_displacement across any conditional branches.

val ins1 : (singleton, 'a) Instruction_name.t -> 'a Operand.t -> unit
val ins2 : (pair, 'a * 'b) Instruction_name.t -> 'a Operand.t -> 'b Operand.t -> unit
val ins3 : (triple, 'a * 'b * 'c) Instruction_name.t -> 'a Operand.t -> 'b Operand.t -> 'c Operand.t -> unit
val ins4 : (quad, 'a * 'b * 'c * 'd) Instruction_name.t -> 'a Operand.t -> 'b Operand.t -> 'c Operand.t -> 'd Operand.t -> unit
val ins0 : (singleton, unit) Instruction_name.t -> unit
module Tupled : sig ... end

Tupled versions of ins2/ins3/ins4 for convenience with helper functions that return tuples.

Expansion of instructions that are aliases

val ins_mul : [ `Reg of [ `GP of [< `W | `X ] as 'w ] ] Operand.t -> [ `Reg of [ `GP of 'w ] ] Operand.t -> [ `Reg of [ `GP of 'w ] ] Operand.t -> unit
val ins_lsl_immediate : [ `Reg of [ `GP of [< `W | `X ] as 'w ] ] Operand.t -> [ `Reg of [ `GP of 'w ] ] Operand.t -> shift_in_bits:int -> unit
val ins_lsr_immediate : [ `Reg of [ `GP of [< `W | `X ] as 'w ] ] Operand.t -> [ `Reg of [ `GP of 'w ] ] Operand.t -> shift_in_bits:int -> unit
val ins_asr_immediate : [ `Reg of [ `GP of [< `W | `X ] as 'w ] ] Operand.t -> [ `Reg of [ `GP of 'w ] ] Operand.t -> shift_in_bits:int -> unit
val ins_uxtb : [ `Reg of [ `GP of [< `W | `X ] as 'w ] ] Operand.t -> [ `Reg of [ `GP of 'w ] ] Operand.t -> unit
val ins_uxth : [ `Reg of [ `GP of [< `W | `X ] as 'w ] ] Operand.t -> [ `Reg of [ `GP of 'w ] ] Operand.t -> unit
val ins_cmp : [ `Reg of [ `GP of [< `SP | `W | `X ] ] ] Operand.t -> [ `Imm of [< `Twelve ] ] Operand.t -> [ `Optional of [ `Fixed_shift of [ `Lsl_by_twelve ] ] option ] Operand.t -> unit
val ins_cmp_reg : [ `Reg of [ `GP of [< `SP | `X ] ] ] Operand.t -> [ `Reg of [ `GP of [< `X ] ] ] Operand.t -> [ `Optional of [ `Shift of [< `Asr | `Lsl | `Lsr ] * [ `Six ] ] option ] Operand.t -> unit
val ins_cmn : [ `Reg of [ `GP of [< `SP | `X ] ] ] Operand.t -> [ `Imm of [< `Twelve ] ] Operand.t -> [ `Optional of [ `Fixed_shift of [ `Lsl_by_twelve ] ] option ] Operand.t -> unit
val ins_cset : [ `Reg of [ `GP of [< `X | `XZR ] ] ] Operand.t -> Cond.t -> unit
val ins_mov_from_sp : dst:[ `Reg of [ `GP of [< `FP | `SP | `X ] ] ] Operand.t -> unit
val ins_mov_to_sp : src:[ `Reg of [ `GP of [< `FP | `SP | `X ] ] ] Operand.t -> unit
val ins_mov_vector : [ `Reg of [ `Neon of [ `Vector of ([< any_vector ] as 'v) * ([< any_width ] as 'w) ] ] ] Operand.t -> [ `Reg of [ `Neon of [ `Vector of 'v * 'w ] ] ] Operand.t -> unit
val ins_mov_reg : [ `Reg of [ `GP of [< `X ] ] ] Operand.t -> [ `Reg of [ `GP of [< `X | `XZR ] ] ] Operand.t -> unit
val ins_mov_reg_w : [ `Reg of [ `GP of [< `W ] ] ] Operand.t -> [ `Reg of [ `GP of [< `W ] ] ] Operand.t -> unit
val ins_mov_imm : [ `Reg of [ `GP of [< `X | `W ] ] ] Operand.t -> [ `Imm of [ `Sixteen_unsigned ] ] Operand.t -> unit