diff options
author | Chris Lattner <sabre@nondot.org> | 2004-02-28 17:31:28 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2004-02-28 17:31:28 +0000 |
commit | 81d50adfafe858c713855b1d567c34bf45d721cf (patch) | |
tree | f655095deb2efa8b8ec9182c7da63273897ac314 /utils | |
parent | 7b6ee7d8f128d005f448a9b70714ed6fefea93a9 (diff) | |
download | llvm-81d50adfafe858c713855b1d567c34bf45d721cf.tar.gz llvm-81d50adfafe858c713855b1d567c34bf45d721cf.tar.bz2 llvm-81d50adfafe858c713855b1d567c34bf45d721cf.tar.xz |
Ignore X = X assignments that was causing Alkis's rewrite of X86.td to crash
tblgen.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11948 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils')
-rw-r--r-- | utils/TableGen/FileParser.y | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/utils/TableGen/FileParser.y b/utils/TableGen/FileParser.y index af8d3d4ff2..d0f88c30c0 100644 --- a/utils/TableGen/FileParser.y +++ b/utils/TableGen/FileParser.y @@ -68,13 +68,20 @@ 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) { err() << "Value '" << ValName << "' unknown!\n"; 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 @@ -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); |