From: tecodev Date: Sat, 20 May 2006 16:55:08 +0000 (+0000) Subject: * src/pic/gen.c (bitpatternFromVal): fixed for 64-bit machines X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=10ecf7f3793460f370a97f69e98bc7bffecdf115;p=fw%2Fsdcc * src/pic/gen.c (bitpatternFromVal): fixed for 64-bit machines * src/pic16/ralloc.c (newReg): use correct name in hashtable, (allocReg): add only new registers to dynAllocRegs, (pic16_assignRegisters): do not reset dynrIdx, fixes bugs #1489055, #1445850, and probably #1483693 git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@4182 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- diff --git a/ChangeLog b/ChangeLog index 305832bc..71370510 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2006-05-20 Raphael Neider + + * src/pic/gen.c (bitpatternFromVal): fixed for 64-bit machines + * src/pic16/ralloc.c (newReg): use correct name in hashtable, + (allocReg): add only new registers to dynAllocRegs, + (pic16_assignRegisters): do not reset dynrIdx, fixes bugs + #1489055, #1445850, and probably #1483693 + 2006-05-19 Vangelis Rokas * src/pic16/glue.c (pic16_emitConfigRegs, pic16_emitIDRegs): fixed diff --git a/src/pic/gen.c b/src/pic/gen.c index 1189c360..649a57d0 100644 --- a/src/pic/gen.c +++ b/src/pic/gen.c @@ -34,6 +34,7 @@ #include #include #include +#include #include "SDCCglobl.h" #include "newalloc.h" @@ -9361,10 +9362,10 @@ bitpatternFromVal (value *val) { union { float d; - unsigned long l; + uint32_t l; } float_long; - assert (sizeof (float) == sizeof (long)); + assert (sizeof (float) == sizeof (uint32_t)); //fprintf (stderr, "%s:%u(%s): val=%lf, type: %d, etype: %d\n", __FILE__, __LINE__, __FUNCTION__, floatFromVal(val), SPEC_NOUN(val->type), SPEC_NOUN(val->etype)); diff --git a/src/pic16/ralloc.c b/src/pic16/ralloc.c index 611142db..d14b83fb 100644 --- a/src/pic16/ralloc.c +++ b/src/pic16/ralloc.c @@ -153,6 +153,7 @@ debugLog (char *fmt,...) vsprintf (buffer, fmt, ap); fprintf (debugF, "%s", buffer); + //fprintf (stderr, "%s", buffer); /* while (isspace((unsigned char)*bufferP)) bufferP++; @@ -424,7 +425,7 @@ regs* newReg(int type, short pc_type, int rIdx, char *name, unsigned size, int a dReg->regop = refop; if(!(type == REG_SFR && alias == 0x80)) - hTabAddItem(&dynDirectRegNames, regname2key(name), dReg); + hTabAddItem(&dynDirectRegNames, regname2key(dReg->name), dReg); return dReg; } @@ -578,17 +579,16 @@ allocReg (short type) // (_inRegAllocator)?"ralloc":"", currFunc, reg->name, reg->rIdx); #if 1 - if(_inRegAllocator && (dynrIdx > MAX_P16_NREGS)) { -// debugf("allocating more registers than available\n", 0); -// return (NULL); - } + if(_inRegAllocator && (dynrIdx > MAX_P16_NREGS)) { + // debugf("allocating more registers than available\n", 0); + // return (NULL); + } + + addSet(&pic16_dynAllocRegs, reg); + hTabAddItem(&dynAllocRegNames, regname2key(reg->name), reg); +// fprintf(stderr, "%s:%d added reg to pic16_dynAllocRegs = %p\n", __FUNCTION__, __LINE__, pic16_dynAllocRegs); #endif } - - addSet(&pic16_dynAllocRegs, reg); - hTabAddItem(&dynAllocRegNames, regname2key(reg->name), reg); - -// fprintf(stderr, "%s:%d added reg to pic16_dynAllocRegs = %p\n", __FUNCTION__, __LINE__, pic16_dynAllocRegs); debugLog ("%s of type %s for register rIdx: %d (0x%x)\n", __FUNCTION__, debugLogRegType (type), dynrIdx-1, dynrIdx-1); @@ -4464,7 +4464,9 @@ pic16_assignRegisters (ebbIndex * ebbi) regTypeNum (); /* start counting function temporary registers from zero */ - dynrIdx = 0; + /* XXX: Resetting dynrIdx breaks register allocation, + * see #1489055, #1483693 (?), and #1445850! */ + //dynrIdx = 0; /* and serially allocate registers */ serialRegAssign (ebbs, count);