aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGordon Henriksen <gordonhenriksen@mac.com>2008-03-14 23:58:56 +0000
committerGordon Henriksen <gordonhenriksen@mac.com>2008-03-14 23:58:56 +0000
commitd2fdc3e4e3d1773dd4e03ade8e33e93e4c054d80 (patch)
treeb7f6b165cf0f13c635be441b1a97f65b8f1e1fd7
parent5bd70e3db32c42542c654da753f7b872905f0aea (diff)
downloadexternal_llvm-d2fdc3e4e3d1773dd4e03ade8e33e93e4c054d80.zip
external_llvm-d2fdc3e4e3d1773dd4e03ade8e33e93e4c054d80.tar.gz
external_llvm-d2fdc3e4e3d1773dd4e03ade8e33e93e4c054d80.tar.bz2
Expose Module::dump via C and Ocaml.
Patch by Erick Tryzelaar. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48379 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--bindings/ocaml/llvm/llvm.ml1
-rw-r--r--bindings/ocaml/llvm/llvm_ocaml.c6
-rw-r--r--include/llvm-c/Core.h3
-rw-r--r--lib/VMCore/Core.cpp4
4 files changed, 14 insertions, 0 deletions
diff --git a/bindings/ocaml/llvm/llvm.ml b/bindings/ocaml/llvm/llvm.ml
index d69487a..92c60c4 100644
--- a/bindings/ocaml/llvm/llvm.ml
+++ b/bindings/ocaml/llvm/llvm.ml
@@ -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 -------------------------------------------------------------===*)
diff --git a/bindings/ocaml/llvm/llvm_ocaml.c b/bindings/ocaml/llvm/llvm_ocaml.c
index f4e958d..ebe09dc 100644
--- a/bindings/ocaml/llvm/llvm_ocaml.c
+++ b/bindings/ocaml/llvm/llvm_ocaml.c
@@ -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 -------------------------------------------------------------===*/
diff --git a/include/llvm-c/Core.h b/include/llvm-c/Core.h
index 1c3fc9c..b10e2b7 100644
--- a/include/llvm-c/Core.h
+++ b/include/llvm-c/Core.h
@@ -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 -------------------------------------------------------------===*/
diff --git a/lib/VMCore/Core.cpp b/lib/VMCore/Core.cpp
index c159bbc..665f0ac 100644
--- a/lib/VMCore/Core.cpp
+++ b/lib/VMCore/Core.cpp
@@ -76,6 +76,10 @@ void LLVMDeleteTypeName(LLVMModuleRef M, const char *Name) {
TST.remove(I);
}
+void LLVMDumpModule(LLVMModuleRef M) {
+ unwrap(M)->dump();
+}
+
/*===-- Operations on types -----------------------------------------------===*/