From: vrokas Date: Sun, 3 Oct 2004 01:10:21 +0000 (+0000) Subject: * device/lib/Makefile.in (target port-specific-objects-pic16): X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=fd23064b4eb19559594c59030c66b32e2cd60c37;p=fw%2Fsdcc * device/lib/Makefile.in (target port-specific-objects-pic16): changed * to *.* so to ignore the CVS directory, * src/pic16/gen.c (pic16_freeAsmop): added code to store result of stacked variables back in stack, * (genEndFunction): fixed bug reported by G.M. Gallant with stack corruption git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@3520 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- diff --git a/ChangeLog b/ChangeLog index c8cc71c4..76920254 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2004-10-03 Vangelis Rokas + + * device/lib/Makefile.in (target port-specific-objects-pic16): + changed * to *.* so to ignore the CVS directory, + * src/pic16/gen.c (pic16_freeAsmop): added code to store result of + stacked variables back in stack, + * (genEndFunction): fixed bug reported by G.M. Gallant with stack + corruption + 2004-10-01 Vangelis Rokas * .version: bumped version number to 2.4.5 diff --git a/device/lib/Makefile.in b/device/lib/Makefile.in index 419859bf..2a6b6f99 100644 --- a/device/lib/Makefile.in +++ b/device/lib/Makefile.in @@ -235,7 +235,7 @@ port-specific-objects: port-specific-objects-pic16: if [ -d $(PORT) ]; then \ $(MAKE) -C $(PORT); \ - cp -f $(PORT)/bin/* $(PORTDIR); \ + cp -f $(PORT)/bin/*.* $(PORTDIR); \ fi lib-files: diff --git a/src/pic16/gen.c b/src/pic16/gen.c index 9a09ef0b..2d130bc3 100644 --- a/src/pic16/gen.c +++ b/src/pic16/gen.c @@ -1241,13 +1241,22 @@ void pic16_freeAsmop (operand *op, asmop *aaop, iCode *ic, bool pop) { int i; + /* we must store the result on stack */ + if((op == IC_RESULT(ic)) && RESULTONSTA(ic)) { + if(_G.accInUse)pic16_pushpCodeOp( pic16_popCopyReg(&pic16_pc_wreg) ); + for(i=0;isize;i++) { + /* initialise for stack access via frame pointer */ + pic16_emitpcode(POC_MOVLW, pic16_popGetLit(OP_SYMBOL(IC_RESULT(ic))->stack + i + _G.stack_lat)); + + pic16_emitpcode(POC_MOVFF, pic16_popGet2p( + aop->aopu.stk.pop[i], pic16_popCopyReg(&pic16_pc_plusw2))); + } + + if(_G.accInUse)pic16_poppCodeOp( pic16_popCopyReg(&pic16_pc_wreg) ); + } + for(i=0;isize;i++) -#if 1 PCOR(aop->aopu.stk.pop[i] )->r->isFree = 1; -#else - pic16_popReleaseTempReg( aop->aopu.stk.pop[i], 0 ); - bitVectUnSetBit(_G.fregsUsed, PCOR(aop->aopu.stk.pop[i])->r->rIdx ); -#endif } break; #if 0 @@ -3737,7 +3746,7 @@ static void genEndFunction (iCode *ic) if(strcmp(sym->name, "main")) { - if(/*!options.ommitFramePtr ||*/ sym->regsUsed) { + if(1/*!options.ommitFramePtr ||*/ /*sym->regsUsed*/) { /* restore stack frame */ if(STACK_MODEL_LARGE) pic16_emitpcode(POC_MOVFF, diff --git a/src/pic16/gen.h b/src/pic16/gen.h index 50d83bb8..7d4b058a 100644 --- a/src/pic16/gen.h +++ b/src/pic16/gen.h @@ -97,10 +97,7 @@ asmop; void genpic16Code (iCode *); -//extern char *fReturnpic16[]; -//extern char *fReturn390[]; extern unsigned pic16_fReturnSizePic; -//extern char **fReturn; #define AOP(op) op->aop @@ -120,6 +117,8 @@ extern unsigned pic16_fReturnSizePic; #define RESULTONSTACK(x) \ (IC_RESULT(x) && IC_RESULT(x)->aop && \ IC_RESULT(x)->aop->type == AOP_STK ) +#define RESULTONSTA(x) (IC_RESULT(x) && IC_RESULT(x)->aop && IC_RESULT(x)->aop->type == AOP_STA) + #define MOVA(x) if (strcmp(x,"a") && strcmp(x,"acc")) pic16_emitcode(";XXX mov","a,%s %s,%d",x,__FILE__,__LINE__); #define CLRC pic16_emitcode(";XXX clr","c %s,%d",__FILE__,__LINE__);