forked from OSchip/llvm-project
Do not #include files into the llvm namespace
llvm-svn: 15849
This commit is contained in:
parent
f8a18099fb
commit
c9d99efdd3
|
@ -27,6 +27,7 @@ static bool isIdentChar(char C) {
|
|||
|
||||
void AsmWriterEmitter::run(std::ostream &O) {
|
||||
EmitSourceFileHeader("Assembly Writer Source Fragment", O);
|
||||
O << "namespace llvm {\n\n";
|
||||
|
||||
CodeGenTarget Target;
|
||||
|
||||
|
@ -103,5 +104,5 @@ void AsmWriterEmitter::run(std::ostream &O) {
|
|||
O << " }\n"
|
||||
" return true;\n"
|
||||
"}\n";
|
||||
EmitSourceFileTail(O);
|
||||
O << "} // End llvm namespace \n";
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ void CodeEmitterGen::run(std::ostream &o) {
|
|||
std::vector<Record*> Insts = Records.getAllDerivedDefinitions("Instruction");
|
||||
|
||||
EmitSourceFileHeader("Machine Code Emitter", o);
|
||||
o << "namespace llvm {\n\n";
|
||||
std::string Namespace = Insts[0]->getValueAsString("Namespace") + "::";
|
||||
|
||||
// Emit function declaration
|
||||
|
@ -225,5 +226,5 @@ void CodeEmitterGen::run(std::ostream &o) {
|
|||
<< " return Value;\n"
|
||||
<< "}\n";
|
||||
|
||||
EmitSourceFileTail(o);
|
||||
o << "} // End llvm namespace \n";
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ using namespace llvm;
|
|||
// runEnums - Print out enum values for all of the instructions.
|
||||
void InstrInfoEmitter::runEnums(std::ostream &OS) {
|
||||
EmitSourceFileHeader("Target Instruction Enum Values", OS);
|
||||
OS << "namespace llvm {\n\n";
|
||||
|
||||
CodeGenTarget Target;
|
||||
|
||||
|
@ -45,7 +46,7 @@ void InstrInfoEmitter::runEnums(std::ostream &OS) {
|
|||
OS << " };\n";
|
||||
if (!Namespace.empty())
|
||||
OS << "}\n";
|
||||
EmitSourceFileTail(OS);
|
||||
OS << "} // End llvm namespace \n";
|
||||
}
|
||||
|
||||
void InstrInfoEmitter::printDefList(ListInit *LI, const std::string &Name,
|
||||
|
@ -63,6 +64,8 @@ void InstrInfoEmitter::printDefList(ListInit *LI, const std::string &Name,
|
|||
// run - Emit the main instruction description records for the target...
|
||||
void InstrInfoEmitter::run(std::ostream &OS) {
|
||||
EmitSourceFileHeader("Target Instruction Descriptors", OS);
|
||||
OS << "namespace llvm {\n\n";
|
||||
|
||||
CodeGenTarget Target;
|
||||
const std::string &TargetName = Target.getName();
|
||||
Record *InstrInfo = Target.getInstructionSet();
|
||||
|
@ -92,7 +95,7 @@ void InstrInfoEmitter::run(std::ostream &OS) {
|
|||
if (II->second.TheDef != PHI)
|
||||
emitRecord(II->second, ++i, InstrInfo, OS);
|
||||
OS << "};\n";
|
||||
EmitSourceFileTail(OS);
|
||||
OS << "} // End llvm namespace \n";
|
||||
}
|
||||
|
||||
void InstrInfoEmitter::emitRecord(const CodeGenInstruction &Inst, unsigned Num,
|
||||
|
|
|
@ -982,6 +982,7 @@ void InstrSelectorEmitter::run(std::ostream &OS) {
|
|||
|
||||
EmitSourceFileHeader("Instruction Selector for the " + Target.getName() +
|
||||
" target", OS);
|
||||
OS << "namespace llvm {\n\n";
|
||||
|
||||
// Output the slot number enums...
|
||||
OS << "\nenum { // Slot numbers...\n"
|
||||
|
@ -1291,6 +1292,5 @@ void InstrSelectorEmitter::run(std::ostream &OS) {
|
|||
<< " }\n\n N->addValue(Val); // Do not ever recalculate this\n"
|
||||
<< " return Val;\n}\n\n";
|
||||
}
|
||||
EmitSourceFileTail(OS);
|
||||
OS << "} // End llvm namespace \n";
|
||||
}
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@ void RegisterInfoEmitter::runEnums(std::ostream &OS) {
|
|||
std::string Namespace = Registers[0].TheDef->getValueAsString("Namespace");
|
||||
|
||||
EmitSourceFileHeader("Target Register Enum Values", OS);
|
||||
OS << "namespace llvm {\n\n";
|
||||
|
||||
if (!Namespace.empty())
|
||||
OS << "namespace " << Namespace << " {\n";
|
||||
|
@ -40,7 +41,7 @@ void RegisterInfoEmitter::runEnums(std::ostream &OS) {
|
|||
OS << " };\n";
|
||||
if (!Namespace.empty())
|
||||
OS << "}\n";
|
||||
EmitSourceFileTail(OS);
|
||||
OS << "} // End llvm namespace \n";
|
||||
}
|
||||
|
||||
void RegisterInfoEmitter::runHeader(std::ostream &OS) {
|
||||
|
@ -51,6 +52,8 @@ void RegisterInfoEmitter::runHeader(std::ostream &OS) {
|
|||
|
||||
OS << "#include \"llvm/Target/MRegisterInfo.h\"\n\n";
|
||||
|
||||
OS << "namespace llvm {\n\n";
|
||||
|
||||
OS << "struct " << ClassName << " : public MRegisterInfo {\n"
|
||||
<< " " << ClassName
|
||||
<< "(int CallFrameSetupOpcode = -1, int CallFrameDestroyOpcode = -1);\n"
|
||||
|
@ -67,7 +70,7 @@ void RegisterInfoEmitter::runHeader(std::ostream &OS) {
|
|||
OS << " extern TargetRegisterClass *" << Name << "RegisterClass;\n";
|
||||
}
|
||||
OS << "} // end of namespace " << TargetName << "\n\n";
|
||||
EmitSourceFileTail(OS);
|
||||
OS << "} // End llvm namespace \n";
|
||||
}
|
||||
|
||||
// RegisterInfoEmitter::run - Main register file description emitter.
|
||||
|
@ -76,6 +79,8 @@ void RegisterInfoEmitter::run(std::ostream &OS) {
|
|||
CodeGenTarget Target;
|
||||
EmitSourceFileHeader("Register Information Source Fragment", OS);
|
||||
|
||||
OS << "namespace llvm {\n\n";
|
||||
|
||||
// Start out by emitting each of the register classes... to do this, we build
|
||||
// a set of registers which belong to a register class, this is to ensure that
|
||||
// each register is only in a single register class.
|
||||
|
@ -236,5 +241,5 @@ void RegisterInfoEmitter::run(std::ostream &OS) {
|
|||
for (unsigned i = 0, e = CSR.size(); i != e; ++i)
|
||||
OS << getQualifiedName(CSR[i]) << ", ";
|
||||
OS << " 0\n };\n return CalleeSaveRegs;\n}\n\n";
|
||||
EmitSourceFileTail(OS);
|
||||
OS << "} // End llvm namespace \n";
|
||||
}
|
||||
|
|
|
@ -21,11 +21,7 @@ void TableGenBackend::EmitSourceFileHeader(const std::string &Desc,
|
|||
OS << "//===- TableGen'erated file -------------------------------------*-"
|
||||
" C++ -*-===//\n//\n// " << Desc << "\n//\n// Automatically generate"
|
||||
"d file, do not edit!\n//\n//===------------------------------------"
|
||||
"----------------------------------===//\n\nnamespace llvm {\n\n";
|
||||
}
|
||||
|
||||
void TableGenBackend::EmitSourceFileTail( std::ostream& OS ) const {
|
||||
OS << "} // End llvm namespace \n";
|
||||
"----------------------------------===//\n\n";
|
||||
}
|
||||
|
||||
/// getQualifiedName - Return the name of the specified record, with a
|
||||
|
|
|
@ -36,10 +36,6 @@ public: // Useful helper routines...
|
|||
/// ostream.
|
||||
void EmitSourceFileHeader(const std::string &Desc, std::ostream &OS) const;
|
||||
|
||||
/// EmitSourceFileTail - Output an LLVm styelf ile tail to the specified
|
||||
/// ostream.
|
||||
void EmitSourceFileTail( std::ostream& OS ) const;
|
||||
|
||||
/// getQualifiedName - Return the name of the specified record, with a
|
||||
/// namespace qualifier if the record contains one.
|
||||
std::string getQualifiedName(Record *R) const;
|
||||
|
|
Loading…
Reference in New Issue