[llvm-commits] CVS: llvm/utils/TableGen/RegisterInfoEmitter.cpp Record.h
Chris Lattner
lattner at cs.uiuc.edu
Thu Aug 7 14:43:14 PDT 2003
Changes in directory llvm/utils/TableGen:
RegisterInfoEmitter.cpp updated: 1.10 -> 1.11
Record.h updated: 1.33 -> 1.34
---
Log message:
Add and use a new method
---
Diffs of the changes:
Index: llvm/utils/TableGen/RegisterInfoEmitter.cpp
diff -u llvm/utils/TableGen/RegisterInfoEmitter.cpp:1.10 llvm/utils/TableGen/RegisterInfoEmitter.cpp:1.11
--- llvm/utils/TableGen/RegisterInfoEmitter.cpp:1.10 Thu Aug 7 00:39:09 2003
+++ llvm/utils/TableGen/RegisterInfoEmitter.cpp Thu Aug 7 14:41:58 2003
@@ -73,7 +73,6 @@
Records.getAllDerivedDefinitions("RegisterClass");
std::vector<Record*> Registers = Records.getAllDerivedDefinitions("Register");
- Record *RegisterClass = Records.getClass("Register");
std::set<Record*> RegistersFound;
std::vector<std::string> RegClassNames;
@@ -99,7 +98,7 @@
DefInit *RegDef = dynamic_cast<DefInit*>(RegList->getElement(i));
if (!RegDef) throw "Register class member is not a record!";
Record *Reg = RegDef->getDef();
- if (!Reg->isSubClassOf(RegisterClass))
+ if (!Reg->isSubClassOf("Register"))
throw "Register Class member '" + Reg->getName() +
" does not derive from the Register class!";
if (RegistersFound.count(Reg))
Index: llvm/utils/TableGen/Record.h
diff -u llvm/utils/TableGen/Record.h:1.33 llvm/utils/TableGen/Record.h:1.34
--- llvm/utils/TableGen/Record.h:1.33 Thu Aug 7 01:00:43 2003
+++ llvm/utils/TableGen/Record.h Thu Aug 7 14:41:59 2003
@@ -703,6 +703,13 @@
return false;
}
+ bool isSubClassOf(const std::string &Name) const {
+ for (unsigned i = 0, e = SuperClasses.size(); i != e; ++i)
+ if (SuperClasses[i]->getName() == Name)
+ return true;
+ return false;
+ }
+
void addSuperClass(Record *R) {
assert(!isSubClassOf(R) && "Already subclassing record!");
SuperClasses.push_back(R);
More information about the llvm-commits
mailing list