From 1e2385b941242f2f96398dc62767420622856149 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Fri, 21 Nov 2003 21:54:22 +0000 Subject: [PATCH] Finegrainify namespacification git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10138 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Analysis/DataStructure/Parallelize.cpp | 4 +--- lib/Transforms/IPO/ConstantMerge.cpp | 6 ++---- lib/Transforms/IPO/DeadArgumentElimination.cpp | 10 +++------- lib/Transforms/IPO/DeadTypeElimination.cpp | 7 ++----- lib/Transforms/IPO/ExtractFunction.cpp | 8 +++----- lib/Transforms/IPO/GlobalDCE.cpp | 6 ++---- lib/Transforms/IPO/IPConstantPropagation.cpp | 7 +++---- lib/Transforms/IPO/Internalize.cpp | 7 ++----- lib/Transforms/IPO/LowerSetJmp.cpp | 7 +++---- lib/Transforms/IPO/Parallelize.cpp | 4 +--- lib/Transforms/IPO/PruneEH.cpp | 7 +++---- lib/Transforms/IPO/RaiseAllocations.cpp | 6 ++---- 12 files changed, 27 insertions(+), 52 deletions(-) diff --git a/lib/Analysis/DataStructure/Parallelize.cpp b/lib/Analysis/DataStructure/Parallelize.cpp index fd39b6b12a5..e22c86cb7fe 100644 --- a/lib/Analysis/DataStructure/Parallelize.cpp +++ b/lib/Analysis/DataStructure/Parallelize.cpp @@ -52,8 +52,7 @@ #include "Support/hash_map" #include #include - -namespace llvm { +using namespace llvm; //---------------------------------------------------------------------------- // Global constants used in marking Cilk functions and function calls. @@ -538,4 +537,3 @@ bool Parallelize::run(Module& M) return true; } -} // End llvm namespace diff --git a/lib/Transforms/IPO/ConstantMerge.cpp b/lib/Transforms/IPO/ConstantMerge.cpp index 498cd7bb142..2ae61fac6e0 100644 --- a/lib/Transforms/IPO/ConstantMerge.cpp +++ b/lib/Transforms/IPO/ConstantMerge.cpp @@ -21,8 +21,7 @@ #include "llvm/Module.h" #include "llvm/Pass.h" #include "Support/Statistic.h" - -namespace llvm { +using namespace llvm; namespace { Statistic<> NumMerged("constmerge", "Number of global constants merged"); @@ -37,7 +36,7 @@ namespace { RegisterOpt X("constmerge","Merge Duplicate Global Constants"); } -Pass *createConstantMergePass() { return new ConstantMerge(); } +Pass *llvm::createConstantMergePass() { return new ConstantMerge(); } bool ConstantMerge::run(Module &M) { std::map CMap; @@ -80,4 +79,3 @@ 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 197710d6502..f90960fc04e 100644 --- a/lib/Transforms/IPO/DeadArgumentElimination.cpp +++ b/lib/Transforms/IPO/DeadArgumentElimination.cpp @@ -29,8 +29,7 @@ #include "Support/Statistic.h" #include "Support/iterator" #include - -namespace llvm { +using namespace llvm; namespace { Statistic<> NumArgumentsEliminated("deadargelim", @@ -108,8 +107,8 @@ namespace { /// createDeadArgEliminationPass - This pass removes arguments from functions /// which are not used by the body of the function. /// -Pass *createDeadArgEliminationPass() { return new DAE(); } -Pass *createDeadArgHackingPass() { return new DAH(); } +Pass *llvm::createDeadArgEliminationPass() { return new DAE(); } +Pass *llvm::createDeadArgHackingPass() { return new DAH(); } static inline bool CallPassesValueThoughVararg(Instruction *Call, const Value *Arg) { @@ -578,6 +577,3 @@ 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 126991d3e69..8849a025a0a 100644 --- a/lib/Transforms/IPO/DeadTypeElimination.cpp +++ b/lib/Transforms/IPO/DeadTypeElimination.cpp @@ -18,8 +18,7 @@ #include "llvm/SymbolTable.h" #include "llvm/DerivedTypes.h" #include "Support/Statistic.h" - -namespace llvm { +using namespace llvm; namespace { struct DTE : public Pass { @@ -42,7 +41,7 @@ namespace { NumKilled("deadtypeelim", "Number of unused typenames removed from symtab"); } -Pass *createDeadTypeEliminationPass() { +Pass *llvm::createDeadTypeEliminationPass() { return new DTE(); } @@ -96,5 +95,3 @@ 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 4e61a3433a0..f98c6197dca 100644 --- a/lib/Transforms/IPO/ExtractFunction.cpp +++ b/lib/Transforms/IPO/ExtractFunction.cpp @@ -6,11 +6,11 @@ // the University of Illinois Open Source License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// + #include "llvm/Transforms/IPO.h" #include "llvm/Pass.h" #include "llvm/Module.h" - -namespace llvm { +using namespace llvm; namespace { class FunctionExtractorPass : public Pass { @@ -89,8 +89,6 @@ namespace { RegisterPass X("extract", "Function Extractor"); } -Pass *createFunctionExtractionPass(Function *F) { +Pass *llvm::createFunctionExtractionPass(Function *F) { return new FunctionExtractorPass(F); } - -} // End llvm namespace diff --git a/lib/Transforms/IPO/GlobalDCE.cpp b/lib/Transforms/IPO/GlobalDCE.cpp index 8e7920dc1b6..8444a452af2 100644 --- a/lib/Transforms/IPO/GlobalDCE.cpp +++ b/lib/Transforms/IPO/GlobalDCE.cpp @@ -21,8 +21,7 @@ #include "llvm/Pass.h" #include "Support/Statistic.h" #include - -namespace llvm { +using namespace llvm; namespace { Statistic<> NumFunctions("globaldce","Number of functions removed"); @@ -49,7 +48,7 @@ namespace { RegisterOpt X("globaldce", "Dead Global Elimination"); } -Pass *createGlobalDCEPass() { return new GlobalDCE(); } +Pass *llvm::createGlobalDCEPass() { return new GlobalDCE(); } bool GlobalDCE::run(Module &M) { bool Changed = false; @@ -198,4 +197,3 @@ 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 b0135d15311..026dbe3e803 100644 --- a/lib/Transforms/IPO/IPConstantPropagation.cpp +++ b/lib/Transforms/IPO/IPConstantPropagation.cpp @@ -21,8 +21,7 @@ #include "llvm/Constants.h" #include "llvm/Support/CallSite.h" #include "Support/Statistic.h" - -namespace llvm { +using namespace llvm; namespace { Statistic<> NumArgumentsProped("ipconstprop", @@ -38,7 +37,7 @@ namespace { RegisterOpt X("ipconstprop", "Interprocedural constant propagation"); } -Pass *createIPConstantPropagationPass() { return new IPCP(); } +Pass *llvm::createIPConstantPropagationPass() { return new IPCP(); } bool IPCP::run(Module &M) { bool Changed = false; @@ -117,6 +116,7 @@ bool IPCP::processFunction(Function &F) { Value *V = ArgumentConstants[i].first; if (ConstantPointerRef *CPR = dyn_cast(V)) V = CPR->getValue(); + AI->replaceAllUsesWith(V); ++NumArgumentsProped; MadeChange = true; @@ -124,4 +124,3 @@ bool IPCP::processFunction(Function &F) { return MadeChange; } -} // End llvm namespace diff --git a/lib/Transforms/IPO/Internalize.cpp b/lib/Transforms/IPO/Internalize.cpp index 574c8bf268f..15c68cd893b 100644 --- a/lib/Transforms/IPO/Internalize.cpp +++ b/lib/Transforms/IPO/Internalize.cpp @@ -21,8 +21,7 @@ #include "Support/Statistic.h" #include #include - -namespace llvm { +using namespace llvm; namespace { Statistic<> NumFunctions("internalize", "Number of functions internalized"); @@ -118,8 +117,6 @@ namespace { RegisterOpt X("internalize", "Internalize Global Symbols"); } // end anonymous namespace -Pass *createInternalizePass() { +Pass *llvm::createInternalizePass() { return new InternalizePass(); } - -} // End llvm namespace diff --git a/lib/Transforms/IPO/LowerSetJmp.cpp b/lib/Transforms/IPO/LowerSetJmp.cpp index f18fb929b34..a9c87f6a89b 100644 --- a/lib/Transforms/IPO/LowerSetJmp.cpp +++ b/lib/Transforms/IPO/LowerSetJmp.cpp @@ -33,6 +33,7 @@ // pass invokable via the "opt" command at will. //===----------------------------------------------------------------------===// +#include "llvm/Transforms/IPO.h" #include "llvm/Constants.h" #include "llvm/DerivedTypes.h" #include "llvm/Instructions.h" @@ -46,8 +47,7 @@ #include "Support/Statistic.h" #include "Support/StringExtras.h" #include "Support/VectorExtras.h" - -namespace llvm { +using namespace llvm; namespace { Statistic<> LongJmpsTransformed("lowersetjmp", @@ -533,9 +533,8 @@ void LowerSetJmp::visitUnwindInst(UnwindInst& UI) "", &UI); } -Pass* createLowerSetJmpPass() +Pass* llvm::createLowerSetJmpPass() { return new LowerSetJmp(); } -} // End llvm namespace diff --git a/lib/Transforms/IPO/Parallelize.cpp b/lib/Transforms/IPO/Parallelize.cpp index fd39b6b12a5..e22c86cb7fe 100644 --- a/lib/Transforms/IPO/Parallelize.cpp +++ b/lib/Transforms/IPO/Parallelize.cpp @@ -52,8 +52,7 @@ #include "Support/hash_map" #include #include - -namespace llvm { +using namespace llvm; //---------------------------------------------------------------------------- // Global constants used in marking Cilk functions and function calls. @@ -538,4 +537,3 @@ 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 30e2514872e..74e0d33d412 100644 --- a/lib/Transforms/IPO/PruneEH.cpp +++ b/lib/Transforms/IPO/PruneEH.cpp @@ -14,6 +14,7 @@ // //===----------------------------------------------------------------------===// +#include "llvm/Transforms/IPO.h" #include "llvm/CallGraphSCCPass.h" #include "llvm/Function.h" #include "llvm/Intrinsics.h" @@ -22,8 +23,7 @@ #include "llvm/Analysis/CallGraph.h" #include "Support/Statistic.h" #include - -namespace llvm { +using namespace llvm; namespace { Statistic<> NumRemoved("prune-eh", "Number of invokes removed"); @@ -39,7 +39,7 @@ namespace { RegisterOpt X("prune-eh", "Remove unused exception handling info"); } -Pass *createPruneEHPass() { return new PruneEH(); } +Pass *llvm::createPruneEHPass() { return new PruneEH(); } bool PruneEH::runOnSCC(const std::vector &SCC) { @@ -107,4 +107,3 @@ bool PruneEH::runOnSCC(const std::vector &SCC) { return MadeChange; } -} // End llvm namespace diff --git a/lib/Transforms/IPO/RaiseAllocations.cpp b/lib/Transforms/IPO/RaiseAllocations.cpp index fd5b7fb1f13..dea919773e5 100644 --- a/lib/Transforms/IPO/RaiseAllocations.cpp +++ b/lib/Transforms/IPO/RaiseAllocations.cpp @@ -21,8 +21,7 @@ #include "llvm/Pass.h" #include "llvm/Support/CallSite.h" #include "Support/Statistic.h" - -namespace llvm { +using namespace llvm; namespace { Statistic<> NumRaised("raiseallocs", "Number of allocations raised"); @@ -52,7 +51,7 @@ namespace { // createRaiseAllocationsPass - The interface to this file... -Pass *createRaiseAllocationsPass() { +Pass *llvm::createRaiseAllocationsPass() { return new RaiseAllocations(); } @@ -197,4 +196,3 @@ bool RaiseAllocations::run(Module &M) { return Changed; } -} // End llvm namespace