Add a way to look up a type by it's name in a module.
[oota-llvm.git] / bindings / ocaml / llvm / llvm.mli
index 48c6ccd648b9bb0a1e4bf2ed1e33df1ab6e68fb1..7025f85b54202066c90a84c3cbaa97338360ace3 100644 (file)
@@ -274,6 +274,11 @@ external define_type_name : string -> lltype -> llmodule -> bool
 external delete_type_name : string -> llmodule -> unit
                           = "llvm_delete_type_name"
 
+(** [type_by_name m n] returns the type in the module [m] named [n], or [None]
+    if it does not exist. See the method [llvm::Module::getTypeByName]. *)
+external type_by_name : llmodule -> string -> lltype option
+                      = "llvm_type_by_name"
+
 (** [dump_module m] prints the .ll representation of the module [m] to standard
     error. See the method [llvm::Module::dump]. *)
 external dump_module : llmodule -> unit = "llvm_dump_module"
@@ -502,6 +507,11 @@ external set_value_name : string -> llvalue -> unit = "llvm_set_value_name"
     error. See the method [llvm::Value::dump]. *)
 external dump_value : llvalue -> unit = "llvm_dump_value"
 
+(** [replace_all_uses_with old new] replaces all uses of the value [old]
+ * with the value [new]. See the method [llvm::Value::replaceAllUsesWith]. *)
+external replace_all_uses_with : llvalue -> llvalue -> unit
+                               = "LLVMReplaceAllUsesWith"
+
 
 (** {7 Operations on constants of (mostly) any type} *)