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 04ad7de7bd3b9fb4d967ab32279938267fa223d2..be42f749b4d33994527f158b7661d1761fa601e1 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 9c42902a04c7b2cb9235428fee16bc04668e4251..48f00ad2225fba95340ea717bedb0e828b381715 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 704ab8273cc7b64fb0a2bdb4f81e3d6fd689fa2b..af15d0f4adf53c0662be29e4b26f05e827edd0bf 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 491c4b091ea6aaa4b62b6041ba9c1cd2879023b3..06a43b11dd5d3d04efc1edb3bc785786fca22147 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 01e700b768127971c08fd4a048e92b4d605f48af..68603e53b64ee40138123f257a9147dd8ee7b910 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 97dd56aa031942960267bbcde2252cf139236eb6..21108c645351c71ec7c079ad52b99f0519e3f5ed 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 f293555a693589e4aa68d1cb7c8946fd65f498e6..e20a0a2f876ffb43a46387f061b060591f8af5ab 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 ab80bab95c7064d8471cc7f57f012a386d8ec1c1..823a32f85fe4fed9993cb0a284a7635864c44abe 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 f0dd1880ff4e171667870dbe8b521cafb9b1f9cb..eaa0d0181afa7b9a82bf1627ac17ab95466e8466 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 99954d632d4d9beb5b086253faf1de1dd10ba549..112f9c2e5df747891685e3a66078c116e8f4fa21 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 6ce320964e9d2590ddab547dc6d5a827b8776225..6d6282029aee4f28588227cf7599207d0cfa7619 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 c4f36d3874cdb3c0da41e38fd3805c4fc6147e48..5f33a60e6fd39c499af10c2e0e078941a1daf9cc 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 bbb1e1e1b0dbdfadb7e94a1275e3e8aaa5d0610e..0317ddbc914042487363137ee04e0067b9c9697a 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 8a59c3a74316a631ba9bc18552a3e5648f8cff78..4af7b42fb7937beee1ca16c1a28830ac19571670 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 2ee398d1aa412662368a0c06f34358ea47429d1e..047491baeeeb5ef729b6f148c92409fa4f8b1a5a 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 e7612e1d821cb047bee7504579b6962711eb5db7..b2fa9e45e71759d85979c8794a2cc0165fc90b40 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 b757531bc112e65fee6eb24a687f4c342ca4456c..26010ebaa2fe3b7626d103b6d00edbb8bb58e4fd 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 6c3ffdf224c5c7af4e2d0bb33c658d2ef4af6212..1e4b306f62ec049fa9d3428030751671ca4c932e 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 fd0e30a71bfb4fa8b02a8a6c8b0ddb8c92dc9175..1ded9e5c4cc0692d9d1b6c56e0bf869b1fedd2be 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 d3861f32cbe47a459093203cb1a48cf870713c3c..c5d54fba7e02fc5babafaecb246fa85a794f9f0a 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 09a1db3d62886f85788529fe56a696428bd6d4d2..92271ce2b910301ccb33483a2a5913e2754f73bb 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 1807f98cb139f3844efe4581219ee05e5a1c78af..e935898f196003e389338ab6da28ac96b4201eaa 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 80085cd29de1e039f4755427c1cd588c0940206f..7a5a699a117fbf840dd3cde246b49a788dbb3768 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 87c854bd0271483256c0a0eff38121004dc2d609..8b25344b4771f98cfe4030acca773cb1ddc26d25 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 9b53bdb8b3f316cd213ca40569e100123b4e8213..0710c10d967e353b203503902a4a15ea5366c7fb 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 c2adb1e8b730957fd57d7a33ab369b614e3ec0b8..7f48ab5499f798bf97c50d05cfcab95a82e6cb18 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 007317ccb59948bf9ca429be18e06d56aef88169..ac3df435008a59d93b771389aa8d79aee386af0c 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 0cfcc61b780544e53e276c1c75c0364517455d51..2bad6bba836b7a33729c9978ee7ea182cd169aa1 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 97a4df5497fe5dcf7975f71ead3c14175f77fcbe..b4e72fed28db8c793b6a627b417ad87a27d56315 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 95022a9ed4dc1eee62b1c7866e4d97eb3b50ce6a..6b947b10507f8b912be32bcd64804c3ce9654d37 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 601bfd65d752fd0d8ac278106662f069c4979aa8..4a9077a0638d24a739ae59bb88fe4b5bd4b5f257 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 bcd67c5037f5a84ed032d4c34e5afe3adf466ecf..f67eb79be3e1c8828a2f4cc82328062075b49fed 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 0c6c25439a7794c461884db329e8ac6fceac6219..215f9430997ea6ef137307153f2dba495a3cdbee 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 3281a2c3daf7cde2f673fc86966cc57f2787ec3d..18e7656bd46e57ce60c67ed5a003a5e7dff65de7 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 9d25d2af890b353f39292d3a03558c51ef006cae..1131e3db4e7d10015116524d2c9579cde24b5a46 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 d2fe4718da40ce304525a520ae465fea6cde586a..f05f4445a8f6d6128546dbf3773aa236e8ce7e5f 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 241ad7e8a951a8baddf9df34ab114bf493fc7e83..f79ad0290a76f3768bb0e5d60ee681dfaa33066a 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 092671ce562f379b99331918400f1cef30b0244f..568fe44c30ec6e31a1b253c21f6ac5b447d1508a 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 6a110f0b87d55aa0e404f9af2d9800b75697138a..2526d4d84619891096355c5234eb7a0e915a092d 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 a632da6de09c550a4e1b69d9c03fe3ad80703af8..79f8f507c686c0f18d3340f8e4caec64c8ab06ef 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 5dc1d6998318cba93fff6db4196818537e36f69f..f343ff40d812d93ea095814397055c7b6c5a30e7 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 9672dacd5067be82ea8f363354c9f5f22978e3f3..3ba920204ac153918b89e707d5ed3d31bdfd7a98 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 fe8b6a5a63a55160781bafbc2bf85ab47a86b62d..609e12d53ec54a9f059b102bb0e07527a8ae3db8 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 5d7f9018542c512792495da687d8bd6ffa7a97b1..4234bd9d8c715f9cbf4c7bbbaebad87c604d393e 100644 (file)
 #include <cstring>
 using namespace llvm;
 
