Make classes in anonymous namespaces use VISIBILITY_HIDDEN to help reduce
authorReid Spencer <rspencer@reidspencer.com>
Mon, 5 Feb 2007 23:42:17 +0000 (23:42 +0000)
committerReid Spencer <rspencer@reidspencer.com>
Mon, 5 Feb 2007 23:42:17 +0000 (23:42 +0000)
LLVM's footprint and speed up linking.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33941 91177308-0d34-0410-b5e6-96231b3b80d8

14 files changed:
lib/Analysis/AliasAnalysisCounter.cpp
lib/Analysis/AliasAnalysisEvaluator.cpp
lib/Analysis/AliasDebugger.cpp
lib/Analysis/AliasSetTracker.cpp
lib/Analysis/BasicAliasAnalysis.cpp
lib/Analysis/CFGPrinter.cpp
lib/Analysis/IPA/Andersens.cpp
lib/Analysis/IPA/CallGraph.cpp
lib/Analysis/IPA/GlobalsModRef.cpp
lib/Analysis/InstCount.cpp
lib/Analysis/LoadValueNumbering.cpp
lib/Analysis/ProfileInfo.cpp
lib/Analysis/ProfileInfoLoaderPass.cpp
lib/Analysis/ValueNumbering.cpp

index d3f0dd0be0f1c7c15b8edca807316885b44d9c12..fcd5edc768b7256986e04d91aafa6ae8bba49f9a 100644 (file)
@@ -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<bool>
   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;
index 0f27974c5b37f2150e1701661571eb5c6d68f9c8..73ea423c45fdf6086fa32c9d2a005988fdf3d70c 100644 (file)
@@ -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 <set>
 using namespace llvm;
@@ -44,7 +45,7 @@ namespace {
   cl::opt<bool> PrintRef("print-ref", cl::ReallyHidden);
   cl::opt<bool> PrintModRef("print-modref", cl::ReallyHidden);
 
-  class AAEval : public FunctionPass {
+  class VISIBILITY_HIDDEN AAEval : public FunctionPass {
     unsigned NoAlias, MayAlias, MustAlias;
     unsigned NoModRef, Mod, Ref, ModRef;
 
index d9da70d52162d6075165d12d22001ab70239ba73..3f7f1cccae094089bf21c27ca62e993108a42acd 100644 (file)
 #include "llvm/Constants.h"
 #include "llvm/DerivedTypes.h"
 #include "llvm/Analysis/AliasAnalysis.h"
+#include "llvm/Support/Compiler.h"
 #include <set>
 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.
index 9ab2b8ad2623542636f990cbe1ab5fc07c66afa4..9564326685b0b854cc67fc7e785777ce2fc64131 100644 (file)
@@ -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 {
index 2626ce085bf9a6cb86c35185ae5ea8b03ede4949..e6b81be17204c1bb942c9b4b71360012d2a7b3c5 100644 (file)
@@ -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;
     }
index f16dca833cd5fb17f241e3c470debb83291d71fd..a57a0685a7e7ae6863219194fd6db28786b0d225 100644 (file)
@@ -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 <iosfwd>
@@ -89,7 +90,7 @@ struct DOTGraphTraits<const Function*> : 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<CFGPrinter> 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;
index aa2188bc951009b676a1a846e56150aaafa86d12..52b19194e1b0daae44b929f1218cb02b675802f4 100644 (file)
@@ -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<Andersens> {
+  class VISIBILITY_HIDDEN Andersens : public ModulePass, public AliasAnalysis,
+                                      private InstVisitor<Andersens> {
     /// 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 {
index f69696ebc98a0c9e7fc12f2f9d34b68cc5ac1c2e..bb96bb2d654ef2d36b626335dfe3ccbd271d2ff0 100644 (file)
@@ -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 <ostream>
 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.
   //
index 6ac040b56fb87862a7ee91ec24ecfbc95f38d392..8d41751b88d5b8712166544e6b4f20b4b2fa9522 100644 (file)
@@ -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 <set>
@@ -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<GlobalValue*> NonAddressTakenGlobals;
index 090dcdd57793ee33a3b6e5dd76503237f2971484..e075fee9f6a391380bc435eaa3c24d5107b262c7 100644 (file)
@@ -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<InstCount> {
+  class VISIBILITY_HIDDEN InstCount 
+      : public FunctionPass, public InstVisitor<InstCount> {
     friend class InstVisitor<InstCount>;
 
     void visitFunction  (Function &F) { ++TotalFuncs; }
index 3fbf23806ce60fcb17796f87e06d5de1534ec089..98b9825b030ea6c4f7eb09a98ba61a695e4c1ea2 100644 (file)
@@ -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 <set>
 #include <algorithm>
@@ -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.
     ///
index c35d00ca05995443064eb2b11bf0d92ae3e4cedb..719eeada15aac0b99de951f2d4c76a092c5a5472 100644 (file)
@@ -16,6 +16,7 @@
 #include "llvm/Analysis/ProfileInfo.h"
 #include "llvm/Pass.h"
 #include "llvm/Support/CFG.h"
+#include "llvm/Support/Compiler.h"
 #include <set>
 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<NoProfileInfo>
index 426bd18746e80a4993010bc139e383d700f8fb3e..9a597a27e4c0f5a51f096deac4312e095607bebf 100644 (file)
@@ -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 = "")
index 5c57fb74a4f3b9d52b0165c7e19bf4900ede956e..963ccb90f3ea7cacb9c3680d9c21b77789556318 100644 (file)
@@ -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<BVNImpl> {
+  struct VISIBILITY_HIDDEN BVNImpl : public InstVisitor<BVNImpl> {
     std::vector<Value*> &RetVals;
     BVNImpl(std::vector<Value*> &RV) : RetVals(RV) {}