* src/pic/device.c (register_map): fixed list construction
authortecodev <tecodev@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Fri, 19 Jan 2007 10:18:16 +0000 (10:18 +0000)
committertecodev <tecodev@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Fri, 19 Jan 2007 10:18:16 +0000 (10:18 +0000)
* src/pic/gen.c (genDivOneByte,genModOneByte): accept result > 1 byte,
  (genMod): removed case for genModbits,
  (genModbits): removed as now unused/unimplemented
* src/pic/glue.c (picglue): prevent name clash with sources 'init.c'

git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@4581 4a8a32a2-be11-0410-ad9d-d568d2c75423

ChangeLog
src/pic/device.c
src/pic/gen.c
src/pic/glue.c

index fd1be24ffcf27f7d9ffee6d014b9df565dd0b26b..dd664b98aab569e71d7e8105cfd68742de2e8646 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2007-01-19 Raphael Neider <rneider AT web.de>
+
+       * src/pic/device.c (register_map): fixed list construction
+       * src/pic/gen.c (genDivOneByte,genModOneByte): accept result > 1 byte,
+         (genMod): removed case for genModbits,
+         (genModbits): removed as now unused/unimplemented
+       * src/pic/glue.c (picglue): prevent name clash with sources 'init.c'
+
 2007-01-18 Frieder Ferlemann <Frieder.Ferlemann AT web.de>
 
        * support/regression/tests/swap.c: added in response to #1638622
index fc35b7e16c0542123fbcb96dd9aede463c1685f1..b20b01d5a62a89a52c409e604bf72aa8af849f24 100644 (file)
@@ -166,11 +166,10 @@ static void register_map(int num_words, char word[SPLIT_WORDS_MAX][PIC14_STRING_
                r->end_address = parse_config_value(word[pcount]);
                r->alias = parse_config_value(word[1]);
                r->bank = (r->start_address >> 7) & 3;
+               // add memRange to device entry for future lookup (sharebanks)
+               r->next = rangeRAM;
+               rangeRAM = r;
        }
-       
-       // add memRange to device entry for future lookup (sharebanks)
-       r->next = rangeRAM;
-       rangeRAM = r;
 }
 
 
index c3328398b62f66cf939cf7913ceb496276854e41..baa457df66870e40524f42b8ae77e04543b3c1f7 100644 (file)
@@ -3454,22 +3454,24 @@ static void genDivOneByte (operand *left,
                                                   operand *result)
 {
        int size;
+       int sign;
        
        FENTRY;
        DEBUGpic14_emitcode ("; ***","%s  %d",__FUNCTION__,__LINE__);
        
-       assert (AOP_SIZE(result) == 1);
        assert (AOP_SIZE(right) == 1);
        assert (AOP_SIZE(left) == 1);
 
        size = min(AOP_SIZE(result),AOP_SIZE(left));
+       sign = !(SPEC_USIGN(operandType(left))
+               && SPEC_USIGN(operandType(right)));
 
        if (AOP_TYPE(right) == AOP_LIT)
        {
                /* XXX: might add specialized code */
        }
 
-       if (SPEC_USIGN(operandType(left)) && SPEC_USIGN(operandType(right)))
+       if (!sign)
        {
                /* unsigned division */
        #if 1
@@ -3529,7 +3531,7 @@ static void genDivOneByte (operand *left,
        }
 
        /* now performed the signed/unsigned division -- extend result */
-       addSign(result, 1, !SPEC_USIGN(operandType(result)));
+       addSign(result, 1, sign);
 }
 
 /*-----------------------------------------------------------------*/
@@ -3571,29 +3573,6 @@ release :
        freeAsmop(result,NULL,ic,TRUE); 
 }
 
-/*-----------------------------------------------------------------*/
-/* genModbits :- modulus of bits                                                                  */
-/*-----------------------------------------------------------------*/
-static void genModbits (operand *left, 
-                                               operand *right, 
-                                               operand *result)
-{
-       
-       char *l;
-       
-       FENTRY;
-       /* the result must be bit */      
-       pic14_emitcode("mov","b,%s",aopGet(AOP(right),0,FALSE,FALSE));
-       l = aopGet(AOP(left),0,FALSE,FALSE);
-       
-       MOVA(l);
-       
-       pic14_emitcode("div","ab");
-       pic14_emitcode("mov","a,b");
-       pic14_emitcode("rrc","a");
-       aopPut(AOP(result),"c",0);
-}
-
 /*-----------------------------------------------------------------*/
 /* genModOneByte : 8 bit modulus                                                                  */
 /*-----------------------------------------------------------------*/
@@ -3602,22 +3581,24 @@ static void genModOneByte (operand *left,
                                                   operand *result)
 {
        int size;
+       int sign;
        
        FENTRY;
        DEBUGpic14_emitcode ("; ***","%s  %d",__FUNCTION__,__LINE__);
        
-       assert (AOP_SIZE(result) == 1);
        assert (AOP_SIZE(right) == 1);
        assert (AOP_SIZE(left) == 1);
 
        size = min(AOP_SIZE(result),AOP_SIZE(left));
+       sign = !(SPEC_USIGN(operandType(left))
+               && SPEC_USIGN(operandType(right)));
 
        if (AOP_TYPE(right) == AOP_LIT)
        {
                /* XXX: might add specialized code */
        }
 
-       if (SPEC_USIGN(operandType(left)) && SPEC_USIGN(operandType(right)))
+       if (!sign)
        {
                /* unsigned division */
        #if 1
@@ -3677,7 +3658,7 @@ static void genModOneByte (operand *left,
        }
 
        /* now we performed the signed/unsigned modulus -- extend result */
-       addSign(result, 1, !SPEC_USIGN(operandType(result)));
+       addSign(result, 1, sign);
 }
 
 /*-----------------------------------------------------------------*/
@@ -3696,14 +3677,6 @@ static void genMod (iCode *ic)
        aopOp (right,ic,FALSE);
        aopOp (result,ic,TRUE);
        
-       /* special cases first */
-       /* both are bits */
-       if (AOP_TYPE(left) == AOP_CRY &&
-               AOP_TYPE(right)== AOP_CRY) {
-               genModbits(left,right,result);
-               goto release ;
-       }
-       
        /* if both are of size == 1 */
        if (AOP_SIZE(left) == 1 &&
                AOP_SIZE(right) == 1 ) {
index da91bf8a22b231f38d89a1bf105c1fdff5e72ff1..1ad65c0b2c4722dcc15a0007dd4581df25996048 100644 (file)
@@ -1443,7 +1443,8 @@ picglue ()
        
        if (mainf && IFFUNC_HASBODY(mainf->type)) {
                /* initialize data memory */
-               fprintf (asmFile, "code_init\t%s\n", CODE_NAME); // Note - for mplink may have to enlarge section vectors in .lnk file
+               /* do NOT name this code_init to avoid conflicts with init.c */
+               fprintf (asmFile, "c_init\t%s\n", CODE_NAME); // Note - for mplink may have to enlarge section vectors in .lnk file
                fprintf (asmFile,"__sdcc_gsinit_startup\n");
                /* FIXME: This is temporary.  The idata section should be used.  If 
                not, we could add a special feature to the linker.  This will