Author: gordon Date: Sat Dec 29 14:45:00 2007 New Revision: 45422 URL: http://llvm.org/viewvc/llvm-project?rev=45422&view=rev Log: Bindings for instruction calling conventions.
Modified: llvm/trunk/bindings/ocaml/llvm/llvm.ml llvm/trunk/bindings/ocaml/llvm/llvm.mli llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c llvm/trunk/include/llvm-c/Core.h llvm/trunk/test/Bindings/Ocaml/vmcore.ml Modified: llvm/trunk/bindings/ocaml/llvm/llvm.ml URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/llvm/llvm.ml?rev=45422&r1=45421&r2=45422&view=diff ============================================================================== --- llvm/trunk/bindings/ocaml/llvm/llvm.ml (original) +++ llvm/trunk/bindings/ocaml/llvm/llvm.ml Sat Dec 29 14:45:00 2007 @@ -328,6 +328,12 @@ external value_is_block : llvalue -> bool = "llvm_value_is_block" external block_of_value : llvalue -> llbasicblock = "LLVMValueAsBasicBlock" +(*--... Operations on call sites ...........................................--*) +external instruction_call_conv: llvalue -> int + = "llvm_instruction_call_conv" +external set_instruction_call_conv: int -> llvalue -> unit + = "llvm_set_instruction_call_conv" + (*--... Operations on phi nodes ............................................--*) external add_incoming : (llvalue * llbasicblock) -> llvalue -> unit = "llvm_add_incoming" Modified: llvm/trunk/bindings/ocaml/llvm/llvm.mli URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/llvm/llvm.mli?rev=45422&r1=45421&r2=45422&view=diff ============================================================================== --- llvm/trunk/bindings/ocaml/llvm/llvm.mli (original) +++ llvm/trunk/bindings/ocaml/llvm/llvm.mli Sat Dec 29 14:45:00 2007 @@ -854,6 +854,20 @@ (** [block_of_value v] losslessly casts [v] to an [llbasicblock]. **) external block_of_value : llvalue -> llbasicblock = "LLVMValueAsBasicBlock" +(*--... Operations on call sites ...........................................--*) + +(** [inst_call_conv ci] is the calling convention for the call or invoke + instruction [ci], which may be one of the values from the module [CallConv]. + See the method [CallSite:: **) +external instruction_call_conv: llvalue -> int + = "llvm_instruction_call_conv" + +(** [set_inst_call_conv cc ci] sets the calling convention for the call or + invoke instruction [ci] to the integer [cc], which can be one of the values + from the module [CallConv]. See the method [CallSite::]. **) +external set_instruction_call_conv: int -> llvalue -> unit + = "llvm_set_instruction_call_conv" + (*--... Operations on phi nodes ............................................--*) (** [add_incoming (v, bb) pn] adds the value [v] to the phi node [pn] for use Modified: llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c?rev=45422&r1=45421&r2=45422&view=diff ============================================================================== --- llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c (original) +++ llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c Sat Dec 29 14:45:00 2007 @@ -652,6 +652,19 @@ return Val_bool(LLVMValueIsBasicBlock(Val)); } +/*--... Operations on call sites ...........................................--*/ + +/* llvalue -> int */ +CAMLprim value llvm_instruction_call_conv(LLVMValueRef Inst) { + return Val_int(LLVMGetInstructionCallConv(Inst)); +} + +/* int -> llvalue -> unit */ +CAMLprim value llvm_set_instruction_call_conv(value CC, LLVMValueRef Inst) { + LLVMSetInstructionCallConv(Inst, Int_val(CC)); + return Val_unit; +} + /*--... Operations on phi nodes ............................................--*/ /* (llvalue * llbasicblock) -> llvalue -> unit */ Modified: llvm/trunk/include/llvm-c/Core.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm-c/Core.h?rev=45422&r1=45421&r2=45422&view=diff ============================================================================== --- llvm/trunk/include/llvm-c/Core.h (original) +++ llvm/trunk/include/llvm-c/Core.h Sat Dec 29 14:45:00 2007 @@ -378,6 +378,10 @@ const char *Name); void LLVMDeleteBasicBlock(LLVMBasicBlockRef BB); +/* Operations on call sites */ +void LLVMSetInstructionCallConv(LLVMValueRef Instr, unsigned CC); +unsigned LLVMGetInstructionCallConv(LLVMValueRef Instr); + /* Operations on phi nodes */ void LLVMAddIncoming(LLVMValueRef PhiNode, LLVMValueRef *IncomingValues, LLVMBasicBlockRef *IncomingBlocks, unsigned Count); Modified: llvm/trunk/test/Bindings/Ocaml/vmcore.ml URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Bindings/Ocaml/vmcore.ml?rev=45422&r1=45421&r2=45422&view=diff ============================================================================== --- llvm/trunk/test/Bindings/Ocaml/vmcore.ml (original) +++ llvm/trunk/test/Bindings/Ocaml/vmcore.ml Sat Dec 29 14:45:00 2007 @@ -768,14 +768,19 @@ end; group "miscellaneous"; begin - (* RUN: grep {Inst45.*call.*P2.*P1} < %t.ll + (* RUN: grep {CallInst.*call.*P2.*P1} < %t.ll + * RUN: grep {CallInst.*cc63} < %t.ll * RUN: grep {Inst47.*select.*Inst46.*P1.*P2} < %t.ll * RUN: grep {Inst48.*va_arg.*null.*i32} < %t.ll * RUN: grep {Inst49.*extractelement.*Vec1.*P2} < %t.ll * RUN: grep {Inst50.*insertelement.*Vec1.*P1.*P2} < %t.ll * RUN: grep {Inst51.*shufflevector.*Vec1.*Vec2.*1.*1.*0.*0} < %t.ll *) - ignore (build_call fn [| p2; p1 |] "Inst45" atentry); + let ci = build_call fn [| p2; p1 |] "CallInst" atentry in + insist (CallConv.c = instruction_call_conv ci); + set_instruction_call_conv 63 ci; + insist (63 = instruction_call_conv ci); + let inst46 = build_icmp Icmp.Eq p1 p2 "Inst46" atentry in ignore (build_select inst46 p1 p2 "Inst47" atentry); ignore (build_va_arg _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits