mirror of
https://github.com/cc65/cc65.git
synced 2024-12-24 11:31:31 +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 */
|
/* Delete the remaining lines */
|
||||||
FreeLines (L2 [0], L2 [3]);
|
FreeLines (L2 [0], L2 [3]);
|
||||||
}
|
|
||||||
|
|
||||||
/* Check for
|
/* Check for
|
||||||
*
|
*
|
||||||
@ -1616,7 +1615,7 @@ static void OptLoads (void)
|
|||||||
* possible to rewrite the library routine to get rid of the additional
|
* possible to rewrite the library routine to get rid of the additional
|
||||||
* overhead.
|
* overhead.
|
||||||
*/
|
*/
|
||||||
if (LineMatch (L, "\tldy\t#$") &&
|
} else if (LineMatch (L, "\tldy\t#$") &&
|
||||||
GetNextCodeLines (L, L2, 6) &&
|
GetNextCodeLines (L, L2, 6) &&
|
||||||
LineFullMatch (L2 [0], "\tlda\t(sp),y") &&
|
LineFullMatch (L2 [0], "\tlda\t(sp),y") &&
|
||||||
LineFullMatch (L2 [1], "\ttax") &&
|
LineFullMatch (L2 [1], "\ttax") &&
|
||||||
@ -1637,7 +1636,6 @@ static void OptLoads (void)
|
|||||||
|
|
||||||
/* Delete the remaining lines */
|
/* Delete the remaining lines */
|
||||||
FreeLines (L2 [0], L2 [3]);
|
FreeLines (L2 [0], L2 [3]);
|
||||||
}
|
|
||||||
|
|
||||||
/* Search for:
|
/* Search for:
|
||||||
*
|
*
|
||||||
@ -1648,15 +1646,45 @@ static void OptLoads (void)
|
|||||||
*
|
*
|
||||||
* jsr pushaysp
|
* jsr pushaysp
|
||||||
*/
|
*/
|
||||||
if (LineFullMatch (L, "\tlda\t(sp),y") &&
|
} else if (LineFullMatch (L, "\tlda\t(sp),y") &&
|
||||||
GetNextCodeLines (L, L2, 1) &&
|
GetNextCodeLines (L, L2, 1) &&
|
||||||
LineFullMatch (L2 [0], "\tjsr\tpusha")) {
|
LineFullMatch (L2 [0], "\tjsr\tpusha")) {
|
||||||
|
|
||||||
/* Found, replace it */
|
/* Found, replace it */
|
||||||
L = ReplaceLine (L, "\tjsr\tpushaysp");
|
L = ReplaceLine (L, "\tjsr\tpushaysp");
|
||||||
FreeLine (L2 [0]);
|
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: */
|
/* All other patterns start with this one: */
|
||||||
if (!LineFullMatch (L, "\tldx\t#$00")) {
|
if (!LineFullMatch (L, "\tldx\t#$00")) {
|
||||||
/* Next line */
|
/* Next line */
|
||||||
|
Loading…
Reference in New Issue
Block a user