[llvm-commits] [llvm] r121837 - in /llvm/trunk/utils/TableGen: AsmMatcherEmitter.cpp CodeGenTarget.cpp LLVMCConfigurationEmitter.h Record.h TGParser.cpp TGParser.h TableGen.cpp
Chris Lattner
sabre at nondot.org
Tue Dec 14 20:48:22 PST 2010
Author: lattner
Date: Tue Dec 14 22:48:22 2010
New Revision: 121837
URL: http://llvm.org/viewvc/llvm-project?rev=121837&view=rev
Log:
various cleanups to tblgen, patch by Garrison Venn!
Modified:
llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp
llvm/trunk/utils/TableGen/CodeGenTarget.cpp
llvm/trunk/utils/TableGen/LLVMCConfigurationEmitter.h
llvm/trunk/utils/TableGen/Record.h
llvm/trunk/utils/TableGen/TGParser.cpp
llvm/trunk/utils/TableGen/TGParser.h
llvm/trunk/utils/TableGen/TableGen.cpp
Modified: llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp?rev=121837&r1=121836&r2=121837&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp Tue Dec 14 22:48:22 2010
@@ -493,7 +493,7 @@
class AsmMatcherInfo {
public:
/// Tracked Records
- RecordKeeper& Records;
+ RecordKeeper &Records;
/// The tablegen AsmParser record.
Record *AsmParser;
@@ -551,7 +551,7 @@
public:
AsmMatcherInfo(Record *AsmParser,
CodeGenTarget &Target,
- RecordKeeper& Records);
+ RecordKeeper &Records);
/// BuildInfo - Construct the various tables used during matching.
void BuildInfo();
@@ -565,12 +565,8 @@
return I == SubtargetFeatures.end() ? 0 : I->second;
}
- RecordKeeper& getRecords() {
- return(Records);
- }
-
- RecordKeeper& getRecords() const {
- return(Records);
+ RecordKeeper &getRecords() const {
+ return Records;
}
};
@@ -1004,7 +1000,7 @@
AsmMatcherInfo::AsmMatcherInfo(Record *asmParser,
CodeGenTarget &target,
- RecordKeeper& records)
+ RecordKeeper &records)
: Records(records), AsmParser(asmParser), Target(target),
RegisterPrefix(AsmParser->getValueAsString("RegisterPrefix")) {
}
Modified: llvm/trunk/utils/TableGen/CodeGenTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeGenTarget.cpp?rev=121837&r1=121836&r2=121837&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/CodeGenTarget.cpp (original)
+++ llvm/trunk/utils/TableGen/CodeGenTarget.cpp Tue Dec 14 22:48:22 2010
@@ -108,7 +108,7 @@
/// getTarget - Return the current instance of the Target class.
///
-CodeGenTarget::CodeGenTarget(RecordKeeper& records) : Records(records) {
+CodeGenTarget::CodeGenTarget(RecordKeeper &records) : Records(records) {
std::vector<Record*> Targets = Records.getAllDerivedDefinitions("Target");
if (Targets.size() == 0)
throw std::string("ERROR: No 'Target' subclasses defined!");
Modified: llvm/trunk/utils/TableGen/LLVMCConfigurationEmitter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/LLVMCConfigurationEmitter.h?rev=121837&r1=121836&r2=121837&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/LLVMCConfigurationEmitter.h (original)
+++ llvm/trunk/utils/TableGen/LLVMCConfigurationEmitter.h Tue Dec 14 22:48:22 2010
@@ -23,7 +23,7 @@
class LLVMCConfigurationEmitter : public TableGenBackend {
RecordKeeper &Records;
public:
- explicit LLVMCConfigurationEmitter(RecordKeeper& records) :
+ explicit LLVMCConfigurationEmitter(RecordKeeper &records) :
Records(records) {}
// run - Output the asmwriter, returning true on failure.
Modified: llvm/trunk/utils/TableGen/Record.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/Record.h?rev=121837&r1=121836&r2=121837&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/Record.h (original)
+++ llvm/trunk/utils/TableGen/Record.h Tue Dec 14 22:48:22 2010
@@ -1236,8 +1236,8 @@
public:
- // Constructs a record. See also RecordKeeper::createRecord.
- explicit Record(const std::string &N, SMLoc loc, RecordKeeper& records) :
+ // Constructs a record.
+ explicit Record(const std::string &N, SMLoc loc, RecordKeeper &records) :
ID(LastID++), Name(N), Loc(loc), TrackedRecords(records) {}
~Record() {}
@@ -1324,7 +1324,7 @@
void resolveReferencesTo(const RecordVal *RV);
RecordKeeper &getRecords() const {
- return(TrackedRecords);
+ return TrackedRecords;
}
void dump() const;
@@ -1466,12 +1466,6 @@
std::vector<Record*>
getAllDerivedDefinitions(const std::string &ClassName) const;
- // allocates and returns a record.
- Record *createRecord(const std::string &N, SMLoc loc) {
- return(new Record(N, loc, *this));
- }
-
-
void dump() const;
};
Modified: llvm/trunk/utils/TableGen/TGParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/TGParser.cpp?rev=121837&r1=121836&r2=121837&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/TGParser.cpp (original)
+++ llvm/trunk/utils/TableGen/TGParser.cpp Tue Dec 14 22:48:22 2010
@@ -1096,8 +1096,9 @@
// Create the new record, set it as CurRec temporarily.
static unsigned AnonCounter = 0;
- Record *NewRec = Records.createRecord(
- "anonymous.val."+utostr(AnonCounter++),NameLoc);
+ Record *NewRec = new Record("anonymous.val."+utostr(AnonCounter++),
+ NameLoc,
+ Records);
SubClassReference SCRef;
SCRef.RefLoc = NameLoc;
SCRef.Rec = Class;
@@ -1661,7 +1662,7 @@
Lex.Lex(); // Eat the 'def' token.
// Parse ObjectName and make a record for it.
- Record *CurRec = Records.createRecord(ParseObjectName(), DefLoc);
+ Record *CurRec = new Record(ParseObjectName(), DefLoc, Records);
if (!CurMultiClass) {
// Top-level def definition.
@@ -1728,7 +1729,7 @@
return TokError("Class '" + CurRec->getName() + "' already defined");
} else {
// If this is the first reference to this class, create and add it.
- CurRec = Records.createRecord(Lex.getCurStrVal(), Lex.getLoc());
+ CurRec = new Record(Lex.getCurStrVal(), Lex.getLoc(), Records);
Records.addClass(CurRec);
}
Lex.Lex(); // eat the name.
@@ -1975,7 +1976,7 @@
}
}
- Record *CurRec = Records.createRecord(DefName, DefmPrefixLoc);
+ Record *CurRec = new Record(DefName, DefmPrefixLoc, Records);
SubClassReference Ref;
Ref.RefLoc = DefmPrefixLoc;
Modified: llvm/trunk/utils/TableGen/TGParser.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/TGParser.h?rev=121837&r1=121836&r2=121837&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/TGParser.h (original)
+++ llvm/trunk/utils/TableGen/TGParser.h Tue Dec 14 22:48:22 2010
@@ -50,9 +50,9 @@
MultiClass *CurMultiClass;
// Record tracker
- RecordKeeper& Records;
+ RecordKeeper &Records;
public:
- TGParser(SourceMgr &SrcMgr, RecordKeeper& records) :
+ TGParser(SourceMgr &SrcMgr, RecordKeeper &records) :
Lex(SrcMgr), CurMultiClass(0), Records(records) {}
/// ParseFile - Main entrypoint for parsing a tblgen file. These parser
Modified: llvm/trunk/utils/TableGen/TableGen.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/TableGen.cpp?rev=121837&r1=121836&r2=121837&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/TableGen.cpp (original)
+++ llvm/trunk/utils/TableGen/TableGen.cpp Tue Dec 14 22:48:22 2010
@@ -186,7 +186,7 @@
static bool ParseFile(const std::string &Filename,
const std::vector<std::string> &IncludeDirs,
SourceMgr &SrcMgr,
- RecordKeeper& Records) {
+ RecordKeeper &Records) {
error_code ec;
MemoryBuffer *F = MemoryBuffer::getFileOrSTDIN(Filename.c_str(), ec);
if (F == 0) {
More information about the llvm-commits
mailing list