Finegrainify namespacification

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15381 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2004-08-01 03:55:39 +00:00
parent 1ab7c5b5e8
commit 2082ebe8b3
9 changed files with 26 additions and 49 deletions

View File

@ -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<Record*> Insts = Records.getAllDerivedDefinitions("Instruction");
@ -226,5 +225,3 @@ void CodeEmitterGen::run(std::ostream &o) {
EmitSourceFileTail(o);
}
} // End llvm namespace

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -18,8 +18,7 @@
#include "Support/Debug.h"
#include "Support/StringExtras.h"
#include <set>
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

View File

@ -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<std::string> &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<std::string, Record*> &Classes = RK.getClasses();
for (std::map<std::string, Record*>::const_iterator I = Classes.begin(),
@ -764,4 +763,3 @@ RecordKeeper::getAllDerivedDefinitions(const std::string &ClassName) const {
return Defs;
}
} // End llvm namespace

View File

@ -18,8 +18,7 @@
#include "Record.h"
#include "Support/StringExtras.h"
#include <set>
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

View File

@ -26,8 +26,7 @@
#include <algorithm>
#include <cstdio>
#include <fstream>
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<RecordVal> &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);

View File

@ -14,8 +14,7 @@
#include "TableGenBackend.h"
#include "Record.h"
#include <iostream>
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