mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-05-21 12:38:45 +00:00
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
This commit is contained in:
parent
0897c60822
commit
dfd414ab77
@ -131,6 +131,7 @@ void CodeEmitterGen::run(std::ostream &o) {
|
|||||||
|
|
||||||
// Mask off the right bits
|
// Mask off the right bits
|
||||||
// Low mask (ie. shift, if necessary)
|
// Low mask (ie. shift, if necessary)
|
||||||
|
assert(endBitInVar >= 0 && "Negative shift amount in masking!");
|
||||||
if (endBitInVar != 0) {
|
if (endBitInVar != 0) {
|
||||||
o << " op" << OpOrder[Vals[i].getName()]
|
o << " op" << OpOrder[Vals[i].getName()]
|
||||||
<< " >>= " << endBitInVar << ";\n";
|
<< " >>= " << endBitInVar << ";\n";
|
||||||
@ -143,6 +144,7 @@ void CodeEmitterGen::run(std::ostream &o) {
|
|||||||
<< " &= (1<<" << beginBitInVar+1 << ") - 1;\n";
|
<< " &= (1<<" << beginBitInVar+1 << ") - 1;\n";
|
||||||
|
|
||||||
// Shift the value to the correct place (according to place in inst)
|
// Shift the value to the correct place (according to place in inst)
|
||||||
|
assert(endBitInInst >= 0 && "Negative shift amount in inst position!");
|
||||||
if (endBitInInst != 0)
|
if (endBitInInst != 0)
|
||||||
o << " op" << OpOrder[Vals[i].getName()]
|
o << " op" << OpOrder[Vals[i].getName()]
|
||||||
<< " <<= " << endBitInInst << ";\n";
|
<< " <<= " << endBitInInst << ";\n";
|
||||||
|
@ -131,6 +131,7 @@ void CodeEmitterGen::run(std::ostream &o) {
|
|||||||
|
|
||||||
// Mask off the right bits
|
// Mask off the right bits
|
||||||
// Low mask (ie. shift, if necessary)
|
// Low mask (ie. shift, if necessary)
|
||||||
|
assert(endBitInVar >= 0 && "Negative shift amount in masking!");
|
||||||
if (endBitInVar != 0) {
|
if (endBitInVar != 0) {
|
||||||
o << " op" << OpOrder[Vals[i].getName()]
|
o << " op" << OpOrder[Vals[i].getName()]
|
||||||
<< " >>= " << endBitInVar << ";\n";
|
<< " >>= " << endBitInVar << ";\n";
|
||||||
@ -143,6 +144,7 @@ void CodeEmitterGen::run(std::ostream &o) {
|
|||||||
<< " &= (1<<" << beginBitInVar+1 << ") - 1;\n";
|
<< " &= (1<<" << beginBitInVar+1 << ") - 1;\n";
|
||||||
|
|
||||||
// Shift the value to the correct place (according to place in inst)
|
// Shift the value to the correct place (according to place in inst)
|
||||||
|
assert(endBitInInst >= 0 && "Negative shift amount in inst position!");
|
||||||
if (endBitInInst != 0)
|
if (endBitInInst != 0)
|
||||||
o << " op" << OpOrder[Vals[i].getName()]
|
o << " op" << OpOrder[Vals[i].getName()]
|
||||||
<< " <<= " << endBitInInst << ";\n";
|
<< " <<= " << endBitInInst << ";\n";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user