[llvm] r250912 - [OCaml] Expose Llvm.{set_,}unnamed_addr.
Peter Zotov via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 21 10:43:02 PDT 2015
Author: whitequark
Date: Wed Oct 21 12:43:02 2015
New Revision: 250912
URL: http://llvm.org/viewvc/llvm-project?rev=250912&view=rev
Log:
[OCaml] Expose Llvm.{set_,}unnamed_addr.
Patch by Jacques-Pascal Deplaix <jp.deplaix at gmail.com>
Modified:
llvm/trunk/bindings/ocaml/llvm/llvm.ml
llvm/trunk/bindings/ocaml/llvm/llvm.mli
llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c
Modified: llvm/trunk/bindings/ocaml/llvm/llvm.ml
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/llvm/llvm.ml?rev=250912&r1=250911&r2=250912&view=diff
==============================================================================
--- llvm/trunk/bindings/ocaml/llvm/llvm.ml (original)
+++ llvm/trunk/bindings/ocaml/llvm/llvm.ml Wed Oct 21 12:43:02 2015
@@ -579,6 +579,8 @@ external global_parent : llvalue -> llmo
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"
Modified: llvm/trunk/bindings/ocaml/llvm/llvm.mli
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/llvm/llvm.mli?rev=250912&r1=250911&r2=250912&view=diff
==============================================================================
--- llvm/trunk/bindings/ocaml/llvm/llvm.mli (original)
+++ llvm/trunk/bindings/ocaml/llvm/llvm.mli Wed Oct 21 12:43:02 2015
@@ -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
Modified: llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c?rev=250912&r1=250911&r2=250912&view=diff
==============================================================================
--- llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c (original)
+++ llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c Wed Oct 21 12:43:02 2015
@@ -940,6 +940,17 @@ CAMLprim value llvm_set_linkage(value Li
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));
More information about the llvm-commits
mailing list