1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00

[LTO] Replace anonymous namespace with static functions (NFC).

Only class declarations should be inside anonymous namespaces
(https://llvm.org/docs/CodingStandards.html#anonymous-namespaces)

Instead of using a anonymous namespace, just mark the functions in it as
static (some of them already were).

This simplifies the diff for D94486.
This commit is contained in:
Florian Hahn 2021-01-13 09:02:23 +00:00
parent 90f5750361
commit 229248a14d

View File

@ -176,9 +176,7 @@ static void RegisterPassPlugins(ArrayRef<std::string> PassPlugins,
}
}
namespace {
std::unique_ptr<TargetMachine>
static std::unique_ptr<TargetMachine>
createTargetMachine(const Config &Conf, const Target *TheTarget, Module &M) {
StringRef TheTriple = M.getTargetTriple();
SubtargetFeatures Features;
@ -360,10 +358,10 @@ static void runOldPMPasses(const Config &Conf, Module &Mod, TargetMachine *TM,
passes.run(Mod);
}
bool opt(const Config &Conf, TargetMachine *TM, unsigned Task, Module &Mod,
bool IsThinLTO, ModuleSummaryIndex *ExportSummary,
const ModuleSummaryIndex *ImportSummary,
const std::vector<uint8_t> &CmdArgs) {
static bool opt(const Config &Conf, TargetMachine *TM, unsigned Task,
Module &Mod, bool IsThinLTO, ModuleSummaryIndex *ExportSummary,
const ModuleSummaryIndex *ImportSummary,
const std::vector<uint8_t> &CmdArgs) {
if (EmbedBitcode == LTOBitcodeEmbedding::EmbedPostMergePreOptimized) {
// FIXME: the motivation for capturing post-merge bitcode and command line
// is replicating the compilation environment from bitcode, without needing
@ -393,9 +391,9 @@ bool opt(const Config &Conf, TargetMachine *TM, unsigned Task, Module &Mod,
return !Conf.PostOptModuleHook || Conf.PostOptModuleHook(Task, Mod);
}
void codegen(const Config &Conf, TargetMachine *TM, AddStreamFn AddStream,
unsigned Task, Module &Mod,
const ModuleSummaryIndex &CombinedIndex) {
static void codegen(const Config &Conf, TargetMachine *TM,
AddStreamFn AddStream, unsigned Task, Module &Mod,
const ModuleSummaryIndex &CombinedIndex) {
if (Conf.PreCodeGenModuleHook && !Conf.PreCodeGenModuleHook(Task, Mod))
return;
@ -440,10 +438,11 @@ void codegen(const Config &Conf, TargetMachine *TM, AddStreamFn AddStream,
DwoOut->keep();
}
void splitCodeGen(const Config &C, TargetMachine *TM, AddStreamFn AddStream,
unsigned ParallelCodeGenParallelismLevel,
std::unique_ptr<Module> Mod,
const ModuleSummaryIndex &CombinedIndex) {
static void splitCodeGen(const Config &C, TargetMachine *TM,
AddStreamFn AddStream,
unsigned ParallelCodeGenParallelismLevel,
std::unique_ptr<Module> Mod,
const ModuleSummaryIndex &CombinedIndex) {
ThreadPool CodegenThreadPool(
heavyweight_hardware_concurrency(ParallelCodeGenParallelismLevel));
unsigned ThreadCount = 0;
@ -491,7 +490,8 @@ void splitCodeGen(const Config &C, TargetMachine *TM, AddStreamFn AddStream,
CodegenThreadPool.wait();
}
Expected<const Target *> initAndLookupTarget(const Config &C, Module &Mod) {
static Expected<const Target *> initAndLookupTarget(const Config &C,
Module &Mod) {
if (!C.OverrideTriple.empty())
Mod.setTargetTriple(C.OverrideTriple);
else if (Mod.getTargetTriple().empty())
@ -503,7 +503,6 @@ Expected<const Target *> initAndLookupTarget(const Config &C, Module &Mod) {
return make_error<StringError>(Msg, inconvertibleErrorCode());
return T;
}
}
Error lto::finalizeOptimizationRemarks(
std::unique_ptr<ToolOutputFile> DiagOutputFile) {