Commits

camlspotter  committed 37d7583

ghost + polyvar

  • Participants
  • Parent commits c30bfcb

Comments (0)

Files changed (6)

 FILES[] =
    phantom_intf
    phantom
+   ltype_intf
    ltype
    lvalue
    lbase

File lbuilder2.ml

     lv_f
 
 
-  let if_then_else (f_lv_cond : bool v) (f_lv_then : unit -> 'a v) (f_lv_else : unit -> 'a v) : 'a v = 
+  let if_then_else (f_lv_cond : unit -> bool v) (f_lv_then : unit -> 'a v) (f_lv_else : unit -> 'a v) : 'a v = 
     (* get the current bb *)
     let start_bb = Block.insertion in
     (* get the function being defined *)
     let the_function = Block.parent start_bb in
-    let lv_cond = f_lv_cond in (* created in [start_bb] *)
+    let lv_cond = f_lv_cond () in (* created in [start_bb] *)
     (* before adding branching, we must create the destinations *)
 
     let then_bb = Block.append ~name:"then" the_function in

File lbuilder2.mli

 
   val is_null : ?name:string -> 'a pointer v -> bool v
 
-  val add : ?name:string -> 'a v -> 'a v -> 'a v
-  val sub : ?name:string -> 'a v -> 'a v -> 'a v
-  val mul : ?name:string -> 'a v -> 'a v -> 'a v
-  val sdiv : ?name:string -> 'a v -> 'a v -> 'a v
-  val fadd : ?name:string -> 'a v -> 'a v -> 'a v
-  val fsub : ?name:string -> 'a v -> 'a v -> 'a v
-  val fmul : ?name:string -> 'a v -> 'a v -> 'a v
-  val fdiv : ?name:string -> 'a v -> 'a v -> 'a v
-  val icmp : Llvm.Icmp.t -> ?name:string -> 'a v -> 'a v -> bool v
-  val fcmp : Llvm.Fcmp.t -> ?name:string -> 'a v -> 'a v -> bool v
+  val add : ?name:string -> ([>`int] as 'a) v -> 'a v -> 'a v
+  val sub : ?name:string -> ([>`int] as 'a) v -> 'a v -> 'a v
+  val mul : ?name:string -> ([>`int] as 'a) v -> 'a v -> 'a v
+  val sdiv : ?name:string -> ([>`int] as 'a) v -> 'a v -> 'a v
+  val fadd : ?name:string -> ([>`floating] as 'a) v -> 'a v -> 'a v
+  val fsub : ?name:string -> ([>`floating] as 'a) v -> 'a v -> 'a v
+  val fmul : ?name:string -> ([>`floating] as 'a) v -> 'a v -> 'a v
+  val fdiv : ?name:string -> ([>`floating] as 'a) v -> 'a v -> 'a v
+  val icmp : Llvm.Icmp.t -> ?name:string -> ([>`int] as 'a) v -> 'a v -> bool v
+  val fcmp : Llvm.Fcmp.t -> ?name:string -> ([>`floating] as 'a) v -> 'a v -> bool v
 
   val printf : string -> unknown v list -> unit
 
   end
 
   val func : string -> 'a typ -> 'b Ltype.WithString.ts -> ('b vs -> 'a v) -> ('b -> 'a) pointer v
-  val if_then_else : bool v -> (unit -> 'a v) -> (unit -> 'a v) -> 'a v
+  val if_then_else : (unit -> bool v) -> (unit -> 'a v) -> (unit -> 'a v) -> 'a v
 end
   (** descriptors *)
   
   type void
-  type i1 = bool
-  type i8 = char
-  type i16
-  type i32 = int32
-  type i64 = int64
+  type i1 = [`int | `i1]
+  type i8 = [`int | `i8]
+  type i16 = [`int | `i16]
+  type i32 = [`int | `i32]
+  type i64 = [`int | `i64]
   type 'a integer
   (* type float_d *)
-  type double
+  type double = [`floating | `double]
   type dots
   type 'a struct_
   (* type ('a, 'tag) array *)
 (** descriptors *)
 
 type void
-type i1 = bool
-type i8 = char
-type i16
-type i32 = int32
-type i64 = int64
+type i1 = [`int | `i1]
+type i8 = [`int | `i8]
+type i16 = [`int | `i16]
+type i32 = [`int | `i32]
+type i64 = [`int | `i64]
 type 'a integer
 (* type float *) (* use OCaml's float *)
-type double
+type double = [`floating | `double]
 type dots
 type 'a struct_
 (* type ('a, 'b) array_ *) (* use OCaml's array *)
     
       val is_null : ?name:string -> 'a pointer v -> bool v
     
-      val add : ?name:string -> 'a v -> 'a v -> 'a v
-      val sub : ?name:string -> 'a v -> 'a v -> 'a v
-      val mul : ?name:string -> 'a v -> 'a v -> 'a v
-      val sdiv : ?name:string -> 'a v -> 'a v -> 'a v
-      val fadd : ?name:string -> 'a v -> 'a v -> 'a v
-      val fsub : ?name:string -> 'a v -> 'a v -> 'a v
-      val fmul : ?name:string -> 'a v -> 'a v -> 'a v
-      val fdiv : ?name:string -> 'a v -> 'a v -> 'a v
-      val icmp : Llvm.Icmp.t -> ?name:string -> 'a v -> 'a v -> bool v
-      val fcmp : Llvm.Fcmp.t -> ?name:string -> 'a v -> 'a v -> bool v
+      val add : ?name:string -> ([>`int] as 'a) v -> 'a v -> 'a v
+      val sub : ?name:string -> ([>`int] as 'a) v -> 'a v -> 'a v
+      val mul : ?name:string -> ([>`int] as 'a) v -> 'a v -> 'a v
+      val sdiv : ?name:string -> ([>`int] as 'a) v -> 'a v -> 'a v
+      val fadd : ?name:string -> ([>`floating] as 'a) v -> 'a v -> 'a v
+      val fsub : ?name:string -> ([>`floating] as 'a) v -> 'a v -> 'a v
+      val fmul : ?name:string -> ([>`floating] as 'a) v -> 'a v -> 'a v
+      val fdiv : ?name:string -> ([>`floating] as 'a) v -> 'a v -> 'a v
+      val icmp : Llvm.Icmp.t -> ?name:string -> ([>`int] as 'a) v -> 'a v -> bool v
+      val fcmp : Llvm.Fcmp.t -> ?name:string -> ([>`floating] as 'a) v -> 'a v -> bool v
     
       val printf : string -> unknown v list -> unit
     
       end
     
       val func : string -> 'a typ -> 'b Ltype.WithString.ts -> ('b vs -> 'a v) -> ('b -> 'a) pointer v
-      val if_then_else : bool v -> (unit -> 'a v) -> (unit -> 'a v) -> 'a v
+      val if_then_else : (unit -> bool v) -> (unit -> 'a v) -> (unit -> 'a v) -> 'a v
     end
   end
 end