mirror of
https://github.com/cc65/cc65.git
synced 2024-12-28 22:30:12 +00:00
Added load/store transformation
git-svn-id: svn://svn.cc65.org/cc65/trunk@554 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
parent
c8171988a2
commit
a4fd5c7648
@ -1589,7 +1589,6 @@ static void OptLoads (void)
|
||||
|
||||
/* Delete the remaining lines */
|
||||
FreeLines (L2 [0], L2 [3]);
|
||||
}
|
||||
|
||||
/* Check for
|
||||
*
|
||||
@ -1616,7 +1615,7 @@ static void OptLoads (void)
|
||||
* possible to rewrite the library routine to get rid of the additional
|
||||
* overhead.
|
||||
*/
|
||||
if (LineMatch (L, "\tldy\t#$") &&
|
||||
} else if (LineMatch (L, "\tldy\t#$") &&
|
||||
GetNextCodeLines (L, L2, 6) &&
|
||||
LineFullMatch (L2 [0], "\tlda\t(sp),y") &&
|
||||
LineFullMatch (L2 [1], "\ttax") &&
|
||||
@ -1637,7 +1636,6 @@ static void OptLoads (void)
|
||||
|
||||
/* Delete the remaining lines */
|
||||
FreeLines (L2 [0], L2 [3]);
|
||||
}
|
||||
|
||||
/* Search for:
|
||||
*
|
||||
@ -1648,15 +1646,45 @@ static void OptLoads (void)
|
||||
*
|
||||
* jsr pushaysp
|
||||
*/
|
||||
if (LineFullMatch (L, "\tlda\t(sp),y") &&
|
||||
} else if (LineFullMatch (L, "\tlda\t(sp),y") &&
|
||||
GetNextCodeLines (L, L2, 1) &&
|
||||
LineFullMatch (L2 [0], "\tjsr\tpusha")) {
|
||||
|
||||
/* Found, replace it */
|
||||
L = ReplaceLine (L, "\tjsr\tpushaysp");
|
||||
FreeLine (L2 [0]);
|
||||
|
||||
/* Search for:
|
||||
*
|
||||
* ldx xx
|
||||
* lda yy
|
||||
* sta zzz
|
||||
* stx zzz+1
|
||||
*
|
||||
* and replace it by:
|
||||
*
|
||||
* lda xx
|
||||
* sta zzz
|
||||
* lda yy
|
||||
* sta zzz+1
|
||||
*
|
||||
* provided that that the X register is not used later. While this is
|
||||
* no direct optimization, it helps with other optimizations.
|
||||
*/
|
||||
} else if (LineMatch (L, "\tldx\t") &&
|
||||
GetNextCodeLines (L, L2, 3) &&
|
||||
LineMatch (L2 [0], "\tlda\t") &&
|
||||
Is16BitStore (L2[1], L2[2]) &&
|
||||
!RegXUsed (L2[2])) {
|
||||
|
||||
/* Found - replace it */
|
||||
NewLineAfter (L2[1], "\tlda\t%s", L->Line+5);
|
||||
L2[2]->Line[3] = 'a';
|
||||
FreeLine (L);
|
||||
L = L2[2];
|
||||
}
|
||||
|
||||
|
||||
/* All other patterns start with this one: */
|
||||
if (!LineFullMatch (L, "\tldx\t#$00")) {
|
||||
/* Next line */
|
||||
|
Loading…
Reference in New Issue
Block a user