Author: leo
Date: Tue Nov  8 07:42:55 2005
New Revision: 9843

Modified:
   trunk/imcc/debug.c
   trunk/imcc/pbc.c
   trunk/imcc/reg_alloc.c
   trunk/imcc/symreg.h
Log:
reg_alloc - cleanup 2

* remove SymReg.simplified
* rename SymReg.score to .offset reflecting its usage in pbc.c


Modified: trunk/imcc/debug.c
==============================================================================
--- trunk/imcc/debug.c  (original)
+++ trunk/imcc/debug.c  Tue Nov  8 07:42:55 2005
@@ -187,7 +187,7 @@ dump_symreg(IMC_Unit * unit)
     fprintf(stderr,
             "\nSymbols:"
             "\n----------------------------------------------\n");
-    fprintf(stderr, "name\tfirst\tlast\t1.blk\t-blk\tset col     \tscore\t"
+    fprintf(stderr, "name\tfirst\tlast\t1.blk\t-blk\tset col     \t"
             "used\tlhs_use\tregp\tus flgs\n"
             "----------------------------------------------\n");
     for(i = 0; i < unit->n_symbols; i++) {
@@ -196,13 +196,13 @@ dump_symreg(IMC_Unit * unit)
             continue;
         if(!r->first_ins)
             continue;
-        fprintf(stderr, "%s %c\t%d\t%d\t%d\t%d\t%c   %2d 
%2d\t%d\t%d\t%d\t%s\t%x\n",
+        fprintf(stderr, "%s %c\t%d\t%d\t%d\t%d\t%c   %2d 
%2d\t%d\t%d\t%s\t%x\n",
                 r->name,
                 r->usage & U_NON_VOLATILE ? 'P' : ' ',
                    r->first_ins->index, r->last_ins->index,
                    r->first_ins->bbindex, r->last_ins->bbindex,
                    r->set,
-                (int)r->color, r->want_regno, r->score,
+                (int)r->color, r->want_regno,
                 r->use_count, r->lhs_use_count,
                 r->reg ? r->reg->name : "",
                 r->usage
@@ -282,20 +282,18 @@ dump_interference_graph(IMC_Unit * unit)
             "\n-------------------------------\n");
     for (x = 0; x < n_symbols; x++) {
 
-       if (!reglist[x]->first_ins) continue;
+        if (!reglist[x]->first_ins) continue;
 
-       fprintf(stderr, "%s\t -> ", reglist[x]->name);
-       cnt = 0;
+        fprintf(stderr, "%s\t -> ", reglist[x]->name);
+        cnt = 0;
 
         for (y = 0; y < n_symbols; y++) {
 
             if (! ig_test(x, y, n_symbols, interference_graph))
                 continue;
             r = unit->reglist[y];
-            if ( r && !r->simplified) {
-               fprintf(stderr, "%s ", r->name);
-               cnt++;
-            }
+            fprintf(stderr, "%s ", r->name);
+            cnt++;
         }
         fprintf(stderr, "(%d)\n", cnt);
     }

Modified: trunk/imcc/pbc.c
==============================================================================
--- trunk/imcc/pbc.c    (original)
+++ trunk/imcc/pbc.c    Tue Nov  8 07:42:55 2005
@@ -21,9 +21,6 @@
  * So when reading color here it's either a constant table idx
  * or a parrot register number, depending on data type.
  *
- * More weird, in global fixup reg->score is used for the opcode offset
- * into the instruction.
- *
  * TODO memory clean up
  *
  * And finally: there might be some issues on 64bit systems with
@@ -262,7 +259,7 @@ store_bsr(Interp *interpreter, SymReg * 
     if (r->set == 'p')
         bsr->set = 'p';
     bsr->color = pc;
-    bsr->score = offset;        /* bsr = 1, set_addr I,x = 2  */
+    bsr->offset = offset;        /* bsr = 1, set_addr I,x = 2  */
     /* This is hackish but it's better to have it here than in the
      * fixup code until we decide if we need the _globallabel semantic.
      */
@@ -534,7 +531,7 @@ fixup_bsrs(Interp *interpreter)
                                 "couldn't find sub 2 '%s'\n",
                                 bsr->name);
                     }
-                    interpreter->code->base.data[addr+bsr->score] =
+                    interpreter->code->base.data[addr+bsr->offset] =
                         pmc_const;
                     IMCC_debug(interpreter, DEBUG_PBC_FIXUP, "fixup const PMC"
                             " sub '%s' const nr: %d\n", bsr->name,
@@ -551,7 +548,7 @@ fixup_bsrs(Interp *interpreter)
                 /* patch the bsr __ instruction */
                 IMCC_debug(interpreter, DEBUG_PBC_FIXUP, "fixup %s pc %d fix 
%d\n",
                         bsr->name, addr, pc - addr);
-                interpreter->code->base.data[addr+bsr->score] = pc - addr;
+                interpreter->code->base.data[addr+bsr->offset] = pc - addr;
             }
         }
         jumppc += s->size;

Modified: trunk/imcc/reg_alloc.c
==============================================================================
--- trunk/imcc/reg_alloc.c      (original)
+++ trunk/imcc/reg_alloc.c      Tue Nov  8 07:42:55 2005
@@ -137,6 +137,8 @@ imc_reg_alloc(Interp *interpreter, IMC_U
     } while (!IMCC_INFO(interpreter)->dont_optimize &&
             optimize(interpreter, unit));
 
+    if (IMCC_INFO(interpreter)->debug & DEBUG_IMC)
+        dump_symreg(unit);
     rebuild_reglist(interpreter, unit);
     graph_coloring_reg_alloc(interpreter, unit);
 
@@ -661,10 +663,8 @@ try_allocate(Parrot_Interp interpreter, 
                     r->color = color;
 
                     IMCC_debug(interpreter, DEBUG_IMC,
-                            "#[%s] gets color [%d]"
-                            "(score %d)\n",
-                            r->name, color,
-                            r->score);
+                            "#[%s] gets color [%d]\n",
+                            r->name, color);
                     break;
                 }
 

Modified: trunk/imcc/symreg.h
==============================================================================
--- trunk/imcc/symreg.h (original)
+++ trunk/imcc/symreg.h Tue Nov  8 07:42:55 2005
@@ -62,10 +62,9 @@ typedef struct _SymReg {
     int want_regno;         /* wanted register number */
     INTVAL color;            /* Color: parrot register number
                                and parrot const table index of VTCONST */
-    int score;               /* How costly it is to spill this symbol */
+    int offset;              /* used for label fixup */
     int use_count;          /* How often this symbol is used */
     int lhs_use_count;      /* How often this symbol is written to */
-    int simplified;          /* Has it been simplified during the process? */
     Life_range **life_info;  /* Each block has its Life_range status */
     struct _SymReg * next;   /* used in the symbols hash */
     struct _Instruction * first_ins;   /* first and last instruction */

Reply via email to