diff options
author | Brian Gaeke <gaeke@uiuc.edu> | 2003-11-11 22:41:34 +0000 |
---|---|---|
committer | Brian Gaeke <gaeke@uiuc.edu> | 2003-11-11 22:41:34 +0000 |
commit | d0fde30ce850b78371fd1386338350591f9ff494 (patch) | |
tree | 83bb73e83f54fc8e1e474d116250ae2779562f7e /lib/Transforms | |
parent | 0d723acf15b0326e2df09ecb614b02a617f536e4 (diff) | |
download | llvm-d0fde30ce850b78371fd1386338350591f9ff494.tar.gz llvm-d0fde30ce850b78371fd1386338350591f9ff494.tar.bz2 llvm-d0fde30ce850b78371fd1386338350591f9ff494.tar.xz |
Put all LLVM code into the llvm namespace, as per bug 109.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9903 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
70 files changed, 296 insertions, 19 deletions
diff --git a/lib/Transforms/ExprTypeConvert.cpp b/lib/Transforms/ExprTypeConvert.cpp index d3e9287de4..970be52aa4 100644 --- a/lib/Transforms/ExprTypeConvert.cpp +++ b/lib/Transforms/ExprTypeConvert.cpp @@ -23,6 +23,8 @@ #include "Support/Debug.h" #include <algorithm> +namespace llvm { + static bool OperandConvertibleToType(User *U, Value *V, const Type *Ty, ValueTypeCache &ConvertedTypes, const TargetData &TD); @@ -1298,3 +1300,5 @@ ValueHandle::~ValueHandle() { // << Operands[0]->use_size() << " " << Operands[0]); } } + +} // End llvm namespace diff --git a/lib/Transforms/Hello/Hello.cpp b/lib/Transforms/Hello/Hello.cpp index a71bd34288..4ed281a40a 100644 --- a/lib/Transforms/Hello/Hello.cpp +++ b/lib/Transforms/Hello/Hello.cpp @@ -15,6 +15,8 @@ #include "llvm/Pass.h" #include "llvm/Function.h" +namespace llvm { + namespace { // Hello - The first implementation, without getAnalysisUsage. struct Hello : public FunctionPass { @@ -39,3 +41,5 @@ namespace { }; RegisterOpt<Hello2> Y("hello2", "Hello World Pass (with getAnalysisUsage implemented)"); } + +} // End llvm namespace diff --git a/lib/Transforms/IPO/ConstantMerge.cpp b/lib/Transforms/IPO/ConstantMerge.cpp index a4526820e6..498cd7bb14 100644 --- a/lib/Transforms/IPO/ConstantMerge.cpp +++ b/lib/Transforms/IPO/ConstantMerge.cpp @@ -22,6 +22,8 @@ #include "llvm/Pass.h" #include "Support/Statistic.h" +namespace llvm { + namespace { Statistic<> NumMerged("constmerge", "Number of global constants merged"); @@ -37,7 +39,6 @@ namespace { Pass *createConstantMergePass() { return new ConstantMerge(); } - bool ConstantMerge::run(Module &M) { std::map<Constant*, GlobalVariable*> CMap; bool MadeChanges = false; @@ -78,3 +79,5 @@ bool ConstantMerge::run(Module &M) { return MadeChanges; } + +} // End llvm namespace diff --git a/lib/Transforms/IPO/DeadArgumentElimination.cpp b/lib/Transforms/IPO/DeadArgumentElimination.cpp index 9003f8877f..197710d650 100644 --- a/lib/Transforms/IPO/DeadArgumentElimination.cpp +++ b/lib/Transforms/IPO/DeadArgumentElimination.cpp @@ -30,6 +30,8 @@ #include "Support/iterator" #include <set> +namespace llvm { + namespace { Statistic<> NumArgumentsEliminated("deadargelim", "Number of unread args removed"); @@ -576,3 +578,6 @@ bool DAE::run(Module &M) { RemoveDeadArgumentsFromFunction(*DeadRetVal.begin()); return true; } + +} // End llvm namespace + diff --git a/lib/Transforms/IPO/DeadTypeElimination.cpp b/lib/Transforms/IPO/DeadTypeElimination.cpp index c3eb416002..126991d3e6 100644 --- a/lib/Transforms/IPO/DeadTypeElimination.cpp +++ b/lib/Transforms/IPO/DeadTypeElimination.cpp @@ -19,6 +19,8 @@ #include "llvm/DerivedTypes.h" #include "Support/Statistic.h" +namespace llvm { + namespace { struct DTE : public Pass { // doPassInitialization - For this pass, it removes global symbol table @@ -45,7 +47,6 @@ Pass *createDeadTypeEliminationPass() { } - // ShouldNukeSymtabEntry - Return true if this module level symbol table entry // should be eliminated. // @@ -95,3 +96,5 @@ bool DTE::run(Module &M) { return Changed; } + +} // End llvm namespace diff --git a/lib/Transforms/IPO/ExtractFunction.cpp b/lib/Transforms/IPO/ExtractFunction.cpp index 1656c512dd..c1ae2d45e4 100644 --- a/lib/Transforms/IPO/ExtractFunction.cpp +++ b/lib/Transforms/IPO/ExtractFunction.cpp @@ -10,6 +10,8 @@ #include "llvm/Pass.h" #include "llvm/Module.h" +namespace llvm { + namespace { class FunctionExtractorPass : public Pass { Function *Named; @@ -90,3 +92,5 @@ namespace { Pass *createFunctionExtractionPass(Function *F) { return new FunctionExtractorPass(F); } + +} // End llvm namespace diff --git a/lib/Transforms/IPO/FunctionResolution.cpp b/lib/Transforms/IPO/FunctionResolution.cpp index a21853d207..2a366c84cd 100644 --- a/lib/Transforms/IPO/FunctionResolution.cpp +++ b/lib/Transforms/IPO/FunctionResolution.cpp @@ -29,6 +29,8 @@ #include "Support/Statistic.h" #include <algorithm> +namespace llvm { + namespace { Statistic<>NumResolved("funcresolve", "Number of varargs functions resolved"); Statistic<> NumGlobals("funcresolve", "Number of global variables resolved"); @@ -329,3 +331,5 @@ bool FunctionResolvingPass::run(Module &M) { return Changed; } + +} // End llvm namespace diff --git a/lib/Transforms/IPO/GlobalDCE.cpp b/lib/Transforms/IPO/GlobalDCE.cpp index dc400269e6..8e7920dc1b 100644 --- a/lib/Transforms/IPO/GlobalDCE.cpp +++ b/lib/Transforms/IPO/GlobalDCE.cpp @@ -22,6 +22,8 @@ #include "Support/Statistic.h" #include <set> +namespace llvm { + namespace { Statistic<> NumFunctions("globaldce","Number of functions removed"); Statistic<> NumVariables("globaldce","Number of global variables removed"); @@ -195,3 +197,5 @@ bool GlobalDCE::SafeToDestroyConstant(Constant *C) { return true; } + +} // End llvm namespace diff --git a/lib/Transforms/IPO/IPConstantPropagation.cpp b/lib/Transforms/IPO/IPConstantPropagation.cpp index b592138b08..b0135d1531 100644 --- a/lib/Transforms/IPO/IPConstantPropagation.cpp +++ b/lib/Transforms/IPO/IPConstantPropagation.cpp @@ -22,6 +22,8 @@ #include "llvm/Support/CallSite.h" #include "Support/Statistic.h" +namespace llvm { + namespace { Statistic<> NumArgumentsProped("ipconstprop", "Number of args turned into constants"); @@ -121,3 +123,5 @@ bool IPCP::processFunction(Function &F) { } return MadeChange; } + +} // End llvm namespace diff --git a/lib/Transforms/IPO/InlineSimple.cpp b/lib/Transforms/IPO/InlineSimple.cpp index 169e57745a..715f4462b2 100644 --- a/lib/Transforms/IPO/InlineSimple.cpp +++ b/lib/Transforms/IPO/InlineSimple.cpp @@ -17,6 +17,8 @@ #include "llvm/Support/CallSite.h" #include "llvm/Transforms/IPO.h" +namespace llvm { + namespace { // FunctionInfo - For each function, calculate the size of it in blocks and // instructions. @@ -114,3 +116,5 @@ int SimpleInliner::getInlineCost(CallSite CS) { InlineCost += CalleeFI.NumInsts*10 + CalleeFI.NumBlocks*20; return InlineCost; } + +} // End llvm namespace diff --git a/lib/Transforms/IPO/Inliner.cpp b/lib/Transforms/IPO/Inliner.cpp index 8ad72ab9a1..bd1bd8370f 100644 --- a/lib/Transforms/IPO/Inliner.cpp +++ b/lib/Transforms/IPO/Inliner.cpp @@ -24,6 +24,8 @@ #include "Support/Debug.h" #include "Support/Statistic.h" +namespace llvm { + namespace { Statistic<> NumInlined("inline", "Number of functions inlined"); Statistic<> NumDeleted("inline", "Number of functions deleted because all callers found"); @@ -134,3 +136,5 @@ bool Inliner::performInlining(CallSite CS, std::set<Function*> &SCC) { } return true; } + +} // End llvm namespace diff --git a/lib/Transforms/IPO/Inliner.h b/lib/Transforms/IPO/Inliner.h index 1f3d0d2dc2..805876c54d 100644 --- a/lib/Transforms/IPO/Inliner.h +++ b/lib/Transforms/IPO/Inliner.h @@ -20,6 +20,9 @@ #define DEBUG_TYPE "inline" #include "llvm/CallGraphSCCPass.h" #include <set> + +namespace llvm { + class CallSite; /// Inliner - This class contains all of the helper code which is used to @@ -61,5 +64,6 @@ private: bool performInlining(CallSite CS, std::set<Function*> &SCC); }; +} // End llvm namespace #endif diff --git a/lib/Transforms/IPO/Internalize.cpp b/lib/Transforms/IPO/Internalize.cpp index 92d389a33d..574c8bf268 100644 --- a/lib/Transforms/IPO/Internalize.cpp +++ b/lib/Transforms/IPO/Internalize.cpp @@ -22,6 +22,8 @@ #include <fstream> #include <set> +namespace llvm { + namespace { Statistic<> NumFunctions("internalize", "Number of functions internalized"); Statistic<> NumGlobals ("internalize", "Number of global vars internalized"); @@ -119,3 +121,5 @@ namespace { Pass *createInternalizePass() { return new InternalizePass(); } + +} // End llvm namespace diff --git a/lib/Transforms/IPO/LowerSetJmp.cpp b/lib/Transforms/IPO/LowerSetJmp.cpp index abbc2c92c4..276523b00b 100644 --- a/lib/Transforms/IPO/LowerSetJmp.cpp +++ b/lib/Transforms/IPO/LowerSetJmp.cpp @@ -47,6 +47,8 @@ #include "Support/StringExtras.h" #include "Support/VectorExtras.h" +namespace llvm { + namespace { Statistic<> LongJmpsTransformed("lowersetjmp", "Number of longjmps transformed"); @@ -538,3 +540,5 @@ Pass* createLowerSetJmpPass() { return new LowerSetJmp(); } + +} // End llvm namespace diff --git a/lib/Transforms/IPO/MutateStructTypes.cpp b/lib/Transforms/IPO/MutateStructTypes.cpp index dfaf8a89c6..41835adb48 100644 --- a/lib/Transforms/IPO/MutateStructTypes.cpp +++ b/lib/Transforms/IPO/MutateStructTypes.cpp @@ -28,6 +28,8 @@ #include "Support/Debug.h" #include <algorithm> +using namespace llvm; + // ValuePlaceHolder - A stupid little marker value. It appears as an // instruction of type Instruction::UserOp1. // diff --git a/lib/Transforms/IPO/Parallelize.cpp b/lib/Transforms/IPO/Parallelize.cpp index 77e6ed3040..fd39b6b12a 100644 --- a/lib/Transforms/IPO/Parallelize.cpp +++ b/lib/Transforms/IPO/Parallelize.cpp @@ -53,6 +53,8 @@ #include <functional> #include <algorithm> +namespace llvm { + //---------------------------------------------------------------------------- // Global constants used in marking Cilk functions and function calls. //---------------------------------------------------------------------------- @@ -535,3 +537,5 @@ bool Parallelize::run(Module& M) return true; } + +} // End llvm namespace diff --git a/lib/Transforms/IPO/PruneEH.cpp b/lib/Transforms/IPO/PruneEH.cpp index b377a8befe..30e2514872 100644 --- a/lib/Transforms/IPO/PruneEH.cpp +++ b/lib/Transforms/IPO/PruneEH.cpp @@ -23,6 +23,8 @@ #include "Support/Statistic.h" #include <set> +namespace llvm { + namespace { Statistic<> NumRemoved("prune-eh", "Number of invokes removed"); @@ -104,3 +106,5 @@ bool PruneEH::runOnSCC(const std::vector<CallGraphNode *> &SCC) { return MadeChange; } + +} // End llvm namespace diff --git a/lib/Transforms/IPO/RaiseAllocations.cpp b/lib/Transforms/IPO/RaiseAllocations.cpp index 81abda0006..fd5b7fb1f1 100644 --- a/lib/Transforms/IPO/RaiseAllocations.cpp +++ b/lib/Transforms/IPO/RaiseAllocations.cpp @@ -22,6 +22,8 @@ #include "llvm/Support/CallSite.h" #include "Support/Statistic.h" +namespace llvm { + namespace { Statistic<> NumRaised("raiseallocs", "Number of allocations raised"); @@ -194,3 +196,5 @@ bool RaiseAllocations::run(Module &M) { return Changed; } + +} // End llvm namespace diff --git a/lib/Transforms/IPO/SimpleStructMutation.cpp b/lib/Transforms/IPO/SimpleStructMutation.cpp index 012fa22770..0c7091696e 100644 --- a/lib/Transforms/IPO/SimpleStructMutation.cpp +++ b/lib/Transforms/IPO/SimpleStructMutation.cpp @@ -23,6 +23,8 @@ using std::vector; using std::set; using std::pair; +namespace llvm { + namespace { struct SimpleStructMutation : public MutateStructTypes { enum Transform { SwapElements, SortElements }; @@ -188,3 +190,5 @@ SimpleStructMutation::TransformsType return Transforms; } + +} // End llvm namespace diff --git a/lib/Transforms/Instrumentation/BlockProfiling.cpp b/lib/Transforms/Instrumentation/BlockProfiling.cpp index c371a9fa69..90ef14df7e 100644 --- a/lib/Transforms/Instrumentation/BlockProfiling.cpp +++ b/lib/Transforms/Instrumentation/BlockProfiling.cpp @@ -25,6 +25,8 @@ #include "llvm/Module.h" #include "llvm/Pass.h" +namespace llvm { + static void insertInitializationCall(Function *MainFn, const char *FnName, GlobalValue *Array) { const Type *ArgVTy = PointerType::get(PointerType::get(Type::SByteTy)); @@ -181,3 +183,5 @@ bool BlockProfiler::run(Module &M) { insertInitializationCall(Main, "llvm_start_block_profiling", Counters); return true; } + +} // End llvm namespace diff --git a/lib/Transforms/Instrumentation/EmitFunctions.cpp b/lib/Transforms/Instrumentation/EmitFunctions.cpp index 9c395a9c1f..57254b9080 100644 --- a/lib/Transforms/Instrumentation/EmitFunctions.cpp +++ b/lib/Transforms/Instrumentation/EmitFunctions.cpp @@ -17,6 +17,8 @@ #include "llvm/Pass.h" #include "llvm/Support/CFG.h" +namespace llvm { + enum Color{ WHITE, GREY, @@ -104,3 +106,5 @@ bool EmitFunctionTable::run(Module &M){ M.getGlobalList().push_back(fnCount); return true; // Always modifies program } + +} // End llvm namespace diff --git a/lib/Transforms/Instrumentation/ProfilePaths/CombineBranch.cpp b/lib/Transforms/Instrumentation/ProfilePaths/CombineBranch.cpp index 6c7bb5f360..04207820a5 100644 --- a/lib/Transforms/Instrumentation/ProfilePaths/CombineBranch.cpp +++ b/lib/Transforms/Instrumentation/ProfilePaths/CombineBranch.cpp @@ -27,6 +27,8 @@ #include "llvm/Function.h" #include "llvm/Pass.h" +namespace llvm { + //this is used to color vertices //during DFS @@ -36,7 +38,7 @@ enum Color{ BLACK }; -namespace{ +namespace { struct CombineBranches : public FunctionPass { private: //DominatorSet *DS; @@ -225,3 +227,5 @@ bool CombineBranches::runOnFunction(Function &F){ return true; } + +} // End llvm namespace diff --git a/lib/Transforms/Instrumentation/ProfilePaths/EdgeCode.cpp b/lib/Transforms/Instrumentation/ProfilePaths/EdgeCode.cpp index 6a7f50e333..3cb5698a11 100644 --- a/lib/Transforms/Instrumentation/ProfilePaths/EdgeCode.cpp +++ b/lib/Transforms/Instrumentation/ProfilePaths/EdgeCode.cpp @@ -27,8 +27,10 @@ #define INSERT_LOAD_COUNT #define INSERT_STORE + using std::vector; +namespace llvm { static void getTriggerCode(Module *M, BasicBlock *BB, int MethNo, Value *pathNo, Value *cnt, Instruction *rInst){ @@ -369,3 +371,4 @@ void insertBB(Edge ed, } } +} // End llvm namespace diff --git a/lib/Transforms/Instrumentation/ProfilePaths/Graph.cpp b/lib/Transforms/Instrumentation/ProfilePaths/Graph.cpp index cae699a8d6..d69c4c3b4c 100644 --- a/lib/Transforms/Instrumentation/ProfilePaths/Graph.cpp +++ b/lib/Transforms/Instrumentation/ProfilePaths/Graph.cpp @@ -19,6 +19,8 @@ using std::vector; +namespace llvm { + const graphListElement *findNodeInList(const Graph::nodeList &NL, Node *N) { for(Graph::nodeList::const_iterator NI = NL.begin(), NE=NL.end(); NI != NE; @@ -564,4 +566,4 @@ void Graph::getBackEdgesVisit(Node *u, vector<Edge > &be, color[u]=BLACK;//done with visiting the node and its neighbors } - +} // End llvm namespace diff --git a/lib/Transforms/Instrumentation/ProfilePaths/Graph.h b/lib/Transforms/Instrumentation/ProfilePaths/Graph.h index 5597b599e0..44b63a91ea 100644 --- a/lib/Transforms/Instrumentation/ProfilePaths/Graph.h +++ b/lib/Transforms/Instrumentation/ProfilePaths/Graph.h @@ -19,6 +19,8 @@ #include <map> #include <cstdlib> +namespace llvm { + class Module; class Function; @@ -112,8 +114,13 @@ struct graphListElement{ } }; +} // End llvm namespace + namespace std { + +using namespace llvm; + template<> struct less<Node *> : public binary_function<Node *, Node *,bool> { bool operator()(Node *n1, Node *n2) const { @@ -135,6 +142,8 @@ namespace std { }; } +namespace llvm { + struct BBSort{ bool operator()(BasicBlock *BB1, BasicBlock *BB2) const{ std::string name1=BB1->getName(); @@ -465,6 +474,7 @@ int valueAssignmentToEdges(Graph& g, std::map<Node *, int> nodePriority, std::vector<Edge> &be); void getBBtrace(std::vector<BasicBlock *> &vBB, int pathNo, Function *M); -#endif +} // End llvm namespace +#endif diff --git a/lib/Transforms/Instrumentation/ProfilePaths/GraphAuxiliary.cpp b/lib/Transforms/Instrumentation/ProfilePaths/GraphAuxiliary.cpp index 66b8ccd6c4..d9dc011cd5 100644 --- a/lib/Transforms/Instrumentation/ProfilePaths/GraphAuxiliary.cpp +++ b/lib/Transforms/Instrumentation/ProfilePaths/GraphAuxiliary.cpp @@ -24,6 +24,8 @@ using std::map; using std::vector; using std::cerr; +namespace llvm { + //check if 2 edges are equal (same endpoints and same weight) static bool edgesEqual(Edge ed1, Edge ed2){ return ((ed1==ed2) && ed1.getWeight()==ed2.getWeight()); @@ -673,3 +675,5 @@ void printGraph(Graph &g){ } cerr<<"--------------------Graph\n"; } + +} // End llvm namespace diff --git a/lib/Transforms/Instrumentation/ProfilePaths/InstLoops.cpp b/lib/Transforms/Instrumentation/ProfilePaths/InstLoops.cpp index b5e9d8c30c..9d6107cd2d 100644 --- a/lib/Transforms/Instrumentation/ProfilePaths/InstLoops.cpp +++ b/lib/Transforms/Instrumentation/ProfilePaths/InstLoops.cpp @@ -27,6 +27,8 @@ #include "llvm/Function.h" #include "llvm/Pass.h" +namespace llvm { + //this is used to color vertices //during DFS @@ -181,3 +183,5 @@ bool InstLoops::runOnFunction(Function &F){ findAndInstrumentBackEdges(F); return true; // Function was modified. } + +} // End llvm namespace diff --git a/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp b/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp index d4973be25e..5728265f42 100644 --- a/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp +++ b/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp @@ -43,6 +43,8 @@ #include <fstream> #include <cstdio> +namespace llvm { + struct ProfilePaths : public FunctionPass { bool runOnFunction(Function &F); @@ -245,3 +247,5 @@ bool ProfilePaths::runOnFunction(Function &F){ return true; // Always modifies function } + +} // End llvm namespace diff --git a/lib/Transforms/Instrumentation/ProfilePaths/RetracePath.cpp b/lib/Transforms/Instrumentation/ProfilePaths/RetracePath.cpp index 58b3840587..cbb2ae6aee 100644 --- a/lib/Transforms/Instrumentation/ProfilePaths/RetracePath.cpp +++ b/lib/Transforms/Instrumentation/ProfilePaths/RetracePath.cpp @@ -21,6 +21,8 @@ using std::vector; using std::map; using std::cerr; +namespace llvm { + //Routines to get the path trace! void getPathFrmNode(Node *n, vector<BasicBlock*> &vBB, int pathNo, Graph &g, @@ -303,3 +305,5 @@ void getBBtrace(vector<BasicBlock *> &vBB, int pathNo, Function *M){//, } */ } + +} // End llvm namespace diff --git a/lib/Transforms/Instrumentation/TraceValues.cpp b/lib/Transforms/Instrumentation/TraceValues.cpp index f19ba74000..c802f73604 100644 --- a/lib/Transforms/Instrumentation/TraceValues.cpp +++ b/lib/Transforms/Instrumentation/TraceValues.cpp @@ -26,6 +26,8 @@ #include <algorithm> #include <sstream> +namespace llvm { + static cl::opt<bool> DisablePtrHashing("tracedisablehashdisable", cl::Hidden, cl::desc("Disable pointer hashing in the -trace or -tracem " @@ -433,3 +435,5 @@ bool InsertTraceCode::runOnFunction(Function &F) { return true; } + +} // End llvm namespace diff --git a/lib/Transforms/LevelRaise.cpp b/lib/Transforms/LevelRaise.cpp index cf64aea1cd..c5be82fca7 100644 --- a/lib/Transforms/LevelRaise.cpp +++ b/lib/Transforms/LevelRaise.cpp @@ -29,6 +29,8 @@ #include "Support/STLExtras.h" #include <algorithm> +namespace llvm { + // StartInst - This enables the -raise-start-inst=foo option to cause the level // raising pass to start at instruction "foo", which is immensely useful for // debugging! @@ -55,7 +57,6 @@ NumDCEorCP("raise", "Number of insts DCEd or constprop'd"); static Statistic<> NumVarargCallChanges("raise", "Number of vararg call peepholes"); - #define PRINT_PEEPHOLE(ID, NUM, I) \ DEBUG(std::cerr << "Inst P/H " << ID << "[" << NUM << "] " << I) @@ -86,12 +87,12 @@ namespace { RegisterOpt<RPR> X("raise", "Raise Pointer References"); } + Pass *createRaisePointerReferencesPass() { return new RPR(); } - // isReinterpretingCast - Return true if the cast instruction specified will // cause the operand to be "reinterpreted". A value is reinterpreted if the // cast instruction would cause the underlying bits to change. @@ -617,3 +618,5 @@ bool RPR::runOnFunction(Function &F) { return Changed; } + +} // End llvm namespace diff --git a/lib/Transforms/Scalar/ADCE.cpp b/lib/Transforms/Scalar/ADCE.cpp index 2735f95d89..e45b273190 100644 --- a/lib/Transforms/Scalar/ADCE.cpp +++ b/lib/Transforms/Scalar/ADCE.cpp @@ -28,6 +28,8 @@ #include "Support/STLExtras.h" #include <algorithm> +namespace llvm { + namespace { Statistic<> NumBlockRemoved("adce", "Number of basic blocks removed"); Statistic<> NumInstRemoved ("adce", "Number of instructions removed"); @@ -456,3 +458,5 @@ bool ADCE::doADCE() { return MadeChanges; } + +} // End llvm namespace diff --git a/lib/Transforms/Scalar/ConstantProp.cpp b/lib/Transforms/Scalar/ConstantProp.cpp index ceef34e54e..66e78960f7 100644 --- a/lib/Transforms/Scalar/ConstantProp.cpp +++ b/lib/Transforms/Scalar/ConstantProp.cpp @@ -27,6 +27,8 @@ #include "Support/Statistic.h" #include <set> +namespace llvm { + namespace { Statistic<> NumInstKilled("constprop", "Number of instructions killed"); @@ -73,3 +75,5 @@ bool ConstantPropagation::runOnFunction(Function &F) { } return Changed; } + +} // End llvm namespace diff --git a/lib/Transforms/Scalar/CorrelatedExprs.cpp b/lib/Transforms/Scalar/CorrelatedExprs.cpp index aad9b7f309..a0358b54ad 100644 --- a/lib/Transforms/Scalar/CorrelatedExprs.cpp +++ b/lib/Transforms/Scalar/CorrelatedExprs.cpp @@ -42,6 +42,8 @@ #include "Support/Statistic.h" #include <algorithm> +namespace llvm { + namespace { Statistic<> NumSetCCRemoved("cee", "Number of setcc instruction eliminated"); Statistic<> NumOperandsCann("cee", "Number of operands canonicalized"); @@ -1314,3 +1316,5 @@ void Relation::print(std::ostream &OS) const { void Relation::dump() const { print(std::cerr); } void ValueInfo::dump() const { print(std::cerr, 0); } void RegionInfo::dump() const { print(std::cerr); } + +} // End llvm namespace diff --git a/lib/Transforms/Scalar/DCE.cpp b/lib/Transforms/Scalar/DCE.cpp index e3fc8de396..3e63cadd3e 100644 --- a/lib/Transforms/Scalar/DCE.cpp +++ b/lib/Transforms/Scalar/DCE.cpp @@ -24,6 +24,8 @@ #include "Support/Statistic.h" #include <set> +namespace llvm { + namespace { Statistic<> DIEEliminated("die", "Number of insts removed"); Statistic<> DCEEliminated("dce", "Number of insts removed"); @@ -57,7 +59,6 @@ Pass *createDeadInstEliminationPass() { } - //===----------------------------------------------------------------------===// // DeadCodeElimination pass implementation // @@ -124,3 +125,5 @@ bool DCE::runOnFunction(Function &F) { Pass *createDeadCodeEliminationPass() { return new DCE(); } + +} // End llvm namespace diff --git a/lib/Transforms/Scalar/DecomposeMultiDimRefs.cpp b/lib/Transforms/Scalar/DecomposeMultiDimRefs.cpp index d6aee14f24..e110cdac8b 100644 --- a/lib/Transforms/Scalar/DecomposeMultiDimRefs.cpp +++ b/lib/Transforms/Scalar/DecomposeMultiDimRefs.cpp @@ -25,6 +25,8 @@ #include "llvm/Pass.h" #include "Support/Statistic.h" +namespace llvm { + namespace { Statistic<> NumAdded("lowerrefs", "# of getelementptr instructions added"); @@ -36,13 +38,6 @@ namespace { RegisterOpt<DecomposePass> X("lowerrefs", "Decompose multi-dimensional " "structure/array references"); -FunctionPass -*createDecomposeMultiDimRefsPass() -{ - return new DecomposePass(); -} - - // runOnBasicBlock - Entry point for array or structure references with multiple // indices. // @@ -57,6 +52,11 @@ DecomposePass::runOnBasicBlock(BasicBlock &BB) return changed; } +FunctionPass +*createDecomposeMultiDimRefsPass() +{ + return new DecomposePass(); +} // Function: DecomposeArrayRef() // @@ -134,3 +134,5 @@ DecomposeArrayRef(GetElementPtrInst* GEP) return true; } + +} // End llvm namespace diff --git a/lib/Transforms/Scalar/GCSE.cpp b/lib/Transforms/Scalar/GCSE.cpp index e1654e5d7f..b00d3005bf 100644 --- a/lib/Transforms/Scalar/GCSE.cpp +++ b/lib/Transforms/Scalar/GCSE.cpp @@ -23,6 +23,8 @@ #include "Support/Statistic.h" #include <algorithm> +namespace llvm { + namespace { Statistic<> NumInstRemoved("gcse", "Number of instructions removed"); Statistic<> NumLoadRemoved("gcse", "Number of loads removed"); @@ -56,7 +58,6 @@ namespace { // createGCSEPass - The public interface to this file... FunctionPass *createGCSEPass() { return new GCSE(); } - // GCSE::runOnFunction - This is the main transformation entry point for a // function. // @@ -269,3 +270,5 @@ Instruction *GCSE::EliminateCSE(Instruction *I, Instruction *Other) { return Ret; } + +} // End llvm namespace diff --git a/lib/Transforms/Scalar/IndVarSimplify.cpp b/lib/Transforms/Scalar/IndVarSimplify.cpp index 1744fe41b2..0777a1e09f 100644 --- a/lib/Transforms/Scalar/IndVarSimplify.cpp +++ b/lib/Transforms/Scalar/IndVarSimplify.cpp @@ -26,6 +26,8 @@ #include "Support/Statistic.h" #include "Support/STLExtras.h" +namespace llvm { + namespace { Statistic<> NumRemoved ("indvars", "Number of aux indvars removed"); Statistic<> NumInserted("indvars", "Number of canonical indvars added"); @@ -217,3 +219,5 @@ namespace { Pass *createIndVarSimplifyPass() { return new InductionVariableSimplify(); } + +} // End llvm namespace diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp index 07736b57c2..8522b610e1 100644 --- a/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/lib/Transforms/Scalar/InstructionCombining.cpp @@ -49,6 +49,8 @@ #include "Support/Statistic.h" #include <algorithm> +namespace llvm { + namespace { Statistic<> NumCombined ("instcombine", "Number of insts combined"); Statistic<> NumConstProp("instcombine", "Number of constant folds"); @@ -2196,3 +2198,5 @@ bool InstCombiner::runOnFunction(Function &F) { Pass *createInstructionCombiningPass() { return new InstCombiner(); } + +} // End llvm namespace diff --git a/lib/Transforms/Scalar/LICM.cpp b/lib/Transforms/Scalar/LICM.cpp index 0f582c1feb..be635dff35 100644 --- a/lib/Transforms/Scalar/LICM.cpp +++ b/lib/Transforms/Scalar/LICM.cpp @@ -44,6 +44,8 @@ #include "llvm/Assembly/Writer.h" #include <algorithm> +namespace llvm { + namespace { cl::opt<bool> DisablePromotion("disable-licm-promotion", cl::Hidden, @@ -466,3 +468,5 @@ void LICM::findPromotableValuesInLoop( } } } + +} // End llvm namespace diff --git a/lib/Transforms/Scalar/PRE.cpp b/lib/Transforms/Scalar/PRE.cpp index fad5789d5a..770cd44d75 100644 --- a/lib/Transforms/Scalar/PRE.cpp +++ b/lib/Transforms/Scalar/PRE.cpp @@ -36,10 +36,12 @@ #include "Support/Statistic.h" #include "Support/hash_set" +namespace llvm { + namespace { Statistic<> NumExprsEliminated("pre", "Number of expressions constantified"); Statistic<> NumRedundant ("pre", "Number of redundant exprs eliminated"); - Statistic<> NumInserted ("pre", "Number of expressions inserted"); + static Statistic<> NumInserted ("pre", "Number of expressions inserted"); struct PRE : public FunctionPass { virtual void getAnalysisUsage(AnalysisUsage &AU) const { @@ -630,3 +632,5 @@ bool PRE::ProcessExpression(Instruction *Expr) { return Changed; } + +} // End llvm namespace diff --git a/lib/Transforms/Scalar/PiNodeInsertion.cpp b/lib/Transforms/Scalar/PiNodeInsertion.cpp index b5011af286..89ec20e069 100644 --- a/lib/Transforms/Scalar/PiNodeInsertion.cpp +++ b/lib/Transforms/Scalar/PiNodeInsertion.cpp @@ -42,6 +42,8 @@ #include "llvm/Support/CFG.h" #include "Support/Statistic.h" +namespace llvm { + namespace { Statistic<> NumInserted("pinodes", "Number of Pi nodes inserted"); @@ -182,3 +184,5 @@ bool PiNodeInserter::insertPiNodeFor(Value *V, BasicBlock *Succ, Value *Rep) { return true; } + +} // End llvm namespace diff --git a/lib/Transforms/Scalar/Reassociate.cpp b/lib/Transforms/Scalar/Reassociate.cpp index befdcfec77..9e22ec4e7e 100644 --- a/lib/Transforms/Scalar/Reassociate.cpp +++ b/lib/Transforms/Scalar/Reassociate.cpp @@ -34,6 +34,8 @@ #include "Support/PostOrderIterator.h" #include "Support/Statistic.h" +namespace llvm { + namespace { Statistic<> NumLinear ("reassociate","Number of insts linearized"); Statistic<> NumChanged("reassociate","Number of insts reassociated"); @@ -58,6 +60,7 @@ namespace { RegisterOpt<Reassociate> X("reassociate", "Reassociate expressions"); } +// Public interface to the Reassociate pass FunctionPass *createReassociatePass() { return new Reassociate(); } void Reassociate::BuildRankMap(Function &F) { @@ -291,3 +294,5 @@ bool Reassociate::runOnFunction(Function &F) { ValueRankMap.clear(); return Changed; } + +} // End llvm namespace diff --git a/lib/Transforms/Scalar/SCCP.cpp b/lib/Transforms/Scalar/SCCP.cpp index 01e3e26ab5..44a553a01b 100644 --- a/lib/Transforms/Scalar/SCCP.cpp +++ b/lib/Transforms/Scalar/SCCP.cpp @@ -33,6 +33,8 @@ #include <algorithm> #include <set> +namespace llvm { + // InstVal class - This class represents the different lattice values that an // instruction may occupy. It is a simple class with value semantics. // @@ -253,7 +255,6 @@ private: // createSCCPPass - This is the public interface to this file... -// Pass *createSCCPPass() { return new SCCP(); } @@ -585,3 +586,5 @@ void SCCP::visitGetElementPtrInst(GetElementPtrInst &I) { markConstant(&I, ConstantExpr::getGetElementPtr(Ptr, Operands)); } + +} // End llvm namespace diff --git a/lib/Transforms/Scalar/ScalarReplAggregates.cpp b/lib/Transforms/Scalar/ScalarReplAggregates.cpp index 9342a5cf40..d29119061d 100644 --- a/lib/Transforms/Scalar/ScalarReplAggregates.cpp +++ b/lib/Transforms/Scalar/ScalarReplAggregates.cpp @@ -32,6 +32,8 @@ #include "Support/Statistic.h" #include "Support/StringExtras.h" +namespace llvm { + namespace { Statistic<> NumReplaced("scalarrepl", "Number of allocas broken up"); Statistic<> NumPromoted("scalarrepl", "Number of allocas promoted"); @@ -61,6 +63,7 @@ namespace { RegisterOpt<SROA> X("scalarrepl", "Scalar Replacement of Aggregates"); } +// Public interface to the ScalarReplAggregates pass Pass *createScalarReplAggregatesPass() { return new SROA(); } @@ -298,3 +301,5 @@ bool SROA::isSafeAllocaToPromote(AllocationInst *AI) { } return true; } + +} // End llvm namespace diff --git a/lib/Transforms/Scalar/SimplifyCFG.cpp b/lib/Transforms/Scalar/SimplifyCFG.cpp index 224d6c5f9a..5a8d428153 100644 --- a/lib/Transforms/Scalar/SimplifyCFG.cpp +++ b/lib/Transforms/Scalar/SimplifyCFG.cpp @@ -26,6 +26,8 @@ #include "Support/Statistic.h" #include <set> +namespace llvm { + namespace { Statistic<> NumSimpl("cfgsimplify", "Number of blocks simplified"); @@ -35,6 +37,7 @@ namespace { RegisterOpt<CFGSimplifyPass> X("simplifycfg", "Simplify the CFG"); } +// Public interface to the CFGSimplification pass FunctionPass *createCFGSimplificationPass() { return new CFGSimplifyPass(); } @@ -100,3 +103,5 @@ bool CFGSimplifyPass::runOnFunction(Function &F) { return Changed; } + +} // End llvm namespace diff --git a/lib/Transforms/Scalar/SymbolStripping.cpp b/lib/Transforms/Scalar/SymbolStripping.cpp index 58395c55ab..9e058e7939 100644 --- a/lib/Transforms/Scalar/SymbolStripping.cpp +++ b/lib/Transforms/Scalar/SymbolStripping.cpp @@ -26,6 +26,8 @@ #include "llvm/SymbolTable.h" #include "llvm/Pass.h" +namespace llvm { + static bool StripSymbolTable(SymbolTable &SymTab) { bool RemovedSymbol = false; @@ -74,3 +76,5 @@ Pass *createSymbolStrippingPass() { Pass *createFullSymbolStrippingPass() { return new FullSymbolStripping(); } + +} // End llvm namespace diff --git a/lib/Transforms/Scalar/TailDuplication.cpp b/lib/Transforms/Scalar/TailDuplication.cpp index d0a7765818..07a3b1e492 100644 --- a/lib/Transforms/Scalar/TailDuplication.cpp +++ b/lib/Transforms/Scalar/TailDuplication.cpp @@ -31,6 +31,8 @@ #include "Support/Debug.h" #include "Support/Statistic.h" +namespace llvm { + namespace { Statistic<> NumEliminated("tailduplicate", "Number of unconditional branches eliminated"); @@ -53,6 +55,7 @@ namespace { RegisterOpt<TailDup> X("tailduplicate", "Tail Duplication"); } +// Public interface to the Tail Duplication pass Pass *createTailDuplicationPass() { return new TailDup(); } /// runOnFunction - Top level algorithm - Loop over each unconditional branch in @@ -339,3 +342,5 @@ Value *TailDup::GetValueOutBlock(BasicBlock *BB, Value *OrigVal, return GetValueInBlock(BB, OrigVal, ValueMap, OutValueMap); } + +} // End llvm namespace diff --git a/lib/Transforms/Scalar/TailRecursionElimination.cpp b/lib/Transforms/Scalar/TailRecursionElimination.cpp index d07f4e857e..dbe91a7940 100644 --- a/lib/Transforms/Scalar/TailRecursionElimination.cpp +++ b/lib/Transforms/Scalar/TailRecursionElimination.cpp @@ -33,6 +33,8 @@ #include "llvm/Pass.h" #include "Support/Statistic.h" +namespace llvm { + namespace { Statistic<> NumEliminated("tailcallelim", "Number of tail calls removed"); @@ -42,6 +44,7 @@ namespace { RegisterOpt<TailCallElim> X("tailcallelim", "Tail Call Elimination"); } +// Public interface to the TailCallElimination pass FunctionPass *createTailCallEliminationPass() { return new TailCallElim(); } @@ -105,3 +108,4 @@ bool TailCallElim::runOnFunction(Function &F) { return MadeChange; } +} // End llvm namespace diff --git a/lib/Transforms/TransformInternals.cpp b/lib/Transforms/TransformInternals.cpp index 3a1d51c3a0..b553f03a41 100644 --- a/lib/Transforms/TransformInternals.cpp +++ b/lib/Transforms/TransformInternals.cpp @@ -18,6 +18,8 @@ #include "llvm/Function.h" #include "llvm/iOther.h" +namespace llvm { + static const Type *getStructOffsetStep(const StructType *STy, uint64_t &Offset, std::vector<Value*> &Indices, const TargetData &TD) { @@ -193,3 +195,5 @@ const Type *ConvertibleToGEP(const Type *Ty, Value *OffsetVal, return NextTy; } + +} // End llvm namespace diff --git a/lib/Transforms/TransformInternals.h b/lib/Transforms/TransformInternals.h index 4f92dc4eda..3b80146a27 100644 --- a/lib/Transforms/TransformInternals.h +++ b/lib/Transforms/TransformInternals.h @@ -22,6 +22,8 @@ #include <map> #include <set> +namespace llvm { + static inline int64_t getConstantValue(const ConstantInt *CPI) { return (int64_t)cast<ConstantInt>(CPI)->getRawValue(); } @@ -139,4 +141,6 @@ const Type *getStructOffsetType(const Type *Ty, unsigned &Offset, std::vector<Value*> &Offsets, const TargetData &TD, bool StopEarly = true); +} // End llvm namespace + #endif diff --git a/lib/Transforms/Utils/BasicBlockUtils.cpp b/lib/Transforms/Utils/BasicBlockUtils.cpp index 22fd555a46..5fb5469332 100644 --- a/lib/Transforms/Utils/BasicBlockUtils.cpp +++ b/lib/Transforms/Utils/BasicBlockUtils.cpp @@ -19,6 +19,8 @@ #include "llvm/Type.h" #include <algorithm> +namespace llvm { + // ReplaceInstWithValue - Replace all uses of an instruction (specified by BI) // with a value, then remove and delete the original instruction. // @@ -112,3 +114,5 @@ void RemoveSuccessor(TerminatorInst *TI, unsigned SuccNum) { if (NewTI) // If it's a different instruction, replace. ReplaceInstWithInst(TI, NewTI); } + +} // End llvm namespace diff --git a/lib/Transforms/Utils/BreakCriticalEdges.cpp b/lib/Transforms/Utils/BreakCriticalEdges.cpp index de59db2f9b..e8201cc391 100644 --- a/lib/Transforms/Utils/BreakCriticalEdges.cpp +++ b/lib/Transforms/Utils/BreakCriticalEdges.cpp @@ -25,6 +25,8 @@ #include "llvm/Support/CFG.h" #include "Support/Statistic.h" +namespace llvm { + namespace { Statistic<> NumBroken("break-crit-edges", "Number of blocks inserted"); @@ -168,3 +170,5 @@ bool SplitCriticalEdge(TerminatorInst *TI, unsigned SuccNum, Pass *P) { } return true; } + +} // End llvm namespace diff --git a/lib/Transforms/Utils/CloneFunction.cpp b/lib/Transforms/Utils/CloneFunction.cpp index e0312f2efb..d8aa9aebe4 100644 --- a/lib/Transforms/Utils/CloneFunction.cpp +++ b/lib/Transforms/Utils/CloneFunction.cpp @@ -19,6 +19,8 @@ #include "llvm/Function.h" #include "ValueMapper.h" +namespace llvm { + // RemapInstruction - Convert the instruction operands from referencing the // current values into those specified by ValueMap. // @@ -140,3 +142,5 @@ Function *CloneFunction(const Function *F, CloneFunctionInto(NewF, F, ValueMap, Returns); return NewF; } + +} // End llvm namespace diff --git a/lib/Transforms/Utils/CloneModule.cpp b/lib/Transforms/Utils/CloneModule.cpp index cc22c7214a..21a8675f07 100644 --- a/lib/Transforms/Utils/CloneModule.cpp +++ b/lib/Transforms/Utils/CloneModule.cpp @@ -19,6 +19,8 @@ #include "llvm/Constant.h" #include "ValueMapper.h" +namespace llvm { + /// CloneModule - Return an exact copy of the specified module. This is not as /// easy as it might seem because we have to worry about making copies of global /// variables and functions, and making their (initializers and references, @@ -88,3 +90,5 @@ Module *CloneModule(const Module *M) { return New; } + +} // End llvm namespace diff --git a/lib/Transforms/Utils/CloneTrace.cpp b/lib/Transforms/Utils/CloneTrace.cpp index 9d995464bf..990e54c783 100644 --- a/lib/Transforms/Utils/CloneTrace.cpp +++ b/lib/Transforms/Utils/CloneTrace.cpp @@ -20,6 +20,8 @@ #include "llvm/Function.h" +namespace llvm { + //Clones the trace (a vector of basic blocks) std::vector<BasicBlock *> CloneTrace(const std::vector<BasicBlock*> &origTrace) { @@ -86,3 +88,5 @@ std::vector<BasicBlock *> CloneTrace(const std::vector<BasicBlock*> &origTrace) //return new vector of basic blocks return clonedTrace; } + +} // End llvm namespace diff --git a/lib/Transforms/Utils/DemoteRegToStack.cpp b/lib/Transforms/Utils/DemoteRegToStack.cpp index bd605ca789..e35dca4de0 100644 --- a/lib/Transforms/Utils/DemoteRegToStack.cpp +++ b/lib/Transforms/Utils/DemoteRegToStack.cpp @@ -22,6 +22,8 @@ #include "llvm/Type.h" #include "Support/hash_set" +namespace llvm { + typedef hash_set<PHINode*> PhiSet; typedef hash_set<PHINode*>::iterator PhiSetIterator; @@ -160,3 +162,5 @@ AllocaInst* DemoteRegToStack(Instruction& X) { return XSlot; } + +} // End llvm namespace diff --git a/lib/Transforms/Utils/InlineFunction.cpp b/lib/Transforms/Utils/InlineFunction.cpp index 1481324330..265d5c419a 100644 --- a/lib/Transforms/Utils/InlineFunction.cpp +++ b/lib/Transforms/Utils/InlineFunction.cpp @@ -24,6 +24,8 @@ #include "llvm/Support/CallSite.h" #include "llvm/Transforms/Utils/Local.h" +namespace llvm { + bool InlineFunction(CallInst *CI) { return InlineFunction(CallSite(CI)); } bool InlineFunction(InvokeInst *II) { return InlineFunction(CallSite(II)); } @@ -278,3 +280,5 @@ bool InlineFunction(CallSite CS) { SimplifyCFG(AfterCallBB); return true; } + +} // End llvm namespace diff --git a/lib/Transforms/Utils/Linker.cpp b/lib/Transforms/Utils/Linker.cpp index 0be840fb6c..4bc78a4cde 100644 --- a/lib/Transforms/Utils/Linker.cpp +++ b/lib/Transforms/Utils/Linker.cpp @@ -23,6 +23,8 @@ #include "llvm/iOther.h" #include "llvm/Constants.h" +namespace llvm { + // Error - Simple wrapper function to conditionally assign to E and return true. // This just makes error return conditions a little bit simpler... // @@ -902,3 +904,4 @@ bool LinkModules(Module *Dest, const Module *Src, std::string *ErrorMsg) { return false; } +} // End llvm namespace diff --git a/lib/Transforms/Utils/Local.cpp b/lib/Transforms/Utils/Local.cpp index 2f9b07ca94..894699596e 100644 --- a/lib/Transforms/Utils/Local.cpp +++ b/lib/Transforms/Utils/Local.cpp @@ -17,6 +17,8 @@ #include "llvm/iOperators.h" #include "llvm/ConstantHandling.h" +namespace llvm { + //===----------------------------------------------------------------------===// // Local constant propagation... // @@ -180,3 +182,5 @@ bool dceInstruction(BasicBlock::iterator &BBI) { } return false; } + +} // End llvm namespace diff --git a/lib/Transforms/Utils/LoopSimplify.cpp b/lib/Transforms/Utils/LoopSimplify.cpp index a1f86486b5..b999ed40cc 100644 --- a/lib/Transforms/Utils/LoopSimplify.cpp +++ b/lib/Transforms/Utils/LoopSimplify.cpp @@ -43,6 +43,8 @@ #include "Support/Statistic.h" #include "Support/DepthFirstIterator.h" +namespace llvm { + namespace { Statistic<> NumInserted("loopsimplify", "Number of pre-header blocks inserted"); @@ -82,7 +84,6 @@ namespace { const PassInfo *LoopSimplifyID = X.getPassInfo(); Pass *createLoopSimplifyPass() { return new LoopSimplify(); } - /// runOnFunction - Run down all loops in the CFG (recursively, but we could do /// it in any convenient order) inserting preheaders... /// @@ -566,3 +567,5 @@ void LoopSimplify::UpdateDomInfoForRevectoredPreds(BasicBlock *NewBB, } } } + +} // End llvm namespace diff --git a/lib/Transforms/Utils/LowerAllocations.cpp b/lib/Transforms/Utils/LowerAllocations.cpp index 96008881bb..eea800ad54 100644 --- a/lib/Transforms/Utils/LowerAllocations.cpp +++ b/lib/Transforms/Utils/LowerAllocations.cpp @@ -22,6 +22,8 @@ #include "llvm/Target/TargetData.h" #include "Support/Statistic.h" +namespace llvm { + namespace { Statistic<> NumLowered("lowerallocs", "Number of allocations lowered"); @@ -131,3 +133,5 @@ bool LowerAllocations::runOnBasicBlock(BasicBlock &BB) { return Changed; } + +} // End llvm namespace diff --git a/lib/Transforms/Utils/LowerInvoke.cpp b/lib/Transforms/Utils/LowerInvoke.cpp index 4885d96f19..ec97ca2040 100644 --- a/lib/Transforms/Utils/LowerInvoke.cpp +++ b/lib/Transforms/Utils/LowerInvoke.cpp @@ -23,6 +23,8 @@ #include "llvm/Constant.h" #include "Support/Statistic.h" +namespace llvm { + namespace { Statistic<> NumLowered("lowerinvoke", "Number of invoke & unwinds replaced"); @@ -37,6 +39,7 @@ namespace { X("lowerinvoke", "Lower invoke and unwind, for unwindless code generators"); } +// Public Interface To the LowerInvoke pass. FunctionPass *createLowerInvokePass() { return new LowerInvoke(); } // doInitialization - Make sure that there is a prototype for abort in the @@ -79,3 +82,5 @@ bool LowerInvoke::runOnFunction(Function &F) { } return Changed; } + +} // End llvm namespace diff --git a/lib/Transforms/Utils/LowerSwitch.cpp b/lib/Transforms/Utils/LowerSwitch.cpp index a45192bb0c..1d0e47145a 100644 --- a/lib/Transforms/Utils/LowerSwitch.cpp +++ b/lib/Transforms/Utils/LowerSwitch.cpp @@ -23,6 +23,8 @@ #include "Support/Debug.h" #include "Support/Statistic.h" +namespace llvm { + namespace { Statistic<> NumLowered("lowerswitch", "Number of SwitchInst's replaced"); @@ -224,3 +226,5 @@ void LowerSwitch::processSwitchInst(SwitchInst *SI) { // We are now done with the switch instruction, delete it. delete SI; } + +} // End llvm namespace diff --git a/lib/Transforms/Utils/Mem2Reg.cpp b/lib/Transforms/Utils/Mem2Reg.cpp index d915155ed4..4d99280805 100644 --- a/lib/Transforms/Utils/Mem2Reg.cpp +++ b/lib/Transforms/Utils/Mem2Reg.cpp @@ -20,6 +20,8 @@ #include "llvm/Target/TargetData.h" #include "Support/Statistic.h" +namespace llvm { + namespace { Statistic<> NumPromoted("mem2reg", "Number of alloca's promoted"); @@ -78,3 +80,5 @@ bool PromotePass::runOnFunction(Function &F) { Pass *createPromoteMemoryToRegister() { return new PromotePass(); } + +} // End llvm namespace diff --git a/lib/Transforms/Utils/PromoteMemoryToRegister.cpp b/lib/Transforms/Utils/PromoteMemoryToRegister.cpp index f920718c3a..0859f69980 100644 --- a/lib/Transforms/Utils/PromoteMemoryToRegister.cpp +++ b/lib/Transforms/Utils/PromoteMemoryToRegister.cpp @@ -25,6 +25,8 @@ #include "llvm/Support/CFG.h" #include "Support/StringExtras.h" +namespace llvm { + /// isAllocaPromotable - Return true if this alloca is legal for promotion. /// This is true if there are only loads and stores to the alloca... /// @@ -459,3 +461,5 @@ void PromoteMemToReg(const std::vector<AllocaInst*> &Allocas, if (Allocas.empty()) return; PromoteMem2Reg(Allocas, DT, DF, TD).run(); } + +} // End llvm namespace diff --git a/lib/Transforms/Utils/SimplifyCFG.cpp b/lib/Transforms/Utils/SimplifyCFG.cpp index a5f54b1326..158d9119ae 100644 --- a/lib/Transforms/Utils/SimplifyCFG.cpp +++ b/lib/Transforms/Utils/SimplifyCFG.cpp @@ -21,6 +21,8 @@ #include <algorithm> #include <functional> +namespace llvm { + // PropagatePredecessors - This gets "Succ" ready to have the predecessors from // "BB". This is a little tricky because "Succ" has PHI nodes, which need to // have extra slots added to them to hold the merge edges from BB's @@ -298,3 +300,5 @@ bool SimplifyCFG(BasicBlock *BB) { return Changed; } + +} // End llvm namespace diff --git a/lib/Transforms/Utils/UnifyFunctionExitNodes.cpp b/lib/Transforms/Utils/UnifyFunctionExitNodes.cpp index 180871b093..2591ffd6d7 100644 --- a/lib/Transforms/Utils/UnifyFunctionExitNodes.cpp +++ b/lib/Transforms/Utils/UnifyFunctionExitNodes.cpp @@ -22,6 +22,8 @@ #include "llvm/iPHINode.h" #include "llvm/Type.h" +namespace llvm { + static RegisterOpt<UnifyFunctionExitNodes> X("mergereturn", "Unify function exit nodes"); @@ -112,3 +114,5 @@ bool UnifyFunctionExitNodes::runOnFunction(Function &F) { ReturnBlock = NewRetBlock; return true; } + +} // End llvm namespace diff --git a/lib/Transforms/Utils/ValueMapper.cpp b/lib/Transforms/Utils/ValueMapper.cpp index 6590498bbc..248ebace7a 100644 --- a/lib/Transforms/Utils/ValueMapper.cpp +++ b/lib/Transforms/Utils/ValueMapper.cpp @@ -16,6 +16,8 @@ #include "llvm/Constants.h" #include "llvm/Instruction.h" +namespace llvm { + Value *MapValue(const Value *V, std::map<const Value*, Value*> &VM) { Value *&VMSlot = VM[V]; if (VMSlot) return VMSlot; // Does it exist in the map yet? @@ -105,3 +107,4 @@ Value *MapValue(const Value *V, std::map<const Value*, Value*> &VM) { return 0; } +} // End llvm namespace diff --git a/lib/Transforms/Utils/ValueMapper.h b/lib/Transforms/Utils/ValueMapper.h index 8264ade108..e67b3261db 100644 --- a/lib/Transforms/Utils/ValueMapper.h +++ b/lib/Transforms/Utils/ValueMapper.h @@ -16,8 +16,13 @@ #define LIB_TRANSFORMS_UTILS_VALUE_MAPPER_H #include <map> + +namespace llvm { + class Value; Value *MapValue(const Value *V, std::map<const Value*, Value*> &VM); +} // End llvm namespace + #endif |