llvm.org GIT mirror llvm / fa6ab43
[OCaml] Add missing Llvm_target functions git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194382 91177308-0d34-0410-b5e6-96231b3b80d8 Peter Zotov 7 years ago
4 changed file(s) with 30 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
2525 external pointer_size : DataLayout.t -> int = "llvm_pointer_size"
2626 external intptr_type : DataLayout.t -> Llvm.llcontext -> Llvm.lltype
2727 = "llvm_intptr_type"
28 external qualified_pointer_size : DataLayout.t -> int -> int
29 = "llvm_qualified_pointer_size"
30 external qualified_intptr_type : DataLayout.t -> Llvm.llcontext ->
31 int -> Llvm.lltype
32 = "llvm_qualified_intptr_type"
2833 external size_in_bits : DataLayout.t -> Llvm.lltype -> Int64.t
2934 = "llvm_size_in_bits"
3035 external store_size : DataLayout.t -> Llvm.lltype -> Int64.t = "llvm_store_size"
4949 external intptr_type : DataLayout.t -> Llvm.llcontext -> Llvm.lltype
5050 = "llvm_intptr_type"
5151
52 (** Returns the pointer size in bytes for a target in a given address space.
53 See the method llvm::DataLayout::getPointerSize. *)
54 external qualified_pointer_size : DataLayout.t -> int -> int
55 = "llvm_qualified_pointer_size"
56
57 (** Returns the integer type that is the same size as a pointer on a target
58 in a given address space.
59 See the method llvm::DataLayout::getIntPtrType. *)
60 external qualified_intptr_type : DataLayout.t -> Llvm.llcontext ->
61 int -> Llvm.lltype
62 = "llvm_qualified_intptr_type"
63
5264 (** Computes the size of a type in bits for a target.
5365 See the method llvm::DataLayout::getTypeSizeInBits. *)
5466 external size_in_bits : DataLayout.t -> Llvm.lltype -> Int64.t
7676 return LLVMIntPtrTypeInContext(C, TargetData_val(TD));;
7777 }
7878
79 /* DataLayout.t -> int -> int */
80 CAMLprim value llvm_qualified_pointer_size(LLVMTargetDataRef TD, value AS) {
81 return Val_int(LLVMPointerSizeForAS(TargetData_val(TD), Int_val(AS)));
82 }
83
84 /* DataLayout.t -> int -> Llvm.lltype */
85 CAMLprim LLVMTypeRef llvm_qualified_intptr_type(LLVMTargetDataRef TD,
86 LLVMContextRef C, value AS) {
87 return LLVMIntPtrTypeForASInContext(C, TargetData_val(TD), Int_val(AS));
88 }
89
7990 /* DataLayout.t -> Llvm.lltype -> Int64.t */
8091 CAMLprim value llvm_size_in_bits(value TD, LLVMTypeRef Ty) {
8192 return caml_copy_int64(LLVMSizeOfTypeInBits(TargetData_val(TD), Ty));
4646 assert_equal (byte_order td) Endian.Little;
4747 assert_equal (pointer_size td) 4;
4848 assert_equal (intptr_type td context) i32_type;
49 assert_equal (qualified_pointer_size td 0) 4;
50 assert_equal (qualified_intptr_type td context 0) i32_type;
4951 assert_equal (size_in_bits td sty) (Int64.of_int 96);
5052 assert_equal (store_size td sty) (Int64.of_int 12);
5153 assert_equal (abi_size td sty) (Int64.of_int 12);