本文整理汇总了C++中SelectInst::getNumOperands方法的典型用法代码示例。如果您正苦于以下问题:C++ SelectInst::getNumOperands方法的具体用法?C++ SelectInst::getNumOperands怎么用?C++ SelectInst::getNumOperands使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SelectInst
的用法示例。
在下文中一共展示了SelectInst::getNumOperands方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handleSelectInstruction
// -- handle select instruction --
void UnsafeTypeCastingCheck::handleSelectInstruction (Instruction *inst) {
SelectInst *sinst = dyn_cast<SelectInst>(inst);
if (sinst == NULL)
utccAbort("handleSelectInstruction cannot process with a non-select instruction");
assert(sinst->getNumOperands() == 3);
Value *choice0 = sinst->getOperand(1);
Value *choice1 = sinst->getOperand(2);
Type *type0 = choice0->getType();
Type *type1 = choice1->getType();
UTCC_TYPE ut0 = llvmT2utccT(type0, choice0);
UTCC_TYPE ut1 = llvmT2utccT(type1, choice1);
if (type0->isIntegerTy() &&
type1->isIntegerTy()) {
if (ut0 == ut1)
setExprType(sinst, ut0);
else if (ut0 == INT_UT || ut1 == INT_UT)
setExprType(sinst, INT_UT);
else setExprType(sinst, NINT_UT);
}
else if (type0->isFloatingPointTy() &&
type1->isFloatingPointTy()) {
if (ut0 == ut1)
setExprType(sinst, ut0);
else if (ut0 == FP_UT || ut1 == FP_UT)
setExprType(sinst, FP_UT);
else setExprType(sinst, NFP_UT);
}
else {
setExprType(sinst, llvmT2utccT(sinst->getType(), sinst));
}
}