aboutsummaryrefslogtreecommitdiff
path: root/bindings
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2010-09-17 15:48:55 +0000
committerDimitry Andric <dim@FreeBSD.org>2010-09-17 15:48:55 +0000
commitd39c594d39df7f283c2fb8a704a3f31c501180d9 (patch)
tree36453626c792cccd91f783a38a169d610a6b9db9 /bindings
parent6144c1de6a7674dad94290650e4e14f24d42e421 (diff)
downloadsrc-d39c594d39df7f283c2fb8a704a3f31c501180d9.tar.gz
src-d39c594d39df7f283c2fb8a704a3f31c501180d9.zip
Vendor import of llvm r114020 (from the release_28 branch):vendor/llvm/llvm-r114020
Notes
Notes: svn path=/vendor/llvm/dist/; revision=212793 svn path=/vendor/llvm/llvm-r114020/; revision=212794; tag=vendor/llvm/llvm-r114020
Diffstat (limited to 'bindings')
-rw-r--r--bindings/ada/llvm/llvm.ads36
-rw-r--r--bindings/ocaml/llvm/llvm.ml12
-rw-r--r--bindings/ocaml/llvm/llvm.mli28
-rw-r--r--bindings/ocaml/llvm/llvm_ocaml.c30
4 files changed, 43 insertions, 63 deletions
diff --git a/bindings/ada/llvm/llvm.ads b/bindings/ada/llvm/llvm.ads
index ce74e670a685..20fc940f8c24 100644
--- a/bindings/ada/llvm/llvm.ads
+++ b/bindings/ada/llvm/llvm.ads
@@ -317,25 +317,27 @@ package llvm is
LLVMGhostLinkage,
LLVMCommonLinkage,
LLVMLinkerPrivateLinkage,
- LLVMLinkerPrivateWeakLinkage);
+ LLVMLinkerPrivateWeakLinkage,
+ LinkerPrivateWeakDefAutoLinkage);
for LLVMLinkage use
- (LLVMExternalLinkage => 0,
- LLVMAvailableExternallyLinkage => 1,
- LLVMLinkOnceAnyLinkage => 2,
- LLVMLinkOnceODRLinkage => 3,
- LLVMWeakAnyLinkage => 4,
- LLVMWeakODRLinkage => 5,
- LLVMAppendingLinkage => 6,
- LLVMInternalLinkage => 7,
- LLVMPrivateLinkage => 8,
- LLVMDLLImportLinkage => 9,
- LLVMDLLExportLinkage => 10,
- LLVMExternalWeakLinkage => 11,
- LLVMGhostLinkage => 12,
- LLVMCommonLinkage => 13,
- LLVMLinkerPrivateLinkage => 14,
- LLVMLinkerPrivateWeakLinkage => 15);
+ (LLVMExternalLinkage => 0,
+ LLVMAvailableExternallyLinkage => 1,
+ LLVMLinkOnceAnyLinkage => 2,
+ LLVMLinkOnceODRLinkage => 3,
+ LLVMWeakAnyLinkage => 4,
+ LLVMWeakODRLinkage => 5,
+ LLVMAppendingLinkage => 6,
+ LLVMInternalLinkage => 7,
+ LLVMPrivateLinkage => 8,
+ LLVMDLLImportLinkage => 9,
+ LLVMDLLExportLinkage => 10,
+ LLVMExternalWeakLinkage => 11,
+ LLVMGhostLinkage => 12,
+ LLVMCommonLinkage => 13,
+ LLVMLinkerPrivateLinkage => 14,
+ LLVMLinkerPrivateWeakLinkage => 15,
+ LinkerPrivateWeakDefAutoLinkage => 16);
pragma Convention (C, LLVMLinkage);
diff --git a/bindings/ocaml/llvm/llvm.ml b/bindings/ocaml/llvm/llvm.ml
index 7ab6f51efb9f..462eb201694b 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"
@@ -280,6 +274,8 @@ let fold_right_uses f v init =
(*--... Operations on users ................................................--*)
external operand : llvalue -> int -> llvalue = "llvm_operand"
+external set_operand : llvalue -> int -> llvalue -> unit = "llvm_set_operand"
+external num_operands : llvalue -> int = "llvm_num_operands"
(*--... Operations on constants of (mostly) any type .......................--*)
external is_constant : llvalue -> bool = "llvm_is_constant"
@@ -319,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"
@@ -1050,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 742265cd3d5c..ba3bbe248b71 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
@@ -557,6 +543,14 @@ val fold_right_uses : (lluse -> 'a -> 'a) -> llvalue -> 'a -> 'a
method [llvm::User::getOperand]. *)
external operand : llvalue -> int -> llvalue = "llvm_operand"
+(** [set_operand v i o] sets the operand of the value [v] at the index [i] to
+ the value [o].
+ See the method [llvm::User::setOperand]. *)
+external set_operand : llvalue -> int -> llvalue -> unit = "llvm_set_operand"
+
+(** [num_operands v] returns the number of operands for the value [v].
+ See the method [llvm::User::getNumOperands]. *)
+external num_operands : llvalue -> int = "llvm_num_operands"
(** {7 Operations on constants of (mostly) any type} *)
@@ -689,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} *)
@@ -991,7 +981,7 @@ external const_insertelement : llvalue -> llvalue -> llvalue -> llvalue
= "LLVMConstInsertElement"
(** [const_shufflevector a b mask] returns a constant [shufflevector].
- See the LLVM Language Reference for details on the [sufflevector]
+ See the LLVM Language Reference for details on the [shufflevector]
instruction.
See the method [llvm::ConstantExpr::getShuffleVector]. *)
external const_shufflevector : llvalue -> llvalue -> llvalue -> llvalue
diff --git a/bindings/ocaml/llvm/llvm_ocaml.c b/bindings/ocaml/llvm/llvm_ocaml.c
index c4355ba2dbf1..ef2e3d66629c 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 */
@@ -452,6 +437,17 @@ CAMLprim LLVMValueRef llvm_operand(LLVMValueRef V, value I) {
return LLVMGetOperand(V, Int_val(I));
}
+/* llvalue -> int -> llvalue -> unit */
+CAMLprim value llvm_set_operand(LLVMValueRef U, value I, LLVMValueRef V) {
+ LLVMSetOperand(U, Int_val(I), V);
+ return Val_unit;
+}
+
+/* llvalue -> int */
+CAMLprim value llvm_num_operands(LLVMValueRef V) {
+ return Val_int(LLVMGetNumOperands(V));
+}
+
/*--... Operations on constants of (mostly) any type .......................--*/
/* llvalue -> bool */
@@ -964,8 +960,8 @@ CAMLprim LLVMValueRef llvm_param(LLVMValueRef Fn, value Index) {
return LLVMGetParam(Fn, Int_val(Index));
}
-/* llvalue -> int -> llvalue */
-CAMLprim value llvm_params(LLVMValueRef Fn, value Index) {
+/* llvalue -> llvalue */
+CAMLprim value llvm_params(LLVMValueRef Fn) {
value Params = alloc(LLVMCountParams(Fn), 0);
LLVMGetParams(Fn, (LLVMValueRef *) Op_val(Params));
return Params;