From 714f7177aa7cea806993b5360242242cd16536df Mon Sep 17 00:00:00 2001 From: michaelh Date: Sat, 12 Feb 2000 06:26:12 +0000 Subject: [PATCH] Better packAssign git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@102 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- device/lib/z80/Makefile | 2 +- device/lib/z80/string.c | 20 ++++++++------------ src/z80/gen.c | 1 + src/z80/ralloc.c | 15 ++++----------- support/tests/dhrystone/Makefile | 2 +- support/tests/dhrystone/dhry.c | 2 ++ 6 files changed, 17 insertions(+), 25 deletions(-) diff --git a/device/lib/z80/Makefile b/device/lib/z80/Makefile index 27d5d2c9..0ecb909e 100644 --- a/device/lib/z80/Makefile +++ b/device/lib/z80/Makefile @@ -9,7 +9,7 @@ OBJ = div.o mul.o putchar.o string.o printf.o asm_strings.o LIB = z80.lib CC = $(SCC) AS = $(SAS) -CFLAGS = -I../include -I. +CFLAGS = -I../include -I. --dumpall all: $(LIB) crt0.o diff --git a/device/lib/z80/string.c b/device/lib/z80/string.c index ea7d5b88..0ba6f753 100644 --- a/device/lib/z80/string.c +++ b/device/lib/z80/string.c @@ -1,17 +1,15 @@ /* Dumb strings stub. Wanted a quick hack for now - will use the libc version later. */ -#if 0 -char *strcpy(char *dest, const char *source) +char *_strcpy(char *dest, const char *source) { - char *ret = dest; - while (*dest++ = *source++); - return ret; + char *d = dest; + const char *s = source; + while (*d++ = *s++); + return dest; } -#endif -#if 0 -void *memcpy(void *dest, const void *source, int count) +void *_memcpy(void *dest, const void *source, int count) { char *d = dest; const char *s = source; @@ -20,11 +18,10 @@ void *memcpy(void *dest, const void *source, int count) return dest; } -#endif -int __strcmp(const char *s1, const char *s2) +int _strcmp(const char *s1, const char *s2) { - int ret = 0; + char ret = 0; while (!(ret = *s1 - *s2) && *s2) ++s1, ++s2; @@ -35,4 +32,3 @@ int __strcmp(const char *s1, const char *s2) return 1; return 0; } - diff --git a/src/z80/gen.c b/src/z80/gen.c index b8280d52..92601216 100644 --- a/src/z80/gen.c +++ b/src/z80/gen.c @@ -15,6 +15,7 @@ With all working on 20796 158 196C Slightly better genCmp(signed) 20597 159 195B Better reg packing, first peephole 20038 163 1873 + With assign packing 19281 165 1849 Michael Hope 2000 Based on the mcs51 generator - Sandeep Dutta . sandeep.dutta@usa.net (1998) diff --git a/src/z80/ralloc.c b/src/z80/ralloc.c index 676f926f..dd75f56b 100644 --- a/src/z80/ralloc.c +++ b/src/z80/ralloc.c @@ -1256,8 +1256,8 @@ static int packRegsForAssign (iCode *ic,eBBlock *ebp) iCode *dic, *sic; if ( - !IS_TRUE_SYMOP(IC_RESULT(ic)) || - !IS_ITEMP(IC_RIGHT(ic)) || + /* !IS_TRUE_SYMOP(IC_RESULT(ic)) ||*/ + !IS_ITEMP(IC_RIGHT(ic)) || OP_LIVETO(IC_RIGHT(ic)) > ic->seq || OP_SYMBOL(IC_RIGHT(ic))->isind) return 0; @@ -1277,7 +1277,6 @@ static int packRegsForAssign (iCode *ic,eBBlock *ebp) a use of the true symbol in before we find the definition then we cannot */ for ( dic = ic->prev ; dic ; dic = dic->prev) { - /* if there is a function call and this is a parameter & not my parameter then don't pack it */ if ( (dic->op == CALL || dic->op == PCALL) && @@ -1288,13 +1287,10 @@ static int packRegsForAssign (iCode *ic,eBBlock *ebp) } if (SKIP_IC2(dic)) - continue; + continue; -#if 0 if (IS_SYMOP(IC_RESULT(dic)) && IC_RESULT(dic)->key == IC_RIGHT(ic)->key) { - if (POINTER_SET(dic)) - dic = NULL; break; } @@ -1316,7 +1312,6 @@ static int packRegsForAssign (iCode *ic,eBBlock *ebp) dic = NULL ; break; } -#endif } if (!dic) @@ -1326,7 +1321,7 @@ static int packRegsForAssign (iCode *ic,eBBlock *ebp) the same atleast one of the operands */ if (OP_SYMBOL(IC_RESULT(ic))->onStack || OP_SYMBOL(IC_RESULT(ic))->iaccess ) { - + /* the operation has only one symbol operator then we can pack */ if ((IC_LEFT(dic) && !IS_SYMOP(IC_LEFT(dic))) || @@ -1433,7 +1428,6 @@ iCode *findAssignToSym (operand *op,iCode *ic) } -#if 0 /*-----------------------------------------------------------------*/ /* packRegsForSupport :- reduce some registers for support calls */ /*-----------------------------------------------------------------*/ @@ -1488,7 +1482,6 @@ static int packRegsForSupport (iCode *ic, eBBlock *ebp) return change ; } -#endif #define IS_OP_RUONLY(x) (x && IS_SYMOP(x) && OP_SYMBOL(x)->ruonly) diff --git a/support/tests/dhrystone/Makefile b/support/tests/dhrystone/Makefile index cc4e6ee9..e87bc050 100644 --- a/support/tests/dhrystone/Makefile +++ b/support/tests/dhrystone/Makefile @@ -2,7 +2,7 @@ CC = /home/michaelh/projects/sdcc/bin/sdcc # -DNOENUM is here to make the results more predictable -CFLAGS = -mz80 -v +CFLAGS = -mz80 -v --dumpall CFLAGS += -DREG= -DNOSTRUCTASSIGN -DNOENUM -DBROKEN_SDCC=0 -DHZ=100 LIBDIR = /home/michaelh/projects/sdcc/device/lib/z80/ LD = link-z80 diff --git a/support/tests/dhrystone/dhry.c b/support/tests/dhrystone/dhry.c index d970ffba..f5acdc08 100644 --- a/support/tests/dhrystone/dhry.c +++ b/support/tests/dhrystone/dhry.c @@ -201,6 +201,8 @@ int main(void) DPRINTF(("Looping.\n")); } /* loop "for Run_Index" */ + _printTStates(); + printf("Run_Index = %d\n", Run_Index); runTime = _clock() - runTime; -- 2.47.2