From: tecodev Date: Mon, 14 Feb 2005 11:00:42 +0000 (+0000) Subject: * device/lib/pic16/libc/string/memccpy.c: changed 3rd argument to char X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=ec0e96d4b57d9a43ff90116ef20fc6e2016490f6;p=fw%2Fsdcc * 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 git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@3680 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- diff --git a/ChangeLog b/ChangeLog index 7f6ed781..e4096f97 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2005-02-14 Raphael Neider + + * 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 * device/include/pic16/string.h: modified prototype for memccpy() diff --git a/device/lib/pic16/libc/string/memccpy.c b/device/lib/pic16/libc/string/memccpy.c index 9e8d03f0..73ec6841 100644 --- a/device/lib/pic16/libc/string/memccpy.c +++ b/device/lib/pic16/libc/string/memccpy.c @@ -26,7 +26,7 @@ -------------------------------------------------------------------------*/ #include -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; diff --git a/src/SDCC.lex b/src/SDCC.lex index 1701dbe1..43074e9d 100644 --- a/src/SDCC.lex +++ b/src/SDCC.lex @@ -692,6 +692,10 @@ static int process_pragma(char *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; @@ -706,7 +710,7 @@ static int process_pragma(char *s) 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); return 0; } } diff --git a/src/pic16/gen.c b/src/pic16/gen.c index 31b932c5..d87d6303 100644 --- a/src/pic16/gen.c +++ b/src/pic16/gen.c @@ -702,7 +702,10 @@ static asmop *aopForSym (iCode *ic, operand *op, bool result) #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) ); } @@ -7596,7 +7599,7 @@ static void genAndOp (iCode *ic) 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); @@ -7645,7 +7648,7 @@ static void genOrOp (iCode *ic) 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); @@ -8687,7 +8690,7 @@ static void genRRC (iCode *ic) 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); @@ -8732,7 +8735,7 @@ static void genRLC (iCode *ic) 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); @@ -9767,7 +9770,7 @@ void pic16_genLeftShiftLiteral (operand *left, 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)); @@ -10375,7 +10378,7 @@ static void genRightShiftLiteral (operand *left, 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)); @@ -10723,7 +10726,7 @@ static void genGenericShift (iCode *ic, int isShiftLeft) { 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)); @@ -11030,7 +11033,7 @@ static void genDataPointerGet(operand *left, 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); @@ -11139,7 +11142,7 @@ static void genNearPointerGet (operand *left, } DEBUGpic16_emitcode ("; ***","%s %d",__FUNCTION__,__LINE__); - pic16_aopOp (result,ic,FALSE); + pic16_aopOp (result,ic,TRUE); DEBUGpic16_pic16_AopType(__LINE__, left, NULL, result); @@ -11278,7 +11281,7 @@ static void genPagedPointerGet (operand *left, 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)) @@ -11356,7 +11359,7 @@ static void genFarPointerGet (operand *left, } /* 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)) @@ -11508,7 +11511,7 @@ static void genGenPointerGet (operand *left, 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);