summaryrefslogtreecommitdiff
path: root/bindings
diff options
context:
space:
mode:
authorErick Tryzelaar <idadesub@users.sourceforge.net>2010-02-28 20:44:58 +0000
committerErick Tryzelaar <idadesub@users.sourceforge.net>2010-02-28 20:44:58 +0000
commit6ba5c56cf5b1609ec4af45f4901118865a8ed9b6 (patch)
treea6a741a16910346705cf544436801520ff08f995 /bindings
parentce89b4e66f7ec82b2b621c94b072f0b22827a3cd (diff)
downloadllvm-6ba5c56cf5b1609ec4af45f4901118865a8ed9b6.tar.gz
llvm-6ba5c56cf5b1609ec4af45f4901118865a8ed9b6.tar.bz2
llvm-6ba5c56cf5b1609ec4af45f4901118865a8ed9b6.tar.xz
Add support for global aliases to ocaml.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97413 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'bindings')
-rw-r--r--bindings/ocaml/llvm/llvm.ml4
-rw-r--r--bindings/ocaml/llvm/llvm.mli9
-rw-r--r--bindings/ocaml/llvm/llvm_ocaml.c7
3 files changed, 20 insertions, 0 deletions
diff --git a/bindings/ocaml/llvm/llvm.ml b/bindings/ocaml/llvm/llvm.ml
index 92bfef51d0..48f649a3cf 100644
--- a/bindings/ocaml/llvm/llvm.ml
+++ b/bindings/ocaml/llvm/llvm.ml
@@ -444,6 +444,10 @@ let rec fold_right_global_range f i e init =
let fold_right_globals f m init =
fold_right_global_range f (global_end m) (At_start m) init
+(*--... Operations on aliases ..............................................--*)
+external add_alias : llmodule -> lltype -> llvalue -> string -> llvalue
+ = "llvm_add_alias"
+
(*--... Operations on functions ............................................--*)
external declare_function : string -> lltype -> llmodule -> llvalue
= "llvm_declare_function"
diff --git a/bindings/ocaml/llvm/llvm.mli b/bindings/ocaml/llvm/llvm.mli
index c8c48f3c53..3413a64660 100644
--- a/bindings/ocaml/llvm/llvm.mli
+++ b/bindings/ocaml/llvm/llvm.mli
@@ -1140,6 +1140,15 @@ external is_thread_local : llvalue -> bool = "llvm_is_thread_local"
external set_thread_local : bool -> llvalue -> unit = "llvm_set_thread_local"
+(** {7 Operations on aliases} *)
+
+(** [add_alias m t a n] inserts an alias in the module [m] with the type [t] and
+ the aliasee [a] with the name [n].
+ See the constructor for [llvm::GlobalAlias]. *)
+external add_alias : llmodule -> lltype -> llvalue -> string -> llvalue
+ = "llvm_add_alias"
+
+
(** {7 Operations on functions} *)
(** [declare_function name ty m] returns a new function of type [ty] and
diff --git a/bindings/ocaml/llvm/llvm_ocaml.c b/bindings/ocaml/llvm/llvm_ocaml.c
index 000db05449..78cf6e4368 100644
--- a/bindings/ocaml/llvm/llvm_ocaml.c
+++ b/bindings/ocaml/llvm/llvm_ocaml.c
@@ -807,6 +807,13 @@ CAMLprim value llvm_set_global_constant(value Flag, LLVMValueRef GlobalVar) {
return Val_unit;
}
+/*--... Operations on aliases ..............................................--*/
+
+CAMLprim LLVMValueRef llvm_add_alias(LLVMModuleRef M, LLVMTypeRef Ty,
+ LLVMValueRef Aliasee, value Name) {
+ return LLVMAddAlias(M, Ty, Aliasee, String_val(Name));
+}
+
/*--... Operations on functions ............................................--*/
DEFINE_ITERATORS(function, Function, LLVMModuleRef, LLVMValueRef,