Put all LLVM code into the llvm namespace, as per bug 109.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9903 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/InstrSched/InstrScheduling.cpp b/lib/CodeGen/InstrSched/InstrScheduling.cpp
index a50439d..4e2bf47 100644
--- a/lib/CodeGen/InstrSched/InstrScheduling.cpp
+++ b/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 @@
 FunctionPass *createInstructionSchedulingWithSSAPass(const TargetMachine &tgt) {
   return new InstructionSchedulingWithSSA(tgt);
 }
+
+} // End llvm namespace
+
diff --git a/lib/CodeGen/InstrSched/SchedGraph.cpp b/lib/CodeGen/InstrSched/SchedGraph.cpp
index e7cd478..3a80880 100644
--- a/lib/CodeGen/InstrSched/SchedGraph.cpp
+++ b/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 @@
       os << std::string(16, ' ') << *outEdges[i];
   }
 }
+
+} // End llvm namespace
diff --git a/lib/CodeGen/InstrSched/SchedGraph.h b/lib/CodeGen/InstrSched/SchedGraph.h
index 50cc052..5aee9b2 100644
--- a/lib/CodeGen/InstrSched/SchedGraph.h
+++ b/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 @@
   }
 };
 
+} // End llvm namespace
+
 #endif
diff --git a/lib/CodeGen/InstrSched/SchedGraphCommon.cpp b/lib/CodeGen/InstrSched/SchedGraphCommon.cpp
index b75e339..d96c201 100644
--- a/lib/CodeGen/InstrSched/SchedGraphCommon.cpp
+++ b/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 @@
   this->eraseOutgoingEdges(node, addDummyEdges);	
 }
 
+} // End llvm namespace
diff --git a/lib/CodeGen/InstrSched/SchedPriorities.cpp b/lib/CodeGen/InstrSched/SchedPriorities.cpp
index 1644d5e..7e05d14 100644
--- a/lib/CodeGen/InstrSched/SchedPriorities.cpp
+++ b/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 @@
   return lastUseMap[MI] = hasLastUse;
 }
 
+} // End llvm namespace
diff --git a/lib/CodeGen/InstrSched/SchedPriorities.h b/lib/CodeGen/InstrSched/SchedPriorities.h
index de321f9..7470467 100644
--- a/lib/CodeGen/InstrSched/SchedPriorities.h
+++ b/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 @@
 
 std::ostream &operator<<(std::ostream &os, const NodeDelayPair* nd);
 
+} // End llvm namespace
+
 #endif
diff --git a/lib/CodeGen/InstrSelection/InstrForest.cpp b/lib/CodeGen/InstrSelection/InstrForest.cpp
index 5496502..fd5056d2 100644
--- a/lib/CodeGen/InstrSelection/InstrForest.cpp
+++ b/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 @@
   delete [] childArray;
   return treeNode;
 }
+
+} // End llvm namespace
diff --git a/lib/CodeGen/InstrSelection/InstrSelection.cpp b/lib/CodeGen/InstrSelection/InstrSelection.cpp
index 0e3e2cd..7609765 100644
--- a/lib/CodeGen/InstrSelection/InstrSelection.cpp
+++ b/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 llvm {
+
 TmpInstruction::TmpInstruction(MachineCodeForInstruction& mcfi,
                                Value *s1, Value *s2, const std::string &name)
   : Instruction(s1->getType(), Instruction::UserOp1, name)
@@ -114,6 +118,7 @@
   LeakDetector::removeGarbageObject(this);
 }
 
+} // End llvm namespace
 
 bool InstructionSelection::runOnFunction(Function &F)
 {
@@ -375,7 +380,6 @@
 }
 
 
-
 //===----------------------------------------------------------------------===//
 // createInstructionSelectionPass - Public entrypoint for instruction selection
 // and this file as a whole...
@@ -383,3 +387,5 @@
 FunctionPass *createInstructionSelectionPass(TargetMachine &T) {
   return new InstructionSelection(T);
 }
