[llvm-commits] CVS: llvm/utils/TableGen/Record.cpp
Chris Lattner
lattner at cs.uiuc.edu
Mon Aug 4 00:01:48 PDT 2003
Changes in directory llvm/utils/TableGen:
Record.cpp updated: 1.19 -> 1.20
---
Log message:
Fix bug: TableGen/BitsInitOverflow.td
---
Diffs of the changes:
Index: llvm/utils/TableGen/Record.cpp
diff -u llvm/utils/TableGen/Record.cpp:1.19 llvm/utils/TableGen/Record.cpp:1.20
--- llvm/utils/TableGen/Record.cpp:1.19 Sun Aug 3 13:16:55 2003
+++ llvm/utils/TableGen/Record.cpp Sun Aug 3 13:24:34 2003
@@ -53,10 +53,19 @@
//
Init *BitsRecTy::convertValue(IntInit *II) {
int Value = II->getValue();
+ // Make sure this bitfield is large enough to hold the integer value...
+ if (Value >= 0) {
+ if (Value & ~((1 << Size)-1))
+ return 0;
+ } else {
+ if ((Value >> Size) != -1 || ((Value & (1 << Size-1)) == 0))
+ return 0;
+ }
BitsInit *Ret = new BitsInit(Size);
for (unsigned i = 0; i != Size; ++i)
Ret->setBit(i, new BitInit(Value & (1 << i)));
+
return Ret;
}
More information about the llvm-commits
mailing list