OSDN Git Service

Clean up the use of static and anonymous namespaces. This turned up
authorDan Gohman <gohman@apple.com>
Tue, 13 May 2008 00:00:25 +0000 (00:00 +0000)
committerDan Gohman <gohman@apple.com>
Tue, 13 May 2008 00:00:25 +0000 (00:00 +0000)
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

124 files changed:
lib/Analysis/AliasAnalysis.cpp
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/CallGraphSCCPass.cpp
lib/Analysis/IPA/GlobalsModRef.cpp
lib/Analysis/InstCount.cpp
lib/Analysis/LoadValueNumbering.cpp
lib/Analysis/MemoryDependenceAnalysis.cpp
lib/Analysis/ProfileInfo.cpp
lib/Analysis/ProfileInfoLoaderPass.cpp
lib/Analysis/ScalarEvolution.cpp
lib/Analysis/ValueNumbering.cpp
lib/Archive/ArchiveReader.cpp
lib/Archive/ArchiveWriter.cpp
lib/Bitcode/Writer/ValueEnumerator.cpp
lib/CodeGen/BranchFolding.cpp
lib/CodeGen/CollectorMetadata.cpp
lib/CodeGen/LiveIntervalAnalysis.cpp
lib/CodeGen/MachineDominators.cpp
lib/CodeGen/MachineLICM.cpp
lib/CodeGen/MachineLoopInfo.cpp
lib/CodeGen/MachineModuleInfo.cpp
lib/CodeGen/MachineSink.cpp
lib/CodeGen/OcamlCollector.cpp
lib/CodeGen/PHIElimination.cpp
lib/CodeGen/Passes.cpp
lib/CodeGen/RegAllocBigBlock.cpp
lib/CodeGen/RegAllocLocal.cpp
lib/CodeGen/RegisterCoalescer.cpp
lib/CodeGen/SelectionDAG/SelectionDAG.cpp
lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
lib/CodeGen/ShadowStackCollector.cpp
lib/CodeGen/SimpleRegisterCoalescing.cpp
lib/CodeGen/StrongPHIElimination.cpp
lib/CodeGen/TwoAddressInstructionPass.cpp
lib/CodeGen/UnreachableBlockElim.cpp
lib/CodeGen/VirtRegMap.cpp
lib/ExecutionEngine/Interpreter/Interpreter.cpp
lib/ExecutionEngine/JIT/JIT.cpp
lib/ExecutionEngine/JIT/JITDwarfEmitter.cpp
lib/Support/Statistic.cpp
lib/System/Unix/Unix.h
lib/Target/ARM/ARMTargetMachine.cpp
lib/Target/Alpha/AlphaTargetMachine.cpp
lib/Target/CBackend/CBackend.cpp
lib/Target/CellSPU/SPUISelDAGToDAG.cpp
lib/Target/CppBackend/CPPBackend.cpp
lib/Target/IA64/IA64TargetMachine.cpp
lib/Target/MSIL/MSILWriter.cpp
lib/Target/Mips/MipsTargetMachine.cpp
lib/Target/PowerPC/PPCISelLowering.cpp
lib/Target/PowerPC/PPCTargetMachine.cpp
lib/Target/Sparc/SparcTargetMachine.cpp
lib/Target/TargetData.cpp
lib/Target/TargetMachine.cpp
lib/Target/X86/X86Subtarget.cpp
lib/Target/X86/X86TargetMachine.cpp
lib/Transforms/Hello/Hello.cpp
lib/Transforms/IPO/ArgumentPromotion.cpp
lib/Transforms/IPO/ConstantMerge.cpp
lib/Transforms/IPO/DeadArgumentElimination.cpp
lib/Transforms/IPO/DeadTypeElimination.cpp
lib/Transforms/IPO/GlobalDCE.cpp
lib/Transforms/IPO/GlobalOpt.cpp
lib/Transforms/IPO/IPConstantPropagation.cpp
lib/Transforms/IPO/IndMemRemoval.cpp
lib/Transforms/IPO/InlineSimple.cpp
lib/Transforms/IPO/Inliner.cpp
lib/Transforms/IPO/Internalize.cpp
lib/Transforms/IPO/LoopExtractor.cpp
lib/Transforms/IPO/LowerSetJmp.cpp
lib/Transforms/IPO/PruneEH.cpp
lib/Transforms/IPO/RaiseAllocations.cpp
lib/Transforms/IPO/StripDeadPrototypes.cpp
lib/Transforms/IPO/StripSymbols.cpp
lib/Transforms/IPO/StructRetPromotion.cpp
lib/Transforms/Instrumentation/BlockProfiling.cpp
lib/Transforms/Instrumentation/EdgeProfiling.cpp
lib/Transforms/Instrumentation/RSProfiling.cpp
lib/Transforms/Scalar/ADCE.cpp
lib/Transforms/Scalar/BasicBlockPlacement.cpp
lib/Transforms/Scalar/CodeGenPrepare.cpp
lib/Transforms/Scalar/CondPropagate.cpp
lib/Transforms/Scalar/ConstantProp.cpp
lib/Transforms/Scalar/DCE.cpp
lib/Transforms/Scalar/DeadStoreElimination.cpp
lib/Transforms/Scalar/GCSE.cpp
lib/Transforms/Scalar/GVNPRE.cpp
lib/Transforms/Scalar/IndVarSimplify.cpp
lib/Transforms/Scalar/InstructionCombining.cpp
lib/Transforms/Scalar/JumpThreading.cpp
lib/Transforms/Scalar/LICM.cpp
lib/Transforms/Scalar/LoopDeletion.cpp
lib/Transforms/Scalar/LoopIndexSplit.cpp
lib/Transforms/Scalar/LoopRotation.cpp
lib/Transforms/Scalar/LoopStrengthReduce.cpp
lib/Transforms/Scalar/LoopUnroll.cpp
lib/Transforms/Scalar/LoopUnswitch.cpp
lib/Transforms/Scalar/PredicateSimplifier.cpp
lib/Transforms/Scalar/Reassociate.cpp
lib/Transforms/Scalar/Reg2Mem.cpp
lib/Transforms/Scalar/SCCP.cpp
lib/Transforms/Scalar/ScalarReplAggregates.cpp
lib/Transforms/Scalar/SimplifyCFG.cpp
lib/Transforms/Scalar/TailDuplication.cpp
lib/Transforms/Scalar/TailRecursionElimination.cpp
lib/Transforms/Utils/BasicInliner.cpp
lib/Transforms/Utils/BreakCriticalEdges.cpp
lib/Transforms/Utils/LCSSA.cpp
lib/Transforms/Utils/LoopSimplify.cpp
lib/Transforms/Utils/LowerAllocations.cpp
lib/Transforms/Utils/LowerInvoke.cpp
lib/Transforms/Utils/LowerSwitch.cpp
lib/Transforms/Utils/Mem2Reg.cpp
lib/VMCore/Constants.cpp
lib/VMCore/PassManager.cpp
lib/VMCore/Type.cpp
lib/VMCore/Verifier.cpp

index 04ad7de..be42f74 100644 (file)
@@ -34,9 +34,7 @@
 using namespace llvm;
 
 // Register the AliasAnalysis interface, providing a nice name to refer to.
-namespace {
-  RegisterAnalysisGroup<AliasAnalysis> Z("Alias Analysis");
-}
+static RegisterAnalysisGroup<AliasAnalysis> Z("Alias Analysis");
 char AliasAnalysis::ID = 0;
 
 //===----------------------------------------------------------------------===//
index 9c42902..48f00ad 100644 (file)
 #include "llvm/Support/Streams.h"
 using namespace llvm;
 
-namespace {
-  static cl::opt<bool>
-  PrintAll("count-aa-print-all-queries", cl::ReallyHidden);
-  static cl::opt<bool>
-  PrintAllFailures("count-aa-print-all-failed-queries", cl::ReallyHidden);
+static cl::opt<bool>
+PrintAll("count-aa-print-all-queries", cl::ReallyHidden);
+static cl::opt<bool>
+PrintAllFailures("count-aa-print-all-failed-queries", cl::ReallyHidden);
 
+namespace {
   class VISIBILITY_HIDDEN AliasAnalysisCounter 
       : public ModulePass, public AliasAnalysis {
     unsigned No, May, Must;
@@ -113,13 +113,13 @@ namespace {
       return AliasAnalysis::getModRefInfo(CS1,CS2);
     }
   };
-
-  char AliasAnalysisCounter::ID = 0;
-  RegisterPass<AliasAnalysisCounter>
-  X("count-aa", "Count Alias Analysis Query Responses", false, true);
-  RegisterAnalysisGroup<AliasAnalysis> Y(X);
 }
 
+char AliasAnalysisCounter::ID = 0;
+static RegisterPass<AliasAnalysisCounter>
+X("count-aa", "Count Alias Analysis Query Responses", false, true);
+static RegisterAnalysisGroup<AliasAnalysis> Y(X);
+
 ModulePass *llvm::createAliasAnalysisCounterPass() {
   return new AliasAnalysisCounter();
 }
index 704ab82..af15d0f 100644 (file)
 #include <sstream>
 using namespace llvm;
 
-namespace {
-  static cl::opt<bool>
-  PrintAll("print-all-alias-modref-info", cl::ReallyHidden);
+static cl::opt<bool> PrintAll("print-all-alias-modref-info", cl::ReallyHidden);
 
-  static cl::opt<bool> PrintNoAlias("print-no-aliases", cl::ReallyHidden);
-  static cl::opt<bool> PrintMayAlias("print-may-aliases", cl::ReallyHidden);
-  static cl::opt<bool> PrintMustAlias("print-must-aliases", cl::ReallyHidden);
+static cl::opt<bool> PrintNoAlias("print-no-aliases", cl::ReallyHidden);
+static cl::opt<bool> PrintMayAlias("print-may-aliases", cl::ReallyHidden);
+static cl::opt<bool> PrintMustAlias("print-must-aliases", cl::ReallyHidden);
 
-  static cl::opt<bool> PrintNoModRef("print-no-modref", cl::ReallyHidden);
-  static cl::opt<bool> PrintMod("print-mod", cl::ReallyHidden);
-  static cl::opt<bool> PrintRef("print-ref", cl::ReallyHidden);
-  static cl::opt<bool> PrintModRef("print-modref", cl::ReallyHidden);
+static cl::opt<bool> PrintNoModRef("print-no-modref", cl::ReallyHidden);
+static cl::opt<bool> PrintMod("print-mod", cl::ReallyHidden);
+static cl::opt<bool> PrintRef("print-ref", cl::ReallyHidden);
+static cl::opt<bool> PrintModRef("print-modref", cl::ReallyHidden);
 
+namespace {
   class VISIBILITY_HIDDEN AAEval : public FunctionPass {
     unsigned NoAlias, MayAlias, MustAlias;
     unsigned NoModRef, Mod, Ref, ModRef;
@@ -74,12 +73,12 @@ namespace {
     bool runOnFunction(Function &F);
     bool doFinalization(Module &M);
   };
-
-  char AAEval::ID = 0;
-  static RegisterPass<AAEval>
-  X("aa-eval", "Exhaustive Alias Analysis Precision Evaluator", false, true);
 }
 
+char AAEval::ID = 0;
+static RegisterPass<AAEval>
+X("aa-eval", "Exhaustive Alias Analysis Precision Evaluator", false, true);
+
 FunctionPass *llvm::createAAEvalPass() { return new AAEval(); }
 
 static void PrintResults(const char *Msg, bool P, const Value *V1, const Value *V2,
index 491c4b0..06a43b1 100644 (file)
@@ -121,11 +121,12 @@ namespace {
     }
 
   };
-
-  char AliasDebugger::ID = 0;
-  RegisterPass<AliasDebugger> X("debug-aa", "AA use debugger", false, true);
-  RegisterAnalysisGroup<AliasAnalysis> Y(X);
 }
 
+char AliasDebugger::ID = 0;
+static RegisterPass<AliasDebugger>
+X("debug-aa", "AA use debugger", false, true);
+static RegisterAnalysisGroup<AliasAnalysis> Y(X);
+
 Pass *llvm::createAliasDebugger() { return new AliasDebugger(); }
 
index 01e700b..68603e5 100644 (file)
@@ -585,6 +585,8 @@ namespace {
       return false;
     }
   };
-  char AliasSetPrinter::ID = 0;
-  RegisterPass<AliasSetPrinter> X("print-alias-sets", "Alias Set Printer", false, true);
 }
+
+char AliasSetPrinter::ID = 0;
+static RegisterPass<AliasSetPrinter>
+X("print-alias-sets", "Alias Set Printer", false, true);
index 97dd56a..21108c6 100644 (file)
@@ -79,15 +79,15 @@ namespace {
     virtual void deleteValue(Value *V) {}
     virtual void copyValue(Value *From, Value *To) {}
   };
+}  // End of anonymous namespace
 
-  // Register this pass...
-  char NoAA::ID = 0;
-  RegisterPass<NoAA>
-  U("no-aa", "No Alias Analysis (always returns 'may' alias)", true, true);
+// Register this pass...
+char NoAA::ID = 0;
+static RegisterPass<NoAA>
+U("no-aa", "No Alias Analysis (always returns 'may' alias)", true, true);
 
-  // Declare that we implement the AliasAnalysis interface
-  RegisterAnalysisGroup<AliasAnalysis> V(U);
-}  // End of anonymous namespace
+// Declare that we implement the AliasAnalysis interface
+static RegisterAnalysisGroup<AliasAnalysis> V(U);
 
 ImmutablePass *llvm::createNoAAPass() { return new NoAA(); }
 
@@ -124,15 +124,15 @@ namespace {
                          const Type *BasePtr2Ty,
                          Value **GEP2Ops, unsigned NumGEP2Ops, unsigned G2Size);
   };
+}  // End of anonymous namespace
 
-  // Register this pass...
-  char BasicAliasAnalysis::ID = 0;
-  RegisterPass<BasicAliasAnalysis>
-  X("basicaa", "Basic Alias Analysis (default AA impl)", false, true);
+// Register this pass...
+char BasicAliasAnalysis::ID = 0;
+static RegisterPass<BasicAliasAnalysis>
+X("basicaa", "Basic Alias Analysis (default AA impl)", false, true);
 
-  // Declare that we implement the AliasAnalysis interface
-  RegisterAnalysisGroup<AliasAnalysis, true> Y(X);
-}  // End of anonymous namespace
+// Declare that we implement the AliasAnalysis interface
+static RegisterAnalysisGroup<AliasAnalysis, true> Y(X);
 
 ImmutablePass *llvm::createBasicAliasAnalysisPass() {
   return new BasicAliasAnalysis();
index f293555..e20a0a2 100644 (file)
@@ -105,11 +105,13 @@ namespace {
       AU.setPreservesAll();
     }
   };
+}
 
-  char CFGViewer::ID = 0;
-  RegisterPass<CFGViewer> V0("view-cfg",
-                             "View CFG of function", false, true);
+char CFGViewer::ID = 0;
+static RegisterPass<CFGViewer>
+V0("view-cfg", "View CFG of function", false, true);
 
+namespace {
   struct VISIBILITY_HIDDEN CFGOnlyViewer : public FunctionPass {
     static char ID; // Pass identifcation, replacement for typeid
     CFGOnlyViewer() : FunctionPass((intptr_t)&ID) {}
@@ -127,11 +129,14 @@ namespace {
       AU.setPreservesAll();
     }
   };
+}
 
-  char CFGOnlyViewer::ID = 0;
-  RegisterPass<CFGOnlyViewer> V1("view-cfg-only",
-                                 "View CFG of function (with no function bodies)", false, true);
+char CFGOnlyViewer::ID = 0;
+static RegisterPass<CFGOnlyViewer>
+V1("view-cfg-only",
+   "View CFG of function (with no function bodies)", false, true);
 