+
+} // End llvm namespace
diff --git a/lib/CodeGen/InstrSelection/InstrSelectionSupport.cpp b/lib/CodeGen/InstrSelection/InstrSelectionSupport.cpp
index 93f7618..44a4359 100644
--- a/lib/CodeGen/InstrSelection/InstrSelectionSupport.cpp
+++ b/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 @@
   
   return MVec;
 }
+
+} // End llvm namespace
diff --git a/lib/CodeGen/LiveVariables.cpp b/lib/CodeGen/LiveVariables.cpp
index 50b90b1..7ec4d32 100644
--- a/lib/CodeGen/LiveVariables.cpp
+++ b/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 @@
   
   return false;
 }
+
+} // End llvm namespace
diff --git a/lib/CodeGen/MachineCodeEmitter.cpp b/lib/CodeGen/MachineCodeEmitter.cpp
index 6e56594..d9b1f7c 100644
--- a/lib/CodeGen/MachineCodeEmitter.cpp
+++ b/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 @@
       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 @@
   };
 }
 
+/// 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/lib/CodeGen/MachineCodeForInstruction.cpp b/lib/CodeGen/MachineCodeForInstruction.cpp
index 36bafe2..000f3d1 100644
--- a/lib/CodeGen/MachineCodeForInstruction.cpp
+++ b/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 @@
   if (callArgsDesc)
     delete callArgsDesc;
 }
+
+} // End llvm namespace
diff --git a/lib/CodeGen/MachineFunction.cpp b/lib/CodeGen/MachineFunction.cpp
index c1eb30a..790859b 100644
--- a/lib/CodeGen/MachineFunction.cpp
+++ b/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 @@
   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/lib/CodeGen/MachineInstr.cpp b/lib/CodeGen/MachineInstr.cpp
index 7fb8b45..ef31cc4 100644
--- a/lib/CodeGen/MachineInstr.cpp
+++ b/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 @@
    // 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 @@
     if (i != StartOp)
       OS << ",";
     OS << " ";
-    ::print(mop, OS, TM);
+    llvm::print(mop, OS, TM);
     
     if (mop.opIsDefAndUse())
       OS << "<def&use>";
@@ -433,3 +435,5 @@
   
   return OS;
 }
+
+} // End llvm namespace
diff --git a/lib/CodeGen/MachineInstrAnnot.cpp b/lib/CodeGen/MachineInstrAnnot.cpp
index bf4e68e..b4b41ac 100644
--- a/lib/CodeGen/MachineInstrAnnot.cpp
+++ b/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 @@
   assert(desc->getCallInst()==callInstr && "Incorrect call args descriptor?");
   return desc;
 }
+
+} // End llvm namespace
diff --git a/lib/CodeGen/ModuloScheduling/ModuloSchedGraph.cpp b/lib/CodeGen/ModuloScheduling/ModuloSchedGraph.cpp
index 6318c5a..8aaaa2b 100644
--- a/lib/CodeGen/ModuloScheduling/ModuloSchedGraph.cpp
+++ b/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 @@
   //delete all the graphs
 }
 
+} // End llvm namespace
diff --git a/lib/CodeGen/ModuloScheduling/ModuloSchedGraph.h b/lib/CodeGen/ModuloScheduling/ModuloSchedGraph.h
index 214e24c..552d699 100644
--- a/lib/CodeGen/ModuloScheduling/ModuloSchedGraph.h
+++ b/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 @@
 
 };
 
+} // End llvm namespace
+
 #endif
diff --git a/lib/CodeGen/ModuloScheduling/ModuloScheduling.cpp b/lib/CodeGen/ModuloScheduling/ModuloScheduling.cpp
index 91ec6c2..219d892 100644
--- a/lib/CodeGen/ModuloScheduling/ModuloScheduling.cpp
+++ b/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 Changed = false;
   return Changed;
 }
