slocs are not statics
[fw/sdcc] / src / pic / ralloc.c
index 244947d8b753d0c490b273c898a6a65008c35659..95c75778a00e2adf6b699b24f5b52c12c2ab9c14 100644 (file)
 
 #include "common.h"
 #include "ralloc.h"
+#include "pcode.h"
 #include "gen.h"
 
-#if defined(_MSC_VER)
-#define __FUNCTION__ __FILE__
-#endif
-
 /*-----------------------------------------------------------------*/
 /* At this point we start getting processor specific although      */
 /* some routines are non-processor specific & can be reused when   */
@@ -61,33 +58,88 @@ _G;
 int pic14_ptrRegReq;           /* one byte pointer register required */
 
 /* pic14 registers */
+/* A nasty, awful, disgusting hack for register declarations */
+#ifdef p16c84
+
 regs regspic14[] =
 {
 
-  {REG_GPR, 0x0C, "r0x0C", "r0x0C", 0x0C, 1, 0},
-  {REG_GPR, 0x0D, "r0x0D", "r0x0C", 0x0D, 1, 0},
-  {REG_GPR, 0x0E, "r0x0E", "r0x0C", 0x0E, 1, 0},
-  {REG_GPR, 0x0F, "r0x0F", "r0x0C", 0x0F, 1, 0},
-  {REG_GPR, 0x10, "r0x10", "r0x10", 0x10, 1, 0},
-  {REG_GPR, 0x11, "r0x11", "r0x11", 0x11, 1, 0},
-  {REG_GPR, 0x12, "r0x12", "r0x12", 0x12, 1, 0},
-  {REG_GPR, 0x13, "r0x13", "r0x13", 0x13, 1, 0},
-  {REG_GPR, 0x14, "r0x14", "r0x14", 0x14, 1, 0},
-  {REG_GPR, 0x15, "r0x15", "r0x15", 0x15, 1, 0},
-  {REG_GPR, 0x16, "r0x16", "r0x16", 0x16, 1, 0},
-  {REG_GPR, 0x17, "r0x17", "r0x17", 0x17, 1, 0},
-  {REG_GPR, 0x18, "r0x18", "r0x18", 0x18, 1, 0},
-  {REG_GPR, 0x19, "r0x19", "r0x19", 0x19, 1, 0},
-  {REG_GPR, 0x1A, "r0x1A", "r0x1A", 0x1A, 1, 0},
-  {REG_GPR, 0x1B, "r0x1B", "r0x1B", 0x1B, 1, 0},
-  {REG_GPR, 0x1C, "r0x1C", "r0x1C", 0x1C, 1, 0},
-  {REG_GPR, 0x1D, "r0x1D", "r0x1D", 0x1D, 1, 0},
-  {REG_GPR, 0x1E, "r0x1E", "r0x1E", 0x1E, 1, 0},
-  {REG_GPR, 0x1F, "r0x1F", "r0x1F", 0x1F, 1, 0},
-  {REG_PTR, 4, "FSR", "FSR", 4, 1, 0},
+  {REG_GPR, PO_GPR_TEMP, 0x0C, "r0x0C", "r0x0C", 0x0C, 1, 0},
+  {REG_GPR, PO_GPR_TEMP, 0x0D, "r0x0D", "r0x0C", 0x0D, 1, 0},
+  {REG_GPR, PO_GPR_TEMP, 0x0E, "r0x0E", "r0x0C", 0x0E, 1, 0},
+  {REG_GPR, PO_GPR_TEMP, 0x0F, "r0x0F", "r0x0C", 0x0F, 1, 0},
+  {REG_GPR, PO_GPR_TEMP, 0x10, "r0x10", "r0x10", 0x10, 1, 0},
+  {REG_GPR, PO_GPR_TEMP, 0x11, "r0x11", "r0x11", 0x11, 1, 0},
+  {REG_GPR, PO_GPR_TEMP, 0x12, "r0x12", "r0x12", 0x12, 1, 0},
+  {REG_GPR, PO_GPR_TEMP, 0x13, "r0x13", "r0x13", 0x13, 1, 0},
+  {REG_GPR, PO_GPR_TEMP, 0x14, "r0x14", "r0x14", 0x14, 1, 0},
+  {REG_GPR, PO_GPR_TEMP, 0x15, "r0x15", "r0x15", 0x15, 1, 0},
+  {REG_GPR, PO_GPR_TEMP, 0x16, "r0x16", "r0x16", 0x16, 1, 0},
+  {REG_GPR, PO_GPR_TEMP, 0x17, "r0x17", "r0x17", 0x17, 1, 0},
+  {REG_GPR, PO_GPR_TEMP, 0x18, "r0x18", "r0x18", 0x18, 1, 0},
+  {REG_GPR, PO_GPR_TEMP, 0x19, "r0x19", "r0x19", 0x19, 1, 0},
+  {REG_GPR, PO_GPR_TEMP, 0x1A, "r0x1A", "r0x1A", 0x1A, 1, 0},
+  {REG_GPR, PO_GPR_TEMP, 0x1B, "r0x1B", "r0x1B", 0x1B, 1, 0},
+  {REG_GPR, PO_GPR_TEMP, 0x1C, "r0x1C", "r0x1C", 0x1C, 1, 0},
+  {REG_GPR, PO_GPR_TEMP, 0x1D, "r0x1D", "r0x1D", 0x1D, 1, 0},
+  {REG_GPR, PO_GPR_TEMP, 0x1E, "r0x1E", "r0x1E", 0x1E, 1, 0},
+  {REG_GPR, PO_GPR_TEMP, 0x1F, "r0x1F", "r0x1F", 0x1F, 1, 0},
+  {REG_PTR, PO_FSR, 4, "FSR", "FSR", 4, 1, 0},
+
+};
+#else
+
+int Gstack_base_addr=0x38; /* The starting address of registers that
+                           * are used to pass and return parameters */
+regs regspic14[] =
+{
+  {REG_GPR, PO_GPR_TEMP, 0x20, "r0x20", "r0x20", 0x20, 1, 0},
+  {REG_GPR, PO_GPR_TEMP, 0x21, "r0x21", "r0x21", 0x21, 1, 0},
+  {REG_GPR, PO_GPR_TEMP, 0x22, "r0x22", "r0x22", 0x22, 1, 0},
+  {REG_GPR, PO_GPR_TEMP, 0x23, "r0x23", "r0x23", 0x23, 1, 0},
+  {REG_GPR, PO_GPR_TEMP, 0x24, "r0x24", "r0x24", 0x24, 1, 0},
+  {REG_GPR, PO_GPR_TEMP, 0x25, "r0x25", "r0x25", 0x25, 1, 0},
+  {REG_GPR, PO_GPR_TEMP, 0x26, "r0x26", "r0x26", 0x26, 1, 0},
+  {REG_GPR, PO_GPR_TEMP, 0x27, "r0x27", "r0x27", 0x27, 1, 0},
+  {REG_GPR, PO_GPR_TEMP, 0x28, "r0x28", "r0x28", 0x28, 1, 0},
+  {REG_GPR, PO_GPR_TEMP, 0x29, "r0x29", "r0x29", 0x29, 1, 0},
+  {REG_GPR, PO_GPR_TEMP, 0x2A, "r0x2A", "r0x2A", 0x2A, 1, 0},
+  {REG_GPR, PO_GPR_TEMP, 0x2B, "r0x2B", "r0x2B", 0x2B, 1, 0},
+  {REG_GPR, PO_GPR_TEMP, 0x2C, "r0x2C", "r0x2C", 0x2C, 1, 0},
+  {REG_GPR, PO_GPR_TEMP, 0x2D, "r0x2D", "r0x2D", 0x2D, 1, 0},
+  {REG_GPR, PO_GPR_TEMP, 0x2E, "r0x2E", "r0x2E", 0x2E, 1, 0},
+  {REG_GPR, PO_GPR_TEMP, 0x2F, "r0x2F", "r0x2F", 0x2F, 1, 0},
+  {REG_GPR, PO_GPR_TEMP, 0x30, "r0x30", "r0x30", 0x30, 1, 0},
+  {REG_GPR, PO_GPR_TEMP, 0x31, "r0x31", "r0x31", 0x31, 1, 0},
+  {REG_GPR, PO_GPR_TEMP, 0x32, "r0x32", "r0x32", 0x32, 1, 0},
+  {REG_GPR, PO_GPR_TEMP, 0x33, "r0x33", "r0x33", 0x33, 1, 0},
+  {REG_GPR, PO_GPR_TEMP, 0x34, "r0x34", "r0x34", 0x34, 1, 0},
+  {REG_GPR, PO_GPR_TEMP, 0x35, "r0x35", "r0x35", 0x35, 1, 0},
+  {REG_GPR, PO_GPR_TEMP, 0x36, "r0x36", "r0x36", 0x36, 1, 0},
+  {REG_GPR, PO_GPR_TEMP, 0x37, "r0x37", "r0x37", 0x37, 1, 0},
+  {REG_STK, PO_GPR_TEMP, 0x38, "r0x38", "r0x38", 0x38, 1, 0},
+  {REG_STK, PO_GPR_TEMP, 0x39, "r0x39", "r0x39", 0x39, 1, 0},
+  {REG_STK, PO_GPR_TEMP, 0x3A, "r0x3A", "r0x3A", 0x3A, 1, 0},
+  {REG_STK, PO_GPR_TEMP, 0x3B, "r0x3B", "r0x3B", 0x3B, 1, 0},
+  {REG_STK, PO_GPR_TEMP, 0x3C, "r0x3C", "r0x3C", 0x3C, 1, 0},
+  {REG_STK, PO_GPR_TEMP, 0x3D, "r0x3D", "r0x3D", 0x3D, 1, 0},
+  {REG_STK, PO_GPR_TEMP, 0x3E, "r0x3E", "r0x3E", 0x3E, 1, 0},
+  {REG_STK, PO_GPR_TEMP, 0x3F, "r0x3F", "r0x3F", 0x3F, 1, 0},
+  {REG_STK, PO_GPR_TEMP, 0x40, "r0x40", "r0x40", 0x40, 1, 0},
+  {REG_STK, PO_GPR_TEMP, 0x41, "r0x41", "r0x41", 0x41, 1, 0},
+  {REG_STK, PO_GPR_TEMP, 0x42, "r0x42", "r0x42", 0x42, 1, 0},
+  {REG_STK, PO_GPR_TEMP, 0x43, "r0x43", "r0x43", 0x43, 1, 0},
+  {REG_STK, PO_GPR_TEMP, 0x44, "r0x44", "r0x44", 0x44, 1, 0},
+  {REG_STK, PO_GPR_TEMP, 0x45, "r0x45", "r0x45", 0x45, 1, 0},
+  {REG_STK, PO_GPR_TEMP, 0x46, "r0x46", "r0x46", 0x46, 1, 0},
+  {REG_STK, PO_GPR_TEMP, 0x47, "r0x47", "r0x47", 0x47, 1, 0},
+
+  {REG_PTR, PO_FSR, 4, "FSR", "FSR", 4, 1, 0},
 
 };
 
