diff options
Diffstat (limited to 'llvm/lib')
249 files changed, 1150 insertions, 189 deletions
diff --git a/llvm/lib/Analysis/AliasAnalysis.cpp b/llvm/lib/Analysis/AliasAnalysis.cpp index 3acdf7841da..c881ec283a9 100644 --- a/llvm/lib/Analysis/AliasAnalysis.cpp +++ b/llvm/lib/Analysis/AliasAnalysis.cpp @@ -29,6 +29,8 @@ #include "llvm/iMemory.h" #include "llvm/Target/TargetData.h" +namespace llvm { + // Register the AliasAnalysis interface, providing a nice name to refer to. namespace { RegisterAnalysisGroup<AliasAnalysis> Z("Alias Analysis"); @@ -123,3 +125,5 @@ namespace { // Declare that we implement the AliasAnalysis interface RegisterAnalysisGroup<AliasAnalysis, NoAA> Y; } // End of anonymous namespace + +} // End llvm namespace diff --git a/llvm/lib/Analysis/AliasAnalysisCounter.cpp b/llvm/lib/Analysis/AliasAnalysisCounter.cpp index 58205652233..59036a4c39c 100644 --- a/llvm/lib/Analysis/AliasAnalysisCounter.cpp +++ b/llvm/lib/Analysis/AliasAnalysisCounter.cpp @@ -16,6 +16,8 @@ #include "llvm/Pass.h" #include <iostream> +namespace llvm { + namespace { class AliasAnalysisCounter : public Pass, public AliasAnalysis { unsigned No, May, Must; @@ -108,3 +110,5 @@ namespace { X("count-aa", "Count Alias Analysis Query Responses"); RegisterAnalysisGroup<AliasAnalysis, AliasAnalysisCounter> Y; } + +} // End llvm namespace diff --git a/llvm/lib/Analysis/AliasAnalysisEvaluator.cpp b/llvm/lib/Analysis/AliasAnalysisEvaluator.cpp index d4a7d18dcd4..2c967c5daa2 100644 --- a/llvm/lib/Analysis/AliasAnalysisEvaluator.cpp +++ b/llvm/lib/Analysis/AliasAnalysisEvaluator.cpp @@ -26,6 +26,8 @@ #include "Support/CommandLine.h" #include <set> +namespace llvm { + namespace { cl::opt<bool> PrintNo ("print-no-aliases", cl::ReallyHidden); cl::opt<bool> PrintMay ("print-may-aliases", cl::ReallyHidden); @@ -114,3 +116,5 @@ bool AAEval::doFinalization(Module &M) { << May*100/Sum << "%/" << Must*100/Sum<<"%\n"; return false; } + +} // End llvm namespace diff --git a/llvm/lib/Analysis/AliasSetTracker.cpp b/llvm/lib/Analysis/AliasSetTracker.cpp index c2800326c20..4a293448ed3 100644 --- a/llvm/lib/Analysis/AliasSetTracker.cpp +++ b/llvm/lib/Analysis/AliasSetTracker.cpp @@ -21,6 +21,8 @@ #include "llvm/Assembly/Writer.h" #include "llvm/Support/InstIterator.h" +namespace llvm { + /// mergeSetIn - Merge the specified alias set into this alias set... /// void AliasSet::mergeSetIn(AliasSet &AS) { @@ -294,7 +296,6 @@ void AliasSetTracker::print(std::ostream &OS) const { void AliasSet::dump() const { print (std::cerr); } void AliasSetTracker::dump() const { print(std::cerr); } - //===----------------------------------------------------------------------===// // AliasSetPrinter Pass //===----------------------------------------------------------------------===// @@ -328,3 +329,5 @@ namespace { RegisterPass<AliasSetPrinter> X("print-alias-sets", "Alias Set Printer", PassInfo::Analysis | PassInfo::Optimization); } + +} // End llvm namespace diff --git a/llvm/lib/Analysis/BasicAliasAnalysis.cpp b/llvm/lib/Analysis/BasicAliasAnalysis.cpp index e60922ac049..16512c0e176 100644 --- a/llvm/lib/Analysis/BasicAliasAnalysis.cpp +++ b/llvm/lib/Analysis/BasicAliasAnalysis.cpp @@ -23,10 +23,11 @@ #include "llvm/DerivedTypes.h" #include "llvm/Target/TargetData.h" +namespace llvm { + // Make sure that anything that uses AliasAnalysis pulls in this file... void BasicAAStub() {} - namespace { struct BasicAliasAnalysis : public ImmutablePass, public AliasAnalysis { @@ -60,8 +61,6 @@ void BasicAliasAnalysis::initializePass() { InitializeAliasAnalysis(this); } - - // hasUniqueAddress - Return true if the specified value points to something // with a unique, discernable, address. static inline bool hasUniqueAddress(const Value *V) { @@ -364,3 +363,4 @@ BasicAliasAnalysis::CheckGEPInstructions(GetElementPtrInst *GEP1, unsigned G1S, return MayAlias; } +} // End llvm namespace diff --git a/llvm/lib/Analysis/CFGPrinter.cpp b/llvm/lib/Analysis/CFGPrinter.cpp index ac93d4c1ca0..bd11522c961 100644 --- a/llvm/lib/Analysis/CFGPrinter.cpp +++ b/llvm/lib/Analysis/CFGPrinter.cpp @@ -26,6 +26,8 @@ #include <sstream> #include <fstream> +namespace llvm { + /// CFGOnly flag - This is used to control whether or not the CFG graph printer /// prints out the contents of basic blocks or not. This is acceptable because /// this code is only really used for debugging purposes. @@ -112,9 +114,6 @@ namespace { "Print CFG of function to 'dot' file"); }; - - - /// 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 @@ -154,3 +153,5 @@ void Function::viewCFGOnly() const { viewCFG(); CFGOnly = false; } + +} // End llvm namespace diff --git a/llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp b/llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp index b4b2e48b4ef..66990fd9230 100644 --- a/llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp +++ b/llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp @@ -20,6 +20,8 @@ #include "Support/Debug.h" #include "DSCallSiteIterator.h" +namespace llvm { + namespace { Statistic<> MaxSCC("budatastructure", "Maximum SCC Size in Call Graph"); Statistic<> NumBUInlines("budatastructures", "Number of graphs inlined"); @@ -316,3 +318,4 @@ void BUDataStructures::calculateGraph(DSGraph &Graph) { //Graph.writeGraphToFile(std::cerr, "bu_" + F.getName()); } +} // End llvm namespace diff --git a/llvm/lib/Analysis/DataStructure/DSCallSiteIterator.h b/llvm/lib/Analysis/DataStructure/DSCallSiteIterator.h index 324111cffad..df9f36908ae 100644 --- a/llvm/lib/Analysis/DataStructure/DSCallSiteIterator.h +++ b/llvm/lib/Analysis/DataStructure/DSCallSiteIterator.h @@ -19,6 +19,8 @@ #include "llvm/Analysis/DSGraph.h" #include "llvm/Function.h" +namespace llvm { + struct DSCallSiteIterator { // FCs are the edges out of the current node are the call site targets... const std::vector<DSCallSite> *FCs; @@ -129,4 +131,6 @@ public: } }; +} // End llvm namespace + #endif diff --git a/llvm/lib/Analysis/DataStructure/DataStructure.cpp b/llvm/lib/Analysis/DataStructure/DataStructure.cpp index d53c7fa5d7b..9cf77ae1229 100644 --- a/llvm/lib/Analysis/DataStructure/DataStructure.cpp +++ b/llvm/lib/Analysis/DataStructure/DataStructure.cpp @@ -23,6 +23,8 @@ #include "Support/Timer.h" #include <algorithm> +namespace llvm { + namespace { Statistic<> NumFolds ("dsnode", "Number of nodes completely folded"); Statistic<> NumCallNodesMerged("dsnode", "Number of call nodes merged"); @@ -161,7 +163,6 @@ bool DSNode::isNodeCompletelyFolded() const { return getSize() == 1 && Ty == Type::VoidTy && isArray(); } - namespace { /// TypeElementWalker Class - Used for implementation of physical subtyping... /// @@ -252,7 +253,7 @@ namespace { } } }; -} +} // end anonymous namespace /// ElementTypesAreCompatible - Check to see if the specified types are /// "physically" compatible. If so, return true, else return false. We only @@ -1639,6 +1640,7 @@ void DSGraph::mergeInGlobalsGraph() { removeTriviallyDeadNodes(); } + /// computeNodeMapping - Given roots in two different DSGraphs, traverse the /// nodes reachable from the two graphs, computing the mapping of nodes from /// the first to the second graph. @@ -1669,3 +1671,4 @@ void DSGraph::computeNodeMapping(const DSNodeHandle &NH1, computeNodeMapping(N1->getLink(i), N2->getLink(N2Idx+i), NodeMap); } +} // End llvm namespace diff --git a/llvm/lib/Analysis/DataStructure/DataStructureAA.cpp b/llvm/lib/Analysis/DataStructure/DataStructureAA.cpp index 99773e3936e..4b55da7aa54 100644 --- a/llvm/lib/Analysis/DataStructure/DataStructureAA.cpp +++ b/llvm/lib/Analysis/DataStructure/DataStructureAA.cpp @@ -17,6 +17,8 @@ #include "llvm/Analysis/AliasAnalysis.h" #include "llvm/Module.h" +namespace llvm { + namespace { class DSAA : public Pass, public AliasAnalysis { TDDataStructures *TD; @@ -176,3 +178,5 @@ void DSAA::getMustAliases(Value *P, std::vector<Value*> &RetVals) { #endif return getAnalysis<AliasAnalysis>().getMustAliases(P, RetVals); } + +} // End llvm namespace diff --git a/llvm/lib/Analysis/DataStructure/DataStructureOpt.cpp b/llvm/lib/Analysis/DataStructure/DataStructureOpt.cpp index 0ca7d6bffc0..d037b52145e 100644 --- a/llvm/lib/Analysis/DataStructure/DataStructureOpt.cpp +++ b/llvm/lib/Analysis/DataStructure/DataStructureOpt.cpp @@ -18,6 +18,8 @@ #include "llvm/Constant.h" #include "Support/Statistic.h" +namespace llvm { + namespace { Statistic<> NumGlobalsConstanted("ds-opt", "Number of globals marked constant"); @@ -47,7 +49,6 @@ namespace { RegisterOpt<DSOpt> X("ds-opt", "DSA-based simple optimizations"); } - /// OptimizeGlobals - This method uses information taken from DSA to optimize /// global variables. /// @@ -96,3 +97,5 @@ bool DSOpt::OptimizeGlobals(Module &M) { } return Changed; } + +} // End llvm namespace diff --git a/llvm/lib/Analysis/DataStructure/DataStructureStats.cpp b/llvm/lib/Analysis/DataStructure/DataStructureStats.cpp index 8d2984845a2..3659c906973 100644 --- a/llvm/lib/Analysis/DataStructure/DataStructureStats.cpp +++ b/llvm/lib/Analysis/DataStructure/DataStructureStats.cpp @@ -19,6 +19,8 @@ #include "Support/Statistic.h" #include <vector> +namespace llvm { + namespace { Statistic<> TotalNumCallees("totalcallees", "Total number of callee functions at all indirect call sites"); @@ -139,3 +141,5 @@ bool DSGraphStats::runOnFunction(Function& F) { visit(F); return true; } + +} // End llvm namespace diff --git a/llvm/lib/Analysis/DataStructure/GraphChecker.cpp b/llvm/lib/Analysis/DataStructure/GraphChecker.cpp index b0164da322f..11ebc6920cb 100644 --- a/llvm/lib/Analysis/DataStructure/GraphChecker.cpp +++ b/llvm/lib/Analysis/DataStructure/GraphChecker.cpp @@ -29,6 +29,8 @@ #include "llvm/Value.h" #include <set> +namespace llvm { + namespace { enum DSPass { local, bu, td }; cl::opt<DSPass> @@ -193,3 +195,5 @@ void DSGC::verify(const DSGraph &G) { } } } + +} // End llvm namespace diff --git a/llvm/lib/Analysis/DataStructure/Local.cpp b/llvm/lib/Analysis/DataStructure/Local.cpp index 0aca21a437b..253cbf7a351 100644 --- a/llvm/lib/Analysis/DataStructure/Local.cpp +++ b/llvm/lib/Analysis/DataStructure/Local.cpp @@ -28,6 +28,8 @@ // #include "llvm/Module.h" +namespace llvm { + static RegisterAnalysis<LocalDataStructures> X("datastructure", "Local Data Structure Analysis"); @@ -41,8 +43,8 @@ namespace DS { return false; } } -using namespace DS; +using namespace DS; namespace { cl::opt<bool> @@ -144,6 +146,8 @@ namespace { }; } +using namespace DS; + //===----------------------------------------------------------------------===// // DSGraph constructor - Simply use the GraphBuilder to construct the local // graph. @@ -617,3 +621,5 @@ void LocalDataStructures::releaseMemory() { delete GlobalsGraph; GlobalsGraph = 0; } + +} // End llvm namespace diff --git a/llvm/lib/Analysis/DataStructure/Printer.cpp b/llvm/lib/Analysis/DataStructure/Printer.cpp index 95879795601..9902906e19a 100644 --- a/llvm/lib/Analysis/DataStructure/Printer.cpp +++ b/llvm/lib/Analysis/DataStructure/Printer.cpp @@ -23,6 +23,8 @@ #include <fstream> #include <sstream> +namespace llvm { + // OnlyPrintMain - The DataStructure printer exposes this option to allow // printing of only the graph for "main". // @@ -32,7 +34,6 @@ namespace { Statistic<> NumFoldedNodes ("dsnode", "Number of folded nodes (in final graph)"); } - void DSNode::dump() const { print(std::cerr, 0); } static std::string getCaption(const DSNode *N, const DSGraph *G) { @@ -280,3 +281,5 @@ void BUDataStructures::print(std::ostream &O, const Module *M) const { void TDDataStructures::print(std::ostream &O, const Module *M) const { printCollection(*this, O, M, "td."); } + +} // End llvm namespace diff --git a/llvm/lib/Analysis/DataStructure/Steensgaard.cpp b/llvm/lib/Analysis/DataStructure/Steensgaard.cpp index 8bf917f0483..d868d250f7b 100644 --- a/llvm/lib/Analysis/DataStructure/Steensgaard.cpp +++ b/llvm/lib/Analysis/DataStructure/Steensgaard.cpp @@ -20,6 +20,8 @@ #include "llvm/Module.h" #include "Support/Debug.h" +namespace llvm { + namespace { class Steens : public Pass, public AliasAnalysis { DSGraph *ResultGraph; @@ -76,7 +78,6 @@ namespace { RegisterAnalysisGroup<AliasAnalysis, Steens> Y; } - /// ResolveFunctionCall - Resolve the actual arguments of a call to function F /// with the specified call site descriptor. This function links the arguments /// and the return value for the call site context-insensitively. @@ -235,3 +236,5 @@ AliasAnalysis::AliasResult Steens::alias(const Value *V1, unsigned V1Size, // return getAnalysis<AliasAnalysis>().alias(V1, V1Size, V2, V2Size); } + +} // End llvm namespace diff --git a/llvm/lib/Analysis/DataStructure/TopDownClosure.cpp b/llvm/lib/Analysis/DataStructure/TopDownClosure.cpp index ad5a9d72203..696368a866e 100644 --- a/llvm/lib/Analysis/DataStructure/TopDownClosure.cpp +++ b/llvm/lib/Analysis/DataStructure/TopDownClosure.cpp @@ -21,6 +21,8 @@ #include "Support/Debug.h" #include "Support/Statistic.h" +namespace llvm { + namespace { RegisterAnalysis<TDDataStructures> // Register the pass Y("tddatastructure", "Top-down Data Structure Analysis"); @@ -310,3 +312,4 @@ void TDDataStructures::inlineGraphIntoCallees(DSGraph &Graph) { << Graph.getFunctionCalls().size() << "]\n"); } +} // End llvm namespace diff --git a/llvm/lib/Analysis/Expressions.cpp b/llvm/lib/Analysis/Expressions.cpp index 4d8897e7fff..b3163904697 100644 --- a/llvm/lib/Analysis/Expressions.cpp +++ b/llvm/lib/Analysis/Expressions.cpp @@ -18,6 +18,8 @@ #include "llvm/ConstantHandling.h" #include "llvm/Function.h" +namespace llvm { + ExprType::ExprType(Value *Val) { if (Val) if (ConstantInt *CPI = dyn_cast<ConstantInt>(Val)) { @@ -352,3 +354,5 @@ ExprType ClassifyExpression(Value *Expr) { // Otherwise, I don't know anything about this value! return I; } + +} // End llvm namespace diff --git a/llvm/lib/Analysis/IPA/CallGraph.cpp b/llvm/lib/Analysis/IPA/CallGraph.cpp index 8d442420500..506198c4fa2 100644 --- a/llvm/lib/Analysis/IPA/CallGraph.cpp +++ b/llvm/lib/Analysis/IPA/CallGraph.cpp @@ -53,6 +53,8 @@ #include "llvm/Support/CallSite.h" #include "Support/STLExtras.h" +namespace llvm { + static RegisterAnalysis<CallGraph> X("callgraph", "Call Graph Construction"); static const char * const KnownExternalFunctions[] = { @@ -349,3 +351,5 @@ Function *CallGraph::removeFunctionFromModule(CallGraphNode *CGN) { } void CallGraph::stub() {} + +} // End llvm namespace diff --git a/llvm/lib/Analysis/IPA/CallGraphSCCPass.cpp b/llvm/lib/Analysis/IPA/CallGraphSCCPass.cpp index 74da70131e8..e9ab6500c8d 100644 --- a/llvm/lib/Analysis/IPA/CallGraphSCCPass.cpp +++ b/llvm/lib/Analysis/IPA/CallGraphSCCPass.cpp @@ -19,6 +19,8 @@ #include "llvm/Analysis/CallGraph.h" #include "Support/SCCIterator.h" +namespace llvm { + /// getAnalysisUsage - For this class, we declare that we require and preserve /// the call graph. If the derived class implements this method, it should /// always explicitly call the implementation here. @@ -35,3 +37,5 @@ bool CallGraphSCCPass::run(Module &M) { Changed = runOnSCC(*I); return Changed; } + +} // End llvm namespace diff --git a/llvm/lib/Analysis/IPA/DependenceGraph.cpp b/llvm/lib/Analysis/IPA/DependenceGraph.cpp index ead777aa133..7d62ef0350c 100644 --- a/llvm/lib/Analysis/IPA/DependenceGraph.cpp +++ b/llvm/lib/Analysis/IPA/DependenceGraph.cpp @@ -24,6 +24,7 @@ #include "llvm/Analysis/DependenceGraph.h" #include "llvm/Function.h" +namespace llvm { //---------------------------------------------------------------------------- // class Dependence: @@ -82,3 +83,5 @@ void DependenceGraph::print(const Function& func, std::ostream &O) const if (const DepGraphNode* dgNode = this->getNode(*II)) dgNode->print(O); } + +} // End llvm namespace diff --git a/llvm/lib/Analysis/IPA/FindUnsafePointerTypes.cpp b/llvm/lib/Analysis/IPA/FindUnsafePointerTypes.cpp index 7eeff7dbc7b..45f5b72ecf9 100644 --- a/llvm/lib/Analysis/IPA/FindUnsafePointerTypes.cpp +++ b/llvm/lib/Analysis/IPA/FindUnsafePointerTypes.cpp @@ -30,6 +30,8 @@ #include "llvm/Support/InstIterator.h" #include "Support/CommandLine.h" +namespace llvm { + static RegisterAnalysis<FindUnsafePointerTypes> X("unsafepointertypes", "Find Unsafe Pointer Types"); @@ -99,3 +101,5 @@ void FindUnsafePointerTypes::print(std::ostream &o, const Module *M) const { CW << " #" << Counter << ". " << (Value*)*I << "\n"; } } + +} // End llvm namespace diff --git a/llvm/lib/Analysis/IPA/FindUsedTypes.cpp b/llvm/lib/Analysis/IPA/FindUsedTypes.cpp index 80bf378b5eb..e930499e2e2 100644 --- a/llvm/lib/Analysis/IPA/FindUsedTypes.cpp +++ b/llvm/lib/Analysis/IPA/FindUsedTypes.cpp @@ -21,6 +21,8 @@ #include "llvm/Assembly/CachedWriter.h" #include "llvm/Support/InstIterator.h" +namespace llvm { + static RegisterAnalysis<FindUsedTypes> X("printusedtypes", "Find Used Types"); @@ -106,3 +108,5 @@ void FindUsedTypes::print(std::ostream &o, const Module *M) const { E = UsedTypes.end(); I != E; ++I) o << " " << *I << "\n"; } + +} // End llvm namespace diff --git a/llvm/lib/Analysis/IPA/IPModRef.cpp b/llvm/lib/Analysis/IPA/IPModRef.cpp index 64b60d48ba2..01b5bd0023a 100644 --- a/llvm/lib/Analysis/IPA/IPModRef.cpp +++ b/llvm/lib/Analysis/IPA/IPModRef.cpp @@ -23,6 +23,8 @@ #include "Support/StringExtras.h" #include <vector> +namespace llvm { + //---------------------------------------------------------------------------- // Private constants and data //---------------------------------------------------------------------------- @@ -441,3 +443,5 @@ void IPModRef::dump() const { print(std::cerr); } + +} // End llvm namespace diff --git a/llvm/lib/Analysis/IPA/MemoryDepAnalysis.cpp b/llvm/lib/Analysis/IPA/MemoryDepAnalysis.cpp index 076836a5cea..e61c076f307 100644 --- a/llvm/lib/Analysis/IPA/MemoryDepAnalysis.cpp +++ b/llvm/lib/Analysis/IPA/MemoryDepAnalysis.cpp @@ -31,6 +31,7 @@ #include "Support/hash_map" #include "Support/hash_set" +namespace llvm { ///-------------------------------------------------------------------------- /// struct ModRefTable: @@ -122,7 +123,7 @@ struct ModRefTable { class ModRefInfoBuilder : public InstVisitor<ModRefInfoBuilder> { const DSGraph& funcGraph; const FunctionModRefInfo& funcModRef; - ModRefTable& modRefTable; + struct ModRefTable& modRefTable; ModRefInfoBuilder(); // DO NOT IMPLEMENT ModRefInfoBuilder(const ModRefInfoBuilder&); // DO NOT IMPLEMENT @@ -498,3 +499,5 @@ void MemoryDepAnalysis::dump() const static RegisterAnalysis<MemoryDepAnalysis> Z("memdep", "Memory Dependence Analysis"); + +} // End llvm namespace diff --git a/llvm/lib/Analysis/IPA/PgmDependenceGraph.cpp b/llvm/lib/Analysis/IPA/PgmDependenceGraph.cpp index ef44cb3efbd..b861c899478 100644 --- a/llvm/lib/Analysis/IPA/PgmDependenceGraph.cpp +++ b/llvm/lib/Analysis/IPA/PgmDependenceGraph.cpp @@ -30,6 +30,7 @@ #include "llvm/Analysis/PostDominators.h" #include "llvm/Function.h" +namespace llvm { //---------------------------------------------------------------------------- // class DepIterState @@ -253,3 +254,5 @@ void PgmDependenceGraph::dump() const static RegisterAnalysis<PgmDependenceGraph> Z("pgmdep", "Enumerate Program Dependence Graph (data and control)"); + +} // End llvm namespace diff --git a/llvm/lib/Analysis/InductionVariable.cpp b/llvm/lib/Analysis/InductionVariable.cpp index 3119d31ded6..6e9a209b7e1 100644 --- a/llvm/lib/Analysis/InductionVariable.cpp +++ b/llvm/lib/Analysis/InductionVariable.cpp @@ -36,6 +36,8 @@ #include "llvm/Assembly/Writer.h" #include "Support/Debug.h" +namespace llvm { + static bool isLoopInvariant(const Value *V, const Loop *L) { if (const Instruction *I = dyn_cast<Instruction>(V)) return !L->contains(I->getParent()); @@ -299,3 +301,5 @@ void InductionVariable::print(std::ostream &o) const { } o << "\n"; } + +} // End llvm namespace diff --git a/llvm/lib/Analysis/InstCount.cpp b/llvm/lib/Analysis/InstCount.cpp index 4d49478a9e6..9177e448000 100644 --- a/llvm/lib/Analysis/InstCount.cpp +++ b/llvm/lib/Analysis/InstCount.cpp @@ -16,6 +16,8 @@ #include "llvm/Support/InstVisitor.h" #include "Support/Statistic.h" +namespace llvm { + namespace { Statistic<> TotalInsts ("instcount", "Number of instructions (of all types)"); Statistic<> TotalBlocks("instcount", "Number of basic blocks"); @@ -62,3 +64,5 @@ bool InstCount::runOnFunction(Function &F) { visit(F); return false; } + +} // End llvm namespace diff --git a/llvm/lib/Analysis/Interval.cpp b/llvm/lib/Analysis/Interval.cpp index 28cee836312..8f0bdfa0034 100644 --- a/llvm/lib/Analysis/Interval.cpp +++ b/llvm/lib/Analysis/Interval.cpp @@ -17,6 +17,8 @@ #include "llvm/Support/CFG.h" #include <algorithm> +using namespace llvm; + //===----------------------------------------------------------------------===// // Interval Implementation //===----------------------------------------------------------------------===// diff --git a/llvm/lib/Analysis/IntervalPartition.cpp b/llvm/lib/Analysis/IntervalPartition.cpp index 27299309984..12c196f2f70 100644 --- a/llvm/lib/Analysis/IntervalPartition.cpp +++ b/llvm/lib/Analysis/IntervalPartition.cpp @@ -15,6 +15,8 @@ #include "llvm/Analysis/IntervalIterator.h" #include "Support/STLExtras.h" +namespace llvm { + static RegisterAnalysis<IntervalPartition> X("intervals", "Interval Partition Construction", true); @@ -108,3 +110,5 @@ IntervalPartition::IntervalPartition(IntervalPartition &IP, bool) { for_each(Intervals.begin(), Intervals.end(), bind_obj(this, &IntervalPartition::updatePredecessors)); } + +} // End llvm namespace diff --git a/llvm/lib/Analysis/LiveVar/BBLiveVar.cpp b/llvm/lib/Analysis/LiveVar/BBLiveVar.cpp index 68eaebf7d27..758f1b1539d 100644 --- a/llvm/lib/Analysis/LiveVar/BBLiveVar.cpp +++ b/llvm/lib/Analysis/LiveVar/BBLiveVar.cpp @@ -21,6 +21,7 @@ /// BROKEN: Should not include sparc stuff directly into here #include "../../Target/Sparc/SparcInternals.h" // Only for PHI defn +namespace llvm { BBLiveVar::BBLiveVar(const BasicBlock &bb, MachineBasicBlock &mbb, unsigned id) : BB(bb), MBB(mbb), POID(id) { @@ -229,6 +230,4 @@ void BBLiveVar::printInOutSets() const { std::cerr << " Out: "; printSet(OutSet); std::cerr << "\n"; } - - - +} // End llvm namespace diff --git a/llvm/lib/Analysis/LiveVar/BBLiveVar.h b/llvm/lib/Analysis/LiveVar/BBLiveVar.h index 33a4faf2b10..781143a93df 100644 --- a/llvm/lib/Analysis/LiveVar/BBLiveVar.h +++ b/llvm/lib/Analysis/LiveVar/BBLiveVar.h @@ -17,6 +17,9 @@ #include "llvm/CodeGen/ValueSet.h" #include "Support/hash_map" + +namespace llvm { + class BasicBlock; class Value; class MachineBasicBlock; @@ -82,4 +85,6 @@ public: void printInOutSets() const; // for printing In/Out sets }; +} // End llvm namespace + #endif diff --git a/llvm/lib/Analysis/LiveVar/FunctionLiveVarInfo.cpp b/llvm/lib/Analysis/LiveVar/FunctionLiveVarInfo.cpp index 588ec646da7..8f0e31811a9 100644 --- a/llvm/lib/Analysis/LiveVar/FunctionLiveVarInfo.cpp +++ b/llvm/lib/Analysis/LiveVar/FunctionLiveVarInfo.cpp @@ -23,6 +23,8 @@ #include "Support/CommandLine.h" #include "BBLiveVar.h" +namespace llvm { + static RegisterAnalysis<FunctionLiveVarInfo> X("livevar", "Live Variable Analysis"); @@ -318,3 +320,5 @@ void FunctionLiveVarInfo::calcLiveVarSetsForBB(const BasicBlock *BB) { SetAI = NewSet; } } + +} // End llvm namespace diff --git a/llvm/lib/Analysis/LiveVar/ValueSet.cpp b/llvm/lib/Analysis/LiveVar/ValueSet.cpp index ba944cb8cc0..fd8289675a2 100644 --- a/llvm/lib/Analysis/LiveVar/ValueSet.cpp +++ b/llvm/lib/Analysis/LiveVar/ValueSet.cpp @@ -11,6 +11,8 @@ #include "llvm/Value.h" #include <iostream> +namespace llvm { + std::ostream &operator<<(std::ostream &O, RAV V) { // func to print a Value const Value &v = V.V; if (v.hasName()) @@ -26,3 +28,4 @@ void printSet(const ValueSet &S) { std::cerr << RAV(*I); } +} // End llvm namespace diff --git a/llvm/lib/Analysis/LoadValueNumbering.cpp b/llvm/lib/Analysis/LoadValueNumbering.cpp index cbcdd0f178a..2d263794175 100644 --- a/llvm/lib/Analysis/LoadValueNumbering.cpp +++ b/llvm/lib/Analysis/LoadValueNumbering.cpp @@ -31,6 +31,8 @@ #include <algorithm> #include <set> +namespace llvm { + namespace { // FIXME: This should not be a FunctionPass. struct LoadVN : public FunctionPass, public ValueNumbering { @@ -70,8 +72,6 @@ namespace { RegisterAnalysisGroup<ValueNumbering, LoadVN> Y; } - - Pass *createLoadValueNumberingPass() { return new LoadVN(); } @@ -340,3 +340,5 @@ bool LoadVN::haveEqualValueNumber(LoadInst *Load, StoreInst *Store, return true; } } + +} // End llvm namespace diff --git a/llvm/lib/Analysis/LoopInfo.cpp b/llvm/lib/Analysis/LoopInfo.cpp index c1f97889e61..68e7d2f845d 100644 --- a/llvm/lib/Analysis/LoopInfo.cpp +++ b/llvm/lib/Analysis/LoopInfo.cpp @@ -21,6 +21,8 @@ #include "Support/DepthFirstIterator.h" #include <algorithm> +namespace llvm { + static RegisterAnalysis<LoopInfo> X("loops", "Natural Loop Construction", true); @@ -367,3 +369,5 @@ void Loop::changeExitBlock(BasicBlock *Old, BasicBlock *New) { I = std::find(I+1, ExitBlocks.end(), Old); } } + +} // End llvm namespace diff --git a/llvm/lib/Analysis/PostDominators.cpp b/llvm/lib/Analysis/PostDominators.cpp index ee31c36b3e3..2589c857739 100644 --- a/llvm/lib/Analysis/PostDominators.cpp +++ b/llvm/lib/Analysis/PostDominators.cpp @@ -17,6 +17,8 @@ #include "Support/DepthFirstIterator.h" #include "Support/SetOperations.h" +namespace llvm { + //===----------------------------------------------------------------------===// // PostDominatorSet Implementation //===----------------------------------------------------------------------===// @@ -214,3 +216,5 @@ PostDominanceFrontier::calculate(const PostDominatorTree &DT, // stub - a dummy function to make linking work ok. void PostDominanceFrontier::stub() { } + +} // End llvm namespace diff --git a/llvm/lib/Analysis/PrintSCC.cpp b/llvm/lib/Analysis/PrintSCC.cpp index 34593811587..ce89fff90e6 100644 --- a/llvm/lib/Analysis/PrintSCC.cpp +++ b/llvm/lib/Analysis/PrintSCC.cpp @@ -31,6 +31,8 @@ #include "llvm/Support/CFG.h" #include "Support/SCCIterator.h" +namespace llvm { + namespace { struct CFGSCC : public FunctionPass { bool runOnFunction(Function& func); @@ -101,3 +103,5 @@ bool CallGraphSCC::run(Module &M) { return true; } + +} // End llvm namespace diff --git a/llvm/lib/Analysis/ValueNumbering.cpp b/llvm/lib/Analysis/ValueNumbering.cpp index 075c1c2b3f8..191e190e20e 100644 --- a/llvm/lib/Analysis/ValueNumbering.cpp +++ b/llvm/lib/Analysis/ValueNumbering.cpp @@ -19,6 +19,8 @@ #include "llvm/Type.h" #include "llvm/iMemory.h" +namespace llvm { + // Register the ValueNumbering interface, providing a nice name to refer to. static RegisterAnalysisGroup<ValueNumbering> X("Value Numbering"); @@ -39,6 +41,7 @@ ValueNumbering::~ValueNumbering() {} // into the tool that uses it. As such, we register and implement the class // here. // + namespace { /// BasicVN - This class is the default implementation of the ValueNumbering /// interface. It walks the SSA def-use chains to trivially identify @@ -62,9 +65,7 @@ namespace { // Declare that we implement the ValueNumbering interface RegisterAnalysisGroup<ValueNumbering, BasicVN, true> Y; -} // End of anonymous namespace -namespace { /// BVNImpl - Implement BasicVN in terms of a visitor class that /// handles the different types of instructions as appropriate. /// @@ -190,3 +191,5 @@ void BVNImpl::visitGetElementPtrInst(GetElementPtrInst &I) { RetVals.push_back(Other); } } + +} // End llvm namespace diff --git a/llvm/lib/AsmParser/Lexer.l b/llvm/lib/AsmParser/Lexer.l index 6466cb721b7..b0e174af50f 100644 --- a/llvm/lib/AsmParser/Lexer.l +++ b/llvm/lib/AsmParser/Lexer.l @@ -35,6 +35,7 @@ #define RET_TOK(type, Enum, sym) \ llvmAsmlval.type = Instruction::Enum; return sym +namespace llvm { // TODO: All of the static identifiers are figured out by the lexer, // these should be hashed to reduce the lexer size @@ -121,6 +122,10 @@ char *UnEscapeLexed(char *Buffer, bool AllowNull) { return BOut; } +} // End llvm namespace + +using namespace llvm; + #define YY_NEVER_INTERACTIVE 1 %} diff --git a/llvm/lib/AsmParser/Parser.cpp b/llvm/lib/AsmParser/Parser.cpp index e8a7bdbbb98..2d6185efeb0 100644 --- a/llvm/lib/AsmParser/Parser.cpp +++ b/llvm/lib/AsmParser/Parser.cpp @@ -15,6 +15,8 @@ #include "llvm/Module.h" #include "llvm/Analysis/Verifier.h" +namespace llvm { + // The useful interface defined by this file... Parse an ASCII file, and return // the internal representation in a nice slice'n'dice'able representation. // @@ -82,3 +84,5 @@ const std::string ParseException::getMessage() const { return Result + ": " + Message; } + +} // End llvm namespace diff --git a/llvm/lib/AsmParser/ParserInternals.h b/llvm/lib/AsmParser/ParserInternals.h index c7837959e61..c18434d1f07 100644 --- a/llvm/lib/AsmParser/ParserInternals.h +++ b/llvm/lib/AsmParser/ParserInternals.h @@ -22,18 +22,22 @@ #include "llvm/Assembly/Parser.h" #include "Support/StringExtras.h" -class Module; - // Global variables exported from the lexer... extern std::FILE *llvmAsmin; extern int llvmAsmlineno; // Globals exported by the parser... +extern char* llvmAsmtext; +extern int llvmAsmleng; + +namespace llvm { + +// Globals exported by the parser... extern std::string CurFilename; + +class Module; Module *RunVMAsmParser(const std::string &Filename, FILE *F); -extern char* llvmAsmtext; -extern int llvmAsmleng; // UnEscapeLexed - Run through the specified buffer and change \xx codes to the // appropriate character. If AllowNull is set to false, a \00 value will cause @@ -209,4 +213,6 @@ static inline int getLineNumFromPlaceHolder(const Value *Val) { } } +} // End llvm namespace + #endif diff --git a/llvm/lib/AsmParser/llvmAsmParser.y b/llvm/lib/AsmParser/llvmAsmParser.y index 96d2daeec4b..a55e735ca49 100644 --- a/llvm/lib/AsmParser/llvmAsmParser.y +++ b/llvm/lib/AsmParser/llvmAsmParser.y @@ -29,6 +29,8 @@ int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit int yylex(); // declaration" of xxx warnings. int yyparse(); +namespace llvm { + static Module *ParserResult; std::string CurFilename; @@ -686,30 +688,34 @@ Module *RunVMAsmParser(const std::string &Filename, FILE *F) { return Result; } +} // End llvm namespace + +using namespace llvm; + %} %union { - Module *ModuleVal; - Function *FunctionVal; - std::pair<PATypeHolder*, char*> *ArgVal; - BasicBlock *BasicBlockVal; - TerminatorInst *TermInstVal; - Instruction *InstVal; - Constant *ConstVal; - - const Type *PrimType; - PATypeHolder *TypeVal; - Value *ValueVal; - - std::vector<std::pair<PATypeHolder*,char*> > *ArgList; - std::vector<Value*> *ValueList; - std::list<PATypeHolder> *TypeList; - std::list<std::pair<Value*, - BasicBlock*> > *PHIList; // Represent the RHS of PHI node - std::vector<std::pair<Constant*, BasicBlock*> > *JumpTable; - std::vector<Constant*> *ConstVector; - - GlobalValue::LinkageTypes Linkage; + llvm::Module *ModuleVal; + llvm::Function *FunctionVal; + std::pair<llvm::PATypeHolder*, char*> *ArgVal; + llvm::BasicBlock *BasicBlockVal; + llvm::TerminatorInst *TermInstVal; + llvm::Instruction *InstVal; + llvm::Constant *ConstVal; + + const llvm::Type *PrimType; + llvm::PATypeHolder *TypeVal; + llvm::Value *ValueVal; + + std::vector<std::pair<llvm::PATypeHolder*,char*> > *ArgList; + std::vector<llvm::Value*> *ValueList; + std::list<llvm::PATypeHolder> *TypeList; + std::list<std::pair<llvm::Value*, + llvm::BasicBlock*> > *PHIList; // Represent the RHS of PHI node + std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable; + std::vector<llvm::Constant*> *ConstVector; + + llvm::GlobalValue::LinkageTypes Linkage; int64_t SInt64Val; uint64_t UInt64Val; int SIntVal; @@ -718,13 +724,13 @@ Module *RunVMAsmParser(const std::string &Filename, FILE *F) { bool BoolVal; char *StrVal; // This memory is strdup'd! - ValID ValIDVal; // strdup'd memory maybe! + llvm::ValID ValIDVal; // strdup'd memory maybe! - Instruction::BinaryOps BinaryOpVal; - Instruction::TermOps TermOpVal; - Instruction::MemoryOps MemOpVal; - Instruction::OtherOps OtherOpVal; - Module::Endianness Endianness; + llvm::Instruction::BinaryOps BinaryOpVal; + llvm::Instruction::TermOps TermOpVal; + llvm::Instruction::MemoryOps MemOpVal; + llvm::Instruction::OtherOps OtherOpVal; + llvm::Module::Endianness Endianness; } %type <ModuleVal> Module FunctionList @@ -1892,6 +1898,7 @@ MemoryInst : MALLOC Types { delete $2; delete $4; }; + %% int yyerror(const char *ErrorMsg) { std::string where diff --git a/llvm/lib/Bytecode/Reader/ArchiveReader.cpp b/llvm/lib/Bytecode/Reader/ArchiveReader.cpp index d155b69beec..33ae24b60ea 100644 --- a/llvm/lib/Bytecode/Reader/ArchiveReader.cpp +++ b/llvm/lib/Bytecode/Reader/ArchiveReader.cpp @@ -22,6 +22,8 @@ #include "Config/sys/mman.h" #include "Config/fcntl.h" +namespace llvm { + namespace { struct ar_hdr { char name[16]; @@ -40,7 +42,6 @@ namespace { }; } - // getObjectType - Determine the type of object that this header represents. // This is capable of parsing the variety of special sections used for various // purposes. @@ -173,3 +174,5 @@ bool ReadArchiveFile(const std::string &Filename, std::vector<Module*> &Objects, return Result; } + +} // End llvm namespace diff --git a/llvm/lib/Bytecode/Reader/ConstantReader.cpp b/llvm/lib/Bytecode/Reader/ConstantReader.cpp index 00f44b3665e..b4553548e8e 100644 --- a/llvm/lib/Bytecode/Reader/ConstantReader.cpp +++ b/llvm/lib/Bytecode/Reader/ConstantReader.cpp @@ -20,6 +20,8 @@ #include "llvm/Constants.h" #include <algorithm> +namespace llvm { + const Type *BytecodeParser::parseTypeConstant(const unsigned char *&Buf, const unsigned char *EndBuf) { unsigned PrimType; @@ -356,3 +358,5 @@ void BytecodeParser::ParseConstantPool(const unsigned char *&Buf, if (Buf > EndBuf) throw std::string("Read past end of buffer."); } + +} // End llvm namespace diff --git a/llvm/lib/Bytecode/Reader/InstructionReader.cpp b/llvm/lib/Bytecode/Reader/InstructionReader.cpp index a409ceebef9..ec8944e7a87 100644 --- a/llvm/lib/Bytecode/Reader/InstructionReader.cpp +++ b/llvm/lib/Bytecode/Reader/InstructionReader.cpp @@ -22,6 +22,8 @@ #include "llvm/iOther.h" #include "llvm/Module.h" +namespace llvm { + namespace { struct RawInst { // The raw fields out of the bytecode stream... unsigned NumOperands; @@ -33,8 +35,6 @@ namespace { }; } - - RawInst::RawInst(const unsigned char *&Buf, const unsigned char *EndBuf, std::vector<unsigned> &Args) { unsigned Op, Typ; @@ -389,3 +389,5 @@ void BytecodeParser::ParseInstruction(const unsigned char *&Buf, BB->getInstList().push_back(Result); BCR_TRACE(4, *Result); } + +} // End llvm namespace diff --git a/llvm/lib/Bytecode/Reader/Reader.cpp b/llvm/lib/Bytecode/Reader/Reader.cpp index a36ea7a7348..9acb93d48a6 100644 --- a/llvm/lib/Bytecode/Reader/Reader.cpp +++ b/llvm/lib/Bytecode/Reader/Reader.cpp @@ -32,6 +32,8 @@ #include <algorithm> #include <memory> +namespace llvm { + static inline void ALIGN32(const unsigned char *&begin, const unsigned char *end) { if (align32(begin, end)) @@ -693,3 +695,5 @@ void BytecodeParser::ParseBytecode(const unsigned char *Buf, unsigned Length, throw; } } + +} // End llvm namespace diff --git a/llvm/lib/Bytecode/Reader/ReaderInternals.h b/llvm/lib/Bytecode/Reader/ReaderInternals.h index c8905454e67..81ccde97fff 100644 --- a/llvm/lib/Bytecode/Reader/ReaderInternals.h +++ b/llvm/lib/Bytecode/Reader/ReaderInternals.h @@ -22,6 +22,8 @@ #include <utility> #include <map> +namespace llvm { + // Enable to trace to figure out what the heck is going on when parsing fails //#define TRACE_LEVEL 10 //#define DEBUG_OUTPUT @@ -226,4 +228,6 @@ static inline void readBlock(const unsigned char *&Buf, #endif } +} // End llvm namespace + #endif diff --git a/llvm/lib/Bytecode/Reader/ReaderWrappers.cpp b/llvm/lib/Bytecode/Reader/ReaderWrappers.cpp index 0df6ea5ff23..1cbead02e85 100644 --- a/llvm/lib/Bytecode/Reader/ReaderWrappers.cpp +++ b/llvm/lib/Bytecode/Reader/ReaderWrappers.cpp @@ -21,6 +21,8 @@ #include "Config/unistd.h" #include "Config/sys/mman.h" +namespace llvm { + //===----------------------------------------------------------------------===// // BytecodeFileReader - Read from an mmap'able file descriptor. // @@ -163,7 +165,7 @@ BytecodeStdinReader::BytecodeStdinReader() { unsigned char Buffer[4096*4]; // Read in all of the data from stdin, we cannot mmap stdin... - while ((BlockSize = read(0 /*stdin*/, Buffer, 4096*4))) { + while ((BlockSize = ::read(0 /*stdin*/, Buffer, 4096*4))) { if (BlockSize == -1) throw std::string("Error reading from stdin!"); @@ -249,7 +251,6 @@ static ModuleProvider *CheckVarargs(ModuleProvider *MP) { return MP; } - //===----------------------------------------------------------------------===// // Wrapper functions //===----------------------------------------------------------------------===// @@ -296,3 +297,5 @@ Module *ParseBytecodeFile(const std::string &Filename, std::string *ErrorStr) { return 0; } } + +} // End llvm namespace diff --git a/llvm/lib/Bytecode/Writer/ConstantWriter.cpp b/llvm/lib/Bytecode/Writer/ConstantWriter.cpp index a9aaffe3eca..303672d166f 100644 --- a/llvm/lib/Bytecode/Writer/ConstantWriter.cpp +++ b/llvm/lib/Bytecode/Writer/ConstantWriter.cpp @@ -17,6 +17,8 @@ #include "llvm/SymbolTable.h" #include "llvm/DerivedTypes.h" +namespace llvm { + void BytecodeWriter::outputType(const Type *T) { output_vbr((unsigned)T->getPrimitiveID(), Out); @@ -202,3 +204,5 @@ bool BytecodeWriter::outputConstant(const Constant *CPV) { } return false; } + +} // End llvm namespace diff --git a/llvm/lib/Bytecode/Writer/InstructionWriter.cpp b/llvm/lib/Bytecode/Writer/InstructionWriter.cpp index faa576ecb46..d52f24145f4 100644 --- a/llvm/lib/Bytecode/Writer/InstructionWriter.cpp +++ b/llvm/lib/Bytecode/Writer/InstructionWriter.cpp @@ -19,6 +19,8 @@ #include "Support/Statistic.h" #include <algorithm> +namespace llvm { + static Statistic<> NumInstrs("bytecodewriter", "Number of instructions"); @@ -295,3 +297,5 @@ void BytecodeWriter::processInstruction(const Instruction &I) { // operands or a large operand index that we are referring to. outputInstructionFormat0(&I, Opcode, Table, Type, Out); } + +} // End llvm namespace diff --git a/llvm/lib/Bytecode/Writer/Writer.cpp b/llvm/lib/Bytecode/Writer/Writer.cpp index 9381e355f0e..9c9e1abcdd8 100644 --- a/llvm/lib/Bytecode/Writer/Writer.cpp +++ b/llvm/lib/Bytecode/Writer/Writer.cpp @@ -36,6 +36,8 @@ #include "Config/string.h" #include <algorithm> +namespace llvm { + static RegisterPass<WriteBytecodePass> X("emitbytecode", "Bytecode Writer"); static Statistic<> @@ -304,3 +306,5 @@ void WriteBytecodeToFile(const Module *C, std::ostream &Out) { Out.flush(); } + +} // End llvm namespace diff --git a/llvm/lib/Bytecode/Writer/WriterInternals.h b/llvm/lib/Bytecode/Writer/WriterInternals.h index 5564f4238ec..8cb4bfd8d6c 100644 --- a/llvm/lib/Bytecode/Writer/WriterInternals.h +++ b/llvm/lib/Bytecode/Writer/WriterInternals.h @@ -25,6 +25,8 @@ #include "llvm/SlotCalculator.h" #include "llvm/Instruction.h" +namespace llvm { + class BytecodeWriter { std::deque<unsigned char> &Out; SlotCalculator Table; @@ -79,5 +81,6 @@ public: } }; +} // End llvm namespace #endif diff --git a/llvm/lib/CWriter/Writer.cpp b/llvm/lib/CWriter/Writer.cpp index 258c2878787..bac088abf7f 100644 --- a/llvm/lib/CWriter/Writer.cpp +++ b/llvm/lib/CWriter/Writer.cpp @@ -31,6 +31,8 @@ #include <algorithm> #include <sstream> +namespace llvm { + namespace { class CWriter : public Pass, public InstVisitor<CWriter> { std::ostream &Out; @@ -161,7 +163,6 @@ namespace { void printIndexingExpression(Value *Ptr, User::op_iterator I, User::op_iterator E); }; -} // Pass the Type* and the variable name and this prints out the variable // declaration. @@ -339,7 +340,7 @@ void CWriter::printConstantArray(ConstantArray *CPA) { // compiler agreeing on the conversion process (which is pretty likely since we // only deal in IEEE FP). // -static bool isFPCSafeToPrint(const ConstantFP *CFP) { +bool isFPCSafeToPrint(const ConstantFP *CFP) { #if HAVE_PRINTF_A char Buffer[100]; sprintf(Buffer, "%a", CFP->getValue()); @@ -563,7 +564,7 @@ bool CWriter::nameAllUsedStructureTypes(Module &M) { // generateCompilerSpecificCode - This is where we add conditional compilation // directives to cater to specific compilers as need be. // -static void generateCompilerSpecificCode(std::ostream& Out) { +void generateCompilerSpecificCode(std::ostream& Out) { // Alloca is hard to get, and we don't want to include stdlib.h here... Out << "/* get a declaration for alloca */\n" << "#ifdef sun\n" @@ -1058,7 +1059,7 @@ void CWriter::visitUnwindInst(UnwindInst &I) { emittedInvoke = true; } -static bool isGotoCodeNecessary(BasicBlock *From, BasicBlock *To) { +bool isGotoCodeNecessary(BasicBlock *From, BasicBlock *To) { // If PHI nodes need copies, we need the copy code... if (isa<PHINode>(To->front()) || From->getNext() != To) // Not directly successor, need goto @@ -1195,10 +1196,10 @@ void CWriter::visitCastInst(CastInst &I) { void CWriter::visitCallInst(CallInst &I) { // Handle intrinsic function calls first... if (Function *F = I.getCalledFunction()) - if (LLVMIntrinsic::ID ID = (LLVMIntrinsic::ID)F->getIntrinsicID()) { + if (Intrinsic::ID ID = (Intrinsic::ID)F->getIntrinsicID()) { switch (ID) { default: assert(0 && "Unknown LLVM intrinsic!"); - case LLVMIntrinsic::va_start: + case Intrinsic::va_start: Out << "0; "; Out << "va_start(*(va_list*)&" << Mang->getValueName(&I) << ", "; @@ -1212,28 +1213,28 @@ void CWriter::visitCallInst(CallInst &I) { writeOperand(&I.getParent()->getParent()->aback()); Out << ")"; return; - case LLVMIntrinsic::va_end: + case Intrinsic::va_end: Out << "va_end(*(va_list*)&"; writeOperand(I.getOperand(1)); Out << ")"; return; - case LLVMIntrinsic::va_copy: + case Intrinsic::va_copy: Out << "0;"; Out << "va_copy(*(va_list*)&" << Mang->getValueName(&I) << ", "; Out << "*(va_list*)&"; writeOperand(I.getOperand(1)); Out << ")"; return; - case LLVMIntrinsic::setjmp: - case LLVMIntrinsic::sigsetjmp: + case Intrinsic::setjmp: + case Intrinsic::sigsetjmp: // This intrinsic should never exist in the program, but until we get // setjmp/longjmp transformations going on, we should codegen it to // something reasonable. This will allow code that never calls longjmp // to work. Out << "0"; return; - case LLVMIntrinsic::longjmp: - case LLVMIntrinsic::siglongjmp: + case Intrinsic::longjmp: + case Intrinsic::siglongjmp: // Longjmp is not implemented, and never will be. It would cause an // exception throw. Out << "abort()"; @@ -1385,9 +1386,12 @@ void CWriter::visitVAArgInst(VAArgInst &I) { Out << ");\n va_end(Tmp); }"; } +} //===----------------------------------------------------------------------===// // External Interface declaration //===----------------------------------------------------------------------===// Pass *createWriteToCPass(std::ostream &o) { return new CWriter(o); } + +} // End llvm namespace diff --git a/llvm/lib/CodeGen/InstrSched/InstrScheduling.cpp b/llvm/lib/CodeGen/InstrSched/InstrScheduling.cpp index a50439de7f6..4e2bf478763 100644 --- a/llvm/lib/CodeGen/InstrSched/InstrScheduling.cpp +++ b/llvm/lib/CodeGen/InstrSched/InstrScheduling.cpp @@ -22,6 +22,8 @@ #include "Support/CommandLine.h" #include <algorithm> +namespace llvm { + SchedDebugLevel_t SchedDebugLevel; static cl::opt<bool> EnableFillingDelaySlots("sched-fill-delay-slots", @@ -1518,3 +1520,6 @@ bool InstructionSchedulingWithSSA::runOnFunction(Function &F) FunctionPass *createInstructionSchedulingWithSSAPass(const TargetMachine &tgt) { return new InstructionSchedulingWithSSA(tgt); } + +} // End llvm namespace + diff --git a/llvm/lib/CodeGen/InstrSched/SchedGraph.cpp b/llvm/lib/CodeGen/InstrSched/SchedGraph.cpp index e7cd47881ac..3a8088043bf 100644 --- a/llvm/lib/CodeGen/InstrSched/SchedGraph.cpp +++ b/llvm/lib/CodeGen/InstrSched/SchedGraph.cpp @@ -23,6 +23,8 @@ #include "llvm/Target/TargetRegInfo.h" #include "Support/STLExtras.h" +namespace llvm { + //*********************** Internal Data Structures *************************/ // The following two types need to be classes, not typedefs, so we can use @@ -737,3 +739,5 @@ void SchedGraphNode::print(std::ostream &os) const { os << std::string(16, ' ') << *outEdges[i]; } } + +} // End llvm namespace diff --git a/llvm/lib/CodeGen/InstrSched/SchedGraph.h b/llvm/lib/CodeGen/InstrSched/SchedGraph.h index 50cc0520e6f..5aee9b25f69 100644 --- a/llvm/lib/CodeGen/InstrSched/SchedGraph.h +++ b/llvm/lib/CodeGen/InstrSched/SchedGraph.h @@ -25,6 +25,8 @@ #include "Support/hash_map" #include "Support/GraphTraits.h" +namespace llvm { + class RegToRefVecMap; class ValueToDefVecMap; class RefVec; @@ -317,4 +319,6 @@ template <> struct GraphTraits<const SchedGraph*> { } }; +} // End llvm namespace + #endif diff --git a/llvm/lib/CodeGen/InstrSched/SchedGraphCommon.cpp b/llvm/lib/CodeGen/InstrSched/SchedGraphCommon.cpp index b75e3397cb9..d96c201c8a2 100644 --- a/llvm/lib/CodeGen/InstrSched/SchedGraphCommon.cpp +++ b/llvm/lib/CodeGen/InstrSched/SchedGraphCommon.cpp @@ -15,6 +15,8 @@ #include "llvm/CodeGen/SchedGraphCommon.h" #include "Support/STLExtras.h" +namespace llvm { + class SchedGraphCommon; // @@ -175,3 +177,4 @@ void SchedGraphCommon::eraseIncidentEdges(SchedGraphNodeCommon* node, this->eraseOutgoingEdges(node, addDummyEdges); } +} // End llvm namespace diff --git a/llvm/lib/CodeGen/InstrSched/SchedPriorities.cpp b/llvm/lib/CodeGen/InstrSched/SchedPriorities.cpp index 1644d5ecbc5..7e05d1417fd 100644 --- a/llvm/lib/CodeGen/InstrSched/SchedPriorities.cpp +++ b/llvm/lib/CodeGen/InstrSched/SchedPriorities.cpp @@ -23,6 +23,8 @@ #include "llvm/Support/CFG.h" #include "Support/PostOrderIterator.h" +namespace llvm { + std::ostream &operator<<(std::ostream &os, const NodeDelayPair* nd) { return os << "Delay for node " << nd->node->getNodeId() << " = " << (long)nd->delay << "\n"; @@ -278,3 +280,4 @@ SchedPriorities::instructionHasLastUse(FunctionLiveVarInfo &LVI, return lastUseMap[MI] = hasLastUse; } +} // End llvm namespace diff --git a/llvm/lib/CodeGen/InstrSched/SchedPriorities.h b/llvm/lib/CodeGen/InstrSched/SchedPriorities.h index de321f9fcbf..74704678066 100644 --- a/llvm/lib/CodeGen/InstrSched/SchedPriorities.h +++ b/llvm/lib/CodeGen/InstrSched/SchedPriorities.h @@ -26,6 +26,8 @@ #include "Support/hash_set" #include <list> +namespace llvm { + class Function; class MachineInstr; class SchedulingManager; @@ -214,4 +216,6 @@ inline void SchedPriorities::updateTime(cycles_t c) { std::ostream &operator<<(std::ostream &os, const NodeDelayPair* nd); +} // End llvm namespace + #endif diff --git a/llvm/lib/CodeGen/InstrSelection/InstrForest.cpp b/llvm/lib/CodeGen/InstrSelection/InstrForest.cpp index 5496502d5ef..fd5056d22d7 100644 --- a/llvm/lib/CodeGen/InstrSelection/InstrForest.cpp +++ b/llvm/lib/CodeGen/InstrSelection/InstrForest.cpp @@ -30,6 +30,8 @@ #include "Support/STLExtras.h" #include "Config/alloca.h" +namespace llvm { + //------------------------------------------------------------------------ // class InstrTreeNode //------------------------------------------------------------------------ @@ -330,3 +332,5 @@ InstructionNode* InstrForest::buildTreeForInstruction(Instruction *instr) { delete [] childArray; return treeNode; } + +} // End llvm namespace diff --git a/llvm/lib/CodeGen/InstrSelection/InstrSelection.cpp b/llvm/lib/CodeGen/InstrSelection/InstrSelection.cpp index 0e3e2cdbf25..760976509c1 100644 --- a/llvm/lib/CodeGen/InstrSelection/InstrSelection.cpp +++ b/llvm/lib/CodeGen/InstrSelection/InstrSelection.cpp @@ -28,6 +28,8 @@ #include "Support/LeakDetector.h" #include <vector> +namespace llvm { + std::vector<MachineInstr*> FixConstantOperandsForInstr(Instruction* vmInstr, MachineInstr* minstr, TargetMachine& target); @@ -82,6 +84,8 @@ namespace { }; } +namespace llvm { + TmpInstruction::TmpInstruction(MachineCodeForInstruction& mcfi, Value *s1, Value *s2, const std::string &name) : Instruction(s1->getType(), Instruction::UserOp1, name) @@ -114,6 +118,7 @@ TmpInstruction::TmpInstruction(MachineCodeForInstruction& mcfi, LeakDetector::removeGarbageObject(this); } +} // End llvm namespace bool InstructionSelection::runOnFunction(Function &F) { @@ -375,7 +380,6 @@ InstructionSelection::PostprocessMachineCodeForTree(InstructionNode* instrNode, } - //===----------------------------------------------------------------------===// // createInstructionSelectionPass - Public entrypoint for instruction selection // and this file as a whole... @@ -383,3 +387,5 @@ InstructionSelection::PostprocessMachineCodeForTree(InstructionNode* instrNode, FunctionPass *createInstructionSelectionPass(TargetMachine &T) { return new InstructionSelection(T); } + +} // End llvm namespace diff --git a/llvm/lib/CodeGen/InstrSelection/InstrSelectionSupport.cpp b/llvm/lib/CodeGen/InstrSelection/InstrSelectionSupport.cpp index 93f76186415..44a43596ee3 100644 --- a/llvm/lib/CodeGen/InstrSelection/InstrSelectionSupport.cpp +++ b/llvm/lib/CodeGen/InstrSelection/InstrSelectionSupport.cpp @@ -25,6 +25,7 @@ #include "llvm/DerivedTypes.h" #include "../../Target/Sparc/SparcInstrSelectionSupport.h" // FIXME! +namespace llvm { // Generate code to load the constant into a TmpInstruction (virtual reg) and // returns the virtual register. @@ -257,3 +258,5 @@ FixConstantOperandsForInstr(Instruction* vmInstr, return MVec; } + +} // End llvm namespace diff --git a/llvm/lib/CodeGen/LiveVariables.cpp b/llvm/lib/CodeGen/LiveVariables.cpp index 50b90b1fdcd..7ec4d32c1e8 100644 --- a/llvm/lib/CodeGen/LiveVariables.cpp +++ b/llvm/lib/CodeGen/LiveVariables.cpp @@ -33,6 +33,8 @@ #include "llvm/Support/CFG.h" #include "Support/DepthFirstIterator.h" +namespace llvm { + static RegisterAnalysis<LiveVariables> X("livevars", "Live Variable Analysis"); const std::pair<MachineBasicBlock*, unsigned> & @@ -307,3 +309,5 @@ bool LiveVariables::runOnMachineFunction(MachineFunction &MF) { return false; } + +} // End llvm namespace diff --git a/llvm/lib/CodeGen/MachineCodeEmitter.cpp b/llvm/lib/CodeGen/MachineCodeEmitter.cpp index 6e56594a10d..d9b1f7ce450 100644 --- a/llvm/lib/CodeGen/MachineCodeEmitter.cpp +++ b/llvm/lib/CodeGen/MachineCodeEmitter.cpp @@ -16,6 +16,8 @@ #include "llvm/Function.h" #include <fstream> +namespace llvm { + namespace { struct DebugMachineCodeEmitter : public MachineCodeEmitter { void startFunction(MachineFunction &F) { @@ -54,18 +56,7 @@ namespace { return 0; } }; -} - - -/// createDebugMachineCodeEmitter - Return a dynamically allocated machine -/// code emitter, which just prints the opcodes and fields out the cout. This -/// can be used for debugging users of the MachineCodeEmitter interface. -/// -MachineCodeEmitter *MachineCodeEmitter::createDebugEmitter() { - return new DebugMachineCodeEmitter(); -} -namespace { class FilePrinterEmitter : public MachineCodeEmitter { std::ofstream actual; std::ostream &o; @@ -169,7 +160,18 @@ namespace { }; } +/// createDebugMachineCodeEmitter - Return a dynamically allocated machine +/// code emitter, which just prints the opcodes and fields out the cout. This +/// can be used for debugging users of the MachineCodeEmitter interface. +/// +MachineCodeEmitter * +MachineCodeEmitter::createDebugEmitter() { + return new DebugMachineCodeEmitter(); +} + MachineCodeEmitter * MachineCodeEmitter::createFilePrinterEmitter(MachineCodeEmitter &MCE) { return new FilePrinterEmitter(MCE, std::cerr); } + +} // End llvm namespace diff --git a/llvm/lib/CodeGen/MachineCodeForInstruction.cpp b/llvm/lib/CodeGen/MachineCodeForInstruction.cpp index 36bafe2ff96..000f3d175b8 100644 --- a/llvm/lib/CodeGen/MachineCodeForInstruction.cpp +++ b/llvm/lib/CodeGen/MachineCodeForInstruction.cpp @@ -27,6 +27,8 @@ #include "llvm/CodeGen/MachineInstrAnnot.h" #include "llvm/CodeGen/InstrSelection.h" +namespace llvm { + AnnotationID MCFI_AID( AnnotationManager::getID("CodeGen::MachineCodeForInstruction")); @@ -68,3 +70,5 @@ MachineCodeForInstruction::~MachineCodeForInstruction() if (callArgsDesc) delete callArgsDesc; } + +} // End llvm namespace diff --git a/llvm/lib/CodeGen/MachineFunction.cpp b/llvm/lib/CodeGen/MachineFunction.cpp index c1eb30a1966..790859bc87a 100644 --- a/llvm/lib/CodeGen/MachineFunction.cpp +++ b/llvm/lib/CodeGen/MachineFunction.cpp @@ -28,6 +28,8 @@ #include "llvm/Pass.h" #include "Config/limits.h" +namespace llvm { + const int INVALID_FRAME_OFFSET = INT_MAX; // std::numeric_limits<int>::max(); static AnnotationID MF_AID( @@ -414,3 +416,5 @@ MachineFunctionInfo::getOffset(const Value* val) const hash_map<const Value*, int>::const_iterator pair = offsets.find(val); return (pair == offsets.end()) ? INVALID_FRAME_OFFSET : pair->second; } + +} // End llvm namespace diff --git a/llvm/lib/CodeGen/MachineInstr.cpp b/llvm/lib/CodeGen/MachineInstr.cpp index 7fb8b4569e2..ef31cc4cb3f 100644 --- a/llvm/lib/CodeGen/MachineInstr.cpp +++ b/llvm/lib/CodeGen/MachineInstr.cpp @@ -16,6 +16,8 @@ #include "llvm/Target/TargetInstrInfo.h" #include "llvm/Target/MRegisterInfo.h" +namespace llvm { + // Global variable holding an array of descriptors for machine instructions. // The actual object needs to be created separately for each target machine. // This variable is initialized and reset by class TargetInstrInfo. @@ -289,7 +291,7 @@ void MachineInstr::print(std::ostream &OS, const TargetMachine &TM) const { // Specialize printing if op#0 is definition if (getNumOperands() && (getOperand(0).opIsDefOnly() || getOperand(0).opIsDefAndUse())) { - ::print(getOperand(0), OS, TM); + llvm::print(getOperand(0), OS, TM); OS << " = "; ++StartOp; // Don't print this operand again! } @@ -300,7 +302,7 @@ void MachineInstr::print(std::ostream &OS, const TargetMachine &TM) const { if (i != StartOp) OS << ","; OS << " "; - ::print(mop, OS, TM); + llvm::print(mop, OS, TM); if (mop.opIsDefAndUse()) OS << "<def&use>"; @@ -433,3 +435,5 @@ std::ostream &operator<<(std::ostream &OS, const MachineOperand &MO) return OS; } + +} // End llvm namespace diff --git a/llvm/lib/CodeGen/MachineInstrAnnot.cpp b/llvm/lib/CodeGen/MachineInstrAnnot.cpp index bf4e68e112f..b4b41ac1761 100644 --- a/llvm/lib/CodeGen/MachineInstrAnnot.cpp +++ b/llvm/lib/CodeGen/MachineInstrAnnot.cpp @@ -18,6 +18,7 @@ #include "llvm/iOther.h" #include "llvm/Type.h" +namespace llvm { CallArgsDescriptor::CallArgsDescriptor(CallInst* _callInstr, TmpInstruction* _retAddrReg, @@ -76,3 +77,5 @@ CallArgsDescriptor *CallArgsDescriptor::get(const MachineInstr* MI) assert(desc->getCallInst()==callInstr && "Incorrect call args descriptor?"); return desc; } + +} // End llvm namespace diff --git a/llvm/lib/CodeGen/ModuloScheduling/ModuloSchedGraph.cpp b/llvm/lib/CodeGen/ModuloScheduling/ModuloSchedGraph.cpp index 6318c5ab46f..8aaaa2b6b5c 100644 --- a/llvm/lib/CodeGen/ModuloScheduling/ModuloSchedGraph.cpp +++ b/llvm/lib/CodeGen/ModuloScheduling/ModuloSchedGraph.cpp @@ -13,6 +13,8 @@ #include "ModuloSchedGraph.h" #include "llvm/Type.h" +namespace llvm { + ModuloSchedGraphNode::ModuloSchedGraphNode(unsigned id, int index, const Instruction *inst, const TargetMachine &targ) @@ -135,3 +137,4 @@ ModuloSchedGraphSet::~ModuloSchedGraphSet(){ //delete all the graphs } +} // End llvm namespace diff --git a/llvm/lib/CodeGen/ModuloScheduling/ModuloSchedGraph.h b/llvm/lib/CodeGen/ModuloScheduling/ModuloSchedGraph.h index 214e24cc8b5..552d699e768 100644 --- a/llvm/lib/CodeGen/ModuloScheduling/ModuloSchedGraph.h +++ b/llvm/lib/CodeGen/ModuloScheduling/ModuloSchedGraph.h @@ -22,6 +22,7 @@ #include "Support/hash_map" #include <vector> +namespace llvm { class ModuloSchedGraphNode : public SchedGraphNodeCommon { @@ -106,4 +107,6 @@ public: }; +} // End llvm namespace + #endif diff --git a/llvm/lib/CodeGen/ModuloScheduling/ModuloScheduling.cpp b/llvm/lib/CodeGen/ModuloScheduling/ModuloScheduling.cpp index 91ec6c28f55..219d892d314 100644 --- a/llvm/lib/CodeGen/ModuloScheduling/ModuloScheduling.cpp +++ b/llvm/lib/CodeGen/ModuloScheduling/ModuloScheduling.cpp @@ -16,6 +16,8 @@ #include "llvm/Function.h" #include "llvm/Pass.h" +namespace llvm { + namespace { class ModuloScheduling : public FunctionPass { @@ -40,3 +42,5 @@ bool ModuloScheduling::runOnFunction(Function &F) { bool Changed = false; return Changed; } + +} // End llvm namespace diff --git a/llvm/lib/CodeGen/PHIElimination.cpp b/llvm/lib/CodeGen/PHIElimination.cpp index 5a988bafe3c..c4b811aef6b 100644 --- a/llvm/lib/CodeGen/PHIElimination.cpp +++ b/llvm/lib/CodeGen/PHIElimination.cpp @@ -21,6 +21,8 @@ #include "llvm/Target/TargetMachine.h" #include "llvm/Support/CFG.h" +namespace llvm { + namespace { struct PNE : public MachineFunctionPass { bool runOnMachineFunction(MachineFunction &Fn) { @@ -52,6 +54,7 @@ namespace { "Eliminate PHI nodes for register allocation"); } + const PassInfo *PHIEliminationID = X.getPassInfo(); /// EliminatePHINodes - Eliminate phi nodes by inserting copy instructions in @@ -260,3 +263,5 @@ bool PNE::EliminatePHINodes(MachineFunction &MF, MachineBasicBlock &MBB) { return true; } + +} // End llvm namespace diff --git a/llvm/lib/CodeGen/Passes.cpp b/llvm/lib/CodeGen/Passes.cpp index 7a51a53ad89..239eacde4c1 100644 --- a/llvm/lib/CodeGen/Passes.cpp +++ b/llvm/lib/CodeGen/Passes.cpp @@ -15,6 +15,8 @@ #include "llvm/CodeGen/Passes.h" #include "Support/CommandLine.h" +namespace llvm { + namespace { enum RegAllocName { simple, local }; @@ -40,3 +42,5 @@ FunctionPass *createRegisterAllocator() return 0; // not reached } } + +} // End llvm namespace diff --git a/llvm/lib/CodeGen/PrologEpilogInserter.cpp b/llvm/lib/CodeGen/PrologEpilogInserter.cpp index a60b8b127bf..8fc9b5b2c21 100644 --- a/llvm/lib/CodeGen/PrologEpilogInserter.cpp +++ b/llvm/lib/CodeGen/PrologEpilogInserter.cpp @@ -25,6 +25,8 @@ #include "llvm/Target/TargetFrameInfo.h" #include "llvm/Target/TargetInstrInfo.h" +namespace llvm { + namespace { struct PEI : public MachineFunctionPass { const char *getPassName() const { @@ -66,6 +68,7 @@ namespace { }; } + /// createPrologEpilogCodeInserter - This function returns a pass that inserts /// prolog and epilog code, and eliminates abstract frame references. /// @@ -258,3 +261,5 @@ void PEI::replaceFrameIndices(MachineFunction &Fn) { break; } } + +} // End llvm namespace diff --git a/llvm/lib/CodeGen/RegAlloc/AllocInfo.h b/llvm/lib/CodeGen/RegAlloc/AllocInfo.h index f83f2103be7..67f58a7ed04 100644 --- a/llvm/lib/CodeGen/RegAlloc/AllocInfo.h +++ b/llvm/lib/CodeGen/RegAlloc/AllocInfo.h @@ -19,6 +19,8 @@ #include "llvm/DerivedTypes.h" #include "llvm/Constants.h" +namespace llvm { + /// AllocInfo - Structure representing one instruction's operand's-worth of /// register allocation state. We create tables made out of these data /// structures to generate mapping information for this register allocator. @@ -77,4 +79,6 @@ struct AllocInfo { } }; +} // End llvm namespace + #endif // ALLOCINFO_H diff --git a/llvm/lib/CodeGen/RegAlloc/IGNode.cpp b/llvm/lib/CodeGen/RegAlloc/IGNode.cpp index f883fb13c1d..a76fdeaa037 100644 --- a/llvm/lib/CodeGen/RegAlloc/IGNode.cpp +++ b/llvm/lib/CodeGen/RegAlloc/IGNode.cpp @@ -16,6 +16,8 @@ #include <algorithm> #include <iostream> +namespace llvm { + //----------------------------------------------------------------------------- // Sets this IGNode on stack and reduce the degree of neighbors //----------------------------------------------------------------------------- @@ -56,3 +58,5 @@ IGNode::getCombinedDegree(const IGNode* otherNode) const { std::vector<IGNode*>::iterator new_end = unique(nbrs.begin(), nbrs.end()); return new_end - nbrs.begin(); } + +} // End llvm namespace diff --git a/llvm/lib/CodeGen/RegAlloc/IGNode.h b/llvm/lib/CodeGen/RegAlloc/IGNode.h index 82f07e0c7e7..9fdc7a6ac07 100644 --- a/llvm/lib/CodeGen/RegAlloc/IGNode.h +++ b/llvm/lib/CodeGen/RegAlloc/IGNode.h @@ -32,6 +32,9 @@ #include "LiveRange.h" #include <vector> + +namespace llvm { + class RegClass; //---------------------------------------------------------------------------- @@ -115,4 +118,6 @@ public: inline LiveRange *getParentLR() const { return ParentLR; } }; +} // End llvm namespace + #endif diff --git a/llvm/lib/CodeGen/RegAlloc/InterferenceGraph.cpp b/llvm/lib/CodeGen/RegAlloc/InterferenceGraph.cpp index 392a96c11c6..3cef19ea0e0 100644 --- a/llvm/lib/CodeGen/RegAlloc/InterferenceGraph.cpp +++ b/llvm/lib/CodeGen/RegAlloc/InterferenceGraph.cpp @@ -17,6 +17,8 @@ #include "Support/STLExtras.h" #include <algorithm> +namespace llvm { + // for asserting this IG node is infact in the IGNodeList of this class inline static void assertIGNode(const InterferenceGraph *IG, const IGNode *Node) { @@ -246,3 +248,5 @@ void InterferenceGraph::printIGNodeList() const { } } } + +} // End llvm namespace diff --git a/llvm/lib/CodeGen/RegAlloc/InterferenceGraph.h b/llvm/lib/CodeGen/RegAlloc/InterferenceGraph.h index 6b8cf3cd053..79850c1fcf0 100644 --- a/llvm/lib/CodeGen/RegAlloc/InterferenceGraph.h +++ b/llvm/lib/CodeGen/RegAlloc/InterferenceGraph.h @@ -30,6 +30,9 @@ #define INTERFERENCEGRAPH_H #include <vector> + +namespace llvm { + class LiveRange; class RegClass; class IGNode; @@ -67,4 +70,6 @@ class InterferenceGraph { void printIGNodeList() const; }; +} // End llvm namespace + #endif diff --git a/llvm/lib/CodeGen/RegAlloc/LiveRange.h b/llvm/lib/CodeGen/RegAlloc/LiveRange.h index aa409c63fbc..d6e2cf63072 100644 --- a/llvm/lib/CodeGen/RegAlloc/LiveRange.h +++ b/llvm/lib/CodeGen/RegAlloc/LiveRange.h @@ -21,6 +21,8 @@ #include "llvm/Value.h" #include "llvm/CodeGen/ValueSet.h" +namespace llvm { + class RegClass; class IGNode; @@ -177,4 +179,6 @@ public: } }; +} // End llvm namespace + #endif diff --git a/llvm/lib/CodeGen/RegAlloc/LiveRangeInfo.cpp b/llvm/lib/CodeGen/RegAlloc/LiveRangeInfo.cpp index b9fcda789f7..9fd04d2b0e4 100644 --- a/llvm/lib/CodeGen/RegAlloc/LiveRangeInfo.cpp +++ b/llvm/lib/CodeGen/RegAlloc/LiveRangeInfo.cpp @@ -23,6 +23,8 @@ #include "llvm/Target/TargetRegInfo.h" #include "Support/SetOperations.h" +namespace llvm { + unsigned LiveRange::getRegClassID() const { return getRegClass()->getID(); } LiveRangeInfo::LiveRangeInfo(const Function *F, const TargetMachine &tm, @@ -411,3 +413,5 @@ void LiveRangeInfo::printLiveRanges() { } } } + +} // End llvm namespace diff --git a/llvm/lib/CodeGen/RegAlloc/LiveRangeInfo.h b/llvm/lib/CodeGen/RegAlloc/LiveRangeInfo.h index 5c5244bd62c..a8d0e7152f1 100644 --- a/llvm/lib/CodeGen/RegAlloc/LiveRangeInfo.h +++ b/llvm/lib/CodeGen/RegAlloc/LiveRangeInfo.h @@ -29,6 +29,8 @@ #include "llvm/CodeGen/ValueSet.h" #include "Support/hash_map" +namespace llvm { + class LiveRange; class MachineInstr; class RegClass; @@ -121,4 +123,6 @@ public: void printLiveRanges(); }; +} // End llvm namespace + #endif diff --git a/llvm/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp b/llvm/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp index 99917cdf0b4..332ae9524cb 100644 --- a/llvm/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp +++ b/llvm/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp @@ -47,6 +47,8 @@ #include "Support/STLExtras.h" #include <cmath> +namespace llvm { + RegAllocDebugLevel_t DEBUG_RA; /// The reoptimizer wants to be able to grovel through the register @@ -1392,3 +1394,5 @@ bool PhyRegAlloc::runOnFunction (Function &F) { if (DEBUG_RA) std::cerr << "\nRegister allocation complete!\n"; return false; // Function was not modified } + +} // End llvm namespace diff --git a/llvm/lib/CodeGen/RegAlloc/PhyRegAlloc.h b/llvm/lib/CodeGen/RegAlloc/PhyRegAlloc.h index c524f9f56cb..4ec083c8ea3 100644 --- a/llvm/lib/CodeGen/RegAlloc/PhyRegAlloc.h +++ b/llvm/lib/CodeGen/RegAlloc/PhyRegAlloc.h @@ -31,6 +31,8 @@ #include "llvm/Target/TargetRegInfo.h" #include <map> +namespace llvm { + class MachineFunction; class FunctionLiveVarInfo; class MachineInstr; @@ -179,4 +181,6 @@ private: void addInterf4PseudoInstr(const MachineInstr *MI); }; +} // End llvm namespace + #endif diff --git a/llvm/lib/CodeGen/RegAlloc/RegAllocCommon.h b/llvm/lib/CodeGen/RegAlloc/RegAllocCommon.h index 97d102a253a..7dd86b205af 100644 --- a/llvm/lib/CodeGen/RegAlloc/RegAllocCommon.h +++ b/llvm/lib/CodeGen/RegAlloc/RegAllocCommon.h @@ -14,6 +14,8 @@ #ifndef REGALLOCCOMMON_H #define REGALLOCCOMMON_H +namespace llvm { + enum RegAllocDebugLevel_t { RA_DEBUG_None = 0, RA_DEBUG_Results = 1, @@ -25,4 +27,6 @@ enum RegAllocDebugLevel_t { extern RegAllocDebugLevel_t DEBUG_RA; +} // End llvm namespace + #endif diff --git a/llvm/lib/CodeGen/RegAlloc/RegClass.cpp b/llvm/lib/CodeGen/RegAlloc/RegClass.cpp index 9c8603b82c3..9af87ba0e86 100644 --- a/llvm/lib/CodeGen/RegAlloc/RegClass.cpp +++ b/llvm/lib/CodeGen/RegAlloc/RegClass.cpp @@ -16,6 +16,8 @@ #include "RegClass.h" #include "llvm/Target/TargetRegInfo.h" +namespace llvm { + //---------------------------------------------------------------------------- // This constructor inits IG. The actual matrix is created by a call to // createInterferenceGraph() above. @@ -245,4 +247,4 @@ void RegClass::printIG() { IG.printIG(); } - +} // End llvm namespace diff --git a/llvm/lib/CodeGen/RegAlloc/RegClass.h b/llvm/lib/CodeGen/RegAlloc/RegClass.h index c861fbae210..0071f7c2129 100644 --- a/llvm/lib/CodeGen/RegAlloc/RegClass.h +++ b/llvm/lib/CodeGen/RegAlloc/RegClass.h @@ -20,6 +20,9 @@ #include "llvm/Target/TargetRegInfo.h" #include "InterferenceGraph.h" #include <stack> + +namespace llvm { + class TargetRegClassInfo; @@ -139,4 +142,6 @@ class RegClass { void printIG(); }; +} // End llvm namespace + #endif diff --git a/llvm/lib/CodeGen/RegAllocLocal.cpp b/llvm/lib/CodeGen/RegAllocLocal.cpp index 8d19b694715..080e6c69c0b 100644 --- a/llvm/lib/CodeGen/RegAllocLocal.cpp +++ b/llvm/lib/CodeGen/RegAllocLocal.cpp @@ -26,6 +26,8 @@ #include "Support/Statistic.h" #include <iostream> +namespace llvm { + namespace { Statistic<> NumSpilled ("ra-local", "Number of registers spilled"); Statistic<> NumReloaded("ra-local", "Number of registers reloaded"); @@ -203,7 +205,6 @@ namespace { }; } - /// getStackSpaceFor - This allocates space for the specified virtual register /// to be held on the stack. int RA::getStackSpaceFor(unsigned VirtReg, const TargetRegisterClass *RC) { @@ -674,3 +675,5 @@ bool RA::runOnMachineFunction(MachineFunction &Fn) { FunctionPass *createLocalRegisterAllocator() { return new RA(); } + +} // End llvm namespace diff --git a/llvm/lib/CodeGen/RegAllocSimple.cpp b/llvm/lib/CodeGen/RegAllocSimple.cpp index a210790b8dd..202123ad106 100644 --- a/llvm/lib/CodeGen/RegAllocSimple.cpp +++ b/llvm/lib/CodeGen/RegAllocSimple.cpp @@ -26,6 +26,8 @@ #include "Support/Statistic.h" #include <iostream> +namespace llvm { + namespace { Statistic<> NumSpilled ("ra-simple", "Number of registers spilled"); Statistic<> NumReloaded("ra-simple", "Number of registers reloaded"); @@ -234,3 +236,5 @@ bool RegAllocSimple::runOnMachineFunction(MachineFunction &Fn) { FunctionPass *createSimpleRegisterAllocator() { return new RegAllocSimple(); } + +} // End llvm namespace diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGBuilder.cpp index a972ddf6026..fd4e7a90c7d 100644 --- a/llvm/lib/CodeGen/SelectionDAG/DAGBuilder.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/DAGBuilder.cpp @@ -21,6 +21,8 @@ #include "llvm/Target/TargetMachine.h" #include "llvm/Support/InstVisitor.h" +namespace llvm { + struct SelectionDAGBuilder : public InstVisitor<SelectionDAGBuilder> { // DAG - the current dag we are building. SelectionDAG &DAG; @@ -270,3 +272,5 @@ SelectionDAG::SelectionDAG(MachineFunction &f, const TargetMachine &tm, SDB.visitBB(const_cast<BasicBlock&>(*I)); Root = SDB.CurRoot; } + +} // End llvm namespace diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index 58a9639c92b..db5941060db 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp @@ -15,6 +15,8 @@ #include "llvm/CodeGen/SelectionDAG.h" #include "llvm/Type.h" +namespace llvm { + SelectionDAG::~SelectionDAG() { for (unsigned i = 0, e = AllNodes.size(); i != e; ++i) delete AllNodes[i]; @@ -126,3 +128,5 @@ void SelectionDAGNode::printit(unsigned Offset, unsigned &LastID, std::cerr << "\n"; } + +} // End llvm namespace diff --git a/llvm/lib/ExecutionEngine/ExecutionEngine.cpp b/llvm/lib/ExecutionEngine/ExecutionEngine.cpp index dd647247c3f..b7da23ca714 100644 --- a/llvm/lib/ExecutionEngine/ExecutionEngine.cpp +++ b/llvm/lib/ExecutionEngine/ExecutionEngine.cpp @@ -27,6 +27,8 @@ #include "Support/DynamicLinker.h" #include "Config/dlfcn.h" +namespace llvm { + Statistic<> NumInitBytes("lli", "Number of bytes of global vars initialized"); ExecutionEngine::ExecutionEngine(ModuleProvider *P) : @@ -390,3 +392,4 @@ void ExecutionEngine::emitGlobals() { InitializeMemory(I->getInitializer(), GlobalAddress[I]); } +} // End llvm namespace diff --git a/llvm/lib/ExecutionEngine/Interpreter/Execution.cpp b/llvm/lib/ExecutionEngine/Interpreter/Execution.cpp index b04f974911d..aa32983cc38 100644 --- a/llvm/lib/ExecutionEngine/Interpreter/Execution.cpp +++ b/llvm/lib/ExecutionEngine/Interpreter/Execution.cpp @@ -18,12 +18,14 @@ #include "Support/Statistic.h" #include <cmath> // For fmod -Interpreter *TheEE = 0; +namespace llvm { namespace { Statistic<> NumDynamicInsts("lli", "Number of dynamic instructions executed"); } +Interpreter *TheEE = 0; + //===----------------------------------------------------------------------===// // Value Manipulation code //===----------------------------------------------------------------------===// @@ -910,3 +912,5 @@ void Interpreter::run() { visit(I); // Dispatch to one of the visit* methods... } } + +} // End llvm namespace diff --git a/llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp b/llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp index ecf19c2f8d5..f516f5de23e 100644 --- a/llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp +++ b/llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp @@ -32,6 +32,8 @@ #include <map> using std::vector; +namespace llvm { + typedef GenericValue (*ExFunc)(FunctionType *, const vector<GenericValue> &); static std::map<const Function *, ExFunc> Functions; static std::map<std::string, ExFunc> FuncNames; @@ -767,3 +769,5 @@ void Interpreter::initializeExternalFunctions() { FuncNames["lle_X_llvm.va_end"] = llvm_va_end; FuncNames["lle_X_llvm.va_copy"] = llvm_va_copy; } + +} // End llvm namespace diff --git a/llvm/lib/ExecutionEngine/Interpreter/Interpreter.cpp b/llvm/lib/ExecutionEngine/Interpreter/Interpreter.cpp index bcaa8569dc4..bb14cd2ee89 100644 --- a/llvm/lib/ExecutionEngine/Interpreter/Interpreter.cpp +++ b/llvm/lib/ExecutionEngine/Interpreter/Interpreter.cpp @@ -17,6 +17,8 @@ #include "llvm/Module.h" #include "llvm/DerivedTypes.h" +namespace llvm { + /// create - Create a new interpreter object. This can never fail. /// ExecutionEngine *Interpreter::create(Module *M){ @@ -97,3 +99,5 @@ GenericValue Interpreter::run(Function *F, rv.IntVal = ExitCode; return rv; } + +} // End llvm namespace diff --git a/llvm/lib/ExecutionEngine/Interpreter/Interpreter.h b/llvm/lib/ExecutionEngine/Interpreter/Interpreter.h index 00784adb714..e9015a203e9 100644 --- a/llvm/lib/ExecutionEngine/Interpreter/Interpreter.h +++ b/llvm/lib/ExecutionEngine/Interpreter/Interpreter.h @@ -22,6 +22,8 @@ #include "llvm/Target/TargetData.h" #include "Support/DataTypes.h" +namespace llvm { + struct FunctionInfo; // Defined in ExecutionAnnotations.h // AllocaHolder - Object to track all of the blocks of memory allocated by @@ -166,4 +168,6 @@ private: // Helper functions void popStackAndReturnValueToCaller(const Type *RetTy, GenericValue Result); }; +} // End llvm namespace + #endif diff --git a/llvm/lib/ExecutionEngine/JIT/Emitter.cpp b/llvm/lib/ExecutionEngine/JIT/Emitter.cpp index 98f526a5f53..32d0651f226 100644 --- a/llvm/lib/ExecutionEngine/JIT/Emitter.cpp +++ b/llvm/lib/ExecutionEngine/JIT/Emitter.cpp @@ -27,6 +27,8 @@ #include "Config/unistd.h" #include "Config/sys/mman.h" +namespace llvm { + namespace { Statistic<> NumBytes("jit", "Number of bytes of machine code compiled"); VM *TheVM = 0; @@ -265,3 +267,5 @@ extern "C" { return TheVM->getPointerToNamedFunction(Name); } } + +} // End llvm namespace diff --git a/llvm/lib/ExecutionEngine/JIT/Intercept.cpp b/llvm/lib/ExecutionEngine/JIT/Intercept.cpp index 6162e938aba..191b57d22a0 100644 --- a/llvm/lib/ExecutionEngine/JIT/Intercept.cpp +++ b/llvm/lib/ExecutionEngine/JIT/Intercept.cpp @@ -19,6 +19,8 @@ #include "Support/DynamicLinker.h" #include <iostream> +namespace llvm { + // AtExitHandlers - List of functions to call when the program exits, // registered with the atexit() library function. static std::vector<void (*)()> AtExitHandlers; @@ -75,3 +77,5 @@ void *VM::getPointerToNamedFunction(const std::string &Name) { return Ptr; } + +} // End llvm namespace diff --git a/llvm/lib/ExecutionEngine/JIT/JIT.cpp b/llvm/lib/ExecutionEngine/JIT/JIT.cpp index fedb6e46b08..61d9629d93e 100644 --- a/llvm/lib/ExecutionEngine/JIT/JIT.cpp +++ b/llvm/lib/ExecutionEngine/JIT/JIT.cpp @@ -24,6 +24,8 @@ #define NO_JITS_ENABLED #endif +namespace llvm { + namespace { enum ArchName { x86, Sparc }; @@ -118,3 +120,5 @@ GenericValue VM::run(Function *F, const std::vector<GenericValue> &ArgValues) rv.IntVal = ExitCode; return rv; } + +} // End llvm namespace diff --git a/llvm/lib/ExecutionEngine/JIT/VM.cpp b/llvm/lib/ExecutionEngine/JIT/VM.cpp index 2dda271fa0a..d7e76859788 100644 --- a/llvm/lib/ExecutionEngine/JIT/VM.cpp +++ b/llvm/lib/ExecutionEngine/JIT/VM.cpp @@ -19,6 +19,8 @@ #include "llvm/CodeGen/MachineCodeEmitter.h" #include "llvm/Target/TargetMachine.h" +namespace llvm { + VM::~VM() { delete MCE; delete &TM; @@ -98,3 +100,5 @@ void *VM::recompileAndRelinkFunction(Function *F) { TM.replaceMachineCodeForFunction (OldAddr, Addr); return Addr; } + +} // End llvm namespace diff --git a/llvm/lib/ExecutionEngine/JIT/VM.h b/llvm/lib/ExecutionEngine/JIT/VM.h index 685c4bd0534..9a17c967c70 100644 --- a/llvm/lib/ExecutionEngine/JIT/VM.h +++ b/llvm/lib/ExecutionEngine/JIT/VM.h @@ -18,6 +18,8 @@ #include "llvm/PassManager.h" #include <map> +namespace llvm { + class Function; class GlobalValue; class Constant; @@ -78,4 +80,6 @@ private: void runJITOnFunction (Function *F); }; +} // End llvm namespace + #endif diff --git a/llvm/lib/Support/Annotation.cpp b/llvm/lib/Support/Annotation.cpp index 890b18de06c..b88624dd1f0 100644 --- a/llvm/lib/Support/Annotation.cpp +++ b/llvm/lib/Support/Annotation.cpp @@ -14,6 +14,8 @@ #include <map> #include "Support/Annotation.h" +namespace llvm { + typedef std::map<const std::string, unsigned> IDMapType; static unsigned IDCounter = 0; // Unique ID counter @@ -94,3 +96,5 @@ Annotation *AnnotationManager::createAnnotation(AnnotationID ID, if (I == getFactMap().end()) return 0; return I->second.first(ID, Obj, I->second.second); } + +} // End llvm namespace diff --git a/llvm/lib/Support/CommandLine.cpp b/llvm/lib/Support/CommandLine.cpp index de895c91176..235dc128433 100644 --- a/llvm/lib/Support/CommandLine.cpp +++ b/llvm/lib/Support/CommandLine.cpp @@ -24,6 +24,8 @@ #include <cstdlib> #include <cerrno> +namespace llvm { + using namespace cl; //===----------------------------------------------------------------------===// @@ -887,3 +889,5 @@ HHOp("help-hidden", cl::desc("display all available options"), cl::location(HiddenPrinter), cl::Hidden, cl::ValueDisallowed); } // End anonymous namespace + +} // End llvm namespace diff --git a/llvm/lib/Support/ConstantRange.cpp b/llvm/lib/Support/ConstantRange.cpp index a9e1204de52..e180f12a1a0 100644 --- a/llvm/lib/Support/ConstantRange.cpp +++ b/llvm/lib/Support/ConstantRange.cpp @@ -26,6 +26,8 @@ #include "llvm/Instruction.h" #include "llvm/ConstantHandling.h" +namespace llvm { + /// Initialize a full (the default) or empty set for the specified type. /// ConstantRange::ConstantRange(const Type *Ty, bool Full) { @@ -248,3 +250,5 @@ void ConstantRange::print(std::ostream &OS) const { void ConstantRange::dump() const { print(std::cerr); } + +} // End llvm namespace diff --git a/llvm/lib/Support/Debug.cpp b/llvm/lib/Support/Debug.cpp index 895abbb1f76..1af23380a27 100644 --- a/llvm/lib/Support/Debug.cpp +++ b/llvm/lib/Support/Debug.cpp @@ -26,6 +26,8 @@ #include "Support/Statistic.h" #include "Support/CommandLine.h" +namespace llvm { + bool DebugFlag; // DebugFlag - Exported boolean set by the -debug option namespace { @@ -62,3 +64,5 @@ bool isCurrentDebugType(const char *DebugType) { return false; #endif } + +} // End llvm namespace diff --git a/llvm/lib/Support/DynamicLinker.cpp b/llvm/lib/Support/DynamicLinker.cpp index 74b36036793..1c9385eea7d 100644 --- a/llvm/lib/Support/DynamicLinker.cpp +++ b/llvm/lib/Support/DynamicLinker.cpp @@ -23,6 +23,8 @@ #include "Config/dlfcn.h" #include <cassert> +namespace llvm { + bool LinkDynamicObject (const char *filename, std::string *ErrorMessage) { #if defined (HAVE_DLOPEN) if (dlopen (filename, RTLD_NOW | RTLD_GLOBAL) == 0) { @@ -52,3 +54,5 @@ void *GetAddressOfSymbol (const char *symbolName) { void *GetAddressOfSymbol (const std::string &symbolName) { return GetAddressOfSymbol (symbolName.c_str ()); } + +} // End llvm namespace diff --git a/llvm/lib/Support/FileUtilities.cpp b/llvm/lib/Support/FileUtilities.cpp index 3262ecce316..cde288925be 100644 --- a/llvm/lib/Support/FileUtilities.cpp +++ b/llvm/lib/Support/FileUtilities.cpp @@ -20,6 +20,9 @@ #include <iostream> #include <cstdio> +namespace llvm +{ + /// CheckMagic - Returns true IFF the file named FN begins with Magic. FN must /// name a readable file. /// @@ -182,3 +185,5 @@ bool MakeFileExecutable (const std::string &Filename) { bool MakeFileReadable (const std::string &Filename) { return AddPermissionsBits (Filename, 0444); } + +} // End llvm namespace diff --git a/llvm/lib/Support/LeakDetector.cpp b/llvm/lib/Support/LeakDetector.cpp index 24c946ab6ea..ffb081a9982 100644 --- a/llvm/lib/Support/LeakDetector.cpp +++ b/llvm/lib/Support/LeakDetector.cpp @@ -15,6 +15,8 @@ #include "llvm/Value.h" #include <set> +namespace llvm { + // Lazily allocate set so that release build doesn't have to do anything. static std::set<const void*> *Objects = 0; static std::set<const Value*> *LLVMObjects = 0; @@ -87,3 +89,5 @@ void LeakDetector::checkForGarbageImpl(const std::string &Message) { Objects = 0; LLVMObjects = 0; } } + +} // End llvm namespace diff --git a/llvm/lib/Support/Mangler.cpp b/llvm/lib/Support/Mangler.cpp index 44c697d3d8f..567fe05e320 100644 --- a/llvm/lib/Support/Mangler.cpp +++ b/llvm/lib/Support/Mangler.cpp @@ -16,6 +16,8 @@ #include "llvm/Type.h" #include "Support/StringExtras.h" +namespace llvm { + static char HexDigit(int V) { return V < 10 ? V+'0' : V+'A'-10; } @@ -99,3 +101,4 @@ Mangler::Mangler(Module &m, bool addUnderscorePrefix) FoundNames.insert(I->getName()); // Otherwise, keep track of name } +} // End llvm namespace diff --git a/llvm/lib/Support/PluginLoader.cpp b/llvm/lib/Support/PluginLoader.cpp index 1582a10c653..1729bb33655 100644 --- a/llvm/lib/Support/PluginLoader.cpp +++ b/llvm/lib/Support/PluginLoader.cpp @@ -23,6 +23,8 @@ #include "Config/link.h" #include <iostream> +namespace llvm { + namespace { struct PluginLoader { void operator=(const std::string &Filename) { @@ -38,3 +40,5 @@ namespace { static cl::opt<PluginLoader, false, cl::parser<std::string> > LoadOpt("load", cl::ZeroOrMore, cl::value_desc("plugin.so"), cl::desc("Load the specified plugin")); + +} // End llvm namespace diff --git a/llvm/lib/Support/Signals.cpp b/llvm/lib/Support/Signals.cpp index efc5f712578..73decfd89be 100644 --- a/llvm/lib/Support/Signals.cpp +++ b/llvm/lib/Support/Signals.cpp @@ -20,6 +20,8 @@ #include <signal.h> #include "Config/config.h" // Get the signal handler return type +namespace llvm { + static std::vector<std::string> FilesToRemove; // IntSigs - Signals that may interrupt the program at any time. @@ -62,3 +64,5 @@ void RemoveFileOnSignal(const std::string &Filename) { std::for_each(IntSigs, IntSigsEnd, RegisterHandler); std::for_each(KillSigs, KillSigsEnd, RegisterHandler); } + +} // End llvm namespace diff --git a/llvm/lib/Support/Statistic.cpp b/llvm/lib/Support/Statistic.cpp index c60a85cdeb6..3ac2bf97fbe 100644 --- a/llvm/lib/Support/Statistic.cpp +++ b/llvm/lib/Support/Statistic.cpp @@ -27,8 +27,10 @@ #include <iostream> #include <algorithm> +namespace llvm { + // GetLibSupportInfoOutputFile - Return a file stream to print our output on... -std::ostream *GetLibSupportInfoOutputFile(); +extern std::ostream *GetLibSupportInfoOutputFile(); unsigned StatisticBase::NumStats = 0; @@ -104,3 +106,5 @@ void StatisticBase::destroy() const { delete OutStream; // Close the file... } } + +} // End llvm namespace diff --git a/llvm/lib/Support/SystemUtils.cpp b/llvm/lib/Support/SystemUtils.cpp index 8c009ffb573..ec535ad45a2 100644 --- a/llvm/lib/Support/SystemUtils.cpp +++ b/llvm/lib/Support/SystemUtils.cpp @@ -24,6 +24,8 @@ #include "Config/unistd.h" #include "Config/errno.h" +namespace llvm { + /// isExecutableFile - This function returns true if the filename specified /// exists and is executable. /// @@ -272,3 +274,4 @@ ExecWait (const char * const old_argv[], const char * const old_envp[]) return 1; } +} // End llvm namespace diff --git a/llvm/lib/Support/Timer.cpp b/llvm/lib/Support/Timer.cpp index 5e84f38852b..d14a225fcf2 100644 --- a/llvm/lib/Support/Timer.cpp +++ b/llvm/lib/Support/Timer.cpp @@ -23,6 +23,8 @@ #include <fstream> #include <map> +namespace llvm { + // getLibSupportInfoOutputFilename - This ugly hack is brought to you courtesy // of constructor/destructor ordering being unspecified by C++. Basically the // problem is that a Statistic<> object gets destroyed, which ends up calling @@ -265,7 +267,8 @@ void Timer::print(const Timer &Total, std::ostream &OS) { } // GetLibSupportInfoOutputFile - Return a file stream to print our output on... -std::ostream *GetLibSupportInfoOutputFile() { +std::ostream * +GetLibSupportInfoOutputFile() { std::string &LibSupportInfoOutputFilename = getLibSupportInfoOutputFilename(); if (LibSupportInfoOutputFilename.empty()) return &std::cerr; @@ -349,3 +352,5 @@ void TimerGroup::removeTimer() { DefaultTimerGroup = 0; } } + +} // End llvm namespace diff --git a/llvm/lib/Support/ToolRunner.cpp b/llvm/lib/Support/ToolRunner.cpp index a66b868c22c..50a9ad21c85 100644 --- a/llvm/lib/Support/ToolRunner.cpp +++ b/llvm/lib/Support/ToolRunner.cpp @@ -18,6 +18,8 @@ #include <iostream> #include <fstream> +namespace llvm { + //===---------------------------------------------------------------------===// // LLI Implementation of AbstractIntepreter interface // @@ -391,3 +393,5 @@ GCC *GCC::create(const std::string &ProgramPath, std::string &Message) { Message = "Found gcc: " + GCCPath + "\n"; return new GCC(GCCPath); } + +} // End llvm namespace diff --git a/llvm/lib/Support/ValueHolder.cpp b/llvm/lib/Support/ValueHolder.cpp index 8661402b061..77fdaf6b44c 100644 --- a/llvm/lib/Support/ValueHolder.cpp +++ b/llvm/lib/Support/ValueHolder.cpp @@ -18,6 +18,10 @@ #include "llvm/Support/ValueHolder.h" #include "llvm/Type.h" +namespace llvm { + ValueHolder::ValueHolder(Value *V) : User(Type::TypeTy, Value::TypeVal) { Operands.push_back(Use(V, this)); } + +} // End llvm namespace diff --git a/llvm/lib/Target/MRegisterInfo.cpp b/llvm/lib/Target/MRegisterInfo.cpp index 6f358152638..7c1028bc323 100644 --- a/llvm/lib/Target/MRegisterInfo.cpp +++ b/llvm/lib/Target/MRegisterInfo.cpp @@ -13,6 +13,8 @@ #include "llvm/Target/MRegisterInfo.h" +namespace llvm { + MRegisterInfo::MRegisterInfo(const MRegisterDesc *D, unsigned NR, regclass_iterator RCB, regclass_iterator RCE, int CFSO, int CFDO) @@ -41,3 +43,5 @@ MRegisterInfo::MRegisterInfo(const MRegisterDesc *D, unsigned NR, MRegisterInfo::~MRegisterInfo() { delete[] PhysRegClasses; } + +} // End llvm namespace diff --git a/llvm/lib/Target/Sparc/EmitAssembly.cpp b/llvm/lib/Target/Sparc/EmitAssembly.cpp index 25034177da4..6af9836e29b 100644 --- a/llvm/lib/Target/Sparc/EmitAssembly.cpp +++ b/llvm/lib/Target/Sparc/EmitAssembly.cpp @@ -33,6 +33,8 @@ #include "SparcInternals.h" #include <string> +namespace llvm { + namespace { Statistic<> EmittedInsts("asm-printer", "Number of machine instrs printed"); @@ -877,12 +879,13 @@ SparcFunctionAsmPrinter::emitFunction(const Function &F) } // End anonymous namespace +namespace llvm { + Pass *UltraSparc::getFunctionAsmPrinterPass(std::ostream &Out) { return new SparcFunctionAsmPrinter(Out, *this); } - - +} // End llvm namespace //===----------------------------------------------------------------------===// @@ -954,3 +957,5 @@ void SparcModuleAsmPrinter::emitGlobals(const Module &M) { Pass *UltraSparc::getModuleAsmPrinterPass(std::ostream &Out) { return new SparcModuleAsmPrinter(Out, *this); } + +} // End llvm namespace diff --git a/llvm/lib/Target/Sparc/EmitBytecodeToAssembly.cpp b/llvm/lib/Target/Sparc/EmitBytecodeToAssembly.cpp index 2c45021f007..a603e94b819 100644 --- a/llvm/lib/Target/Sparc/EmitBytecodeToAssembly.cpp +++ b/llvm/lib/Target/Sparc/EmitBytecodeToAssembly.cpp @@ -18,6 +18,8 @@ #include "llvm/Bytecode/Writer.h" #include <iostream> +namespace llvm { + using std::ostream; namespace { @@ -113,3 +115,5 @@ namespace { Pass *UltraSparc::getBytecodeAsmPrinterPass(std::ostream &Out) { return new SparcBytecodeWriter(Out); } + +} // End llvm namespace diff --git a/llvm/lib/Target/Sparc/MappingInfo.cpp b/llvm/lib/Target/Sparc/MappingInfo.cpp index db03f13b976..2afde6bdf59 100644 --- a/llvm/lib/Target/Sparc/MappingInfo.cpp +++ b/llvm/lib/Target/Sparc/MappingInfo.cpp @@ -49,6 +49,8 @@ #include "llvm/CodeGen/MachineCodeForInstruction.h" #include "Support/StringExtras.h" +namespace llvm { + namespace { class MappingInfoAsmPrinter : public FunctionPass { std::ostream &Out; @@ -293,3 +295,5 @@ bool MappingInfoAsmPrinter::doFinalization (Module &M) { return false; } +} // End llvm namespace + diff --git a/llvm/lib/Target/Sparc/MappingInfo.h b/llvm/lib/Target/Sparc/MappingInfo.h index f86e2b42b7a..6af116a6da2 100644 --- a/llvm/lib/Target/Sparc/MappingInfo.h +++ b/llvm/lib/Target/Sparc/MappingInfo.h @@ -18,6 +18,9 @@ #include <iosfwd> #include <vector> #include <string> + +namespace llvm { + class Pass; Pass *getMappingInfoAsmPrinterPass(std::ostream &out); @@ -41,4 +44,6 @@ public: } }; +} // End llvm namespace + #endif diff --git a/llvm/lib/Target/Sparc/PeepholeOpts.cpp b/llvm/lib/Target/Sparc/PeepholeOpts.cpp index 83081b71203..9713a02d95e 100644 --- a/llvm/lib/Target/Sparc/PeepholeOpts.cpp +++ b/llvm/lib/Target/Sparc/PeepholeOpts.cpp @@ -20,6 +20,8 @@ #include "llvm/BasicBlock.h" #include "llvm/Pass.h" +namespace llvm { + //************************* Internal Functions *****************************/ static inline void @@ -163,3 +165,5 @@ bool PeepholeOpts::runOnBasicBlock(BasicBlock &BB) { FunctionPass* createPeepholeOptsPass(const TargetMachine &TM) { return new PeepholeOpts(TM); } + +} // End llvm namespace diff --git a/llvm/lib/Target/Sparc/PreSelection.cpp b/llvm/lib/Target/Sparc/PreSelection.cpp index 9078dc13b1e..205ecd3145c 100644 --- a/llvm/lib/Target/Sparc/PreSelection.cpp +++ b/llvm/lib/Target/Sparc/PreSelection.cpp @@ -29,6 +29,8 @@ #include "llvm/Transforms/Scalar.h" #include <algorithm> +namespace llvm { + namespace { //===--------------------------------------------------------------------===// @@ -71,6 +73,7 @@ namespace { "Specialize LLVM code for a target machine" createPreselectionPass); #endif + } // end anonymous namespace @@ -236,7 +239,6 @@ void PreSelection::visitCallInst(CallInst &I) { visitOperands(I, (/*firstOp=*/ I.getCalledFunction()? 1 : 0)); } - //===----------------------------------------------------------------------===// // createPreSelectionPass - Public entrypoint for pre-selection pass // and this file as a whole... @@ -244,3 +246,5 @@ void PreSelection::visitCallInst(CallInst &I) { FunctionPass* createPreSelectionPass(const TargetMachine &TM) { return new PreSelection(TM); } + +} // End llvm namespace diff --git a/llvm/lib/Target/Sparc/PrologEpilogCodeInserter.cpp b/llvm/lib/Target/Sparc/PrologEpilogCodeInserter.cpp index ff7bd7d0269..555b6b14fe7 100644 --- a/llvm/lib/Target/Sparc/PrologEpilogCodeInserter.cpp +++ b/llvm/lib/Target/Sparc/PrologEpilogCodeInserter.cpp @@ -27,6 +27,8 @@ #include "llvm/DerivedTypes.h" #include "llvm/Intrinsics.h" +namespace llvm { + namespace { struct InsertPrologEpilogCode : public MachineFunctionPass { const char *getPassName() const { return "Sparc Prolog/Epilog Inserter"; } @@ -177,3 +179,5 @@ void InsertPrologEpilogCode::InsertEpilogCode(MachineFunction &MF) FunctionPass *UltraSparc::getPrologEpilogInsertionPass() { return new InsertPrologEpilogCode(); } + +} // End llvm namespace diff --git a/llvm/lib/Target/Sparc/Sparc.burg.in b/llvm/lib/Target/Sparc/Sparc.burg.in index a5bc98fa899..38dc2439ce8 100644 --- a/llvm/lib/Target/Sparc/Sparc.burg.in +++ b/llvm/lib/Target/Sparc/Sparc.burg.in @@ -11,7 +11,7 @@ Xinclude <cstdio> Xinclude <llvm/CodeGen/InstrForest.h> -typedef InstrTreeNode* NODEPTR_TYPE; +typedef llvm::InstrTreeNode* NODEPTR_TYPE; Xdefine OP_LABEL(p) ((p)->opLabel) Xdefine LEFT_CHILD(p) ((p)->LeftChild) Xdefine RIGHT_CHILD(p) ((p)->RightChild) diff --git a/llvm/lib/Target/Sparc/Sparc.cpp b/llvm/lib/Target/Sparc/Sparc.cpp index d20fc758d0d..73f2fd81395 100644 --- a/llvm/lib/Target/Sparc/Sparc.cpp +++ b/llvm/lib/Target/Sparc/Sparc.cpp @@ -27,6 +27,8 @@ #include "llvm/Target/TargetMachineImpls.h" #include "Support/CommandLine.h" +namespace llvm { + static const unsigned ImplicitRegUseList[] = { 0 }; /* not used yet */ // Build the MachineInstruction Description Array... const TargetInstrDescriptor SparcMachineInstrDesc[] = { @@ -267,3 +269,5 @@ bool UltraSparc::addPassesToJITCompile(FunctionPassManager &PM) { return false; // success! } + +} // End llvm namespace diff --git a/llvm/lib/Target/Sparc/SparcInstrInfo.cpp b/llvm/lib/Target/Sparc/SparcInstrInfo.cpp index d92e3be9ca2..11b0c7beab5 100644 --- a/llvm/lib/Target/Sparc/SparcInstrInfo.cpp +++ b/llvm/lib/Target/Sparc/SparcInstrInfo.cpp @@ -23,6 +23,8 @@ #include "llvm/CodeGen/MachineCodeForInstruction.h" #include "llvm/CodeGen/MachineInstrBuilder.h" +namespace llvm { + static const uint32_t MAXLO = (1 << 10) - 1; // set bits set by %lo(*) static const uint32_t MAXSIMM = (1 << 12) - 1; // set bits in simm13 field of OR @@ -792,3 +794,5 @@ UltraSparcInstrInfo::CreateZeroExtensionInstructions( CreateBitExtensionInstructions(/*signExtend*/ false, target, F, srcVal, destVal, numLowBits, mvec, mcfi); } + +} // End llvm namespace diff --git a/llvm/lib/Target/Sparc/SparcInstrSelection.cpp b/llvm/lib/Target/Sparc/SparcInstrSelection.cpp index b377658b9c8..21e884be8e1 100644 --- a/llvm/lib/Target/Sparc/SparcInstrSelection.cpp +++ b/llvm/lib/Target/Sparc/SparcInstrSelection.cpp @@ -32,6 +32,8 @@ #include <algorithm> #include <cmath> +namespace llvm { + static inline void Add3OperandInstr(unsigned Opcode, InstructionNode* Node, std::vector<MachineInstr*>& mvec) { mvec.push_back(BuildMI(Opcode, 3).addReg(Node->leftChild()->getValue()) @@ -1390,12 +1392,12 @@ AllUsesAreBranches(const Instruction* setccI) // instead of a regular call. If not that kind of intrinsic, do nothing. // Returns true if code was generated, otherwise false. // -bool CodeGenIntrinsic(LLVMIntrinsic::ID iid, CallInst &callInstr, +bool CodeGenIntrinsic(Intrinsic::ID iid, CallInst &callInstr, TargetMachine &target, std::vector<MachineInstr*>& mvec) { switch (iid) { - case LLVMIntrinsic::va_start: { + case Intrinsic::va_start: { // Get the address of the first incoming vararg argument on the stack bool ignore; Function* func = cast<Function>(callInstr.getParent()->getParent()); @@ -1409,10 +1411,10 @@ bool CodeGenIntrinsic(LLVMIntrinsic::ID iid, CallInst &callInstr, return true; } - case LLVMIntrinsic::va_end: + case Intrinsic::va_end: return true; // no-op on Sparc - case LLVMIntrinsic::va_copy: + case Intrinsic::va_copy: // Simple copy of current va_list (arg1) to new va_list (result) mvec.push_back(BuildMI(V9::ORr, 3). addMReg(target.getRegInfo().getZeroRegNum()). @@ -1420,8 +1422,8 @@ bool CodeGenIntrinsic(LLVMIntrinsic::ID iid, CallInst &callInstr, addRegDef(&callInstr)); return true; - case LLVMIntrinsic::sigsetjmp: - case LLVMIntrinsic::setjmp: { + case Intrinsic::sigsetjmp: + case Intrinsic::setjmp: { // act as if we return 0 unsigned g0 = target.getRegInfo().getZeroRegNum(); mvec.push_back(BuildMI(V9::ORr,3).addMReg(g0).addMReg(g0) @@ -1429,8 +1431,8 @@ bool CodeGenIntrinsic(LLVMIntrinsic::ID iid, CallInst &callInstr, return true; } - case LLVMIntrinsic::siglongjmp: - case LLVMIntrinsic::longjmp: { + case Intrinsic::siglongjmp: + case Intrinsic::longjmp: { // call abort() Module* M = callInstr.getParent()->getParent()->getParent(); const FunctionType *voidvoidFuncTy = @@ -2474,8 +2476,8 @@ GetInstructionsByRule(InstructionNode* subtreeRoot, // sequence (e.g., va_start). Indirect calls cannot be special. // bool specialIntrinsic = false; - LLVMIntrinsic::ID iid; - if (calledFunc && (iid=(LLVMIntrinsic::ID)calledFunc->getIntrinsicID())) + Intrinsic::ID iid; + if (calledFunc && (iid=(Intrinsic::ID)calledFunc->getIntrinsicID())) specialIntrinsic = CodeGenIntrinsic(iid, *callInstr, target, mvec); // If not, generate the normal call sequence for the function. @@ -2929,3 +2931,5 @@ GetInstructionsByRule(InstructionNode* subtreeRoot, } } } + +} diff --git a/llvm/lib/Target/Sparc/SparcInstrSelectionSupport.h b/llvm/lib/Target/Sparc/SparcInstrSelectionSupport.h index d49863c1c84..b69c5c2b6e4 100644 --- a/llvm/lib/Target/Sparc/SparcInstrSelectionSupport.h +++ b/llvm/lib/Target/Sparc/SparcInstrSelectionSupport.h @@ -17,6 +17,8 @@ #include "llvm/DerivedTypes.h" #include "SparcInternals.h" +namespace llvm { + // Choose load instruction opcode based on type of value inline MachineOpCode ChooseLoadInstruction(const Type *DestTy) @@ -220,4 +222,6 @@ convertOpcodeFromRegToImm(unsigned Opcode) { } } +} // End llvm namespace + #endif diff --git a/llvm/lib/Target/Sparc/SparcInternals.h b/llvm/lib/Target/Sparc/SparcInternals.h index 4d0a48e4d5d..5e5f155e399 100644 --- a/llvm/lib/Target/Sparc/SparcInternals.h +++ b/llvm/lib/Target/Sparc/SparcInternals.h @@ -25,6 +25,8 @@ #include "SparcRegClassInfo.h" #include "Config/sys/types.h" +namespace llvm { + class LiveRange; class UltraSparc; class Pass; @@ -693,4 +695,6 @@ public: Pass* getBytecodeAsmPrinterPass(std::ostream &Out); }; +} // End llvm namespace + #endif diff --git a/llvm/lib/Target/Sparc/SparcRegClassInfo.cpp b/llvm/lib/Target/Sparc/SparcRegClassInfo.cpp index d6de5f9c0df..564e59cd70e 100644 --- a/llvm/lib/Target/Sparc/SparcRegClassInfo.cpp +++ b/llvm/lib/Target/Sparc/SparcRegClassInfo.cpp @@ -17,6 +17,8 @@ #include "../../CodeGen/RegAlloc/RegAllocCommon.h" // FIXME! #include "../../CodeGen/RegAlloc/IGNode.h" // FIXME! +namespace llvm { + //----------------------------------------------------------------------------- // Int Register Class - method for coloring a node in the interference graph. // @@ -390,3 +392,5 @@ int SparcFloatRegClass::findFloatColor(const LiveRange *LR, return -1; } + +} // End llvm namespace diff --git a/llvm/lib/Target/Sparc/SparcRegClassInfo.h b/llvm/lib/Target/Sparc/SparcRegClassInfo.h index 321ce60ab0f..cc492e77c72 100644 --- a/llvm/lib/Target/Sparc/SparcRegClassInfo.h +++ b/llvm/lib/Target/Sparc/SparcRegClassInfo.h @@ -16,6 +16,8 @@ #include "llvm/Target/TargetRegInfo.h" +namespace llvm { + //----------------------------------------------------------------------------- // Integer Register Class //----------------------------------------------------------------------------- @@ -217,4 +219,6 @@ struct SparcSpecialRegClass : public TargetRegClassInfo { const char * const getRegName(unsigned reg) const; }; +} // End llvm namespace + #endif diff --git a/llvm/lib/Target/Sparc/SparcRegInfo.cpp b/llvm/lib/Target/Sparc/SparcRegInfo.cpp index 84dc92e246d..5edbbe06470 100644 --- a/llvm/lib/Target/Sparc/SparcRegInfo.cpp +++ b/llvm/lib/Target/Sparc/SparcRegInfo.cpp @@ -27,6 +27,8 @@ #include "llvm/Function.h" #include "llvm/DerivedTypes.h" +namespace llvm { + enum { BadRegClass = ~0 }; @@ -967,3 +969,5 @@ void UltraSparcRegInfo::printReg(const LiveRange *LR) const { std::cerr << "+" << getUnifiedRegName(uRegName+1); std::cerr << "]\n"; } + +} // End llvm namespace diff --git a/llvm/lib/Target/Sparc/SparcV9CodeEmitter.cpp b/llvm/lib/Target/Sparc/SparcV9CodeEmitter.cpp index d60d9151c1c..c50dca55e78 100644 --- a/llvm/lib/Target/Sparc/SparcV9CodeEmitter.cpp +++ b/llvm/lib/Target/Sparc/SparcV9CodeEmitter.cpp @@ -38,6 +38,8 @@ #include "SparcV9CodeEmitter.h" #include "Config/alloca.h" +namespace llvm { + namespace { Statistic<> OverwrittenCalls("call-ovwr", "Number of over-written calls"); Statistic<> UnmodifiedCalls("call-skip", "Number of unmodified calls"); @@ -443,7 +445,6 @@ uint64_t JITResolver::emitStubForFunction(Function *F) { return (intptr_t)MCE.finishFunctionStub(*F)+4; /* 1 instr past the restore */ } - SparcV9CodeEmitter::SparcV9CodeEmitter(TargetMachine &tm, MachineCodeEmitter &M): TM(tm), MCE(M) { @@ -809,4 +810,6 @@ void* SparcV9CodeEmitter::getGlobalAddress(GlobalValue *V, MachineInstr &MI, } } +} // End llvm namespace + #include "SparcV9CodeEmitter.inc" diff --git a/llvm/lib/Target/Sparc/SparcV9CodeEmitter.h b/llvm/lib/Target/Sparc/SparcV9CodeEmitter.h index 7e19c44ce03..d21345ec041 100644 --- a/llvm/lib/Target/Sparc/SparcV9CodeEmitter.h +++ b/llvm/lib/Target/Sparc/SparcV9CodeEmitter.h @@ -19,6 +19,8 @@ #include "llvm/CodeGen/MachineFunctionPass.h" #include "llvm/Target/TargetMachine.h" +namespace llvm { + class GlobalValue; class MachineInstr; class MachineOperand; @@ -81,4 +83,6 @@ private: }; +} // End llvm namespace + #endif diff --git a/llvm/lib/Target/Sparc/StackSlots.cpp b/llvm/lib/Target/Sparc/StackSlots.cpp index 551dd92b495..5fd0ba19271 100644 --- a/llvm/lib/Target/Sparc/StackSlots.cpp +++ b/llvm/lib/Target/Sparc/StackSlots.cpp @@ -20,6 +20,8 @@ #include "llvm/CodeGen/MachineFunctionInfo.h" #include "llvm/CodeGen/MachineFunctionPass.h" +namespace llvm { + namespace { class StackSlots : public MachineFunctionPass { const TargetMachine &Target; @@ -48,3 +50,5 @@ namespace { Pass *createStackSlotsPass(const TargetMachine &Target) { return new StackSlots(Target); } + +} // End llvm namespace diff --git a/llvm/lib/Target/Sparc/UltraSparcSchedInfo.cpp b/llvm/lib/Target/Sparc/UltraSparcSchedInfo.cpp index fd03ad69d67..7d8ea05066c 100644 --- a/llvm/lib/Target/Sparc/UltraSparcSchedInfo.cpp +++ b/llvm/lib/Target/Sparc/UltraSparcSchedInfo.cpp @@ -13,6 +13,8 @@ #include "SparcInternals.h" +using namespace llvm; + /*--------------------------------------------------------------------------- Scheduling guidelines for SPARC IIi: diff --git a/llvm/lib/Target/TargetData.cpp b/llvm/lib/Target/TargetData.cpp index a377fd0d7f9..ed6936dd122 100644 --- a/llvm/lib/Target/TargetData.cpp +++ b/llvm/lib/Target/TargetData.cpp @@ -22,13 +22,14 @@ #include "llvm/DerivedTypes.h" #include "llvm/Constants.h" +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"); } - static inline void getTypeInfo(const Type *Ty, const TargetData *TD, uint64_t &Size, unsigned char &Alignment); @@ -221,3 +222,5 @@ uint64_t TargetData::getIndexedOffset(const Type *ptrTy, return Result; } + +} // End llvm namespace diff --git a/llvm/lib/Target/TargetInstrInfo.cpp b/llvm/lib/Target/TargetInstrInfo.cpp index f377d67b66f..0f9015f8a60 100644 --- a/llvm/lib/Target/TargetInstrInfo.cpp +++ b/llvm/lib/Target/TargetInstrInfo.cpp @@ -15,6 +15,8 @@ #include "llvm/Constant.h" #include "llvm/DerivedTypes.h" +namespace llvm { + // External object describing the machine instructions // Initialized only when the TargetMachine class is created // and reset when that class is destroyed. @@ -59,3 +61,5 @@ bool TargetInstrInfo::ConstantTypeMustBeLoaded(const Constant* CV) const { assert(CV->getType()->isPrimitiveType() || isa<PointerType>(CV->getType())); return !(CV->getType()->isIntegral() || isa<PointerType>(CV->getType())); } + +} // End llvm namespace diff --git a/llvm/lib/Target/TargetMachine.cpp b/llvm/lib/Target/TargetMachine.cpp index b7c1b342e12..e7630b4ab34 100644 --- a/llvm/lib/Target/TargetMachine.cpp +++ b/llvm/lib/Target/TargetMachine.cpp @@ -16,6 +16,8 @@ #include "llvm/Target/TargetCacheInfo.h" #include "llvm/Type.h" +namespace llvm { + //--------------------------------------------------------------------------- // class TargetMachine // @@ -49,3 +51,5 @@ void TargetCacheInfo::Initialize() { cacheSizes.push_back(1 << 15); cacheSizes.push_back(1 << 20); cacheAssoc.push_back(1); cacheAssoc.push_back(4); } + +} // End llvm namespace diff --git a/llvm/lib/Target/TargetSchedInfo.cpp b/llvm/lib/Target/TargetSchedInfo.cpp index 0dbde45c38e..f33223c43a6 100644 --- a/llvm/lib/Target/TargetSchedInfo.cpp +++ b/llvm/lib/Target/TargetSchedInfo.cpp @@ -15,6 +15,8 @@ #include "llvm/Target/TargetSchedInfo.h" #include "llvm/Target/TargetMachine.h" +namespace llvm { + resourceId_t MachineResource::nextId = 0; // Check if fromRVec and toRVec have *any* common entries. @@ -249,3 +251,5 @@ void InstrRUsage::addUsageDelta(const InstrRUsageDelta &delta) { assert(r >= 0 && "Resource to remove was unused in cycle c!"); } } + +} // End llvm namespace diff --git a/llvm/lib/Target/X86/FloatingPoint.cpp b/llvm/lib/Target/X86/FloatingPoint.cpp index 07e58ba171c..5c6e6ebfdde 100644 --- a/llvm/lib/Target/X86/FloatingPoint.cpp +++ b/llvm/lib/Target/X86/FloatingPoint.cpp @@ -25,6 +25,8 @@ #include <algorithm> #include <iostream> +namespace llvm { + namespace { Statistic<> NumFXCH("x86-codegen", "Number of fxch instructions inserted"); Statistic<> NumFP ("x86-codegen", "Number of floating point instructions"); @@ -70,7 +72,7 @@ namespace { // getSTReg - Return the X86::ST(i) register which contains the specified // FP<RegNo> register unsigned getSTReg(unsigned RegNo) const { - return StackTop - 1 - getSlot(RegNo) + X86::ST0; + return StackTop - 1 - getSlot(RegNo) + llvm::X86::ST0; } // pushReg - Push the specifiex FP<n> register onto the stack @@ -598,3 +600,5 @@ void FPS::handleSpecialFP(MachineBasicBlock::iterator &I) { I = MBB->erase(I)-1; // Remove the pseudo instruction } + +} // End llvm namespace diff --git a/llvm/lib/Target/X86/InstSelectPattern.cpp b/llvm/lib/Target/X86/InstSelectPattern.cpp index 434ceee91c6..e5182945646 100644 --- a/llvm/lib/Target/X86/InstSelectPattern.cpp +++ b/llvm/lib/Target/X86/InstSelectPattern.cpp @@ -28,6 +28,8 @@ // Include the generated instruction selector... #include "X86GenInstrSelector.inc" +namespace llvm { + namespace { struct ISel : public FunctionPass, SelectionDAGTargetBuilder { TargetMachine &TM; @@ -114,7 +116,6 @@ void ISel::expandCall(SelectionDAG &SD, CallInst &CI) { assert(0 && "ISel::expandCall not implemented!"); } - /// createX86PatternInstructionSelector - This pass converts an LLVM function /// into a machine code representation using pattern matching and a machine /// description file. @@ -122,3 +123,5 @@ void ISel::expandCall(SelectionDAG &SD, CallInst &CI) { FunctionPass *createX86PatternInstructionSelector(TargetMachine &TM) { return new ISel(TM); } + +} // End llvm namespace diff --git a/llvm/lib/Target/X86/InstSelectSimple.cpp b/llvm/lib/Target/X86/InstSelectSimple.cpp index 1242545d83a..de341c477dc 100644 --- a/llvm/lib/Target/X86/InstSelectSimple.cpp +++ b/llvm/lib/Target/X86/InstSelectSimple.cpp @@ -29,6 +29,8 @@ #include "llvm/Target/TargetMachine.h" #include "llvm/Support/InstVisitor.h" +namespace llvm { + /// BMI - A special BuildMI variant that takes an iterator to insert the /// instruction at as well as a basic block. This is the version for when you /// have a destination register in mind. @@ -138,7 +140,7 @@ namespace { void doCall(const ValueRecord &Ret, MachineInstr *CallMI, const std::vector<ValueRecord> &Args); void visitCallInst(CallInst &I); - void visitIntrinsicCall(LLVMIntrinsic::ID ID, CallInst &I); + void visitIntrinsicCall(Intrinsic::ID ID, CallInst &I); // Arithmetic operators void visitSimpleBinary(BinaryOperator &B, unsigned OpcodeClass); @@ -1045,7 +1047,7 @@ void ISel::visitCallInst(CallInst &CI) { MachineInstr *TheCall; if (Function *F = CI.getCalledFunction()) { // Is it an intrinsic function call? - if (LLVMIntrinsic::ID ID = (LLVMIntrinsic::ID)F->getIntrinsicID()) { + if (Intrinsic::ID ID = (Intrinsic::ID)F->getIntrinsicID()) { visitIntrinsicCall(ID, CI); // Special intrinsics are not handled here return; } @@ -1066,29 +1068,29 @@ void ISel::visitCallInst(CallInst &CI) { } -void ISel::visitIntrinsicCall(LLVMIntrinsic::ID ID, CallInst &CI) { +void ISel::visitIntrinsicCall(Intrinsic::ID ID, CallInst &CI) { unsigned TmpReg1, TmpReg2; switch (ID) { - case LLVMIntrinsic::va_start: + case Intrinsic::va_start: // Get the address of the first vararg value... TmpReg1 = getReg(CI); addFrameReference(BuildMI(BB, X86::LEAr32, 5, TmpReg1), VarArgsFrameIndex); return; - case LLVMIntrinsic::va_copy: + case Intrinsic::va_copy: TmpReg1 = getReg(CI); TmpReg2 = getReg(CI.getOperand(1)); BuildMI(BB, X86::MOVrr32, 1, TmpReg1).addReg(TmpReg2); return; - case LLVMIntrinsic::va_end: return; // Noop on X86 + case Intrinsic::va_end: return; // Noop on X86 - case LLVMIntrinsic::longjmp: - case LLVMIntrinsic::siglongjmp: + case Intrinsic::longjmp: + case Intrinsic::siglongjmp: BuildMI(BB, X86::CALLpcrel32, 1).addExternalSymbol("abort", true); return; - case LLVMIntrinsic::setjmp: - case LLVMIntrinsic::sigsetjmp: + case Intrinsic::setjmp: + case Intrinsic::sigsetjmp: // Setjmp always returns zero... BuildMI(BB, X86::MOVir32, 1, getReg(CI)).addZImm(0); return; @@ -2127,7 +2129,6 @@ void ISel::visitFreeInst(FreeInst &I) { doCall(ValueRecord(0, Type::VoidTy), TheCall, Args); } - /// createX86SimpleInstructionSelector - This pass converts an LLVM function /// into a machine code representation is a very simple peep-hole fashion. The /// generated code sucks but the implementation is nice and simple. @@ -2135,3 +2136,5 @@ void ISel::visitFreeInst(FreeInst &I) { FunctionPass *createX86SimpleInstructionSelector(TargetMachine &TM) { return new ISel(TM); } + +} // End llvm namespace diff --git a/llvm/lib/Target/X86/PeepholeOptimizer.cpp b/llvm/lib/Target/X86/PeepholeOptimizer.cpp index fbc84f7e871..2f3280a4bbb 100644 --- a/llvm/lib/Target/X86/PeepholeOptimizer.cpp +++ b/llvm/lib/Target/X86/PeepholeOptimizer.cpp @@ -15,6 +15,8 @@ #include "llvm/CodeGen/MachineFunctionPass.h" #include "llvm/CodeGen/MachineInstrBuilder.h" +namespace llvm { + namespace { struct PH : public MachineFunctionPass { virtual bool runOnMachineFunction(MachineFunction &MF); @@ -131,3 +133,5 @@ bool PH::PeepholeOptimize(MachineBasicBlock &MBB, return false; } } + +} // End llvm namespace diff --git a/llvm/lib/Target/X86/Printer.cpp b/llvm/lib/Target/X86/Printer.cpp index 3d073f77c65..292a465e725 100644 --- a/llvm/lib/Target/X86/Printer.cpp +++ b/llvm/lib/Target/X86/Printer.cpp @@ -29,6 +29,8 @@ #include "Support/StringExtras.h" #include "Support/CommandLine.h" +namespace llvm { + namespace { Statistic<> EmittedInsts("asm-printer", "Number of machine instrs printed"); @@ -960,3 +962,5 @@ bool Printer::doFinalization(Module &M) { delete Mang; return false; // success } + +} // End llvm namespace diff --git a/llvm/lib/Target/X86/X86.h b/llvm/lib/Target/X86/X86.h index 01041f8d3a8..5cf897fa715 100644 --- a/llvm/lib/Target/X86/X86.h +++ b/llvm/lib/Target/X86/X86.h @@ -16,6 +16,9 @@ #define TARGET_X86_H #include <iosfwd> + +namespace llvm { + class TargetMachine; class FunctionPass; @@ -58,6 +61,8 @@ FunctionPass *createEmitX86CodeToMemory(); // Defines symbolic names for X86 registers. This defines a mapping from // register name to register number. // +} // End llvm namespace + #include "X86GenRegisterNames.inc" // Defines symbolic names for the X86 instructions. diff --git a/llvm/lib/Target/X86/X86CodeEmitter.cpp b/llvm/lib/Target/X86/X86CodeEmitter.cpp index f49fde58d20..e24e2904b51 100644 --- a/llvm/lib/Target/X86/X86CodeEmitter.cpp +++ b/llvm/lib/Target/X86/X86CodeEmitter.cpp @@ -24,6 +24,8 @@ #include "Support/Statistic.h" #include "Config/alloca.h" +namespace llvm { + namespace { Statistic<> NumEmitted("x86-emitter", "Number of machine instructions emitted"); @@ -589,3 +591,5 @@ void Emitter::emitInstruction(MachineInstr &MI) { break; } } + +} // End llvm namespace diff --git a/llvm/lib/Target/X86/X86InstrBuilder.h b/llvm/lib/Target/X86/X86InstrBuilder.h index a6d65d47495..a5643bdbfb6 100644 --- a/llvm/lib/Target/X86/X86InstrBuilder.h +++ b/llvm/lib/Target/X86/X86InstrBuilder.h @@ -26,6 +26,8 @@ #include "llvm/CodeGen/MachineInstrBuilder.h" +namespace llvm { + /// addDirectMem - This function is used to add a direct memory reference to the /// current instruction -- that is, a dereference of an address in a register, /// with no scale, index or displacement. An example is: DWORD PTR [EAX]. @@ -69,4 +71,6 @@ addConstantPoolReference(const MachineInstrBuilder &MIB, unsigned CPI, return MIB.addConstantPoolIndex(CPI).addZImm(1).addReg(0).addSImm(Offset); } +} // End llvm namespace + #endif diff --git a/llvm/lib/Target/X86/X86InstrInfo.cpp b/llvm/lib/Target/X86/X86InstrInfo.cpp index 012ceadff0b..681bf023d99 100644 --- a/llvm/lib/Target/X86/X86InstrInfo.cpp +++ b/llvm/lib/Target/X86/X86InstrInfo.cpp @@ -17,6 +17,8 @@ #include "X86GenInstrInfo.inc" +using namespace llvm; + X86InstrInfo::X86InstrInfo() : TargetInstrInfo(X86Insts, sizeof(X86Insts)/sizeof(X86Insts[0]), 0) { } diff --git a/llvm/lib/Target/X86/X86InstrInfo.h b/llvm/lib/Target/X86/X86InstrInfo.h index 26b2618a01f..2bf82d16c63 100644 --- a/llvm/lib/Target/X86/X86InstrInfo.h +++ b/llvm/lib/Target/X86/X86InstrInfo.h @@ -17,6 +17,8 @@ #include "llvm/Target/TargetInstrInfo.h" #include "X86RegisterInfo.h" +namespace llvm { + /// X86II - This namespace holds all of the target specific flags that /// instruction info tracks. /// @@ -181,4 +183,6 @@ public: } }; +} // End llvm namespace + #endif diff --git a/llvm/lib/Target/X86/X86RegisterInfo.cpp b/llvm/lib/Target/X86/X86RegisterInfo.cpp index fd8a615e316..0e8b889ad8d 100644 --- a/llvm/lib/Target/X86/X86RegisterInfo.cpp +++ b/llvm/lib/Target/X86/X86RegisterInfo.cpp @@ -25,6 +25,8 @@ #include "llvm/Target/TargetFrameInfo.h" #include "Support/CommandLine.h" +namespace llvm { + namespace { cl::opt<bool> NoFPElim("disable-fp-elim", @@ -253,8 +255,12 @@ int X86RegisterInfo::emitEpilogue(MachineFunction &MF, return MBB.size() - oldSize; } +} // End llvm namespace + #include "X86GenRegisterInfo.inc" +namespace llvm { + const TargetRegisterClass* X86RegisterInfo::getRegClassForType(const Type* Ty) const { switch (Ty->getPrimitiveID()) { @@ -274,3 +280,5 @@ X86RegisterInfo::getRegClassForType(const Type* Ty) const { case Type::DoubleTyID: return &RFPInstance; } } + +} // End llvm namespace diff --git a/llvm/lib/Target/X86/X86RegisterInfo.h b/llvm/lib/Target/X86/X86RegisterInfo.h index 0db8e18bee1..77a8a1a4053 100644 --- a/llvm/lib/Target/X86/X86RegisterInfo.h +++ b/llvm/lib/Target/X86/X86RegisterInfo.h @@ -16,10 +16,12 @@ #include "llvm/Target/MRegisterInfo.h" -class Type; +class llvm::Type; #include "X86GenRegisterInfo.h.inc" +namespace llvm { + struct X86RegisterInfo : public X86GenRegisterInfo { X86RegisterInfo(); const TargetRegisterClass* getRegClassForType(const Type* Ty) const; @@ -52,4 +54,6 @@ struct X86RegisterInfo : public X86GenRegisterInfo { int emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const; }; +} // End llvm namespace + #endif diff --git a/llvm/lib/Target/X86/X86TargetMachine.cpp b/llvm/lib/Target/X86/X86TargetMachine.cpp index 954d4f4ced6..31eb4bd61c2 100644 --- a/llvm/lib/Target/X86/X86TargetMachine.cpp +++ b/llvm/lib/Target/X86/X86TargetMachine.cpp @@ -22,6 +22,8 @@ #include "Support/CommandLine.h" #include "Support/Statistic.h" +namespace llvm { + namespace { cl::opt<bool> PrintCode("print-machineinstrs", cl::desc("Print generated machine code")); @@ -153,3 +155,5 @@ void X86TargetMachine::replaceMachineCodeForFunction (void *Old, void *New) { int32_t OldAddr = (intptr_t) OldWord; *OldWord = NewAddr - OldAddr - 4; // Emit PC-relative addr of New code. } + +} // End llvm namespace diff --git a/llvm/lib/Target/X86/X86TargetMachine.h b/llvm/lib/Target/X86/X86TargetMachine.h index 5581da4d818..12f5c0e6a22 100644 --- a/llvm/lib/Target/X86/X86TargetMachine.h +++ b/llvm/lib/Target/X86/X86TargetMachine.h @@ -19,6 +19,8 @@ #include "llvm/PassManager.h" #include "X86InstrInfo.h" +namespace llvm { + class X86TargetMachine : public TargetMachine { X86InstrInfo InstrInfo; TargetFrameInfo FrameInfo; @@ -55,4 +57,6 @@ public: virtual void replaceMachineCodeForFunction (void *Old, void *New); }; +} // End llvm namespace + #endif diff --git a/llvm/lib/Transforms/ExprTypeConvert.cpp b/llvm/lib/Transforms/ExprTypeConvert.cpp index d3e9287de47..970be52aa41 100644 --- a/llvm/lib/Transforms/ExprTypeConvert.cpp +++ b/llvm/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/llvm/lib/Transforms/Hello/Hello.cpp b/llvm/lib/Transforms/Hello/Hello.cpp index a71bd342888..4ed281a40af 100644 --- a/llvm/lib/Transforms/Hello/Hello.cpp +++ b/llvm/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/llvm/lib/Transforms/IPO/ConstantMerge.cpp b/llvm/lib/Transforms/IPO/ConstantMerge.cpp index a4526820e61..498cd7bb142 100644 --- a/llvm/lib/Transforms/IPO/ConstantMerge.cpp +++ b/llvm/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/llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp b/llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp index 9003f8877f7..197710d6502 100644 --- a/llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp +++ b/llvm/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/llvm/lib/Transforms/IPO/DeadTypeElimination.cpp b/llvm/lib/Transforms/IPO/DeadTypeElimination.cpp index c3eb4160029..126991d3e69 100644 --- a/llvm/lib/Transforms/IPO/DeadTypeElimination.cpp +++ b/llvm/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/llvm/lib/Transforms/IPO/ExtractFunction.cpp b/llvm/lib/Transforms/IPO/ExtractFunction.cpp index 1656c512dde..c1ae2d45e45 100644 --- a/llvm/lib/Transforms/IPO/ExtractFunction.cpp +++ b/llvm/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/llvm/lib/Transforms/IPO/FunctionResolution.cpp b/llvm/lib/Transforms/IPO/FunctionResolution.cpp index a21853d207e..2a366c84cd6 100644 --- a/llvm/lib/Transforms/IPO/FunctionResolution.cpp +++ b/llvm/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/llvm/lib/Transforms/IPO/GlobalDCE.cpp b/llvm/lib/Transforms/IPO/GlobalDCE.cpp index dc400269e60..8e7920dc1b6 100644 --- a/llvm/lib/Transforms/IPO/GlobalDCE.cpp +++ b/llvm/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/llvm/lib/Transforms/IPO/IPConstantPropagation.cpp b/llvm/lib/Transforms/IPO/IPConstantPropagation.cpp index b592138b088..b0135d15311 100644 --- a/llvm/lib/Transforms/IPO/IPConstantPropagation.cpp +++ b/llvm/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/llvm/lib/Transforms/IPO/InlineSimple.cpp b/llvm/lib/Transforms/IPO/InlineSimple.cpp index 169e57745ac..715f4462b29 100644 --- a/llvm/lib/Transforms/IPO/InlineSimple.cpp +++ b/llvm/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/llvm/lib/Transforms/IPO/Inliner.cpp b/llvm/lib/Transforms/IPO/Inliner.cpp index 8ad72ab9a17..bd1bd8370f7 100644 --- a/llvm/lib/Transforms/IPO/Inliner.cpp +++ b/llvm/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/llvm/lib/Transforms/IPO/Inliner.h b/llvm/lib/Transforms/IPO/Inliner.h index 1f3d0d2dc22..805876c54d6 100644 --- a/llvm/lib/Transforms/IPO/Inliner.h +++ b/llvm/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/llvm/lib/Transforms/IPO/Internalize.cpp b/llvm/lib/Transforms/IPO/Internalize.cpp index 92d389a33d0..574c8bf268f 100644 --- a/llvm/lib/Transforms/IPO/Internalize.cpp +++ b/llvm/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/llvm/lib/Transforms/IPO/LowerSetJmp.cpp b/llvm/lib/Transforms/IPO/LowerSetJmp.cpp index abbc2c92c47..276523b00b7 100644 --- a/llvm/lib/Transforms/IPO/LowerSetJmp.cpp +++ b/llvm/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/llvm/lib/Transforms/IPO/MutateStructTypes.cpp b/llvm/lib/Transforms/IPO/MutateStructTypes.cpp index dfaf8a89c6d..41835adb487 100644 --- a/llvm/lib/Transforms/IPO/MutateStructTypes.cpp +++ b/llvm/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/llvm/lib/Transforms/IPO/Parallelize.cpp b/llvm/lib/Transforms/IPO/Parallelize.cpp index 77e6ed30408..fd39b6b12a5 100644 --- a/llvm/lib/Transforms/IPO/Parallelize.cpp +++ b/llvm/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/llvm/lib/Transforms/IPO/PruneEH.cpp b/llvm/lib/Transforms/IPO/PruneEH.cpp index b377a8befe8..30e2514872e 100644 --- a/llvm/lib/Transforms/IPO/PruneEH.cpp +++ b/llvm/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/llvm/lib/Transforms/IPO/RaiseAllocations.cpp b/llvm/lib/Transforms/IPO/RaiseAllocations.cpp index 81abda00067..fd5b7fb1f13 100644 --- a/llvm/lib/Transforms/IPO/RaiseAllocations.cpp +++ b/llvm/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/llvm/lib/Transforms/IPO/SimpleStructMutation.cpp b/llvm/lib/Transforms/IPO/SimpleStructMutation.cpp index 012fa227702..0c7091696e4 100644 --- a/llvm/lib/Transforms/IPO/SimpleStructMutation.cpp +++ b/llvm/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/llvm/lib/Transforms/Instrumentation/BlockProfiling.cpp b/llvm/lib/Transforms/Instrumentation/BlockProfiling.cpp index c371a9fa694..90ef14df7ec 100644 --- a/llvm/lib/Transforms/Instrumentation/BlockProfiling.cpp +++ b/llvm/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/llvm/lib/Transforms/Instrumentation/EmitFunctions.cpp b/llvm/lib/Transforms/Instrumentation/EmitFunctions.cpp index 9c395a9c1f6..57254b90800 100644 --- a/llvm/lib/Transforms/Instrumentation/EmitFunctions.cpp +++ b/llvm/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/llvm/lib/Transforms/Instrumentation/ProfilePaths/CombineBranch.cpp b/llvm/lib/Transforms/Instrumentation/ProfilePaths/CombineBranch.cpp index 6c7bb5f3601..04207820a53 100644 --- a/llvm/lib/Transforms/Instrumentation/ProfilePaths/CombineBranch.cpp +++ b/llvm/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/llvm/lib/Transforms/Instrumentation/ProfilePaths/EdgeCode.cpp b/llvm/lib/Transforms/Instrumentation/ProfilePaths/EdgeCode.cpp index 6a7f50e333a..3cb5698a11b 100644 --- a/llvm/lib/Transforms/Instrumentation/ProfilePaths/EdgeCode.cpp +++ b/llvm/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/llvm/lib/Transforms/Instrumentation/ProfilePaths/Graph.cpp b/llvm/lib/Transforms/Instrumentation/ProfilePaths/Graph.cpp index cae699a8d6e..d69c4c3b4ce 100644 --- a/llvm/lib/Transforms/Instrumentation/ProfilePaths/Graph.cpp +++ b/llvm/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/llvm/lib/Transforms/Instrumentation/ProfilePaths/Graph.h b/llvm/lib/Transforms/Instrumentation/ProfilePaths/Graph.h index 5597b599e06..44b63a91ea9 100644 --- a/llvm/lib/Transforms/Instrumentation/ProfilePaths/Graph.h +++ b/llvm/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/llvm/lib/Transforms/Instrumentation/ProfilePaths/GraphAuxiliary.cpp b/llvm/lib/Transforms/Instrumentation/ProfilePaths/GraphAuxiliary.cpp index 66b8ccd6c44..d9dc011cd5e 100644 --- a/llvm/lib/Transforms/Instrumentation/ProfilePaths/GraphAuxiliary.cpp +++ b/llvm/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/llvm/lib/Transforms/Instrumentation/ProfilePaths/InstLoops.cpp b/llvm/lib/Transforms/Instrumentation/ProfilePaths/InstLoops.cpp index b5e9d8c30cc..9d6107cd2d2 100644 --- a/llvm/lib/Transforms/Instrumentation/ProfilePaths/InstLoops.cpp +++ b/llvm/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/llvm/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp b/llvm/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp index d4973be25eb..5728265f427 100644 --- a/llvm/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp +++ b/llvm/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/llvm/lib/Transforms/Instrumentation/ProfilePaths/RetracePath.cpp b/llvm/lib/Transforms/Instrumentation/ProfilePaths/RetracePath.cpp index 58b3840587b..cbb2ae6aee5 100644 --- a/llvm/lib/Transforms/Instrumentation/ProfilePaths/RetracePath.cpp +++ b/llvm/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/llvm/lib/Transforms/Instrumentation/TraceValues.cpp b/llvm/lib/Transforms/Instrumentation/TraceValues.cpp index f19ba74000d..c802f736046 100644 --- a/llvm/lib/Transforms/Instrumentation/TraceValues.cpp +++ b/llvm/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/llvm/lib/Transforms/LevelRaise.cpp b/llvm/lib/Transforms/LevelRaise.cpp index cf64aea1cdd..c5be82fca7b 100644 --- a/llvm/lib/Transforms/LevelRaise.cpp +++ b/llvm/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/llvm/lib/Transforms/Scalar/ADCE.cpp b/llvm/lib/Transforms/Scalar/ADCE.cpp index 2735f95d89f..e45b2731908 100644 --- a/llvm/lib/Transforms/Scalar/ADCE.cpp +++ b/llvm/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/llvm/lib/Transforms/Scalar/ConstantProp.cpp b/llvm/lib/Transforms/Scalar/ConstantProp.cpp index ceef34e54ec..66e78960f78 100644 --- a/llvm/lib/Transforms/Scalar/ConstantProp.cpp +++ b/llvm/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/llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp b/llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp index aad9b7f3096..a0358b54ad2 100644 --- a/llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp +++ b/llvm/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/llvm/lib/Transforms/Scalar/DCE.cpp b/llvm/lib/Transforms/Scalar/DCE.cpp index e3fc8de396c..3e63cadd3e5 100644 --- a/llvm/lib/Transforms/Scalar/DCE.cpp +++ b/llvm/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/llvm/lib/Transforms/Scalar/DecomposeMultiDimRefs.cpp b/llvm/lib/Transforms/Scalar/DecomposeMultiDimRefs.cpp index d6aee14f240..e110cdac8b7 100644 --- a/llvm/lib/Transforms/Scalar/DecomposeMultiDimRefs.cpp +++ b/llvm/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/llvm/lib/Transforms/Scalar/GCSE.cpp b/llvm/lib/Transforms/Scalar/GCSE.cpp index e1654e5d7f3..b00d3005bfa 100644 --- a/llvm/lib/Transforms/Scalar/GCSE.cpp +++ b/llvm/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/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp b/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp index 1744fe41b2d..0777a1e09fd 100644 --- a/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp +++ b/llvm/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/llvm/lib/Transforms/Scalar/InstructionCombining.cpp b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp index 07736b57c2d..8522b610e13 100644 --- a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/llvm/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/llvm/lib/Transforms/Scalar/LICM.cpp b/llvm/lib/Transforms/Scalar/LICM.cpp index 0f582c1feba..be635dff35b 100644 --- a/llvm/lib/Transforms/Scalar/LICM.cpp +++ b/llvm/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/llvm/lib/Transforms/Scalar/LoopSimplify.cpp b/llvm/lib/Transforms/Scalar/LoopSimplify.cpp index a1f86486b53..b999ed40cc9 100644 --- a/llvm/lib/Transforms/Scalar/LoopSimplify.cpp +++ b/llvm/lib/Transforms/Scalar/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/llvm/lib/Transforms/Scalar/LowerAllocations.cpp b/llvm/lib/Transforms/Scalar/LowerAllocations.cpp index 96008881bba..eea800ad547 100644 --- a/llvm/lib/Transforms/Scalar/LowerAllocations.cpp +++ b/llvm/lib/Transforms/Scalar/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/llvm/lib/Transforms/Scalar/LowerInvoke.cpp b/llvm/lib/Transforms/Scalar/LowerInvoke.cpp index 4885d96f19f..ec97ca20409 100644 --- a/llvm/lib/Transforms/Scalar/LowerInvoke.cpp +++ b/llvm/lib/Transforms/Scalar/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/llvm/lib/Transforms/Scalar/LowerSwitch.cpp b/llvm/lib/Transforms/Scalar/LowerSwitch.cpp index a45192bb0cf..1d0e47145ac 100644 --- a/llvm/lib/Transforms/Scalar/LowerSwitch.cpp +++ b/llvm/lib/Transforms/Scalar/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/llvm/lib/Transforms/Scalar/Mem2Reg.cpp b/llvm/lib/Transforms/Scalar/Mem2Reg.cpp index d915155ed4b..4d992808058 100644 --- a/llvm/lib/Transforms/Scalar/Mem2Reg.cpp +++ b/llvm/lib/Transforms/Scalar/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/llvm/lib/Transforms/Scalar/PRE.cpp b/llvm/lib/Transforms/Scalar/PRE.cpp index fad5789d5ad..770cd44d75f 100644 --- a/llvm/lib/Transforms/Scalar/PRE.cpp +++ b/llvm/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/llvm/lib/Transforms/Scalar/PiNodeInsertion.cpp b/llvm/lib/Transforms/Scalar/PiNodeInsertion.cpp index b5011af2865..89ec20e0690 100644 --- a/llvm/lib/Transforms/Scalar/PiNodeInsertion.cpp +++ b/llvm/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/llvm/lib/Transforms/Scalar/Reassociate.cpp b/llvm/lib/Transforms/Scalar/Reassociate.cpp index befdcfec774..9e22ec4e7e5 100644 --- a/llvm/lib/Transforms/Scalar/Reassociate.cpp +++ b/llvm/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/llvm/lib/Transforms/Scalar/SCCP.cpp b/llvm/lib/Transforms/Scalar/SCCP.cpp index 01e3e26ab53..44a553a01bc 100644 --- a/llvm/lib/Transforms/Scalar/SCCP.cpp +++ b/llvm/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/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp b/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp index 9342a5cf406..d29119061dc 100644 --- a/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp +++ b/llvm/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/llvm/lib/Transforms/Scalar/SimplifyCFG.cpp b/llvm/lib/Transforms/Scalar/SimplifyCFG.cpp index 224d6c5f9ae..5a8d4281538 100644 --- a/llvm/lib/Transforms/Scalar/SimplifyCFG.cpp +++ b/llvm/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/llvm/lib/Transforms/Scalar/SymbolStripping.cpp b/llvm/lib/Transforms/Scalar/SymbolStripping.cpp index 58395c55ab8..9e058e7939d 100644 --- a/llvm/lib/Transforms/Scalar/SymbolStripping.cpp +++ b/llvm/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/llvm/lib/Transforms/Scalar/TailDuplication.cpp b/llvm/lib/Transforms/Scalar/TailDuplication.cpp index d0a77658187..07a3b1e492a 100644 --- a/llvm/lib/Transforms/Scalar/TailDuplication.cpp +++ b/llvm/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/llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp b/llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp index d07f4e857ee..dbe91a79407 100644 --- a/llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp +++ b/llvm/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/llvm/lib/Transforms/TransformInternals.cpp b/llvm/lib/Transforms/TransformInternals.cpp index 3a1d51c3a02..b553f03a41b 100644 --- a/llvm/lib/Transforms/TransformInternals.cpp +++ b/llvm/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/llvm/lib/Transforms/TransformInternals.h b/llvm/lib/Transforms/TransformInternals.h index 4f92dc4eda8..3b80146a278 100644 --- a/llvm/lib/Transforms/TransformInternals.h +++ b/llvm/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/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp b/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp index 22fd555a46a..5fb54693325 100644 --- a/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp +++ b/llvm/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/llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp b/llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp index de59db2f9bc..e8201cc3915 100644 --- a/llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp +++ b/llvm/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/llvm/lib/Transforms/Utils/CloneFunction.cpp b/llvm/lib/Transforms/Utils/CloneFunction.cpp index e0312f2efb2..d8aa9aebe43 100644 --- a/llvm/lib/Transforms/Utils/CloneFunction.cpp +++ b/llvm/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/llvm/lib/Transforms/Utils/CloneModule.cpp b/llvm/lib/Transforms/Utils/CloneModule.cpp index cc22c7214a5..21a8675f07b 100644 --- a/llvm/lib/Transforms/Utils/CloneModule.cpp +++ b/llvm/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/llvm/lib/Transforms/Utils/CloneTrace.cpp b/llvm/lib/Transforms/Utils/CloneTrace.cpp index 9d995464bf8..990e54c783b 100644 --- a/llvm/lib/Transforms/Utils/CloneTrace.cpp +++ b/llvm/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/llvm/lib/Transforms/Utils/DemoteRegToStack.cpp b/llvm/lib/Transforms/Utils/DemoteRegToStack.cpp index bd605ca7890..e35dca4de03 100644 --- a/llvm/lib/Transforms/Utils/DemoteRegToStack.cpp +++ b/llvm/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/llvm/lib/Transforms/Utils/InlineFunction.cpp b/llvm/lib/Transforms/Utils/InlineFunction.cpp index 1481324330a..265d5c419ac 100644 --- a/llvm/lib/Transforms/Utils/InlineFunction.cpp +++ b/llvm/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/llvm/lib/Transforms/Utils/Linker.cpp b/llvm/lib/Transforms/Utils/Linker.cpp index 0be840fb6cd..4bc78a4cde3 100644 --- a/llvm/lib/Transforms/Utils/Linker.cpp +++ b/llvm/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/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp index 2f9b07ca945..894699596e1 100644 --- a/llvm/lib/Transforms/Utils/Local.cpp +++ b/llvm/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/llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp b/llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp index f920718c3a9..0859f699801 100644 --- a/llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp +++ b/llvm/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/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp index a5f54b1326c..158d9119ae5 100644 --- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp +++ b/llvm/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/llvm/lib/Transforms/Utils/UnifyFunctionExitNodes.cpp b/llvm/lib/Transforms/Utils/UnifyFunctionExitNodes.cpp index 180871b0937..2591ffd6d72 100644 --- a/llvm/lib/Transforms/Utils/UnifyFunctionExitNodes.cpp +++ b/llvm/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/llvm/lib/Transforms/Utils/ValueMapper.cpp b/llvm/lib/Transforms/Utils/ValueMapper.cpp index 6590498bbc1..248ebace7a5 100644 --- a/llvm/lib/Transforms/Utils/ValueMapper.cpp +++ b/llvm/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/llvm/lib/Transforms/Utils/ValueMapper.h b/llvm/lib/Transforms/Utils/ValueMapper.h index 8264ade108a..e67b3261dba 100644 --- a/llvm/lib/Transforms/Utils/ValueMapper.h +++ b/llvm/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 diff --git a/llvm/lib/VMCore/AsmWriter.cpp b/llvm/lib/VMCore/AsmWriter.cpp index c9c4dde7e85..67ccdd0f8de 100644 --- a/llvm/lib/VMCore/AsmWriter.cpp +++ b/llvm/lib/VMCore/AsmWriter.cpp @@ -33,6 +33,8 @@ #include "Support/STLExtras.h" #include <algorithm> +namespace llvm { + static RegisterPass<PrintModulePass> X("printm", "Print module to stderr",PassInfo::Analysis|PassInfo::Optimization); static RegisterPass<PrintFunctionPass> @@ -1052,3 +1054,5 @@ CachedWriter &CachedWriter::operator<<(const Value *V) { } return *this; } + +} // End llvm namespace diff --git a/llvm/lib/VMCore/BasicBlock.cpp b/llvm/lib/VMCore/BasicBlock.cpp index 2458cda2036..63a722b33e4 100644 --- a/llvm/lib/VMCore/BasicBlock.cpp +++ b/llvm/lib/VMCore/BasicBlock.cpp @@ -22,6 +22,8 @@ #include "SymbolTableListTraitsImpl.h" #include <algorithm> +namespace llvm { + // DummyInst - An instance of this class is used to mark the end of the // instruction list. This is not a real instruction. // @@ -141,7 +143,7 @@ void BasicBlock::dropAllReferences() { // bool BasicBlock::hasConstantReferences() const { for (use_const_iterator I = use_begin(), E = use_end(); I != E; ++I) - if (::isa<Constant>((Value*)*I)) + if (isa<Constant>((Value*)*I)) return true; return false; @@ -263,3 +265,5 @@ BasicBlock *BasicBlock::splitBasicBlock(iterator I, const std::string &BBName) { } return New; } + +} // End llvm namespace diff --git a/llvm/lib/VMCore/ConstantHandling.cpp b/llvm/lib/VMCore/ConstantHandling.cpp index 32b9ebba742..7fb7a05e55d 100644 --- a/llvm/lib/VMCore/ConstantHandling.cpp +++ b/llvm/lib/VMCore/ConstantHandling.cpp @@ -17,6 +17,8 @@ #include "llvm/DerivedTypes.h" #include <cmath> +namespace llvm { + AnnotationID ConstRules::AID(AnnotationManager::getID("opt::ConstRules", &ConstRules::find)); @@ -638,3 +640,5 @@ ConstRules *ConstRules::getConstantExprRules() { static EmptyRules CERules; return &CERules; } + +} // End llvm namespace diff --git a/llvm/lib/VMCore/Constants.cpp b/llvm/lib/VMCore/Constants.cpp index 28cc9d24e03..527eff54908 100644 --- a/llvm/lib/VMCore/Constants.cpp +++ b/llvm/lib/VMCore/Constants.cpp @@ -20,6 +20,8 @@ #include "Support/StringExtras.h" #include <algorithm> +namespace llvm { + ConstantBool *ConstantBool::True = new ConstantBool(true); ConstantBool *ConstantBool::False = new ConstantBool(false); @@ -1029,3 +1031,5 @@ unsigned Constant::mutateReferences(Value *OldV, Value *NewV) { return NumReplaced; } } + +} // End llvm namespace diff --git a/llvm/lib/VMCore/Dominators.cpp b/llvm/lib/VMCore/Dominators.cpp index c3bce78b5ad..cad66853c9c 100644 --- a/llvm/lib/VMCore/Dominators.cpp +++ b/llvm/lib/VMCore/Dominators.cpp @@ -20,6 +20,8 @@ #include "Support/DepthFirstIterator.h" #include "Support/SetOperations.h" +namespace llvm { + //===----------------------------------------------------------------------===// // DominatorSet Implementation //===----------------------------------------------------------------------===// @@ -358,3 +360,5 @@ void DominanceFrontierBase::print(std::ostream &o) const { o << " is:\t" << I->second << "\n"; } } + +} // End llvm namespace diff --git a/llvm/lib/VMCore/Function.cpp b/llvm/lib/VMCore/Function.cpp index f47ecea7af3..364cc6f733e 100644 --- a/llvm/lib/VMCore/Function.cpp +++ b/llvm/lib/VMCore/Function.cpp @@ -19,6 +19,8 @@ #include "Support/LeakDetector.h" #include "SymbolTableListTraitsImpl.h" +namespace llvm { + BasicBlock *ilist_traits<BasicBlock>::createNode() { BasicBlock *Ret = new BasicBlock(); // This should not be garbage monitored. @@ -158,7 +160,7 @@ void Function::dropAllReferences() { } /// getIntrinsicID - This method returns the ID number of the specified -/// function, or LLVMIntrinsic::not_intrinsic if the function is not an +/// function, or Intrinsic::not_intrinsic if the function is not an /// intrinsic, or if the pointer is null. This value is always defined to be /// zero to allow easy checking for whether a function is intrinsic or not. The /// particular intrinsic functions which correspond to this value are defined in @@ -176,21 +178,21 @@ unsigned Function::getIntrinsicID() const { std::string name; // The name of the intrinsic unsigned id; // Its ID number } alpha_intrinsics[] = { - { "llvm.alpha.ctlz", LLVMIntrinsic::alpha_ctlz }, - { "llvm.alpha.cttz", LLVMIntrinsic::alpha_cttz }, - { "llvm.alpha.ctpop", LLVMIntrinsic::alpha_ctpop }, - { "llvm.alpha.umulh", LLVMIntrinsic::alpha_umulh }, - { "llvm.alpha.vecop", LLVMIntrinsic::alpha_vecop }, - { "llvm.alpha.pup", LLVMIntrinsic::alpha_pup }, - { "llvm.alpha.bytezap", LLVMIntrinsic::alpha_bytezap }, - { "llvm.alpha.bytemanip", LLVMIntrinsic::alpha_bytemanip }, - { "llvm.alpha.dfp_bop", LLVMIntrinsic::alpha_dfpbop }, - { "llvm.alpha.dfp_uop", LLVMIntrinsic::alpha_dfpuop }, - { "llvm.alpha.unordered", LLVMIntrinsic::alpha_unordered }, - { "llvm.alpha.uqtodfp", LLVMIntrinsic::alpha_uqtodfp }, - { "llvm.alpha.uqtosfp", LLVMIntrinsic::alpha_uqtosfp }, - { "llvm.alpha.dfptosq", LLVMIntrinsic::alpha_dfptosq }, - { "llvm.alpha.sfptosq", LLVMIntrinsic::alpha_sfptosq }, + { "llvm.alpha.ctlz", Intrinsic::alpha_ctlz }, + { "llvm.alpha.cttz", Intrinsic::alpha_cttz }, + { "llvm.alpha.ctpop", Intrinsic::alpha_ctpop }, + { "llvm.alpha.umulh", Intrinsic::alpha_umulh }, + { "llvm.alpha.vecop", Intrinsic::alpha_vecop }, + { "llvm.alpha.pup", Intrinsic::alpha_pup }, + { "llvm.alpha.bytezap", Intrinsic::alpha_bytezap }, + { "llvm.alpha.bytemanip", Intrinsic::alpha_bytemanip }, + { "llvm.alpha.dfp_bop", Intrinsic::alpha_dfpbop }, + { "llvm.alpha.dfp_uop", Intrinsic::alpha_dfpuop }, + { "llvm.alpha.unordered", Intrinsic::alpha_unordered }, + { "llvm.alpha.uqtodfp", Intrinsic::alpha_uqtodfp }, + { "llvm.alpha.uqtosfp", Intrinsic::alpha_uqtosfp }, + { "llvm.alpha.dfptosq", Intrinsic::alpha_dfptosq }, + { "llvm.alpha.sfptosq", Intrinsic::alpha_sfptosq }, }; const unsigned num_alpha_intrinsics = sizeof(alpha_intrinsics) / sizeof(*alpha_intrinsics); @@ -204,17 +206,17 @@ unsigned Function::getIntrinsicID() const { return alpha_intrinsics[i].id; break; case 'l': - if (getName() == "llvm.longjmp") return LLVMIntrinsic::longjmp; + if (getName() == "llvm.longjmp") return Intrinsic::longjmp; break; case 's': - if (getName() == "llvm.setjmp") return LLVMIntrinsic::setjmp; - if (getName() == "llvm.sigsetjmp") return LLVMIntrinsic::sigsetjmp; - if (getName() == "llvm.siglongjmp") return LLVMIntrinsic::siglongjmp; + if (getName() == "llvm.setjmp") return Intrinsic::setjmp; + if (getName() == "llvm.sigsetjmp") return Intrinsic::sigsetjmp; + if (getName() == "llvm.siglongjmp") return Intrinsic::siglongjmp; break; case 'v': - if (getName() == "llvm.va_copy") return LLVMIntrinsic::va_copy; - if (getName() == "llvm.va_end") return LLVMIntrinsic::va_end; - if (getName() == "llvm.va_start") return LLVMIntrinsic::va_start; + if (getName() == "llvm.va_copy") return Intrinsic::va_copy; + if (getName() == "llvm.va_end") return Intrinsic::va_end; + if (getName() == "llvm.va_start") return Intrinsic::va_start; break; } // The "llvm." namespace is reserved! @@ -257,3 +259,5 @@ void GlobalVariable::setName(const std::string &name, SymbolTable *ST) { Value::setName(name); if (P && getName() != "") P->getSymbolTable().insert(this); } + +} // End llvm namespace diff --git a/llvm/lib/VMCore/InstrTypes.cpp b/llvm/lib/VMCore/InstrTypes.cpp index ba1d4b71608..17e16fa733f 100644 --- a/llvm/lib/VMCore/InstrTypes.cpp +++ b/llvm/lib/VMCore/InstrTypes.cpp @@ -19,6 +19,8 @@ #include "llvm/Type.h" #include <algorithm> // find +namespace llvm { + //===----------------------------------------------------------------------===// // TerminatorInst Class //===----------------------------------------------------------------------===// @@ -56,3 +58,5 @@ Value *PHINode::removeIncomingValue(unsigned Idx, bool DeletePHIIfEmpty) { } return Removed; } + +} // End llvm namespace diff --git a/llvm/lib/VMCore/Instruction.cpp b/llvm/lib/VMCore/Instruction.cpp index b72656bdc23..9ca2fedbf4f 100644 --- a/llvm/lib/VMCore/Instruction.cpp +++ b/llvm/lib/VMCore/Instruction.cpp @@ -16,6 +16,8 @@ #include "llvm/Type.h" #include "Support/LeakDetector.h" +namespace llvm { + Instruction::Instruction(const Type *ty, unsigned it, const std::string &Name, Instruction *InsertBefore) : User(ty, Value::InstructionVal, Name) { @@ -163,3 +165,5 @@ bool Instruction::isTrapping(unsigned op) { return false; } } + +} // End llvm namespace diff --git a/llvm/lib/VMCore/Module.cpp b/llvm/lib/VMCore/Module.cpp index e62c83f67a6..6b15929506e 100644 --- a/llvm/lib/VMCore/Module.cpp +++ b/llvm/lib/VMCore/Module.cpp @@ -22,6 +22,8 @@ #include <cstdarg> #include <map> +namespace llvm { + Function *ilist_traits<Function>::createNode() { FunctionType *FTy = FunctionType::get(Type::VoidTy, std::vector<const Type*>(), false); @@ -307,3 +309,5 @@ void Module::mutateConstantPointerRef(GlobalValue *OldGV, GlobalValue *NewGV) { delete Ref; } } + +} // End llvm namespace diff --git a/llvm/lib/VMCore/ModuleProvider.cpp b/llvm/lib/VMCore/ModuleProvider.cpp index ba324d08941..8be033622df 100644 --- a/llvm/lib/VMCore/ModuleProvider.cpp +++ b/llvm/lib/VMCore/ModuleProvider.cpp @@ -14,6 +14,8 @@ #include "llvm/ModuleProvider.h" #include "llvm/Module.h" +namespace llvm { + /// ctor - always have a valid Module /// ModuleProvider::ModuleProvider() : TheModule(0) { } @@ -35,3 +37,5 @@ Module* ModuleProvider::materializeModule() { return TheModule; } + +} // End llvm namespace diff --git a/llvm/lib/VMCore/Pass.cpp b/llvm/lib/VMCore/Pass.cpp index 96ad3c94e98..b387fc35240 100644 --- a/llvm/lib/VMCore/Pass.cpp +++ b/llvm/lib/VMCore/Pass.cpp @@ -21,6 +21,8 @@ #include "Support/TypeInfo.h" #include <set> +namespace llvm { + // IncludeFile - Stub function used to help linking out. IncludeFile::IncludeFile(void*) {} @@ -467,3 +469,5 @@ void PassRegistrationListener::enumeratePasses() { E = PassInfoMap->end(); I != E; ++I) passEnumerate(I->second); } + +} // End llvm namespace diff --git a/llvm/lib/VMCore/PassManagerT.h b/llvm/lib/VMCore/PassManagerT.h index a715f5148e5..c5cac1d7fef 100644 --- a/llvm/lib/VMCore/PassManagerT.h +++ b/llvm/lib/VMCore/PassManagerT.h @@ -28,6 +28,9 @@ #include "Support/Timer.h" #include <algorithm> #include <iostream> + +namespace llvm { + class Annotable; //===----------------------------------------------------------------------===// @@ -792,4 +795,6 @@ inline bool PassManagerTraits<Function>::doFinalization(Module &M) { return Changed; } +} // End llvm namespace + #endif diff --git a/llvm/lib/VMCore/SlotCalculator.cpp b/llvm/lib/VMCore/SlotCalculator.cpp index aef71763c44..c6e44e8266f 100644 --- a/llvm/lib/VMCore/SlotCalculator.cpp +++ b/llvm/lib/VMCore/SlotCalculator.cpp @@ -27,6 +27,8 @@ #include "Support/STLExtras.h" #include <algorithm> +namespace llvm { + #if 0 #define SC_DEBUG(X) std::cerr << X #else @@ -361,3 +363,5 @@ int SlotCalculator::doInsertValue(const Value *D) { SC_DEBUG("]\n"); return (int)DestSlot; } + +} // End llvm namespace diff --git a/llvm/lib/VMCore/SymbolTable.cpp b/llvm/lib/VMCore/SymbolTable.cpp index 9452cdfec43..834d6198982 100644 --- a/llvm/lib/VMCore/SymbolTable.cpp +++ b/llvm/lib/VMCore/SymbolTable.cpp @@ -17,6 +17,8 @@ #include "Support/StringExtras.h" #include <algorithm> +namespace llvm { + #define DEBUG_SYMBOL_TABLE 0 #define DEBUG_ABSTYPE 0 @@ -354,3 +356,5 @@ void SymbolTable::dump() const { std::cout << "Symbol table dump:\n"; for_each(begin(), end(), DumpPlane); } + +} // End llvm namespace diff --git a/llvm/lib/VMCore/SymbolTableListTraitsImpl.h b/llvm/lib/VMCore/SymbolTableListTraitsImpl.h index aec7520cef1..22d2e1d6c7a 100644 --- a/llvm/lib/VMCore/SymbolTableListTraitsImpl.h +++ b/llvm/lib/VMCore/SymbolTableListTraitsImpl.h @@ -19,6 +19,8 @@ #include "llvm/SymbolTableListTraits.h" #include "llvm/SymbolTable.h" +namespace llvm { + template<typename ValueSubClass, typename ItemParentClass,typename SymTabClass, typename SubClass> void SymbolTableListTraits<ValueSubClass,ItemParentClass,SymTabClass,SubClass> @@ -94,4 +96,6 @@ void SymbolTableListTraits<ValueSubClass,ItemParentClass,SymTabClass,SubClass> } } +} // End llvm namespace + #endif diff --git a/llvm/lib/VMCore/Type.cpp b/llvm/lib/VMCore/Type.cpp index ed468022cb8..9e33303b7f2 100644 --- a/llvm/lib/VMCore/Type.cpp +++ b/llvm/lib/VMCore/Type.cpp @@ -18,6 +18,8 @@ #include "Support/STLExtras.h" #include <algorithm> +namespace llvm { + // DEBUG_MERGE_TYPES - Enable this #define to see how and when derived types are // created and later destroyed, all in an effort to make sure that there is only // a single canonical version of a type. @@ -1114,3 +1116,4 @@ void PointerType::typeBecameConcrete(const DerivedType *AbsTy) { refineAbstractType(AbsTy, AbsTy); } +} // End llvm namespace diff --git a/llvm/lib/VMCore/Value.cpp b/llvm/lib/VMCore/Value.cpp index 709ae3e9aed..f389eb0132f 100644 --- a/llvm/lib/VMCore/Value.cpp +++ b/llvm/lib/VMCore/Value.cpp @@ -18,6 +18,8 @@ #include "Support/LeakDetector.h" #include <algorithm> +namespace llvm { + //===----------------------------------------------------------------------===// // Value Class //===----------------------------------------------------------------------===// @@ -107,3 +109,5 @@ void User::replaceUsesOfWith(Value *From, Value *To) { setOperand(i, To); // Fix it now... } } + +} // End llvm namespace diff --git a/llvm/lib/VMCore/Verifier.cpp b/llvm/lib/VMCore/Verifier.cpp index 14c14f3c089..1362eaab0f6 100644 --- a/llvm/lib/VMCore/Verifier.cpp +++ b/llvm/lib/VMCore/Verifier.cpp @@ -57,6 +57,8 @@ #include "Support/STLExtras.h" #include <algorithm> +namespace llvm { + namespace { // Anonymous namespace for class struct Verifier : public FunctionPass, InstVisitor<Verifier> { @@ -149,7 +151,7 @@ namespace { // Anonymous namespace for class void visitReturnInst(ReturnInst &RI); void visitUserOp1(Instruction &I); void visitUserOp2(Instruction &I) { visitUserOp1(I); } - void visitIntrinsicFunctionCall(LLVMIntrinsic::ID ID, CallInst &CI); + void visitIntrinsicFunctionCall(Intrinsic::ID ID, CallInst &CI); // CheckFailed - A check failed, so print out the condition and the message // that failed. This provides a nice place to put a breakpoint if you want @@ -168,7 +170,6 @@ namespace { // Anonymous namespace for class }; RegisterPass<Verifier> X("verify", "Module Verifier"); -} // Assert - We know that cond should be true, if not print an error message. #define Assert(C, M) \ @@ -368,7 +369,7 @@ void Verifier::visitCallInst(CallInst &CI) { CI.getOperand(i+1), FTy->getParamType(i)); if (Function *F = CI.getCalledFunction()) - if (LLVMIntrinsic::ID ID = (LLVMIntrinsic::ID)F->getIntrinsicID()) + if (Intrinsic::ID ID = (Intrinsic::ID)F->getIntrinsicID()) visitIntrinsicFunctionCall(ID, CI); visitInstruction(CI); @@ -500,7 +501,7 @@ void Verifier::visitInstruction(Instruction &I) { } /// visitIntrinsicFunction - Allow intrinsics to be verified in different ways. -void Verifier::visitIntrinsicFunctionCall(LLVMIntrinsic::ID ID, CallInst &CI) { +void Verifier::visitIntrinsicFunctionCall(Intrinsic::ID ID, CallInst &CI) { Function *IF = CI.getCalledFunction(); const FunctionType *FT = IF->getFunctionType(); Assert1(IF->isExternal(), "Intrinsic functions should never be defined!", IF); @@ -509,37 +510,37 @@ void Verifier::visitIntrinsicFunctionCall(LLVMIntrinsic::ID ID, CallInst &CI) { // FIXME: this should check the return type of each intrinsic as well, also // arguments! switch (ID) { - case LLVMIntrinsic::va_start: + case Intrinsic::va_start: Assert1(CI.getParent()->getParent()->getFunctionType()->isVarArg(), "llvm.va_start intrinsic may only occur in function with variable" " args!", &CI); NumArgs = 0; break; - case LLVMIntrinsic::va_end: NumArgs = 1; break; - case LLVMIntrinsic::va_copy: NumArgs = 1; break; + case Intrinsic::va_end: NumArgs = 1; break; + case Intrinsic::va_copy: NumArgs = 1; break; - case LLVMIntrinsic::setjmp: NumArgs = 1; break; - case LLVMIntrinsic::longjmp: NumArgs = 2; break; - case LLVMIntrinsic::sigsetjmp: NumArgs = 2; break; - case LLVMIntrinsic::siglongjmp: NumArgs = 2; break; + case Intrinsic::setjmp: NumArgs = 1; break; + case Intrinsic::longjmp: NumArgs = 2; break; + case Intrinsic::sigsetjmp: NumArgs = 2; break; + case Intrinsic::siglongjmp: NumArgs = 2; break; - case LLVMIntrinsic::alpha_ctlz: NumArgs = 1; break; - case LLVMIntrinsic::alpha_cttz: NumArgs = 1; break; - case LLVMIntrinsic::alpha_ctpop: NumArgs = 1; break; - case LLVMIntrinsic::alpha_umulh: NumArgs = 2; break; - case LLVMIntrinsic::alpha_vecop: NumArgs = 4; break; - case LLVMIntrinsic::alpha_pup: NumArgs = 3; break; - case LLVMIntrinsic::alpha_bytezap: NumArgs = 2; break; - case LLVMIntrinsic::alpha_bytemanip: NumArgs = 3; break; - case LLVMIntrinsic::alpha_dfpbop: NumArgs = 3; break; - case LLVMIntrinsic::alpha_dfpuop: NumArgs = 2; break; - case LLVMIntrinsic::alpha_unordered: NumArgs = 2; break; - case LLVMIntrinsic::alpha_uqtodfp: NumArgs = 2; break; - case LLVMIntrinsic::alpha_uqtosfp: NumArgs = 2; break; - case LLVMIntrinsic::alpha_dfptosq: NumArgs = 2; break; - case LLVMIntrinsic::alpha_sfptosq: NumArgs = 2; break; - - case LLVMIntrinsic::not_intrinsic: + case Intrinsic::alpha_ctlz: NumArgs = 1; break; + case Intrinsic::alpha_cttz: NumArgs = 1; break; + case Intrinsic::alpha_ctpop: NumArgs = 1; break; + case Intrinsic::alpha_umulh: NumArgs = 2; break; + case Intrinsic::alpha_vecop: NumArgs = 4; break; + case Intrinsic::alpha_pup: NumArgs = 3; break; + case Intrinsic::alpha_bytezap: NumArgs = 2; break; + case Intrinsic::alpha_bytemanip: NumArgs = 3; break; + case Intrinsic::alpha_dfpbop: NumArgs = 3; break; + case Intrinsic::alpha_dfpuop: NumArgs = 2; break; + case Intrinsic::alpha_unordered: NumArgs = 2; break; + case Intrinsic::alpha_uqtodfp: NumArgs = 2; break; + case Intrinsic::alpha_uqtosfp: NumArgs = 2; break; + case Intrinsic::alpha_dfptosq: NumArgs = 2; break; + case Intrinsic::alpha_sfptosq: NumArgs = 2; break; + + case Intrinsic::not_intrinsic: assert(0 && "Invalid intrinsic!"); NumArgs = 0; break; } @@ -548,6 +549,7 @@ void Verifier::visitIntrinsicFunctionCall(LLVMIntrinsic::ID ID, CallInst &CI) { "Illegal # arguments for intrinsic function!", IF); } +} // End anonymous namespace //===----------------------------------------------------------------------===// // Implement the public interfaces to this file... @@ -585,3 +587,5 @@ bool verifyModule(const Module &M) { PM.run((Module&)M); return V->Broken; } + +} // End llvm namespace diff --git a/llvm/lib/VMCore/iBranch.cpp b/llvm/lib/VMCore/iBranch.cpp index bcba7145cc0..59dc303d701 100644 --- a/llvm/lib/VMCore/iBranch.cpp +++ b/llvm/lib/VMCore/iBranch.cpp @@ -16,6 +16,8 @@ #include "llvm/BasicBlock.h" #include "llvm/Type.h" +namespace llvm { + BranchInst::BranchInst(BasicBlock *True, BasicBlock *False, Value *Cond, Instruction *InsertBefore) : TerminatorInst(Instruction::Br, InsertBefore) { @@ -49,3 +51,5 @@ BranchInst::BranchInst(const BranchInst &BI) : TerminatorInst(Instruction::Br) { Operands.push_back(Use(BI.Operands[2], this)); } } + +} // End llvm namespace diff --git a/llvm/lib/VMCore/iCall.cpp b/llvm/lib/VMCore/iCall.cpp index b99c9e7bb3f..c385afc778b 100644 --- a/llvm/lib/VMCore/iCall.cpp +++ b/llvm/lib/VMCore/iCall.cpp @@ -17,6 +17,8 @@ #include "llvm/DerivedTypes.h" #include "llvm/Function.h" +namespace llvm { + //===----------------------------------------------------------------------===// // CallInst Implementation //===----------------------------------------------------------------------===// @@ -144,8 +146,12 @@ Function *InvokeInst::getCalledFunction() { return 0; } +} // End llvm namespace + #include "llvm/Support/CallSite.h" +namespace llvm { + Function *CallSite::getCalledFunction() const { Value *Callee = getCalledValue(); if (Function *F = dyn_cast<Function>(Callee)) @@ -155,3 +161,4 @@ Function *CallSite::getCalledFunction() const { return 0; } +} // End llvm namespace diff --git a/llvm/lib/VMCore/iMemory.cpp b/llvm/lib/VMCore/iMemory.cpp index 75309ad8dc0..c1a06576cd4 100644 --- a/llvm/lib/VMCore/iMemory.cpp +++ b/llvm/lib/VMCore/iMemory.cpp @@ -15,6 +15,8 @@ #include "llvm/Constants.h" #include "llvm/DerivedTypes.h" +using namespace llvm; + AllocationInst::AllocationInst(const Type *Ty, Value *ArraySize, unsigned iTy, const std::string &Name, Instruction *InsertBef) : Instruction(PointerType::get(Ty), iTy, Name, InsertBef) { diff --git a/llvm/lib/VMCore/iOperators.cpp b/llvm/lib/VMCore/iOperators.cpp index d8932901981..79fac335fe5 100644 --- a/llvm/lib/VMCore/iOperators.cpp +++ b/llvm/lib/VMCore/iOperators.cpp @@ -16,6 +16,8 @@ #include "llvm/Constants.h" #include "llvm/BasicBlock.h" +namespace llvm { + //===----------------------------------------------------------------------===// // BinaryOperator Class //===----------------------------------------------------------------------===// @@ -194,3 +196,5 @@ Instruction::BinaryOps SetCondInst::getSwappedCondition(BinaryOps Opcode) { case SetLE: return SetGE; } } + +} // End llvm namespace diff --git a/llvm/lib/VMCore/iSwitch.cpp b/llvm/lib/VMCore/iSwitch.cpp index e6a4f48ef49..4386b7b837c 100644 --- a/llvm/lib/VMCore/iSwitch.cpp +++ b/llvm/lib/VMCore/iSwitch.cpp @@ -14,6 +14,8 @@ #include "llvm/iTerminators.h" #include "llvm/BasicBlock.h" +namespace llvm { + SwitchInst::SwitchInst(Value *V, BasicBlock *DefaultDest, Instruction *InsertBefore) : TerminatorInst(Instruction::Switch, InsertBefore) { @@ -48,3 +50,5 @@ void SwitchInst::removeCase(unsigned idx) { assert(idx*2 < Operands.size() && "Successor index out of range!!!"); Operands.erase(Operands.begin()+idx*2, Operands.begin()+(idx+1)*2); } + +} // End llvm namespace |