+namespace {
   struct VISIBILITY_HIDDEN CFGPrinter : public FunctionPass {
     static char ID; // Pass identification, replacement for typeid
     CFGPrinter() : FunctionPass((intptr_t)&ID) {}
@@ -156,11 +161,13 @@ namespace {
       AU.setPreservesAll();
     }
   };
+}
 
-  char CFGPrinter::ID = 0;
-  RegisterPass<CFGPrinter> P1("print-cfg",
-                              "Print CFG of function to 'dot' file", false, true);
+char CFGPrinter::ID = 0;
+static RegisterPass<CFGPrinter>
+P1("print-cfg", "Print CFG of function to 'dot' file", false, true);
 
+namespace {
   struct VISIBILITY_HIDDEN CFGOnlyPrinter : public CFGPrinter {
     static char ID; // Pass identification, replacement for typeid
     CFGOnlyPrinter() : CFGPrinter((intptr_t)&ID) {}
@@ -177,13 +184,13 @@ namespace {
       AU.setPreservesAll();
     }
   };
-
-  char CFGOnlyPrinter::ID = 0;
-  RegisterPass<CFGOnlyPrinter>
-  P2("print-cfg-only",
-     "Print CFG of function to 'dot' file (with no function bodies)", false, true);
 }
 
+char CFGOnlyPrinter::ID = 0;
+static RegisterPass<CFGOnlyPrinter>
+P2("print-cfg-only",
+   "Print CFG of function to 'dot' file (with no function bodies)", false, true);
+
 /// viewCFG - This function is meant for use from the debugger.  You can just
 /// say 'call F->viewCFG()' and a ghostview window should pop up from the
 /// program, displaying the CFG of the current function.  This depends on there
index ab80bab..823a32f 100644 (file)
@@ -89,14 +89,14 @@ STATISTIC(NumNodes      , "Number of nodes");
 STATISTIC(NumUnified    , "Number of variables unified");
 STATISTIC(NumErased     , "Number of redundant constraints erased");
 
-namespace {
-  const unsigned SelfRep = (unsigned)-1;
-  const unsigned Unvisited = (unsigned)-1;
-  // Position of the function return node relative to the function node.
-  const unsigned CallReturnPos = 1;
-  // Position of the function call node relative to the function node.
-  const unsigned CallFirstArgPos = 2;
+static const unsigned SelfRep = (unsigned)-1;
+static const unsigned Unvisited = (unsigned)-1;
+// Position of the function return node relative to the function node.
+static const unsigned CallReturnPos = 1;
+// Position of the function call node relative to the function node.
+static const unsigned CallFirstArgPos = 2;
 
+namespace {
   struct BitmapKeyInfo {
     static inline SparseBitVector<> *getEmptyKey() {
       return reinterpret_cast<SparseBitVector<> *>(-1);
@@ -608,16 +608,15 @@ namespace {
       PrintPointsToGraph();
     }
   };
+}
 
-  char Andersens::ID = 0;
-  RegisterPass<Andersens> X("anders-aa",
-                            "Andersen's Interprocedural Alias Analysis", false,
-                            true);
-  RegisterAnalysisGroup<AliasAnalysis> Y(X);
+char Andersens::ID = 0;
+static RegisterPass<Andersens>
+X("anders-aa", "Andersen's Interprocedural Alias Analysis", false, true);
+static RegisterAnalysisGroup<AliasAnalysis> Y(X);
 
-  // Initialize Timestamp Counter (static).
-  unsigned Andersens::Node::Counter = 0;
-}
+// Initialize Timestamp Counter (static).
+unsigned Andersens::Node::Counter = 0;
 
 ModulePass *llvm::createAndersensPass() { return new Andersens(); }
 
index f0dd188..eaa0d01 100644 (file)
@@ -190,12 +190,13 @@ private:
   }
 };
 
-RegisterAnalysisGroup<CallGraph> X("Call Graph");
-RegisterPass<BasicCallGraph> Y("basiccg", "Basic CallGraph Construction", false, true);
-RegisterAnalysisGroup<CallGraph, true> Z(Y);
-
 } //End anonymous namespace
 
+static RegisterAnalysisGroup<CallGraph> X("Call Graph");
+static RegisterPass<BasicCallGraph>
+Y("basiccg", "Basic CallGraph Construction", false, true);
+static RegisterAnalysisGroup<CallGraph, true> Z(Y);
+
 char CallGraph::ID = 0;
 char BasicCallGraph::ID = 0;
 
index 99954d6..112f9c2 100644 (file)
@@ -27,6 +27,8 @@ using namespace llvm;
 //
 /// CGPassManager manages FPPassManagers and CalLGraphSCCPasses.
 
+namespace {
+
 class CGPassManager : public ModulePass, public PMDataManager {
 
 public:
@@ -73,6 +75,8 @@ public:
   }
 };
 
+}
+
 char CGPassManager::ID = 0;
 /// run - Execute all of the passes scheduled for execution.  Keep track of
 /// whether any of the passes modifies the module, and if so, return true.
index 6ce3209..6d62820 100644 (file)
@@ -146,14 +146,13 @@ namespace {
                               GlobalValue *OkayStoreDest = 0);
     bool AnalyzeIndirectGlobalMemory(GlobalValue *GV);
   };
-
-  char GlobalsModRef::ID = 0;
-  RegisterPass<GlobalsModRef> X("globalsmodref-aa",
-                                "Simple mod/ref analysis for globals", false,
-                                true);
-  RegisterAnalysisGroup<AliasAnalysis> Y(X);
 }
 
+char GlobalsModRef::ID = 0;
+static RegisterPass<GlobalsModRef>
+X("globalsmodref-aa", "Simple mod/ref analysis for globals", false, true);
+static RegisterAnalysisGroup<AliasAnalysis> Y(X);
+
 Pass *llvm::createGlobalsModRefPass() { return new GlobalsModRef(); }
 
 /// getUnderlyingObject - This traverses the use chain to figure out what object
index c4f36d3..5f33a60 100644 (file)
@@ -62,12 +62,12 @@ namespace {
     virtual void print(std::ostream &O, const Module *M) const {}
 
   };
-
-  char InstCount::ID = 0;
-  RegisterPass<InstCount> X("instcount",
-                            "Counts the various types of Instructions", false, true);
 }
 
+char InstCount::ID = 0;
+static RegisterPass<InstCount>
+X("instcount", "Counts the various types of Instructions", false, true);
+
 FunctionPass *llvm::createInstCountPass() { return new InstCount(); }
 
 // InstCount::run - This is the main Analysis entry point for a
index bbb1e1e..0317ddb 100644 (file)
@@ -82,14 +82,15 @@ namespace {
     void getCallEqualNumberNodes(CallInst *CI,
                                  std::vector<Value*> &RetVals) const;
   };
+}
 
-  char LoadVN::ID = 0;
-  // Register this pass...
-  RegisterPass<LoadVN> X("load-vn", "Load Value Numbering", false, true);
+char LoadVN::ID = 0;
+// Register this pass...
+static RegisterPass<LoadVN>
+X("load-vn", "Load Value Numbering", false, true);
 
-  // Declare that we implement the ValueNumbering interface
-  RegisterAnalysisGroup<ValueNumbering> Y(X);
-}
+// Declare that we implement the ValueNumbering interface
+static RegisterAnalysisGroup<ValueNumbering> Y(X);
 
 FunctionPass *llvm::createLoadValueNumberingPass() { return new LoadVN(); }
 
index 8a59c3a..4af7b42 100644 (file)
 
 using namespace llvm;
 
-namespace {
-  // Control the calculation of non-local dependencies by only examining the
-  // predecessors if the basic block has less than X amount (50 by default).
-  static cl::opt<int> 
-  PredLimit("nonlocaldep-threshold", cl::Hidden, cl::init(50),
-            cl::desc("Control the calculation of non-local"
-                     "dependencies (default = 50)"));           
-}
+// Control the calculation of non-local dependencies by only examining the
+// predecessors if the basic block has less than X amount (50 by default).
+static cl::opt<int> 
+PredLimit("nonlocaldep-threshold", cl::Hidden, cl::init(50),
+          cl::desc("Control the calculation of non-local"
+                   "dependencies (default = 50)"));           
 
 STATISTIC(NumCacheNonlocal, "Number of cached non-local responses");
 STATISTIC(NumUncacheNonlocal, "Number of uncached non-local responses");
index 2ee398d..047491b 100644 (file)
@@ -21,9 +21,7 @@
 using namespace llvm;
 
 // Register the ProfileInfo interface, providing a nice name to refer to.
-namespace {
-  RegisterAnalysisGroup<ProfileInfo> Z("Profile Information");
-}
+static RegisterAnalysisGroup<ProfileInfo> Z("Profile Information");
 char ProfileInfo::ID = 0;
 
 ProfileInfo::~ProfileInfo() {}
@@ -89,14 +87,14 @@ namespace {
     static char ID; // Class identification, replacement for typeinfo
     NoProfileInfo() : ImmutablePass((intptr_t)&ID) {}
   };
+}  // End of anonymous namespace
 
-  char NoProfileInfo::ID = 0;
-  // Register this pass...
-  RegisterPass<NoProfileInfo>
-  X("no-profile", "No Profile Information", false, true);
+char NoProfileInfo::ID = 0;
+// Register this pass...
+static RegisterPass<NoProfileInfo>
+X("no-profile", "No Profile Information", false, true);
 
-  // Declare that we implement the ProfileInfo interface
-  RegisterAnalysisGroup<ProfileInfo, true> Y(X);
-}  // End of anonymous namespace
+// Declare that we implement the ProfileInfo interface
+static RegisterAnalysisGroup<ProfileInfo, true> Y(X);
 
 ImmutablePass *llvm::createNoProfileInfoPass() { return new NoProfileInfo(); }
index e7612e1..b2fa9e4 100644 (file)
 #include "llvm/Support/Streams.h"
 using namespace llvm;
 
