CompareInstruction class (Seth Warn)
git-svn-id: http://llvm-py.googlecode.com/svn/trunk@76 8d1e9007-1d4e-0410-b67e-1979fd6579aa
This commit is contained in:
parent
fa30225181
commit
f3989aa240
4 changed files with 26 additions and 0 deletions
|
|
@ -579,6 +579,10 @@ _wrap_obj2obj(LLVMCountIncoming, LLVMValueRef, int)
|
||||||
_wrap_objint2obj(LLVMGetIncomingValue, LLVMValueRef, LLVMValueRef)
|
_wrap_objint2obj(LLVMGetIncomingValue, LLVMValueRef, LLVMValueRef)
|
||||||
_wrap_objint2obj(LLVMGetIncomingBlock, LLVMValueRef, LLVMBasicBlockRef)
|
_wrap_objint2obj(LLVMGetIncomingBlock, LLVMValueRef, LLVMBasicBlockRef)
|
||||||
|
|
||||||
|
/*===-- Compare Instructions ---------------------------------------------===*/
|
||||||
|
|
||||||
|
_wrap_obj2obj(LLVMCmpInstGetPredicate, LLVMValueRef, int)
|
||||||
|
|
||||||
/*===-- Instruction builders ----------------------------------------------===*/
|
/*===-- Instruction builders ----------------------------------------------===*/
|
||||||
|
|
||||||
_wrap_none2obj(LLVMCreateBuilder, LLVMBuilderRef)
|
_wrap_none2obj(LLVMCreateBuilder, LLVMBuilderRef)
|
||||||
|
|
@ -1373,6 +1377,9 @@ static PyMethodDef core_methods[] = {
|
||||||
_method( LLVMGetIncomingValue )
|
_method( LLVMGetIncomingValue )
|
||||||
_method( LLVMGetIncomingBlock )
|
_method( LLVMGetIncomingBlock )
|
||||||
|
|
||||||
|
/* Comparison Instructions */
|
||||||
|
_method( LLVMCmpInstGetPredicate )
|
||||||
|
|
||||||
/* Instruction builders */
|
/* Instruction builders */
|
||||||
_method( LLVMCreateBuilder )
|
_method( LLVMCreateBuilder )
|
||||||
_method( LLVMPositionBuilderBefore )
|
_method( LLVMPositionBuilderBefore )
|
||||||
|
|
|
||||||
|
|
@ -1420,6 +1420,13 @@ class SwitchInstruction(Instruction):
|
||||||
_core.LLVMAddCase(self.ptr, const.ptr, bblk.ptr)
|
_core.LLVMAddCase(self.ptr, const.ptr, bblk.ptr)
|
||||||
|
|
||||||
|
|
||||||
|
class CompareInstruction(Instruction):
|
||||||
|
|
||||||
|
@property
|
||||||
|
def predicate(self):
|
||||||
|
return _core.LLVMCmpInstGetPredicate(self.ptr)
|
||||||
|
|
||||||
|
|
||||||
#===----------------------------------------------------------------------===
|
#===----------------------------------------------------------------------===
|
||||||
# Basic block
|
# Basic block
|
||||||
#===----------------------------------------------------------------------===
|
#===----------------------------------------------------------------------===
|
||||||
|
|
@ -1469,6 +1476,8 @@ __class_for_valueid = {
|
||||||
VALUE_INSTRUCTION + OPCODE_CALL : CallOrInvokeInstruction,
|
VALUE_INSTRUCTION + OPCODE_CALL : CallOrInvokeInstruction,
|
||||||
VALUE_INSTRUCTION + OPCODE_INVOKE : CallOrInvokeInstruction,
|
VALUE_INSTRUCTION + OPCODE_INVOKE : CallOrInvokeInstruction,
|
||||||
VALUE_INSTRUCTION + OPCODE_SWITCH : SwitchInstruction,
|
VALUE_INSTRUCTION + OPCODE_SWITCH : SwitchInstruction,
|
||||||
|
VALUE_INSTRUCTION + OPCODE_ICMP : CompareInstruction,
|
||||||
|
VALUE_INSTRUCTION + OPCODE_FCMP : CompareInstruction
|
||||||
}
|
}
|
||||||
|
|
||||||
def _make_value(ptr):
|
def _make_value(ptr):
|
||||||
|
|
|
||||||
|
|
@ -240,6 +240,13 @@ unsigned LLVMInstGetOpcode(LLVMValueRef inst)
|
||||||
return instp->getOpcode();
|
return instp->getOpcode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned LLVMCmpInstGetPredicate(LLVMValueRef cmpinst)
|
||||||
|
{
|
||||||
|
llvm::CmpInst *instp = llvm::unwrap<llvm::CmpInst>(cmpinst);
|
||||||
|
assert(instp);
|
||||||
|
return instp->getPredicate();
|
||||||
|
}
|
||||||
|
|
||||||
/* llvm::unwrap a set of `n' wrapped objects starting at `values',
|
/* llvm::unwrap a set of `n' wrapped objects starting at `values',
|
||||||
* into a vector of pointers to llvm::unwrapped objects `out'. */
|
* into a vector of pointers to llvm::unwrapped objects `out'. */
|
||||||
template <typename W, typename UW>
|
template <typename W, typename UW>
|
||||||
|
|
|
||||||
|
|
@ -139,6 +139,9 @@ const char *LLVMInstGetOpcodeName(LLVMValueRef inst);
|
||||||
/* Wraps llvm::Instruction::getOpcode(). */
|
/* Wraps llvm::Instruction::getOpcode(). */
|
||||||
unsigned LLVMInstGetOpcode(LLVMValueRef inst);
|
unsigned LLVMInstGetOpcode(LLVMValueRef inst);
|
||||||
|
|
||||||
|
/* Wraps llvm::CmpInst::getPredicate(). */
|
||||||
|
unsigned LLVMCmpInstGetPredicate(LLVMValueRef cmpinst);
|
||||||
|
|
||||||
/* Wraps llvm::ParseAssemblyString(). Returns a module reference or NULL (with
|
/* Wraps llvm::ParseAssemblyString(). Returns a module reference or NULL (with
|
||||||
* `out' pointing to an error message). Dispose error message after use, via
|
* `out' pointing to an error message). Dispose error message after use, via
|
||||||
* LLVMDisposeMessage(). */
|
* LLVMDisposeMessage(). */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue