Commits

camlspotter committed 85625e6

fixing types

Comments (0)

Files changed (2)

 
   type 'a m = 'a Monad.t
 
+  let unknownM (v : 'a v m) : unknown v m = 
+    v >>= fun v -> return (!=?v)
+    
   let magicM (v : 'a v m) : 'b v m = perform
     v <-- v;
     return (Value.magic v)
     fun ?(name=defname) (x : 'a v) (y : 'a v) ->
       (unsafeM (f !=<x !=<y name) : bool v m)
 
-  let add ?name = arith "added" Llvm.build_add ?name
-  let sub ?name = arith "subed" Llvm.build_sub ?name
-  let mul ?name = arith "muled" Llvm.build_mul ?name
+  let add  ?name = arith "added" Llvm.build_add ?name
+  let sub  ?name = arith "subed" Llvm.build_sub ?name
+  let mul  ?name = arith "muled" Llvm.build_mul ?name
   let sdiv ?name = arith "sdived" Llvm.build_sdiv ?name
   let fadd ?name = arith "fadded" Llvm.build_fadd ?name
   let fsub ?name = arith "fsubed" Llvm.build_fsub ?name
     name ^ "=" ^ Type.string_of lty
 
   (* CR: bitcast is wrapped again! *)
-  let cast ?name v lty = 
+  let bitcast ?name v lty = 
     let name = match name with
       | Some n -> n
       | None -> cast_name v lty
 
   let malloc_lty ?name ?bzero (lty : 'ty typ) = perform
     ptr <-- malloc ?name ?bzero (size_of lty);
-    cast ptr (pointer lty)
+    bitcast ptr (pointer lty)
 
   let free ptr = Monad.ignore (call Module.External.free (Value.c1 ptr))
   ;;
   end
   type 'a m = 'a Monad.t
 
+  val unknownM : 'a v m -> unknown v m
   val magicM : 'a v m -> 'b v m
 
   val call : ?name:string -> ('a -> 'b) pointer v -> 'a vs -> 'b v m
 
   val global_stringptr : ?name:string -> string -> i8 pointer v m
 
-  val bitcast : ?name:string -> 'a v -> 'b typ -> 'b v m
-
   val unsafe_gep : ?name:string -> 'a pointer v -> i32 v list -> 'unsafe pointer v m
     
   val load : ?name:string -> 'a pointer v -> 'a v m
 
   val is_null : ?name:string -> 'a pointer v -> bool v m
 
-  val add : ?name:string -> 'a v -> 'a v -> 'a v m
-  val sub : ?name:string -> 'a v -> 'a v -> 'a v m
-  val mul : ?name:string -> 'a v -> 'a v -> 'a v m
-  val sdiv : ?name:string -> 'a v -> 'a v -> 'a v m
-  val fadd : ?name:string -> 'a v -> 'a v -> 'a v m
-  val fsub : ?name:string -> 'a v -> 'a v -> 'a v m
-  val fmul : ?name:string -> 'a v -> 'a v -> 'a v m
-  val fdiv : ?name:string -> 'a v -> 'a v -> 'a v m
-  val icmp : Llvm.Icmp.t -> ?name:string -> 'a v -> 'a v -> bool v m
-  val fcmp : Llvm.Fcmp.t -> ?name:string -> 'a v -> 'a v -> bool v m
+  val add :  ?name:string -> ([>`int] as 'a) v -> 'a v -> 'a v m
+  val sub :  ?name:string -> ([>`int] as 'a) v -> 'a v -> 'a v m
+  val mul :  ?name:string -> ([>`int] as 'a) v -> 'a v -> 'a v m
+  val sdiv : ?name:string -> ([>`int] as 'a) v -> 'a v -> 'a v m
+  val fadd : ?name:string -> ([>`floating] as 'a) v -> 'a v -> 'a v m
+  val fsub : ?name:string -> ([>`floating] as 'a) v -> 'a v -> 'a v m
+  val fmul : ?name:string -> ([>`floating] as 'a) v -> 'a v -> 'a v m
+  val fdiv : ?name:string -> ([>`floating] as 'a) v -> 'a v -> 'a v m
+  val icmp : Llvm.Icmp.t -> ?name:string -> ([>`int] as 'a) v -> 'a v -> bool v m
+  val fcmp : Llvm.Fcmp.t -> ?name:string -> ([>`floating] as 'a) v -> 'a v -> bool v m
 
   val printf : string -> unknown v list -> unit m
 
-  val cast : ?name:string -> 'a v -> 'b typ -> 'b v m
-  val pointercast : ?name:string -> 'a pointer v -> 'b typ -> 'b v m
+  val bitcast : ?name:string -> 'a v -> 'b typ -> 'b v m
+  val pointercast : ?name:string -> 'a pointer v -> ([>`int] as 'b) typ -> 'b v m
 
   val malloc : ?name:string -> ?bzero:bool -> i32 v -> void_pointer v m
   val malloc_lty : ?name:string -> ?bzero:bool -> 'a typ -> 'a pointer v m
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.