本文整理汇总了C++中function::iterator::back方法的典型用法代码示例。如果您正苦于以下问题:C++ iterator::back方法的具体用法?C++ iterator::back怎么用?C++ iterator::back使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类function::iterator
的用法示例。
在下文中一共展示了iterator::back方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: processBasicBlock
void Matcher::processBasicBlock(Function *F)
{
for (Function::iterator FI = F->begin(), FE = F->end(); FI != FE; FI++) {
/** Use first and last instruction to get the scope information **/
Instruction *first = & FI->front();
Instruction *last = & FI->back();
if (first == NULL || last == NULL) {
errs() << "NULL scope instructions " << "\n";
continue;
}
DebugLoc Loc = first->getDebugLoc();
if (Loc.isUnknown()) {
errs() << "Unknown LOC information" << "\n";
continue;
}
errs() << "Block :" << Loc.getLine();
Loc = last->getDebugLoc();
if (Loc.isUnknown()) {
errs() << "Unknown LOC information" << "\n";
continue;
}
errs() << ", " << Loc.getLine() << "\n";
}
}
示例2: compile_builder
void Compiler::compile_builder(jit::Context& ctx, LLVMState* ls, JITMethodInfo& info,
jit::Builder& work)
{
llvm::Function* func = info.function();
if(!work.generate_body()) {
function_ = NULL;
// This is too noisy to report
// llvm::outs() << "not supported yet.\n";
return;
}
// Hook up the return pad and return phi.
work.generate_hard_return();
if(ls->jit_dump_code() & cSimple) {
llvm::outs() << "[[[ LLVM Simple IR ]]]\n";
llvm::outs() << *func << "\n";
}
std::vector<BasicBlock*> to_remove;
bool Broken = false;
for(Function::iterator I = func->begin(), E = func->end(); I != E; ++I) {
if(I->empty()) {
BasicBlock& bb = *I;
// No one jumps to it....
if(llvm::pred_begin(&bb) == llvm::pred_end(&bb)) {
to_remove.push_back(&bb);
} else {
llvm::outs() << "Basic Block is empty and used!\n";
}
} else if(!I->back().isTerminator()) {
llvm::errs() << "Basic Block does not have terminator!\n";
llvm::errs() << *I << "\n";
llvm::errs() << "\n";
Broken = true;
}
}
for(std::vector<BasicBlock*>::iterator i = to_remove.begin();
i != to_remove.end();
++i) {
(*i)->eraseFromParent();
}
if(Broken or llvm::verifyFunction(*func, PrintMessageAction)) {
llvm::outs() << "ERROR: complication error detected.\n";
llvm::outs() << "ERROR: Please report the above message and the\n";
llvm::outs() << " code below to http://github.com/rubinius/rubinius/issues\n";
llvm::outs() << *func << "\n";
function_ = NULL;
return;
}
ls->passes()->run(*func);
if(ls->jit_dump_code() & cOptimized) {
llvm::outs() << "[[[ LLVM Optimized IR: "
<< ls->symbol_cstr(info.method()->name()) << " ]]]\n";
llvm::outs() << *func << "\n";
}
function_ = func;
generate_function(ls);
// Inject the RuntimeData objects used into the original CompiledMethod
// Do this way after we've validated the IR so things are consistent.
ctx.runtime_data_holder()->set_function(func, mci_->address(), mci_->size());
info.method()->set_jit_data(ctx.runtime_data_holder());
ls->shared().om->add_code_resource(ctx.runtime_data_holder());
}