* src/pic16/gen.c (genAssign): fixed assignment from longs
authortecodev <tecodev@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Wed, 26 Jan 2005 14:42:28 +0000 (14:42 +0000)
committertecodev <tecodev@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Wed, 26 Jan 2005 14:42:28 +0000 (14:42 +0000)
  in codespace (were cut to three bytes)
* (genDummyRead): implemented (except for CODESPACE...),
  fixed bug #1108575
* src/pic16/glue.c (emitStatistics): beautified
* device/lib/pic16/libm/Makefile: added include path

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

ChangeLog
device/lib/pic16/libm/Makefile
src/pic16/gen.c
src/pic16/glue.c

index dbc95f60be8c4f228557a8d4320b63a6d64ce041..3d9cb32c3faaa6783632628067baac5990663337 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2005-01-26 Raphael Neider <rneider AT web.de>
+
+       * src/pic16/gen.c (genAssign): fixed assignment from longs
+         in codespace (were cut to three bytes)
+       * (genDummyRead): implemented (except for CODESPACE...),
+         fixed bug #1108575
+       * src/pic16/glue.c (emitStatistics): beautified
+       * device/lib/pic16/libm/Makefile: added include path
+
 2004-01-26 Erik Petrich <epetrich AT ivorytower.norman.ok.us>
 
        * src/z80/gen.c (aopPut): fixed bug #1103902
index 629407cf12b4f05913237102fde08c6260bfa992..524f2175f3f847638a21ea19125b853d113d5639 100644 (file)
@@ -63,6 +63,7 @@ SRCS  =       acosf  \
 COMPILE_FLAGS  += $(MODELFLAGS) $(OPT_FLAGS)
 
 #CFLAGS        += -I$(LIBC_INC_DIR)
+CFLAGS += -I $(PRJDIR)/device/include/pic16
 
 
 CFILES = $(patsubst %,%.c,$(SRCS))
index 2604eeac64a0e6ebc530154fc798da47ea19c94f..ee85154ddbb2efa13f528619c5b8d7b8692b51cb 100644 (file)
@@ -12820,7 +12820,7 @@ static void genAssign (iCode *ic)
                                pic16_popCopyReg(&pic16_pc_tblptru)));
        }
 
-       size = min(AOP_SIZE(right), AOP_SIZE(result));
+       size = min(getSize(OP_SYM_ETYPE(right)), AOP_SIZE(result));
        while(size--) {
                pic16_emitpcodeNULLop(POC_TBLRD_POSTINC);
                pic16_emitpcode(POC_MOVFF, pic16_popGet2p(pic16_popCopyReg(&pic16_pc_tablat),
@@ -12828,8 +12828,9 @@ static void genAssign (iCode *ic)
                offset++;
        }
 
-       if(AOP_SIZE(result) > AOP_SIZE(right)) {
-               size = AOP_SIZE(result) - AOP_SIZE(right);
+       size = getSize(OP_SYM_ETYPE(right));
+       if(AOP_SIZE(result) > size) {
+               size = AOP_SIZE(result) - size;
                while(size--) {
                        pic16_emitpcode(POC_CLRF, pic16_popGet(AOP(result), offset));
                        offset++;
@@ -13566,10 +13567,26 @@ static void genReceive (iCode *ic)
 static void
 genDummyRead (iCode * ic)
 {
-  pic16_emitcode ("; genDummyRead","");
-  pic16_emitcode ("; not implemented","");
+  operand *op;
+  int i;
 
-  ic = ic;
+  op = IC_RIGHT(ic);
+  if (op && IS_SYMOP(op)) {
+    if (IN_CODESPACE(SPEC_OCLS(OP_SYM_ETYPE(op)))) {
+      fprintf (stderr, "%s: volatile symbols in codespace?!? -- might go wrong...\n", __FUNCTION__);
+      return;
+    }
+    pic16_aopOp (op, ic, FALSE);
+    for (i=0; i < AOP_SIZE(op); i++) {
+      // may need to protect this from the peepholer -- this is not nice but works...
+      pic16_addpCode2pBlock(pb,pic16_newpCodeAsmDir(";", "VOLATILE READ - BEGIN"));
+      pic16_mov2w (AOP(op),i);
+      pic16_addpCode2pBlock(pb,pic16_newpCodeAsmDir(";", "VOLATILE READ - END"));
+    } // for i
+    pic16_freeAsmop (op, NULL, ic, TRUE);
+  } else if (op) {
+    fprintf (stderr, "%s: not implemented for non-symbols (volatile operand might not be read)\n", __FUNCTION__);
+  } // if
 }
 
 /*-----------------------------------------------------------------*/
index 7f32b21098c4c4043c60dcaf9c0ed5638a916c73..673e9e8ce67627a35e320d53536b1b27740ad4b4 100644 (file)
@@ -1564,15 +1564,18 @@ pic16emitOverlay (FILE * afile)
 
 void emitStatistics(FILE *asmFile)
 {
+  unsigned long isize, udsize;
   statistics.isize = pic16_countInstructions();
+  isize = (statistics.isize >= 0) ? statistics.isize : 0;
+  udsize = (statistics.udsize >= 0) ? statistics.udsize : 0;
        
   fprintf (asmFile, "\n\n; Statistics:\n");
-  fprintf (asmFile, "; code size:\t%ld (0x%lx) bytes\n;\t\t%ld (0x%lx) words\n",
-    statistics.isize, statistics.isize,
-    statistics.isize>>1, statistics.isize>>1);
-  fprintf (asmFile, "; udata size:\t%ld (0x%lx) bytes\n", 
-    statistics.udsize, statistics.udsize);
-  fprintf (asmFile, "; access size:\t%ld (0x%lx) bytes\n",
+  fprintf (asmFile, "; code size:\t%5ld (0x%04lx) bytes (%3.2f%%)\n;           \t%5ld (0x%04lx) words\n",
+    isize, isize, (isize*100.0)/(128 << 10),
+    isize>>1, isize>>1);
+  fprintf (asmFile, "; udata size:\t%5ld (0x%04lx) bytes (%3.2f%%)\n",
+    udsize, udsize, (udsize*100.0) / ((pic16 ? pic16->RAMsize : 0x200) -256));
+  fprintf (asmFile, "; access size:\t%5ld (0x%04lx) bytes\n",
     statistics.intsize, statistics.intsize);
 
   fprintf (asmFile, "\n\n");