diff options
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 |