aboutsummaryrefslogtreecommitdiffstats
path: root/bindings
diff options
context:
space:
mode:
authorPeter Zotov <whitequark@whitequark.org>2013-11-11 14:47:28 +0000
committerPeter Zotov <whitequark@whitequark.org>2013-11-11 14:47:28 +0000
commitfa6ab4393ebb7add77a4a957dc50453d07b54a62 (patch)
tree374549c7b1c82b390e1db4581067b38093a811e9 /bindings
parent786a43e2d8f98034046b7fd3a78d94e57a466895 (diff)
downloadexternal_llvm-fa6ab4393ebb7add77a4a957dc50453d07b54a62.zip
external_llvm-fa6ab4393ebb7add77a4a957dc50453d07b54a62.tar.gz
external_llvm-fa6ab4393ebb7add77a4a957dc50453d07b54a62.tar.bz2
[OCaml] Add missing Llvm_target functions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194382 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'bindings')
-rw-r--r--bindings/ocaml/target/llvm_target.ml5
-rw-r--r--bindings/ocaml/target/llvm_target.mli12
-rw-r--r--bindings/ocaml/target/target_ocaml.c11
3 files changed, 28 insertions, 0 deletions
diff --git a/bindings/ocaml/target/llvm_target.ml b/bindings/ocaml/target/llvm_target.ml
index b6a4d51..8a6aabf 100644
--- a/bindings/ocaml/target/llvm_target.ml
+++ b/bindings/ocaml/target/llvm_target.ml
@@ -26,6 +26,11 @@ external byte_order : DataLayout.t -> Endian.t = "llvm_byte_order"
external pointer_size : DataLayout.t -> int = "llvm_pointer_size"
external intptr_type : DataLayout.t -> Llvm.llcontext -> Llvm.lltype
= "llvm_intptr_type"
+external qualified_pointer_size : DataLayout.t -> int -> int
+ = "llvm_qualified_pointer_size"
+external qualified_intptr_type : DataLayout.t -> Llvm.llcontext ->
+ int -> Llvm.lltype
+ = "llvm_qualified_intptr_type"
external size_in_bits : DataLayout.t -> Llvm.lltype -> Int64.t
= "llvm_size_in_bits"
external store_size : DataLayout.t -> Llvm.lltype -> Int64.t = "llvm_store_size"
diff --git a/bindings/ocaml/target/llvm_target.mli b/bindings/ocaml/target/llvm_target.mli
index 7c255ad..87b7005 100644
--- a/bindings/ocaml/target/llvm_target.mli
+++ b/bindings/ocaml/target/llvm_target.mli
@@ -50,6 +50,18 @@ external pointer_size : DataLayout.t -> int = "llvm_pointer_size"
external intptr_type : DataLayout.t -> Llvm.llcontext -> Llvm.lltype
= "llvm_intptr_type"
+(** Returns the pointer size in bytes for a target in a given address space.
+ See the method llvm::DataLayout::getPointerSize. *)
+external qualified_pointer_size : DataLayout.t -> int -> int
+ = "llvm_qualified_pointer_size"
+
+(** Returns the integer type that is the same size as a pointer on a target
+ in a given address space.
+ See the method llvm::DataLayout::getIntPtrType. *)
+external qualified_intptr_type : DataLayout.t -> Llvm.llcontext ->
+ int -> Llvm.lltype
+ = "llvm_qualified_intptr_type"
+
(** Computes the size of a type in bits for a target.
See the method llvm::DataLayout::getTypeSizeInBits. *)
external size_in_bits : DataLayout.t -> Llvm.lltype -> Int64.t
diff --git a/bindings/ocaml/target/target_ocaml.c b/bindings/ocaml/target/target_ocaml.c
index 46bf8dc..5178c09 100644
--- a/bindings/ocaml/target/target_ocaml.c
+++ b/bindings/ocaml/target/target_ocaml.c
@@ -77,6 +77,17 @@ CAMLprim LLVMTypeRef llvm_intptr_type(value TD, LLVMContextRef C) {
return LLVMIntPtrTypeInContext(C, TargetData_val(TD));;
}
+/* DataLayout.t -> int -> int */
+CAMLprim value llvm_qualified_pointer_size(LLVMTargetDataRef TD, value AS) {
+ return Val_int(LLVMPointerSizeForAS(TargetData_val(TD), Int_val(AS)));
+}
+
+/* DataLayout.t -> int -> Llvm.lltype */
+CAMLprim LLVMTypeRef llvm_qualified_intptr_type(LLVMTargetDataRef TD,
+ LLVMContextRef C, value AS) {
+ return LLVMIntPtrTypeForASInContext(C, TargetData_val(TD), Int_val(AS));
+}
+
/* DataLayout.t -> Llvm.lltype -> Int64.t */
CAMLprim value llvm_size_in_bits(value TD, LLVMTypeRef Ty) {
return caml_copy_int64(LLVMSizeOfTypeInBits(TargetData_val(TD), Ty));