static OptFunc DOptRTS = { OptRTS, "OptRTS", 100, 0, 0, 0, 0, 0 };
static OptFunc DOptRTSJumps1 = { OptRTSJumps1, "OptRTSJumps1", 100, 0, 0, 0, 0, 0 };
static OptFunc DOptRTSJumps2 = { OptRTSJumps2, "OptRTSJumps2", 100, 0, 0, 0, 0, 0 };
-static OptFunc DOptNegA1 = { OptNegA1, "OptNegA1", 100, 0, 0, 0, 0, 0 };
-static OptFunc DOptNegA2 = { OptNegA2, "OptNegA2", 100, 0, 0, 0, 0, 0 };
-static OptFunc DOptNegAX1 = { OptNegAX1, "OptNegAX1", 100, 0, 0, 0, 0, 0 };
-static OptFunc DOptNegAX2 = { OptNegAX2, "OptNegAX2", 100, 0, 0, 0, 0, 0 };
-static OptFunc DOptNegAX3 = { OptNegAX3, "OptNegAX3", 100, 0, 0, 0, 0, 0 };
-static OptFunc DOptNegAX4 = { OptNegAX4, "OptNegAX4", 100, 0, 0, 0, 0, 0 };
+static OptFunc DOptBNegA1 = { OptBNegA1, "OptBNegA1", 100, 0, 0, 0, 0, 0 };
+static OptFunc DOptBNegA2 = { OptBNegA2, "OptBNegA2", 100, 0, 0, 0, 0, 0 };
+static OptFunc DOptBNegAX1 = { OptBNegAX1, "OptBNegAX1", 100, 0, 0, 0, 0, 0 };
+static OptFunc DOptBNegAX2 = { OptBNegAX2, "OptBNegAX2", 100, 0, 0, 0, 0, 0 };
+static OptFunc DOptBNegAX3 = { OptBNegAX3, "OptBNegAX3", 100, 0, 0, 0, 0, 0 };
+static OptFunc DOptBNegAX4 = { OptBNegAX4, "OptBNegAX4", 100, 0, 0, 0, 0, 0 };
static OptFunc DOptPrecalc = { OptPrecalc, "OptPrecalc", 100, 0, 0, 0, 0, 0 };
static OptFunc DOptPtrLoad1 = { OptPtrLoad1, "OptPtrLoad1", 100, 0, 0, 0, 0, 0 };
static OptFunc DOptPtrLoad2 = { OptPtrLoad2, "OptPtrLoad2", 100, 0, 0, 0, 0, 0 };
&DOptJumpTarget3,
&DOptLoad1,
&DOptLoad2,
- &DOptNegA1,
- &DOptNegA2,
- &DOptNegAX1,
- &DOptNegAX2,
- &DOptNegAX3,
- &DOptNegAX4,
+ &DOptBNegA1,
+ &DOptBNegA2,
+ &DOptBNegAX1,
+ &DOptBNegAX2,
+ &DOptBNegAX3,
+ &DOptBNegAX4,
&DOptPrecalc,
&DOptPtrLoad1,
&DOptPtrLoad11,
Changes += RunOptFunc (S, &DOptPtrLoad15, 1);
Changes += RunOptFunc (S, &DOptPtrLoad16, 1);
Changes += RunOptFunc (S, &DOptPtrLoad17, 1);
- Changes += RunOptFunc (S, &DOptNegAX1, 1);
- Changes += RunOptFunc (S, &DOptNegAX2, 1);
- Changes += RunOptFunc (S, &DOptNegAX3, 1);
- Changes += RunOptFunc (S, &DOptNegAX4, 1);
+ Changes += RunOptFunc (S, &DOptBNegAX1, 1);
+ Changes += RunOptFunc (S, &DOptBNegAX2, 1);
+ Changes += RunOptFunc (S, &DOptBNegAX3, 1);
+ Changes += RunOptFunc (S, &DOptBNegAX4, 1);
Changes += RunOptFunc (S, &DOptAdd1, 1);
Changes += RunOptFunc (S, &DOptAdd2, 1);
Changes += RunOptFunc (S, &DOptAdd4, 1);
do {
C = 0;
- C += RunOptFunc (S, &DOptNegA1, 1);
- C += RunOptFunc (S, &DOptNegA2, 1);
+ C += RunOptFunc (S, &DOptBNegA1, 1);
+ C += RunOptFunc (S, &DOptBNegA2, 1);
C += RunOptFunc (S, &DOptStackOps, 1);
C += RunOptFunc (S, &DOptSub1, 1);
C += RunOptFunc (S, &DOptSub2, 1);
/* */
/* */
/* */
-/* (C) 2001-2005, Ullrich von Bassewitz */
-/* Römerstrasse 52 */
+/* (C) 2001-2012, Ullrich von Bassewitz */
+/* Roemerstrasse 52 */
/* D-70794 Filderstadt */
/* EMail: uz@cc65.org */
/* */
/*****************************************************************************/
-/* nega optimizations */
+/* bnega optimizations */
/*****************************************************************************/
-unsigned OptNegA1 (CodeSeg* S)
+unsigned OptBNegA1 (CodeSeg* S)
/* Check for
*
* ldx #$00
-unsigned OptNegA2 (CodeSeg* S)
+unsigned OptBNegA2 (CodeSeg* S)
/* Check for
*
- * lda ..
+ * lda ..
* jsr bnega
* jeq/jne ..
*
/*****************************************************************************/
-/* negax optimizations */
+/* bnegax optimizations */
/*****************************************************************************/
-unsigned OptNegAX1 (CodeSeg* S)
+unsigned OptBNegAX1 (CodeSeg* S)
/* On a call to bnegax, if X is zero, the result depends only on the value in
* A, so change the call to a call to bnega. This will get further optimized
* later if possible.
-unsigned OptNegAX2 (CodeSeg* S)
+unsigned OptBNegAX2 (CodeSeg* S)
/* Search for the sequence:
*
* ldy #xx
-unsigned OptNegAX3 (CodeSeg* S)
+unsigned OptBNegAX3 (CodeSeg* S)
/* Search for the sequence:
*
* lda xx
-unsigned OptNegAX4 (CodeSeg* S)
+unsigned OptBNegAX4 (CodeSeg* S)
/* Search for the sequence:
*
* jsr xxx
*
* and replace it by:
*
- * jsr xxx
+ * jsr xxx
* <boolean test>
* jne/jeq ...
*/
/* Insert apropriate test code */
if (ByteSized) {
/* Test bytes */
- X = NewCodeEntry (OP65_TAX, AM65_IMP, 0, 0, L[0]->LI);
- CS_InsertEntry (S, X, I+2);
+ X = NewCodeEntry (OP65_TAX, AM65_IMP, 0, 0, L[0]->LI);
+ CS_InsertEntry (S, X, I+2);
} else {
- /* Test words */
- X = NewCodeEntry (OP65_STX, AM65_ZP, "tmp1", 0, L[0]->LI);
- CS_InsertEntry (S, X, I+2);
- X = NewCodeEntry (OP65_ORA, AM65_ZP, "tmp1", 0, L[0]->LI);
- CS_InsertEntry (S, X, I+3);
+ /* Test words */
+ X = NewCodeEntry (OP65_STX, AM65_ZP, "tmp1", 0, L[0]->LI);
+ CS_InsertEntry (S, X, I+2);
+ X = NewCodeEntry (OP65_ORA, AM65_ZP, "tmp1", 0, L[0]->LI);
+ CS_InsertEntry (S, X, I+3);
}
/* Delete the subroutine call */
/* */
/* */
/* */
-/* (C) 2001 Ullrich von Bassewitz */
-/* Wacholderweg 14 */
-/* D-70597 Stuttgart */
-/* EMail: uz@cc65.org */
+/* (C) 2001-2012, Ullrich von Bassewitz */
+/* Roemerstrasse 52 */
+/* D-70794 Filderstadt */
+/* EMail: uz@cc65.org */
/* */
/* */
/* This software is provided 'as-is', without any expressed or implied */
/*****************************************************************************/
-/* nega optimizations */
+/* bnega optimizations */
/*****************************************************************************/
-unsigned OptNegA1 (CodeSeg* S);
+unsigned OptBNegA1 (CodeSeg* S);
/* Check for
*
- * ldx #$00
- * lda ..
- * jsr bnega
+ * ldx #$00
+ * lda ..
+ * jsr bnega
*
* Remove the ldx if the lda does not use it.
*/
-unsigned OptNegA2 (CodeSeg* S);
+unsigned OptBNegA2 (CodeSeg* S);
/* Check for
*
- * lda ..
- * jsr bnega
+ * lda ..
+ * jsr bnega
* jeq/jne ..
*
* Adjust the conditional branch and remove the call to the subroutine.
/*****************************************************************************/
-/* negax optimizations */
+/* bnegax optimizations */
/*****************************************************************************/
-unsigned OptNegAX1 (CodeSeg* S);
+unsigned OptBNegAX1 (CodeSeg* S);
/* On a call to bnegax, if X is zero, the result depends only on the value in
* A, so change the call to a call to bnega. This will get further optimized
* later if possible.
*/
-unsigned OptNegAX2 (CodeSeg* S);
+unsigned OptBNegAX2 (CodeSeg* S);
/* Search for the sequence:
*
- * lda (xx),y
+ * lda (xx),y
* tax
* dey
- * lda (xx),y
- * jsr bnegax
+ * lda (xx),y
+ * jsr bnegax
* jne/jeq ...
*
* and replace it by
* jeq/jne ...
*/
-unsigned OptNegAX3 (CodeSeg* S);
+unsigned OptBNegAX3 (CodeSeg* S);
/* Search for the sequence:
*
- * lda xx
- * ldx yy
- * jsr bnegax
+ * lda xx
+ * ldx yy
+ * jsr bnegax
* jne/jeq ...
*
* and replace it by
*
* lda xx
- * ora xx+1
+ * ora xx+1
* jeq/jne ...
*/
-unsigned OptNegAX4 (CodeSeg* S);
+unsigned OptBNegAX4 (CodeSeg* S);
/* Search for the sequence:
*
* jsr xxx