本文整理汇总了C++中InvokeInst::setParamAttrs方法的典型用法代码示例。如果您正苦于以下问题:C++ InvokeInst::setParamAttrs方法的具体用法?C++ InvokeInst::setParamAttrs怎么用?C++ InvokeInst::setParamAttrs使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类InvokeInst
的用法示例。
在下文中一共展示了InvokeInst::setParamAttrs方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: visitCallInst
// visitCallInst - This converts all LLVM call instructions into invoke
// instructions. The except part of the invoke goes to the "LongJmpBlkPre"
// that grabs the exception and proceeds to determine if it's a longjmp
// exception or not.
void LowerSetJmp::visitCallInst(CallInst& CI)
{
if (CI.getCalledFunction())
if (!IsTransformableFunction(CI.getCalledFunction()->getName()) ||
CI.getCalledFunction()->isIntrinsic()) return;
BasicBlock* OldBB = CI.getParent();
// If not reachable from a setjmp call, don't transform.
if (!DFSBlocks.count(OldBB)) return;
BasicBlock* NewBB = OldBB->splitBasicBlock(CI);
assert(NewBB && "Couldn't split BB of \"call\" instruction!!");
DFSBlocks.insert(NewBB);
NewBB->setName("Call2Invoke");
Function* Func = OldBB->getParent();
// Construct the new "invoke" instruction.
TerminatorInst* Term = OldBB->getTerminator();
std::vector<Value*> Params(CI.op_begin() + 1, CI.op_end());
InvokeInst* II =
InvokeInst::Create(CI.getCalledValue(), NewBB, PrelimBBMap[Func],
Params.begin(), Params.end(), CI.getName(), Term);
II->setCallingConv(CI.getCallingConv());
II->setParamAttrs(CI.getParamAttrs());
// Replace the old call inst with the invoke inst and remove the call.
CI.replaceAllUsesWith(II);
CI.getParent()->getInstList().erase(&CI);
// The old terminator is useless now that we have the invoke inst.
Term->getParent()->getInstList().erase(Term);
++CallsTransformed;
}