* device/include/pic16/pic18f*.h: add bit aliases in INTCONbits_t
[fw/sdcc] / src / pic16 / ralloc.c
index b61225f3cfed53f94c506d7fdab2bd4c08546826..68a27ed062894f2c264d39946b7165effb45f711 100644 (file)
@@ -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) {
@@ -3806,17 +3800,25 @@ packForPush (iCode * ic, eBBlock * ebp)
 
 
 
-  /* we now we know that it has one & only one def & use
-     and the that the definition is an assignment */
-  IC_LEFT (ic) = IC_RIGHT (dic);
+  /*
+   * The following code causes segfaults, e.g.,
+   *   #2496919 Internal error with pic16 sdcc
+   * and is thus disabled for now.
+   */
+  if (0)
+    {
+      /* we now we know that it has one & only one def & use
+         and the that the definition is an assignment */
+      IC_LEFT (ic) = IC_RIGHT (dic);
 
-  iLine = printILine(dic);
-  debugf("remiCodeFromeBBlock: %s\n", iLine);
-  dbuf_free(iLine);
+      iLine = printILine(dic);
+      debugf("remiCodeFromeBBlock: %s\n", iLine);
+      dbuf_free(iLine);
 
-  remiCodeFromeBBlock (ebp, dic);
-  bitVectUnSetBit(OP_SYMBOL(IC_RESULT(dic))->defs,dic->key);
-  hTabDeleteItem (&iCodehTab, dic->key, dic, DELETE_ITEM, NULL);
+      remiCodeFromeBBlock (ebp, dic);
+      bitVectUnSetBit(OP_SYMBOL(IC_RESULT(dic))->defs,dic->key);
+      hTabDeleteItem (&iCodehTab, dic->key, dic, DELETE_ITEM, NULL);
+    } // if
 }
 
 static void printSymType(char * str, sym_link *sl)
@@ -4068,7 +4070,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) =>");