本文整理汇总了C++中FunctionPassManager::addPass方法的典型用法代码示例。如果您正苦于以下问题:C++ FunctionPassManager::addPass方法的具体用法?C++ FunctionPassManager::addPass怎么用?C++ FunctionPassManager::addPass使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FunctionPassManager
的用法示例。
在下文中一共展示了FunctionPassManager::addPass方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: parseFunctionPassName
static bool parseFunctionPassName(FunctionPassManager &FPM, StringRef Name) {
if (Name == "no-op-function") {
FPM.addPass(NoOpFunctionPass());
return true;
}
if (Name == "print") {
FPM.addPass(PrintFunctionPass(dbgs()));
return true;
}
return false;
}
示例2: parseFunctionPassPipeline
bool PassBuilder::parseFunctionPassPipeline(FunctionPassManager &FPM,
StringRef &PipelineText,
bool VerifyEachPass,
bool DebugLogging) {
for (;;) {
// Parse nested pass managers by recursing.
if (PipelineText.startswith("function(")) {
FunctionPassManager NestedFPM(DebugLogging);
// Parse the inner pipeline inte the nested manager.
PipelineText = PipelineText.substr(strlen("function("));
if (!parseFunctionPassPipeline(NestedFPM, PipelineText, VerifyEachPass,
DebugLogging) ||
PipelineText.empty())
return false;
assert(PipelineText[0] == ')');
PipelineText = PipelineText.substr(1);
// Add the nested pass manager with the appropriate adaptor.
FPM.addPass(std::move(NestedFPM));
} else if (PipelineText.startswith("loop(")) {
LoopPassManager NestedLPM(DebugLogging);
// Parse the inner pipeline inte the nested manager.
PipelineText = PipelineText.substr(strlen("loop("));
if (!parseLoopPassPipeline(NestedLPM, PipelineText, VerifyEachPass,
DebugLogging) ||
PipelineText.empty())
return false;
assert(PipelineText[0] == ')');
PipelineText = PipelineText.substr(1);
// Add the nested pass manager with the appropriate adaptor.
FPM.addPass(createFunctionToLoopPassAdaptor(std::move(NestedLPM)));
} else {
// Otherwise try to parse a pass name.
size_t End = PipelineText.find_first_of(",)");
if (!parseFunctionPassName(FPM, PipelineText.substr(0, End)))
return false;
if (VerifyEachPass)
FPM.addPass(VerifierPass());
PipelineText = PipelineText.substr(End);
}
if (PipelineText.empty() || PipelineText[0] == ')')
return true;
assert(PipelineText[0] == ',');
PipelineText = PipelineText.substr(1);
}
}