]> git.gag.com Git - fw/sdcc/commitdiff
* src/pic/gen.c (bitpatternFromVal): fixed for 64-bit machines
authortecodev <tecodev@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sat, 20 May 2006 16:55:08 +0000 (16:55 +0000)
committertecodev <tecodev@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sat, 20 May 2006 16:55:08 +0000 (16:55 +0000)
* 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

ChangeLog
src/pic/gen.c
src/pic16/ralloc.c

index 305832bccfa96fd80240bf136f4c0367260c0420..713705100adc4364efaa61a9047adc7eefe5b07b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2006-05-20 Raphael Neider <rneider AT web.de>
+
+       * 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 <vrokas AT users.sourceforge.net>
 
        * src/pic16/glue.c (pic16_emitConfigRegs, pic16_emitIDRegs): fixed
index 1189c3607d38e85514974140de8ba63fc9cff657..649a57d0cd0b2e1c399da039f29632fff02dce29 100644 (file)
@@ -34,6 +34,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <ctype.h>
+#include <stdint.h>
 #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));
 
index 611142db48593b9f1a8f813824fae562902ce9b5..d14b83fb623093719b1ab70c089268dbafd8048a 100644 (file)
@@ -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);