-namespace {
-  static cl::opt<std::string>
-  ProfileInfoFilename("profile-info-file", cl::init("llvmprof.out"),
-                      cl::value_desc("filename"),
-                      cl::desc("Profile file loaded by -profile-loader"));
+static cl::opt<std::string>
+ProfileInfoFilename("profile-info-file", cl::init("llvmprof.out"),
+                    cl::value_desc("filename"),
+                    cl::desc("Profile file loaded by -profile-loader"));
 
+namespace {
   class VISIBILITY_HIDDEN LoaderPass : public ModulePass, public ProfileInfo {
     std::string Filename;
   public:
@@ -49,13 +49,13 @@ namespace {
     /// run - Load the profile information from the specified file.
     virtual bool runOnModule(Module &M);
   };
+}  // End of anonymous namespace
 
-  char LoaderPass::ID = 0;
-  RegisterPass<LoaderPass>
-  X("profile-loader", "Load profile information from llvmprof.out", false, true);
+char LoaderPass::ID = 0;
+static RegisterPass<LoaderPass>
+X("profile-loader", "Load profile information from llvmprof.out", false, true);
 
-  RegisterAnalysisGroup<ProfileInfo> Y(X);
-}  // End of anonymous namespace
+static RegisterAnalysisGroup<ProfileInfo> Y(X);
 
 ModulePass *llvm::createProfileLoaderPass() { return new LoaderPass(); }
 
index b757531..26010eb 100644 (file)
@@ -95,16 +95,14 @@ STATISTIC(NumTripCountsNotComputed,
 STATISTIC(NumBruteForceTripCountsComputed,
           "Number of loops with trip counts computed by force");
 
-cl::opt<unsigned>
+static cl::opt<unsigned>
 MaxBruteForceIterations("scalar-evolution-max-iterations", cl::ReallyHidden,
                         cl::desc("Maximum number of iterations SCEV will "
                                  "symbolically execute a constant derived loop"),
                         cl::init(100));
 
-namespace {
-  RegisterPass<ScalarEvolution>
-  R("scalar-evolution", "Scalar Evolution Analysis", false, true);
-}
+static RegisterPass<ScalarEvolution>
+R("scalar-evolution", "Scalar Evolution Analysis", false, true);
 char ScalarEvolution::ID = 0;
 
 //===----------------------------------------------------------------------===//
index 6c3ffdf..1e4b306 100644 (file)
@@ -24,7 +24,7 @@ using namespace llvm;
 
 char ValueNumbering::ID = 0;
 // Register the ValueNumbering interface, providing a nice name to refer to.
-static RegisterAnalysisGroup<ValueNumbering> X("Value Numbering");
+static RegisterAnalysisGroup<ValueNumbering> V("Value Numbering");
 
 /// ValueNumbering destructor: DO NOT move this to the header file for
 /// ValueNumbering or else clients of the ValueNumbering class may not depend on
@@ -64,15 +64,17 @@ namespace {
     virtual void getEqualNumberNodes(Value *V1,
                                      std::vector<Value*> &RetVals) const;
   };
+}
 
-  char BasicVN::ID = 0;
-  // Register this pass...
-  RegisterPass<BasicVN>
-  X("basicvn", "Basic Value Numbering (default GVN impl)", false, true);
+char BasicVN::ID = 0;
+// Register this pass...
+static RegisterPass<BasicVN>
+X("basicvn", "Basic Value Numbering (default GVN impl)", false, true);
 
-  // Declare that we implement the ValueNumbering interface
-  RegisterAnalysisGroup<ValueNumbering, true> Y(X);
+// Declare that we implement the ValueNumbering interface
+static RegisterAnalysisGroup<ValueNumbering, true> Y(X);
 
+namespace {
   /// BVNImpl - Implement BasicVN in terms of a visitor class that
   /// handles the different types of instructions as appropriate.
   ///
index fd0e30a..1ded9e5 100644 (file)
@@ -19,7 +19,7 @@
 using namespace llvm;
 
 /// Read a variable-bit-rate encoded unsigned integer
-inline unsigned readInteger(const char*&At, const char*End){
+static inline unsigned readInteger(const char*&At, const char*End) {
   unsigned Shift = 0;
   unsigned Result = 0;
 
index d3861f3..c5d54fb 100644 (file)
@@ -25,7 +25,7 @@ using namespace llvm;
 
 // Write an integer using variable bit rate encoding. This saves a few bytes
 // per entry in the symbol table.
-inline void writeInteger(unsigned num, std::ofstream& ARFile) {
+static inline void writeInteger(unsigned num, std::ofstream& ARFile) {
   while (1) {
     if (num < 0x80) { // done?
       ARFile << (unsigned char)num;
@@ -41,7 +41,7 @@ inline void writeInteger(unsigned num, std::ofstream& ARFile) {
 
 // Compute how many bytes are taken by a given VBR encoded value. This is needed
 // to pre-compute the size of the symbol table.
-inline unsigned numVbrBytes(unsigned num) {
+static inline unsigned numVbrBytes(unsigned num) {
 
   // Note that the following nested ifs are somewhat equivalent to a binary
   // search. We split it in half by comparing against 2^14 first. This allows
index 09a1db3..92271ce 100644 (file)
@@ -114,19 +114,21 @@ ValueEnumerator::ValueEnumerator(const Module *M) {
 }
 
 // Optimize constant ordering.
-struct CstSortPredicate {
-  ValueEnumerator &VE;
-  CstSortPredicate(ValueEnumerator &ve) : VE(ve) {}
-  bool operator()(const std::pair<const Value*, unsigned> &LHS,
-                  const std::pair<const Value*, unsigned> &RHS) {
-    // Sort by plane.
-    if (LHS.first->getType() != RHS.first->getType())
-      return VE.getTypeID(LHS.first->getType()) < 
-             VE.getTypeID(RHS.first->getType());
-    // Then by frequency.
-    return LHS.second > RHS.second;
-  }
-};
+namespace {
+  struct CstSortPredicate {
+    ValueEnumerator &VE;
+    explicit CstSortPredicate(ValueEnumerator &ve) : VE(ve) {}
+    bool operator()(const std::pair<const Value*, unsigned> &LHS,
+                    const std::pair<const Value*, unsigned> &RHS) {
+      // Sort by plane.
+      if (LHS.first->getType() != RHS.first->getType())
+        return VE.getTypeID(LHS.first->getType()) < 
+               VE.getTypeID(RHS.first->getType());
+      // Then by frequency.
+      return LHS.second > RHS.second;
+    }
+  };
+}
 
 /// OptimizeConstants - Reorder constant pool for denser encoding.
 void ValueEnumerator::OptimizeConstants(unsigned CstStart, unsigned CstEnd) {
index 1807f98..e935898 100644 (file)
@@ -38,13 +38,13 @@ STATISTIC(NumBranchOpts, "Number of branches optimized");
 STATISTIC(NumTailMerge , "Number of block tails merged");
 static cl::opt<cl::boolOrDefault> FlagEnableTailMerge("enable-tail-merge", 
                               cl::init(cl::BOU_UNSET), cl::Hidden);
-namespace {
-  // Throttle for huge numbers of predecessors (compile speed problems)
-  static cl::opt<unsigned>
-  TailMergeThreshold("tail-merge-threshold", 
-            cl::desc("Max number of predecessors to consider tail merging"),
-            cl::init(100), cl::Hidden);
+// Throttle for huge numbers of predecessors (compile speed problems)
+static cl::opt<unsigned>
+TailMergeThreshold("tail-merge-threshold", 
+          cl::desc("Max number of predecessors to consider tail merging"),
+          cl::init(100), cl::Hidden);
 
+namespace {
   struct VISIBILITY_HIDDEN BranchFolder : public MachineFunctionPass {
     static char ID;
     explicit BranchFolder(bool defaultEnableTailMerge) : 
index 80085cd..7a5a699 100644 (file)
@@ -51,11 +51,11 @@ namespace {
     bool doFinalization(Module &M);
   };
   
-  RegisterPass<CollectorModuleMetadata>
-  X("collector-metadata", "Create Garbage Collector Module Metadata");
-  
 }
 
+static RegisterPass<CollectorModuleMetadata>
+X("collector-metadata", "Create Garbage Collector Module Metadata");
+
 // -----------------------------------------------------------------------------
 
 CollectorMetadata::CollectorMetadata(const Function &F, Collector &C)
index 87c854b..8b25344 100644 (file)
 #include <cmath>
 using namespace llvm;
 
-namespace {
-  // Hidden options for help debugging.
-  static cl::opt<bool> DisableReMat("disable-rematerialization", 
-                                    cl::init(false), cl::Hidden);
-
-  static cl::opt<bool> SplitAtBB("split-intervals-at-bb", 
-                                 cl::init(true), cl::Hidden);
-  static cl::opt<int> SplitLimit("split-limit",
-                                 cl::init(-1), cl::Hidden);
-}
+// Hidden options for help debugging.
+static cl::opt<bool> DisableReMat("disable-rematerialization", 
+                                  cl::init(false), cl::Hidden);
+
+static cl::opt<bool> SplitAtBB("split-intervals-at-bb", 
+                               cl::init(true), cl::Hidden);
+static cl::opt<int> SplitLimit("split-limit",
+                               cl::init(-1), cl::Hidden);
 
 STATISTIC(numIntervals, "Number of original intervals");
 STATISTIC(numIntervalsAfter, "Number of intervals after coalescing");
@@ -53,9 +51,7 @@ STATISTIC(numFolds    , "Number of loads/stores folded into instructions");
 STATISTIC(numSplits   , "Number of intervals split");
 
 char LiveIntervals::ID = 0;
-namespace {
-  RegisterPass<LiveIntervals> X("liveintervals", "Live Interval Analysis");
-}
+static RegisterPass<LiveIntervals> X("liveintervals", "Live Interval Analysis");
 
 void LiveIntervals::getAnalysisUsage(AnalysisUsage &AU) const {
   AU.addPreserved<LiveVariables>();
@@ -1078,20 +1074,22 @@ static const VNInfo *findDefinedVNInfo(const LiveInterval &li, unsigned DefIdx)
 
 /// RewriteInfo - Keep track of machine instrs that will be rewritten
 /// during spilling.
-struct RewriteInfo {
-  unsigned Index;
-  MachineInstr *MI;
-  bool HasUse;
-  bool HasDef;
-  RewriteInfo(unsigned i, MachineInstr *mi, bool u, bool d)
-    : Index(i), MI(mi), HasUse(u), HasDef(d) {}
-};
-
-struct RewriteInfoCompare {
-  bool operator()(const RewriteInfo &LHS, const RewriteInfo &RHS) const {
-    return LHS.Index < RHS.Index;
-  }
-};
+namespace {
+  struct RewriteInfo {
+    unsigned Index;
+    MachineInstr *MI;
+    bool HasUse;
+    bool HasDef;
+    RewriteInfo(unsigned i, MachineInstr *mi, bool u, bool d)
+      : Index(i), MI(mi), HasUse(u), HasDef(d) {}
+  };
+
+  struct RewriteInfoCompare {
+    bool operator()(const RewriteInfo &LHS, const RewriteInfo &RHS) const {
+      return LHS.Index < RHS.Index;
+    }
+  };
+}
 
 void LiveIntervals::
 rewriteInstructionsForSpills(const LiveInterval &li, bool TrySplit,
index 9b53bdb..0710c10 100644 (file)
@@ -22,9 +22,7 @@ TEMPLATE_INSTANTIATION(class DominatorTreeBase<MachineBasicBlock>);
 
 char MachineDominatorTree::ID = 0;
 
-namespace {
-  RegisterPass<MachineDominatorTree>
-  E("machinedomtree", "MachineDominator Tree Construction", true);
-}
+static RegisterPass<MachineDominatorTree>
+E("machinedomtree", "MachineDominator Tree Construction", true);
 
 const PassInfo *llvm::MachineDominatorsID = E.getPassInfo();
index c2adb1e..7f48ab5 100644 (file)
@@ -150,12 +150,12 @@ namespace {
     ///
     void Hoist(MachineInstr &MI);
   };
-
-  char MachineLICM::ID = 0;
-  RegisterPass<MachineLICM> X("machine-licm",
-                              "Machine Loop Invariant Code Motion");
 } // end anonymous namespace
 
+char MachineLICM::ID = 0;
+static RegisterPass<MachineLICM>
+X("machine-licm", "Machine Loop Invariant Code Motion");
+
 FunctionPass *llvm::createMachineLICMPass() { return new MachineLICM(); }
 
 /// Hoist expressions out of the specified loop. Note, alias info for inner loop
index 007317c..ac3df43 100644 (file)
@@ -23,10 +23,8 @@ TEMPLATE_INSTANTIATION(class LoopBase<MachineBasicBlock>);
 TEMPLATE_INSTANTIATION(class LoopInfoBase<MachineBasicBlock>);
 
 char MachineLoopInfo::ID = 0;
-namespace {
-  RegisterPass<MachineLoopInfo>
-  X("machine-loops", "Machine Natural Loop Construction", true);
-}
+static RegisterPass<MachineLoopInfo>
+X("machine-loops", "Machine Natural Loop Construction", true);
 
 const PassInfo *llvm::MachineLoopInfoID = X.getPassInfo();
 
index 0cfcc61..2bad6bb 100644 (file)
@@ -27,9 +27,8 @@ using namespace llvm;
 using namespace llvm::dwarf;
 
 // Handle the Pass registration stuff necessary to use TargetData's.
-namespace {
-  RegisterPass<MachineModuleInfo> X("machinemoduleinfo", "Module Information");
-}
+static RegisterPass<MachineModuleInfo>
+X("machinemoduleinfo", "Module Information");
 char MachineModuleInfo::ID = 0;
 
 //===----------------------------------------------------------------------===//
@@ -160,6 +159,8 @@ void DIVisitor::ApplyToFields(DebugInfoDesc *DD) {
   DD->ApplyToFields(this);
 }
 
+namespace {
+
 //===----------------------------------------------------------------------===//
 /// DICountVisitor - This DIVisitor counts all the fields in the supplied debug
 /// the supplied DebugInfoDesc.
@@ -479,6 +480,7 @@ public:
   }
 };
 
+}
 
 //===----------------------------------------------------------------------===//
 
index 97a4df5..b4e72fe 100644 (file)
@@ -50,10 +50,11 @@ namespace {
     bool SinkInstruction(MachineInstr *MI, bool &SawStore);
     bool AllUsesDominatedByBlock(unsigned Reg, MachineBasicBlock *MBB) const;
   };
-  
-  char MachineSinking::ID = 0;
-  RegisterPass<MachineSinking> X("machine-sink", "Machine code sinking");
 } // end anonymous namespace
+  
+char MachineSinking::ID = 0;
+static RegisterPass<MachineSinking>
+X("machine-sink", "Machine code sinking");
 
 FunctionPass *llvm::createMachineSinkingPass() { return new MachineSinking(); }
 
index 95022a9..6b947b1 100644 (file)
@@ -35,11 +35,11 @@ namespace {
                         const TargetAsmInfo &TAI);
   };
   
-  CollectorRegistry::Add<OcamlCollector>
-  X("ocaml", "ocaml 3.10-compatible collector");
-  
 }
 
+static CollectorRegistry::Add<OcamlCollector>
+X("ocaml", "ocaml 3.10-compatible collector");
+
 // -----------------------------------------------------------------------------
 
 static void EmitCamlGlobal(const Module &M, std::ostream &OS, AsmPrinter &AP,
index 601bfd6..4a9077a 100644 (file)
@@ -73,12 +73,12 @@ namespace {
     // Defs of PHI sources which are implicit_def.
     SmallPtrSet<MachineInstr*, 4> ImpDefs;
   };
-
-  char PNE::ID = 0;
-  RegisterPass<PNE> X("phi-node-elimination",
-                      "Eliminate PHI nodes for register allocation");
 }
 
+char PNE::ID = 0;
+static RegisterPass<PNE>
+X("phi-node-elimination", "Eliminate PHI nodes for register allocation");
+
 const PassInfo *llvm::PHIEliminationID = X.getPassInfo();
 
 bool PNE::runOnMachineFunction(MachineFunction &Fn) {
index bcd67c5..f67eb79 100644 (file)
@@ -30,14 +30,11 @@ MachinePassRegistry RegisterRegAlloc::Registry;
 /// RegAlloc command line options.
 ///
 //===---------------------------------------------------------------------===//
-namespace {
-  static
-  cl::opt<RegisterRegAlloc::FunctionPassCtor, false,
-          RegisterPassParser<RegisterRegAlloc> >
-  RegAlloc("regalloc",
-           cl::init(&createLinearScanRegisterAllocator),
-           cl::desc("Register allocator to use: (default = linearscan)")); 
-}
+static cl::opt<RegisterRegAlloc::FunctionPassCtor, false,
+               RegisterPassParser<RegisterRegAlloc> >
+RegAlloc("regalloc",
+         cl::init(&createLinearScanRegisterAllocator),
+         cl::desc("Register allocator to use: (default = linearscan)")); 
 
 
 //===---------------------------------------------------------------------===//
index 0c6c254..215f943 100644 (file)
@@ -52,11 +52,11 @@ STATISTIC(NumStores, "Number of stores added");
 STATISTIC(NumLoads , "Number of loads added");
 STATISTIC(NumFolded, "Number of loads/stores folded into instructions");
 
-namespace {
-  static RegisterRegAlloc
-    bigBlockRegAlloc("bigblock", "  Big-block register allocator",
-                  createBigBlockRegisterAllocator);
+static RegisterRegAlloc
+  bigBlockRegAlloc("bigblock", "  Big-block register allocator",
+                createBigBlockRegisterAllocator);
 
+namespace {
 /// VRegKeyInfo - Defines magic values required to use VirtRegs as DenseMap
 /// keys.
   struct VRegKeyInfo {
index 3281a2c..18e7656 100644 (file)
@@ -37,12 +37,11 @@ using namespace llvm;
 STATISTIC(NumStores, "Number of stores added");
 STATISTIC(NumLoads , "Number of loads added");
 
-namespace {
-  static RegisterRegAlloc
-    localRegAlloc("local", "  local register allocator",
-                  createLocalRegisterAllocator);
-
+static RegisterRegAlloc
+  localRegAlloc("local", "  local register allocator",
+                createLocalRegisterAllocator);
 
+namespace {
   class VISIBILITY_HIDDEN RALocal : public MachineFunctionPass {
   public:
     static char ID;
index 9d25d2a..1131e3d 100644 (file)
@@ -22,9 +22,7 @@
 using namespace llvm;
 
 // Register the RegisterCoalescer interface, providing a nice name to refer to.
-namespace {
-  RegisterAnalysisGroup<RegisterCoalescer> Z("Register Coalescer");
-}
+static RegisterAnalysisGroup<RegisterCoalescer> Z("Register Coalescer");
 char RegisterCoalescer::ID = 0;
 
 // RegisterCoalescer destructor: DO NOT move this to the header file
index d2fe471..f05f444 100644 (file)
@@ -318,7 +318,7 @@ static void AddNodeIDOpcode(FoldingSetNodeID &ID, unsigned OpC)  {
 
 /// AddNodeIDValueTypes - Value type lists are intern'd so we can represent them
 /// solely with their pointer.
-void AddNodeIDValueTypes(FoldingSetNodeID &ID, SDVTList VTList) {
+static void AddNodeIDValueTypes(FoldingSetNodeID &ID, SDVTList VTList) {
   ID.AddPointer(VTList.VTs);  
 }
 
index 241ad7e..f79ad02 100644 (file)
@@ -74,18 +74,16 @@ MachinePassRegistry RegisterScheduler::Registry;
 /// ISHeuristic command line option for instruction schedulers.
 ///
 //===---------------------------------------------------------------------===//
-namespace {
-  static cl::opt<RegisterScheduler::FunctionPassCtor, false,
-                 RegisterPassParser<RegisterScheduler> >
-  ISHeuristic("pre-RA-sched",
-              cl::init(&createDefaultScheduler),
-              cl::desc("Instruction schedulers available (before register"
-                       " allocation):"));
-
-  static RegisterScheduler
-  defaultListDAGScheduler("default", "  Best scheduler for the target",
-                          createDefaultScheduler);
-} // namespace
+static cl::opt<RegisterScheduler::FunctionPassCtor, false,
+               RegisterPassParser<RegisterScheduler> >
+ISHeuristic("pre-RA-sched",
+            cl::init(&createDefaultScheduler),
+            cl::desc("Instruction schedulers available (before register"
+                     " allocation):"));
+
+static RegisterScheduler
+defaultListDAGScheduler("default", "  Best scheduler for the target",
+                        createDefaultScheduler);
 
 namespace { struct SDISelAsmOperandInfo; }
 
index 092671c..568fe44 100644 (file)
@@ -66,11 +66,14 @@ namespace {
     static GetElementPtrInst *CreateGEP(IRBuilder &B, Value *BasePtr,
                                         int Idx1, int Idx2, const char *Name);
   };
+
+}
   
-  CollectorRegistry::Add<ShadowStackCollector>
-  Y("shadow-stack",
-    "Very portable collector for uncooperative code generators");
+static CollectorRegistry::Add<ShadowStackCollector>
+Y("shadow-stack",
+  "Very portable collector for uncooperative code generators");
   
+namespace {
   /// EscapeEnumerator - This is a little algorithm to find all escape points
   /// from a function so that "finally"-style code can be inserted. In addition
   /// to finding the existing return and unwind instructions, it also (if
index 6a110f0..2526d4d 100644 (file)
@@ -42,23 +42,21 @@ STATISTIC(numPeep     , "Number of identity moves eliminated after coalescing");
 STATISTIC(numAborts   , "Number of times interval joining aborted");
 
 char SimpleRegisterCoalescing::ID = 0;
-namespace {
-  static cl::opt<bool>
-  EnableJoining("join-liveintervals",
-                cl::desc("Coalesce copies (default=true)"),
-                cl::init(true));
+static cl::opt<bool>
+EnableJoining("join-liveintervals",
+              cl::desc("Coalesce copies (default=true)"),
+              cl::init(true));
 
-  static cl::opt<bool>
-  NewHeuristic("new-coalescer-heuristic",
-                cl::desc("Use new coalescer heuristic"),
-                cl::init(false));
+static cl::opt<bool>
+NewHeuristic("new-coalescer-heuristic",
+              cl::desc("Use new coalescer heuristic"),
+              cl::init(false));
 
-  RegisterPass<SimpleRegisterCoalescing> 
-  X("simple-register-coalescing", "Simple Register Coalescing");
+static RegisterPass<SimpleRegisterCoalescing> 
+X("simple-register-coalescing", "Simple Register Coalescing");
 
-  // Declare that we implement the RegisterCoalescer interface
-  RegisterAnalysisGroup<RegisterCoalescer, true/*The Default*/> V(X);
-}
+// Declare that we implement the RegisterCoalescer interface
+static RegisterAnalysisGroup<RegisterCoalescer, true/*The Default*/> V(X);
 
 const PassInfo *llvm::SimpleRegisterCoalescingID = X.getPassInfo();
 
index a632da6..79f8f50 100644 (file)
@@ -140,12 +140,13 @@ namespace {
                       SmallPtrSet<MachineBasicBlock*, 16>& v);
     void mergeLiveIntervals(unsigned primary, unsigned secondary, unsigned VN);
   };
-
-  char StrongPHIElimination::ID = 0;
-  RegisterPass<StrongPHIElimination> X("strong-phi-node-elimination",
-                  "Eliminate PHI nodes for register allocation, intelligently");
 }
 
+char StrongPHIElimination::ID = 0;
+static RegisterPass<StrongPHIElimination>
+X("strong-phi-node-elimination",
+  "Eliminate PHI nodes for register allocation, intelligently");
+
 const PassInfo *llvm::StrongPHIEliminationID = X.getPassInfo();
 
 /// computeDFS - Computes the DFS-in and DFS-out numbers of the dominator tree
@@ -192,6 +193,8 @@ void StrongPHIElimination::computeDFS(MachineFunction& MF) {
   }
 }
 
+namespace {
+
 /// PreorderSorter - a helper class that is used to sort registers
 /// according to the preorder number of their defining blocks
 class PreorderSorter {
@@ -219,6 +222,8 @@ public:
   }
 };
 
+}
+
 /// computeDomForest - compute the subforest of the DomTree corresponding
 /// to the defining blocks of the registers in question
 std::vector<StrongPHIElimination::DomForestNode*>
index 5dc1d69..f343ff4 100644 (file)
@@ -75,12 +75,12 @@ namespace {
     /// runOnMachineFunction - Pass entry point.
     bool runOnMachineFunction(MachineFunction&);
   };
-
-  char TwoAddressInstructionPass::ID = 0;
-  RegisterPass<TwoAddressInstructionPass>
-  X("twoaddressinstruction", "Two-Address instruction pass");
 }
 
+char TwoAddressInstructionPass::ID = 0;
+static RegisterPass<TwoAddressInstructionPass>
+X("twoaddressinstruction", "Two-Address instruction pass");
+
 const PassInfo *llvm::TwoAddressInstructionPassID = X.getPassInfo();
 
 /// Sink3AddrInstruction - A two-address instruction has been converted to a
index 9672dac..3ba9202 100644 (file)
@@ -38,10 +38,10 @@ namespace {
     static char ID; // Pass identification, replacement for typeid
     UnreachableBlockElim() : FunctionPass((intptr_t)&ID) {}
   };
-  char UnreachableBlockElim::ID = 0;
-  RegisterPass<UnreachableBlockElim>
-  X("unreachableblockelim", "Remove unreachable blocks from the CFG");
 }
+char UnreachableBlockElim::ID = 0;
+static RegisterPass<UnreachableBlockElim>
+X("unreachableblockelim", "Remove unreachable blocks from the CFG");
 
 FunctionPass *llvm::createUnreachableBlockEliminationPass() {
   return new UnreachableBlockElim();
index fe8b6a5..609e12d 100644 (file)
@@ -48,17 +48,17 @@ STATISTIC(NumDSS   , "Number of dead spill slots removed");
 
 namespace {
   enum SpillerName { simple, local };
-
-  static cl::opt<SpillerName>
-  SpillerOpt("spiller",
-             cl::desc("Spiller to use: (default: local)"),
-             cl::Prefix,
-             cl::values(clEnumVal(simple, "  simple spiller"),
-                        clEnumVal(local,  "  local spiller"),
-                        clEnumValEnd),
-             cl::init(local));
 }
 
+static cl::opt<SpillerName>
+SpillerOpt("spiller",
+           cl::desc("Spiller to use: (default: local)"),
+           cl::Prefix,
+           cl::values(clEnumVal(simple, "  simple spiller"),
+                      clEnumVal(local,  "  local spiller"),
+                      clEnumValEnd),
+           cl::init(local));
+
 //===----------------------------------------------------------------------===//
 //  VirtRegMap implementation
 //===----------------------------------------------------------------------===//
index 5d7f901..4234bd9 100644 (file)
 #include <cstring>
 using namespace llvm;
 
+namespace {
+
 static struct RegisterInterp {
   RegisterInterp() { Interpreter::Register(); }
 } InterpRegistrator;
 
+}
+
 namespace llvm {
   void LinkInInterpreter() {
   }
index 9e89e3c..e95c8a0 100644 (file)
@@ -52,10 +52,14 @@ using namespace llvm;
 extern void *__dso_handle __attribute__ ((__visibility__ ("hidden")));
 #endif
 
+namespace {
+
 static struct RegisterJIT {
   RegisterJIT() { JIT::Register(); }
 } JITRegistrator;
 
+}
+
 namespace llvm {
   void LinkInJIT() {
   }
index b73b0bd..3b10a95 100644 (file)
@@ -172,6 +172,8 @@ static bool PadLT(const LandingPadInfo *L, const LandingPadInfo *R) {
   return LSize < RSize;
 }
 
+namespace {
+
 struct KeyInfo {
   static inline unsigned getEmptyKey() { return -1U; }
   static inline unsigned getTombstoneKey() { return -2U; }
@@ -205,6 +207,8 @@ struct CallSiteEntry {
   unsigned Action;
 };
 
+}
+
 unsigned char* JITDwarfEmitter::EmitExceptionTable(MachineFunction* MF,
                                          unsigned char* StartFunction,
                                          unsigned char* EndFunction) const {
index 4516ebc..13acc1b 100644 (file)
@@ -70,6 +70,8 @@ void Statistic::RegisterStatistic() {
   Initialized = true;
 }
 
+namespace {
+
 struct NameCompare {
   bool operator()(const Statistic *LHS, const Statistic *RHS) const {
     int Cmp = std::strcmp(LHS->getName(), RHS->getName());
@@ -80,6 +82,8 @@ struct NameCompare {
   }
 };
 
+}
+
 // Print information when destroyed, iff command line option is specified.
 StatisticInfo::~StatisticInfo() {
   // Statistics not enabled?
index a7030fc..b2c3160 100644 (file)
@@ -70,7 +70,7 @@
 /// string and the Unix error number given by \p errnum. If errnum is -1, the
 /// default then the value of errno is used.
 /// @brief Make an error message
-inline bool MakeErrMsg(
+static inline bool MakeErrMsg(
   std::string* ErrMsg, const std::string& prefix, int errnum = -1) {
   if (!ErrMsg)
     return true;
index d084fff..913ebe0 100644 (file)
@@ -27,11 +27,9 @@ static cl::opt<bool> DisableLdStOpti("disable-arm-loadstore-opti", cl::Hidden,
 static cl::opt<bool> DisableIfConversion("disable-arm-if-conversion",cl::Hidden,
                               cl::desc("Disable if-conversion pass"));
 
-namespace {
-  // Register the target.
-  RegisterTarget<ARMTargetMachine>   X("arm",   "  ARM");
-  RegisterTarget<ThumbTargetMachine> Y("thumb", "  Thumb");
-}
+// Register the target.
+static RegisterTarget<ARMTargetMachine>   X("arm",   "  ARM");
+static RegisterTarget<ThumbTargetMachine> Y("thumb", "  Thumb");
 
 /// ThumbTargetMachine - Create an Thumb architecture model.
 ///
index 0887b95..e986a64 100644 (file)
 
 using namespace llvm;
 
-namespace {
-  // Register the targets
-  RegisterTarget<AlphaTargetMachine> X("alpha", "  Alpha (incomplete)");
-}
+// Register the targets
+static RegisterTarget<AlphaTargetMachine> X("alpha", "  Alpha (incomplete)");
 
 const TargetAsmInfo *AlphaTargetMachine::createTargetAsmInfo() const {
   return new AlphaTargetAsmInfo(*this);
index d6ccefc..dcc920a 100644 (file)
 #include <sstream>
 using namespace llvm;
 
-namespace {
-  // Register the target.
-  RegisterTarget<CTargetMachine> X("c", "  C backend");
+// Register the target.
+static RegisterTarget<CTargetMachine> X("c", "  C backend");
 
+namespace {
   /// CBackendNameAllUsedStructsAndMergeFunctions - This pass inserts names for
   /// any unnamed structure types that are used by the program, and merges
   /// external functions with the same name.
index 49a5e86..c6628ac 100644 (file)
@@ -214,6 +214,8 @@ namespace {
   }
 }
 
+namespace {
+
 //===--------------------------------------------------------------------===//
 /// SPUDAGToDAGISel - Cell SPU-specific code to select SPU machine
 /// instructions for SelectionDAG operations.
@@ -336,6 +338,8 @@ public:
 #include "SPUGenDAGISel.inc"
 };
 
+}
+
 /// InstructionSelectBasicBlock - This callback is invoked by
 /// SelectionDAGISel when it has created a SelectionDAG for us to codegen.
 void
index b42001f..2ba5fa6 100644 (file)
@@ -70,10 +70,10 @@ static cl::opt<std::string> NameToGenerate("cppfor", cl::Optional,
   cl::desc("Specify the name of the thing to generate"),
   cl::init("!bad!"));
 
-namespace {
-  // Register the target.
-  RegisterTarget<CPPTargetMachine> X("cpp", "  C++ backend");
+// Register the target.
+static RegisterTarget<CPPTargetMachine> X("cpp", "  C++ backend");
 
+namespace {
   typedef std::vector<const Type*> TypeList;
   typedef std::map<const Type*,std::string> TypeMap;
   typedef std::map<const Value*,std::string> ValueMap;
index d472b5c..7a0e456 100644 (file)
@@ -26,9 +26,7 @@ using namespace llvm;
 extern "C" int IA64TargetMachineModule;
 int IA64TargetMachineModule = 0;
 
-namespace {
-  RegisterTarget<IA64TargetMachine> X("ia64", "  IA-64 (Itanium)");
-}
+static RegisterTarget<IA64TargetMachine> X("ia64", "  IA-64 (Itanium)");
 
 const TargetAsmInfo *IA64TargetMachine::createTargetAsmInfo() const {
   return new IA64TargetAsmInfo(*this);
index 187dd4a..2b7e69e 100644 (file)
@@ -46,7 +46,7 @@ namespace {
 }
 
 
-RegisterTarget<MSILTarget> X("msil", "  MSIL backend");
+static RegisterTarget<MSILTarget> X("msil", "  MSIL backend");
 
 bool MSILModule::runOnModule(Module &M) {
   ModulePtr = &M;
index 09e058f..40de5df 100644 (file)
 #include "llvm/Target/TargetMachineRegistry.h"
 using namespace llvm;
 
-namespace {
-  // Register the target.
-  RegisterTarget<MipsTargetMachine> X("mips", "  Mips");
-}
+// Register the target.
+static RegisterTarget<MipsTargetMachine> X("mips", "  Mips");
 
 const TargetAsmInfo *MipsTargetMachine::
 createTargetAsmInfo() const 
index 37b8e7b..097e256 100644 (file)
@@ -1920,6 +1920,8 @@ static SDNode *isBLACompatibleAddress(SDOperand Op, SelectionDAG &DAG) {
                          DAG.getTargetLoweringInfo().getPointerTy()).Val;
 }
 
+namespace {
+
 struct TailCallArgumentInfo {
   SDOperand Arg;
   SDOperand FrameIdxOp;
@@ -1928,6 +1930,8 @@ struct TailCallArgumentInfo {
   TailCallArgumentInfo() : FrameIdx(0) {}
 };
 
+}
+
 /// StoreTailCallArgumentsToStackSlot - Stores arguments to their stack slot.
 static void
 StoreTailCallArgumentsToStackSlot(SelectionDAG &DAG,
index a77cc15..cfec534 100644 (file)
 #include "llvm/Target/TargetMachineRegistry.h"
 using namespace llvm;
 
-namespace {
-  // Register the targets
-  RegisterTarget<PPC32TargetMachine>
-  X("ppc32", "  PowerPC 32");
-  RegisterTarget<PPC64TargetMachine>
-  Y("ppc64", "  PowerPC 64");
-}
+// Register the targets
+static RegisterTarget<PPC32TargetMachine>
+X("ppc32", "  PowerPC 32");
+static RegisterTarget<PPC64TargetMachine>
+Y("ppc64", "  PowerPC 64");
 
 const TargetAsmInfo *PPCTargetMachine::createTargetAsmInfo() const {
   if (Subtarget.isDarwin())
index 38f6d6a..a916b5c 100644 (file)
 #include "llvm/Target/TargetMachineRegistry.h"
 using namespace llvm;
 
-namespace {
-  // Register the target.
-  RegisterTarget<SparcTargetMachine> X("sparc", "  SPARC");
-}
+// Register the target.
+static RegisterTarget<SparcTargetMachine> X("sparc", "  SPARC");
 
 const TargetAsmInfo *SparcTargetMachine::createTargetAsmInfo() const {
   return new SparcTargetAsmInfo(*this);
index 215a4f6..69a8ca9 100644 (file)
 using namespace llvm;
 
 // Handle the Pass registration stuff necessary to use TargetData's.
-namespace {
-  // Register the default SparcV9 implementation...
-  RegisterPass<TargetData> X("targetdata", "Target Data Layout", false, 
-                             true);
-}
+
+// Register the default SparcV9 implementation...
+static RegisterPass<TargetData> X("targetdata", "Target Data Layout", false, 
+                                  true);
 char TargetData::ID = 0;
 
 //===----------------------------------------------------------------------===//
@@ -318,6 +317,8 @@ unsigned TargetData::getAlignmentInfo(AlignTypeEnum AlignType,
                  : Alignments[BestMatchIdx].PrefAlign;
 }
 
+namespace {
+
 /// LayoutInfo - The lazy cache of structure layout information maintained by
 /// TargetData.  Note that the struct types must have been free'd before
 /// llvm_shutdown is called (and thus this is deallocated) because all the
@@ -342,8 +343,10 @@ struct DenseMapLayoutKeyInfo {
 };
 
 typedef DenseMap<LayoutKey, StructLayout*, DenseMapLayoutKeyInfo> LayoutInfoTy;
-static ManagedStatic<LayoutInfoTy> LayoutInfo;
 
+}
+
+static ManagedStatic<LayoutInfoTy> LayoutInfo;
 
 TargetData::~TargetData() {
   if (LayoutInfo.isConstructed()) {
index 1065b09..6e8831b 100644 (file)
@@ -39,117 +39,116 @@ namespace llvm {
   bool RealignStack;
   unsigned StackAlignment;
 }
-namespace {
-  static cl::opt<bool, true> PrintCode("print-machineinstrs",
-    cl::desc("Print generated machine code"),
-    cl::location(PrintMachineCode), cl::init(false));
-
-  static cl::opt<bool, true>
-    DisableFPElim("disable-fp-elim",
-                  cl::desc("Disable frame pointer elimination optimization"),
-                  cl::location(NoFramePointerElim),
-                  cl::init(false));
-  static cl::opt<bool, true>
-  DisableExcessPrecision("disable-excess-fp-precision",
-               cl::desc("Disable optimizations that may increase FP precision"),
-               cl::location(NoExcessFPPrecision),
-               cl::init(false));
-  static cl::opt<bool, true>
-  EnableUnsafeFPMath("enable-unsafe-fp-math",
-               cl::desc("Enable optimizations that may decrease FP precision"),
-               cl::location(UnsafeFPMath),
-               cl::init(false));
-  static cl::opt<bool, true>
-  EnableFiniteOnlyFPMath("enable-finite-only-fp-math",
-               cl::desc("Enable optimizations that assumes non- NaNs / +-Infs"),
-               cl::location(FiniteOnlyFPMathOption),
-               cl::init(false));
-  static cl::opt<bool, true>
-  EnableHonorSignDependentRoundingFPMath(cl::Hidden,
-               "enable-sign-dependent-rounding-fp-math",
-       cl::desc("Force codegen to assume rounding mode can change dynamically"),
-               cl::location(HonorSignDependentRoundingFPMathOption),
-               cl::init(false));
-
-  static cl::opt<bool, true>
-  GenerateSoftFloatCalls("soft-float",
-               cl::desc("Generate software floating point library calls"),
-               cl::location(UseSoftFloat),
-               cl::init(false));
-  static cl::opt<bool, true>
-  DontPlaceZerosInBSS("nozero-initialized-in-bss",
-              cl::desc("Don't place zero-initialized symbols into bss section"),
-              cl::location(NoZerosInBSS),
-              cl::init(false));
-  static cl::opt<bool, true>
-  EnableExceptionHandling("enable-eh",
-               cl::desc("Emit DWARF exception handling (default if target supports)"),
-               cl::location(ExceptionHandling),
-               cl::init(false));
-  static cl::opt<bool, true>
-  EnableUnwindTables("unwind-tables",
-               cl::desc("Generate unwinding tables for all functions"),
-               cl::location(UnwindTablesMandatory),
-               cl::init(false));
-
-  static cl::opt<llvm::Reloc::Model, true>
-  DefRelocationModel(
-    "relocation-model",
-    cl::desc("Choose relocation model"),
-    cl::location(RelocationModel),
-    cl::init(Reloc::Default),
-    cl::values(
-      clEnumValN(Reloc::Default, "default",
-                 "  Target default relocation model"),
-      clEnumValN(Reloc::Static, "static",
-                 "  Non-relocatable code"),
-      clEnumValN(Reloc::PIC_, "pic",
-                 "  Fully relocatable, position independent code"),
-      clEnumValN(Reloc::DynamicNoPIC, "dynamic-no-pic",
-                 "  Relocatable external references, non-relocatable code"),
-      clEnumValEnd));
-  static cl::opt<llvm::CodeModel::Model, true>
-  DefCodeModel(
-    "code-model",
-    cl::desc("Choose code model"),
-    cl::location(CMModel),
-    cl::init(CodeModel::Default),
-    cl::values(
-      clEnumValN(CodeModel::Default, "default",
-                 "  Target default code model"),
-      clEnumValN(CodeModel::Small, "small",
-                 "  Small code model"),
-      clEnumValN(CodeModel::Kernel, "kernel",
-                 "  Kernel code model"),
-      clEnumValN(CodeModel::Medium, "medium",
-                 "  Medium code model"),
-      clEnumValN(CodeModel::Large, "large",
-                 "  Large code model"),
-      clEnumValEnd));
-
-  static cl::opt<bool, true>
-  EnablePerformTailCallOpt("tailcallopt",
-                           cl::desc("Turn on tail call optimization."),
-                           cl::location(PerformTailCallOpt),
-                           cl::init(false));
-  static cl::opt<bool, true>
-  EnableOptimizeForSize("optimize-size",
-                        cl::desc("Optimize for size."),
-                           cl::location(OptimizeForSize),
-                           cl::init(false));
-
-  static cl::opt<bool, true>
-  EnableRealignStack("realign-stack",
-                     cl::desc("Realign stack if needed"),
-                     cl::location(RealignStack),
-                     cl::init(true));
-
-  static cl::opt<unsigned, true>
-  OverrideStackAlignment("stack-alignment",
-                         cl::desc("Override default stack alignment"),
-                         cl::location(StackAlignment),
-                         cl::init(0));
-}
+
+static cl::opt<bool, true> PrintCode("print-machineinstrs",
+  cl::desc("Print generated machine code"),
+  cl::location(PrintMachineCode), cl::init(false));
+
+static cl::opt<bool, true>
+  DisableFPElim("disable-fp-elim",
+                cl::desc("Disable frame pointer elimination optimization"),
+                cl::location(NoFramePointerElim),
+                cl::init(false));
+static cl::opt<bool, true>
+DisableExcessPrecision("disable-excess-fp-precision",
+             cl::desc("Disable optimizations that may increase FP precision"),
+             cl::location(NoExcessFPPrecision),
+             cl::init(false));
+static cl::opt<bool, true>
+EnableUnsafeFPMath("enable-unsafe-fp-math",
+             cl::desc("Enable optimizations that may decrease FP precision"),
+             cl::location(UnsafeFPMath),
+             cl::init(false));
+static cl::opt<bool, true>
+EnableFiniteOnlyFPMath("enable-finite-only-fp-math",
+             cl::desc("Enable optimizations that assumes non- NaNs / +-Infs"),
+             cl::location(FiniteOnlyFPMathOption),
+             cl::init(false));
+static cl::opt<bool, true>
+EnableHonorSignDependentRoundingFPMath(cl::Hidden,
+             "enable-sign-dependent-rounding-fp-math",
+     cl::desc("Force codegen to assume rounding mode can change dynamically"),
+             cl::location(HonorSignDependentRoundingFPMathOption),
+             cl::init(false));
+
+static cl::opt<bool, true>
+GenerateSoftFloatCalls("soft-float",
+             cl::desc("Generate software floating point library calls"),
+             cl::location(UseSoftFloat),
+             cl::init(false));
+static cl::opt<bool, true>
+DontPlaceZerosInBSS("nozero-initialized-in-bss",
+            cl::desc("Don't place zero-initialized symbols into bss section"),
+            cl::location(NoZerosInBSS),
+            cl::init(false));
+static cl::opt<bool, true>
+EnableExceptionHandling("enable-eh",
+             cl::desc("Emit DWARF exception handling (default if target supports)"),
+             cl::location(ExceptionHandling),
+             cl::init(false));
+static cl::opt<bool, true>
+EnableUnwindTables("unwind-tables",
+             cl::desc("Generate unwinding tables for all functions"),
+             cl::location(UnwindTablesMandatory),
+             cl::init(false));
+
+static cl::opt<llvm::Reloc::Model, true>
+DefRelocationModel(
+  "relocation-model",
+  cl::desc("Choose relocation model"),
+  cl::location(RelocationModel),
+  cl::init(Reloc::Default),
+  cl::values(
+    clEnumValN(Reloc::Default, "default",
+               "  Target default relocation model"),
+    clEnumValN(Reloc::Static, "static",
+               "  Non-relocatable code"),
+    clEnumValN(Reloc::PIC_, "pic",
+               "  Fully relocatable, position independent code"),
+    clEnumValN(Reloc::DynamicNoPIC, "dynamic-no-pic",
+               "  Relocatable external references, non-relocatable code"),
+    clEnumValEnd));
+static cl::opt<llvm::CodeModel::Model, true>
+DefCodeModel(
+  "code-model",
+  cl::desc("Choose code model"),
+  cl::location(CMModel),
+  cl::init(CodeModel::Default),
+  cl::values(
+    clEnumValN(CodeModel::Default, "default",
+               "  Target default code model"),
+    clEnumValN(CodeModel::Small, "small",
+               "  Small code model"),
+    clEnumValN(CodeModel::Kernel, "kernel",
+               "  Kernel code model"),
+    clEnumValN(CodeModel::Medium, "medium",
+               "  Medium code model"),
+    clEnumValN(CodeModel::Large, "large",
+               "  Large code model"),
+    clEnumValEnd));
+
+static cl::opt<bool, true>
+EnablePerformTailCallOpt("tailcallopt",
+                         cl::desc("Turn on tail call optimization."),
+                         cl::location(PerformTailCallOpt),
+                         cl::init(false));
+static cl::opt<bool, true>
+EnableOptimizeForSize("optimize-size",
+                      cl::desc("Optimize for size."),
+                         cl::location(OptimizeForSize),
+                         cl::init(false));
+
+static cl::opt<bool, true>
+EnableRealignStack("realign-stack",
+                   cl::desc("Realign stack if needed"),
+                   cl::location(RealignStack),
+                   cl::init(true));
+
+static cl::opt<unsigned, true>
+OverrideStackAlignment("stack-alignment",
+                       cl::desc("Override default stack alignment"),
+                       cl::location(StackAlignment),
+                       cl::init(0));
 
 //---------------------------------------------------------------------------
 // TargetMachine Class
index c004077..98d80c8 100644 (file)
@@ -19,7 +19,7 @@
 #include "llvm/Target/TargetOptions.h"
 using namespace llvm;
 
-cl::opt<X86Subtarget::AsmWriterFlavorTy>
+static cl::opt<X86Subtarget::AsmWriterFlavorTy>
 AsmWriterFlavor("x86-asm-syntax", cl::init(X86Subtarget::Unset),
   cl::desc("Choose style of code to emit from X86 backend:"),
   cl::values(
index 218f356..a60ce09 100644 (file)
@@ -30,13 +30,11 @@ using namespace llvm;
 extern "C" int X86TargetMachineModule;
 int X86TargetMachineModule = 0;
 
-namespace {
-  // Register the target.
-  RegisterTarget<X86_32TargetMachine>
-  X("x86",    "  32-bit X86: Pentium-Pro and above");
-  RegisterTarget<X86_64TargetMachine>
-  Y("x86-64", "  64-bit X86: EM64T and AMD64");
-}
+// Register the target.
+static RegisterTarget<X86_32TargetMachine>
+X("x86",    "  32-bit X86: Pentium-Pro and above");
+static RegisterTarget<X86_64TargetMachine>
+Y("x86-64", "  64-bit X86: EM64T and AMD64");
 
 const TargetAsmInfo *X86TargetMachine::createTargetAsmInfo() const {
   return new X86TargetAsmInfo(*this);
index 5f27e04..f2a8322 100644 (file)
@@ -36,10 +36,12 @@ namespace {
       return false;
     }
   };
+}
 
-  char Hello::ID = 0;
-  RegisterPass<Hello> X("hello", "Hello World Pass");
+char Hello::ID = 0;
+static RegisterPass<Hello> X("hello", "Hello World Pass");
 
+namespace {
   // Hello2 - The second implementation with getAnalysisUsage implemented.
   struct Hello2 : public FunctionPass {
     static char ID; // Pass identification, replacement for typeid
@@ -58,7 +60,8 @@ namespace {
       AU.setPreservesAll();
     };
   };
-  char Hello2::ID = 0;
-  RegisterPass<Hello2> Y("hello2",
-                        "Hello World Pass (with getAnalysisUsage implemented)");
 }
+
+char Hello2::ID = 0;
+static RegisterPass<Hello2>
+Y("hello2", "Hello World Pass (with getAnalysisUsage implemented)");
index c6e27b4..264f080 100644 (file)
@@ -77,12 +77,12 @@ namespace {
        /// The maximum number of elements to expand, or 0 for unlimited.
        unsigned maxElements;
   };
-
-  char ArgPromotion::ID = 0;
-  RegisterPass<ArgPromotion> X("argpromotion",
-                               "Promote 'by reference' arguments to scalars");
 }
 
+char ArgPromotion::ID = 0;
+static RegisterPass<ArgPromotion>
+X("argpromotion", "Promote 'by reference' arguments to scalars");
+
 Pass *llvm::createArgumentPromotionPass(unsigned maxElements) {
   return new ArgPromotion(maxElements);
 }
index a8a1492..86cfcc4 100644 (file)
@@ -38,11 +38,12 @@ namespace {
     //
     bool runOnModule(Module &M);
   };
-
-  char ConstantMerge::ID = 0;
-  RegisterPass<ConstantMerge>X("constmerge","Merge Duplicate Global Constants");
 }
 
+char ConstantMerge::ID = 0;
+static RegisterPass<ConstantMerge>
+X("constmerge", "Merge Duplicate Global Constants");
+
 ModulePass *llvm::createConstantMergePass() { return new ConstantMerge(); }
 
 bool ConstantMerge::runOnModule(Module &M) {
index 6cd128b..9b3efe0 100644 (file)
@@ -97,9 +97,13 @@ namespace {
 
     void RemoveDeadArgumentsFromFunction(Function *F);
   };
-  char DAE::ID = 0;
-  RegisterPass<DAE> X("deadargelim", "Dead Argument Elimination");
+}
+
+char DAE::ID = 0;
+static RegisterPass<DAE>
+X("deadargelim", "Dead Argument Elimination");
 
+namespace {
   /// DAH - DeadArgumentHacking pass - Same as dead argument elimination, but
   /// deletes arguments to functions which are external.  This is only for use
   /// by bugpoint.
@@ -107,11 +111,12 @@ namespace {
     static char ID;
     virtual bool ShouldHackArguments() const { return true; }
   };
-  char DAH::ID = 0;
-  RegisterPass<DAH> Y("deadarghaX0r",
-                      "Dead Argument Hacking (BUGPOINT USE ONLY; DO NOT USE)");
 }
 
+char DAH::ID = 0;
+static RegisterPass<DAH>
+Y("deadarghaX0r", "Dead Argument Hacking (BUGPOINT USE ONLY; DO NOT USE)");
+
 /// createDeadArgEliminationPass - This pass removes arguments from functions
 /// which are not used by the body of the function.
 ///
index b9d9b54..3cb658e 100644 (file)
@@ -43,10 +43,11 @@ namespace {
       AU.addRequired<FindUsedTypes>();
     }
   };
-  char DTE::ID = 0;
-  RegisterPass<DTE> X("deadtypeelim", "Dead Type Elimination");
 }
 
+char DTE::ID = 0;
+static RegisterPass<DTE> X("deadtypeelim", "Dead Type Elimination");
+
 ModulePass *llvm::createDeadTypeEliminationPass() {
   return new DTE();
 }
index 4e30c10..98202eb 100644 (file)
@@ -49,10 +49,11 @@ namespace {
     bool SafeToDestroyConstant(Constant* C);
     bool RemoveUnusedGlobalValue(GlobalValue &GV);
   };
-  char GlobalDCE::ID = 0;
-  RegisterPass<GlobalDCE> X("globaldce", "Dead Global Elimination");
 }
 
+char GlobalDCE::ID = 0;
+static RegisterPass<GlobalDCE> X("globaldce", "Dead Global Elimination");
+
 ModulePass *llvm::createGlobalDCEPass() { return new GlobalDCE(); }
 
 bool GlobalDCE::runOnModule(Module &M) {
index 600be26..e822d9c 100644 (file)
@@ -68,13 +68,15 @@ namespace {
     bool OptimizeGlobalCtorsList(GlobalVariable *&GCL);
     bool ProcessInternalGlobal(GlobalVariable *GV,Module::global_iterator &GVI);
   };
-
-  char GlobalOpt::ID = 0;
-  RegisterPass<GlobalOpt> X("globalopt", "Global Variable Optimizer");
 }
 
+char GlobalOpt::ID = 0;
+static RegisterPass<GlobalOpt> X("globalopt", "Global Variable Optimizer");
+
 ModulePass *llvm::createGlobalOptimizerPass() { return new GlobalOpt(); }
 
+namespace {
+
 /// GlobalStatus - As we analyze each global, keep track of some information
 /// about it.  If we find out that the address of the global is taken, none of
 /// this info will be accurate.
@@ -129,7 +131,7 @@ struct VISIBILITY_HIDDEN GlobalStatus {
                    HasNonInstructionUser(false), HasPHIUser(false) {}
 };
 
-
+}
 
 /// ConstantIsDead - Return true if the specified constant is (transitively)
 /// dead.  The constant may be used by other constants (e.g. constant arrays and
index c51c023..792fa98 100644 (file)
@@ -42,10 +42,12 @@ namespace {
     bool PropagateConstantsIntoArguments(Function &F);
     bool PropagateConstantReturn(Function &F);
   };
-  char IPCP::ID = 0;
-  RegisterPass<IPCP> X("ipconstprop", "Interprocedural constant propagation");
 }
 
+char IPCP::ID = 0;
+static RegisterPass<IPCP>
+X("ipconstprop", "Interprocedural constant propagation");
+
 ModulePass *llvm::createIPConstantPropagationPass() { return new IPCP(); }
 
 bool IPCP::runOnModule(Module &M) {
index 2f9c34d..a623135 100644 (file)
@@ -37,10 +37,11 @@ namespace {
 
     virtual bool runOnModule(Module &M);
   };
-  char IndMemRemPass::ID = 0;
-  RegisterPass<IndMemRemPass> X("indmemrem","Indirect Malloc and Free Removal");
 } // end anonymous namespace
 
+char IndMemRemPass::ID = 0;
+static RegisterPass<IndMemRemPass>
+X("indmemrem","Indirect Malloc and Free Removal");
 
 bool IndMemRemPass::runOnModule(Module &M) {
   //in Theory, all direct calls of malloc and free should be promoted
index a007103..63a4798 100644 (file)
@@ -45,10 +45,12 @@ namespace {
     }
     virtual bool doInitialization(CallGraph &CG);
   };
-  char SimpleInliner::ID = 0;
-  RegisterPass<SimpleInliner> X("inline", "Function Integration/Inlining");
 }
 
+char SimpleInliner::ID = 0;
+static RegisterPass<SimpleInliner>
+X("inline", "Function Integration/Inlining");
+
 Pass *llvm::createFunctionInliningPass() { return new SimpleInliner(); }
 
 Pass *llvm::createFunctionInliningPass(int Threshold) { 
index f44e784..1c3d5a8 100644 (file)
@@ -30,11 +30,9 @@ using namespace llvm;
 STATISTIC(NumInlined, "Number of functions inlined");
 STATISTIC(NumDeleted, "Number of functions deleted because all callers found");
 
-namespace {
-  static cl::opt<int>
-  InlineLimit("inline-threshold", cl::Hidden, cl::init(200),
+static cl::opt<int>
+InlineLimit("inline-threshold", cl::Hidden, cl::init(200),
         cl::desc("Control the amount of inlining to perform (default = 200)"));
-}
 
 Inliner::Inliner(const void *ID) 
   : CallGraphSCCPass((intptr_t)ID), InlineThreshold(InlineLimit) {}
index f3adb56..453b494 100644 (file)
@@ -28,20 +28,19 @@ using namespace llvm;
 STATISTIC(NumFunctions, "Number of functions internalized");
 STATISTIC(NumGlobals  , "Number of global vars internalized");
 
-namespace {
-
-  // APIFile - A file which contains a list of symbols that should not be marked
-  // external.
-  static cl::opt<std::string>
-  APIFile("internalize-public-api-file", cl::value_desc("filename"),
-          cl::desc("A file containing list of symbol names to preserve"));
+// APIFile - A file which contains a list of symbols that should not be marked
+// external.
+static cl::opt<std::string>
+APIFile("internalize-public-api-file", cl::value_desc("filename"),
+        cl::desc("A file containing list of symbol names to preserve"));
 
-  // APIList - A list of symbols that should not be marked internal.
-  static cl::list<std::string>
-  APIList("internalize-public-api-list", cl::value_desc("list"),
-          cl::desc("A list of symbol names to preserve"),
-          cl::CommaSeparated);
+// APIList - A list of symbols that should not be marked internal.
+static cl::list<std::string>
+APIList("internalize-public-api-list", cl::value_desc("list"),
+        cl::desc("A list of symbol names to preserve"),
+        cl::CommaSeparated);
 
+namespace {
   class VISIBILITY_HIDDEN InternalizePass : public ModulePass {
     std::set<std::string> ExternalNames;
     bool DontInternalize;
@@ -52,10 +51,12 @@ namespace {
     void LoadFile(const char *Filename);
     virtual bool runOnModule(Module &M);
   };
-  char InternalizePass::ID = 0;
-  RegisterPass<InternalizePass> X("internalize", "Internalize Global Symbols");
 } // end anonymous namespace
 
+char InternalizePass::ID = 0;
+static RegisterPass<InternalizePass>
+X("internalize", "Internalize Global Symbols");
+
 InternalizePass::InternalizePass(bool InternalizeEverything) 
   : ModulePass((intptr_t)&ID), DontInternalize(false){
   if (!APIFile.empty())           // If a filename is specified, use it
index 54fc442..10ec306 100644 (file)
@@ -52,22 +52,24 @@ namespace {
       AU.addRequired<LoopInfo>();
     }
   };
+}
 
-  char LoopExtractor::ID = 0;
-  RegisterPass<LoopExtractor>
-  X("loop-extract", "Extract loops into new functions");
+char LoopExtractor::ID = 0;
+static RegisterPass<LoopExtractor>
+X("loop-extract", "Extract loops into new functions");
 
+namespace {
   /// SingleLoopExtractor - For bugpoint.
   struct SingleLoopExtractor : public LoopExtractor {
     static char ID; // Pass identification, replacement for typeid
     SingleLoopExtractor() : LoopExtractor(1) {}
   };
-
-  char SingleLoopExtractor::ID = 0;
-  RegisterPass<SingleLoopExtractor>
-  Y("loop-extract-single", "Extract at most one loop into a new function");
 } // End anonymous namespace
 
+char SingleLoopExtractor::ID = 0;
+static RegisterPass<SingleLoopExtractor>
+Y("loop-extract-single", "Extract at most one loop into a new function");
+
 // createLoopExtractorPass - This pass extracts all natural loops from the
 // program into a function if it can.
 //
@@ -146,14 +148,14 @@ FunctionPass *llvm::createSingleLoopExtractorPass() {
 }
 
 
-namespace {
-  // BlockFile - A file which contains a list of blocks that should not be
-  // extracted.
-  static cl::opt<std::string>
-  BlockFile("extract-blocks-file", cl::value_desc("filename"),
-            cl::desc("A file containing list of basic blocks to not extract"),
-            cl::Hidden);
+// BlockFile - A file which contains a list of blocks that should not be
+// extracted.
+static cl::opt<std::string>
+BlockFile("extract-blocks-file", cl::value_desc("filename"),
+          cl::desc("A file containing list of basic blocks to not extract"),
+          cl::Hidden);
 
+namespace {
   /// BlockExtractorPass - This pass is used by bugpoint to extract all blocks
   /// from the module into their own functions except for those specified by the
   /// BlocksToNotExtract list.
@@ -173,12 +175,12 @@ namespace {
 
     bool runOnModule(Module &M);
   };
-
-  char BlockExtractorPass::ID = 0;
-  RegisterPass<BlockExtractorPass>
-  XX("extract-blocks", "Extract Basic Blocks From Module (for bugpoint use)");
 }
 
+char BlockExtractorPass::ID = 0;
+static RegisterPass<BlockExtractorPass>
+XX("extract-blocks", "Extract Basic Blocks From Module (for bugpoint use)");
+
 // createBlockExtractorPass - This pass extracts all blocks (except those
 // specified in the argument list) from the functions in the module.
 //
index 2db8257..0faaeb1 100644 (file)
@@ -122,11 +122,11 @@ namespace {
     bool runOnModule(Module& M);
     bool doInitialization(Module& M);
   };
-
-  char LowerSetJmp::ID = 0;
-  RegisterPass<LowerSetJmp> X("lowersetjmp", "Lower Set Jump");
 } // end anonymous namespace
 
+char LowerSetJmp::ID = 0;
+static RegisterPass<LowerSetJmp> X("lowersetjmp", "Lower Set Jump");
+
 // run - Run the transformation on the program. We grab the function
 // prototypes for longjmp and setjmp. If they are used in the program,
 // then we can go directly to the places they're at and transform them.
index 0181605..ceb9e3e 100644 (file)
@@ -43,11 +43,12 @@ namespace {
     bool SimplifyFunction(Function *F);
     void DeleteBasicBlock(BasicBlock *BB);
   };
-
-  char PruneEH::ID = 0;
-  RegisterPass<PruneEH> X("prune-eh", "Remove unused exception handling info");
 }
 
+char PruneEH::ID = 0;
+static RegisterPass<PruneEH>
+X("prune-eh", "Remove unused exception handling info");
+
 Pass *llvm::createPruneEHPass() { return new PruneEH(); }
 
 
index 1f12fcf..0931dec 100644 (file)
@@ -48,12 +48,11 @@ namespace {
     //
     bool runOnModule(Module &M);
   };
-
-  char RaiseAllocations::ID = 0;
-  RegisterPass<RaiseAllocations>
-  X("raiseallocs", "Raise allocations from calls to instructions");
 }  // end anonymous namespace
 
+char RaiseAllocations::ID = 0;
+static RegisterPass<RaiseAllocations>
+X("raiseallocs", "Raise allocations from calls to instructions");
 
 // createRaiseAllocationsPass - The interface to this file...
 ModulePass *llvm::createRaiseAllocationsPass() {
index ca8a436..7db0aa8 100644 (file)
@@ -34,12 +34,12 @@ public:
   virtual bool runOnModule(Module &M);
 };
 
-char StripDeadPrototypesPass::ID = 0;
-RegisterPass<StripDeadPrototypesPass> X("strip-dead-prototypes", 
-                                        "Strip Unused Function Prototypes");
-
 } // end anonymous namespace
 
+char StripDeadPrototypesPass::ID = 0;
+static RegisterPass<StripDeadPrototypesPass>
+X("strip-dead-prototypes", "Strip Unused Function Prototypes");
+
 bool StripDeadPrototypesPass::runOnModule(Module &M) {
   bool MadeChange = false;
   
index cd23962..63e1a7b 100644 (file)
@@ -46,11 +46,12 @@ namespace {
       AU.setPreservesAll();
     }
   };
-
-  char StripSymbols::ID = 0;
-  RegisterPass<StripSymbols> X("strip", "Strip all symbols from a module");
 }
 
+char StripSymbols::ID = 0;
+static RegisterPass<StripSymbols>
+X("strip", "Strip all symbols from a module");
+
 ModulePass *llvm::createStripSymbolsPass(bool OnlyDebugInfo) {
   return new StripSymbols(OnlyDebugInfo);
 }
index 34d9774..4f4f574 100644 (file)
@@ -58,12 +58,12 @@ namespace {
     void updateCallSites(Function *F, Function *NF);
     bool nestedStructType(const StructType *STy);
   };
-
-  char SRETPromotion::ID = 0;
-  RegisterPass<SRETPromotion> X("sretpromotion",
-                               "Promote sret arguments to multiple ret values");
 }
 
+char SRETPromotion::ID = 0;
+static RegisterPass<SRETPromotion>
+X("sretpromotion", "Promote sret arguments to multiple ret values");
+
 Pass *llvm::createStructRetPromotionPass() {
   return new SRETPromotion();
 }
index 7068db2..acde018 100644 (file)
@@ -36,14 +36,14 @@ namespace {
     static char ID;
     bool runOnModule(Module &M);
   };
+}
 
-  char FunctionProfiler::ID = 0;
-
-  RegisterPass<FunctionProfiler> X("insert-function-profiling",
-                               "Insert instrumentation for function profiling");
-  RegisterAnalysisGroup<RSProfilers> XG(X);
+char FunctionProfiler::ID = 0;
 
-}
+static RegisterPass<FunctionProfiler>
+X("insert-function-profiling",
+  "Insert instrumentation for function profiling");
+static RegisterAnalysisGroup<RSProfilers> XG(X);
 
 ModulePass *llvm::createFunctionProfilerPass() {
   return new FunctionProfiler();
@@ -86,13 +86,13 @@ namespace {
   public:
     static char ID;
   };
-
-  char BlockProfiler::ID = 0;
-  RegisterPass<BlockProfiler> Y("insert-block-profiling",
-                                "Insert instrumentation for block profiling");
-  RegisterAnalysisGroup<RSProfilers> YG(Y);
 }
 
+char BlockProfiler::ID = 0;
+static RegisterPass<BlockProfiler>
+Y("insert-block-profiling", "Insert instrumentation for block profiling");
+static RegisterAnalysisGroup<RSProfilers> YG(Y);
+
 ModulePass *llvm::createBlockProfilerPass() { return new BlockProfiler(); }
 
 bool BlockProfiler::runOnModule(Module &M) {
index 72f43e5..2cf824b 100644 (file)
@@ -36,12 +36,12 @@ namespace {
     static char ID; // Pass identification, replacement for typeid
     EdgeProfiler() : ModulePass((intptr_t)&ID) {}
   };
-
-  char EdgeProfiler::ID = 0;
-  RegisterPass<EdgeProfiler> X("insert-edge-profiling",
-                               "Insert instrumentation for edge profiling");
 }
 
+char EdgeProfiler::ID = 0;
+static RegisterPass<EdgeProfiler>
+X("insert-edge-profiling", "Insert instrumentation for edge profiling");
+
 ModulePass *llvm::createEdgeProfilerPass() { return new EdgeProfiler(); }
 
 bool EdgeProfiler::runOnModule(Module &M) {
index c22a29f..62c9ddd 100644 (file)
@@ -55,16 +55,18 @@ namespace {
   enum RandomMeth {
     GBV, GBVO, HOSTCC
   };
+}
 
-  static cl::opt<RandomMeth> 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<RandomMeth> 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<RSProfilers> A("Profiling passes");
-  static RegisterPass<NullProfilerRS> NP("insert-null-profiling-rs",
-                                         "Measure profiling framework overhead");
-  static RegisterAnalysisGroup<RSProfilers, true> NPT(NP);
+static RegisterAnalysisGroup<RSProfilers> A("Profiling passes");
+static RegisterPass<NullProfilerRS> NP("insert-null-profiling-rs",
+                                       "Measure profiling framework overhead");
+static RegisterAnalysisGroup<RSProfilers, true> 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<ProfilerRS> X("insert-rs-profiling-framework",
-                             "Insert random sampling instrumentation framework");
 }
 
+static RegisterPass<ProfilerRS>
+X("insert-rs-profiling-framework",
+  "Insert random sampling instrumentation framework");
+
 char RSProfilers::ID = 0;
 char NullProfilerRS::ID = 0;
 char ProfilerRS::ID = 0;
index d909d02..c633f93 100644 (file)
@@ -106,11 +106,11 @@ private:
     markInstructionLive(const_cast<TerminatorInst*>(BB->getTerminator()));
   }
 };
-
-  char ADCE::ID = 0;
-  RegisterPass<ADCE> X("adce", "Aggressive Dead Code Elimination");
 } // End of anonymous namespace
 
+char ADCE::ID = 0;
+static RegisterPass<ADCE> X("adce", "Aggressive Dead Code Elimination");
+
 FunctionPass *llvm::createAggressiveDCEPass() { return new ADCE(); }
 
 void ADCE::markBlockAlive(BasicBlock *BB) {
index 9bde749..041bed2 100644 (file)
@@ -72,12 +72,12 @@ namespace {
     /// successors.
     void PlaceBlocks(BasicBlock *BB);
   };
-
-  char BlockPlacement::ID = 0;
-  RegisterPass<BlockPlacement> X("block-placement",
-                                 "Profile Guided Basic Block Placement");
 }
 
+char BlockPlacement::ID = 0;
+static RegisterPass<BlockPlacement>
+X("block-placement", "Profile Guided Basic Block Placement");
+
 FunctionPass *llvm::createBlockPlacementPass() { return new BlockPlacement(); }
 
 bool BlockPlacement::runOnFunction(Function &F) {
index bc19114..2dfd4d7 100644 (file)
@@ -483,6 +483,7 @@ static void EraseDeadInstructions(Value *V) {
   }
 }
 
+namespace {
 
 /// ExtAddrMode - This is an extended version of TargetLowering::AddrMode which
 /// holds actual Value*'s for register values.
@@ -517,6 +518,8 @@ void ExtAddrMode::dump() const {
   cerr << *this << "\n";
 }
 
+}
+
 static bool TryMatchingScaledValue(Value *ScaleReg, int64_t Scale,
                                    const Type *AccessTy, ExtAddrMode &AddrMode,
                                    SmallVector<Instruction*, 16> &AddrModeInsts,
index bed2b35..c1e4195 100644 (file)
@@ -48,10 +48,10 @@ namespace {
     void SimplifyPredecessors(SwitchInst *SI);
     void RevectorBlockTo(BasicBlock *FromBB, BasicBlock *ToBB);
   };
-  
-  char CondProp::ID = 0;
-  RegisterPass<CondProp> X("condprop", "Conditional Propagation");
 }
+  
+char CondProp::ID = 0;
+static RegisterPass<CondProp> X("condprop", "Conditional Propagation");
 
 FunctionPass *llvm::createCondPropagationPass() {
   return new CondProp();
index 60b915a..90e8dad 100644 (file)
@@ -43,12 +43,12 @@ namespace {
       AU.setPreservesCFG();
     }
   };
-
-  char ConstantPropagation::ID = 0;
-  RegisterPass<ConstantPropagation> X("constprop",
-                                      "Simple constant propagation");
 }
 
+char ConstantPropagation::ID = 0;
+static RegisterPass<ConstantPropagation>
+X("constprop", "Simple constant propagation");
+
 FunctionPass *llvm::createConstantPropagationPass() {
   return new ConstantPropagation();
 }
index 539dd22..a63fcb6 100644 (file)
@@ -52,11 +52,12 @@ namespace {
       AU.setPreservesCFG();
     }
   };
-
-  char DeadInstElimination::ID = 0;
-  RegisterPass<DeadInstElimination> X("die", "Dead Instruction Elimination");
 }
 
+char DeadInstElimination::ID = 0;
+static RegisterPass<DeadInstElimination>
+X("die", "Dead Instruction Elimination");
+
 Pass *llvm::createDeadInstEliminationPass() {
   return new DeadInstElimination();
 }
@@ -76,11 +77,11 @@ namespace {
       AU.setPreservesCFG();
     }
  };
-
-  char DCE::ID = 0;
-  RegisterPass<DCE> Y("dce", "Dead Code Elimination");
 }
 
+char DCE::ID = 0;
+static RegisterPass<DCE> Y("dce", "Dead Code Elimination");
+
 bool DCE::runOnFunction(Function &F) {
   // Start out with all of the instructions in the worklist...
   std::vector<Instruction*> WorkList;
index 89afa91..bbb3a8a 100644 (file)
@@ -92,10 +92,11 @@ namespace {
       AU.addPreserved<MemoryDependenceAnalysis>();
     }
   };
-  char DSE::ID = 0;
-  RegisterPass<DSE> X("dse", "Dead Store Elimination");
 }
 
+char DSE::ID = 0;
+static RegisterPass<DSE> X("dse", "Dead Store Elimination");
+
 FunctionPass *llvm::createDeadStoreEliminationPass() { return new DSE(); }
 
 bool DSE::runOnBasicBlock(BasicBlock &BB) {
index 39a1b25..35752bb 100644 (file)
@@ -52,11 +52,12 @@ namespace {
       AU.addRequired<ValueNumbering>();
     }
   };
-
-  char GCSE::ID = 0;
-  RegisterPass<GCSE> X("gcse", "Global Common Subexpression Elimination");
 }
 
+char GCSE::ID = 0;
+static RegisterPass<GCSE>
+X("gcse", "Global Common Subexpression Elimination");
+
 // createGCSEPass - The public interface to this file...
 FunctionPass *llvm::createGCSEPass() { return new GCSE(); }
 
index 3bd6bff..80d74e6 100644 (file)
@@ -45,6 +45,8 @@ using namespace llvm;
 //                         ValueTable Class
 //===----------------------------------------------------------------------===//
 
+namespace {
+
 /// This class holds the mapping between values and value numbers.  It is used
 /// as an efficient mechanism to determine the expression-wise equivalence of
 /// two values.
@@ -123,6 +125,7 @@ struct Expression {
   }
 };
 
+}
 
 namespace {
   class VISIBILITY_HIDDEN ValueTable {
@@ -596,6 +599,8 @@ unsigned ValueTable::size() {
   return nextValueNumber;
 }
 
+namespace {
+
 //===----------------------------------------------------------------------===//
 //                       ValueNumberedSet Class
 //===----------------------------------------------------------------------===//
@@ -652,6 +657,8 @@ class ValueNumberedSet {
     }
 };
 
+}
+
 //===----------------------------------------------------------------------===//
 //                         GVNPRE Pass
 //===----------------------------------------------------------------------===//
index 4305422..4de19a9 100644 (file)
@@ -94,11 +94,12 @@ namespace {
 
     void DeleteTriviallyDeadInstructions(std::set<Instruction*> &Insts);
   };
-
-  char IndVarSimplify::ID = 0;
-  RegisterPass<IndVarSimplify> X("indvars", "Canonicalize Induction Variables");
 }
 
+char IndVarSimplify::ID = 0;
+static RegisterPass<IndVarSimplify>
+X("indvars", "Canonicalize Induction Variables");
+
 LoopPass *llvm::createIndVarSimplifyPass() {
   return new IndVarSimplify();
 }
index f359187..0662055 100644 (file)
@@ -8,8 +8,8 @@
 //===----------------------------------------------------------------------===//
 //
 // InstructionCombining - Combine instructions to form fewer, simple
-// instructions.  This pass does not modify the CFG This pass is where algebraic
-// simplification happens.
+// instructions.  This pass does not modify the CFG.  This pass is where
+// algebraic simplification happens.
 //
 // This pass combines things like:
 //    %Y = add i32 %X, 1
@@ -384,11 +384,12 @@ namespace {
     unsigned GetOrEnforceKnownAlignment(Value *V,
                                         unsigned PrefAlign = 0);
   };
-
-  char InstCombiner::ID = 0;
-  RegisterPass<InstCombiner> X("instcombine", "Combine redundant instructions");
 }
 
+char InstCombiner::ID = 0;
+static RegisterPass<InstCombiner>
+X("instcombine", "Combine redundant instructions");
+
 // getComplexity:  Assign a complexity or rank value to LLVM Values...
 //   0 -> undef, 1 -> Const, 2 -> Other, 3 -> Arg, 3 -> Unary, 4 -> OtherInst
 static unsigned getComplexity(Value *V) {
@@ -2151,6 +2152,7 @@ Instruction *AssociativeOpt(BinaryOperator &Root, const Functor &F) {
   return 0;
 }
 
+namespace {
 
 // AddRHS - Implements: X + X --> X << 1
 struct AddRHS {
@@ -2178,6 +2180,8 @@ struct AddMaskingAnd {
   }
 };
 
+}
+
 static Value *FoldOperationIntoSelectOperand(Instruction &I, Value *SO,
                                              InstCombiner *IC) {
   if (CastInst *CI = dyn_cast<CastInst>(&I)) {
@@ -4635,6 +4639,8 @@ Instruction *InstCombiner::visitOr(BinaryOperator &I) {
   return Changed ? &I : 0;
 }
 
+namespace {
+
 // XorSelf - Implements: X ^ X --> 0
 struct XorSelf {
   Value *RHS;
@@ -4645,6 +4651,7 @@ struct XorSelf {
   }
 };
 
+}
 
 Instruction *InstCombiner::visitXor(BinaryOperator &I) {
   bool Changed = SimplifyCommutative(I);
index 991b111..d79a6ce 100644 (file)
@@ -63,10 +63,12 @@ namespace {
     bool ProcessBranchOnLogical(Value *V, BasicBlock *BB, bool isAnd);
     bool ProcessBranchOnCompare(CmpInst *Cmp, BasicBlock *BB);
   };
-  char JumpThreading::ID = 0;
-  RegisterPass<JumpThreading> X("jump-threading", "Jump Threading");
 }
 
+char JumpThreading::ID = 0;
+static RegisterPass<JumpThreading>
+X("jump-threading", "Jump Threading");
+
 // Public interface to the Jump Threading pass
 FunctionPass *llvm::createJumpThreadingPass() { return new JumpThreading(); }
 
index 2d53532..695a4fb 100644 (file)
@@ -58,11 +58,11 @@ STATISTIC(NumMovedLoads, "Number of load insts hoisted or sunk");
 STATISTIC(NumMovedCalls, "Number of call insts hoisted or sunk");
 STATISTIC(NumPromoted  , "Number of memory locations promoted to registers");
 
-namespace {
-  static cl::opt<bool>
-  DisablePromotion("disable-licm-promotion", cl::Hidden,
-                   cl::desc("Disable memory promotion in LICM pass"));
+static cl::opt<bool>
+DisablePromotion("disable-licm-promotion", cl::Hidden,
+                 cl::desc("Disable memory promotion in LICM pass"));
 
+namespace {
   struct VISIBILITY_HIDDEN LICM : public LoopPass {
     static char ID; // Pass identification, replacement for typeid
     LICM() : LoopPass((intptr_t)&ID) {}
@@ -216,11 +216,11 @@ namespace {
                    std::vector<std::pair<AllocaInst*, Value*> > &PromotedValues,
                                     std::map<Value*, AllocaInst*> &Val2AlMap);
   };
-
-  char LICM::ID = 0;
-  RegisterPass<LICM> X("licm", "Loop Invariant Code Motion");
 }
 
+char LICM::ID = 0;
+static RegisterPass<LICM> X("licm", "Loop Invariant Code Motion");
+
 LoopPass *llvm::createLICMPass() { return new LICM(); }
 
 /// Hoist expressions out of the specified loop. Note, alias info for inner
index 02a5ca9..c26a66c 100644 (file)
@@ -52,10 +52,10 @@ namespace {
       AU.addPreservedID(LCSSAID);
     }
   };
-  
-  char LoopDeletion::ID = 0;
-  RegisterPass<LoopDeletion> X ("loop-deletion", "Delete dead loops");
 }
+  
+char LoopDeletion::ID = 0;
+static RegisterPass<LoopDeletion> X("loop-deletion", "Delete dead loops");
 
 LoopPass* llvm::createLoopDeletionPass() {
   return new LoopDeletion();
index a6bd9ff..6113b24 100644 (file)
@@ -195,11 +195,12 @@ namespace {
     // Induction variable's final loop exit value operand number in exit condition..
     unsigned ExitValueNum;
   };
-
-  char LoopIndexSplit::ID = 0;
-  RegisterPass<LoopIndexSplit> X ("loop-index-split", "Index Split Loops");
 }
 
+char LoopIndexSplit::ID = 0;
+static RegisterPass<LoopIndexSplit>
+X("loop-index-split", "Index Split Loops");
+
 LoopPass *llvm::createLoopIndexSplitPass() {
   return new LoopIndexSplit();
 }
index 91a96bc..d8362a5 100644 (file)
@@ -102,10 +102,10 @@ namespace {
     LPPassManager *LPM_Ptr;
     SmallVector<RenameData, MAX_HEADER_SIZE> LoopHeaderInfo;
   };
-  
-  char LoopRotate::ID = 0;
-  RegisterPass<LoopRotate> X ("loop-rotate", "Rotate Loops");
 }
+  
+char LoopRotate::ID = 0;
+static RegisterPass<LoopRotate> X("loop-rotate", "Rotate Loops");
 
 LoopPass *llvm::createLoopRotatePass() { return new LoopRotate(); }
 
index 4dc7d60..6d66d14 100644 (file)
@@ -194,10 +194,12 @@ private:
                                       Loop *L, bool isOnlyStride);
     void DeleteTriviallyDeadInstructions(SmallPtrSet<Instruction*,16> &Insts);
   };
-  char LoopStrengthReduce::ID = 0;
-  RegisterPass<LoopStrengthReduce> X("loop-reduce", "Loop Strength Reduction");
 }
 
+char LoopStrengthReduce::ID = 0;
+static RegisterPass<LoopStrengthReduce>
+X("loop-reduce", "Loop Strength Reduction");
+
 LoopPass *llvm::createLoopStrengthReducePass(const TargetLowering *TLI) {
   return new LoopStrengthReduce(TLI);
 }
index 0db9641..d329970 100644 (file)
@@ -44,17 +44,15 @@ using namespace llvm;
 STATISTIC(NumCompletelyUnrolled, "Number of loops completely unrolled");
 STATISTIC(NumUnrolled,    "Number of loops unrolled (completely or otherwise)");
 
-namespace {
-  static cl::opt<unsigned>
-  UnrollThreshold
-    ("unroll-threshold", cl::init(100), cl::Hidden,
-     cl::desc("The cut-off point for automatic loop unrolling"));
+static cl::opt<unsigned>
+UnrollThreshold("unroll-threshold", cl::init(100), cl::Hidden,
+  cl::desc("The cut-off point for automatic loop unrolling"));
 
-  static cl::opt<unsigned>
-  UnrollCount
-    ("unroll-count", cl::init(0), cl::Hidden,
-     cl::desc("Use this unroll count for all loops, for testing purposes"));
+static cl::opt<unsigned>
+UnrollCount("unroll-count", cl::init(0), cl::Hidden,
+  cl::desc("Use this unroll count for all loops, for testing purposes"));
 
+namespace {
   class VISIBILITY_HIDDEN LoopUnroll : public LoopPass {
     LoopInfo *LI;  // The current loop information
   public:
@@ -81,10 +79,11 @@ namespace {
       AU.addPreserved<LoopInfo>();
     }
   };
-  char LoopUnroll::ID = 0;
-  RegisterPass<LoopUnroll> X("loop-unroll", "Unroll loops");
 }
 
+char LoopUnroll::ID = 0;
+static RegisterPass<LoopUnroll> X("loop-unroll", "Unroll loops");
+
 LoopPass *llvm::createLoopUnrollPass() { return new LoopUnroll(); }
 
 /// ApproximateLoopSize - Approximate the size of the loop.
index 5af0a57..7806987 100644 (file)
@@ -54,11 +54,11 @@ STATISTIC(NumSelects , "Number of selects unswitched");
 STATISTIC(NumTrivial , "Number of unswitches that are trivial");
 STATISTIC(NumSimplify, "Number of simplifications of unswitched code");
 
-namespace {
-  static cl::opt<unsigned>
-  Threshold("loop-unswitch-threshold", cl::desc("Max loop size to unswitch"),
-            cl::init(10), cl::Hidden);
+static cl::opt<unsigned>
+Threshold("loop-unswitch-threshold", cl::desc("Max loop size to unswitch"),
+          cl::init(10), cl::Hidden);
   
+namespace {
   class VISIBILITY_HIDDEN LoopUnswitch : public LoopPass {
     LoopInfo *LI;  // Loop information
     LPPassManager *LPM;
@@ -144,9 +144,9 @@ namespace {
                            std::vector<Instruction*> &Worklist, Loop *l);
     void RemoveLoopFromHierarchy(Loop *L);
   };
-  char LoopUnswitch::ID = 0;
-  RegisterPass<LoopUnswitch> X("loop-unswitch", "Unswitch loops");
 }
+char LoopUnswitch::ID = 0;
+static RegisterPass<LoopUnswitch> X("loop-unswitch", "Unswitch loops");
 
 LoopPass *llvm::createLoopUnswitchPass(bool Os) { 
   return new LoopUnswitch(Os); 
@@ -459,11 +459,11 @@ static inline void RemapInstruction(Instruction *I,
 // OrigPreheader is loop pre-header before this pass started
 // updating CFG. NewPrehader is loops new pre-header. However, after CFG
 // manipulation, loop L may not exist. So rely on input parameter NewPreheader.
-void CloneDomInfo(BasicBlock *NewBB, BasicBlock *Orig, 
-                  BasicBlock *NewPreheader, BasicBlock *OrigPreheader, 
-                  BasicBlock *OrigHeader,
-                  DominatorTree *DT, DominanceFrontier *DF,
-                  DenseMap<const Value*, Value*> &VM) {
+static void CloneDomInfo(BasicBlock *NewBB, BasicBlock *Orig,
+                         BasicBlock *NewPreheader, BasicBlock *OrigPreheader,
+                         BasicBlock *OrigHeader,
+                         DominatorTree *DT, DominanceFrontier *DF,
+                         DenseMap<const Value*, Value*> &VM) {
 
   // If NewBB alreay has found its place in domiantor tree then no need to do
   // anything.
index 1b36d84..5c79444 100644 (file)
@@ -2646,12 +2646,12 @@ namespace {
       }
     }
   }
-
-  char PredicateSimplifier::ID = 0;
-  RegisterPass<PredicateSimplifier> X("predsimplify",
-                                      "Predicate Simplifier");
 }
 
+char PredicateSimplifier::ID = 0;
+static RegisterPass<PredicateSimplifier>
+X("predsimplify", "Predicate Simplifier");
+
 FunctionPass *llvm::createPredicateSimplifierPass() {
   return new PredicateSimplifier();
 }
index 0a118cd..e2d133c 100644 (file)
@@ -64,7 +64,7 @@ static void PrintOps(Instruction *I, const std::vector<ValueEntry> &Ops) {
       << "," << Ops[i].Rank;
 }
   
-namespace {  
+namespace {
   class VISIBILITY_HIDDEN Reassociate : public FunctionPass {
     std::map<BasicBlock*, unsigned> RankMap;
     std::map<Value*, unsigned> ValueRankMap;
@@ -92,11 +92,11 @@ namespace {
     
     void RemoveDeadBinaryOp(Value *V);
   };
-
-  char Reassociate::ID = 0;
-  RegisterPass<Reassociate> X("reassociate", "Reassociate expressions");
 }
 
+char Reassociate::ID = 0;
+static RegisterPass<Reassociate> X("reassociate", "Reassociate expressions");
+
 // Public interface to the Reassociate pass
 FunctionPass *llvm::createReassociatePass() { return new Reassociate(); }
 
index eda0c0e..b31b1d1 100644 (file)
@@ -111,10 +111,11 @@ namespace {
       return false;
     }
   };
-  
-  char RegToMem::ID = 0;
-  RegisterPass<RegToMem> X("reg2mem", "Demote all values to stack slots");
 }
+  
+char RegToMem::ID = 0;
+static RegisterPass<RegToMem>
+X("reg2mem", "Demote all values to stack slots");
 
 // createDemoteRegisterToMemory - Provide an entry point to create this pass.
 //
index 168e544..9c17b77 100644 (file)
@@ -1435,11 +1435,11 @@ namespace {
       AU.setPreservesCFG();
     }
   };
-
-  char SCCP::ID = 0;
-  RegisterPass<SCCP> X("sccp", "Sparse Conditional Constant Propagation");
 } // end anonymous namespace
 
+char SCCP::ID = 0;
+static RegisterPass<SCCP>
+X("sccp", "Sparse Conditional Constant Propagation");
 
 // createSCCPPass - This is the public interface to this file...
 FunctionPass *llvm::createSCCPPass() {
@@ -1543,12 +1543,12 @@ namespace {
     IPSCCP() : ModulePass((intptr_t)&ID) {}
     bool runOnModule(Module &M);
   };
-
-  char IPSCCP::ID = 0;
-  RegisterPass<IPSCCP>
-  Y("ipsccp", "Interprocedural Sparse Conditional Constant Propagation");
 } // end anonymous namespace
 
+char IPSCCP::ID = 0;
+static RegisterPass<IPSCCP>
+Y("ipsccp", "Interprocedural Sparse Conditional Constant Propagation");
+
 // createIPSCCPPass - This is the public interface to this file...
 ModulePass *llvm::createIPSCCPPass() {
   return new IPSCCP();
index 51aad84..0cd10ef 100644 (file)
@@ -124,11 +124,11 @@ namespace {
                                       unsigned Offset);
     static Instruction *isOnlyCopiedFromConstantGlobal(AllocationInst *AI);
   };
-
-  char SROA::ID = 0;
-  RegisterPass<SROA> X("scalarrepl", "Scalar Replacement of Aggregates");
 }
 
+char SROA::ID = 0;
+static RegisterPass<SROA> X("scalarrepl", "Scalar Replacement of Aggregates");
+
 // Public interface to the ScalarReplAggregates pass
 FunctionPass *llvm::createScalarReplAggregatesPass(signed int Threshold) { 
   return new SROA(Threshold);
index 48342bd..a42bc34 100644 (file)
@@ -45,10 +45,11 @@ namespace {
 
     virtual bool runOnFunction(Function &F);
   };
-  char CFGSimplifyPass::ID = 0;
-  RegisterPass<CFGSimplifyPass> X("simplifycfg", "Simplify the CFG");
 }
 
+char CFGSimplifyPass::ID = 0;
+static RegisterPass<CFGSimplifyPass> X("simplifycfg", "Simplify the CFG");
+
 // Public interface to the CFGSimplification pass
 FunctionPass *llvm::createCFGSimplificationPass() {
   return new CFGSimplifyPass();
index f9b8ace..40da808 100644 (file)
@@ -37,10 +37,11 @@ using namespace llvm;
 
 STATISTIC(NumEliminated, "Number of unconditional branches eliminated");
 
+static cl::opt<unsigned>
+Threshold("taildup-threshold", cl::desc("Max block size to tail duplicate"),
+          cl::init(6), cl::Hidden);
+
 namespace {
-  cl::opt<unsigned>
-  Threshold("taildup-threshold", cl::desc("Max block size to tail duplicate"),
-            cl::init(6), cl::Hidden);
   class VISIBILITY_HIDDEN TailDup : public FunctionPass {
     bool runOnFunction(Function &F);
   public:
@@ -51,10 +52,11 @@ namespace {
     inline bool shouldEliminateUnconditionalBranch(TerminatorInst *TI);
     inline void eliminateUnconditionalBranch(BranchInst *BI);
   };
-  char TailDup::ID = 0;
-  RegisterPass<TailDup> X("tailduplicate", "Tail Duplication");
 }
 
+char TailDup::ID = 0;
+static RegisterPass<TailDup> X("tailduplicate", "Tail Duplication");
+
 // Public interface to the Tail Duplication pass
 FunctionPass *llvm::createTailDuplicationPass() { return new TailDup(); }
 
index 78b088a..b9de782 100644 (file)
@@ -80,10 +80,11 @@ namespace {
     bool CanMoveAboveCall(Instruction *I, CallInst *CI);
     Value *CanTransformAccumulatorRecursion(Instruction *I, CallInst *CI);
   };
-  char TailCallElim::ID = 0;
-  RegisterPass<TailCallElim> X("tailcallelim", "Tail Call Elimination");
 }
 
+char TailCallElim::ID = 0;
+static RegisterPass<TailCallElim> X("tailcallelim", "Tail Call Elimination");
+
 // Public interface to the TailCallElimination pass
 FunctionPass *llvm::createTailCallEliminationPass() {
   return new TailCallElim();
index a3f294d..5c2c698 100644 (file)
 
 using namespace llvm;
 
-namespace {
-  static cl::opt<unsigned>     
-  BasicInlineThreshold("inline-threshold", cl::Hidden, cl::init(200),
-                       cl::desc("Control the amount of basic inlining to perform (default = 200)"));
-}
+static cl::opt<unsigned>     
+BasicInlineThreshold("inline-threshold", cl::Hidden, cl::init(200),
+                     cl::desc("Control the amount of basic inlining to perform (default = 200)"));
 
 namespace llvm {
 
index e230ca6..4bf7bac 100644 (file)
@@ -48,12 +48,12 @@ namespace {
       AU.addPreservedID(LoopSimplifyID);
     }
   };
-
-  char BreakCriticalEdges::ID = 0;
-  RegisterPass<BreakCriticalEdges> X("break-crit-edges",
-                                    "Break critical edges in CFG");
 }
 
+char BreakCriticalEdges::ID = 0;
+static RegisterPass<BreakCriticalEdges>
+X("break-crit-edges", "Break critical edges in CFG");
+
 // Publically exposed interface to pass...
 const PassInfo *llvm::BreakCriticalEdgesID = X.getPassInfo();
 FunctionPass *llvm::createBreakCriticalEdgesPass() {
index 3931467..ff5f863 100644 (file)
@@ -94,10 +94,10 @@ namespace {
       return std::binary_search(LoopBlocks.begin(), LoopBlocks.end(), B);
     }
   };
-  
-  char LCSSA::ID = 0;
-  RegisterPass<LCSSA> X("lcssa", "Loop-Closed SSA Form Pass");
 }
+  
+char LCSSA::ID = 0;
+static RegisterPass<LCSSA> X("lcssa", "Loop-Closed SSA Form Pass");
 
 LoopPass *llvm::createLCSSAPass() { return new LCSSA(); }
 const PassInfo *llvm::LCSSAID = X.getPassInfo();
index 8e30e04..9351837 100644 (file)
@@ -95,12 +95,12 @@ namespace {
                                   SmallVectorImpl<BasicBlock*> &SplitPreds,
                                   Loop *L);
   };
-
-  char LoopSimplify::ID = 0;
-  RegisterPass<LoopSimplify>
-  X("loopsimplify", "Canonicalize natural loops", true);
 }
 
+char LoopSimplify::ID = 0;
+static RegisterPass<LoopSimplify>
+X("loopsimplify", "Canonicalize natural loops", true);
+
 // Publically exposed interface to pass...
 const PassInfo *llvm::LoopSimplifyID = X.getPassInfo();
 FunctionPass *llvm::createLoopSimplifyPass() { return new LoopSimplify(); }
index 8708f99..edce5e1 100644 (file)
@@ -66,12 +66,12 @@ namespace {
     ///
     bool runOnBasicBlock(BasicBlock &BB);
   };
-
-  char LowerAllocations::ID = 0;
-  RegisterPass<LowerAllocations>
-  X("lowerallocs", "Lower allocations from instructions to calls");
 }
 
+char LowerAllocations::ID = 0;
+static RegisterPass<LowerAllocations>
+X("lowerallocs", "Lower allocations from instructions to calls");
+
 // Publically exposed interface to pass...
 const PassInfo *llvm::LowerAllocationsID = X.getPassInfo();
 // createLowerAllocationsPass - Interface to this file...
index 3d356b7..0530e52 100644 (file)
@@ -98,12 +98,12 @@ namespace {
                                 AllocaInst *InvokeNum, SwitchInst *CatchSwitch);
     bool insertExpensiveEHSupport(Function &F);
   };
-
-  char LowerInvoke::ID = 0;
-  RegisterPass<LowerInvoke>
-  X("lowerinvoke", "Lower invoke and unwind, for unwindless code generators");
 }
 
+char LowerInvoke::ID = 0;
+static RegisterPass<LowerInvoke>
+X("lowerinvoke", "Lower invoke and unwind, for unwindless code generators");
+
 const PassInfo *llvm::LowerInvokePassID = X.getPassInfo();
 
 // Public Interface To the LowerInvoke pass.
index d75880f..9ddb2cd 100644 (file)
@@ -77,12 +77,12 @@ namespace {
       return CI1->getValue().slt(CI2->getValue());
     }
   };
-
-  char LowerSwitch::ID = 0;
-  RegisterPass<LowerSwitch>
-  X("lowerswitch", "Lower SwitchInst's to branches");
 }
 
+char LowerSwitch::ID = 0;
+static RegisterPass<LowerSwitch>
+X("lowerswitch", "Lower SwitchInst's to branches");
+
 // Publically exposed interface to pass...
 const PassInfo *llvm::LowerSwitchID = X.getPassInfo();
 // createLowerSwitchPass - Interface to this file...
index f9b1d8d..e402bb9 100644 (file)
@@ -48,11 +48,11 @@ namespace {
       AU.addPreservedID(LowerAllocationsID);
     }
   };
-
-  char PromotePass::ID = 0;
-  RegisterPass<PromotePass> X("mem2reg", "Promote Memory to Register");
 }  // end of anonymous namespace
 
