From: tecodev Date: Sun, 18 Sep 2005 11:19:12 +0000 (+0000) Subject: * src/pic16/gen.c (genFarPointerGet,genFarPointerSet): removed X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=6ec8b0a2821f0f1f135ef84d86ec49d79492b00f;p=fw%2Fsdcc * src/pic16/gen.c (genFarPointerGet,genFarPointerSet): removed as these are now unused, (genPointerGet,genPointerSet): handle FPOINTERs like POINTERs * src/pic16/pcode.c (pic16_symIsSpecial): assume REG_TMPs to be local, avoids uninitialized pointer dereference on r->name * src/pic16/ralloc.c (newReg): fixed indentation git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@3894 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- diff --git a/ChangeLog b/ChangeLog index 46cbbc38..64563cca 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2005-09-18 Raphael Neider + + * src/pic16/gen.c (genFarPointerGet,genFarPointerSet): removed + as these are now unused, + (genPointerGet,genPointerSet): handle FPOINTERs like POINTERs + * src/pic16/pcode.c (pic16_symIsSpecial): assume REG_TMPs to be + local, avoids uninitialized pointer dereference on r->name + * src/pic16/ralloc.c (newReg): fixed indentation + 2005-09-13 Maarten Brock * src/SDCCval.c (constVal): fixed bug 730366 diff --git a/src/pic16/gen.c b/src/pic16/gen.c index 9ca5da16..00d5cd1b 100644 --- a/src/pic16/gen.c +++ b/src/pic16/gen.c @@ -10972,6 +10972,10 @@ static void genPagedPointerGet (operand *left, } +#if 0 +/* This code is not adjusted to PIC16 and fails utterly. + * On the other hand: PIC16 does not support xdata (the only mem FPOINTERs are used for) anyway... */ + /*-----------------------------------------------------------------*/ /* genFarPointerGet - gget value from far space */ /*-----------------------------------------------------------------*/ @@ -11021,6 +11025,7 @@ static void genFarPointerGet (operand *left, pic16_freeAsmop(result,NULL,ic,TRUE); } +#endif #if 0 /*-----------------------------------------------------------------*/ @@ -11313,6 +11318,7 @@ static void genPointerGet (iCode *ic) the pointer values */ switch (p_type) { case POINTER: + case FPOINTER: case IPOINTER: genNearPointerGet (left,result,ic); break; @@ -11321,9 +11327,13 @@ static void genPointerGet (iCode *ic) genPagedPointerGet(left,result,ic); break; +#if 0 + /* PICs do not support FAR pointers... */ + /* MUST move them somewhere; handle FPOINTERs like POINTERS or like GPOINTERs?!? */ case FPOINTER: genFarPointerGet (left,result,ic); break; +#endif case CPOINTER: genConstPointerGet (left,result,ic); @@ -11825,6 +11835,10 @@ static void genPagedPointerSet (operand *right, } +#if 0 +/* This code is not adjusted to PIC16 and fails utterly... + * On the other hand: PIC16 has no xdata anyway (the only memory FPOINTERs are use for) */ + /*-----------------------------------------------------------------*/ /* genFarPointerSet - set value from far space */ /*-----------------------------------------------------------------*/ @@ -11874,6 +11888,7 @@ static void genFarPointerSet (operand *right, pic16_freeAsmop(right,NULL,ic,TRUE); } +#endif /*-----------------------------------------------------------------*/ /* genGenPointerSet - set value from generic pointer space */ @@ -12102,6 +12117,7 @@ static void genPointerSet (iCode *ic) the pointer values */ switch (p_type) { case POINTER: + case FPOINTER: case IPOINTER: genNearPointerSet (right,result,ic); break; @@ -12110,9 +12126,12 @@ static void genPointerSet (iCode *ic) genPagedPointerSet (right,result,ic); break; +#if 0 + /* MUST move them somewhere; handle FPOINTERs like POINTERS or like GPOINTERs?!? */ case FPOINTER: genFarPointerSet (right,result,ic); break; +#endif case GPOINTER: genGenPointerSet (right,result,ic); diff --git a/src/pic16/pcode.c b/src/pic16/pcode.c index 24f36331..6e12de99 100644 --- a/src/pic16/pcode.c +++ b/src/pic16/pcode.c @@ -10578,6 +10578,8 @@ static int pic16_symIsSpecial (symbol_t sym) { static int pic16_regIsLocal (regs *r) { symbol_t sym; if (r) { + if (r->type == REG_TMP) return 1; + sym = symFromStr (r->name); switch (sym) { case SPO_WREG: diff --git a/src/pic16/ralloc.c b/src/pic16/ralloc.c index 5fa12896..197cf013 100644 --- a/src/pic16/ralloc.c +++ b/src/pic16/ralloc.c @@ -371,9 +371,10 @@ regs* newReg(short type, short pc_type, int rIdx, char *name, int size, int alia dReg->name = Safe_strdup(name); else { sprintf(buffer,"r0x%02X", dReg->rIdx); - if(type == REG_STK) + if(type == REG_STK) { *buffer = 's'; - dReg->name = Safe_strdup(buffer); + } + dReg->name = Safe_strdup(buffer); } @@ -392,7 +393,7 @@ regs* newReg(short type, short pc_type, int rIdx, char *name, int size, int alia } #if NEWREG_DEBUG - fprintf(stderr,"newReg: %s, rIdx = 0x%02x\taccess= %d\tregop= %p\n",dReg->name,rIdx, dReg->accessBank, refop); + fprintf(stderr,"newReg @ %p: %s, rIdx = 0x%02x\taccess= %d\tregop= %p\n",dReg, dReg->name,rIdx, dReg->accessBank, refop); #endif dReg->size = size; dReg->alias = alias;