summaryrefslogtreecommitdiff
path: root/lib/Transforms/IPO
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2008-05-13 00:00:25 +0000
committerDan Gohman <gohman@apple.com>2008-05-13 00:00:25 +0000
commit844731a7f1909f55935e3514c9e713a62d67662e (patch)
tree9221560124d6ed762ef6e5bbda45f4038dacdeb0 /lib/Transforms/IPO
parenta334d5f5355be5c26ea2d3c28456722afd1a4559 (diff)
downloadllvm-844731a7f1909f55935e3514c9e713a62d67662e.tar.gz
llvm-844731a7f1909f55935e3514c9e713a62d67662e.tar.bz2
llvm-844731a7f1909f55935e3514c9e713a62d67662e.tar.xz
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
Diffstat (limited to 'lib/Transforms/IPO')
-rw-r--r--lib/Transforms/IPO/ArgumentPromotion.cpp8
-rw-r--r--lib/Transforms/IPO/ConstantMerge.cpp7
-rw-r--r--lib/Transforms/IPO/DeadArgumentElimination.cpp15
-rw-r--r--lib/Transforms/IPO/DeadTypeElimination.cpp5
-rw-r--r--lib/Transforms/IPO/GlobalDCE.cpp5
-rw-r--r--lib/Transforms/IPO/GlobalOpt.cpp10
-rw-r--r--lib/Transforms/IPO/IPConstantPropagation.cpp6
-rw-r--r--lib/Transforms/IPO/IndMemRemoval.cpp5
-rw-r--r--lib/Transforms/IPO/InlineSimple.cpp6
-rw-r--r--lib/Transforms/IPO/Inliner.cpp6
-rw-r--r--lib/Transforms/IPO/Internalize.cpp29
-rw-r--r--lib/Transforms/IPO/LoopExtractor.cpp38
-rw-r--r--lib/Transforms/IPO/LowerSetJmp.cpp6
-rw-r--r--lib/Transforms/IPO/PruneEH.cpp7
-rw-r--r--lib/Transforms/IPO/RaiseAllocations.cpp7
-rw-r--r--lib/Transforms/IPO/StripDeadPrototypes.cpp8
-rw-r--r--lib/Transforms/IPO/StripSymbols.cpp7
-rw-r--r--lib/Transforms/IPO/StructRetPromotion.cpp8
18 files changed, 100 insertions, 83 deletions
diff --git a/lib/Transforms/IPO/ArgumentPromotion.cpp b/lib/Transforms/IPO/ArgumentPromotion.cpp
index c6e27b4d62..264f080787 100644
--- a/lib/Transforms/IPO/ArgumentPromotion.cpp
+++ b/lib/Transforms/IPO/ArgumentPromotion.cpp
@@ -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);
}
diff --git a/lib/Transforms/IPO/ConstantMerge.cpp b/lib/Transforms/IPO/ConstantMerge.cpp
index a8a1492375..86cfcc4624 100644
--- a/lib/Transforms/IPO/ConstantMerge.cpp
+++ b/lib/Transforms/IPO/ConstantMerge.cpp
@@ -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) {
diff --git a/lib/Transforms/IPO/DeadArgumentElimination.cpp b/lib/Transforms/IPO/DeadArgumentElimination.cpp
index 6cd128b7c4..9b3efe0962 100644
--- a/lib/Transforms/IPO/DeadArgumentElimination.cpp
+++ b/lib/Transforms/IPO/DeadArgumentElimination.cpp
@@ -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.
///
diff --git a/lib/Transforms/IPO/DeadTypeElimination.cpp b/lib/Transforms/IPO/DeadTypeElimination.cpp
index b9d9b547ea..3cb658ef72 100644
--- a/lib/Transforms/IPO/DeadTypeElimination.cpp
+++ b/lib/Transforms/IPO/DeadTypeElimination.cpp
@@ -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();
}
diff --git a/lib/Transforms/IPO/GlobalDCE.cpp b/lib/Transforms/IPO/GlobalDCE.cpp
index 4e30c10547..98202eb0b3 100644
--- a/lib/Transforms/IPO/GlobalDCE.cpp
+++ b/lib/Transforms/IPO/GlobalDCE.cpp
@@ -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) {
diff --git a/lib/Transforms/IPO/GlobalOpt.cpp b/lib/Transforms/IPO/GlobalOpt.cpp
index 600be26620..e822d9c7b9 100644
--- a/lib/Transforms/IPO/GlobalOpt.cpp
+++ b/lib/Transforms/IPO/GlobalOpt.cpp
@@ -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
diff --git a/lib/Transforms/IPO/IPConstantPropagation.cpp b/lib/Transforms/IPO/IPConstantPropagation.cpp
index c51c023c68..792fa980a6 100644
--- a/lib/Transforms/IPO/IPConstantPropagation.cpp
+++ b/lib/Transforms/IPO/IPConstantPropagation.cpp
@@ -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) {
diff --git a/lib/Transforms/IPO/IndMemRemoval.cpp b/lib/Transforms/IPO/IndMemRemoval.cpp
index 2f9c34d5cf..a623135bc1 100644
--- a/lib/Transforms/IPO/IndMemRemoval.cpp
+++ b/lib/Transforms/IPO/IndMemRemoval.cpp
@@ -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
diff --git a/lib/Transforms/IPO/InlineSimple.cpp b/lib/Transforms/IPO/InlineSimple.cpp
index a007103a59..63a4798cce 100644
--- a/lib/Transforms/IPO/InlineSimple.cpp
+++ b/lib/Transforms/IPO/InlineSimple.cpp
@@ -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) {
diff --git a/lib/Transforms/IPO/Inliner.cpp b/lib/Transforms/IPO/Inliner.cpp
index f44e78429b..1c3d5a81f3 100644
--- a/lib/Transforms/IPO/Inliner.cpp
+++ b/lib/Transforms/IPO/Inliner.cpp
@@ -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) {}
diff --git a/lib/Transforms/IPO/Internalize.cpp b/lib/Transforms/IPO/Internalize.cpp
index f3adb5692f..453b4945e7 100644
--- a/lib/Transforms/IPO/Internalize.cpp
+++ b/lib/Transforms/IPO/Internalize.cpp
@@ -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
diff --git a/lib/Transforms/IPO/LoopExtractor.cpp b/lib/Transforms/IPO/LoopExtractor.cpp
index 54fc44252e..10ec3065af 100644
--- a/lib/Transforms/IPO/LoopExtractor.cpp
+++ b/lib/Transforms/IPO/LoopExtractor.cpp
@@ -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.
//
diff --git a/lib/Transforms/IPO/LowerSetJmp.cpp b/lib/Transforms/IPO/LowerSetJmp.cpp
index 2db8257b84..0faaeb1a61 100644
--- a/lib/Transforms/IPO/LowerSetJmp.cpp
+++ b/lib/Transforms/IPO/LowerSetJmp.cpp
@@ -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.
diff --git a/lib/Transforms/IPO/PruneEH.cpp b/lib/Transforms/IPO/PruneEH.cpp
index 0181605256..ceb9e3e54e 100644
--- a/lib/Transforms/IPO/PruneEH.cpp
+++ b/lib/Transforms/IPO/PruneEH.cpp
@@ -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(); }
diff --git a/lib/Transforms/IPO/RaiseAllocations.cpp b/lib/Transforms/IPO/RaiseAllocations.cpp
index 1f12fcf79d..0931dec010 100644
--- a/lib/Transforms/IPO/RaiseAllocations.cpp
+++ b/lib/Transforms/IPO/RaiseAllocations.cpp
@@ -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() {
diff --git a/lib/Transforms/IPO/StripDeadPrototypes.cpp b/lib/Transforms/IPO/StripDeadPrototypes.cpp
index ca8a436844..7db0aa8d12 100644
--- a/lib/Transforms/IPO/StripDeadPrototypes.cpp
+++ b/lib/Transforms/IPO/StripDeadPrototypes.cpp
@@ -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;
diff --git a/lib/Transforms/IPO/StripSymbols.cpp b/lib/Transforms/IPO/StripSymbols.cpp
index cd2396258c..63e1a7beb0 100644
--- a/lib/Transforms/IPO/StripSymbols.cpp
+++ b/lib/Transforms/IPO/StripSymbols.cpp
@@ -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);
}
diff --git a/lib/Transforms/IPO/StructRetPromotion.cpp b/lib/Transforms/IPO/StructRetPromotion.cpp
index 34d977452c..4f4f5748eb 100644
--- a/lib/Transforms/IPO/StructRetPromotion.cpp
+++ b/lib/Transforms/IPO/StructRetPromotion.cpp
@@ -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();
}