本文整理汇总了C++中Executable::getStubTarget方法的典型用法代码示例。如果您正苦于以下问题:C++ Executable::getStubTarget方法的具体用法?C++ Executable::getStubTarget怎么用?C++ Executable::getStubTarget使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Executable
的用法示例。
在下文中一共展示了Executable::getStubTarget方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: annotateStubs
void annotateStubs(Executable& executable, Module& module)
{
Function* jumpIntrin = module.getFunction("x86_jump_intrin");
// This may eventually need to be moved to a pass of its own or something.
vector<Function*> functions;
for (Function& fn : module.getFunctionList())
{
if (md::isPrototype(fn))
{
continue;
}
BasicBlock& entry = fn.getEntryBlock();
auto terminator = entry.getTerminator();
if (isa<UnreachableInst>(terminator))
{
if (auto prev = dyn_cast<CallInst>(terminator->getPrevNode()))
if (prev->getCalledFunction() == jumpIntrin)
if (auto load = dyn_cast<LoadInst>(prev->getOperand(2)))
if (auto constantExpr = dyn_cast<ConstantExpr>(load->getPointerOperand()))
{
unique_ptr<Instruction> inst(constantExpr->getAsInstruction());
if (auto int2ptr = dyn_cast<IntToPtrInst>(inst.get()))
{
auto value = cast<ConstantInt>(int2ptr->getOperand(0));
auto intValue = value->getLimitedValue();
if (const string* stubTarget = executable.getStubTarget(intValue))
{
md::setImportName(fn, *stubTarget);
fn.setName(*stubTarget);
}
}
}
}
}
}