+#endif
+
 int pic14_nRegs = sizeof (regspic14) / sizeof (regs);
 static void spillThis (symbol *);
 static int debug = 1;
@@ -105,7 +157,7 @@ debugLog (char *fmt,...)
   //char *bufferP=buffer;
   va_list ap;
 
-  if (!debug)
+  if (!debug || !srcFileName)
     return;
 
 
@@ -319,20 +371,6 @@ decodeOp (unsigned int op)
       return "RANGE";
     case FAR:
       return "FAR";
-    case _XDATA:
-      return "_XDATA";
-    case _CODE:
-      return "_CODE";
-    case _GENERIC:
-      return "_GENERIC";
-    case _NEAR:
-      return "_NEAR";
-    case _PDATA:
-      return "_PDATA";
-    case _IDATA:
-      return "_IDATA";
-    case _EEPROM:
-      return "_EEPROM";
     case CASE:
       return "CASE";
     case DEFAULT:
@@ -480,19 +518,35 @@ pic14_regWithIdx (int idx)
 {
   int i;
 
-  debugLog ("%s\n", __FUNCTION__);
+  debugLog ("%s - requesting index = 0x%x\n", __FUNCTION__,idx);
 
   for (i = 0; i < pic14_nRegs; i++)
     if (regspic14[i].rIdx == idx)
       return &regspic14[i];
 
-  return &regspic14[0];
-
+  //return &regspic14[0];
+  fprintf(stderr,"%s %d - requested register: 0x%x\n",__FUNCTION__,__LINE__,idx);
   werror (E_INTERNAL_ERROR, __FILE__, __LINE__,
          "regWithIdx not found");
   exit (1);
 }
 
