aboutsummaryrefslogtreecommitdiffstats
path: root/bindings
diff options
context:
space:
mode:
authorGordon Henriksen <gordonhenriksen@mac.com>2007-10-06 16:56:09 +0000
committerGordon Henriksen <gordonhenriksen@mac.com>2007-10-06 16:56:09 +0000
commit7d36594ca17132efce4664f383df5aa3cc959792 (patch)
treec65164939c32e6d6fdaf1a13deaa4ac21020ad66 /bindings
parent659c9472f084e9c16b39362b142a8022e59a7668 (diff)
downloadexternal_llvm-7d36594ca17132efce4664f383df5aa3cc959792.zip
external_llvm-7d36594ca17132efce4664f383df5aa3cc959792.tar.gz
external_llvm-7d36594ca17132efce4664f383df5aa3cc959792.tar.bz2
Adopting a uniform naming convention for type constructors in
bindings (part le deux). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42701 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'bindings')
-rw-r--r--bindings/ocaml/llvm/llvm.ml19
-rw-r--r--bindings/ocaml/llvm/llvm.mli19
-rw-r--r--bindings/ocaml/llvm/llvm_ocaml.c38
3 files changed, 44 insertions, 32 deletions
diff --git a/bindings/ocaml/llvm/llvm.ml b/bindings/ocaml/llvm/llvm.ml
index 016c17a..d1877b4 100644
--- a/bindings/ocaml/llvm/llvm.ml
+++ b/bindings/ocaml/llvm/llvm.ml
@@ -128,7 +128,7 @@ let i16_type = _i16_type ()
let i32_type = _i32_type ()
let i64_type = _i64_type ()
-external make_integer_type : int -> lltype = "llvm_make_integer_type"
+external integer_type : int -> lltype = "llvm_integer_type"
external integer_bitwidth : lltype -> int = "llvm_integer_bitwidth"
(*--... Operations on real types ...........................................--*)
@@ -146,29 +146,30 @@ let ppc_fp128_type = _ppc_fp128_type ()
(*--... Operations on function types .......................................--*)
(* FIXME: handle parameter attributes *)
-external make_function_type : lltype -> lltype array -> bool -> lltype
- = "llvm_make_function_type"
+external function_type : lltype -> lltype array -> lltype = "llvm_function_type"
+external var_arg_function_type : lltype -> lltype array -> lltype
+ = "llvm_var_arg_function_type"
external is_var_arg : lltype -> bool = "llvm_is_var_arg"
external return_type : lltype -> lltype = "llvm_return_type"
external param_types : lltype -> lltype array = "llvm_param_types"
(*--... Operations on struct types .........................................--*)
-external make_struct_type : lltype array -> bool -> lltype
- = "llvm_make_struct_type"
+external struct_type : lltype array -> lltype = "llvm_struct_type"
+external packed_struct_type : lltype array -> lltype = "llvm_packed_struct_type"
external element_types : lltype -> lltype array = "llvm_element_types"
external is_packed : lltype -> bool = "llvm_is_packed"
(*--... Operations on pointer, vector, and array types .....................--*)
-external make_array_type : lltype -> int -> lltype = "llvm_make_array_type"
-external make_pointer_type : lltype -> lltype = "llvm_make_pointer_type"
-external make_vector_type : lltype -> int -> lltype = "llvm_make_vector_type"
+external array_type : lltype -> int -> lltype = "llvm_array_type"
+external pointer_type : lltype -> lltype = "llvm_pointer_type"
+external vector_type : lltype -> int -> lltype = "llvm_vector_type"
external element_type : lltype -> lltype = "llvm_element_type"
external array_length : lltype -> int = "llvm_array_length"
external vector_size : lltype -> int = "llvm_vector_size"
(*--... Operations on other types ..........................................--*)
-external make_opaque_type : unit -> lltype = "llvm_make_opaque_type"
+external opaque_type : unit -> lltype = "llvm_opaque_type"
external _void_type : unit -> lltype = "llvm_void_type"
external _label_type : unit -> lltype = "llvm_label_type"
diff --git a/bindings/ocaml/llvm/llvm.mli b/bindings/ocaml/llvm/llvm.mli
index 3ded2db..42cf002 100644
--- a/bindings/ocaml/llvm/llvm.mli
+++ b/bindings/ocaml/llvm/llvm.mli
@@ -121,7 +121,7 @@ val i8_type : lltype
val i16_type : lltype
val i32_type : lltype
val i64_type : lltype
-external make_integer_type : int -> lltype = "llvm_make_integer_type"
+external integer_type : int -> lltype = "llvm_integer_type"
external integer_bitwidth : lltype -> int = "llvm_integer_bitwidth"
(*--... Operations on real types ...........................................--*)
@@ -133,29 +133,30 @@ val ppc_fp128_type : lltype
(*--... Operations on function types .......................................--*)
(* FIXME: handle parameter attributes *)
-external make_function_type : lltype -> lltype array -> bool -> lltype
- = "llvm_make_function_type"
+external function_type : lltype -> lltype array -> lltype = "llvm_function_type"
+external var_arg_function_type : lltype -> lltype array -> lltype
+ = "llvm_var_arg_function_type"
external is_var_arg : lltype -> bool = "llvm_is_var_arg"
external return_type : lltype -> lltype = "llvm_return_type"
external param_types : lltype -> lltype array = "llvm_param_types"
(*--... Operations on struct types .........................................--*)
-external make_struct_type : lltype array -> bool -> lltype
- = "llvm_make_struct_type"
+external struct_type : lltype array -> lltype = "llvm_struct_type"
+external packed_struct_type : lltype array -> lltype = "llvm_packed_struct_type"
external element_types : lltype -> lltype array = "llvm_element_types"
external is_packed : lltype -> bool = "llvm_is_packed"
(*--... Operations on pointer, vector, and array types .....................--*)
-external make_array_type : lltype -> int -> lltype = "llvm_make_array_type"
-external make_pointer_type : lltype -> lltype = "llvm_make_pointer_type"
-external make_vector_type : lltype -> int -> lltype = "llvm_make_vector_type"
+external array_type : lltype -> int -> lltype = "llvm_array_type"
+external pointer_type : lltype -> lltype = "llvm_pointer_type"
+external vector_type : lltype -> int -> lltype = "llvm_vector_type"
external element_type : lltype -> lltype = "llvm_element_type"
external array_length : lltype -> int = "llvm_array_length"
external vector_size : lltype -> int = "llvm_vector_size"
(*--... Operations on other types ..........................................--*)
-external make_opaque_type : unit -> lltype = "llvm_make_opaque_type"
+external opaque_type : unit -> lltype = "llvm_opaque_type"
val void_type : lltype
val label_type : lltype
diff --git a/bindings/ocaml/llvm/llvm_ocaml.c b/bindings/ocaml/llvm/llvm_ocaml.c
index 0005bee..7cb9029 100644
--- a/bindings/ocaml/llvm/llvm_ocaml.c
+++ b/bindings/ocaml/llvm/llvm_ocaml.c
@@ -73,7 +73,7 @@ CAMLprim LLVMTypeRef llvm_i32_type(value Unit) { return LLVMInt32Type(); }
CAMLprim LLVMTypeRef llvm_i64_type(value Unit) { return LLVMInt64Type(); }
/* int -> lltype */
-CAMLprim LLVMTypeRef llvm_make_integer_type(value Width) {
+CAMLprim LLVMTypeRef llvm_integer_type(value Width) {
return LLVMIntType(Int_val(Width));
}
@@ -111,12 +111,17 @@ CAMLprim LLVMTypeRef llvm_ppc_fp128_type(value Unit) {
/*--... Operations on function types .......................................--*/
-/* lltype -> lltype array -> bool -> lltype */
-CAMLprim LLVMTypeRef llvm_make_function_type(LLVMTypeRef RetTy, value ParamTys,
- value IsVarArg) {
+/* lltype -> lltype array -> lltype */
+CAMLprim LLVMTypeRef llvm_function_type(LLVMTypeRef RetTy, value ParamTys) {
return LLVMFunctionType(RetTy, (LLVMTypeRef *) ParamTys,
- Wosize_val(ParamTys),
- Bool_val(IsVarArg));
+ Wosize_val(ParamTys), 0);
+}
+
+/* lltype -> lltype array -> lltype */
+CAMLprim LLVMTypeRef llvm_var_arg_function_type(LLVMTypeRef RetTy,
+ value ParamTys) {
+ return LLVMFunctionType(RetTy, (LLVMTypeRef *) ParamTys,
+ Wosize_val(ParamTys), 1);
}
/* lltype -> bool */
@@ -138,11 +143,16 @@ CAMLprim value llvm_param_types(LLVMTypeRef FunTy) {
/*--... Operations on struct types .........................................--*/
-/* lltype array -> bool -> lltype */
-CAMLprim LLVMTypeRef llvm_make_struct_type(value ElementTypes, value Packed) {
+/* lltype array -> lltype */
+CAMLprim LLVMTypeRef llvm_struct_type(value ElementTypes) {
+ return LLVMStructType((LLVMTypeRef *) ElementTypes,
+ Wosize_val(ElementTypes), 0);
+}
+
+/* lltype array -> lltype */
+CAMLprim LLVMTypeRef llvm_packed_struct_type(value ElementTypes) {
return LLVMStructType((LLVMTypeRef *) ElementTypes,
- Wosize_val(ElementTypes),
- Bool_val(Packed));
+ Wosize_val(ElementTypes), 1);
}
/* lltype -> lltype array */
@@ -160,17 +170,17 @@ CAMLprim value llvm_is_packed(LLVMTypeRef StructTy) {
/*--... Operations on array, pointer, and vector types .....................--*/
/* lltype -> int -> lltype */
-CAMLprim LLVMTypeRef llvm_make_array_type(LLVMTypeRef ElementTy, value Count) {
+CAMLprim LLVMTypeRef llvm_array_type(LLVMTypeRef ElementTy, value Count) {
return LLVMArrayType(ElementTy, Int_val(Count));
}
/* lltype -> lltype */
-CAMLprim LLVMTypeRef llvm_make_pointer_type(LLVMTypeRef ElementTy) {
+CAMLprim LLVMTypeRef llvm_pointer_type(LLVMTypeRef ElementTy) {
return LLVMPointerType(ElementTy);
}
/* lltype -> int -> lltype */
-CAMLprim LLVMTypeRef llvm_make_vector_type(LLVMTypeRef ElementTy, value Count) {
+CAMLprim LLVMTypeRef llvm_vector_type(LLVMTypeRef ElementTy, value Count) {
return LLVMVectorType(ElementTy, Int_val(Count));
}
@@ -196,7 +206,7 @@ CAMLprim LLVMTypeRef llvm_void_type (value Unit) { return LLVMVoidType(); }
CAMLprim LLVMTypeRef llvm_label_type(value Unit) { return LLVMLabelType(); }
/* unit -> lltype */
-CAMLprim LLVMTypeRef llvm_make_opaque_type(value Unit) {
+CAMLprim LLVMTypeRef llvm_opaque_type(value Unit) {
return LLVMOpaqueType();
}