Debugging RuleSless2Zero

This commit is contained in:
caheckman 2019-07-24 10:24:56 -04:00
parent 6e44b809b9
commit b0a54473df

View file

@ -5280,7 +5280,6 @@ int4 RuleSLess2Zero::applyOp(PcodeOp *op,Funcdata &data)
} }
} }
else if (lvn->getOffset() == calc_mask(lvn->getSize())) { else if (lvn->getOffset() == calc_mask(lvn->getSize())) {
if (op->code() == CPUI_INT_SLESS) {
multop = rvn->getDef(); multop = rvn->getDef();
Varnode *hibit = getHiBit(multop); Varnode *hibit = getHiBit(multop);
if (hibit != (Varnode *) 0) { // Test for -1 s< (hi ^ lo) if (hibit != (Varnode *) 0) { // Test for -1 s< (hi ^ lo)
@ -5294,8 +5293,9 @@ int4 RuleSLess2Zero::applyOp(PcodeOp *op,Funcdata &data)
} }
else if (multop->code() == CPUI_SUBPIECE) { else if (multop->code() == CPUI_SUBPIECE) {
avn = multop->getIn(0); avn = multop->getIn(0);
if (avn->isFree()) return 0; if (avn->isFree())
if (avn->getSize() + (int4)multop->getIn(1)->getOffset() == rvn->getSize()) { return 0;
if (rvn->getSize() + (int4) multop->getIn(1)->getOffset() == avn->getSize()) {
// We have -1 s< SUB( avn, #hi ) // We have -1 s< SUB( avn, #hi )
data.opSetInput(op, avn, 1); data.opSetInput(op, avn, 1);
data.opSetInput(op, data.newConstant(avn->getSize(), calc_mask(avn->getSize())), 0); data.opSetInput(op, data.newConstant(avn->getSize(), calc_mask(avn->getSize())), 0);
@ -5305,14 +5305,14 @@ int4 RuleSLess2Zero::applyOp(PcodeOp *op,Funcdata &data)
else if (multop->code() == CPUI_INT_NEGATE) { else if (multop->code() == CPUI_INT_NEGATE) {
// We have -1 s< ~avn // We have -1 s< ~avn
avn = multop->getIn(0); avn = multop->getIn(0);
if (avn->isFree()) return 0; if (avn->isFree())
return 0;
data.opSetInput(op, avn, 0); data.opSetInput(op, avn, 0);
data.opSetInput(op, data.newConstant(avn->getSize(), 0), 1); data.opSetInput(op, data.newConstant(avn->getSize(), 0), 1);
return 1; return 1;
} }
} }
} }
}
else if (rvn->isConstant()) { else if (rvn->isConstant()) {
if (!lvn->isWritten()) return 0; if (!lvn->isWritten()) return 0;
if (rvn->getOffset() == 0) { if (rvn->getOffset() == 0) {
@ -5327,7 +5327,7 @@ int4 RuleSLess2Zero::applyOp(PcodeOp *op,Funcdata &data)
data.opSetInput(op,rvn,0); data.opSetInput(op,rvn,0);
return 1; return 1;
} }
else if (op->code() == CPUI_INT_SLESS) { else {
Varnode *hibit = getHiBit(multop); Varnode *hibit = getHiBit(multop);
if (hibit != (Varnode *)0) { // Test for (hi ^ lo) s< 0 if (hibit != (Varnode *)0) { // Test for (hi ^ lo) s< 0
if (hibit->isConstant()) if (hibit->isConstant())
@ -5340,7 +5340,7 @@ int4 RuleSLess2Zero::applyOp(PcodeOp *op,Funcdata &data)
else if (multop->code() == CPUI_SUBPIECE) { else if (multop->code() == CPUI_SUBPIECE) {
avn = multop->getIn(0); avn = multop->getIn(0);
if (avn->isFree()) return 0; if (avn->isFree()) return 0;
if (avn->getSize() + (int4)multop->getIn(1)->getOffset() == lvn->getSize()) { if (lvn->getSize() + (int4)multop->getIn(1)->getOffset() == avn->getSize()) {
// We have SUB( avn, #hi ) s< 0 // We have SUB( avn, #hi ) s< 0
data.opSetInput(op,avn,0); data.opSetInput(op,avn,0);
data.opSetInput(op,data.newConstant(avn->getSize(),0),1); data.opSetInput(op,data.newConstant(avn->getSize(),0),1);