* device/lib/Makefile.in (target port-specific-objects-pic16):
authorvrokas <vrokas@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sun, 3 Oct 2004 01:10:21 +0000 (01:10 +0000)
committervrokas <vrokas@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sun, 3 Oct 2004 01:10:21 +0000 (01:10 +0000)
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

ChangeLog
device/lib/Makefile.in
src/pic16/gen.c
src/pic16/gen.h

index c8cc71c4a03d4c98fb5e2aff6c150674052117dc..7692025407d2b28edb3e9ff7d7255f0431cd41aa 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2004-10-03 Vangelis Rokas <vrokas AT otenet.gr>
+
+       * 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 <vrokas AT otenet.gr>
 
        * .version: bumped version number to 2.4.5
index 419859bfe94ede8b5961950c9d17dac55bef0ce6..2a6b6f9995efd8e14168517fa9add0db5053f5ad 100644 (file)
@@ -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:
index 9a09ef0b891063c594ff9914f17864e1f7aa82ab..2d130bc34f275ad83e3c45522da2fab4cfe305cf 100644 (file)
@@ -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;i<aop->size;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;i<aop->size;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,
index 50d83bb8a1b3b100191efa1646248632d5200728..7d4b058a613ca5e9b0fc16736e224cb5f379355e 100644 (file)
@@ -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__);