Module Ast.Make

Parameters

module Size : sig ... end

Signature

type size = Size.size
val size_ty : size Costlang.Ty.t
type unop =
  1. | Log2
  2. | Sqrt
type binop_size =
  1. | Add
  2. | Sat_sub
  3. | Mul
  4. | Div
  5. | Max
  6. | Min
type binop_bool =
  1. | Eq
  2. | Lt
type _ t =
  1. | Size : Costlang.Num.t -> size t
  2. | Bool : bool -> bool t
  3. | Unop : unop * size t -> size t
  4. | Binop_size : binop_size * size t * size t -> size t
  5. | Binop_bool : binop_bool * size t * size t -> bool t
  6. | Shift : [ `Left | `Right ] * size t * int -> size t
  7. | Free : Free_variable.t -> size t
  8. | Lam : string * 'a Costlang.Ty.t * 'b t -> ('a -> 'b) t
  9. | App : ('a -> 'b) t * 'a t -> 'b t
  10. | Let : string * 'a t * 'b t -> 'b t
  11. | If : bool t * size t * size t -> size t
  12. | Variable : string * 'a Costlang.Ty.t -> 'a t
val term_size : 'a. 'a t -> int
val type_of : 'a t -> 'a Costlang.Ty.t
val pp : Stdlib.Format.formatter -> _ t -> unit
val to_expression : _ t -> Parsetree.expression

To OCaml parsetree

Existentials

type packed
val pack : 'a t -> packed
val unpack : 'a Costlang.Ty.t -> packed -> 'a t option

Optimizations

val at_least_10 : 'a t -> 'a t
val subst_let : 'a t -> 'a t
val optimize_affine : 'a t -> 'a t
val cse : 'a t -> 'a t