From b17d2136eae4d9003e2a04f89afc6cd6a56c966a Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Sat, 12 Jan 2019 18:36:22 +0000 Subject: [PATCH] Give helper classes/functions local linkage. NFC. llvm-svn: 351016 --- llvm/lib/AsmParser/LLParser.cpp | 2 +- llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 4 ++-- llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp | 2 ++ llvm/lib/CodeGen/GlobalISel/Legalizer.cpp | 2 ++ llvm/lib/Transforms/IPO/HotColdSplitting.cpp | 2 ++ llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp | 2 +- llvm/lib/Transforms/Scalar/LICM.cpp | 2 ++ llvm/lib/Transforms/Scalar/LoopSimplifyCFG.cpp | 2 ++ 8 files changed, 14 insertions(+), 4 deletions(-) diff --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp index f887372..ee63450 100644 --- a/llvm/lib/AsmParser/LLParser.cpp +++ b/llvm/lib/AsmParser/LLParser.cpp @@ -7519,7 +7519,7 @@ bool LLParser::ParseArgs(std::vector &Args) { return false; } -auto FwdVIRef = (GlobalValueSummaryMapTy::value_type *)-8; +static const auto FwdVIRef = (GlobalValueSummaryMapTy::value_type *)-8; static void resolveFwdRef(ValueInfo *Fwd, ValueInfo &Resolved) { bool ReadOnly = Fwd->isReadOnly(); diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index 151cf3c..1de2ffb 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -2376,8 +2376,8 @@ static void emitRangeList(DwarfDebug &DD, AsmPrinter *Asm, } } -void emitDebugRangesImpl(DwarfDebug &DD, AsmPrinter *Asm, - const DwarfFile &Holder, MCSymbol *TableEnd) { +static void emitDebugRangesImpl(DwarfDebug &DD, AsmPrinter *Asm, + const DwarfFile &Holder, MCSymbol *TableEnd) { for (const RangeSpanList &List : Holder.getRangeLists()) emitRangeList(DD, Asm, List); diff --git a/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp b/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp index 4feb624..4db5d1c 100644 --- a/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp +++ b/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp @@ -105,6 +105,7 @@ IRTranslator::IRTranslator() : MachineFunctionPass(ID) { } #ifndef NDEBUG +namespace { /// Verify that every instruction created has the same DILocation as the /// instruction being translated. class DILocationVerifier : MachineFunction::Delegate { @@ -131,6 +132,7 @@ public: } void MF_HandleRemoval(const MachineInstr &MI) override {} }; +} // namespace #endif // ifndef NDEBUG diff --git a/llvm/lib/CodeGen/GlobalISel/Legalizer.cpp b/llvm/lib/CodeGen/GlobalISel/Legalizer.cpp index df2dcac..8f8280a 100644 --- a/llvm/lib/CodeGen/GlobalISel/Legalizer.cpp +++ b/llvm/lib/CodeGen/GlobalISel/Legalizer.cpp @@ -73,6 +73,7 @@ static bool isArtifact(const MachineInstr &MI) { using InstListTy = GISelWorkList<256>; using ArtifactListTy = GISelWorkList<128>; +namespace { class LegalizerWorkListManager : public GISelChangeObserver { InstListTy &InstList; ArtifactListTy &ArtifactList; @@ -111,6 +112,7 @@ public: createdInstr(MI); } }; +} // namespace bool Legalizer::runOnMachineFunction(MachineFunction &MF) { // If the ISel pipeline failed, do not bother running that pass. diff --git a/llvm/lib/Transforms/IPO/HotColdSplitting.cpp b/llvm/lib/Transforms/IPO/HotColdSplitting.cpp index 5d989a4..924a7d5 100644 --- a/llvm/lib/Transforms/IPO/HotColdSplitting.cpp +++ b/llvm/lib/Transforms/IPO/HotColdSplitting.cpp @@ -295,6 +295,7 @@ Function *HotColdSplitting::extractColdRegion(const BlockSequence &Region, /// A pair of (basic block, score). using BlockTy = std::pair; +namespace { /// A maximal outlining region. This contains all blocks post-dominated by a /// sink block, the sink block itself, and all blocks dominated by the sink. class OutliningRegion { @@ -458,6 +459,7 @@ public: return SubRegion; } }; +} // namespace bool HotColdSplitting::outlineColdRegions(Function &F, ProfileSummaryInfo &PSI, BlockFrequencyInfo *BFI, diff --git a/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp b/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp index 8291239..9af64ed 100644 --- a/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp +++ b/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp @@ -185,7 +185,7 @@ static StringRef getFunctionName(const DISubprogram *SP) { /// Prefer relative paths in the coverage notes. Clang also may split /// up absolute paths into a directory and filename component. When /// the relative path doesn't exist, reconstruct the absolute path. -SmallString<128> getFilename(const DISubprogram *SP) { +static SmallString<128> getFilename(const DISubprogram *SP) { SmallString<128> Path; StringRef RelPath = SP->getFilename(); if (sys::fs::exists(RelPath)) diff --git a/llvm/lib/Transforms/Scalar/LICM.cpp b/llvm/lib/Transforms/Scalar/LICM.cpp index 44ef6ea..d204654 100644 --- a/llvm/lib/Transforms/Scalar/LICM.cpp +++ b/llvm/lib/Transforms/Scalar/LICM.cpp @@ -480,6 +480,7 @@ bool llvm::sinkRegion(DomTreeNode *N, AliasAnalysis *AA, LoopInfo *LI, return Changed; } +namespace { // This is a helper class for hoistRegion to make it able to hoist control flow // in order to be able to hoist phis. The way this works is that we initially // start hoisting to the loop preheader, and when we see a loop invariant branch @@ -706,6 +707,7 @@ public: return HoistDestinationMap[BB]; } }; +} // namespace /// Walk the specified region of the CFG (defined by all blocks dominated by /// the specified block, and that are in the current loop) in depth first diff --git a/llvm/lib/Transforms/Scalar/LoopSimplifyCFG.cpp b/llvm/lib/Transforms/Scalar/LoopSimplifyCFG.cpp index c846165..2e5927f 100644 --- a/llvm/lib/Transforms/Scalar/LoopSimplifyCFG.cpp +++ b/llvm/lib/Transforms/Scalar/LoopSimplifyCFG.cpp @@ -80,6 +80,7 @@ static BasicBlock *getOnlyLiveSuccessor(BasicBlock *BB) { return nullptr; } +namespace { /// Helper class that can turn branches and switches with constant conditions /// into unconditional branches. class ConstantTerminatorFoldingImpl { @@ -538,6 +539,7 @@ public: return true; } }; +} // namespace /// Turn branches and switches with known constant conditions into unconditional /// branches. -- 2.7.4