summaryrefslogtreecommitdiffstats
path: root/bindings
diff options
context:
space:
mode:
authorPeter Zotov <whitequark@whitequark.org>2015-10-21 17:43:02 +0000
committerPeter Zotov <whitequark@whitequark.org>2015-10-21 17:43:02 +0000
commit7d30a2ed8bbfb77386e3198a74f0288aec52e874 (patch)
tree6bce2741d3a1c1eb6289d4cdd7fdb6b653785453 /bindings
parent8b64b61d9a83ffc00a91101505deac1b3eceafe3 (diff)
[OCaml] Expose Llvm.{set_,}unnamed_addr.
Patch by Jacques-Pascal Deplaix <jp.deplaix@gmail.com> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250912 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'bindings')
-rw-r--r--bindings/ocaml/llvm/llvm.ml2
-rw-r--r--bindings/ocaml/llvm/llvm.mli10
-rw-r--r--bindings/ocaml/llvm/llvm_ocaml.c11
3 files changed, 23 insertions, 0 deletions
diff --git a/bindings/ocaml/llvm/llvm.ml b/bindings/ocaml/llvm/llvm.ml
index 9a3cb1f0de09..259d57bc0680 100644
--- a/bindings/ocaml/llvm/llvm.ml
+++ b/bindings/ocaml/llvm/llvm.ml
@@ -579,6 +579,8 @@ external global_parent : llvalue -> llmodule = "LLVMGetGlobalParent"
external is_declaration : llvalue -> bool = "llvm_is_declaration"
external linkage : llvalue -> Linkage.t = "llvm_linkage"
external set_linkage : Linkage.t -> llvalue -> unit = "llvm_set_linkage"
+external unnamed_addr : llvalue -> bool = "llvm_unnamed_addr"
+external set_unnamed_addr : bool -> llvalue -> unit = "llvm_set_unnamed_addr"
external section : llvalue -> string = "llvm_section"
external set_section : string -> llvalue -> unit = "llvm_set_section"
external visibility : llvalue -> Visibility.t = "llvm_visibility"
diff --git a/bindings/ocaml/llvm/llvm.mli b/bindings/ocaml/llvm/llvm.mli
index dcda02764f54..541c35a2a229 100644
--- a/bindings/ocaml/llvm/llvm.mli
+++ b/bindings/ocaml/llvm/llvm.mli
@@ -1255,6 +1255,16 @@ val linkage : llvalue -> Linkage.t
See the method [llvm::GlobalValue::setLinkage]. *)
val set_linkage : Linkage.t -> llvalue -> unit
+(** [unnamed_addr g] returns [true] if the global value [g] has the unnamed_addr
+ attribute. Returns [false] otherwise.
+ See the method [llvm::GlobalValue::getUnnamedAddr]. *)
+val unnamed_addr : llvalue -> bool
+
+(** [set_unnamed_addr b g] if [b] is [true], sets the unnamed_addr attribute of
+ the global value [g]. Unset it otherwise.
+ See the method [llvm::GlobalValue::setUnnamedAddr]. *)
+val set_unnamed_addr : bool -> llvalue -> unit
+
(** [section g] returns the linker section of the global value [g].
See the method [llvm::GlobalValue::getSection]. *)
val section : llvalue -> string
diff --git a/bindings/ocaml/llvm/llvm_ocaml.c b/bindings/ocaml/llvm/llvm_ocaml.c
index 3889f9276ccd..b4c47e7475e6 100644
--- a/bindings/ocaml/llvm/llvm_ocaml.c
+++ b/bindings/ocaml/llvm/llvm_ocaml.c
@@ -940,6 +940,17 @@ CAMLprim value llvm_set_linkage(value Linkage, LLVMValueRef Global) {
return Val_unit;
}
+/* llvalue -> bool */
+CAMLprim value llvm_unnamed_addr(LLVMValueRef Global) {
+ return Val_bool(LLVMHasUnnamedAddr(Global));
+}
+
+/* bool -> llvalue -> unit */
+CAMLprim value llvm_set_unnamed_addr(value UseUnnamedAddr, LLVMValueRef Global) {
+ LLVMSetUnnamedAddr(Global, Bool_val(UseUnnamedAddr));
+ return Val_unit;
+}
+
/* llvalue -> string */
CAMLprim value llvm_section(LLVMValueRef Global) {
return caml_copy_string(LLVMGetSection(Global));