+/*-----------------------------------------------------------------*/
+/*-----------------------------------------------------------------*/
+regs *
+pic14_findFreeReg(short type)
+{
+  int i;
+
+  for (i = 0; i < pic14_nRegs; i++) {
+    if (!type && regspic14[i].isFree)
+      return &regspic14[i];
+    if (regspic14[i].isFree &&
+       regspic14[i].type == type)
+      return &regspic14[i];
+  }
+  return NULL;
+}
 /*-----------------------------------------------------------------*/
 /* freeReg - frees a register                                      */
 /*-----------------------------------------------------------------*/
@@ -890,6 +944,7 @@ createStackSpil (symbol * sym)
   sloc->etype = getSpec (sloc->type);
   SPEC_SCLS (sloc->etype) = S_DATA;
   SPEC_EXTR (sloc->etype) = 0;
+  SPEC_STAT (sloc->etype) = 0;
 
   /* we don't allow it to be allocated`
      onto the external stack since : so we
@@ -1544,19 +1599,21 @@ serialRegAssign (eBBlock ** ebbs, int count)
 
              /* if it has a spillocation & is used less than
                 all other live ranges then spill this */
-             if (willCS && sym->usl.spillLoc)
-               {
-
-                 symbol *leastUsed =
-                 leastUsedLR (liveRangesWith (spillable,
-                                              allLRs,
-                                              ebbs[i],
-                                              ic));
-                 if (leastUsed &&
-                     leastUsed->used > sym->used)
-                   {
-                     spillThis (sym);
-                     continue;
+               if (willCS) {
+                   if (sym->usl.spillLoc) {
+                       symbol *leastUsed = leastUsedLR (liveRangesWith (spillable,
+                                                                        allLRs, ebbs[i], ic));
+                       if (leastUsed && leastUsed->used > sym->used) {
+                           spillThis (sym);
+                           continue;
+                       }
+                   } else {
+                       /* if none of the liveRanges have a spillLocation then better
+                          to spill this one than anything else already assigned to registers */
+                       if (liveRangesWith(spillable,noSpilLoc,ebbs[i],ic)) {
+                           spillThis (sym);
+                           continue;
+                       }
                    }
                }
 
@@ -1566,7 +1623,7 @@ serialRegAssign (eBBlock ** ebbs, int count)
              /* if we need ptr regs for the right side
                 then mark it */
              if (POINTER_GET (ic) && getSize (OP_SYMBOL (IC_LEFT (ic))->type)
-                 <= PTRSIZE)
+                 <= (unsigned) PTRSIZE)
                {
                  pic14_ptrRegReq++;
                  ptrRegSet = 1;
@@ -1575,6 +1632,8 @@ serialRegAssign (eBBlock ** ebbs, int count)
              _G.regAssigned = bitVectSetBit (_G.regAssigned, sym->key);
 
              debugLog ("  %d - \n", __LINE__);
+             if(debugF) 
+               bitVectDebugOn(_G.regAssigned, debugF);
 
              for (j = 0; j < sym->nRegs; j++)
                {
@@ -1801,7 +1860,7 @@ rematStr (symbol * sym)
        }
 
       /* we reached the end */
-      sprintf (s, "%s\n", OP_SYMBOL (IC_LEFT (ic))->rname);
+      sprintf (s, "%s", OP_SYMBOL (IC_LEFT (ic))->rname);
       break;
     }
 
@@ -1822,109 +1881,105 @@ regTypeNum ()
   debugLog ("%s\n", __FUNCTION__);
   /* for each live range do */
   for (sym = hTabFirstItem (liveRanges, &k); sym;
-       sym = hTabNextItem (liveRanges, &k))
-    {
+       sym = hTabNextItem (liveRanges, &k)) {
 
-      debugLog ("  %d - %s\n", __LINE__, sym->rname);
+    debugLog ("  %d - %s\n", __LINE__, sym->rname);
 
-      /* if used zero times then no registers needed */
-      if ((sym->liveTo - sym->liveFrom) == 0)
-       continue;
+    /* if used zero times then no registers needed */
+    if ((sym->liveTo - sym->liveFrom) == 0)
+      continue;
 
 
-      /* if the live range is a temporary */
-      if (sym->isitmp)
-       {
-
-         debugLog ("  %d - \n", __LINE__);
-
-         /* if the type is marked as a conditional */
-         if (sym->regType == REG_CND)
-           continue;
+    /* if the live range is a temporary */
+    if (sym->isitmp) {
 
-         /* if used in return only then we don't 
-            need registers */
-         if (sym->ruonly || sym->accuse)
-           {
-             if (IS_AGGREGATE (sym->type) || sym->isptr)
-               sym->type = aggrToPtr (sym->type, FALSE);
-             debugLog ("  %d - \n", __LINE__);
-
-             continue;
-           }
+      debugLog ("  %d - itemp register\n", __LINE__);
 
-         /* if the symbol has only one definition &
-            that definition is a get_pointer and the
-            pointer we are getting is rematerializable and
-            in "data" space */
+      /* if the type is marked as a conditional */
+      if (sym->regType == REG_CND)
+       continue;
 
-         if (bitVectnBitsOn (sym->defs) == 1 &&
-             (ic = hTabItemWithKey (iCodehTab,
-                                    bitVectFirstBit (sym->defs))) &&
-             POINTER_GET (ic) &&
-             !IS_BITVAR (sym->etype))
-           {
+      /* if used in return only then we don't 
+        need registers */
+      if (sym->ruonly || sym->accuse) {
+       if (IS_AGGREGATE (sym->type) || sym->isptr)
+         sym->type = aggrToPtr (sym->type, FALSE);
+       debugLog ("  %d - no reg needed - used as a return\n", __LINE__);
 
-             debugLog ("  %d - \n", __LINE__);
+       continue;
+      }
 
-             /* if remat in data space */
-             if (OP_SYMBOL (IC_LEFT (ic))->remat &&
-                 DCL_TYPE (aggrToPtr (sym->type, FALSE)) == POINTER)
-               {
+      /* if the symbol has only one definition &
+        that definition is a get_pointer and the
+        pointer we are getting is rematerializable and
+        in "data" space */
+
+      if (bitVectnBitsOn (sym->defs) == 1 &&
+         (ic = hTabItemWithKey (iCodehTab,
+                                bitVectFirstBit (sym->defs))) &&
+         POINTER_GET (ic) &&
+         !sym->noSpilLoc &&
+         !IS_BITVAR (sym->etype)) {
+       
+
+       debugLog ("  %d - \n", __LINE__);
+
+       /* if remat in data space */
+       if (OP_SYMBOL (IC_LEFT (ic))->remat &&
+           DCL_TYPE (aggrToPtr (sym->type, FALSE)) == POINTER) {
+
+         /* create a psuedo symbol & force a spil */
+         symbol *psym = newSymbol (rematStr (OP_SYMBOL (IC_LEFT (ic))), 1);
+         psym->type = sym->type;
+         psym->etype = sym->etype;
+         strcpy (psym->rname, psym->name);
+         sym->isspilt = 1;
+         sym->usl.spillLoc = psym;
+         continue;
+       }
 
-                 /* create a psuedo symbol & force a spil */
-                 symbol *psym = newSymbol (rematStr (OP_SYMBOL (IC_LEFT (ic))), 1);
-                 psym->type = sym->type;
-                 psym->etype = sym->etype;
-                 strcpy (psym->rname, psym->name);
-                 sym->isspilt = 1;
-                 sym->usl.spillLoc = psym;
-                 continue;
-               }
+       /* if in data space or idata space then try to
+          allocate pointer register */
 
-             /* if in data space or idata space then try to
-                allocate pointer register */
+      }
 
-           }
+      /* if not then we require registers */
+      sym->nRegs = ((IS_AGGREGATE (sym->type) || sym->isptr) ?
+                   getSize (sym->type = aggrToPtr (sym->type, FALSE)) :
+                   getSize (sym->type));
 
-         /* if not then we require registers */
-         sym->nRegs = ((IS_AGGREGATE (sym->type) || sym->isptr) ?
-                       getSize (sym->type = aggrToPtr (sym->type, FALSE)) :
-                       getSize (sym->type));
+      if (sym->nRegs > 4) {
+       fprintf (stderr, "allocated more than 4 or 0 registers for type ");
+       printTypeChain (sym->type, stderr);
+       fprintf (stderr, "\n");
+      }
 
-         if (sym->nRegs > 4)
-           {
-             fprintf (stderr, "allocated more than 4 or 0 registers for type ");
-             printTypeChain (sym->type, stderr);
-             fprintf (stderr, "\n");
-           }
+      /* determine the type of register required */
+      if (sym->nRegs == 1 &&
+         IS_PTR (sym->type) &&
+         sym->uptr)
+       sym->regType = REG_PTR;
+      else
+       sym->regType = REG_GPR;
 
-         debugLog ("  %d - \n", __LINE__);
 
-         /* determine the type of register required */
-         if (sym->nRegs == 1 &&
-             IS_PTR (sym->type) &&
-             sym->uptr)
-           sym->regType = REG_PTR;
-         else
-           sym->regType = REG_GPR;
-         debugLog ("  reg type %s\n", debugLogRegType (sym->regType));
+      debugLog ("  reg name %s,  reg type %s\n", sym->rname, debugLogRegType (sym->regType));
 
-       }
-      else
-       /* for the first run we don't provide */
-       /* registers for true symbols we will */
-       /* see how things go                  */
-       sym->nRegs = 0;
     }
+    else
+      /* for the first run we don't provide */
+      /* registers for true symbols we will */
+      /* see how things go                  */
+      sym->nRegs = 0;
+  }
 
 }
 
 /*-----------------------------------------------------------------*/
 /* freeAllRegs - mark all registers as free                        */
 /*-----------------------------------------------------------------*/
