Minor code improvement.
git-svn-id: svn://svn.cc65.org/cc65/trunk@4106 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
parent
944057238e
commit
7c4240fe69
1 changed files with 19 additions and 3 deletions
|
@ -752,7 +752,7 @@ unsigned OptCondBranches1 (CodeSeg* S)
|
||||||
CS_DelEntry (S, I+1);
|
CS_DelEntry (S, I+1);
|
||||||
|
|
||||||
/* Remember, we had changes */
|
/* Remember, we had changes */
|
||||||
++Changes;
|
++Changes;
|
||||||
|
|
||||||
} else if ((BC == BC_EQ && E->Num == 0) ||
|
} else if ((BC == BC_EQ && E->Num == 0) ||
|
||||||
(BC == BC_NE && E->Num != 0) ||
|
(BC == BC_NE && E->Num != 0) ||
|
||||||
|
@ -1880,17 +1880,33 @@ unsigned OptPrecalc (CodeSeg* S)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OP65_ADC:
|
|
||||||
case OP65_ASL:
|
case OP65_ASL:
|
||||||
case OP65_EOR:
|
case OP65_EOR:
|
||||||
case OP65_LSR:
|
case OP65_LSR:
|
||||||
case OP65_SBC:
|
|
||||||
if (RegValIsKnown (Out->RegA)) {
|
if (RegValIsKnown (Out->RegA)) {
|
||||||
/* Accu op zp with known contents */
|
/* Accu op zp with known contents */
|
||||||
Arg = MakeHexArg (Out->RegA);
|
Arg = MakeHexArg (Out->RegA);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case OP65_ADC:
|
||||||
|
case OP65_SBC:
|
||||||
|
/* If this is an operation with an immediate operand of zero,
|
||||||
|
* and the register is zero, the operation won't give us any
|
||||||
|
* results we don't already have (including the flags), so
|
||||||
|
* remove it. Something like this is generated as a result of
|
||||||
|
* a compare where parts of the values are known to be zero.
|
||||||
|
*/
|
||||||
|
if (In->RegA == 0 && CE_IsKnownImm (E, 0x00)) {
|
||||||
|
/* 0-0 or 0+0 -> remove */
|
||||||
|
CS_DelEntry (S, I);
|
||||||
|
++Changes;
|
||||||
|
} else if (RegValIsKnown (Out->RegA)) {
|
||||||
|
/* Accu op zp with known contents */
|
||||||
|
Arg = MakeHexArg (Out->RegA);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case OP65_AND:
|
case OP65_AND:
|
||||||
if (CE_IsKnownImm (E, 0xFF)) {
|
if (CE_IsKnownImm (E, 0xFF)) {
|
||||||
/* AND with 0xFF, remove */
|
/* AND with 0xFF, remove */
|
||||||
|
|
Loading…
Add table
Reference in a new issue