Expose Module::dump via C and Ocaml.
authorGordon Henriksen <gordonhenriksen@mac.com>
Fri, 14 Mar 2008 23:58:56 +0000 (23:58 +0000)
committerGordon Henriksen <gordonhenriksen@mac.com>
Fri, 14 Mar 2008 23:58:56 +0000 (23:58 +0000)
Patch by Erick Tryzelaar.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48379 91177308-0d34-0410-b5e6-96231b3b80d8

bindings/ocaml/llvm/llvm.ml
bindings/ocaml/llvm/llvm_ocaml.c
include/llvm-c/Core.h
lib/VMCore/Core.cpp

index d69487a2df2ff04a7943e62eb93c027f4441287c..92c60c404f96634f896c1a3eb3009f41f6b7b33c 100644 (file)
@@ -119,6 +119,7 @@ external define_type_name : string -> lltype -> llmodule -> bool
                           = "llvm_add_type_name"
 external delete_type_name : string -> llmodule -> unit
                           = "llvm_delete_type_name"
+external dump_module : llmodule -> unit = "llvm_dump_module"
 
 (*===-- Types -------------------------------------------------------------===*)
 
index f4e958d966ccfe1f82eef559f6c6734b3f05272f..ebe09dcbef9b7def54a79fc174c704cd3c7dd51b 100644 (file)
@@ -98,6 +98,12 @@ CAMLprim value llvm_delete_type_name(value Name, LLVMModuleRef M) {
   return Val_unit;
 }
 
+/* llmodule -> unit */
+CAMLprim value llvm_dump_module(LLVMModuleRef M) {
+  LLVMDumpModule(M);
+  return Val_unit;
+}
+
 
 /*===-- Types -------------------------------------------------------------===*/
 
index 1c3fc9ceb464a964e0ace191fb108c2ea73a67a5..b10e2b721e2b6b7fae2b5271befe507c0466fe2a 100644 (file)
@@ -183,6 +183,9 @@ void LLVMSetTarget(LLVMModuleRef M, const char *Triple);
 int LLVMAddTypeName(LLVMModuleRef M, const char *Name, LLVMTypeRef Ty);
 void LLVMDeleteTypeName(LLVMModuleRef M, const char *Name);
 
+/** See Module::dump. */
+void LLVMDumpModule(LLVMModuleRef M);
+
 
 /*===-- Types -------------------------------------------------------------===*/
 
index c159bbc2f76af4792b8704726138e9fccf8c2fac..665f0ac1b8278752558f34aed74f3ecc4a553148 100644 (file)
@@ -76,6 +76,10 @@ void LLVMDeleteTypeName(LLVMModuleRef M, const char *Name) {
       TST.remove(I);
 }
 
+void LLVMDumpModule(LLVMModuleRef M) {
+  unwrap(M)->dump();
+}
+
 
 /*===-- Operations on types -----------------------------------------------===*/