Changeset View
Changeset View
Standalone View
Standalone View
llvm/lib/Passes/PassPluginLoader.cpp
- This file was added.
//===-- PassPluginLoader.cpp ----------------------------------------------===// | |||||
// | |||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | |||||
// See https://llvm.org/LICENSE.txt for license information. | |||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | |||||
// | |||||
//===----------------------------------------------------------------------===// | |||||
#define DONT_GET_PASS_PLUGIN_LOADER_OPTION | |||||
#include "llvm/Passes/PassPluginLoader.h" | |||||
#include "llvm/Passes/PassPluginRegistry.h" | |||||
#include "llvm/Support/raw_ostream.h" | |||||
using namespace llvm; | |||||
void PassPluginLoader::operator=(const std::string &Filename) { | |||||
auto PassPlugin = PassPlugin::Load(Filename); | |||||
if (!PassPlugin) { | |||||
errs() << "Failed to load passes from '" << Filename | |||||
<< "'. Request ignored.\n"; | |||||
return; | |||||
} | |||||
PassPluginRegistry::addPlugin(std::move(PassPlugin.get())); | |||||
w2yehia: why do we need a lock?
Is there a use case where multiple threads enter this function.
Right… | |||||
That's a very good question that I couldn't answer: I based the implementation on what is done over in PluginLoader, but I too wondered why it was guarded (this commit introduces it but I couldn't find more details). I'm fine with removing it unless someone can provide a use case where we need it; I'll update the patch! viroulep: That's a very good question that I couldn't answer: I based the implementation on what is done… | |||||
} |
why do we need a lock?
Is there a use case where multiple threads enter this function.
Right now, the only place we create a PassPluginLoader is in cl::opt<PassPluginLoader> PassPlugins.