llvm.org GIT mirror llvm / 13ba2f9
Remove unions from the ocaml bindings. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112363 91177308-0d34-0410-b5e6-96231b3b80d8 Benjamin Kramer 9 years ago
3 changed file(s) with 0 addition(s) and 43 deletion(s). Raw diff Collapse all Expand all
3434 | Opaque
3535 | Vector
3636 | Metadata
37 | Union
3837 end
3938
4039 module Linkage = struct
209208 = "llvm_struct_element_types"
210209 external is_packed : lltype -> bool = "llvm_is_packed"
211210
212 (*--... Operations on union types ..........................................--*)
213 external union_type : llcontext -> lltype array -> lltype = "llvm_union_type"
214 external union_element_types : lltype -> lltype array
215 = "llvm_union_element_types"
216
217211 (*--... Operations on pointer, vector, and array types .....................--*)
218212 external array_type : lltype -> int -> lltype = "llvm_array_type"
219213 external pointer_type : lltype -> lltype = "llvm_pointer_type"
320314 external const_packed_struct : llcontext -> llvalue array -> llvalue
321315 = "llvm_const_packed_struct"
322316 external const_vector : llvalue array -> llvalue = "llvm_const_vector"
323 external const_union : lltype -> llvalue -> llvalue = "LLVMConstUnion"
324317
325318 (*--... Constant expressions ...............................................--*)
326319 external align_of : lltype -> llvalue = "LLVMAlignOf"
10511044 if is_packed ty
10521045 then "<" ^ s ^ ">"
10531046 else s
1054 | TypeKind.Union -> "union { " ^ (concat2 ", " (
1055 Array.map string_of_lltype (union_element_types ty)
1056 )) ^ " }"
10571047 | TypeKind.Array -> "[" ^ (string_of_int (array_length ty)) ^
10581048 " x " ^ (string_of_lltype (element_type ty)) ^ "]"
10591049 | TypeKind.Vector -> "<" ^ (string_of_int (vector_size ty)) ^
7171 | Opaque
7272 | Vector
7373 | Metadata
74 | Union
7574 end
7675
7776 (** The linkage of a global value, accessed with {!linkage} and
407406 external is_packed : lltype -> bool = "llvm_is_packed"
408407
409408
410 (** {7 Operations on union types} *)
411
412 (** [union_type context tys] returns the union type in the context [context]
413 containing the types in the array [tys]. See the method
414 [llvm::UnionType::get] *)
415 external union_type : llcontext -> lltype array -> lltype = "llvm_union_type"
416
417 (** [union_element_types uty] returns the constituent types of the union type
418 [uty]. See the method [llvm::UnionType::getElementType]. *)
419 external union_element_types : lltype -> lltype array
420 = "llvm_union_element_types"
421
422
423409 (** {7 Operations on pointer, vector, and array types} *)
424410
425411 (** [array_type ty n] returns the array type containing [n] elements of type
695681 [vector_type (type_of elts.(0)) (Array.length elts)] and containing the
696682 values [elts]. See the method [llvm::ConstantVector::get]. *)
697683 external const_vector : llvalue array -> llvalue = "llvm_const_vector"
698
699 (** [const_union ty v] returns the union constant of type [union_type tys] and
700 containing the value [v]. See the method [llvm::ConstantUnion::get]. *)
701 external const_union : lltype -> llvalue -> llvalue = "LLVMConstUnion"
702684
703685
704686 (** {7 Constant expressions} *)
317317 return Val_bool(LLVMIsPackedStruct(StructTy));
318318 }
319319
320 /*--... Operations on union types ..........................................--*/
321
322 /* llcontext -> lltype array -> lltype */
323 CAMLprim LLVMTypeRef llvm_union_type(LLVMContextRef C, value ElementTypes) {
324 return LLVMUnionTypeInContext(C, (LLVMTypeRef *) ElementTypes,
325 Wosize_val(ElementTypes));
326 }
327
328 /* lltype -> lltype array */
329 CAMLprim value llvm_union_element_types(LLVMTypeRef UnionTy) {
330 value Tys = alloc(LLVMCountUnionElementTypes(UnionTy), 0);
331 LLVMGetUnionElementTypes(UnionTy, (LLVMTypeRef *) Tys);
332 return Tys;
333 }
334
335320 /*--... Operations on array, pointer, and vector types .....................--*/
336321
337322 /* lltype -> int -> lltype */