+
+} // End llvm namespace
diff --git a/lib/CodeGen/PHIElimination.cpp b/lib/CodeGen/PHIElimination.cpp
index 5a988ba..c4b811a 100644
--- a/lib/CodeGen/PHIElimination.cpp
+++ b/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 @@
 		      "Eliminate PHI nodes for register allocation");
 }
 
+
 const PassInfo *PHIEliminationID = X.getPassInfo();
 
 /// EliminatePHINodes - Eliminate phi nodes by inserting copy instructions in
@@ -260,3 +263,5 @@
 
   return true;
 }
+
+} // End llvm namespace
diff --git a/lib/CodeGen/Passes.cpp b/lib/CodeGen/Passes.cpp
index 7a51a53..239eacd 100644
--- a/lib/CodeGen/Passes.cpp
+++ b/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 @@
     return 0; // not reached
   }
 }
+
+} // End llvm namespace
diff --git a/lib/CodeGen/PrologEpilogInserter.cpp b/lib/CodeGen/PrologEpilogInserter.cpp
index a60b8b1..8fc9b5b 100644
--- a/lib/CodeGen/PrologEpilogInserter.cpp
+++ b/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 @@
   };
 }
 
+
 /// createPrologEpilogCodeInserter - This function returns a pass that inserts
 /// prolog and epilog code, and eliminates abstract frame references.
 ///
@@ -258,3 +261,5 @@
 	  break;
 	}
 }
+
+} // End llvm namespace
diff --git a/lib/CodeGen/RegAlloc/AllocInfo.h b/lib/CodeGen/RegAlloc/AllocInfo.h
index f83f210..67f58a7 100644
--- a/lib/CodeGen/RegAlloc/AllocInfo.h
+++ b/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 @@
   }
 };
 
+} // End llvm namespace
+
 #endif // ALLOCINFO_H
diff --git a/lib/CodeGen/RegAlloc/IGNode.cpp b/lib/CodeGen/RegAlloc/IGNode.cpp
index f883fb1..a76fdea 100644
--- a/lib/CodeGen/RegAlloc/IGNode.cpp
+++ b/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 @@
   std::vector<IGNode*>::iterator new_end = unique(nbrs.begin(), nbrs.end());
   return new_end - nbrs.begin();
 }
+
+} // End llvm namespace
diff --git a/lib/CodeGen/RegAlloc/IGNode.h b/lib/CodeGen/RegAlloc/IGNode.h
index 82f07e0..9fdc7a6 100644
--- a/lib/CodeGen/RegAlloc/IGNode.h
+++ b/lib/CodeGen/RegAlloc/IGNode.h
@@ -32,6 +32,9 @@
 
 #include "LiveRange.h"
 #include <vector>
+
+namespace llvm {
+
 class RegClass;
 
 //----------------------------------------------------------------------------
@@ -115,4 +118,6 @@
   inline LiveRange *getParentLR() const { return ParentLR; }
 };
 
+} // End llvm namespace
+
 #endif
diff --git a/lib/CodeGen/RegAlloc/InterferenceGraph.cpp b/lib/CodeGen/RegAlloc/InterferenceGraph.cpp
index 392a96c..3cef19e 100644
--- a/lib/CodeGen/RegAlloc/InterferenceGraph.cpp
+++ b/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 @@
     }
   }
 }
+
+} // End llvm namespace
diff --git a/lib/CodeGen/RegAlloc/InterferenceGraph.h b/lib/CodeGen/RegAlloc/InterferenceGraph.h
index 6b8cf3c..79850c1 100644
--- a/lib/CodeGen/RegAlloc/InterferenceGraph.h
+++ b/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 @@
   void printIGNodeList() const;
 };
 
+} // End llvm namespace
+
 #endif
diff --git a/lib/CodeGen/RegAlloc/LiveRange.h b/lib/CodeGen/RegAlloc/LiveRange.h
index aa409c6..d6e2cf6 100644
--- a/lib/CodeGen/RegAlloc/LiveRange.h
+++ b/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 @@
   }
 };
 
+} // End llvm namespace
+
 #endif
