Author: kjs
Date: Tue Dec 16 09:54:40 2008
New Revision: 33966
Modified:
trunk/compilers/pirc/new/pircompunit.c
trunk/compilers/pirc/new/pircompunit.h
trunk/compilers/pirc/new/pirsymbol.c
Log:
[pirc] start duplicating info for symbols/pir_reg; old code will be removed
shortly.
Modified: trunk/compilers/pirc/new/pircompunit.c
==============================================================================
--- trunk/compilers/pirc/new/pircompunit.c (original)
+++ trunk/compilers/pirc/new/pircompunit.c Tue Dec 16 09:54:40 2008
@@ -444,9 +444,9 @@
if (TEST_FLAG(left->flags, TARGET_FLAG_IS_REG)) { /* if left is a reg
*/
if (TEST_FLAG(right->flags, TARGET_FLAG_IS_REG)) { /* then right must
be a reg */
- if ((left->s.reg->type == right->s.reg->type) /* types must
match */
- && (left->s.reg->regno == right->s.reg->regno /* PIR
regno must match */
- && (left->s.reg->color == right->s.reg->color))) /* PASM regno
must match */
+ if ((left->info->type == right->info->type) /* types must
match */
+ && (left->info->id.regno == right->info->id.regno /* PIR regno
must match */
+ && (left->info->color == right->info->color))) /* PASM regno
must match */
return TRUE;
}
else /* left is a reg, right is not */
@@ -456,8 +456,8 @@
else { /* left is not a reg */
if (!TEST_FLAG(right->flags, TARGET_FLAG_IS_REG) /* right must not be
a reg */
- && (left->s.sym->name && right->s.sym->name /* both must have a
name */
- && STREQ(left->s.sym->name, right->s.sym->name))) /* and they must be
equal */
+ && (left->info->id.name && right->info->id.name /* both must
have a name */
+ && STREQ(left->info->id.name, right->info->id.name))) /* and they must
be equal */
return TRUE;
}
@@ -521,6 +521,8 @@
t->s.sym = sym; /* set a pointer from target to symbol */
t->flags = sym->flags; /* copy the flags */
+ t->info = &sym->info;
+
return t;
}
Modified: trunk/compilers/pirc/new/pircompunit.h
==============================================================================
--- trunk/compilers/pirc/new/pircompunit.h (original)
+++ trunk/compilers/pirc/new/pircompunit.h Tue Dec 16 09:54:40 2008
@@ -201,7 +201,7 @@
struct pir_reg *reg;
} s;
- struct syminfo *syminfo;
+ struct syminfo *info;
target_flag flags; /* flags like :slurpy etc. */
char const *alias; /* if this is a named parameter, this is
the alias */
char const *lex_name; /* if this is a lexical, this field
contains the name */
Modified: trunk/compilers/pirc/new/pirsymbol.c
==============================================================================
--- trunk/compilers/pirc/new/pirsymbol.c (original)
+++ trunk/compilers/pirc/new/pirsymbol.c Tue Dec 16 09:54:40 2008
@@ -167,10 +167,15 @@
symbol *
new_symbol(NOTNULL(lexer_state * const lexer), NOTNULL(char const * const
name), pir_type type) {
symbol *sym = pir_mem_allocate_zeroed_typed(lexer, symbol);
+ /* XXX remove the next 3 statements */
sym->name = name;
sym->type = type;
sym->color = NO_REG_ALLOCATED;
+ sym->info.id.name = name;
+ sym->info.type = type;
+ sym->info.color = NO_REG_ALLOCATED;
+
sym->next = NULL;
return sym;
}
@@ -329,10 +334,15 @@
new_pir_reg(NOTNULL(lexer_state * const lexer), pir_type type, int regno) {
pir_reg *r = pir_mem_allocate_zeroed_typed(lexer, pir_reg);
+ /* XXX remove next 3 statements */
r->type = type;
r->color = NO_REG_ALLOCATED;
-
r->regno = regno;
+
+ r->info.type = type;
+ r->info.color = NO_REG_ALLOCATED;
+ r->info.id.regno = regno;
+
r->next = NULL;
return r;