camlspotter avatar camlspotter committed 79217fb

fixed for llvm 3.2

Comments (0)

Files changed (15)

examples/OMakefile

 OCAMLINCLUDES += ../lib
-OCAML_BYTE_LINK_FLAGS += llvm_phantom.cmo
-OCAML_NATIVE_LINK_FLAGS += llvm_phantom.cmx
+OCAML_BYTE_LINK_FLAGS += -cc g++ llvm_phantom.cmo
+OCAML_NATIVE_LINK_FLAGS += -cc g++ llvm_phantom.cmx
 OCAMLDEPFLAGS += -I ../lib 
 
+OCAMLPACKS[] += llvm.executionengine llvm.scalar_opts llvm.analysis
+
 OCamlRequire(../lib/llvm_phantom.cmo ../lib/llvm_phantom.cmx)
 
 MyOCamlTestProgram(double, double)
 .PHONY: all install clean
 
 FILES[] =
+   phantom
    extension
    context
    type_intf
 open Spotlib.Spot
-module P = Spotlib.Spot.Phantom
+module P = Phantom
 open P.Open
 
 module Builder = struct

lib/build_intf.ml

 open Spotlib.Spot
-open Spotlib.Spot.Phantom
+open Phantom
 open Type
 open Value
 
             | TypeKind.Vector -> 
                 let s, recs = string_of_lltype visited (element_type ty) in
                 "<" ^ (string_of_int (vector_size ty)) ^ " x " ^ s ^ ">", recs
+(* gone in 3.2
             | TypeKind.Opaque -> "opaque", []
+*)
             | TypeKind.Function -> 
                 let name_recs = List.map (string_of_lltype visited) (Array.to_list (param_types ty)) in
                 let s = String.concat ", " (List.map fst name_recs) in
             | TypeKind.Float -> "float", []
             | TypeKind.Void -> "void", []
             | TypeKind.Metadata -> "metadata", []
+            | Half -> assert false (* New in 3.2 *)
           in
           try 
             let name = List.assq ty recs in
 open Llvm_executionengine
 
 open Spotlib.Spot
-module P = Spotlib.Spot.Phantom
+module P = Phantom
 open P.Open
 
 open Type
 open Type
 open Llvm_executionengine
 
-open Spotlib.Spot
 (* open Spotlib.Spot.Phantom.Open *)
 
 type 'a v = ('a, GenericValue.t) Phantom.t
-open Spotlib.Spot.Phantom.Open
+open Phantom.Open
 (* open Value *)
 
 type ('a, 'final, 'res) t = 
 open Spotlib.Spot
-module P = Spotlib.Spot.Phantom
+module P = Phantom
 open P.Open
 
 module E = Llvm_executionengine
     if opt then begin
       (* Set up the optimizer pipeline.  Start with registering info about how the
        * target lays out data structures. *)
-      T.TargetData.add (E.ExecutionEngine.target_data engine) fpm;
+      T.DataLayout.add (E.ExecutionEngine.target_data engine) fpm;
       (* Do simple "peephole" optimizations and bit-twiddling optzn. *)
       S.add_instruction_combination fpm;
       (* reassociate expressions. *)
   (* let delete_type_name = delete_type_name *)
   let set_inline_asm = Llvm.set_module_inline_asm module_
 
+(* define_type_name no longer exists in 3.2
   let define_type_name n (t : 'a typ) = 
     let name = A.name ^ "." ^ n in
     if Llvm.define_type_name name !<t module_ then
           t
       | None -> assert false
     else failwithf "define_type_name %s failed" n
+*)
 
   (* let delete_type_name : I do not think I need such a function. *)
 
   let type_by_name : string -> unknown typ option = fun name ->
-    Option.map ~f:(!>) (Llvm.type_by_name module_ name)
+    Option.map (!>) (Llvm.type_by_name module_ name)
 
   let dump () = Llvm.dump_module module_
   
   end
   
   module Function = struct
-    let lookup n = Option.map ~f:P.unsafe (Llvm.lookup_function n module_)
+    let lookup n = Option.map P.unsafe (Llvm.lookup_function n module_)
     let declare n ty = P.unsafe (Llvm.declare_function n !<ty module_)
   end
   

lib/module_intf.ml

 open Value
 
 (* open Spotlib.Spot *)
-open Spotlib.Spot.Phantom
+open Phantom
 
 (* open Llvm_executionengine (* for GenericValue *) *)
 
   val set_target_triple : string -> unit
   val data_layout : unit -> string
   val set_data_layout : string -> unit
+(* not in 3.2
   val define_type_name : string -> 'a typ -> 'a typ
+*)
   (* delete_type_name : really you need it ? *)
   val type_by_name : string -> unknown typ option
   val dump : unit -> unit
 
 (** Types and values. They are so essential that they are exposed. *)
 
-module Phantom = Spotlib.Spot.Phantom
 include Phantom.Open
 include Type
 include Value
 
+module Phantom = Phantom
+
 module Gep = Gep
 module Genvalue = Genvalue
 module Create = Wrap.Create
 open Llvm
 (* open Spotlib.Spot *)
 
-module P = Spotlib.Spot.Phantom
+module P = Phantom
 (* open P.Open *)
 
 (** phantom *)
 (* open Type *)
 
 open Spotlib.Spot
-module P = Spotlib.Spot.Phantom
+module P = Phantom
 open P.Open
 
 (* This should be shared by all the Make(A) *)
   let address_space (t : 'a pointer typ) = address_space !<t
   let vector_size (t : ('a, 'tag) vector typ) = vector_size !<t
 
+(* not in 3.2
   let opaque () = opaque_type context
   let refine opaque ~by = refine_type opaque by
   let recursive (f : 'a typ -> 'b typ) : 'b typ =
     let ty = f (P.unsafe op) in
     refine op ~by:(!<ty);
     ty
+*)
   let void : void typ = P.unsafe & void_type context
   let label : label typ = P.unsafe & label_type context
 
-open Spotlib.Spot
-(* open Spotlib.Spot.Phantom.Open *)
-
 module type S0 = sig
   (** phantom *)
   type 'a typ = ('a, Llvm.lltype) Phantom.t
 
   (** {7 Operations on other types} *)
 
+(*
   val recursive : ('a typ -> 'b typ) -> 'b typ
     (** [recursive f] returns a recusive type defined by [f]. *)
-  (* val opaque_type : use [recursive]. *)
+  val opaque_type : use [recursive].
+*)
   val void : void typ
   val label : label typ
 
 open Llvm
 open Spotlib.Spot
-module P = Spotlib.Spot.Phantom
+module P = Phantom
 open P.Open
 
 open Type
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.