[llvm-commits] CVS: llvm/utils/TableGen/CodeEmitterGen.cpp CodeEmitterGen.h CodeGenWrappers.cpp CodeGenWrappers.h FileLexer.l FileParser.y InstrInfoEmitter.cpp InstrInfoEmitter.h InstrSelectorEmitter.cpp InstrSelectorEmitter.h Record.cpp Record.h RegisterInfoEmitter.cpp RegisterInfoEmitter.h TableGen.cpp TableGenBackend.cpp TableGenBackend.h
Brian Gaeke
gaeke at cs.uiuc.edu
Tue Nov 11 16:42:12 PST 2003
Changes in directory llvm/utils/TableGen:
CodeEmitterGen.cpp updated: 1.28 -> 1.29
CodeEmitterGen.h updated: 1.9 -> 1.10
CodeGenWrappers.cpp updated: 1.5 -> 1.6
CodeGenWrappers.h updated: 1.6 -> 1.7
FileLexer.l updated: 1.16 -> 1.17
FileParser.y updated: 1.25 -> 1.26
InstrInfoEmitter.cpp updated: 1.6 -> 1.7
InstrInfoEmitter.h updated: 1.4 -> 1.5
InstrSelectorEmitter.cpp updated: 1.35 -> 1.36
InstrSelectorEmitter.h updated: 1.22 -> 1.23
Record.cpp updated: 1.29 -> 1.30
Record.h updated: 1.37 -> 1.38
RegisterInfoEmitter.cpp updated: 1.14 -> 1.15
RegisterInfoEmitter.h updated: 1.5 -> 1.6
TableGen.cpp updated: 1.22 -> 1.23
TableGenBackend.cpp updated: 1.4 -> 1.5
TableGenBackend.h updated: 1.5 -> 1.6
---
Log message:
Put all LLVM code into the llvm namespace, as per bug 109.
---
Diffs of the changes: (+112 -14)
Index: llvm/utils/TableGen/CodeEmitterGen.cpp
diff -u llvm/utils/TableGen/CodeEmitterGen.cpp:1.28 llvm/utils/TableGen/CodeEmitterGen.cpp:1.29
--- llvm/utils/TableGen/CodeEmitterGen.cpp:1.28 Mon Oct 20 15:20:30 2003
+++ llvm/utils/TableGen/CodeEmitterGen.cpp Tue Nov 11 16:41:34 2003
@@ -15,6 +15,8 @@
#include "Record.h"
#include "Support/Debug.h"
+namespace llvm {
+
void CodeEmitterGen::run(std::ostream &o) {
std::vector<Record*> Insts = Records.getAllDerivedDefinitions("Instruction");
@@ -221,4 +223,8 @@
<< " }\n"
<< " return Value;\n"
<< "}\n";
+
+ EmitSourceFileTail(o);
}
+
+} // End llvm namespace
Index: llvm/utils/TableGen/CodeEmitterGen.h
diff -u llvm/utils/TableGen/CodeEmitterGen.h:1.9 llvm/utils/TableGen/CodeEmitterGen.h:1.10
--- llvm/utils/TableGen/CodeEmitterGen.h:1.9 Mon Oct 20 15:20:30 2003
+++ llvm/utils/TableGen/CodeEmitterGen.h Tue Nov 11 16:41:34 2003
@@ -16,6 +16,8 @@
#include "TableGenBackend.h"
+namespace llvm {
+
class CodeEmitterGen : public TableGenBackend {
RecordKeeper &Records;
public:
@@ -27,5 +29,7 @@
void emitMachineOpEmitter(std::ostream &o, const std::string &Namespace);
void emitGetValueBit(std::ostream &o, const std::string &Namespace);
};
+
+} // End llvm namespace
#endif
Index: llvm/utils/TableGen/CodeGenWrappers.cpp
diff -u llvm/utils/TableGen/CodeGenWrappers.cpp:1.5 llvm/utils/TableGen/CodeGenWrappers.cpp:1.6
--- llvm/utils/TableGen/CodeGenWrappers.cpp:1.5 Mon Oct 20 15:20:30 2003
+++ llvm/utils/TableGen/CodeGenWrappers.cpp Tue Nov 11 16:41:34 2003
@@ -17,6 +17,8 @@
#include "CodeGenWrappers.h"
#include "Record.h"
+namespace llvm {
+
/// getValueType - Return the MCV::ValueType that the specified TableGen record
/// corresponds to.
MVT::ValueType getValueType(Record *Rec) {
@@ -94,3 +96,5 @@
Record *CodeGenTarget::getInstructionSet() const {
return TargetRec->getValueAsDef("InstructionSet");
}
+
+} // End llvm namespace
Index: llvm/utils/TableGen/CodeGenWrappers.h
diff -u llvm/utils/TableGen/CodeGenWrappers.h:1.6 llvm/utils/TableGen/CodeGenWrappers.h:1.7
--- llvm/utils/TableGen/CodeGenWrappers.h:1.6 Mon Oct 20 15:20:30 2003
+++ llvm/utils/TableGen/CodeGenWrappers.h Tue Nov 11 16:41:34 2003
@@ -21,6 +21,9 @@
#include <iosfwd>
#include <string>
#include <vector>
+
+namespace llvm {
+
class Record;
class RecordKeeper;
@@ -59,5 +62,7 @@
// target, lazily reading it from the record keeper as needed.
// CodeGenInstructionSet *getInstructionSet -
};
+
+} // End llvm namespace
#endif
Index: llvm/utils/TableGen/FileLexer.l
diff -u llvm/utils/TableGen/FileLexer.l:1.16 llvm/utils/TableGen/FileLexer.l:1.17
--- llvm/utils/TableGen/FileLexer.l:1.16 Tue Oct 21 10:29:18 2003
+++ llvm/utils/TableGen/FileLexer.l Tue Nov 11 16:41:34 2003
@@ -28,9 +28,13 @@
%{
#include "Record.h"
-typedef std::pair<Record*, std::vector<Init*>*> SubClassRefTy;
+typedef std::pair<llvm::Record*, std::vector<llvm::Init*>*> SubClassRefTy;
#include "FileParser.h"
+int Fileparse();
+
+namespace llvm {
+
// Global variable recording the location of the include directory
std::string IncludeDirectory;
@@ -69,7 +73,6 @@
}
-int Fileparse();
//
// Function: ParseFile()
@@ -170,6 +173,10 @@
yy_switch_to_buffer(IncludeStack.back().Buffer);
return 0;
}
+
+} // End llvm namespace
+
+using namespace llvm;
%}
Index: llvm/utils/TableGen/FileParser.y
diff -u llvm/utils/TableGen/FileParser.y:1.25 llvm/utils/TableGen/FileParser.y:1.26
--- llvm/utils/TableGen/FileParser.y:1.25 Tue Oct 21 10:29:18 2003
+++ llvm/utils/TableGen/FileParser.y Tue Nov 11 16:41:34 2003
@@ -20,6 +20,9 @@
int yyerror(const char *ErrorMsg);
int yylex();
+
+namespace llvm {
+
extern int Filelineno;
static Record *CurRec = 0;
@@ -160,20 +163,23 @@
addSuperClass(SC);
}
+} // End llvm namespace
+
+using namespace llvm;
%}
%union {
- std::string *StrVal;
- int IntVal;
- RecTy *Ty;
- Init *Initializer;
- std::vector<Init*> *FieldList;
- std::vector<unsigned>*BitList;
- Record *Rec;
- SubClassRefTy *SubClassRef;
- std::vector<SubClassRefTy> *SubClassList;
- std::vector<std::pair<Init*, std::string> > *DagValueList;
+ std::string* StrVal;
+ int IntVal;
+ llvm::RecTy* Ty;
+ llvm::Init* Initializer;
+ std::vector<llvm::Init*>* FieldList;
+ std::vector<unsigned>* BitList;
+ llvm::Record* Rec;
+ SubClassRefTy* SubClassRef;
+ std::vector<SubClassRefTy>* SubClassList;
+ std::vector<std::pair<llvm::Init*, std::string> >* DagValueList;
};
%token INT BIT STRING BITS LIST CODE DAG CLASS DEF FIELD LET IN
@@ -193,6 +199,7 @@
%type <StrVal> Declaration OptID OptVarName
%start File
+
%%
ClassID : ID {
Index: llvm/utils/TableGen/InstrInfoEmitter.cpp
diff -u llvm/utils/TableGen/InstrInfoEmitter.cpp:1.6 llvm/utils/TableGen/InstrInfoEmitter.cpp:1.7
--- llvm/utils/TableGen/InstrInfoEmitter.cpp:1.6 Mon Oct 20 15:20:30 2003
+++ llvm/utils/TableGen/InstrInfoEmitter.cpp Tue Nov 11 16:41:34 2003
@@ -16,6 +16,8 @@
#include "CodeGenWrappers.h"
#include "Record.h"
+namespace llvm {
+
// runEnums - Print out enum values for all of the instructions.
void InstrInfoEmitter::runEnums(std::ostream &OS) {
std::vector<Record*> Insts = Records.getAllDerivedDefinitions("Instruction");
@@ -47,6 +49,7 @@
OS << " };\n";
if (!Namespace.empty())
OS << "}\n";
+ EmitSourceFileTail(OS);
}
void InstrInfoEmitter::printDefList(ListInit *LI, const std::string &Name,
@@ -93,6 +96,7 @@
if (Instructions[i] != PHI)
emitRecord(Instructions[i], i+1, InstrInfo, OS);
OS << "};\n";
+ EmitSourceFileTail(OS);
}
void InstrInfoEmitter::emitRecord(Record *R, unsigned Num, Record *InstrInfo,
@@ -169,3 +173,5 @@
std::cerr << "Unhandled initializer: " << *Val << "\n";
throw "In record '" + R->getName() + "' for TSFlag emission.";
}
+
+} // End llvm namespace
Index: llvm/utils/TableGen/InstrInfoEmitter.h
diff -u llvm/utils/TableGen/InstrInfoEmitter.h:1.4 llvm/utils/TableGen/InstrInfoEmitter.h:1.5
--- llvm/utils/TableGen/InstrInfoEmitter.h:1.4 Mon Oct 20 15:20:30 2003
+++ llvm/utils/TableGen/InstrInfoEmitter.h Tue Nov 11 16:41:34 2003
@@ -16,6 +16,9 @@
#define INSTRINFO_EMITTER_H
#include "TableGenBackend.h"
+
+namespace llvm {
+
class StringInit;
class IntInit;
class ListInit;
@@ -37,5 +40,7 @@
void emitShiftedValue(Record *R, StringInit *Val, IntInit *Shift,
std::ostream &OS);
};
+
+} // End llvm namespace
#endif
Index: llvm/utils/TableGen/InstrSelectorEmitter.cpp
diff -u llvm/utils/TableGen/InstrSelectorEmitter.cpp:1.35 llvm/utils/TableGen/InstrSelectorEmitter.cpp:1.36
--- llvm/utils/TableGen/InstrSelectorEmitter.cpp:1.35 Mon Oct 20 15:20:30 2003
+++ llvm/utils/TableGen/InstrSelectorEmitter.cpp Tue Nov 11 16:41:34 2003
@@ -19,6 +19,8 @@
#include "Support/StringExtras.h"
#include <set>
+namespace llvm {
+
NodeType::ArgResultTypes NodeType::Translate(Record *R) {
const std::string &Name = R->getName();
if (Name == "DNVT_any") return Any;
@@ -978,9 +980,10 @@
CalculateComputableValues();
+ OS << "#include \"llvm/CodeGen/MachineInstrBuilder.h\"\n";
+
EmitSourceFileHeader("Instruction Selector for the " + Target.getName() +
" target", OS);
- OS << "#include \"llvm/CodeGen/MachineInstrBuilder.h\"\n";
// Output the slot number enums...
OS << "\nenum { // Slot numbers...\n"
@@ -1290,5 +1293,7 @@
<< " }\n\n N->addValue(Val); // Do not ever recalculate this\n"
<< " return Val;\n}\n\n";
}
+ EmitSourceFileTail(OS);
}
+} // End llvm namespace
Index: llvm/utils/TableGen/InstrSelectorEmitter.h
diff -u llvm/utils/TableGen/InstrSelectorEmitter.h:1.22 llvm/utils/TableGen/InstrSelectorEmitter.h:1.23
--- llvm/utils/TableGen/InstrSelectorEmitter.h:1.22 Mon Oct 20 15:20:30 2003
+++ llvm/utils/TableGen/InstrSelectorEmitter.h Tue Nov 11 16:41:34 2003
@@ -21,6 +21,8 @@
#include <map>
#include <cassert>
+namespace llvm {
+
class DagInit;
class Init;
class InstrSelectorEmitter;
@@ -390,5 +392,7 @@
TreePatternNode *ArgDecl, Pattern *P,
bool PrintArg, std::ostream &OS);
};
+
+} // End llvm namespace
#endif
Index: llvm/utils/TableGen/Record.cpp
diff -u llvm/utils/TableGen/Record.cpp:1.29 llvm/utils/TableGen/Record.cpp:1.30
--- llvm/utils/TableGen/Record.cpp:1.29 Mon Oct 20 15:20:30 2003
+++ llvm/utils/TableGen/Record.cpp Tue Nov 11 16:41:34 2003
@@ -16,6 +16,8 @@
// Type implementations
//===----------------------------------------------------------------------===//
+namespace llvm {
+
void RecTy::dump() const { print(std::cerr); }
Init *BitRecTy::convertValue(BitsInit *BI) {
@@ -681,3 +683,5 @@
return Defs;
}
+
+} // End llvm namespace
Index: llvm/utils/TableGen/Record.h
diff -u llvm/utils/TableGen/Record.h:1.37 llvm/utils/TableGen/Record.h:1.38
--- llvm/utils/TableGen/Record.h:1.37 Mon Oct 20 15:20:30 2003
+++ llvm/utils/TableGen/Record.h Tue Nov 11 16:41:34 2003
@@ -21,6 +21,8 @@
#include <iostream>
#include <cassert>
+namespace llvm {
+
// RecTy subclasses...
class BitRecTy;
class BitsRecTy;
@@ -852,5 +854,7 @@
std::ostream &operator<<(std::ostream &OS, const RecordKeeper &RK);
extern RecordKeeper Records;
+
+} // End llvm namespace
#endif
Index: llvm/utils/TableGen/RegisterInfoEmitter.cpp
diff -u llvm/utils/TableGen/RegisterInfoEmitter.cpp:1.14 llvm/utils/TableGen/RegisterInfoEmitter.cpp:1.15
--- llvm/utils/TableGen/RegisterInfoEmitter.cpp:1.14 Mon Oct 20 15:20:30 2003
+++ llvm/utils/TableGen/RegisterInfoEmitter.cpp Tue Nov 11 16:41:34 2003
@@ -19,6 +19,8 @@
#include "Support/StringExtras.h"
#include <set>
+namespace llvm {
+
// runEnums - Print out enum values for all of the registers.
void RegisterInfoEmitter::runEnums(std::ostream &OS) {
std::vector<Record*> Registers = Records.getAllDerivedDefinitions("Register");
@@ -40,6 +42,7 @@
OS << " };\n";
if (!Namespace.empty())
OS << "}\n";
+ EmitSourceFileTail(OS);
}
void RegisterInfoEmitter::runHeader(std::ostream &OS) {
@@ -68,6 +71,7 @@
OS << " extern TargetRegisterClass *" << Name << "RegisterClass;\n";
}
OS << "} // end of namespace " << TargetName << "\n\n";
+ EmitSourceFileTail(OS);
}
// RegisterInfoEmitter::run - Main register file description emitter.
@@ -240,4 +244,7 @@
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);
}
+
+} // End llvm namespace
Index: llvm/utils/TableGen/RegisterInfoEmitter.h
diff -u llvm/utils/TableGen/RegisterInfoEmitter.h:1.5 llvm/utils/TableGen/RegisterInfoEmitter.h:1.6
--- llvm/utils/TableGen/RegisterInfoEmitter.h:1.5 Mon Oct 20 15:20:30 2003
+++ llvm/utils/TableGen/RegisterInfoEmitter.h Tue Nov 11 16:41:34 2003
@@ -18,6 +18,8 @@
#include "TableGenBackend.h"
+namespace llvm {
+
class RegisterInfoEmitter : public TableGenBackend {
RecordKeeper &Records;
public:
@@ -32,5 +34,7 @@
// runEnums - Print out enum values for all of the registers.
void runEnums(std::ostream &o);
};
+
+} // End llvm namespace
#endif
Index: llvm/utils/TableGen/TableGen.cpp
diff -u llvm/utils/TableGen/TableGen.cpp:1.22 llvm/utils/TableGen/TableGen.cpp:1.23
--- llvm/utils/TableGen/TableGen.cpp:1.22 Mon Oct 20 15:20:30 2003
+++ llvm/utils/TableGen/TableGen.cpp Tue Nov 11 16:41:34 2003
@@ -27,6 +27,8 @@
#include <cstdio>
#include <fstream>
+namespace llvm {
+
enum ActionType {
PrintRecords,
GenEmitter,
@@ -406,6 +408,9 @@
}
}
+} // End llvm namespace
+
+using namespace llvm;
int main(int argc, char **argv) {
cl::ParseCommandLineOptions(argc, argv);
@@ -459,11 +464,16 @@
InstrSelectorEmitter(Records).run(*Out);
break;
case PrintEnums:
+ {
std::vector<Record*> Recs = Records.getAllDerivedDefinitions(Class);
for (unsigned i = 0, e = Recs.size(); i != e; ++i)
*Out << Recs[i] << ", ";
*Out << "\n";
break;
+ }
+ default:
+ assert(1 && "Invalid Action");
+ return 1;
}
} catch (const std::string &Error) {
std::cerr << Error << "\n";
Index: llvm/utils/TableGen/TableGenBackend.cpp
diff -u llvm/utils/TableGen/TableGenBackend.cpp:1.4 llvm/utils/TableGen/TableGenBackend.cpp:1.5
--- llvm/utils/TableGen/TableGenBackend.cpp:1.4 Mon Oct 20 15:20:30 2003
+++ llvm/utils/TableGen/TableGenBackend.cpp Tue Nov 11 16:41:34 2003
@@ -15,12 +15,18 @@
#include "Record.h"
#include <iostream>
+namespace llvm {
+
void TableGenBackend::EmitSourceFileHeader(const std::string &Desc,
std::ostream &OS) const {
OS << "//===- TableGen'erated file -------------------------------------*-"
" C++ -*-===//\n//\n// " << Desc << "\n//\n// Automatically generate"
"d file, do not edit!\n//\n//===------------------------------------"
- "----------------------------------===//\n\n";
+ "----------------------------------===//\n\nnamespace llvm {\n\n";
+}
+
+void TableGenBackend::EmitSourceFileTail( std::ostream& OS ) const {
+ OS << "} // End llvm namespace \n";
}
/// getQualifiedName - Return the name of the specified record, with a
@@ -32,3 +38,4 @@
return Namespace + "::" + R->getName();
}
+} // End llvm namespace
Index: llvm/utils/TableGen/TableGenBackend.h
diff -u llvm/utils/TableGen/TableGenBackend.h:1.5 llvm/utils/TableGen/TableGenBackend.h:1.6
--- llvm/utils/TableGen/TableGenBackend.h:1.5 Mon Oct 20 15:20:30 2003
+++ llvm/utils/TableGen/TableGenBackend.h Tue Nov 11 16:41:34 2003
@@ -17,6 +17,9 @@
#include <string>
#include <iosfwd>
+
+namespace llvm {
+
class Record;
class RecordKeeper;
@@ -33,9 +36,15 @@
/// 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;
};
+
+} // End llvm namespace
#endif
More information about the llvm-commits
mailing list