1
0
mirror of https://github.com/cc65/cc65.git synced 2024-12-25 17:29:50 +00:00

Fixed a problem with OptJumpTarget1: The inspected jump must not have a label

attached, because the effective code changes for code jumping to this label if
removals are applied.


git-svn-id: svn://svn.cc65.org/cc65/trunk@4169 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
uz 2009-09-14 18:36:38 +00:00
parent b7df1ed5d4
commit 254e1169f2

View File

@ -564,12 +564,13 @@ unsigned OptJumpTarget1 (CodeSeg* S)
/* Get next entry */ /* Get next entry */
E2 = CS_GetNextEntry (S, I); E2 = CS_GetNextEntry (S, I);
/* Check if we have a jump or branch, and a matching label, which /* Check if we have a jump or branch without a label attached, and
* is not attached to the jump itself * a jump target, which is not attached to the jump itself
*/ */
if (E2 != 0 && if (E2 != 0 &&
(E2->Info & OF_UBRA) != 0 && (E2->Info & OF_UBRA) != 0 &&
E2->JumpTo && !CE_HasLabel (E2) &&
E2->JumpTo &&
E2->JumpTo->Owner != E2) { E2->JumpTo->Owner != E2) {
/* Get the entry preceeding the branch target */ /* Get the entry preceeding the branch target */
@ -1805,7 +1806,7 @@ unsigned OptPushPop (CodeSeg* S)
++Changes; ++Changes;
} else if ((E->Info & OF_CBRA) == 0 && } else if ((E->Info & OF_CBRA) == 0 &&
(!RegAUsed (S, I) || !ChgA)) { (!RegAUsed (S, I) || !ChgA)) {
/* We can remove the PHA and PLA instructions */ /* We can remove the PHA and PLA instructions */
CS_DelEntry (S, Pop); CS_DelEntry (S, Pop);