external pointer_type : lltype -> lltype = "llvm_pointer_type"
external qualified_pointer_type : lltype -> int -> lltype
= "llvm_qualified_pointer_type"
+external pointer_type_in_context : llcontext -> int -> lltype
+ = "llvm_pointer_type_in_context"
external vector_type : lltype -> int -> lltype = "llvm_vector_type"
external element_type : lltype -> lltype = "LLVMGetElementType"
See the method [llvm::PointerType::get]. *)
val qualified_pointer_type : lltype -> int -> lltype
+(** [pointer_type_in_context context as] returns the opaque pointer type
+ referencing objects in address space [as].
+ See the method [llvm::PointerType::get]. *)
+val pointer_type_in_context : llcontext -> int -> lltype
+
(** [vector_type ty n] returns the array type containing [n] elements of the
primitive type [ty]. See the method [llvm::ArrayType::get]. *)
val vector_type : lltype -> int -> lltype
return LLVMPointerType(ElementTy, Int_val(AddressSpace));
}
+/* llcontext -> int -> lltype */
+LLVMTypeRef llvm_pointer_type_in_context(LLVMContextRef C, value AddressSpace) {
+ return LLVMPointerTypeInContext(C, Int_val(AddressSpace));
+}
+
/* lltype -> int -> lltype */
LLVMTypeRef llvm_vector_type(LLVMTypeRef ElementTy, value Count) {
return LLVMVectorType(ElementTy, Int_val(Count));
insist (i32_type = (Array.get (subtypes ar)) 0);
insist (i8_type = (Array.get (subtypes ar)) 1)
+(*===-- Pointer types ----------------------------------------------------===*)
+let test_pointer_types () =
+ insist (address_space (pointer_type_in_context context 0) = 0);
+ insist (address_space (pointer_type_in_context context 1) = 1)
(*===-- Conversion --------------------------------------------------------===*)
let _ =
suite "contained types" test_contained_types;
+ suite "pointer types" test_pointer_types;
suite "conversion" test_conversion;
suite "target" test_target;
suite "constants" test_constants;