From d226244ae0f5b85d21c9cd23f27f1d7890ea3b4f Mon Sep 17 00:00:00 2001 From: Alan Hu Date: Tue, 11 Oct 2022 16:25:29 -0700 Subject: [llvm-ocaml] Replace all typed pointer functions with opaque pointer functions Reviewed By: aeubanks Differential Revision: https://reviews.llvm.org/D135524 --- llvm/bindings/ocaml/llvm/llvm.ml | 53 +++++--------- llvm/bindings/ocaml/llvm/llvm.mli | 122 +++++++++------------------------ llvm/bindings/ocaml/llvm/llvm_ocaml.c | 125 +++++++--------------------------- 3 files changed, 72 insertions(+), 228 deletions(-) (limited to 'llvm/bindings') diff --git a/llvm/bindings/ocaml/llvm/llvm.ml b/llvm/bindings/ocaml/llvm/llvm.ml index 45ded66..5e44133 100644 --- a/llvm/bindings/ocaml/llvm/llvm.ml +++ b/llvm/bindings/ocaml/llvm/llvm.ml @@ -505,11 +505,9 @@ external is_literal : lltype -> bool = "llvm_is_literal" external subtypes : lltype -> lltype array = "llvm_subtypes" external array_type : lltype -> int -> lltype = "llvm_array_type" -external pointer_type : lltype -> lltype = "llvm_pointer_type" -external qualified_pointer_type : lltype -> int -> lltype +external pointer_type : llcontext -> lltype = "llvm_pointer_type" +external qualified_pointer_type : llcontext -> int -> lltype = "llvm_qualified_pointer_type" -external pointer_type_in_context : llcontext -> int -> lltype - = "llvm_pointer_type_in_context" external vector_type : lltype -> int -> lltype = "llvm_vector_type" external element_type : lltype -> lltype = "LLVMGetElementType" @@ -659,9 +657,8 @@ external const_fcmp : Fcmp.t -> llvalue -> llvalue -> llvalue external const_shl : llvalue -> llvalue -> llvalue = "LLVMConstShl" external const_lshr : llvalue -> llvalue -> llvalue = "LLVMConstLShr" external const_ashr : llvalue -> llvalue -> llvalue = "LLVMConstAShr" -external const_gep : llvalue -> llvalue array -> llvalue = "llvm_const_gep" -external const_gep2 : lltype -> llvalue -> llvalue array -> llvalue - = "llvm_const_gep2" +external const_gep : lltype -> llvalue -> llvalue array -> llvalue + = "llvm_const_gep" external const_in_bounds_gep : llvalue -> llvalue array -> llvalue = "llvm_const_in_bounds_gep" external const_trunc : llvalue -> lltype -> llvalue = "LLVMConstTrunc" @@ -798,12 +795,9 @@ let fold_right_globals f m init = fold_right_global_range f (global_end m) (At_start m) init (*--... Operations on aliases ..............................................--*) -external add_alias : llmodule -> lltype -> llvalue -> string -> llvalue +external add_alias : llmodule -> lltype -> int -> llvalue -> string -> llvalue = "llvm_add_alias" -external add_alias2 : llmodule -> lltype -> int -> llvalue -> string -> llvalue - = "llvm_add_alias2" - (*--... Operations on functions ............................................--*) external declare_function : string -> lltype -> llmodule -> llvalue = "llvm_declare_function" @@ -1212,12 +1206,9 @@ external build_indirect_br : llvalue -> int -> llbuilder -> llvalue = "llvm_build_indirect_br" external add_destination : llvalue -> llbasicblock -> unit = "llvm_add_destination" -external build_invoke : llvalue -> llvalue array -> llbasicblock -> +external build_invoke : lltype -> llvalue -> llvalue array -> llbasicblock -> llbasicblock -> string -> llbuilder -> llvalue = "llvm_build_invoke_bc" "llvm_build_invoke_nat" -external build_invoke2 : lltype -> llvalue -> llvalue array -> llbasicblock -> - llbasicblock -> string -> llbuilder -> llvalue - = "llvm_build_invoke2_bc" "llvm_build_invoke2_nat" external build_landingpad : lltype -> llvalue -> int -> string -> llbuilder -> llvalue = "llvm_build_landingpad" external is_cleanup : llvalue -> bool = "llvm_is_cleanup" @@ -1293,10 +1284,8 @@ external build_alloca : lltype -> string -> llbuilder -> llvalue = "llvm_build_alloca" external build_array_alloca : lltype -> llvalue -> string -> llbuilder -> llvalue = "llvm_build_array_alloca" -external build_load : llvalue -> string -> llbuilder -> llvalue +external build_load : lltype -> llvalue -> string -> llbuilder -> llvalue = "llvm_build_load" -external build_load2 : lltype -> llvalue -> string -> llbuilder -> llvalue - = "llvm_build_load2" external build_store : llvalue -> llvalue -> llbuilder -> llvalue = "llvm_build_store" external build_atomicrmw : AtomicRMWBinOp.t -> llvalue -> llvalue -> @@ -1304,18 +1293,12 @@ external build_atomicrmw : AtomicRMWBinOp.t -> llvalue -> llvalue -> llvalue = "llvm_build_atomicrmw_bytecode" "llvm_build_atomicrmw_native" -external build_gep : llvalue -> llvalue array -> string -> llbuilder -> llvalue - = "llvm_build_gep" -external build_gep2 : lltype -> llvalue -> llvalue array -> string -> llbuilder - -> llvalue = "llvm_build_gep2" -external build_in_bounds_gep : llvalue -> llvalue array -> string -> +external build_gep : lltype -> llvalue -> llvalue array -> string -> llbuilder + -> llvalue = "llvm_build_gep" +external build_in_bounds_gep : lltype -> llvalue -> llvalue array -> string -> llbuilder -> llvalue = "llvm_build_in_bounds_gep" -external build_in_bounds_gep2 : lltype -> llvalue -> llvalue array -> string -> - llbuilder -> llvalue = "llvm_build_in_bounds_gep2" -external build_struct_gep : llvalue -> int -> string -> llbuilder -> llvalue - = "llvm_build_struct_gep" -external build_struct_gep2 : lltype -> llvalue -> int -> string -> llbuilder -> - llvalue = "llvm_build_struct_gep2" +external build_struct_gep : lltype -> llvalue -> int -> string -> llbuilder -> + llvalue = "llvm_build_struct_gep" external build_global_string : string -> string -> llbuilder -> llvalue = "llvm_build_global_string" @@ -1371,10 +1354,8 @@ external build_phi : (llvalue * llbasicblock) list -> string -> llbuilder -> llvalue = "llvm_build_phi" external build_empty_phi : lltype -> string -> llbuilder -> llvalue = "llvm_build_empty_phi" -external build_call : llvalue -> llvalue array -> string -> llbuilder -> llvalue - = "llvm_build_call" -external build_call2 : lltype -> llvalue -> llvalue array -> string -> - llbuilder -> llvalue = "llvm_build_call2" +external build_call : lltype -> llvalue -> llvalue array -> string -> + llbuilder -> llvalue = "llvm_build_call" external build_select : llvalue -> llvalue -> llvalue -> string -> llbuilder -> llvalue = "llvm_build_select" external build_va_arg : llvalue -> lltype -> string -> llbuilder -> llvalue @@ -1394,10 +1375,8 @@ external build_is_null : llvalue -> string -> llbuilder -> llvalue = "llvm_build_is_null" external build_is_not_null : llvalue -> string -> llbuilder -> llvalue = "llvm_build_is_not_null" -external build_ptrdiff : llvalue -> llvalue -> string -> llbuilder -> llvalue - = "llvm_build_ptrdiff" -external build_ptrdiff2 : lltype -> llvalue -> llvalue -> string -> llbuilder -> - llvalue = "llvm_build_ptrdiff2" +external build_ptrdiff : lltype -> llvalue -> llvalue -> string -> llbuilder -> + llvalue = "llvm_build_ptrdiff" external build_freeze : llvalue -> string -> llbuilder -> llvalue = "llvm_build_freeze" diff --git a/llvm/bindings/ocaml/llvm/llvm.mli b/llvm/bindings/ocaml/llvm/llvm.mli index b8b014f..26332a7 100644 --- a/llvm/bindings/ocaml/llvm/llvm.mli +++ b/llvm/bindings/ocaml/llvm/llvm.mli @@ -716,20 +716,15 @@ val subtypes : lltype -> lltype array [ty]. See the method [llvm::ArrayType::get]. *) val array_type : lltype -> int -> lltype -(** [pointer_type ty] returns the pointer type referencing objects of type - [ty] in the default address space (0). +(** [pointer_type context] returns the pointer type in the default + address space (0). See the method [llvm::PointerType::getUnqual]. *) -val pointer_type : lltype -> lltype +val pointer_type : llcontext -> lltype -(** [qualified_pointer_type ty as] returns the pointer type referencing objects - of type [ty] in address space [as]. +(** [qualified_pointer_type context sp] returns the pointer type referencing + objects in address space [sp]. See the method [llvm::PointerType::get]. *) -val qualified_pointer_type : lltype -> int -> lltype - -(** [pointer_type_in_context context as] returns the opaque pointer type - referencing objects in address space [as]. - See the method [llvm::PointerType::get]. *) -val pointer_type_in_context : llcontext -> int -> lltype +val qualified_pointer_type : llcontext -> int -> lltype (** [vector_type ty n] returns the array type containing [n] elements of the primitive type [ty]. See the method [llvm::ArrayType::get]. *) @@ -1168,16 +1163,11 @@ val const_lshr : llvalue -> llvalue -> llvalue See the method [llvm::ConstantExpr::getAShr]. *) val const_ashr : llvalue -> llvalue -> llvalue -(** [const_gep pc indices] returns the constant [getElementPtr] of [pc] with the - constant integers indices from the array [indices]. - See the method [llvm::ConstantExpr::getGetElementPtr]. *) -val const_gep : llvalue -> llvalue array -> llvalue - -(** [const_gep2 srcty pc indices] returns the constant [getElementPtr] of [pc] +(** [const_gep srcty pc indices] returns the constant [getElementPtr] of [pc] with source element type [srcty] and the constant integers indices from the array [indices]. See the method [llvm::ConstantExpr::getGetElementPtr]. *) -val const_gep2 : lltype -> llvalue -> llvalue array -> llvalue +val const_gep : lltype -> llvalue -> llvalue array -> llvalue (** [const_in_bounds_gep pc indices] returns the constant [getElementPtr] of [pc] with the constant integers indices from the array [indices]. @@ -1509,15 +1499,10 @@ val set_externally_initialized : bool -> llvalue -> unit (** {7 Operations on aliases} *) -(** [add_alias m t a n] inserts an alias in the module [m] with the type [t] and - the aliasee [a] with the name [n]. +(** [add_alias m vt sp a n] inserts an alias in the module [m] with the value + type [vt] the address space [sp] the aliasee [a] with the name [n]. See the constructor for [llvm::GlobalAlias]. *) -val add_alias : llmodule -> lltype -> llvalue -> string -> llvalue - -(** [add_alias m vt as a n] inserts an alias in the module [m] with the value - type [vt] the address space [as] the aliasee [a] with the name [n]. - See the constructor for [llvm::GlobalAlias]. *) -val add_alias2 : llmodule -> lltype -> int -> llvalue -> string -> llvalue +val add_alias : llmodule -> lltype -> int -> llvalue -> string -> llvalue (** {7 Operations on functions} *) @@ -2097,19 +2082,12 @@ val build_indirect_br : llvalue -> int -> llbuilder -> llvalue See the method [llvm::IndirectBrInst::addDestination]. **) val add_destination : llvalue -> llbasicblock -> unit -(** [build_invoke fn args tobb unwindbb name b] creates an +(** [build_invoke fnty fn args tobb unwindbb name b] creates an [%name = invoke %fn(args) to %tobb unwind %unwindbb] instruction at the position specified by the instruction builder [b]. See the method [llvm::LLVMBuilder::CreateInvoke]. *) -val build_invoke : llvalue -> llvalue array -> llbasicblock -> - llbasicblock -> string -> llbuilder -> llvalue - -(** [build_invoke2 fnty fn args tobb unwindbb name b] creates an - [%name = invoke %fn(args) to %tobb unwind %unwindbb] - instruction at the position specified by the instruction builder [b]. - See the method [llvm::LLVMBuilder::CreateInvoke]. *) -val build_invoke2 : lltype -> llvalue -> llvalue array -> llbasicblock -> - llbasicblock -> string -> llbuilder -> llvalue +val build_invoke : lltype -> llvalue -> llvalue array -> llbasicblock -> + llbasicblock -> string -> llbuilder -> llvalue (** [build_landingpad ty persfn numclauses name b] creates an [landingpad] @@ -2345,17 +2323,11 @@ val build_alloca : lltype -> string -> llbuilder -> llvalue val build_array_alloca : lltype -> llvalue -> string -> llbuilder -> llvalue -(** [build_load v name b] creates a - [%name = load %v] - instruction at the position specified by the instruction builder [b]. - See the method [llvm::LLVMBuilder::CreateLoad]. *) -val build_load : llvalue -> string -> llbuilder -> llvalue - -(** [build_load2 ty v name b] creates a +(** [build_load ty v name b] creates a [%name = load %ty, %v] instruction at the position specified by the instruction builder [b]. See the method [llvm::LLVMBuilder::CreateLoad]. *) -val build_load2 : lltype -> llvalue -> string -> llbuilder -> llvalue +val build_load : lltype -> llvalue -> string -> llbuilder -> llvalue (** [build_store v p b] creates a [store %v, %p] @@ -2371,46 +2343,26 @@ val build_store : llvalue -> llvalue -> llbuilder -> llvalue val build_atomicrmw : AtomicRMWBinOp.t -> llvalue -> llvalue -> AtomicOrdering.t -> bool -> string -> llbuilder -> llvalue -(** [build_gep p indices name b] creates a - [%name = getelementptr %p, indices...] - instruction at the position specified by the instruction builder [b]. - See the method [llvm::LLVMBuilder::CreateGetElementPtr]. *) -val build_gep : llvalue -> llvalue array -> string -> llbuilder -> llvalue - -(** [build_gep2 srcty p indices name b] creates a +(** [build_gep srcty p indices name b] creates a [%name = getelementptr srcty, %p, indices...] instruction at the position specified by the instruction builder [b]. See the method [llvm::LLVMBuilder::CreateGetElementPtr]. *) -val build_gep2 : lltype -> llvalue -> llvalue array -> string -> llbuilder -> - llvalue +val build_gep : lltype -> llvalue -> llvalue array -> string -> llbuilder -> + llvalue -(** [build_in_bounds_gep p indices name b] creates a - [%name = gelementptr inbounds %p, indices...] - instruction at the position specified by the instruction builder [b]. - See the method [llvm::LLVMBuilder::CreateInBoundsGetElementPtr]. *) -val build_in_bounds_gep : llvalue -> llvalue array -> string -> llbuilder -> - llvalue - -(** [build_in_bounds_gep2 srcty p indices name b] creates a +(** [build_in_bounds_gep srcty p indices name b] creates a [%name = gelementptr inbounds srcty, %p, indices...] instruction at the position specified by the instruction builder [b]. See the method [llvm::LLVMBuilder::CreateInBoundsGetElementPtr]. *) -val build_in_bounds_gep2 : lltype -> llvalue -> llvalue array -> string -> - llbuilder -> llvalue - -(** [build_struct_gep p idx name b] creates a - [%name = getelementptr %p, 0, idx] - instruction at the position specified by the instruction builder [b]. - See the method [llvm::LLVMBuilder::CreateStructGetElementPtr]. *) -val build_struct_gep : llvalue -> int -> string -> llbuilder -> - llvalue +val build_in_bounds_gep : lltype -> llvalue -> llvalue array -> string -> + llbuilder -> llvalue -(** [build_struct_gep2 srcty p idx name b] creates a +(** [build_struct_gep srcty p idx name b] creates a [%name = getelementptr srcty, %p, 0, idx] instruction at the position specified by the instruction builder [b]. See the method [llvm::LLVMBuilder::CreateStructGetElementPtr]. *) -val build_struct_gep2 : lltype -> llvalue -> int -> string -> llbuilder -> - llvalue +val build_struct_gep : lltype -> llvalue -> int -> string -> llbuilder -> + llvalue (** [build_global_string str name b] creates a series of instructions that adds a global string at the position specified by the instruction builder [b]. @@ -2565,18 +2517,12 @@ val build_phi : (llvalue * llbasicblock) list -> string -> llbuilder -> See the method [llvm::LLVMBuilder::CreatePHI]. *) val build_empty_phi : lltype -> string -> llbuilder -> llvalue -(** [build_call fn args name b] creates a - [%name = call %fn(args...)] - instruction at the position specified by the instruction builder [b]. - See the method [llvm::LLVMBuilder::CreateCall]. *) -val build_call : llvalue -> llvalue array -> string -> llbuilder -> llvalue - -(** [build_call2 fnty fn args name b] creates a +(** [build_call fnty fn args name b] creates a [%name = call %fn(args...)] instruction at the position specified by the instruction builder [b]. See the method [llvm::LLVMBuilder::CreateCall]. *) -val build_call2 : lltype -> llvalue -> llvalue array -> string -> llbuilder -> - llvalue +val build_call : lltype -> llvalue -> llvalue array -> string -> llbuilder -> + llvalue (** [build_select cond thenv elsev name b] creates a [%name = select %cond, %thenv, %elsev] @@ -2638,18 +2584,12 @@ val build_is_null : llvalue -> string -> llbuilder -> llvalue See the method [llvm::LLVMBuilder::CreateIsNotNull]. *) val build_is_not_null : llvalue -> string -> llbuilder -> llvalue -(** [build_ptrdiff lhs rhs name b] creates a series of instructions that measure - the difference between two pointer values at the position specified by the - instruction builder [b]. - See the method [llvm::LLVMBuilder::CreatePtrDiff]. *) -val build_ptrdiff : llvalue -> llvalue -> string -> llbuilder -> llvalue - -(** [build_ptrdiff2 elemty lhs rhs name b] creates a series of instructions +(** [build_ptrdiff elemty lhs rhs name b] creates a series of instructions that measure the difference between two pointer values in multiples of [elemty] at the position specified by the instruction builder [b]. See the method [llvm::LLVMBuilder::CreatePtrDiff]. *) -val build_ptrdiff2 : lltype -> llvalue -> llvalue -> string -> llbuilder -> - llvalue +val build_ptrdiff : lltype -> llvalue -> llvalue -> string -> llbuilder -> + llvalue (** [build_freeze x name b] creates a [%name = freeze %x] diff --git a/llvm/bindings/ocaml/llvm/llvm_ocaml.c b/llvm/bindings/ocaml/llvm/llvm_ocaml.c index 7f30662..d6346ae 100644 --- a/llvm/bindings/ocaml/llvm/llvm_ocaml.c +++ b/llvm/bindings/ocaml/llvm/llvm_ocaml.c @@ -570,19 +570,13 @@ LLVMTypeRef llvm_array_type(LLVMTypeRef ElementTy, value Count) { return LLVMArrayType(ElementTy, Int_val(Count)); } -/* lltype -> lltype */ -LLVMTypeRef llvm_pointer_type(LLVMTypeRef ElementTy) { - return LLVMPointerType(ElementTy, 0); -} - -/* lltype -> int -> lltype */ -LLVMTypeRef llvm_qualified_pointer_type(LLVMTypeRef ElementTy, - value AddressSpace) { - return LLVMPointerType(ElementTy, Int_val(AddressSpace)); +/* llcontext -> lltype */ +LLVMTypeRef llvm_pointer_type(LLVMContextRef C, value AddressSpace) { + return LLVMPointerTypeInContext(C, 0); } /* llcontext -> int -> lltype */ -LLVMTypeRef llvm_pointer_type_in_context(LLVMContextRef C, value AddressSpace) { +LLVMTypeRef llvm_qualified_pointer_type(LLVMContextRef C, value AddressSpace) { return LLVMPointerTypeInContext(C, Int_val(AddressSpace)); } @@ -993,14 +987,8 @@ LLVMValueRef llvm_const_fcmp(value Pred, LLVMValueRef LHSConstant, return LLVMConstFCmp(Int_val(Pred), LHSConstant, RHSConstant); } -/* llvalue -> llvalue array -> llvalue */ -LLVMValueRef llvm_const_gep(LLVMValueRef ConstantVal, value Indices) { - return LLVMConstGEP(ConstantVal, (LLVMValueRef *)Op_val(Indices), - Wosize_val(Indices)); -} - /* lltype -> llvalue -> llvalue array -> llvalue */ -LLVMValueRef llvm_const_gep2(LLVMTypeRef Ty, LLVMValueRef ConstantVal, +LLVMValueRef llvm_const_gep(LLVMTypeRef Ty, LLVMValueRef ConstantVal, value Indices) { return LLVMConstGEP2(Ty, ConstantVal, (LLVMValueRef *)Op_val(Indices), Wosize_val(Indices)); @@ -1257,12 +1245,7 @@ value llvm_set_global_constant(value Flag, LLVMValueRef GlobalVar) { /*--... Operations on aliases ..............................................--*/ -LLVMValueRef llvm_add_alias(LLVMModuleRef M, LLVMTypeRef Ty, - LLVMValueRef Aliasee, value Name) { - return LLVMAddAlias(M, Ty, Aliasee, String_val(Name)); -} - -LLVMValueRef llvm_add_alias2(LLVMModuleRef M, LLVMTypeRef ValueTy, +LLVMValueRef llvm_add_alias(LLVMModuleRef M, LLVMTypeRef ValueTy, value AddrSpace, LLVMValueRef Aliasee, value Name) { return LLVMAddAlias2(M, ValueTy, Int_val(AddrSpace), Aliasee, String_val(Name)); @@ -1764,30 +1747,12 @@ value llvm_add_destination(LLVMValueRef IndirectBr, LLVMBasicBlockRef Dest) { return Val_unit; } -/* llvalue -> llvalue array -> llbasicblock -> llbasicblock -> string -> - llbuilder -> llvalue */ -LLVMValueRef llvm_build_invoke_nat(LLVMValueRef Fn, value Args, - LLVMBasicBlockRef Then, - LLVMBasicBlockRef Catch, value Name, - value B) { - return LLVMBuildInvoke(Builder_val(B), Fn, (LLVMValueRef *)Op_val(Args), - Wosize_val(Args), Then, Catch, String_val(Name)); -} - -/* llvalue -> llvalue array -> llbasicblock -> llbasicblock -> string -> - llbuilder -> llvalue */ -LLVMValueRef llvm_build_invoke_bc(value Args[], int NumArgs) { - return llvm_build_invoke_nat((LLVMValueRef)Args[0], Args[1], - (LLVMBasicBlockRef)Args[2], - (LLVMBasicBlockRef)Args[3], Args[4], Args[5]); -} - /* lltype -> llvalue -> llvalue array -> llbasicblock -> llbasicblock -> string -> llbuilder -> llvalue */ -LLVMValueRef llvm_build_invoke2_nat(LLVMTypeRef FnTy, LLVMValueRef Fn, - value Args, LLVMBasicBlockRef Then, - LLVMBasicBlockRef Catch, value Name, - value B) { +LLVMValueRef llvm_build_invoke_nat(LLVMTypeRef FnTy, LLVMValueRef Fn, + value Args, LLVMBasicBlockRef Then, + LLVMBasicBlockRef Catch, value Name, + value B) { return LLVMBuildInvoke2(Builder_val(B), FnTy, Fn, (LLVMValueRef *)Op_val(Args), Wosize_val(Args), Then, Catch, String_val(Name)); @@ -1795,9 +1760,9 @@ LLVMValueRef llvm_build_invoke2_nat(LLVMTypeRef FnTy, LLVMValueRef Fn, /* lltype -> llvalue -> llvalue array -> llbasicblock -> llbasicblock -> string -> llbuilder -> llvalue */ -LLVMValueRef llvm_build_invoke2_bc(value Args[], int NumArgs) { - return llvm_build_invoke2_nat((LLVMTypeRef)Args[0], (LLVMValueRef)Args[1], - Args[2], (LLVMBasicBlockRef)Args[3], +LLVMValueRef llvm_build_invoke_bc(value Args[], int NumArgs) { + return llvm_build_invoke_nat((LLVMTypeRef)Args[0], (LLVMValueRef)Args[1], + Args[2], (LLVMBasicBlockRef)Args[3], (LLVMBasicBlockRef)Args[4], Args[5], Args[6]); } @@ -2025,14 +1990,9 @@ LLVMValueRef llvm_build_array_alloca(LLVMTypeRef Ty, LLVMValueRef Size, return LLVMBuildArrayAlloca(Builder_val(B), Ty, Size, String_val(Name)); } -/* llvalue -> string -> llbuilder -> llvalue */ -LLVMValueRef llvm_build_load(LLVMValueRef Pointer, value Name, value B) { - return LLVMBuildLoad(Builder_val(B), Pointer, String_val(Name)); -} - /* lltype -> llvalue -> string -> llbuilder -> llvalue */ -LLVMValueRef llvm_build_load2(LLVMTypeRef Ty, LLVMValueRef Pointer, value Name, - value B) { +LLVMValueRef llvm_build_load(LLVMTypeRef Ty, LLVMValueRef Pointer, value Name, + value B) { return LLVMBuildLoad2(Builder_val(B), Ty, Pointer, String_val(Name)); } @@ -2060,47 +2020,25 @@ LLVMValueRef llvm_build_atomicrmw_bytecode(value *argv, int argn) { argv[5], argv[6]); } -/* llvalue -> llvalue array -> string -> llbuilder -> llvalue */ -LLVMValueRef llvm_build_gep(LLVMValueRef Pointer, value Indices, value Name, - value B) { - return LLVMBuildGEP(Builder_val(B), Pointer, (LLVMValueRef *)Op_val(Indices), - Wosize_val(Indices), String_val(Name)); -} - /* lltype -> llvalue -> llvalue array -> string -> llbuilder -> llvalue */ -LLVMValueRef llvm_build_gep2(LLVMTypeRef Ty, LLVMValueRef Pointer, - value Indices, value Name, value B) { +LLVMValueRef llvm_build_gep(LLVMTypeRef Ty, LLVMValueRef Pointer, value Indices, + value Name, value B) { return LLVMBuildGEP2(Builder_val(B), Ty, Pointer, (LLVMValueRef *)Op_val(Indices), Wosize_val(Indices), String_val(Name)); } -/* llvalue -> llvalue array -> string -> llbuilder -> llvalue */ -LLVMValueRef llvm_build_in_bounds_gep(LLVMValueRef Pointer, value Indices, - value Name, value B) { - return LLVMBuildInBoundsGEP(Builder_val(B), Pointer, - (LLVMValueRef *)Op_val(Indices), - Wosize_val(Indices), String_val(Name)); -} - /* lltype -> llvalue -> llvalue array -> string -> llbuilder -> llvalue */ -LLVMValueRef llvm_build_in_bounds_gep2(LLVMTypeRef Ty, LLVMValueRef Pointer, - value Indices, value Name, value B) { +LLVMValueRef llvm_build_in_bounds_gep(LLVMTypeRef Ty, LLVMValueRef Pointer, + value Indices, value Name, value B) { return LLVMBuildInBoundsGEP2(Builder_val(B), Ty, Pointer, (LLVMValueRef *)Op_val(Indices), Wosize_val(Indices), String_val(Name)); } -/* llvalue -> int -> string -> llbuilder -> llvalue */ -LLVMValueRef llvm_build_struct_gep(LLVMValueRef Pointer, value Index, - value Name, value B) { - return LLVMBuildStructGEP(Builder_val(B), Pointer, Int_val(Index), - String_val(Name)); -} - /* lltype -> llvalue -> int -> string -> llbuilder -> llvalue */ -LLVMValueRef llvm_build_struct_gep2(LLVMTypeRef Ty, LLVMValueRef Pointer, - value Index, value Name, value B) { +LLVMValueRef llvm_build_struct_gep(LLVMTypeRef Ty, LLVMValueRef Pointer, + value Index, value Name, value B) { return LLVMBuildStructGEP2(Builder_val(B), Ty, Pointer, Int_val(Index), String_val(Name)); } @@ -2271,16 +2209,9 @@ LLVMValueRef llvm_build_empty_phi(LLVMTypeRef Type, value Name, value B) { return LLVMBuildPhi(Builder_val(B), Type, String_val(Name)); } -/* llvalue -> llvalue array -> string -> llbuilder -> llvalue */ -LLVMValueRef llvm_build_call(LLVMValueRef Fn, value Params, value Name, - value B) { - return LLVMBuildCall(Builder_val(B), Fn, (LLVMValueRef *)Op_val(Params), - Wosize_val(Params), String_val(Name)); -} - /* lltype -> llvalue -> llvalue array -> string -> llbuilder -> llvalue */ -LLVMValueRef llvm_build_call2(LLVMTypeRef FnTy, LLVMValueRef Fn, value Params, - value Name, value B) { +LLVMValueRef llvm_build_call(LLVMTypeRef FnTy, LLVMValueRef Fn, value Params, + value Name, value B) { return LLVMBuildCall2(Builder_val(B), FnTy, Fn, (LLVMValueRef *)Op_val(Params), Wosize_val(Params), String_val(Name)); @@ -2342,14 +2273,8 @@ LLVMValueRef llvm_build_is_not_null(LLVMValueRef Val, value Name, value B) { } /* llvalue -> llvalue -> string -> llbuilder -> llvalue */ -LLVMValueRef llvm_build_ptrdiff(LLVMValueRef LHS, LLVMValueRef RHS, value Name, - value B) { - return LLVMBuildPtrDiff(Builder_val(B), LHS, RHS, String_val(Name)); -} - -/* llvalue -> llvalue -> string -> llbuilder -> llvalue */ -LLVMValueRef llvm_build_ptrdiff2(LLVMTypeRef ElemTy, LLVMValueRef LHS, - LLVMValueRef RHS, value Name, value B) { +LLVMValueRef llvm_build_ptrdiff(LLVMTypeRef ElemTy, LLVMValueRef LHS, + LLVMValueRef RHS, value Name, value B) { return LLVMBuildPtrDiff2(Builder_val(B), ElemTy, LHS, RHS, String_val(Name)); } -- cgit v1.1