mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-16 08:08:01 +00:00
Add and use a new method
llvm-svn: 7682
This commit is contained in:
parent
4d0c647dec
commit
69b1d7c0d6
@ -703,6 +703,13 @@ public:
|
||||
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);
|
||||
|
@ -73,7 +73,6 @@ void RegisterInfoEmitter::run(std::ostream &OS) {
|
||||
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 @@ void RegisterInfoEmitter::run(std::ostream &OS) {
|
||||
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))
|
||||
|
Loading…
Reference in New Issue
Block a user