* device/include/pic16/pic18fregs.h, src/pic16/devices.inc,
[fw/sdcc] / src / pic16 / ralloc.c
index b6a50842db49cea97161620c920cb391be79ac6a..197cf0138bbcd31393301d3fa0f38ab77bdeaca0 100644 (file)
@@ -154,7 +154,7 @@ debugLog (char *fmt,...)
 
   fprintf (debugF, "%s", buffer);
 /*
-   while (isspace(*bufferP)) bufferP++;
+   while (isspace((unsigned char)*bufferP)) bufferP++;
 
    if (bufferP && *bufferP) 
    lineCurr = (lineCurr ?
@@ -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;
@@ -927,8 +928,8 @@ pic16_allocDirReg (operand *op )
                reg->address = SPEC_ADDR ( OP_SYM_ETYPE(op));
 
                /* work around for user defined registers in access bank */
-               if((reg->address>= 0x00 && reg->address < 0x80)
-                       || (reg->address >= 0xf80 && reg->address <= 0xfff))
+               if((reg->address>= 0x00 && reg->address < pic16->acsSplitOfs)
+                       || (reg->address >= (0xf00 + pic16->acsSplitOfs) && reg->address <= 0xfff))
                        reg->accessBank = 1;
                
                debugLog ("  -- and it is at a fixed address 0x%02x\n",reg->address);
@@ -960,7 +961,7 @@ pic16_allocRegByName (char *name, int size, operand *op)
      * a new one and put it in the hash table AND in the 
      * dynDirectRegNames set */
 
-       fprintf (stderr,"%s:%d symbol name %s\tregop= %p\n", __FUNCTION__, __LINE__, name, op);
+       //fprintf (stderr,"%s:%d symbol name %s\tregop= %p\n", __FUNCTION__, __LINE__, name, op);
 
     reg = newReg(REG_GPR, PO_DIR, rDirectIdx++, name,size,0, op);