From: tecodev Date: Sat, 10 Jun 2006 09:31:29 +0000 (+0000) Subject: * src/pic16/gen.c (pic16_aopOp): use WREG as destination even for X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=5cb4bb4d324621c9bd66c6d8b4b6cd9ff4da0961;hp=fbce3b5dc99c2dae3e30bcc55a49a20a8fc4e149;p=fw%2Fsdcc * src/pic16/gen.c (pic16_aopOp): use WREG as destination even for multibyte dummy reads (fixes #1503234) git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@4211 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- diff --git a/ChangeLog b/ChangeLog index c92c3a1a..e4a43556 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2006-06-10 Raphael Neider + + * src/pic16/gen.c (pic16_aopOp): use WREG as destination even for + multibyte dummy reads (fixes #1503234) + 2006-06-10 Maarten Brock * device/include/mcs51/compiler.h: new, added header file to enable diff --git a/src/pic16/gen.c b/src/pic16/gen.c index b1f315da..61ed3aa7 100644 --- a/src/pic16/gen.c +++ b/src/pic16/gen.c @@ -1288,23 +1288,30 @@ void pic16_aopOp (operand *op, iCode *ic, bool result) sym->rname, sym->usl.spillLoc->offset); #endif - sym->aop = op->aop = aop = newAsmop(AOP_PCODE); - if (sym->usl.spillLoc && getSize(sym->type) != getSize(sym->usl.spillLoc->type)) { - /* Don't reuse the new aop */ - sym->usl.spillLoc->aop = NULL; - } //aop->aopu.pcop = pic16_popGetImmd(sym->usl.spillLoc->rname,0,sym->usl.spillLoc->offset); if (sym->usl.spillLoc && sym->usl.spillLoc->rname) { + sym->aop = op->aop = aop = newAsmop(AOP_PCODE); aop->aopu.pcop = pic16_popRegFromString(sym->usl.spillLoc->rname, getSize(sym->type), sym->usl.spillLoc->offset, op); - } else { - fprintf (stderr, "%s:%d called for a spillLocation -- assigning WREG instead --- CHECK!\n", __FUNCTION__, __LINE__); + } else if (getSize(sym->type) <= 1) { + //fprintf (stderr, "%s:%d called for a spillLocation -- assigning WREG instead --- CHECK (size:%u)!\n", __FUNCTION__, __LINE__, getSize(sym->type)); pic16_emitpcomment (";!!! %s:%d called for a spillLocation -- assigning WREG instead --- CHECK", __FUNCTION__, __LINE__); assert (getSize(sym->type) <= 1); + sym->aop = op->aop = aop = newAsmop(AOP_PCODE); aop->aopu.pcop = pic16_popCopyReg (&pic16_pc_wreg); + } else { + /* We need some kind of dummy area for getSize(sym->type) byte, + * use WREG for all storage locations. + * XXX: This only works if we are implementing a `dummy read', + * the stored value will not be retrievable... + * See #1503234 for a case requiring this. */ + sym->aop = op->aop = aop = newAsmop(AOP_REG); + aop->size = getSize(sym->type); + for ( i = 0 ; i < aop->size ;i++) + aop->aopu.aop_reg[i] = pic16_pc_wreg.r; } - aop->size = getSize(sym->type); + aop->size = getSize(sym->type); return; }