aboutsummaryrefslogtreecommitdiff
path: root/utils/TableGen/CodeEmitterGen.cpp
diff options
context:
space:
mode:
authorMisha Brukman <brukman+llvm@gmail.com>2003-08-06 16:28:49 +0000
committerMisha Brukman <brukman+llvm@gmail.com>2003-08-06 16:28:49 +0000
commitdfd414ab770a389d29b7294f20e38cbf74c9f9a9 (patch)
tree59cff411777dc71243801088439c8b7b1a90f316 /utils/TableGen/CodeEmitterGen.cpp
parent0897c6082215da422a486274efc7bbee78ba9a43 (diff)
Added asserts to prevent negative shift amounts from being generated.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7640 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/TableGen/CodeEmitterGen.cpp')
-rw-r--r--utils/TableGen/CodeEmitterGen.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/utils/TableGen/CodeEmitterGen.cpp b/utils/TableGen/CodeEmitterGen.cpp
index 076945616f..a2839c9177 100644
--- a/utils/TableGen/CodeEmitterGen.cpp
+++ b/utils/TableGen/CodeEmitterGen.cpp
@@ -131,6 +131,7 @@ void CodeEmitterGen::run(std::ostream &o) {
// 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 @@ void CodeEmitterGen::run(std::ostream &o) {
<< " &= (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";