本文整理汇总了C++中InvokeInst::setNormalDest方法的典型用法代码示例。如果您正苦于以下问题:C++ InvokeInst::setNormalDest方法的具体用法?C++ InvokeInst::setNormalDest怎么用?C++ InvokeInst::setNormalDest使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类InvokeInst
的用法示例。
在下文中一共展示了InvokeInst::setNormalDest方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: instrumentPointerInstruction
void MemoryInstrumenter::instrumentPointerInstruction(Instruction *I) {
BasicBlock::iterator Loc;
if (isa<PHINode>(I)) {
// Cannot insert hooks right after a PHI, because PHINodes have to be
// grouped together.
Loc = I->getParent()->getFirstNonPHI();
} else if (!I->isTerminator()) {
Loc = I;
++Loc;
} else {
assert(isa<InvokeInst>(I));
InvokeInst *II = cast<InvokeInst>(I);
BasicBlock *NormalDest = II->getNormalDest();
// It's not always OK to insert HookTopLevel simply at the beginning of the
// normal destination, because the normal destionation may be shared by
// multiple InvokeInsts. In that case, we will create a critical edge block,
// and add the HookTopLevel over there.
if (NormalDest->getUniquePredecessor()) {
Loc = NormalDest->getFirstNonPHI();
} else {
BasicBlock *CritEdge = BasicBlock::Create(I->getContext(),
"crit_edge",
I->getParent()->getParent());
Loc = BranchInst::Create(NormalDest, CritEdge);
// Now that CritEdge becomes the new predecessor of NormalDest, replace
// all phi uses of I->getParent() with CritEdge.
for (auto J = NormalDest->begin();
NormalDest->getFirstNonPHI() != J;
++J) {
PHINode *Phi = cast<PHINode>(J);
int i;
while ((i = Phi->getBasicBlockIndex(I->getParent())) >= 0)
Phi->setIncomingBlock(i, CritEdge);
}
II->setNormalDest(CritEdge);
}
}
if (LoadInst *LI = dyn_cast<LoadInst>(I))
instrumentPointer(I, LI->getPointerOperand(), Loc);
else
instrumentPointer(I, NULL, Loc);
}