[llvm-commits] CVS: llvm/utils/TableGen/CodeEmitterGen.cpp

Misha Brukman brukman at cs.uiuc.edu
Wed Aug 6 11:29:01 PDT 2003


Changes in directory llvm/utils/TableGen:

CodeEmitterGen.cpp updated: 1.25 -> 1.26

---
Log message:

Added asserts to prevent negative shift amounts from being generated.


---
Diffs of the changes:

Index: llvm/utils/TableGen/CodeEmitterGen.cpp
diff -u llvm/utils/TableGen/CodeEmitterGen.cpp:1.25 llvm/utils/TableGen/CodeEmitterGen.cpp:1.26
--- llvm/utils/TableGen/CodeEmitterGen.cpp:1.25	Tue Aug  5 23:36:35 2003
+++ llvm/utils/TableGen/CodeEmitterGen.cpp	Wed Aug  6 11:28:49 2003
@@ -131,6 +131,7 @@
             
             // Mask off the right bits
             // Low mask (ie. shift, if necessary)
+            assert(endBitInVar >= 0 && "Negative shift amount in masking!");
             if (endBitInVar != 0) {
               o << "      op" << OpOrder[Vals[i].getName()]
                 << " >>= " << endBitInVar << ";\n";
@@ -143,6 +144,7 @@
               << " &= (1<<" << beginBitInVar+1 << ") - 1;\n";
             
             // Shift the value to the correct place (according to place in inst)
+            assert(endBitInInst >= 0 && "Negative shift amount in inst position!");
             if (endBitInInst != 0)
               o << "      op" << OpOrder[Vals[i].getName()]
               << " <<= " << endBitInInst << ";\n";





More information about the llvm-commits mailing list