OSDN Git Service

Remove unions from the ocaml bindings.
authorBenjamin Kramer <benny.kra@googlemail.com>
Sat, 28 Aug 2010 09:47:42 +0000 (09:47 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Sat, 28 Aug 2010 09:47:42 +0000 (09:47 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112363 91177308-0d34-0410-b5e6-96231b3b80d8

bindings/ocaml/llvm/llvm.ml
bindings/ocaml/llvm/llvm.mli
bindings/ocaml/llvm/llvm_ocaml.c

index e0c168a..462eb20 100644 (file)
@@ -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)) ^
index 4b9caad..ba3bbe2 100644 (file)
@@ -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} *)
 
index d25d294..ef2e3d6 100644 (file)
@@ -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 */