From: michaelh Date: Fri, 12 Oct 2001 01:18:11 +0000 (+0000) Subject: * src/z80/gen.c (gencjneshort): Fixed X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=9c9f0722725e5d23a3d6f0df9f34033e41ae2790;p=fw%2Fsdcc * src/z80/gen.c (gencjneshort): Fixed * src/z80/ralloc.c (packRegsForHLUse): Added pack into HL for cast then ipush. git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@1389 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- diff --git a/ChangeLog b/ChangeLog index 57841260..7fef2678 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2001-10-11 Michael Hope + + * src/z80/gen.c (gencjneshort): Fixed + + * src/z80/ralloc.c (packRegsForHLUse): Added pack into HL for cast then ipush. + 2001-10-09 Michael Hope * support/regression/tests/bug-469671.c: Added. diff --git a/src/z80/gen.c b/src/z80/gen.c index 642b3a3a..6bffec3c 100644 --- a/src/z80/gen.c +++ b/src/z80/gen.c @@ -120,7 +120,7 @@ enum { /* Set to enable debugging trace statements in the output assembly code. */ - DISABLE_DEBUG = 0, + DISABLE_DEBUG = 0 }; static char *_z80_return[] = @@ -3733,11 +3733,9 @@ gencjneshort (operand * left, operand * right, symbol * lbl) emit2 ("ld a,%s", aopGet (AOP (left), offset, FALSE)); if (size > 1) { - size--; - offset++; - while (size--) + while (--size) { - emit2 ("or a,%s", aopGet (AOP (left), offset, FALSE)); + emit2 ("or a,%s", aopGet (AOP (left), ++offset, FALSE)); } } else diff --git a/src/z80/peeph-z80.def b/src/z80/peeph-z80.def index 90336dde..76fe8cdd 100644 --- a/src/z80/peeph-z80.def +++ b/src/z80/peeph-z80.def @@ -3,7 +3,23 @@ replace restart { bit %3,a jp %4,%5 } by { - ; Rule 100: Removed redundent load bit %3,%1(%2) jp %4,%5 } +replace { + ld %1,%2) + ld a,%2) +} by { + ld %1,%2) + ld a,%1 +} +replace { + ld %1),a + xor a,a + or a,%1) + jp z,%2 +} by { + ld %1),a + or a,a + jp z,%2 +} diff --git a/src/z80/peeph.def b/src/z80/peeph.def index a743e557..6b144b33 100644 --- a/src/z80/peeph.def +++ b/src/z80/peeph.def @@ -6,7 +6,7 @@ replace restart { replace restart { ld %1,%1 } by { - ; Rule 1: Removed redundent load + ; Removed redundent load } replace restart { xor a,a @@ -22,7 +22,6 @@ replace restart { cp a,#0x00 jp nz,%1 } by { - ; Rule 3: Changed cp #0 to or or a,a jp nz,%1 } @@ -33,7 +32,6 @@ replace restart { jp %3 %2: } by { - ; Rule 4: Changed jp order jp z,%2 %1: jp %3 @@ -44,7 +42,6 @@ replace restart { jp %2 %1: } by { - ; Rule 5: Changed jump logic jp z,%2 %1: } @@ -53,7 +50,6 @@ replace restart { jp %2 %1: } by { - ; Rule 6: Changed jump logic jp nz,%2 %1: } @@ -61,14 +57,12 @@ replace restart { or a,%1 or a,a } by { - ; Rule 7: Removed redundent or or a,%1 } replace restart { or a,%1) or a,a } by { - ; Rule 8: Removed redundent or for (ix) or a,%1) } replace restart { diff --git a/src/z80/ralloc.c b/src/z80/ralloc.c index ac7fe0e7..fbd12bec 100644 --- a/src/z80/ralloc.c +++ b/src/z80/ralloc.c @@ -2035,6 +2035,8 @@ packRegsForHLUse (iCode * ic) if (ic->next != uic) return; + if (ic->op == CAST && uic->op == IPUSH) + goto hluse; if (ic->op == ADDRESS_OF && uic->op == IPUSH) goto hluse; if (ic->op == CALL && ic->parmBytes == 0 && (uic->op == '-' || uic->op == '+'))