Clean up the use of static and anonymous namespaces. This turned up

several things that were neither in an anonymous namespace nor static
but not intended to be global.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51017 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Dan Gohman 2008-05-13 00:00:25 +00:00
parent a334d5f535
commit 844731a7f1
124 changed files with 785 additions and 707 deletions

View 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;
//===----------------------------------------------------------------------===//

View File

@ -21,12 +21,12 @@
#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();
}

View File

@ -34,19 +34,18 @@
#include <sstream>
using namespace llvm;
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> 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 {
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> 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);
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,

View 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(); }

View 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);

View File

@ -79,16 +79,16 @@ namespace {
virtual void deleteValue(Value *V) {}
virtual void copyValue(Value *From, Value *To) {}
};
// Register this pass...
char NoAA::ID = 0;
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
// 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
static RegisterAnalysisGroup<AliasAnalysis> V(U);
ImmutablePass *llvm::createNoAAPass() { return new NoAA(); }
namespace {
@ -124,16 +124,16 @@ namespace {
const Type *BasePtr2Ty,
Value **GEP2Ops, unsigned NumGEP2Ops, unsigned G2Size);
};
// Register this pass...
char BasicAliasAnalysis::ID = 0;
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
// 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
static RegisterAnalysisGroup<AliasAnalysis, true> Y(X);
ImmutablePass *llvm::createBasicAliasAnalysisPass() {
return new BasicAliasAnalysis();
}

View 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

View 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,17 +608,16 @@ namespace {
PrintPointsToGraph();
}
};
char Andersens::ID = 0;
RegisterPass<Andersens> X("anders-aa",
"Andersen's Interprocedural Alias Analysis", false,
true);
RegisterAnalysisGroup<AliasAnalysis> Y(X);
// Initialize Timestamp Counter (static).
unsigned Andersens::Node::Counter = 0;
}
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;
ModulePass *llvm::createAndersensPass() { return new Andersens(); }
//===----------------------------------------------------------------------===//

View 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;

View 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.

View 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

View 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

View File

@ -82,15 +82,16 @@ 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);
// Declare that we implement the ValueNumbering interface
RegisterAnalysisGroup<ValueNumbering> Y(X);
}
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
static RegisterAnalysisGroup<ValueNumbering> Y(X);
FunctionPass *llvm::createLoadValueNumberingPass() { return new LoadVN(); }

View File

@ -28,14 +28,12 @@
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");

View 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) {}
};
char NoProfileInfo::ID = 0;
// Register this pass...
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
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
static RegisterAnalysisGroup<ProfileInfo, true> Y(X);
ImmutablePass *llvm::createNoProfileInfoPass() { return new NoProfileInfo(); }

View File

@ -23,12 +23,12 @@
#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,14 +49,14 @@ namespace {
/// run - Load the profile information from the specified file.
virtual bool runOnModule(Module &M);
};
char LoaderPass::ID = 0;
RegisterPass<LoaderPass>
X("profile-loader", "Load profile information from llvmprof.out", false, true);
RegisterAnalysisGroup<ProfileInfo> Y(X);
} // End of anonymous namespace
char LoaderPass::ID = 0;
static RegisterPass<LoaderPass>
X("profile-loader", "Load profile information from llvmprof.out", false, true);
static RegisterAnalysisGroup<ProfileInfo> Y(X);
ModulePass *llvm::createProfileLoaderPass() { return new LoaderPass(); }
/// createProfileLoaderPass - This function returns a Pass that loads the

View 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;
//===----------------------------------------------------------------------===//

View 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.
///

View 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;

View 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

View 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) {

View 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) :

View 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)

View File

@ -36,16 +36,14 @@
#include <cmath>
using namespace llvm;
namespace {
// Hidden options for help debugging.
static cl::opt<bool> DisableReMat("disable-rematerialization",
cl::init(false), 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);
}
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) {}
};
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;
}
};
struct RewriteInfoCompare {
bool operator()(const RewriteInfo &LHS, const RewriteInfo &RHS) const {
return LHS.Index < RHS.Index;
}
};
}
void LiveIntervals::
rewriteInstructionsForSpills(const LiveInterval &li, bool TrySplit,

View 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();

View 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

View 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();

View 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:
}
};
}
//===----------------------------------------------------------------------===//

View 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(); }

View 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,

View 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) {

View 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)"));
//===---------------------------------------------------------------------===//

View 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 {

View File

@ -37,12 +37,11 @@ using namespace llvm;
STATISTIC(NumStores, "Number of stores added");
STATISTIC(NumLoads , "Number of loads added");
static RegisterRegAlloc
localRegAlloc("local", " local register allocator",
createLocalRegisterAllocator);
namespace {
static RegisterRegAlloc
localRegAlloc("local", " local register allocator",
createLocalRegisterAllocator);
class VISIBILITY_HIDDEN RALocal : public MachineFunctionPass {
public:
static char ID;

View 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

View 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);
}

View 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 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 RegisterScheduler
defaultListDAGScheduler("default", " Best scheduler for the target",
createDefaultScheduler);
namespace { struct SDISelAsmOperandInfo; }

View 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

View 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();

View 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*>

View 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

View 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();

View 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
//===----------------------------------------------------------------------===//

View File

@ -21,10 +21,14 @@
#include <cstring>
using namespace llvm;
namespace {
static struct RegisterInterp {
RegisterInterp() { Interpreter::Register(); }
} InterpRegistrator;
}
namespace llvm {
void LinkInInterpreter() {
}

View 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() {
}

View 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 {

View 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?

View 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;

View 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.
///

View File

@ -20,10 +20,8 @@
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);

View File

@ -47,10 +47,10 @@
#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.

View 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

View 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;

View 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);

View 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;

View File

@ -19,10 +19,8 @@
#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

View 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,

View File

@ -19,13 +19,11 @@
#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())

View File

@ -18,10 +18,8 @@
#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);

View File

@ -30,11 +30,10 @@
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()) {

View 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> PrintCode("print-machineinstrs",
cl::desc("Print generated machine code"),
cl::location(PrintMachineCode), 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<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<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>
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<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<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>
EnableRealignStack("realign-stack",
cl::desc("Realign stack if needed"),
cl::location(RealignStack),
cl::init(true));
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<unsigned, true>
OverrideStackAlignment("stack-alignment",
cl::desc("Override default stack alignment"),
cl::location(StackAlignment),
cl::init(0));
}
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

View 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(

View 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);

View 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)");

View 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);
}

View 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) {

View 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.
///

View 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();
}

View 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) {

View 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

View 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) {

View 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

View 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) {

View 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) {}

View File

@ -28,20 +28,19 @@ using namespace llvm;
STATISTIC(NumFunctions, "Number of functions internalized");
STATISTIC(NumGlobals , "Number of global vars internalized");
// 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);
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"));
// 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);
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

View 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.
//

View 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.

View 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(); }

View 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() {

View 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;

View 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);
}

View 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();
}

View File

@ -36,15 +36,15 @@ 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) {

View 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) {

View 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;

View 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) {

View 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) {

View 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,

View 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();

View 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();
}

View 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;

View 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) {

View 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(); }

View 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
//===----------------------------------------------------------------------===//

View 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();
}

View 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);

View 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(); }

View 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

View 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();

View 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();
}

Some files were not shown because too many files have changed in this diff Show More