1
0
mirror of https://github.com/cc65/cc65.git synced 2024-07-03 06:29:36 +00:00

Minor code improvement.

git-svn-id: svn://svn.cc65.org/cc65/trunk@4106 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
uz 2009-09-01 09:15:19 +00:00
parent 944057238e
commit 7c4240fe69

View File

@ -752,7 +752,7 @@ unsigned OptCondBranches1 (CodeSeg* S)
CS_DelEntry (S, I+1);
/* Remember, we had changes */
++Changes;
++Changes;
} else if ((BC == BC_EQ && E->Num == 0) ||
(BC == BC_NE && E->Num != 0) ||
@ -1880,17 +1880,33 @@ unsigned OptPrecalc (CodeSeg* S)
}
break;
case OP65_ADC:
case OP65_ASL:
case OP65_EOR:
case OP65_LSR:
case OP65_SBC:
if (RegValIsKnown (Out->RegA)) {
/* Accu op zp with known contents */
Arg = MakeHexArg (Out->RegA);
}
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:
if (CE_IsKnownImm (E, 0xFF)) {
/* AND with 0xFF, remove */