[llvm-commits] CVS: llvm/utils/TableGen/FileParser.y Record.cpp Record.h
Chris Lattner
lattner at cs.uiuc.edu
Thu Dec 5 21:56:01 PST 2002
Changes in directory llvm/utils/TableGen:
FileParser.y updated: 1.2 -> 1.3
Record.cpp updated: 1.5 -> 1.6
Record.h updated: 1.7 -> 1.8
---
Log message:
Tighten up assertion checking
---
Diffs of the changes:
Index: llvm/utils/TableGen/FileParser.y
diff -u llvm/utils/TableGen/FileParser.y:1.2 llvm/utils/TableGen/FileParser.y:1.3
--- llvm/utils/TableGen/FileParser.y:1.2 Mon Dec 2 10:43:43 2002
+++ llvm/utils/TableGen/FileParser.y Thu Dec 5 21:55:39 2002
@@ -89,14 +89,21 @@
BitsInit *NewVal = new BitsInit(CurVal->getNumBits());
- for (unsigned i = 0, e = CurVal->getNumBits(); i != e; ++i)
- NewVal->setBit(i, CurVal->getBit(i));
-
- // Loop over bits, assigning values as appopriate...
+ // Loop over bits, assigning values as appropriate...
for (unsigned i = 0, e = BitList->size(); i != e; ++i) {
unsigned Bit = (*BitList)[i];
+ if (NewVal->getBit(i)) {
+ err() << "Cannot set bit #" << i << " of value '" << ValName
+ << "' more than once!\n";
+ abort();
+ }
NewVal->setBit(Bit, BInit->getBit(i));
}
+
+ for (unsigned i = 0, e = CurVal->getNumBits(); i != e; ++i)
+ if (NewVal->getBit(i) == 0)
+ NewVal->setBit(i, CurVal->getBit(i));
+
V = NewVal;
}
Index: llvm/utils/TableGen/Record.cpp
diff -u llvm/utils/TableGen/Record.cpp:1.5 llvm/utils/TableGen/Record.cpp:1.6
--- llvm/utils/TableGen/Record.cpp:1.5 Tue Dec 3 00:00:33 2002
+++ llvm/utils/TableGen/Record.cpp Thu Dec 5 21:55:39 2002
@@ -211,12 +211,14 @@
for (unsigned i = 0, e = Bits.size(); i != e; ++i) {
Init *B;
- New->setBit(i, getBit(i));
+ Init *CurBit = getBit(i);
+
do {
- B = New->getBit(i);
- New->setBit(i, B->resolveReferences(R));
- Changed |= B != New->getBit(i);
- } while (B != New->getBit(i));
+ B = CurBit;
+ CurBit = CurBit->resolveReferences(R);
+ Changed |= B != CurBit;
+ } while (B != CurBit);
+ New->setBit(i, CurBit);
}
if (Changed)
Index: llvm/utils/TableGen/Record.h
diff -u llvm/utils/TableGen/Record.h:1.7 llvm/utils/TableGen/Record.h:1.8
--- llvm/utils/TableGen/Record.h:1.7 Tue Dec 3 00:00:33 2002
+++ llvm/utils/TableGen/Record.h Thu Dec 5 21:55:39 2002
@@ -245,6 +245,7 @@
}
void setBit(unsigned Bit, Init *V) {
assert(Bit < Bits.size() && "Bit index out of range!");
+ assert(Bits[Bit] == 0 && "Bit already set!");
Bits[Bit] = V;
}
More information about the llvm-commits
mailing list