+char PromotePass::ID = 0;
+static RegisterPass<PromotePass> X("mem2reg", "Promote Memory to Register");
+
 bool PromotePass::runOnFunction(Function &F) {
   std::vector<AllocaInst*> Allocas;
 
index 974678b..b327a6a 100644 (file)
@@ -1514,6 +1514,8 @@ void UndefValue::destroyConstant() {
 //---- ConstantExpr::get() implementations...
 //
 
+namespace {
+
 struct ExprMapKeyType {
   explicit ExprMapKeyType(unsigned opc, std::vector<Constant*> ops,
       unsigned short pred = 0) : opcode(opc), predicate(pred), operands(ops) { }
@@ -1537,6 +1539,8 @@ struct ExprMapKeyType {
   }
 };
 
+}
+
 namespace llvm {
   template<>
   struct ConstantCreator<ConstantExpr, Type, ExprMapKeyType> {
index 3123794..add6529 100644 (file)
@@ -360,10 +360,10 @@ public:
   }
 };
 
-static TimingInfo *TheTimeInfo;
-
 } // End of anon namespace
 
+static TimingInfo *TheTimeInfo;
+
 //===----------------------------------------------------------------------===//
 // PMTopLevelManager implementation
 
index 6339912..d7fe2d1 100644 (file)
@@ -550,6 +550,7 @@ void DerivedType::dropAllTypeUses() {
 }
 
 
+namespace {
 
 /// TypePromotionGraph and graph traits - this is designed to allow us to do
 /// efficient SCC processing of type graphs.  This is the exact same as
@@ -560,6 +561,8 @@ struct TypePromotionGraph {
   TypePromotionGraph(Type *T) : Ty(T) {}
 };
 
+}
+
 namespace llvm {
   template <> struct GraphTraits<TypePromotionGraph> {
     typedef Type NodeType;
index aec5974..4c6f9e0 100644 (file)
@@ -92,11 +92,14 @@ namespace {  // Anonymous namespace for class
       return false;
     }
   };
+}
 
-  char PreVerifier::ID = 0;
-  RegisterPass<PreVerifier> PreVer("preverify", "Preliminary module verification");
-  const PassInfo *PreVerifyID = PreVer.getPassInfo();
+char PreVerifier::ID = 0;
+static RegisterPass<PreVerifier>
+PreVer("preverify", "Preliminary module verification");
+static const PassInfo *PreVerifyID = PreVer.getPassInfo();
 
+namespace {
   struct VISIBILITY_HIDDEN
      Verifier : public FunctionPass, InstVisitor<Verifier> {
     static char ID; // Pass ID, replacement for typeid
@@ -305,11 +308,10 @@ namespace {  // Anonymous namespace for class
       Broken = true;
     }
   };
-
-  char Verifier::ID = 0;
-  RegisterPass<Verifier> X("verify", "Module Verifier");
 } // End anonymous namespace
 
+char Verifier::ID = 0;
+static RegisterPass<Verifier> X("verify", "Module Verifier");
 
 // Assert - We know that cond should be true, if not print an error message.
 #define Assert(C, M) \