+namespace {
+
 static struct RegisterInterp {
   RegisterInterp() { Interpreter::Register(); }
 } InterpRegistrator;
 
+}
+
 namespace llvm {
   void LinkInInterpreter() {
   }
index 9e89e3c0e1d93c8eab9f57344a7b2b33e006bd06..e95c8a0996cabff0df844c6d11eb8c6248c65835 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 b73b0bd76c322b89262a542eb4e554414836123c..3b10a952d7f4c6c8bf66c1aed38b78e475e8a91a 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 4516ebc6b344ab2a69aea4c886aa4bea9a5c9e1b..13acc1b0fa1e541086c40724be001615ee5d0b4d 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 a7030fc7b27cbb38c354d6d01ac6beded43bdb00..b2c3160a415b3e551a348b3148d0e08d358a2f02 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 d084fffa22f4cc21ad5cb501cc2256f1f958c11e..913ebe0fa5e936c595df425f7fa1c61f1f1d574b 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 0887b952bb53f897575d8dc3d7c7e9f11ad56d0f..e986a64c090c90d7b0b15f8df5956c73fee8af9c 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 d6ccefc8467b421e37e2631bcb59cab448eee297..dcc920a64c235a71952a784d501790f450c17ee9 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 49a5e864d3e0ab832862c3af9bc539193fd15c54..c6628aca63a9a59c13e9e3f85dbfe3a0d5cd7e4f 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 b42001fa284a45ad58f5a23bceed1c0abf99d6a7..2ba5fa66808a29d7413c7e79661719cede4f2fd7 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 d472b5cc5c7f1935a096784983e79850f0f14085..7a0e4567bc08f52328d0c6e2d6a6db529ab9b425 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 187dd4a8af430fdff5cdf66f859c8595f9978ae3..2b7e69e4de08a636646e381875759c21371b782b 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 09e058f34f31c12828d8f9c16ea1e1427405b130..40de5dff1b58c99bd54fd805e4ea3280b6a2a984 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 37b8e7bb114ee1a6d0612446c8322152b83070e5..097e256c4a39697c9f9192e6430fe1e0ecd4b9ac 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 a77cc15d8f87ce5c7b87222dba52a9a4fe20ee99..cfec534ac20d7f21c20a8f8890a64bfc1d918de9 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 38f6d6a9014db2cb36925dd25dd9b75b5ca05fcb..a916b5c8ebdbbfbaf1c4f2ae2f75909e09241b5f 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 215a4f6d388968cd5c8a70cf94651279a9f9a825..69a8ca902b4285407f248670a7ea3790ee799e95 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 1065b095bc8c4c2571d341259c6ce2740e3e7b70..6e8831bf1f90e85febdef50eee72effdae1753f5 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 c0040779a9ae219daeb57e1605a61ffd89aebba8..98d80c84a0a6ba8bcaf1804f9de5dbd63ae1de84 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 218f356b9217e02cfaedc09151ca67021b4e85f5..a60ce09ab9c739fa50623438273e4751dd72c197 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 5f27e04683c58b5e235f5eff89af6f1529b18ea7..f2a8322550f8f1f572b50e0fc5b5dfa5e36e5c12 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 c6e27b4d627a7ccb36831a4d629af7bd64aa6dde..264f080787c17833449a4a2ed870a8e8f9f6f811 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 a8a1492375542620aa0296e37e87eb614f9753f6..86cfcc4624aab765a1e426da4eed782313fd7417 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 6cd128b7c4586913683cd54a027b0a7e7d08feec..9b3efe0962bff19603ba9374753f7f3c61eb0ba1 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 b9d9b547ea3e79fc0afb5e88a1912a4e06e84d79..3cb658ef72f1a663d6546f56c6df6fe55929e9d2 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 4e30c105475a5a07c5fd5fdeae15921b1c972e90..98202eb0b34583c813d923d51e005f2e072c225c 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 600be26620a874cc4226804fa8ebfff599c4fb7d..e822d9c7b958dc8863b3a673a8f93b996f18fed5 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 c51c023c686127aab00ccc8bf8f1673cfd138ea1..792fa980a60b5ff29d767cf9bc5032cedb0faa4a 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 2f9c34d5cf6f7309dec8b357e2eca9b119b54ba7..a623135bc1e2d77b6f5bea035c56dc6cc89cbeec 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 a007103a59902dfea745795b91e02cce4f9e1b10..63a4798cce1dc933cc00b5fdcd1188bb4eea8b78 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 f44e78429b62403f5a2273d4f40f78eb6870e0aa..1c3d5a81f36967a49c58398a2d0be62ae93a8f07 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 f3adb5692f17bbab73317b129d6a2097fa82e910..453b4945e7306618758ea4bf5689c948c0872d84 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 54fc44252e783a8e7d8078c5cfcd6a8421f036b4..10ec3065af7ca81ecbb640aac141f2ef4352a215 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 2db8257b84fdbbb7cc7dfb7a4e3d5cf40d33c92a..0faaeb1a611df97a601cac5ab4f995f4cfec801d 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 01816052569036882a41c9a21faa3c347aa7f42e..ceb9e3e54e81c3e87cdb4f14611f350a6dc2c009 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 1f12fcf79d3f5e8667a85ec1276d6462fd13106e..0931dec01055727176975c186b88d0cca1af089d 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 ca8a436844a57edfa146980c18100e5b11eb6e3e..7db0aa8d129b2ae13a4c250bef2671601df58e8a 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 cd2396258c41f8b6d99ca1b07bb245cfdebcfbb7..63e1a7beb042cfe085810ab6bbc8711584d8bfc9 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 34d977452c6d0e10c5b5e505800175361eb1680f..4f4f5748ebdd0ea165237e3739f13140e3afbfd9 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 7068db281de4f5d2858a8fbaa2ff72f11745d8d3..acde01888ca47f1ece8832a12a759dbbeafaf490 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 72f43e512476a4ca052c4a301134178b42b363a3..2cf824b25f5e0836efed82dba737bfcc40c1fa04 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 c22a29ff7a42c8f3b36f6eef2c9b7f8781c92c79..62c9ddd6b2c2024c68c2744213bb9ce3ca41ca1c 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 d909d0227c0362d926c09ae1063ce00b74889857..c633f9305815488d373eae86910d32a61dbcbc10 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 9bde749035750f5189f0271d6316eb85eba45fbb..041bed234b6fdbe616263fdb306d2f45ceb5db34 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 bc19114fa2d501cd59078acf6b9e1779cb1ca16d..2dfd4d7a3d3ccc0a00f5653bffb8fd87a6266a90 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 bed2b359a0e38b73a3e29cbde4531412deb1a0c9..c1e419569f47cf8c56af77851ffa5c3ba88a66d9 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 60b915a1b5e43baf2478999389f25059b552cf72..90e8dad4f8af0605bf1831d4e52695a555e2c699 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 539dd22d47d102b54de8e61995a71e5125c91571..a63fcb6589f7ae2e9b10ebd67693797d269ccdac 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 89afa911e758c39f036ef963b41c7a803193e542..bbb3a8a34472b6d792c07a11db14ede57cb0dc60 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 39a1b257258073a123d797f30df865593bae909d..35752bb67967d6e6b3f01076826abb3f943fee58 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 3bd6bff5d607b7d3501be563c6ed81735beef18a..80d74e6004b625d4fe484349db18c789461500b5 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 43054227aeaece19b73a5a395bf876ecfcd00366..4de19a94fb412f11497272ebdf21cff8cee56cc8 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 f3591879f7bb039c14f2bbe9bd7682d14ed884f6..06620557daa6018dbca208a76577590ae8de9405 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 991b11110b41eec883c6c2b550bf0437f1fa456d..d79a6cea3b121e6ae921f8ec6f99a917203b478f 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 2d535326d2a4022f6d79cb1c0bbef0121c5adb84..695a4fb0159fe4ba5a2be0d36ec14e1df70e509a 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 02a5ca98d97761e803d1ef98ffe9d0d163af85b4..c26a66c721ecbe9f5cd0619b9fd4791a2fe6902c 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 a6bd9ff20a9ae965ea31d325ae45f39580d88955..6113b24a29815567a2c74e5bffe7d8443ce4aa79 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 91a96bcedacdc354f366325247316be9058f8fc2..d8362a5500699c256239c1c9419f84d8584962cf 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 4dc7d60b0cb7aed64ef2735e820e36b7c3de0ac3..6d66d14ec9a81ac43fe81610b794948546bd4574 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 0db964125adb72a6e22de6af44cade057aba65d2..d32997020433a56759a3eaa8214bb17a51f5e43d 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 5af0a57a80f9fc4fde3d9b3ca5f9abe57ccf0f2a..78069870507502707f37de633ede4b890456e84d 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 1b36d84a7bd3c07fdc1be3b187facfc5099ee768..5c79444dc519e0288d1b3723e824ee429c402887 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 0a118cd338b9269b88b88a1882ae09d7e565bc79..e2d133ce3512b666c863a080cdcf51173ecfd36e 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 eda0c0e93a1985c57f7b955c7d2851258ee7f1a4..b31b1d1fa6ea8b194d7be23ac1943af1a0c9e987 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 168e54484dabb565750d8783841362a6315ad81d..9c17b77954e2b4bc066d9f8d001fae4d89511fe5 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 51aad84c0725ab970eae08fdbec7b01abdc7f3e1..0cd10ef0c16d7d60a4995b60dc828b4a46e8a4fd 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 48342bdc11f125d511d177a2c44142d750cfe065..a42bc34040ee1caad707d0dabb4c76c3c9165e33 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 f9b8ace11f391815f250d172a9cba90b23b80d68..40da808f671d4252da4235e70e0052add6736ceb 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 78b088a6444fcd4636d3df4fd18cba2b42980824..b9de782b2706d4598d41acc0b46137cc25b925ff 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 a3f294d34212d81c07571ca8b319d89252e31a91..5c2c6989b71611d5dfe267ca68d52fa4d0a3562b 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 e230ca6830406979a669c482012ac8f9d81d8b3a..4bf7bac4e2241e69e8eecef2c47d2990390bbced 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 39314678bd4d812a30a4eb20c90f8bf1d3403ba7..ff5f863645bba654e890fda525e3945bdacb9b27 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 8e30e0428629d8c3cc46273b3505b44b6aa69726..9351837aca5d7d6b5a015609ec3d2e8da053c558 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 8708f994fee215af32074c9bb5aff1ad56ba4c21..edce5e144c7c94d03c1f26391f582d58d5ce67f0 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 3d356b78aeea4fb7478e3d6ffb60f1e3bb40f0c9..0530e52173d0a270a373fec8b1bba4c1ddd51cdb 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 d75880f585c3b3e7941a52e73518f52d09b93372..9ddb2cd1d9d75fa7368324e40466712640a930d6 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 f9b1d8d4994acdb13041a7ac7d53bcd427a28c2b..e402bb935706a465436e1fc47c5795b5de0b336d 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 974678b2c0eb1a09046f11cf1b5bcce037a3cefb..b327a6a855ad6e72ce7be2a9bb55ba8884adc99c 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 312379479d6a65dcda5c7adc1c47b703e4bf5a24..add652986d1cca9452d2f3930826ef1a2746c2da 100644 (file)
@@ -360,10 +360,10 @@ public:
   }
 };
 
-static TimingInfo *TheTimeInfo;
-
 } // End of anon namespace
 
+static TimingInfo *TheTimeInfo;
+
 //===----------------------------------------------------------------------===//
 // PMTopLevelManager implementation
 
index 633991299b2cd6edb3370a930a1e8044cf41ea37..d7fe2d1cfbeea94daec09b222e85331f8d515ea6 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 aec5974209b9a18e96e7951b0cb8d88ec46452c6..4c6f9e00f7cd555de80d9e58beac9ac885342653 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) \