forked from OSchip/llvm-project
parent
fec812e1f1
commit
60c40de81b
|
@ -705,6 +705,8 @@ external instr_end : llbasicblock -> (llbasicblock, llvalue) llrev_pos
|
||||||
external instr_pred : llvalue -> (llbasicblock, llvalue) llrev_pos
|
external instr_pred : llvalue -> (llbasicblock, llvalue) llrev_pos
|
||||||
= "llvm_instr_pred"
|
= "llvm_instr_pred"
|
||||||
|
|
||||||
|
external icmp_predicate : llvalue -> Icmp.t option = "llvm_instr_icmp_predicate"
|
||||||
|
|
||||||
let rec iter_instrs_range f i e =
|
let rec iter_instrs_range f i e =
|
||||||
if i = e then () else
|
if i = e then () else
|
||||||
match i with
|
match i with
|
||||||
|
|
|
@ -1435,6 +1435,8 @@ val instr_pred : llvalue -> (llbasicblock, llvalue) llrev_pos
|
||||||
val fold_right_instrs: (llvalue -> 'a -> 'a) -> llbasicblock -> 'a -> 'a
|
val fold_right_instrs: (llvalue -> 'a -> 'a) -> llbasicblock -> 'a -> 'a
|
||||||
|
|
||||||
|
|
||||||
|
val icmp_predicate : llvalue -> Icmp.t option
|
||||||
|
|
||||||
(** {7 Operations on call sites} *)
|
(** {7 Operations on call sites} *)
|
||||||
|
|
||||||
(** [instruction_call_conv ci] is the calling convention for the call or invoke
|
(** [instruction_call_conv ci] is the calling convention for the call or invoke
|
||||||
|
|
|
@ -1010,6 +1010,19 @@ DEFINE_ITERATORS(instr, Instruction, LLVMBasicBlockRef, LLVMValueRef,
|
||||||
LLVMGetInstructionParent)
|
LLVMGetInstructionParent)
|
||||||
|
|
||||||
|
|
||||||
|
/* llvalue -> ICmp.t */
|
||||||
|
CAMLprim value llvm_instr_icmp_predicate(LLVMValueRef Val) {
|
||||||
|
CAMLparam0();
|
||||||
|
int x = LLVMGetICmpPredicate(Val);
|
||||||
|
if (x) {
|
||||||
|
value Option = alloc(1, 0);
|
||||||
|
Field(Option, 0) = Val_int(x - LLVMIntEQ);
|
||||||
|
CAMLreturn(Option);
|
||||||
|
}
|
||||||
|
CAMLreturn(Val_int(0));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*--... Operations on call sites ...........................................--*/
|
/*--... Operations on call sites ...........................................--*/
|
||||||
|
|
||||||
/* llvalue -> int */
|
/* llvalue -> int */
|
||||||
|
|
|
@ -783,6 +783,7 @@ LLVMBasicBlockRef LLVMGetInstructionParent(LLVMValueRef Inst);
|
||||||
LLVMValueRef LLVMGetNextInstruction(LLVMValueRef Inst);
|
LLVMValueRef LLVMGetNextInstruction(LLVMValueRef Inst);
|
||||||
LLVMValueRef LLVMGetPreviousInstruction(LLVMValueRef Inst);
|
LLVMValueRef LLVMGetPreviousInstruction(LLVMValueRef Inst);
|
||||||
void LLVMInstructionEraseFromParent(LLVMValueRef Inst);
|
void LLVMInstructionEraseFromParent(LLVMValueRef Inst);
|
||||||
|
LLVMIntPredicate LLVMGetICmpPredicate(LLVMValueRef Inst);
|
||||||
|
|
||||||
/* Operations on call sites */
|
/* Operations on call sites */
|
||||||
void LLVMSetInstructionCallConv(LLVMValueRef Instr, unsigned CC);
|
void LLVMSetInstructionCallConv(LLVMValueRef Instr, unsigned CC);
|
||||||
|
|
|
@ -1552,6 +1552,15 @@ void LLVMInstructionEraseFromParent(LLVMValueRef Inst) {
|
||||||
unwrap<Instruction>(Inst)->eraseFromParent();
|
unwrap<Instruction>(Inst)->eraseFromParent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LLVMIntPredicate LLVMGetICmpPredicate(LLVMValueRef Inst) {
|
||||||
|
if (ICmpInst *I = dyn_cast<ICmpInst>(unwrap(Inst)))
|
||||||
|
return (LLVMIntPredicate)I->getPredicate();
|
||||||
|
if (ConstantExpr *CE = dyn_cast<ConstantExpr>(unwrap(Inst)))
|
||||||
|
if (CE->getOpcode() == Instruction::ICmp)
|
||||||
|
return (LLVMIntPredicate)CE->getPredicate();
|
||||||
|
return (LLVMIntPredicate)0;
|
||||||
|
}
|
||||||
|
|
||||||
/*--.. Call and invoke instructions ........................................--*/
|
/*--.. Call and invoke instructions ........................................--*/
|
||||||
|
|
||||||
unsigned LLVMGetInstructionCallConv(LLVMValueRef Instr) {
|
unsigned LLVMGetInstructionCallConv(LLVMValueRef Instr) {
|
||||||
|
|
Loading…
Reference in New Issue