From: tecodev Date: Mon, 15 Sep 2008 09:28:11 +0000 (+0000) Subject: * src/pic16/device.c (pic16_dump_usection): force udata sections X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=c5499f98aa5c2ce7df3a6e5dcf0fd69b6c3818cd;p=fw%2Fsdcc * src/pic16/device.c (pic16_dump_usection): force udata sections into the addressable range (0..0xFFF), workaround for a gpsim bug preventing simulation of regtest bug1750318 * src/pic16/ralloc.c (deassignLRs): cosmetic changes, (serialRegAssign): fixed regtest bug-971834, (pic16_packRegisters): avoid null-pointer dereference git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@5238 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- diff --git a/ChangeLog b/ChangeLog index c576667e..e3e93675 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2008-09-15 Raphael Neider + + * src/pic16/device.c (pic16_dump_usection): force udata sections + into the addressable range (0..0xFFF), workaround for a gpsim + bug preventing simulation of regtest bug1750318 + * src/pic16/ralloc.c (deassignLRs): cosmetic changes, + (serialRegAssign): fixed regtest bug-971834, + (pic16_packRegisters): avoid null-pointer dereference + 2008-09-14 Raphael Neider * src/pic16/gen.c, src/pic16/ralloc.c: use diff --git a/src/pic16/device.c b/src/pic16/device.c index 66ee6f3c..726e0fe9 100644 --- a/src/pic16/device.c +++ b/src/pic16/device.c @@ -195,29 +195,30 @@ void pic16_dump_usection(FILE *of, set *section, int fix) #endif } else { unsigned int j=0; - int deb_addr=0; rprev = NULL; - init_addr = rlist[j]->address; - deb_addr = init_addr; - fprintf(of, "\n\nustat_%s_%02d\tudata\t0X%04X\n", moduleName, abs_usection_no++, init_addr); + init_addr = (rlist[j]->address & 0x0FFF); // warning(s) emitted below + fprintf(of, "\n\nustat_%s_%02d\tudata\t0X%04X\n", moduleName, abs_usection_no++, (init_addr & 0x0FFF)); for(j=0;jaddress; - deb_addr = init_addr; + init_addr = (r->address & 0x0FFF); + if (init_addr != r->address) { + fprintf (stderr, "%s: WARNING: Changed address of pinned variable %s from 0x%x to 0x%x\n", + moduleName, r->name, r->address, init_addr); + } // if - if((rprev && (init_addr > (rprev->address + rprev->size)))) { + if((rprev && (init_addr != ((rprev->address & 0x0FFF) + rprev->size)))) { fprintf(of, "\n\nustat_%s_%02d\tudata\t0X%04X\n", moduleName, abs_usection_no++, init_addr); } - if(r1 && (init_addr == r1->address)) { + /* XXX: Does not handle partial overlap correctly. */ + if(r1 && (init_addr == (r1->address & 0x0FFF))) { fprintf(of, "\n%s\tres\t0\n", r->name); } else { fprintf(of, "%s\tres\t%d\n", r->name, r->size); - deb_addr += r->size; statistics.udsize += r->size; } diff --git a/src/pic16/ralloc.c b/src/pic16/ralloc.c index b61225f3..c626d27f 100644 --- a/src/pic16/ralloc.c +++ b/src/pic16/ralloc.c @@ -2117,12 +2117,6 @@ deassignLRs (iCode * ic, eBBlock * ebp) ) { - -// for (i = 0; i < max (sym->nRegs, result->nRegs); i++) - /* the above does not free the unsued registers in sym, - * leaving them marked as used, and increasing register usage - * until the end of the function - VR 23/11/05 */ - for (i = 0; i < result->nRegs; i++) if (i < sym->nRegs) result->regs[i] = sym->regs[i]; @@ -2130,6 +2124,7 @@ deassignLRs (iCode * ic, eBBlock * ebp) result->regs[i] = getRegGpr (ic, ebp, result); _G.regAssigned = bitVectSetBit (_G.regAssigned, result->key); + } /* free the remaining */ @@ -2387,13 +2382,12 @@ serialRegAssign (eBBlock ** ebbs, int count) have been allocated after sym->liveFrom but freed before ic->seq. This is complicated, so spill this symbol instead and let fillGaps handle the allocation. */ -#if 0 if (sym->liveFrom < ic->seq) { spillThis (sym); continue; } -#endif + /* if it has a spillocation & is used less than all other live ranges then spill this */ if (willCS) { @@ -4068,7 +4062,7 @@ pic16_packRegisters (eBBlock * ebp) #endif /* mark the pointer usages */ - if (POINTER_SET (ic)) + if (POINTER_SET (ic) && IS_SYMOP (IC_RESULT (ic))) { OP_SYMBOL (IC_RESULT (ic))->uptr = 1; debugLog (" marking as a pointer (set) =>");