From 844731a7f1909f55935e3514c9e713a62d67662e Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Tue, 13 May 2008 00:00:25 +0000 Subject: Clean up the use of static and anonymous namespaces. This turned up several things that were neither in an anonymous namespace nor static but not intended to be global. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51017 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Instrumentation/BlockProfiling.cpp | 22 +++++++------- lib/Transforms/Instrumentation/EdgeProfiling.cpp | 8 +++--- lib/Transforms/Instrumentation/RSProfiling.cpp | 35 +++++++++++++---------- 3 files changed, 35 insertions(+), 30 deletions(-) (limited to 'lib/Transforms/Instrumentation') diff --git a/lib/Transforms/Instrumentation/BlockProfiling.cpp b/lib/Transforms/Instrumentation/BlockProfiling.cpp index 7068db281d..acde01888c 100644 --- a/lib/Transforms/Instrumentation/BlockProfiling.cpp +++ b/lib/Transforms/Instrumentation/BlockProfiling.cpp @@ -36,14 +36,14 @@ namespace { static char ID; bool runOnModule(Module &M); }; +} - char FunctionProfiler::ID = 0; - - RegisterPass X("insert-function-profiling", - "Insert instrumentation for function profiling"); - RegisterAnalysisGroup XG(X); +char FunctionProfiler::ID = 0; -} +static RegisterPass +X("insert-function-profiling", + "Insert instrumentation for function profiling"); +static RegisterAnalysisGroup XG(X); ModulePass *llvm::createFunctionProfilerPass() { return new FunctionProfiler(); @@ -86,13 +86,13 @@ namespace { public: static char ID; }; - - char BlockProfiler::ID = 0; - RegisterPass Y("insert-block-profiling", - "Insert instrumentation for block profiling"); - RegisterAnalysisGroup YG(Y); } +char BlockProfiler::ID = 0; +static RegisterPass +Y("insert-block-profiling", "Insert instrumentation for block profiling"); +static RegisterAnalysisGroup YG(Y); + ModulePass *llvm::createBlockProfilerPass() { return new BlockProfiler(); } bool BlockProfiler::runOnModule(Module &M) { diff --git a/lib/Transforms/Instrumentation/EdgeProfiling.cpp b/lib/Transforms/Instrumentation/EdgeProfiling.cpp index 72f43e5124..2cf824b25f 100644 --- a/lib/Transforms/Instrumentation/EdgeProfiling.cpp +++ b/lib/Transforms/Instrumentation/EdgeProfiling.cpp @@ -36,12 +36,12 @@ namespace { static char ID; // Pass identification, replacement for typeid EdgeProfiler() : ModulePass((intptr_t)&ID) {} }; - - char EdgeProfiler::ID = 0; - RegisterPass X("insert-edge-profiling", - "Insert instrumentation for edge profiling"); } +char EdgeProfiler::ID = 0; +static RegisterPass +X("insert-edge-profiling", "Insert instrumentation for edge profiling"); + ModulePass *llvm::createEdgeProfilerPass() { return new EdgeProfiler(); } bool EdgeProfiler::runOnModule(Module &M) { diff --git a/lib/Transforms/Instrumentation/RSProfiling.cpp b/lib/Transforms/Instrumentation/RSProfiling.cpp index c22a29ff7a..62c9ddd6b2 100644 --- a/lib/Transforms/Instrumentation/RSProfiling.cpp +++ b/lib/Transforms/Instrumentation/RSProfiling.cpp @@ -55,16 +55,18 @@ namespace { enum RandomMeth { GBV, GBVO, HOSTCC }; +} - static cl::opt RandomMethod("profile-randomness", - cl::desc("How to randomly choose to profile:"), - cl::values( - clEnumValN(GBV, "global", "global counter"), - clEnumValN(GBVO, "ra_global", - "register allocated global counter"), - clEnumValN(HOSTCC, "rdcc", "cycle counter"), - clEnumValEnd)); +static cl::opt RandomMethod("profile-randomness", + cl::desc("How to randomly choose to profile:"), + cl::values( + clEnumValN(GBV, "global", "global counter"), + clEnumValN(GBVO, "ra_global", + "register allocated global counter"), + clEnumValN(HOSTCC, "rdcc", "cycle counter"), + clEnumValEnd)); +namespace { /// NullProfilerRS - The basic profiler that does nothing. It is the default /// profiler and thus terminates RSProfiler chains. It is useful for /// measuring framework overhead @@ -81,12 +83,14 @@ namespace { AU.setPreservesAll(); } }; +} - static RegisterAnalysisGroup A("Profiling passes"); - static RegisterPass NP("insert-null-profiling-rs", - "Measure profiling framework overhead"); - static RegisterAnalysisGroup NPT(NP); +static RegisterAnalysisGroup A("Profiling passes"); +static RegisterPass NP("insert-null-profiling-rs", + "Measure profiling framework overhead"); +static RegisterAnalysisGroup NPT(NP); +namespace { /// Chooser - Something that chooses when to make a sample of the profiled code class VISIBILITY_HIDDEN Chooser { public: @@ -158,11 +162,12 @@ namespace { bool doInitialization(Module &M); virtual void getAnalysisUsage(AnalysisUsage &AU) const; }; - - RegisterPass X("insert-rs-profiling-framework", - "Insert random sampling instrumentation framework"); } +static RegisterPass +X("insert-rs-profiling-framework", + "Insert random sampling instrumentation framework"); + char RSProfilers::ID = 0; char NullProfilerRS::ID = 0; char ProfilerRS::ID = 0; -- cgit v1.2.3