develooper Front page | perl.cvs.parrot | Postings from December 2008

[svn:parrot] r33894 - trunk/compilers/pirc/new

From:
kjs
Date:
December 14, 2008 09:10
Subject:
[svn:parrot] r33894 - trunk/compilers/pirc/new
Message ID:
20081214171049.E5D1ACBA12@x12.develooper.com
Author: kjs
Date: Sun Dec 14 09:10:49 2008
New Revision: 33894

Modified:
   trunk/compilers/pirc/new/pirsymbol.c
   trunk/compilers/pirc/new/pirsymbol.h

Log:
[pirc] prepare to do clean up some code related to symbol and pir_reg structures. + add a #define for documentation purposes.

Modified: trunk/compilers/pirc/new/pirsymbol.c
==============================================================================
--- trunk/compilers/pirc/new/pirsymbol.c	(original)
+++ trunk/compilers/pirc/new/pirsymbol.c	Sun Dec 14 09:10:49 2008
@@ -48,6 +48,8 @@
 */
 
 
+#define NO_REG_ALLOCATED    -1
+
 /*
 
 =item C<static int
@@ -167,7 +169,7 @@
     symbol *sym = pir_mem_allocate_zeroed_typed(lexer, symbol);
     sym->name   = name;
     sym->type   = type;
-    sym->color  = -1; /* -1 means no PASM reg has been allocated yet for this symbol */
+    sym->color  = NO_REG_ALLOCATED;
 
     sym->next   = NULL;
     return sym;
@@ -253,7 +255,7 @@
         for (i = 0; i < symbols->size; i++) {
             bucket *b = get_bucket(symbols, i);
             while (b) {
-                if (bucket_symbol(b)->color == -1)
+                if (bucket_symbol(b)->color == NO_REG_ALLOCATED)
                     fprintf(stderr, "Warning: in sub '%s': symbol '%s' declared but not used\n",
                                     subiter->sub_name, bucket_symbol(b)->name);
 
@@ -291,7 +293,7 @@
         symbol *sym = bucket_symbol(buck);
 
         if (STREQ(sym->name, name)) {
-            if (sym->color == -1)  /* no PASM register assigned yet */
+            if (sym->color == NO_REG_ALLOCATED)  /* no PASM register assigned yet */
                 /* get a new reg from vanilla reg. allocator */
                 assign_vanilla_register(lexer, sym);
             else  /* update end point of interval */
@@ -328,7 +330,7 @@
     pir_reg *r = pir_mem_allocate_zeroed_typed(lexer, pir_reg);
 
     r->type    = type;
-    r->color   = -1; /* -1 means no PASM register is allocated for this PIR register. */
+    r->color   = NO_REG_ALLOCATED;
 
     r->regno   = regno;
     r->next    = NULL;

Modified: trunk/compilers/pirc/new/pirsymbol.h
==============================================================================
--- trunk/compilers/pirc/new/pirsymbol.h	(original)
+++ trunk/compilers/pirc/new/pirsymbol.h	Sun Dec 14 09:10:49 2008
@@ -20,10 +20,18 @@
 #include "pircompunit.h"
 #include "pirregalloc.h"
 
+/* core info of all symbols and PIR registers ($I42, etc.). */
+typedef struct syminfo {
+    int            color;
+    pir_type       type;
+    live_interval *interval;
+
+} syminfo;
 
 
 /* structure to represent a declared local variable or parameter */
 typedef struct symbol {
+    syminfo        info;
     int            color;
     pir_type       type;
     live_interval *interval;
@@ -38,6 +46,7 @@
 
 /* structure to represent a PIR register. */
 typedef struct pir_reg {
+    syminfo         info;
     int             color;
     pir_type        type;
     live_interval  *interval;



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About