+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
COMPILE_FLAGS += $(MODELFLAGS) $(OPT_FLAGS)
#CFLAGS += -I$(LIBC_INC_DIR)
+CFLAGS += -I $(PRJDIR)/device/include/pic16
CFILES = $(patsubst %,%.c,$(SRCS))
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),
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++;
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
}
/*-----------------------------------------------------------------*/
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");