* src/SDCC.lex (process_pragma): fixed to make disable_warning work for PIC16
* src/pic16/gen.c (aopForSym, calls to pic16_aopOp): prevent unneccessary
retrievals of result operand's value on assignment
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@3680
4a8a32a2-be11-0410-ad9d-
d568d2c75423
+2005-02-14 Raphael Neider <rneider AT web.de>
+
+ * device/lib/pic16/libc/string/memccpy.c: changed 3rd argument to char
+ * src/SDCC.lex (process_pragma): fixed to make disable_warning work for PIC16
+ * src/pic16/gen.c (aopForSym, calls to pic16_aopOp): prevent unneccessary
+ retrievals of result operand's value on assignment
+
2005-02-13 Vangelis Rokas <vrokas AT otenet.gr>
* device/include/pic16/string.h: modified prototype for memccpy()
2005-02-13 Vangelis Rokas <vrokas AT otenet.gr>
* device/include/pic16/string.h: modified prototype for memccpy()
-------------------------------------------------------------------------*/
#include <string.h>
-------------------------------------------------------------------------*/
#include <string.h>
-void *memccpy (void *dst, void *src, int c, size_t acount)
+void *memccpy (void *dst, void *src, char c, size_t acount)
{
void *ret = dst;
char *d = dst;
{
void *ret = dst;
char *d = dst;
while ((!isspace(*s)) && (*s != '\n'))
s++ ;
while ((!isspace(*s)) && (*s != '\n'))
s++ ;
+ /* skip separating whitespace */
+ while (isspace(*s) && (*s != '\n'))
+ s++;
+
/* First give the port a chance */
if (port->process_pragma && !port->process_pragma(cp))
return 0;
/* First give the port a chance */
if (port->process_pragma && !port->process_pragma(cp))
return 0;
if (pragma_tbl[i].deprecated != 0)
werror(W_DEPRECATED_PRAGMA, pragma_tbl[i].name);
if (pragma_tbl[i].deprecated != 0)
werror(W_DEPRECATED_PRAGMA, pragma_tbl[i].name);
- doPragma(pragma_tbl[i].id, cp + len);
+ doPragma(pragma_tbl[i].id, s);
#if 1
DEBUGpic16_emitcode(";","%d sym->rname = %s, size = %d stack = %d",__LINE__,sym->rname,aop->size, sym->stack);
#if 1
DEBUGpic16_emitcode(";","%d sym->rname = %s, size = %d stack = %d",__LINE__,sym->rname,aop->size, sym->stack);
+
+ // we do not need to load the value if it is to be defined...
+ if (result) return aop;
+
if(_G.accInUse) {
pic16_pushpCodeOp( pic16_popCopyReg(&pic16_pc_wreg) );
}
if(_G.accInUse) {
pic16_pushpCodeOp( pic16_popCopyReg(&pic16_pc_wreg) );
}
only those used in arthmetic operations remain */
pic16_aopOp((left=IC_LEFT(ic)),ic,FALSE);
pic16_aopOp((right=IC_RIGHT(ic)),ic,FALSE);
only those used in arthmetic operations remain */
pic16_aopOp((left=IC_LEFT(ic)),ic,FALSE);
pic16_aopOp((right=IC_RIGHT(ic)),ic,FALSE);
- pic16_aopOp((result=IC_RESULT(ic)),ic,FALSE);
+ pic16_aopOp((result=IC_RESULT(ic)),ic,TRUE);
DEBUGpic16_pic16_AopType(__LINE__,left,right,result);
DEBUGpic16_pic16_AopType(__LINE__,left,right,result);
only those used in arthmetic operations remain */
pic16_aopOp((left=IC_LEFT(ic)),ic,FALSE);
pic16_aopOp((right=IC_RIGHT(ic)),ic,FALSE);
only those used in arthmetic operations remain */
pic16_aopOp((left=IC_LEFT(ic)),ic,FALSE);
pic16_aopOp((right=IC_RIGHT(ic)),ic,FALSE);
- pic16_aopOp((result=IC_RESULT(ic)),ic,FALSE);
+ pic16_aopOp((result=IC_RESULT(ic)),ic,TRUE);
DEBUGpic16_pic16_AopType(__LINE__,left,right,result);
DEBUGpic16_pic16_AopType(__LINE__,left,right,result);
left = IC_LEFT(ic);
result=IC_RESULT(ic);
pic16_aopOp (left,ic,FALSE);
left = IC_LEFT(ic);
result=IC_RESULT(ic);
pic16_aopOp (left,ic,FALSE);
- pic16_aopOp (result,ic,FALSE);
+ pic16_aopOp (result,ic,TRUE);
DEBUGpic16_pic16_AopType(__LINE__,left,NULL,result);
DEBUGpic16_pic16_AopType(__LINE__,left,NULL,result);
left = IC_LEFT(ic);
result=IC_RESULT(ic);
pic16_aopOp (left,ic,FALSE);
left = IC_LEFT(ic);
result=IC_RESULT(ic);
pic16_aopOp (left,ic,FALSE);
- pic16_aopOp (result,ic,FALSE);
+ pic16_aopOp (result,ic,TRUE);
DEBUGpic16_pic16_AopType(__LINE__,left,NULL,result);
DEBUGpic16_pic16_AopType(__LINE__,left,NULL,result);
pic16_freeAsmop(right,NULL,ic,TRUE);
pic16_aopOp(left,ic,FALSE);
pic16_freeAsmop(right,NULL,ic,TRUE);
pic16_aopOp(left,ic,FALSE);
- pic16_aopOp(result,ic,FALSE);
+ pic16_aopOp(result,ic,TRUE);
size = getSize(operandType(result));
size = getSize(operandType(result));
pic16_freeAsmop(right,NULL,ic,TRUE);
pic16_aopOp(left,ic,FALSE);
pic16_freeAsmop(right,NULL,ic,TRUE);
pic16_aopOp(left,ic,FALSE);
- pic16_aopOp(result,ic,FALSE);
+ pic16_aopOp(result,ic,TRUE);
DEBUGpic16_emitcode ("; ***","%s %d shCount:%d result:%d left:%d",__FUNCTION__,__LINE__,shCount,AOP_SIZE(result),AOP_SIZE(left));
DEBUGpic16_emitcode ("; ***","%s %d shCount:%d result:%d left:%d",__FUNCTION__,__LINE__,shCount,AOP_SIZE(result),AOP_SIZE(left));
pic16_aopOp(right,ic,FALSE);
pic16_aopOp(left,ic,FALSE);
pic16_aopOp(right,ic,FALSE);
pic16_aopOp(left,ic,FALSE);
- pic16_aopOp(result,ic,FALSE);
+ pic16_aopOp(result,ic,TRUE);
sign = !SPEC_USIGN(operandType (left));
signedCount = !SPEC_USIGN(operandType (right));
sign = !SPEC_USIGN(operandType (left));
signedCount = !SPEC_USIGN(operandType (right));
int size, offset = 0, leoffset=0 ;
DEBUGpic16_emitcode ("; ***","%s %d",__FUNCTION__,__LINE__);
int size, offset = 0, leoffset=0 ;
DEBUGpic16_emitcode ("; ***","%s %d",__FUNCTION__,__LINE__);
- pic16_aopOp(result, ic, FALSE);
+ pic16_aopOp(result, ic, TRUE);
size = AOP_SIZE(result);
// fprintf(stderr, "%s:%d size= %d\n", __FILE__, __LINE__, size);
size = AOP_SIZE(result);
// fprintf(stderr, "%s:%d size= %d\n", __FILE__, __LINE__, size);
}
DEBUGpic16_emitcode ("; ***","%s %d",__FUNCTION__,__LINE__);
}
DEBUGpic16_emitcode ("; ***","%s %d",__FUNCTION__,__LINE__);
- pic16_aopOp (result,ic,FALSE);
+ pic16_aopOp (result,ic,TRUE);
DEBUGpic16_pic16_AopType(__LINE__, left, NULL, result);
DEBUGpic16_pic16_AopType(__LINE__, left, NULL, result);
rname = pic16_aopGet(AOP(left),0,FALSE,FALSE);
pic16_freeAsmop(left,NULL,ic,TRUE);
rname = pic16_aopGet(AOP(left),0,FALSE,FALSE);
pic16_freeAsmop(left,NULL,ic,TRUE);
- pic16_aopOp (result,ic,FALSE);
+ pic16_aopOp (result,ic,TRUE);
/* if bitfield then unpack the bits */
if (IS_BITFIELD(retype))
/* if bitfield then unpack the bits */
if (IS_BITFIELD(retype))
}
/* so dptr know contains the address */
pic16_freeAsmop(left,NULL,ic,TRUE);
}
/* so dptr know contains the address */
pic16_freeAsmop(left,NULL,ic,TRUE);
- pic16_aopOp(result,ic,FALSE);
+ pic16_aopOp(result,ic,TRUE);
/* if bit then unpack */
if (IS_BITFIELD(retype))
/* if bit then unpack */
if (IS_BITFIELD(retype))
DEBUGpic16_emitcode ("; ***","%s %d",__FUNCTION__,__LINE__);
pic16_aopOp(left,ic,FALSE);
DEBUGpic16_emitcode ("; ***","%s %d",__FUNCTION__,__LINE__);
pic16_aopOp(left,ic,FALSE);
- pic16_aopOp(result,ic,FALSE);
+ pic16_aopOp(result,ic,TRUE);
size = AOP_SIZE(result);
DEBUGpic16_pic16_AopType(__LINE__,left,NULL,result);
size = AOP_SIZE(result);
DEBUGpic16_pic16_AopType(__LINE__,left,NULL,result);