mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-02 15:32:06 +00:00
fix to register analysis pass from llvm plugin
This commit is contained in:
parent
d4ba2b4c7c
commit
5048f81313
@ -795,6 +795,20 @@ LLVMRustOptimize(
|
||||
CGSCCAnalysisManager CGAM;
|
||||
ModuleAnalysisManager MAM;
|
||||
|
||||
if (LLVMPluginsLen) {
|
||||
auto PluginsStr = StringRef(LLVMPlugins, LLVMPluginsLen);
|
||||
SmallVector<StringRef> Plugins;
|
||||
PluginsStr.split(Plugins, ',', -1, false);
|
||||
for (auto PluginPath: Plugins) {
|
||||
auto Plugin = PassPlugin::Load(PluginPath.str());
|
||||
if (!Plugin) {
|
||||
LLVMRustSetLastError(("Failed to load pass plugin" + PluginPath.str()).c_str());
|
||||
return LLVMRustResult::Failure;
|
||||
}
|
||||
Plugin->registerPassBuilderCallbacks(PB);
|
||||
}
|
||||
}
|
||||
|
||||
FAM.registerPass([&] { return PB.buildDefaultAAPipeline(); });
|
||||
|
||||
Triple TargetTriple(TheModule->getTargetTriple());
|
||||
@ -918,20 +932,6 @@ LLVMRustOptimize(
|
||||
}
|
||||
}
|
||||
|
||||
if (LLVMPluginsLen) {
|
||||
auto PluginsStr = StringRef(LLVMPlugins, LLVMPluginsLen);
|
||||
SmallVector<StringRef> Plugins;
|
||||
PluginsStr.split(Plugins, ',', -1, false);
|
||||
for (auto PluginPath: Plugins) {
|
||||
auto Plugin = PassPlugin::Load(PluginPath.str());
|
||||
if (!Plugin) {
|
||||
LLVMRustSetLastError(("Failed to load pass plugin" + PluginPath.str()).c_str());
|
||||
return LLVMRustResult::Failure;
|
||||
}
|
||||
Plugin->registerPassBuilderCallbacks(PB);
|
||||
}
|
||||
}
|
||||
|
||||
ModulePassManager MPM;
|
||||
bool NeedThinLTOBufferPasses = UseThinLTOBuffers;
|
||||
if (!NoPrepopulatePasses) {
|
||||
|
Loading…
Reference in New Issue
Block a user