From 4333c767108c9aeec9eed41e9d534bff807001ef Mon Sep 17 00:00:00 2001 From: uz Date: Sat, 23 Jun 2012 16:17:56 +0000 Subject: [PATCH] The OptNegXXX function were actually handling bnega... runtime stuff. Renamed them accordingly. git-svn-id: svn://svn.cc65.org/cc65/trunk@5731 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- src/cc65/codeopt.c | 36 +++++++++++++++++----------------- src/cc65/coptneg.c | 38 ++++++++++++++++++------------------ src/cc65/coptneg.h | 48 +++++++++++++++++++++++----------------------- 3 files changed, 61 insertions(+), 61 deletions(-) diff --git a/src/cc65/codeopt.c b/src/cc65/codeopt.c index 0226b2ad1..98bfc686c 100644 --- a/src/cc65/codeopt.c +++ b/src/cc65/codeopt.c @@ -1179,12 +1179,12 @@ static OptFunc DOptLoad2 = { OptLoad2, "OptLoad2", 200, 0, 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 }; @@ -1271,12 +1271,12 @@ static OptFunc* OptFuncs[] = { &DOptJumpTarget3, &DOptLoad1, &DOptLoad2, - &DOptNegA1, - &DOptNegA2, - &DOptNegAX1, - &DOptNegAX2, - &DOptNegAX3, - &DOptNegAX4, + &DOptBNegA1, + &DOptBNegA2, + &DOptBNegAX1, + &DOptBNegAX2, + &DOptBNegAX3, + &DOptBNegAX4, &DOptPrecalc, &DOptPtrLoad1, &DOptPtrLoad11, @@ -1583,10 +1583,10 @@ static unsigned RunOptGroup1 (CodeSeg* S) 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); @@ -1640,8 +1640,8 @@ static unsigned RunOptGroup3 (CodeSeg* S) 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); diff --git a/src/cc65/coptneg.c b/src/cc65/coptneg.c index 058b1ccba..9c41a8fe5 100644 --- a/src/cc65/coptneg.c +++ b/src/cc65/coptneg.c @@ -6,8 +6,8 @@ /* */ /* */ /* */ -/* (C) 2001-2005, Ullrich von Bassewitz */ -/* Römerstrasse 52 */ +/* (C) 2001-2012, Ullrich von Bassewitz */ +/* Roemerstrasse 52 */ /* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ /* */ @@ -41,12 +41,12 @@ /*****************************************************************************/ -/* nega optimizations */ +/* bnega optimizations */ /*****************************************************************************/ -unsigned OptNegA1 (CodeSeg* S) +unsigned OptBNegA1 (CodeSeg* S) /* Check for * * ldx #$00 @@ -98,10 +98,10 @@ unsigned OptNegA1 (CodeSeg* S) -unsigned OptNegA2 (CodeSeg* S) +unsigned OptBNegA2 (CodeSeg* S) /* Check for * - * lda .. + * lda .. * jsr bnega * jeq/jne .. * @@ -160,12 +160,12 @@ unsigned OptNegA2 (CodeSeg* S) /*****************************************************************************/ -/* 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. @@ -209,7 +209,7 @@ unsigned OptNegAX1 (CodeSeg* S) -unsigned OptNegAX2 (CodeSeg* S) +unsigned OptBNegAX2 (CodeSeg* S) /* Search for the sequence: * * ldy #xx @@ -282,7 +282,7 @@ unsigned OptNegAX2 (CodeSeg* S) -unsigned OptNegAX3 (CodeSeg* S) +unsigned OptBNegAX3 (CodeSeg* S) /* Search for the sequence: * * lda xx @@ -343,7 +343,7 @@ unsigned OptNegAX3 (CodeSeg* S) -unsigned OptNegAX4 (CodeSeg* S) +unsigned OptBNegAX4 (CodeSeg* S) /* Search for the sequence: * * jsr xxx @@ -352,7 +352,7 @@ unsigned OptNegAX4 (CodeSeg* S) * * and replace it by: * - * jsr xxx + * jsr xxx * * jne/jeq ... */ @@ -385,14 +385,14 @@ unsigned OptNegAX4 (CodeSeg* S) /* 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 */ diff --git a/src/cc65/coptneg.h b/src/cc65/coptneg.h index e7d12a16f..0ff897d0c 100644 --- a/src/cc65/coptneg.h +++ b/src/cc65/coptneg.h @@ -6,10 +6,10 @@ /* */ /* */ /* */ -/* (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 */ @@ -44,26 +44,26 @@ /*****************************************************************************/ -/* 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. @@ -72,25 +72,25 @@ unsigned OptNegA2 (CodeSeg* S); /*****************************************************************************/ -/* 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 @@ -101,22 +101,22 @@ unsigned OptNegAX2 (CodeSeg* S); * 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 -- 2.39.5