-static void
-freeAllRegs ()
+void
+pic14_freeAllRegs ()
 {
   int i;
 
@@ -1933,6 +1988,21 @@ freeAllRegs ()
     regspic14[i].isFree = 1;
 }
 
+/*-----------------------------------------------------------------*/
+/*-----------------------------------------------------------------*/
+void
+pic14_deallocateAllRegs ()
+{
+  int i;
+
+  debugLog ("%s\n", __FUNCTION__);
+  for (i = 0; i < pic14_nRegs; i++) {
+    regspic14[i].isFree = 1;
+    regspic14[i].wasUsed = 0;
+  }
+}
+
+
 /*-----------------------------------------------------------------*/
 /* deallocStackSpil - this will set the stack pointer back         */
 /*-----------------------------------------------------------------*/
@@ -2033,6 +2103,7 @@ packRegsForAssign (iCode * ic, eBBlock * ebp)
       OP_SYMBOL (IC_RIGHT (ic))->isind ||
       OP_LIVETO (IC_RIGHT (ic)) > ic->seq)
     {
+      debugLog ("  %d - not packing - right side fails \n", __LINE__);
       return 0;
     }
 
@@ -2334,7 +2405,7 @@ packRegsForOneuse (iCode * ic, operand * op, eBBlock * ebp)
 
   /* only upto 2 bytes since we cannot predict
      the usage of b, & acc */
