本文整理汇总了C++中OwningPtr::run方法的典型用法代码示例。如果您正苦于以下问题:C++ OwningPtr::run方法的具体用法?C++ OwningPtr::run怎么用?C++ OwningPtr::run使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OwningPtr
的用法示例。
在下文中一共展示了OwningPtr::run方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
Passes.add(new LoopPassPrinter(PassInf, Out->os()));
break;
case PT_Function:
Passes.add(new FunctionPassPrinter(PassInf, Out->os()));
break;
case PT_CallGraphSCC:
Passes.add(new CallGraphSCCPassPrinter(PassInf, Out->os()));
break;
default:
Passes.add(new ModulePassPrinter(PassInf, Out->os()));
break;
}
}
}
if (PrintEachXForm)
Passes.add(createPrintModulePass(&errs()));
}
// If -std-compile-opts was specified at the end of the pass list, add them.
if (StandardCompileOpts) {
AddStandardCompilePasses(Passes);
StandardCompileOpts = false;
}
if (StandardLinkOpts) {
AddStandardLinkPasses(Passes);
StandardLinkOpts = false;
}
if (OptLevelO1)
AddOptimizationPasses(Passes, *FPasses, 1, 0);
if (OptLevelO2)
AddOptimizationPasses(Passes, *FPasses, 2, 0);
if (OptLevelOs)
AddOptimizationPasses(Passes, *FPasses, 2, 1);
if (OptLevelOz)
AddOptimizationPasses(Passes, *FPasses, 2, 2);
if (OptLevelO3)
AddOptimizationPasses(Passes, *FPasses, 3, 0);
if (OptLevelO1 || OptLevelO2 || OptLevelOs || OptLevelOz || OptLevelO3) {
FPasses->doInitialization();
for (Module::iterator F = M->begin(), E = M->end(); F != E; ++F)
FPasses->run(*F);
FPasses->doFinalization();
}
// @LOCALMOD-BEGIN
if (PNaClABISimplifyPreOpt)
PNaClABISimplifyAddPreOptPasses(Passes);
if (PNaClABISimplifyPostOpt)
PNaClABISimplifyAddPostOptPasses(Passes);
// @LOCALMOD-END
// Check that the module is well formed on completion of optimization
if (!NoVerify && !VerifyEach)
Passes.add(createVerifierPass());
// Write bitcode or assembly to the output as the last step...
if (!NoOutput && !AnalyzeOnly) {
if (OutputAssembly)
Passes.add(createPrintModulePass(&Out->os()));
// @LOCALMOD
}
// Before executing passes, print the final values of the LLVM options.
cl::PrintOptionValues();
// Now that we have all of the passes ready, run them.
Passes.run(*M.get());
// @LOCALMOD-BEGIN
// Write bitcode to the output.
if (!NoOutput && !AnalyzeOnly && !OutputAssembly) {
switch (OutputFileFormat) {
case LLVMFormat:
WriteBitcodeToFile(M.get(), Out->os());
break;
case PNaClFormat:
NaClWriteBitcodeToFile(M.get(), Out->os());
break;
default:
errs() << "Don't understand bitcode format for generated bitcode.\n";
return 1;
}
}
// @LOCALMOD-END
// Declare success.
if (!NoOutput || PrintBreakpoints)
Out->keep();
return 0;
}
示例2: main
//.........这里部分代码省略.........
StandardLinkOpts.getPosition() < PassList.getPosition(i)) {
AddStandardLinkPasses(Passes);
StandardLinkOpts = false;
}
if (OptLevelO1 && OptLevelO1.getPosition() < PassList.getPosition(i)) {
AddOptimizationPasses(Passes, *FPasses, 1);
OptLevelO1 = false;
}
if (OptLevelO2 && OptLevelO2.getPosition() < PassList.getPosition(i)) {
AddOptimizationPasses(Passes, *FPasses, 2);
OptLevelO2 = false;
}
if (OptLevelO3 && OptLevelO3.getPosition() < PassList.getPosition(i)) {
AddOptimizationPasses(Passes, *FPasses, 3);
OptLevelO3 = false;
}
const PassInfo *PassInf = PassList[i];
Pass *P = 0;
if (PassInf->getNormalCtor())
P = PassInf->getNormalCtor()();
else
errs() << argv[0] << ": cannot create pass: "
<< PassInf->getPassName() << "\n";
if (P) {
PassKind Kind = P->getPassKind();
addPass(Passes, P);
if (AnalyzeOnly) {
switch (Kind) {
case PT_BasicBlock:
Passes.add(new BasicBlockPassPrinter(PassInf, Out->os()));
break;
case PT_Loop:
Passes.add(new LoopPassPrinter(PassInf, Out->os()));
break;
case PT_Function:
Passes.add(new FunctionPassPrinter(PassInf, Out->os()));
break;
case PT_CallGraphSCC:
Passes.add(new CallGraphSCCPassPrinter(PassInf, Out->os()));
break;
default:
Passes.add(new ModulePassPrinter(PassInf, Out->os()));
break;
}
}
}
if (PrintEachXForm)
Passes.add(createPrintModulePass(&errs()));
}
// If -std-compile-opts was specified at the end of the pass list, add them.
if (StandardCompileOpts) {
AddStandardCompilePasses(Passes);
StandardCompileOpts = false;
}
if (StandardLinkOpts) {
AddStandardLinkPasses(Passes);
StandardLinkOpts = false;
}
if (OptLevelO1)
AddOptimizationPasses(Passes, *FPasses, 1);
if (OptLevelO2)
AddOptimizationPasses(Passes, *FPasses, 2);
if (OptLevelO3)
AddOptimizationPasses(Passes, *FPasses, 3);
if (OptLevelO1 || OptLevelO2 || OptLevelO3)
FPasses->run(*M.get());
// Check that the module is well formed on completion of optimization
if (!NoVerify && !VerifyEach)
Passes.add(createVerifierPass());
// Write bitcode or assembly to the output as the last step...
if (!NoOutput && !AnalyzeOnly) {
if (OutputAssembly)
Passes.add(createPrintModulePass(&Out->os()));
else
Passes.add(createBitcodeWriterPass(Out->os()));
}
// Now that we have all of the passes ready, run them.
Passes.run(*M.get());
// Declare success.
if (!NoOutput)
Out->keep();
return 0;
}