From: Benjamin Kramer Date: Sat, 28 Aug 2010 09:47:42 +0000 (+0000) Subject: Remove unions from the ocaml bindings. X-Git-Url: http://plrg.eecs.uci.edu/git/?p=oota-llvm.git;a=commitdiff_plain;h=13ba2f9714185cf93531ab51addebf63ee256e81 Remove unions from the ocaml bindings. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112363 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/bindings/ocaml/llvm/llvm.ml b/bindings/ocaml/llvm/llvm.ml index e0c168a2d9d..462eb201694 100644 --- a/bindings/ocaml/llvm/llvm.ml +++ b/bindings/ocaml/llvm/llvm.ml @@ -35,7 +35,6 @@ module TypeKind = struct | Opaque | Vector | Metadata - | Union end module Linkage = struct @@ -210,11 +209,6 @@ external struct_element_types : lltype -> lltype array = "llvm_struct_element_types" external is_packed : lltype -> bool = "llvm_is_packed" -(*--... Operations on union types ..........................................--*) -external union_type : llcontext -> lltype array -> lltype = "llvm_union_type" -external union_element_types : lltype -> lltype array - = "llvm_union_element_types" - (*--... Operations on pointer, vector, and array types .....................--*) external array_type : lltype -> int -> lltype = "llvm_array_type" external pointer_type : lltype -> lltype = "llvm_pointer_type" @@ -321,7 +315,6 @@ external const_struct : llcontext -> llvalue array -> llvalue external const_packed_struct : llcontext -> llvalue array -> llvalue = "llvm_const_packed_struct" external const_vector : llvalue array -> llvalue = "llvm_const_vector" -external const_union : lltype -> llvalue -> llvalue = "LLVMConstUnion" (*--... Constant expressions ...............................................--*) external align_of : lltype -> llvalue = "LLVMAlignOf" @@ -1052,9 +1045,6 @@ let rec string_of_lltype ty = if is_packed ty then "<" ^ s ^ ">" else s - | TypeKind.Union -> "union { " ^ (concat2 ", " ( - Array.map string_of_lltype (union_element_types ty) - )) ^ " }" | TypeKind.Array -> "[" ^ (string_of_int (array_length ty)) ^ " x " ^ (string_of_lltype (element_type ty)) ^ "]" | TypeKind.Vector -> "<" ^ (string_of_int (vector_size ty)) ^ diff --git a/bindings/ocaml/llvm/llvm.mli b/bindings/ocaml/llvm/llvm.mli index 4b9caadb619..ba3bbe248b7 100644 --- a/bindings/ocaml/llvm/llvm.mli +++ b/bindings/ocaml/llvm/llvm.mli @@ -72,7 +72,6 @@ module TypeKind : sig | Opaque | Vector | Metadata - | Union end (** The linkage of a global value, accessed with {!linkage} and @@ -408,19 +407,6 @@ external struct_element_types : lltype -> lltype array external is_packed : lltype -> bool = "llvm_is_packed" -(** {7 Operations on union types} *) - -(** [union_type context tys] returns the union type in the context [context] - containing the types in the array [tys]. See the method - [llvm::UnionType::get] *) -external union_type : llcontext -> lltype array -> lltype = "llvm_union_type" - -(** [union_element_types uty] returns the constituent types of the union type - [uty]. See the method [llvm::UnionType::getElementType]. *) -external union_element_types : lltype -> lltype array - = "llvm_union_element_types" - - (** {7 Operations on pointer, vector, and array types} *) (** [array_type ty n] returns the array type containing [n] elements of type @@ -697,10 +683,6 @@ external const_packed_struct : llcontext -> llvalue array -> llvalue values [elts]. See the method [llvm::ConstantVector::get]. *) external const_vector : llvalue array -> llvalue = "llvm_const_vector" -(** [const_union ty v] returns the union constant of type [union_type tys] and - containing the value [v]. See the method [llvm::ConstantUnion::get]. *) -external const_union : lltype -> llvalue -> llvalue = "LLVMConstUnion" - (** {7 Constant expressions} *) diff --git a/bindings/ocaml/llvm/llvm_ocaml.c b/bindings/ocaml/llvm/llvm_ocaml.c index d25d2942d14..ef2e3d66629 100644 --- a/bindings/ocaml/llvm/llvm_ocaml.c +++ b/bindings/ocaml/llvm/llvm_ocaml.c @@ -318,21 +318,6 @@ CAMLprim value llvm_is_packed(LLVMTypeRef StructTy) { return Val_bool(LLVMIsPackedStruct(StructTy)); } -/*--... Operations on union types ..........................................--*/ - -/* llcontext -> lltype array -> lltype */ -CAMLprim LLVMTypeRef llvm_union_type(LLVMContextRef C, value ElementTypes) { - return LLVMUnionTypeInContext(C, (LLVMTypeRef *) ElementTypes, - Wosize_val(ElementTypes)); -} - -/* lltype -> lltype array */ -CAMLprim value llvm_union_element_types(LLVMTypeRef UnionTy) { - value Tys = alloc(LLVMCountUnionElementTypes(UnionTy), 0); - LLVMGetUnionElementTypes(UnionTy, (LLVMTypeRef *) Tys); - return Tys; -} - /*--... Operations on array, pointer, and vector types .....................--*/ /* lltype -> int -> lltype */