diff --git a/lib/CodeGen/RegAlloc/LiveRangeInfo.cpp b/lib/CodeGen/RegAlloc/LiveRangeInfo.cpp
index b9fcda7..9fd04d2 100644
--- a/lib/CodeGen/RegAlloc/LiveRangeInfo.cpp
+++ b/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 @@
     }
   }
 }
+
+} // End llvm namespace
diff --git a/lib/CodeGen/RegAlloc/LiveRangeInfo.h b/lib/CodeGen/RegAlloc/LiveRangeInfo.h
index 5c5244b..a8d0e71 100644
--- a/lib/CodeGen/RegAlloc/LiveRangeInfo.h
+++ b/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 @@
   void printLiveRanges();
 };
 
+} // End llvm namespace
+
 #endif 
diff --git a/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp b/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp
index 99917cd..332ae95 100644
--- a/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp
+++ b/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 @@
   if (DEBUG_RA) std::cerr << "\nRegister allocation complete!\n"; 
   return false;     // Function was not modified
 } 
+
+} // End llvm namespace
diff --git a/lib/CodeGen/RegAlloc/PhyRegAlloc.h b/lib/CodeGen/RegAlloc/PhyRegAlloc.h
index c524f9f..4ec083c 100644
--- a/lib/CodeGen/RegAlloc/PhyRegAlloc.h
+++ b/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 @@
   void addInterf4PseudoInstr(const MachineInstr *MI);
 };
 
+} // End llvm namespace
+
 #endif
diff --git a/lib/CodeGen/RegAlloc/RegAllocCommon.h b/lib/CodeGen/RegAlloc/RegAllocCommon.h
index 97d102a..7dd86b2 100644
--- a/lib/CodeGen/RegAlloc/RegAllocCommon.h
+++ b/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 @@
 
 extern RegAllocDebugLevel_t DEBUG_RA;
 
+} // End llvm namespace
+
 #endif
diff --git a/lib/CodeGen/RegAlloc/RegClass.cpp b/lib/CodeGen/RegAlloc/RegClass.cpp
index 9c8603b..9af87ba 100644
--- a/lib/CodeGen/RegAlloc/RegClass.cpp
+++ b/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 @@
   IG.printIG(); 
 }
 
-
+} // End llvm namespace
diff --git a/lib/CodeGen/RegAlloc/RegClass.h b/lib/CodeGen/RegAlloc/RegClass.h
index c861fba..0071f7c 100644
--- a/lib/CodeGen/RegAlloc/RegClass.h
+++ b/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 @@
   void printIG();
 };
 
+} // End llvm namespace
+
 #endif
diff --git a/lib/CodeGen/RegAllocLocal.cpp b/lib/CodeGen/RegAllocLocal.cpp
index 8d19b69..080e6c6 100644
--- a/lib/CodeGen/RegAllocLocal.cpp
+++ b/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 @@
   };
 }
 
-
 /// 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 @@
 FunctionPass *createLocalRegisterAllocator() {
   return new RA();
 }
+
+} // End llvm namespace
diff --git a/lib/CodeGen/RegAllocSimple.cpp b/lib/CodeGen/RegAllocSimple.cpp
index a210790..202123a 100644
--- a/lib/CodeGen/RegAllocSimple.cpp
+++ b/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 @@
 FunctionPass *createSimpleRegisterAllocator() {
   return new RegAllocSimple();
 }
+
+} // End llvm namespace
diff --git a/lib/CodeGen/SelectionDAG/DAGBuilder.cpp b/lib/CodeGen/SelectionDAG/DAGBuilder.cpp
index a972ddf..fd4e7a9 100644
--- a/lib/CodeGen/SelectionDAG/DAGBuilder.cpp
+++ b/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 @@
     SDB.visitBB(const_cast<BasicBlock&>(*I));
   Root = SDB.CurRoot;
 }
+
+} // End llvm namespace
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
index 58a9639..db59410 100644
--- a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ b/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 @@
 
   std::cerr << "\n";
 }
+
+} // End llvm namespace