Added instruction properties (is_XXX, opcode, opcode_name)

git-svn-id: http://llvm-py.googlecode.com/svn/trunk@42 8d1e9007-1d4e-0410-b67e-1979fd6579aa
This commit is contained in:
mdevan.foobar 2008-09-16 16:38:21 +00:00
commit aee33c6612
5 changed files with 108 additions and 5 deletions

View file

@ -84,8 +84,29 @@ LLVMValueRef LLVMBuildVFCmp(LLVMBuilderRef B, LLVMRealPredicate Op,
}
#endif
unsigned LLVMInstIsTerminator(LLVMValueRef I) {
return unwrap<Instruction>(I)->isTerminator() ? 1 : 0;
#define inst_checkfn(ourfn, llvmfn) \
unsigned ourfn (LLVMValueRef I) { \
return unwrap<Instruction>(I)-> llvmfn () ? 1 : 0; \
}
inst_checkfn(LLVMInstIsTerminator, isTerminator)
inst_checkfn(LLVMInstIsBinaryOp, isBinaryOp)
inst_checkfn(LLVMInstIsShift, isShift)
inst_checkfn(LLVMInstIsCast, isCast)
inst_checkfn(LLVMInstIsLogicalShift,isLogicalShift)
inst_checkfn(LLVMInstIsArithmeticShift,isArithmeticShift)
inst_checkfn(LLVMInstIsAssociative, isAssociative)
inst_checkfn(LLVMInstIsCommutative, isCommutative)
inst_checkfn(LLVMInstIsTrapping, isTrapping)
const char *LLVMInstGetOpcodeName(LLVMValueRef I)
{
return unwrap<Instruction>(I)->getOpcodeName();
}
unsigned LLVMInstGetOpcode(LLVMValueRef I)
{
return unwrap<Instruction>(I)->getOpcode();
}
LLVMValueRef LLVMBuildRetMultiple(LLVMBuilderRef B, LLVMValueRef *Values,