-(*===-- tools/ml/llvm.ml - LLVM Ocaml Interface ---------------------------===*
+(*===-- llvm/llvm.ml - LLVM Ocaml Interface --------------------------------===*
*
* The LLVM Compiler Infrastructure
*
- * This file was developed by Gordon Henriksen and is distributed under the
- * University of Illinois Open Source License. See LICENSE.TXT for details.
+ * This file is distributed under the University of Illinois Open Source
+ * License. See LICENSE.TXT for details.
*
*===----------------------------------------------------------------------===*)
= "llvm_add_type_name"
external delete_type_name : string -> llmodule -> unit
= "llvm_delete_type_name"
-
+external dump_module : llmodule -> unit = "llvm_dump_module"
(*===-- Types -------------------------------------------------------------===*)
end
+(*===-- Pass Manager ------------------------------------------------------===*)
+
+module PassManager = struct
+ type 'a t
+ type any = [ `Module | `Function ]
+ external create : unit -> [ `Module ] t = "llvm_passmanager_create"
+ external create_function : llmoduleprovider -> [ `Function ] t
+ = "LLVMCreateFunctionPassManager"
+ external run_module : llmodule -> [ `Module ] t -> bool
+ = "llvm_passmanager_run_module"
+ external initialize : [ `Function ] t -> bool = "llvm_passmanager_initialize"
+ external run_function : llvalue -> [ `Function ] t -> bool
+ = "llvm_passmanager_run_function"
+ external finalize : [ `Function ] t -> bool = "llvm_passmanager_finalize"
+ external dispose : [< any ] t -> unit = "llvm_passmanager_dispose"
+end
+
+
(*===-- Non-Externs -------------------------------------------------------===*)
(* These functions are built using the externals, so must be declared late. *)