diff options
author | Florian Hahn <flo@fhahn.com> | 2021-01-13 09:02:23 +0000 |
---|---|---|
committer | Florian Hahn <flo@fhahn.com> | 2021-01-13 09:32:15 +0000 |
commit | f638c2eb4ee6d0a0bd0e80cd305ad93e382db8f5 (patch) | |
tree | 867070ecf859c9a3503ccafb62b9de060434836d | |
parent | cbea6737d5130724c7c8cf8ee4ccf1c3dd099450 (diff) | |
download | llvm-f638c2eb4ee6d0a0bd0e80cd305ad93e382db8f5.tar.gz |
[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.
-rw-r--r-- | llvm/lib/LTO/LTOBackend.cpp | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/llvm/lib/LTO/LTOBackend.cpp b/llvm/lib/LTO/LTOBackend.cpp index 65aaa8d21bfc..112a0c0897e8 100644 --- a/llvm/lib/LTO/LTOBackend.cpp +++ b/llvm/lib/LTO/LTOBackend.cpp @@ -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) { |