-  if (getSize (operandType (op)) > (fReturnSize - 2) &&
+  if (getSize (operandType (op)) > (fReturnSizePic - 2) &&
       ic->op != RETURN &&
       ic->op != SEND)
     return NULL;
@@ -2619,7 +2690,6 @@ static void
 packForReceive (iCode * ic, eBBlock * ebp)
 {
   iCode *dic;
-  bool can_remove = 1;         // assume that we can remove temporary
 
   debugLog ("%s\n", __FUNCTION__);
   debugAopGet ("  result:", IC_RESULT (ic));
@@ -2737,6 +2807,8 @@ packRegisters (eBBlock * ebp)
          !OP_SYMBOL (IC_LEFT (ic))->onStack)
        {
 
+         debugLog ("  %d - %s. result is rematerializable\n", __LINE__,__FUNCTION__);
+
          OP_SYMBOL (IC_RESULT (ic))->remat = 1;
          OP_SYMBOL (IC_RESULT (ic))->rematiCode = ic;
          OP_SYMBOL (IC_RESULT (ic))->usl.spillLoc = NULL;
@@ -2751,6 +2823,7 @@ packRegisters (eBBlock * ebp)
          OP_SYMBOL (IC_RIGHT (ic))->remat &&
          bitVectnBitsOn (OP_SYMBOL (IC_RESULT (ic))->defs) <= 1)
        {
+         debugLog ("  %d - %s. straight rematerializable\n", __LINE__,__FUNCTION__);
 
          OP_SYMBOL (IC_RESULT (ic))->remat =
            OP_SYMBOL (IC_RIGHT (ic))->remat;
@@ -2767,7 +2840,7 @@ packRegisters (eBBlock * ebp)
           bitVectnBitsOn (OP_DEFS (IC_RESULT (ic))) == 1 &&
           IS_OP_LITERAL (IC_RIGHT (ic))))
        {
-
+         debugLog ("  %d - %s. rematerializable because op is +/-\n", __LINE__,__FUNCTION__);
          //int i = 
          operandLitValue (IC_RIGHT (ic));
          OP_SYMBOL (IC_RESULT (ic))->remat = 1;
@@ -2779,12 +2852,14 @@ packRegisters (eBBlock * ebp)
       if (POINTER_SET (ic))
        {
          OP_SYMBOL (IC_RESULT (ic))->uptr = 1;
-         debugLog ("  marking as a pointer (set)\n");
+         debugLog ("  marking as a pointer (set) =>");
+         debugAopGet ("  result:", IC_RESULT (ic));
        }
       if (POINTER_GET (ic))
        {
          OP_SYMBOL (IC_LEFT (ic))->uptr = 1;
-         debugLog ("  marking as a pointer (get)\n");
+         debugLog ("  marking as a pointer (get) =>");
+         debugAopGet ("  left:", IC_LEFT (ic));
        }
 
       if (!SKIP_IC2 (ic))
@@ -2898,7 +2973,7 @@ packRegisters (eBBlock * ebp)
 
              /* if the type from and type to are the same
                 then if this is the only use then packit */
-             if (checkType (operandType (IC_RIGHT (ic)),
+             if (compareType (operandType (IC_RIGHT (ic)),
                             operandType (IC_LEFT (ic))) == 1)
                {
                  iCode *dic = packRegsForOneuse (ic, IC_RIGHT (ic), ebp);
@@ -3015,7 +3090,7 @@ pic14_assignRegisters (eBBlock ** ebbs, int count)
     packRegisters (ebbs[i]);
 
   if (options.dump_pack)
-    dumpEbbsToFileExt (".dumppack", ebbs, count);
+    dumpEbbsToFileExt (DUMP_PACK, ebbs, count);
 
   /* first determine for each live range the number of 
      registers & the type of registers required for each */
@@ -3047,7 +3122,7 @@ pic14_assignRegisters (eBBlock ** ebbs, int count)
   redoStackOffsets ();
 
   if (options.dump_rassgn)
-    dumpEbbsToFileExt (".dumprassgn", ebbs, count);
+    dumpEbbsToFileExt (DUMP_RASSGN, ebbs, count);
 
   /* now get back the chain */
   ic = iCodeLabelOptimize (iCodeFromeBBlock (ebbs, count));
@@ -3064,7 +3139,7 @@ pic14_assignRegisters (eBBlock ** ebbs, int count)
   setToNull ((void **) &_G.stackSpil);
   setToNull ((void **) &_G.spiltSet);
   /* mark all registers as free */
-  freeAllRegs ();
+  pic14_freeAllRegs ();
 
   debugLog ("leaving\n<><><><><><><><><><><><><><><><><>\n");
   debugLogClose ();