Better packAssign
authormichaelh <michaelh@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sat, 12 Feb 2000 06:26:12 +0000 (06:26 +0000)
committermichaelh <michaelh@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sat, 12 Feb 2000 06:26:12 +0000 (06:26 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@102 4a8a32a2-be11-0410-ad9d-d568d2c75423

device/lib/z80/Makefile
device/lib/z80/string.c
src/z80/gen.c
src/z80/ralloc.c
support/tests/dhrystone/Makefile
support/tests/dhrystone/dhry.c

index 27d5d2c973d30dc9937c73005fca38ab5226f0cc..0ecb909eaca5672078373eede043574a48b59bf8 100644 (file)
@@ -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
 
index ea7d5b88a9a66f6258d2a1a04ee42abc213ab0ef..0ba6f75364801069990df762be39b7900e2d1889 100644 (file)
@@ -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;
 }
-
index b8280d5216f4ea59aac959bd4813cf6d4c4f98c3..926012163818ee1d4d6b83e7b233a5c584f415f0 100644 (file)
@@ -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 <michaelh@earthling.net>        2000
   Based on the mcs51 generator - Sandeep Dutta . sandeep.dutta@usa.net (1998)
index 676f926ff33bb6dff19c56770e0896c170b95837..dd75f56be86a6589dad090efcbd84e6bec05ce14 100644 (file)
@@ -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)
 
index cc4e6ee979c2ff64a3b9711ebdddf64a53f09cff..e87bc05025e309d2dd113907c116ddbbe6e7c213 100644 (file)
@@ -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
index d970ffbacb1d25822d7d7b1697109fb2d3c1c316..f5acdc081f41d1150912862da177ae0002ba2869 100644 (file)
@@ -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;