after a good night sleep, let's try again
authorjohanknol <johanknol@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Wed, 9 Apr 2003 09:04:39 +0000 (09:04 +0000)
committerjohanknol <johanknol@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Wed, 9 Apr 2003 09:04:39 +0000 (09:04 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@2500 4a8a32a2-be11-0410-ad9d-d568d2c75423

src/mcs51/ralloc.c

index 546708caa8b2efa8eea5802f7928382d8e2346ec..6289a4a20fe3f4ba96f6077b4b3112d9f6582c32 100644 (file)
@@ -1107,15 +1107,15 @@ serialRegAssign (eBBlock ** ebbs, int count)
 
        /* of all instructions do */
        for (ic = ebbs[i]->sch; ic; ic = ic->next) {
-#if 0
-           int i;
+#if 1
+           int reg;
 
            // update the registers in use at the start of this icode
-           for (i=0; i<8; i++) {
-             if (regs8051[i].isFree) {
-               ic->riu &= ~(1<<regs8051[i].offset);
+           for (reg=0; reg<mcs51_nRegs; reg++) {
+             if (regs8051[reg].isFree) {
+               ic->riu &= ~(1<<regs8051[reg].offset);
              } else {
-               ic->riu |= (1<<regs8051[i].offset);
+               ic->riu |= (1<<regs8051[reg].offset);
              }
            }
 #endif
@@ -2847,7 +2847,9 @@ mcs51_assignRegisters (eBBlock ** ebbs, int count)
   createRegMask (ebbs, count);
 
   /* redo that offsets for stacked automatic variables */
-  redoStackOffsets ();
+  if (currFunc) {
+    redoStackOffsets ();
+  }
 
   if (options.dump_rassgn)
     {