From d7d83db5f22d05e5b14b6b1d838668222113c83a Mon Sep 17 00:00:00 2001 From: Reid Spencer Date: Mon, 5 Feb 2007 23:42:17 +0000 Subject: [PATCH] Make classes in anonymous namespaces use VISIBILITY_HIDDEN to help reduce LLVM's footprint and speed up linking. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33941 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Analysis/AliasAnalysisCounter.cpp | 4 +++- lib/Analysis/AliasAnalysisEvaluator.cpp | 3 ++- lib/Analysis/AliasDebugger.cpp | 4 +++- lib/Analysis/AliasSetTracker.cpp | 3 ++- lib/Analysis/BasicAliasAnalysis.cpp | 2 +- lib/Analysis/CFGPrinter.cpp | 5 +++-- lib/Analysis/IPA/Andersens.cpp | 5 +++-- lib/Analysis/IPA/CallGraph.cpp | 3 ++- lib/Analysis/IPA/GlobalsModRef.cpp | 8 +++++--- lib/Analysis/InstCount.cpp | 4 +++- lib/Analysis/LoadValueNumbering.cpp | 3 ++- lib/Analysis/ProfileInfo.cpp | 4 +++- lib/Analysis/ProfileInfoLoaderPass.cpp | 3 ++- lib/Analysis/ValueNumbering.cpp | 6 ++++-- 14 files changed, 38 insertions(+), 19 deletions(-) diff --git a/lib/Analysis/AliasAnalysisCounter.cpp b/lib/Analysis/AliasAnalysisCounter.cpp index d3f0dd0be0f..fcd5edc768b 100644 --- a/lib/Analysis/AliasAnalysisCounter.cpp +++ b/lib/Analysis/AliasAnalysisCounter.cpp @@ -17,6 +17,7 @@ #include "llvm/Analysis/AliasAnalysis.h" #include "llvm/Assembly/Writer.h" #include "llvm/Support/CommandLine.h" +#include "llvm/Support/Compiler.h" #include "llvm/Support/Streams.h" using namespace llvm; @@ -26,7 +27,8 @@ namespace { cl::opt PrintAllFailures("count-aa-print-all-failed-queries", cl::ReallyHidden); - class AliasAnalysisCounter : public ModulePass, public AliasAnalysis { + class VISIBILITY_HIDDEN AliasAnalysisCounter + : public ModulePass, public AliasAnalysis { unsigned No, May, Must; unsigned NoMR, JustRef, JustMod, MR; const char *Name; diff --git a/lib/Analysis/AliasAnalysisEvaluator.cpp b/lib/Analysis/AliasAnalysisEvaluator.cpp index 0f27974c5b3..73ea423c45f 100644 --- a/lib/Analysis/AliasAnalysisEvaluator.cpp +++ b/lib/Analysis/AliasAnalysisEvaluator.cpp @@ -28,6 +28,7 @@ #include "llvm/Target/TargetData.h" #include "llvm/Support/InstIterator.h" #include "llvm/Support/CommandLine.h" +#include "llvm/Support/Compiler.h" #include "llvm/Support/Streams.h" #include using namespace llvm; @@ -44,7 +45,7 @@ namespace { cl::opt PrintRef("print-ref", cl::ReallyHidden); cl::opt PrintModRef("print-modref", cl::ReallyHidden); - class AAEval : public FunctionPass { + class VISIBILITY_HIDDEN AAEval : public FunctionPass { unsigned NoAlias, MayAlias, MustAlias; unsigned NoModRef, Mod, Ref, ModRef; diff --git a/lib/Analysis/AliasDebugger.cpp b/lib/Analysis/AliasDebugger.cpp index d9da70d5216..3f7f1cccae0 100644 --- a/lib/Analysis/AliasDebugger.cpp +++ b/lib/Analysis/AliasDebugger.cpp @@ -23,12 +23,14 @@ #include "llvm/Constants.h" #include "llvm/DerivedTypes.h" #include "llvm/Analysis/AliasAnalysis.h" +#include "llvm/Support/Compiler.h" #include using namespace llvm; namespace { - class AliasDebugger : public ModulePass, public AliasAnalysis { + class VISIBILITY_HIDDEN AliasDebugger + : public ModulePass, public AliasAnalysis { //What we do is simple. Keep track of every value the AA could //know about, and verify that queries are one of those. diff --git a/lib/Analysis/AliasSetTracker.cpp b/lib/Analysis/AliasSetTracker.cpp index 9ab2b8ad262..9564326685b 100644 --- a/lib/Analysis/AliasSetTracker.cpp +++ b/lib/Analysis/AliasSetTracker.cpp @@ -18,6 +18,7 @@ #include "llvm/Type.h" #include "llvm/Target/TargetData.h" #include "llvm/Assembly/Writer.h" +#include "llvm/Support/Compiler.h" #include "llvm/Support/InstIterator.h" #include "llvm/Support/Streams.h" using namespace llvm; @@ -551,7 +552,7 @@ void AliasSetTracker::dump() const { print(cerr); } //===----------------------------------------------------------------------===// namespace { - class AliasSetPrinter : public FunctionPass { + class VISIBILITY_HIDDEN AliasSetPrinter : public FunctionPass { AliasSetTracker *Tracker; public: virtual void getAnalysisUsage(AnalysisUsage &AU) const { diff --git a/lib/Analysis/BasicAliasAnalysis.cpp b/lib/Analysis/BasicAliasAnalysis.cpp index 2626ce085bf..e6b81be1720 100644 --- a/lib/Analysis/BasicAliasAnalysis.cpp +++ b/lib/Analysis/BasicAliasAnalysis.cpp @@ -745,7 +745,7 @@ BasicAliasAnalysis::CheckGEPInstructions( } namespace { - struct StringCompare { + struct VISIBILITY_HIDDEN StringCompare { bool operator()(const char *LHS, const char *RHS) { return strcmp(LHS, RHS) < 0; } diff --git a/lib/Analysis/CFGPrinter.cpp b/lib/Analysis/CFGPrinter.cpp index f16dca833cd..a57a0685a7e 100644 --- a/lib/Analysis/CFGPrinter.cpp +++ b/lib/Analysis/CFGPrinter.cpp @@ -23,6 +23,7 @@ #include "llvm/Analysis/CFGPrinter.h" #include "llvm/Assembly/Writer.h" #include "llvm/Support/CFG.h" +#include "llvm/Support/Compiler.h" #include "llvm/Support/GraphWriter.h" #include "llvm/Config/config.h" #include @@ -89,7 +90,7 @@ struct DOTGraphTraits : public DefaultDOTGraphTraits { } namespace { - struct CFGPrinter : public FunctionPass { + struct VISIBILITY_HIDDEN CFGPrinter : public FunctionPass { virtual bool runOnFunction(Function &F) { std::string Filename = "cfg." + F.getName() + ".dot"; cerr << "Writing '" << Filename << "'..."; @@ -113,7 +114,7 @@ namespace { RegisterPass P1("print-cfg", "Print CFG of function to 'dot' file"); - struct CFGOnlyPrinter : public CFGPrinter { + struct VISIBILITY_HIDDEN CFGOnlyPrinter : public CFGPrinter { virtual bool runOnFunction(Function &F) { bool OldCFGOnly = CFGOnly; CFGOnly = true; diff --git a/lib/Analysis/IPA/Andersens.cpp b/lib/Analysis/IPA/Andersens.cpp index aa2188bc951..52b19194e1b 100644 --- a/lib/Analysis/IPA/Andersens.cpp +++ b/lib/Analysis/IPA/Andersens.cpp @@ -55,6 +55,7 @@ #include "llvm/Instructions.h" #include "llvm/Module.h" #include "llvm/Pass.h" +#include "llvm/Support/Compiler.h" #include "llvm/Support/InstIterator.h" #include "llvm/Support/InstVisitor.h" #include "llvm/Analysis/AliasAnalysis.h" @@ -71,8 +72,8 @@ STATISTIC(NumEscapingFunctions, "Number of internal functions that escape"); STATISTIC(NumIndirectCallees , "Number of indirect callees found"); namespace { - class Andersens : public ModulePass, public AliasAnalysis, - private InstVisitor { + class VISIBILITY_HIDDEN Andersens : public ModulePass, public AliasAnalysis, + private InstVisitor { /// Node class - This class is used to represent a memory object in the /// program, and is the primitive used to build the points-to graph. class Node { diff --git a/lib/Analysis/IPA/CallGraph.cpp b/lib/Analysis/IPA/CallGraph.cpp index f69696ebc98..bb96bb2d654 100644 --- a/lib/Analysis/IPA/CallGraph.cpp +++ b/lib/Analysis/IPA/CallGraph.cpp @@ -16,6 +16,7 @@ #include "llvm/Module.h" #include "llvm/Instructions.h" #include "llvm/Support/CallSite.h" +#include "llvm/Support/Compiler.h" #include "llvm/Support/Streams.h" #include using namespace llvm; @@ -35,7 +36,7 @@ namespace { //===----------------------------------------------------------------------===// // BasicCallGraph class definition // -class BasicCallGraph : public CallGraph, public ModulePass { +class VISIBILITY_HIDDEN BasicCallGraph : public CallGraph, public ModulePass { // Root is root of the call graph, or the external node if a 'main' function // couldn't be found. // diff --git a/lib/Analysis/IPA/GlobalsModRef.cpp b/lib/Analysis/IPA/GlobalsModRef.cpp index 6ac040b56fb..8d41751b88d 100644 --- a/lib/Analysis/IPA/GlobalsModRef.cpp +++ b/lib/Analysis/IPA/GlobalsModRef.cpp @@ -23,8 +23,9 @@ #include "llvm/DerivedTypes.h" #include "llvm/Analysis/AliasAnalysis.h" #include "llvm/Analysis/CallGraph.h" -#include "llvm/Support/InstIterator.h" +#include "llvm/Support/Compiler.h" #include "llvm/Support/CommandLine.h" +#include "llvm/Support/InstIterator.h" #include "llvm/ADT/Statistic.h" #include "llvm/ADT/SCCIterator.h" #include @@ -42,7 +43,7 @@ namespace { /// function in the program. Later, the entries for these functions are /// removed if the function is found to call an external function (in which /// case we know nothing about it. - struct FunctionRecord { + struct VISIBILITY_HIDDEN FunctionRecord { /// GlobalInfo - Maintain mod/ref info for all of the globals without /// addresses taken that are read or written (transitively) by this /// function. @@ -63,7 +64,8 @@ namespace { }; /// GlobalsModRef - The actual analysis pass. - class GlobalsModRef : public ModulePass, public AliasAnalysis { + class VISIBILITY_HIDDEN GlobalsModRef + : public ModulePass, public AliasAnalysis { /// NonAddressTakenGlobals - The globals that do not have their addresses /// taken. std::set NonAddressTakenGlobals; diff --git a/lib/Analysis/InstCount.cpp b/lib/Analysis/InstCount.cpp index 090dcdd5779..e075fee9f6a 100644 --- a/lib/Analysis/InstCount.cpp +++ b/lib/Analysis/InstCount.cpp @@ -15,6 +15,7 @@ #include "llvm/Analysis/Passes.h" #include "llvm/Pass.h" #include "llvm/Function.h" +#include "llvm/Support/Compiler.h" #include "llvm/Support/InstVisitor.h" #include "llvm/Support/Streams.h" #include "llvm/ADT/Statistic.h" @@ -33,7 +34,8 @@ STATISTIC(TotalMemInst, "Number of memory instructions"); namespace { - class InstCount : public FunctionPass, public InstVisitor { + class VISIBILITY_HIDDEN InstCount + : public FunctionPass, public InstVisitor { friend class InstVisitor; void visitFunction (Function &F) { ++TotalFuncs; } diff --git a/lib/Analysis/LoadValueNumbering.cpp b/lib/Analysis/LoadValueNumbering.cpp index 3fbf23806ce..98b9825b030 100644 --- a/lib/Analysis/LoadValueNumbering.cpp +++ b/lib/Analysis/LoadValueNumbering.cpp @@ -31,6 +31,7 @@ #include "llvm/Analysis/AliasAnalysis.h" #include "llvm/Analysis/Dominators.h" #include "llvm/Support/CFG.h" +#include "llvm/Support/Compiler.h" #include "llvm/Target/TargetData.h" #include #include @@ -38,7 +39,7 @@ using namespace llvm; namespace { // FIXME: This should not be a FunctionPass. - struct LoadVN : public FunctionPass, public ValueNumbering { + struct VISIBILITY_HIDDEN LoadVN : public FunctionPass, public ValueNumbering { /// Pass Implementation stuff. This doesn't do any analysis. /// diff --git a/lib/Analysis/ProfileInfo.cpp b/lib/Analysis/ProfileInfo.cpp index c35d00ca059..719eeada15a 100644 --- a/lib/Analysis/ProfileInfo.cpp +++ b/lib/Analysis/ProfileInfo.cpp @@ -16,6 +16,7 @@ #include "llvm/Analysis/ProfileInfo.h" #include "llvm/Pass.h" #include "llvm/Support/CFG.h" +#include "llvm/Support/Compiler.h" #include using namespace llvm; @@ -82,7 +83,8 @@ unsigned ProfileInfo::getExecutionCount(BasicBlock *BB) const { // namespace { - struct NoProfileInfo : public ImmutablePass, public ProfileInfo {}; + struct VISIBILITY_HIDDEN NoProfileInfo + : public ImmutablePass, public ProfileInfo {}; // Register this pass... RegisterPass diff --git a/lib/Analysis/ProfileInfoLoaderPass.cpp b/lib/Analysis/ProfileInfoLoaderPass.cpp index 426bd18746e..9a597a27e4c 100644 --- a/lib/Analysis/ProfileInfoLoaderPass.cpp +++ b/lib/Analysis/ProfileInfoLoaderPass.cpp @@ -19,6 +19,7 @@ #include "llvm/Analysis/ProfileInfo.h" #include "llvm/Analysis/ProfileInfoLoader.h" #include "llvm/Support/CommandLine.h" +#include "llvm/Support/Compiler.h" #include "llvm/Support/Streams.h" using namespace llvm; @@ -28,7 +29,7 @@ namespace { cl::value_desc("filename"), cl::desc("Profile file loaded by -profile-loader")); - class LoaderPass : public ModulePass, public ProfileInfo { + class VISIBILITY_HIDDEN LoaderPass : public ModulePass, public ProfileInfo { std::string Filename; public: LoaderPass(const std::string &filename = "") diff --git a/lib/Analysis/ValueNumbering.cpp b/lib/Analysis/ValueNumbering.cpp index 5c57fb74a4f..963ccb90f3e 100644 --- a/lib/Analysis/ValueNumbering.cpp +++ b/lib/Analysis/ValueNumbering.cpp @@ -19,6 +19,7 @@ #include "llvm/Instructions.h" #include "llvm/Pass.h" #include "llvm/Type.h" +#include "llvm/Support/Compiler.h" using namespace llvm; // Register the ValueNumbering interface, providing a nice name to refer to. @@ -48,7 +49,8 @@ namespace { /// lexically identical expressions. This does not require any ahead of time /// analysis, so it is a very fast default implementation. /// - struct BasicVN : public ImmutablePass, public ValueNumbering { + struct VISIBILITY_HIDDEN BasicVN + : public ImmutablePass, public ValueNumbering { /// getEqualNumberNodes - Return nodes with the same value number as the /// specified Value. This fills in the argument vector with any equal /// values. @@ -69,7 +71,7 @@ namespace { /// BVNImpl - Implement BasicVN in terms of a visitor class that /// handles the different types of instructions as appropriate. /// - struct BVNImpl : public InstVisitor { + struct VISIBILITY_HIDDEN BVNImpl : public InstVisitor { std::vector &RetVals; BVNImpl(std::vector &RV) : RetVals(RV) {} -- 2.34.1