llvm.org GIT mirror llvm / 4917ec9
add binding to read icmp predicate git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141287 91177308-0d34-0410-b5e6-96231b3b80d8 Torok Edwin 7 years ago
5 changed file(s) with 27 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
704704 external instr_pred : llvalue -> (llbasicblock, llvalue) llrev_pos
705705 = "llvm_instr_pred"
706706
707 external icmp_predicate : llvalue -> Icmp.t option = "llvm_instr_icmp_predicate"
708
707709 let rec iter_instrs_range f i e =
708710 if i = e then () else
709711 match i with
14341434 val fold_right_instrs: (llvalue -> 'a -> 'a) -> llbasicblock -> 'a -> 'a
14351435
14361436
1437 val icmp_predicate : llvalue -> Icmp.t option
1438
14371439 (** {7 Operations on call sites} *)
14381440
14391441 (** [instruction_call_conv ci] is the calling convention for the call or invoke
10091009 LLVMGetInstructionParent)
10101010
10111011
1012 /* llvalue -> ICmp.t */
1013 CAMLprim value llvm_instr_icmp_predicate(LLVMValueRef Val) {
1014 CAMLparam0();
1015 int x = LLVMGetICmpPredicate(Val);
1016 if (x) {
1017 value Option = alloc(1, 0);
1018 Field(Option, 0) = Val_int(x - LLVMIntEQ);
1019 CAMLreturn(Option);
1020 }
1021 CAMLreturn(Val_int(0));
1022 }
1023
1024
10121025 /*--... Operations on call sites ...........................................--*/
10131026
10141027 /* llvalue -> int */
782782 LLVMValueRef LLVMGetNextInstruction(LLVMValueRef Inst);
783783 LLVMValueRef LLVMGetPreviousInstruction(LLVMValueRef Inst);
784784 void LLVMInstructionEraseFromParent(LLVMValueRef Inst);
785 LLVMIntPredicate LLVMGetICmpPredicate(LLVMValueRef Inst);
785786
786787 /* Operations on call sites */
787788 void LLVMSetInstructionCallConv(LLVMValueRef Instr, unsigned CC);
15511551 unwrap(Inst)->eraseFromParent();
15521552 }
15531553
1554 LLVMIntPredicate LLVMGetICmpPredicate(LLVMValueRef Inst) {
1555 if (ICmpInst *I = dyn_cast(unwrap(Inst)))
1556 return (LLVMIntPredicate)I->getPredicate();
1557 if (ConstantExpr *CE = dyn_cast(unwrap(Inst)))
1558 if (CE->getOpcode() == Instruction::ICmp)
1559 return (LLVMIntPredicate)CE->getPredicate();
1560 return (LLVMIntPredicate)0;
1561 }
1562
15541563 /*--.. Call and invoke instructions ........................................--*/
15551564
15561565 unsigned LLVMGetInstructionCallConv(LLVMValueRef Instr) {