mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-27 17:31:33 +00:00
[OCaml] Add missing Llvm_target functions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194382 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
786a43e2d8
commit
fa6ab4393e
@ -26,6 +26,11 @@ external byte_order : DataLayout.t -> Endian.t = "llvm_byte_order"
|
|||||||
external pointer_size : DataLayout.t -> int = "llvm_pointer_size"
|
external pointer_size : DataLayout.t -> int = "llvm_pointer_size"
|
||||||
external intptr_type : DataLayout.t -> Llvm.llcontext -> Llvm.lltype
|
external intptr_type : DataLayout.t -> Llvm.llcontext -> Llvm.lltype
|
||||||
= "llvm_intptr_type"
|
= "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
|
external size_in_bits : DataLayout.t -> Llvm.lltype -> Int64.t
|
||||||
= "llvm_size_in_bits"
|
= "llvm_size_in_bits"
|
||||||
external store_size : DataLayout.t -> Llvm.lltype -> Int64.t = "llvm_store_size"
|
external store_size : DataLayout.t -> Llvm.lltype -> Int64.t = "llvm_store_size"
|
||||||
|
@ -50,6 +50,18 @@ external pointer_size : DataLayout.t -> int = "llvm_pointer_size"
|
|||||||
external intptr_type : DataLayout.t -> Llvm.llcontext -> Llvm.lltype
|
external intptr_type : DataLayout.t -> Llvm.llcontext -> Llvm.lltype
|
||||||
= "llvm_intptr_type"
|
= "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.
|
(** Computes the size of a type in bits for a target.
|
||||||
See the method llvm::DataLayout::getTypeSizeInBits. *)
|
See the method llvm::DataLayout::getTypeSizeInBits. *)
|
||||||
external size_in_bits : DataLayout.t -> Llvm.lltype -> Int64.t
|
external size_in_bits : DataLayout.t -> Llvm.lltype -> Int64.t
|
||||||
|
@ -77,6 +77,17 @@ CAMLprim LLVMTypeRef llvm_intptr_type(value TD, LLVMContextRef C) {
|
|||||||
return LLVMIntPtrTypeInContext(C, TargetData_val(TD));;
|
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 */
|
/* DataLayout.t -> Llvm.lltype -> Int64.t */
|
||||||
CAMLprim value llvm_size_in_bits(value TD, LLVMTypeRef Ty) {
|
CAMLprim value llvm_size_in_bits(value TD, LLVMTypeRef Ty) {
|
||||||
return caml_copy_int64(LLVMSizeOfTypeInBits(TargetData_val(TD), Ty));
|
return caml_copy_int64(LLVMSizeOfTypeInBits(TargetData_val(TD), Ty));
|
||||||
|
@ -47,6 +47,8 @@ let test_target_data () =
|
|||||||
assert_equal (byte_order td) Endian.Little;
|
assert_equal (byte_order td) Endian.Little;
|
||||||
assert_equal (pointer_size td) 4;
|
assert_equal (pointer_size td) 4;
|
||||||
assert_equal (intptr_type td context) i32_type;
|
assert_equal (intptr_type td context) i32_type;
|
||||||
|
assert_equal (qualified_pointer_size td 0) 4;
|
||||||
|
assert_equal (qualified_intptr_type td context 0) i32_type;
|
||||||
assert_equal (size_in_bits td sty) (Int64.of_int 96);
|
assert_equal (size_in_bits td sty) (Int64.of_int 96);
|
||||||
assert_equal (store_size td sty) (Int64.of_int 12);
|
assert_equal (store_size td sty) (Int64.of_int 12);
|
||||||
assert_equal (abi_size td sty) (Int64.of_int 12);
|
assert_equal (abi_size td sty) (Int64.of_int 12);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user