1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 19:23:23 +01:00

Ignore X = X assignments that was causing Alkis's rewrite of X86.td to crash

tblgen.

llvm-svn: 11948
This commit is contained in:
Chris Lattner 2004-02-28 17:31:28 +00:00
parent fbca3a0161
commit 7d89f8837d

View File

@ -68,7 +68,7 @@ static void addSuperClass(Record *SC) {
static void setValue(const std::string &ValName,
std::vector<unsigned> *BitList, Init *V) {
if (!V) return ;
if (!V) return;
RecordVal *RV = CurRec->getValue(ValName);
if (RV == 0) {
@ -76,6 +76,13 @@ static void setValue(const std::string &ValName,
exit(1);
}
// Do not allow assignments like 'X = X'. This will just cause infinite loops
// in the resolution machinery.
if (!BitList)
if (VarInit *VI = dynamic_cast<VarInit*>(V))
if (VI->getName() == ValName)
return;
// If we are assigning to a subset of the bits in the value... then we must be
// assigning to a field of BitsRecTy, which must have a BitsInit
// initializer...
@ -154,10 +161,9 @@ static void addSubClass(Record *SC, const std::vector<Init*> &TemplateArgs) {
}
}
// Since everything went well, we can now set the "superclass" list for the
// current record.
const std::vector<Record*> &SCs = SC->getSuperClasses();
const std::vector<Record*> &SCs = SC->getSuperClasses();
for (unsigned i = 0, e = SCs.size(); i != e; ++i)
addSuperClass(SCs[i]);
addSuperClass(SC);