diff --git a/utils/TableGen/CodeEmitterGen.cpp b/utils/TableGen/CodeEmitterGen.cpp index 2c3e374b166..6cf18c2ded9 100644 --- a/utils/TableGen/CodeEmitterGen.cpp +++ b/utils/TableGen/CodeEmitterGen.cpp @@ -14,8 +14,7 @@ #include "CodeEmitterGen.h" #include "Record.h" #include "Support/Debug.h" - -namespace llvm { +using namespace llvm; void CodeEmitterGen::run(std::ostream &o) { std::vector Insts = Records.getAllDerivedDefinitions("Instruction"); @@ -226,5 +225,3 @@ void CodeEmitterGen::run(std::ostream &o) { EmitSourceFileTail(o); } - -} // End llvm namespace diff --git a/utils/TableGen/CodeGenTarget.cpp b/utils/TableGen/CodeGenTarget.cpp index 842294a0378..fe4ad2634da 100644 --- a/utils/TableGen/CodeGenTarget.cpp +++ b/utils/TableGen/CodeGenTarget.cpp @@ -16,16 +16,15 @@ #include "CodeGenWrappers.h" #include "Record.h" - -namespace llvm { +using namespace llvm; /// getValueType - Return the MCV::ValueType that the specified TableGen record /// corresponds to. -MVT::ValueType getValueType(Record *Rec) { +MVT::ValueType llvm::getValueType(Record *Rec) { return (MVT::ValueType)Rec->getValueAsInt("Value"); } -std::string getName(MVT::ValueType T) { +std::string llvm::getName(MVT::ValueType T) { switch (T) { case MVT::Other: return "UNKNOWN"; case MVT::i1: return "i1"; @@ -43,7 +42,7 @@ std::string getName(MVT::ValueType T) { } } -std::string getEnumName(MVT::ValueType T) { +std::string llvm::getEnumName(MVT::ValueType T) { switch (T) { case MVT::Other: return "Other"; case MVT::i1: return "i1"; @@ -62,12 +61,11 @@ std::string getEnumName(MVT::ValueType T) { } -std::ostream &operator<<(std::ostream &OS, MVT::ValueType T) { +std::ostream &llvm::operator<<(std::ostream &OS, MVT::ValueType T) { return OS << getName(T); } - /// getTarget - Return the current instance of the Target class. /// CodeGenTarget::CodeGenTarget() : PointerType(MVT::Other) { @@ -99,4 +97,3 @@ Record *CodeGenTarget::getInstructionSet() const { return TargetRec->getValueAsDef("InstructionSet"); } -} // End llvm namespace diff --git a/utils/TableGen/CodeGenWrappers.cpp b/utils/TableGen/CodeGenWrappers.cpp index 842294a0378..fe4ad2634da 100644 --- a/utils/TableGen/CodeGenWrappers.cpp +++ b/utils/TableGen/CodeGenWrappers.cpp @@ -16,16 +16,15 @@ #include "CodeGenWrappers.h" #include "Record.h" - -namespace llvm { +using namespace llvm; /// getValueType - Return the MCV::ValueType that the specified TableGen record /// corresponds to. -MVT::ValueType getValueType(Record *Rec) { +MVT::ValueType llvm::getValueType(Record *Rec) { return (MVT::ValueType)Rec->getValueAsInt("Value"); } -std::string getName(MVT::ValueType T) { +std::string llvm::getName(MVT::ValueType T) { switch (T) { case MVT::Other: return "UNKNOWN"; case MVT::i1: return "i1"; @@ -43,7 +42,7 @@ std::string getName(MVT::ValueType T) { } } -std::string getEnumName(MVT::ValueType T) { +std::string llvm::getEnumName(MVT::ValueType T) { switch (T) { case MVT::Other: return "Other"; case MVT::i1: return "i1"; @@ -62,12 +61,11 @@ std::string getEnumName(MVT::ValueType T) { } -std::ostream &operator<<(std::ostream &OS, MVT::ValueType T) { +std::ostream &llvm::operator<<(std::ostream &OS, MVT::ValueType T) { return OS << getName(T); } - /// getTarget - Return the current instance of the Target class. /// CodeGenTarget::CodeGenTarget() : PointerType(MVT::Other) { @@ -99,4 +97,3 @@ Record *CodeGenTarget::getInstructionSet() const { return TargetRec->getValueAsDef("InstructionSet"); } -} // End llvm namespace diff --git a/utils/TableGen/InstrInfoEmitter.cpp b/utils/TableGen/InstrInfoEmitter.cpp index 6f9440a6076..d2a35370999 100644 --- a/utils/TableGen/InstrInfoEmitter.cpp +++ b/utils/TableGen/InstrInfoEmitter.cpp @@ -15,8 +15,7 @@ #include "InstrInfoEmitter.h" #include "CodeGenWrappers.h" #include "Record.h" - -namespace llvm { +using namespace llvm; // runEnums - Print out enum values for all of the instructions. void InstrInfoEmitter::runEnums(std::ostream &OS) { @@ -175,4 +174,3 @@ void InstrInfoEmitter::emitShiftedValue(Record *R, StringInit *Val, throw "In record '" + R->getName() + "' for TSFlag emission."; } -} // End llvm namespace diff --git a/utils/TableGen/InstrSelectorEmitter.cpp b/utils/TableGen/InstrSelectorEmitter.cpp index 5c093935247..d6f9c0a4de7 100644 --- a/utils/TableGen/InstrSelectorEmitter.cpp +++ b/utils/TableGen/InstrSelectorEmitter.cpp @@ -18,8 +18,7 @@ #include "Support/Debug.h" #include "Support/StringExtras.h" #include - -namespace llvm { +using namespace llvm; NodeType::ArgResultTypes NodeType::Translate(Record *R) { const std::string &Name = R->getName(); @@ -104,7 +103,7 @@ TreePatternNode *TreePatternNode::clone() const { return New; } -std::ostream &operator<<(std::ostream &OS, const TreePatternNode &N) { +std::ostream &llvm::operator<<(std::ostream &OS, const TreePatternNode &N) { if (N.isLeaf()) return OS << N.getType() << ":" << *N.getValue(); OS << "(" << N.getType() << ":"; @@ -359,7 +358,7 @@ Pattern *Pattern::clone(Record *R) const { -std::ostream &operator<<(std::ostream &OS, const Pattern &P) { +std::ostream &llvm::operator<<(std::ostream &OS, const Pattern &P) { switch (P.getPatternType()) { case Pattern::Nonterminal: OS << "Nonterminal pattern "; break; case Pattern::Instruction: OS << "Instruction pattern "; break; @@ -1296,4 +1295,3 @@ void InstrSelectorEmitter::run(std::ostream &OS) { EmitSourceFileTail(OS); } -} // End llvm namespace diff --git a/utils/TableGen/Record.cpp b/utils/TableGen/Record.cpp index 717962794a0..88c1f81002e 100644 --- a/utils/TableGen/Record.cpp +++ b/utils/TableGen/Record.cpp @@ -11,13 +11,12 @@ //===----------------------------------------------------------------------===// #include "Record.h" +using namespace llvm; //===----------------------------------------------------------------------===// // Type implementations //===----------------------------------------------------------------------===// -namespace llvm { - void RecTy::dump() const { print(std::cerr); } Init *BitRecTy::convertValue(BitsInit *BI) { @@ -568,7 +567,7 @@ void Record::resolveReferences() { void Record::dump() const { std::cerr << *this; } -std::ostream &operator<<(std::ostream &OS, const Record &R) { +std::ostream &llvm::operator<<(std::ostream &OS, const Record &R) { OS << R.getName(); const std::vector &TArgs = R.getTemplateArgs(); @@ -730,7 +729,7 @@ DagInit *Record::getValueAsDag(const std::string &FieldName) const { void RecordKeeper::dump() const { std::cerr << *this; } -std::ostream &operator<<(std::ostream &OS, const RecordKeeper &RK) { +std::ostream &llvm::operator<<(std::ostream &OS, const RecordKeeper &RK) { OS << "------------- Classes -----------------\n"; const std::map &Classes = RK.getClasses(); for (std::map::const_iterator I = Classes.begin(), @@ -764,4 +763,3 @@ RecordKeeper::getAllDerivedDefinitions(const std::string &ClassName) const { return Defs; } -} // End llvm namespace diff --git a/utils/TableGen/RegisterInfoEmitter.cpp b/utils/TableGen/RegisterInfoEmitter.cpp index 4e7aa9b5846..8fd0e165531 100644 --- a/utils/TableGen/RegisterInfoEmitter.cpp +++ b/utils/TableGen/RegisterInfoEmitter.cpp @@ -18,8 +18,7 @@ #include "Record.h" #include "Support/StringExtras.h" #include - -namespace llvm { +using namespace llvm; // runEnums - Print out enum values for all of the registers. void RegisterInfoEmitter::runEnums(std::ostream &OS) { @@ -246,5 +245,3 @@ void RegisterInfoEmitter::run(std::ostream &OS) { OS << " 0\n };\n return CalleeSaveRegs;\n}\n\n"; EmitSourceFileTail(OS); } - -} // End llvm namespace diff --git a/utils/TableGen/TableGen.cpp b/utils/TableGen/TableGen.cpp index dd4d22aa4f0..7bd52b37cf0 100644 --- a/utils/TableGen/TableGen.cpp +++ b/utils/TableGen/TableGen.cpp @@ -26,8 +26,7 @@ #include #include #include - -namespace llvm { +using namespace llvm; enum ActionType { PrintRecords, @@ -79,10 +78,12 @@ namespace { cl::value_desc("directory"), cl::init("")); } +namespace llvm { + void ParseFile(const std::string &Filename, + const std::string &IncludeDir); +} -void ParseFile(const std::string &Filename, const std::string & IncludeDir); - -RecordKeeper Records; +RecordKeeper llvm::Records; static Init *getBit(Record *R, unsigned BitNo) { const std::vector &V = R->getValues(); @@ -408,10 +409,6 @@ static void ParseMachineCode() { } } -} // End llvm namespace - -using namespace llvm; - int main(int argc, char **argv) { cl::ParseCommandLineOptions(argc, argv); ParseFile(InputFilename, IncludeDir); diff --git a/utils/TableGen/TableGenBackend.cpp b/utils/TableGen/TableGenBackend.cpp index 67a37885db1..b98ff0a4242 100644 --- a/utils/TableGen/TableGenBackend.cpp +++ b/utils/TableGen/TableGenBackend.cpp @@ -14,8 +14,7 @@ #include "TableGenBackend.h" #include "Record.h" #include - -namespace llvm { +using namespace llvm; void TableGenBackend::EmitSourceFileHeader(const std::string &Desc, std::ostream &OS) const { @@ -38,4 +37,3 @@ std::string TableGenBackend::getQualifiedName(Record *R) const { return Namespace + "::" + R->getName(); } -} // End llvm namespace