X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=src%2Fcc65%2Fcoptstore.h;h=b6ac183538476838e380934a49ee8e203800aaf5;hb=7aefd9b4e7b67908b7b3c38b6003c7f1a8d3ee2d;hp=29a97de7d00abc2fa927afe993ab71e2bcfafb80;hpb=914b2a7e370709a9fe45d738fc8aaa9b7382f76f;p=cc65 diff --git a/src/cc65/coptstore.h b/src/cc65/coptstore.h index 29a97de7d..b6ac18353 100644 --- a/src/cc65/coptstore.h +++ b/src/cc65/coptstore.h @@ -6,10 +6,10 @@ /* */ /* */ /* */ -/* (C) 2002 Ullrich von Bassewitz */ -/* Wacholderweg 14 */ -/* D-70597 Stuttgart */ -/* EMail: uz@cc65.org */ +/* (C) 2002-2006, Ullrich von Bassewitz */ +/* Römerstrasse 52 */ +/* D-70794 Filderstadt */ +/* EMail: uz@cc65.org */ /* */ /* */ /* This software is provided 'as-is', without any expressed or implied */ @@ -44,23 +44,66 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ unsigned OptStore1 (CodeSeg* S); +/* Search for the sequence + * + * ldy #n + * jsr staxysp + * ldy #n+1 + * jsr ldaxysp + * + * and remove the useless load, provided that the next insn doesn't use flags + * from the load. + */ + +unsigned OptStore2 (CodeSeg* S); /* Search for a call to staxysp. If the ax register is not used later, and * the value is constant, just use the A register and store directly into the * stack. */ -unsigned OptStore2 (CodeSeg* S); +unsigned OptStore3 (CodeSeg* S); /* Search for a call to steaxysp. If the eax register is not used later, and * the value is constant, just use the A register and store directly into the * stack. */ +unsigned OptStore4 (CodeSeg* S); +/* Search for the sequence + * + * sta xx + * stx yy + * lda xx + * ldx yy + * + * and remove the useless load, provided that the next insn doesn't use flags + * from the load. + */ + +unsigned OptStore5 (CodeSeg* S); +/* Search for the sequence + * + * lda foo + * ldx bar + * sta something + * stx something-else + * + * and replace it by + * + * lda foo + * sta something + * lda bar + * sta something-else + * + * if X is not used later. This replacement doesn't save any cycles or bytes, + * but it keeps the value of X, which may be reused later. + */ + /* End of coptstore.h */