本文整理汇总了C++中basicblock::iterator::setDebugLoc方法的典型用法代码示例。如果您正苦于以下问题:C++ iterator::setDebugLoc方法的具体用法?C++ iterator::setDebugLoc怎么用?C++ iterator::setDebugLoc使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类basicblock::iterator
的用法示例。
在下文中一共展示了iterator::setDebugLoc方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateFastPath
void BBCloner::CreateFastPath(Function &F) {
CloneMap.clear();
for (Function::arg_iterator AI = F.arg_begin(); AI != F.arg_end(); ++AI)
CloneMap[AI] = AI;
BBSet OldBBs;
for (Function::iterator B = F.begin(); B != F.end(); ++B)
OldBBs.insert(B);
for (BBSet::iterator I = OldBBs.begin(); I != OldBBs.end(); ++I) {
BasicBlock *B = *I;
// Skip the back edge blocks inserted by CheckInserter.
if (IsBackEdgeBlock(*B)) {
CloneMap[B] = B;
continue;
}
BasicBlock *B2 = CloneBasicBlock(B, CloneMap, ".fast", &F, NULL);
// Strip DebugLoc from all cloned instructions; otherwise, the code
// generator would assert fail. TODO: Figure out why it would fail.
for (BasicBlock::iterator Ins = B2->begin(); Ins != B2->end(); ++Ins) {
if (!Ins->getDebugLoc().isUnknown())
Ins->setDebugLoc(DebugLoc());
}
CloneMap[B] = B2;
}
for (Function::iterator B2 = F.begin(); B2 != F.end(); ++B2) {
if (OldBBs.count(B2))
continue;
for (BasicBlock::iterator I = B2->begin(); I != B2->end(); ++I)
RemapInstruction(I, CloneMap);
}
}
示例2: StripDebugInfo
// StripDebugInfo - Strip debug info in the module if it exists.
// To do this, we remove llvm.dbg.func.start, llvm.dbg.stoppoint, and
// llvm.dbg.region.end calls, and any globals they point to if now dead.
static bool StripDebugInfo(Module &M) {
bool Changed = false;
// Remove all of the calls to the debugger intrinsics, and remove them from
// the module.
if (Function *Declare = M.getFunction("llvm.dbg.declare")) {
while (!Declare->use_empty()) {
CallInst *CI = cast<CallInst>(Declare->use_back());
CI->eraseFromParent();
}
Declare->eraseFromParent();
Changed = true;
}
if (Function *DbgVal = M.getFunction("llvm.dbg.value")) {
while (!DbgVal->use_empty()) {
CallInst *CI = cast<CallInst>(DbgVal->use_back());
CI->eraseFromParent();
}
DbgVal->eraseFromParent();
Changed = true;
}
for (Module::named_metadata_iterator NMI = M.named_metadata_begin(),
NME = M.named_metadata_end(); NMI != NME;) {
NamedMDNode *NMD = NMI;
++NMI;
if (NMD->getName().startswith("llvm.dbg.")) {
NMD->eraseFromParent();
Changed = true;
}
}
for (Module::iterator MI = M.begin(), ME = M.end(); MI != ME; ++MI)
for (Function::iterator FI = MI->begin(), FE = MI->end(); FI != FE;
++FI)
for (BasicBlock::iterator BI = FI->begin(), BE = FI->end(); BI != BE;
++BI) {
if (!BI->getDebugLoc().isUnknown()) {
Changed = true;
BI->setDebugLoc(DebugLoc());
}
}
return Changed;
}
示例3: fixupLineNumbers
/// fixupLineNumbers - Update inlined instructions' line numbers to
/// to encode location where these instructions are inlined.
static void fixupLineNumbers(Function *Fn, Function::iterator FI,
Instruction *TheCall) {
DebugLoc TheCallDL = TheCall->getDebugLoc();
if (TheCallDL.isUnknown())
return;
for (; FI != Fn->end(); ++FI) {
for (BasicBlock::iterator BI = FI->begin(), BE = FI->end();
BI != BE; ++BI) {
DebugLoc DL = BI->getDebugLoc();
if (!DL.isUnknown()) {
BI->setDebugLoc(updateInlinedAtInfo(DL, TheCallDL, BI->getContext()));
if (DbgValueInst *DVI = dyn_cast<DbgValueInst>(BI)) {
LLVMContext &Ctx = BI->getContext();
MDNode *InlinedAt = BI->getDebugLoc().getInlinedAt(Ctx);
DVI->setOperand(2, createInlinedVariable(DVI->getVariable(),
InlinedAt, Ctx));
}
}
}
}
}