llvm.org GIT mirror llvm / cc0928f
Bindings for instruction calling conventions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45422 91177308-0d34-0410-b5e6-96231b3b80d8 Gordon Henriksen 11 years ago
5 changed file(s) with 44 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
327327 external value_is_block : llvalue -> bool = "llvm_value_is_block"
328328 external block_of_value : llvalue -> llbasicblock = "LLVMValueAsBasicBlock"
329329
330 (*--... Operations on call sites ...........................................--*)
331 external instruction_call_conv: llvalue -> int
332 = "llvm_instruction_call_conv"
333 external set_instruction_call_conv: int -> llvalue -> unit
334 = "llvm_set_instruction_call_conv"
335
330336 (*--... Operations on phi nodes ............................................--*)
331337 external add_incoming : (llvalue * llbasicblock) -> llvalue -> unit
332338 = "llvm_add_incoming"
853853 (** [block_of_value v] losslessly casts [v] to an [llbasicblock]. **)
854854 external block_of_value : llvalue -> llbasicblock = "LLVMValueAsBasicBlock"
855855
856 (*--... Operations on call sites ...........................................--*)
857
858 (** [inst_call_conv ci] is the calling convention for the call or invoke
859 instruction [ci], which may be one of the values from the module [CallConv].
860 See the method [CallSite:: **)
861 external instruction_call_conv: llvalue -> int
862 = "llvm_instruction_call_conv"
863
864 (** [set_inst_call_conv cc ci] sets the calling convention for the call or
865 invoke instruction [ci] to the integer [cc], which can be one of the values
866 from the module [CallConv]. See the method [CallSite::]. **)
867 external set_instruction_call_conv: int -> llvalue -> unit
868 = "llvm_set_instruction_call_conv"
869
856870 (*--... Operations on phi nodes ............................................--*)
857871
858872 (** [add_incoming (v, bb) pn] adds the value [v] to the phi node [pn] for use
649649 /* llvalue -> bool */
650650 CAMLprim value llvm_value_is_block(LLVMValueRef Val) {
651651 return Val_bool(LLVMValueIsBasicBlock(Val));
652 }
653
654 /*--... Operations on call sites ...........................................--*/
655
656 /* llvalue -> int */
657 CAMLprim value llvm_instruction_call_conv(LLVMValueRef Inst) {
658 return Val_int(LLVMGetInstructionCallConv(Inst));
659 }
660
661 /* int -> llvalue -> unit */
662 CAMLprim value llvm_set_instruction_call_conv(value CC, LLVMValueRef Inst) {
663 LLVMSetInstructionCallConv(Inst, Int_val(CC));
664 return Val_unit;
652665 }
653666
654667 /*--... Operations on phi nodes ............................................--*/
377377 const char *Name);
378378 void LLVMDeleteBasicBlock(LLVMBasicBlockRef BB);
379379
380 /* Operations on call sites */
381 void LLVMSetInstructionCallConv(LLVMValueRef Instr, unsigned CC);
382 unsigned LLVMGetInstructionCallConv(LLVMValueRef Instr);
383
380384 /* Operations on phi nodes */
381385 void LLVMAddIncoming(LLVMValueRef PhiNode, LLVMValueRef *IncomingValues,
382386 LLVMBasicBlockRef *IncomingBlocks, unsigned Count);
767767 end;
768768
769769 group "miscellaneous"; begin
770 (* RUN: grep {Inst45.*call.*P2.*P1} < %t.ll
770 (* RUN: grep {CallInst.*call.*P2.*P1} < %t.ll
771 * RUN: grep {CallInst.*cc63} < %t.ll
771772 * RUN: grep {Inst47.*select.*Inst46.*P1.*P2} < %t.ll
772773 * RUN: grep {Inst48.*va_arg.*null.*i32} < %t.ll
773774 * RUN: grep {Inst49.*extractelement.*Vec1.*P2} < %t.ll
774775 * RUN: grep {Inst50.*insertelement.*Vec1.*P1.*P2} < %t.ll
775776 * RUN: grep {Inst51.*shufflevector.*Vec1.*Vec2.*1.*1.*0.*0} < %t.ll
776777 *)
777 ignore (build_call fn [| p2; p1 |] "Inst45" atentry);
778 let ci = build_call fn [| p2; p1 |] "CallInst" atentry in
779 insist (CallConv.c = instruction_call_conv ci);
780 set_instruction_call_conv 63 ci;
781 insist (63 = instruction_call_conv ci);
782
778783 let inst46 = build_icmp Icmp.Eq p1 p2 "Inst46" atentry in
779784 ignore (build_select inst46 p1 p2 "Inst47" atentry);
780785 ignore (build_va_arg