Source

ocaml-llvm-phantom / lib / gep.ml

Full commit
open Phantom.Open
(* open Value *)

type ('a, 'final, 'res) t = 
    { k : [`int of int | `llvalue of Llvm.llvalue] list -> 'res; 
      rev : [`int of int | `llvalue of Llvm.llvalue] list; 
                            }
let gen k f = f { rev = []; k = k; }
let end_ st = st.k (List.rev st.rev)
  
let pos (n : int) st k = k { st with rev = `int n::st.rev }
let pos_i32 n st k = k { st with rev = `llvalue !<n::st.rev }
let mem0 st k = k { st with rev = `int 0  :: st.rev }
let mem1 st k = k { st with rev = `int 1  :: st.rev }
let mem2 st k = k { st with rev = `int 2  :: st.rev }
let mem3 st k = k { st with rev = `int 3  :: st.rev }
let mem4 st k = k { st with rev = `int 4  :: st.rev }
let mem5 st k = k { st with rev = `int 5  :: st.rev }
let mem6 st k = k { st with rev = `int 6  :: st.rev }
let mem7 st k = k { st with rev = `int 7  :: st.rev }
let mem8 st k = k { st with rev = `int 8  :: st.rev }
let mem9 st k = k { st with rev = `int 9  :: st.rev }