From c2194e70f968fe9d82fcb1233c3d7d9e46b286e9 Mon Sep 17 00:00:00 2001 From: tecodev Date: Wed, 26 Jan 2005 14:42:28 +0000 Subject: [PATCH] * 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 git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@3657 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- ChangeLog | 9 +++++++++ device/lib/pic16/libm/Makefile | 1 + src/pic16/gen.c | 29 +++++++++++++++++++++++------ src/pic16/glue.c | 15 +++++++++------ 4 files changed, 42 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index dbc95f60..3d9cb32c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2005-01-26 Raphael Neider + + * 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 * src/z80/gen.c (aopPut): fixed bug #1103902 diff --git a/device/lib/pic16/libm/Makefile b/device/lib/pic16/libm/Makefile index 629407cf..524f2175 100644 --- a/device/lib/pic16/libm/Makefile +++ b/device/lib/pic16/libm/Makefile @@ -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)) diff --git a/src/pic16/gen.c b/src/pic16/gen.c index 2604eeac..ee85154d 100644 --- a/src/pic16/gen.c +++ b/src/pic16/gen.c @@ -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 } /*-----------------------------------------------------------------*/ diff --git a/src/pic16/glue.c b/src/pic16/glue.c index 7f32b210..673e9e8c 100644 --- a/src/pic16/glue.c +++ b/src/pic16/glue.c @@ -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"); -- 2.47.2