/* */
/* */
/* */
-/* (C) 2001 Ullrich von Bassewitz */
-/* Wacholderweg 14 */
-/* D-70597 Stuttgart */
-/* EMail: uz@cc65.org */
+/* (C) 2001-2009, Ullrich von Bassewitz */
+/* Roemerstrasse 52 */
+/* D-70794 Filderstadt */
+/* EMail: uz@cc65.org */
/* */
/* */
/* This software is provided 'as-is', without any expressed or implied */
unsigned OptCmp1 (CodeSeg* S);
+/* Search for the sequence
+ *
+ * ldx xx
+ * stx tmp1
+ * ora tmp1
+ *
+ * and replace it by
+ *
+ * ora xx
+ */
+
+unsigned OptCmp2 (CodeSeg* S);
/* Search for the sequence
*
* stx xx
* ora xx
*/
-unsigned OptCmp2 (CodeSeg* S);
+unsigned OptCmp3 (CodeSeg* S);
/* Search for
*
* lda/and/ora/eor ...
* and remove the cmp.
*/
-unsigned OptCmp3 (CodeSeg* S);
+unsigned OptCmp4 (CodeSeg* S);
/* Search for
*
* lda x
* of this instruction.
*/
-unsigned OptCmp4 (CodeSeg* S);
+unsigned OptCmp5 (CodeSeg* S);
/* Optimize compares of local variables:
*
* ldy #o
* jne/jeq L2
*/
-unsigned OptCmp5 (CodeSeg* S);
+unsigned OptCmp6 (CodeSeg* S);
/* Search for calls to compare subroutines followed by a conditional branch
* and replace them by cheaper versions, since the branch means that the
* boolean value returned by these routines is not needed (we may also check
* that explicitly, but for the current code generator it is always true).
*/
-unsigned OptCmp6 (CodeSeg* S);
+unsigned OptCmp7 (CodeSeg* S);
/* Search for a sequence ldx/txa/branch and remove the txa if A is not
* used later.
*/
-unsigned OptCmp7 (CodeSeg* S);
+unsigned OptCmp8 (CodeSeg* S);
/* Check for register compares where the contents of the register and therefore
* the result of the compare is known.
*/
+unsigned OptCmp9 (CodeSeg* S);
+/* Search for the sequence
+ *
+ * sbc xx
+ * bvs/bvc L
+ * eor #$80
+ * L: asl a
+ * bcc/bcs somewhere
+ *
+ * If A is not used later (which should be the case), we can branch on the N
+ * flag instead of the carry flag and remove the asl.
+ */
+
/* End of coptcmp.h */