Author: kjs
Date: Tue Dec 16 10:21:52 2008
New Revision: 33970
Modified:
trunk/compilers/pirc/new/pircompunit.c
trunk/compilers/pirc/new/piremit.c
trunk/compilers/pirc/new/pirsymbol.c
trunk/compilers/pirc/new/pirsymbol.h
Log:
[pirc] remove field #3 ("color") from symbol/pir_reg.
Modified: trunk/compilers/pirc/new/pircompunit.c
==============================================================================
--- trunk/compilers/pirc/new/pircompunit.c (original)
+++ trunk/compilers/pirc/new/pircompunit.c Tue Dec 16 10:21:52 2008
@@ -2087,7 +2087,7 @@
/* if the target is a register, invoke that. */
if (TEST_FLAG(inv->sub->flags, TARGET_FLAG_IS_REG)) {
- target *sub = new_reg(lexer, PMC_TYPE, inv->sub->s.reg->color);
+ target *sub = new_reg(lexer, PMC_TYPE,
inv->sub->s.reg->info.color);
if (inv->retcc) { /* return continuation present? */
new_sub_instr(lexer, PARROT_OP_invoke_p_p, "invoke_p_p");
add_operands(lexer, "%T%T", inv->sub, inv->retcc);
Modified: trunk/compilers/pirc/new/piremit.c
==============================================================================
--- trunk/compilers/pirc/new/piremit.c (original)
+++ trunk/compilers/pirc/new/piremit.c Tue Dec 16 10:21:52 2008
@@ -97,10 +97,10 @@
if (t->s.reg == NULL)
fprintf(stderr, "reg target has no pir_reg ptr!\n");
- fprintf(out, "%c%d", pir_register_types[t->s.reg->info.type],
t->s.reg->color);
+ fprintf(out, "%c%d", pir_register_types[t->s.reg->info.type],
t->s.reg->info.color);
}
else
- fprintf(out, "%c%d", pir_register_types[t->s.sym->info.type],
t->s.sym->color);
+ fprintf(out, "%c%d", pir_register_types[t->s.sym->info.type],
t->s.sym->info.color);
/* if the target has a key, print that too */
if (t->key)
@@ -432,9 +432,9 @@
static void
emit_pbc_target_arg(lexer_state * const lexer, target * const t) {
if (TEST_FLAG(t->flags, TARGET_FLAG_IS_REG))
- emit_int_arg(lexer->bc, t->s.reg->color);
+ emit_int_arg(lexer->bc, t->s.reg->info.color);
else
- emit_int_arg(lexer->bc, t->s.sym->color);
+ emit_int_arg(lexer->bc, t->s.sym->info.color);
}
/*
Modified: trunk/compilers/pirc/new/pirsymbol.c
==============================================================================
--- trunk/compilers/pirc/new/pirsymbol.c (original)
+++ trunk/compilers/pirc/new/pirsymbol.c Tue Dec 16 10:21:52 2008
@@ -80,12 +80,12 @@
*/
void
assign_vanilla_register(NOTNULL(lexer_state * const lexer), symbol * const
sym) {
- sym->color = next_register(lexer, sym->info.type);
+ sym->info.color = next_register(lexer, sym->info.type);
sym->info.interval = new_live_interval(lexer->lsr, lexer->stmt_counter,
sym->info.type);
/* set the reference of the interval to the symbol's color */
- sym->info.interval->color = &sym->color;
+ sym->info.interval->color = &sym->info.color;
/* mark the interval, so that its register is not reused, if the
:unique_reg
* flag was set.
@@ -170,8 +170,6 @@
/* XXX remove the next 3 statements */
sym->name = name;
- sym->color = NO_REG_ALLOCATED;
-
sym->info.id.name = name;
sym->info.type = type;
sym->info.color = NO_REG_ALLOCATED;
@@ -260,7 +258,7 @@
for (i = 0; i < symbols->size; i++) {
bucket *b = get_bucket(symbols, i);
while (b) {
- if (bucket_symbol(b)->color == NO_REG_ALLOCATED)
+ if (bucket_symbol(b)->info.color == NO_REG_ALLOCATED)
fprintf(stderr, "Warning: in sub '%s': symbol '%s'
declared but not used\n",
subiter->sub_name, bucket_symbol(b)->name);
@@ -298,7 +296,7 @@
symbol *sym = bucket_symbol(buck);
if (STREQ(sym->name, name)) {
- if (sym->color == NO_REG_ALLOCATED) /* no PASM register assigned
yet */
+ if (sym->info.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 */
@@ -335,8 +333,6 @@
pir_reg *r = pir_mem_allocate_zeroed_typed(lexer, pir_reg);
/* XXX remove next 3 statements */
-
- r->color = NO_REG_ALLOCATED;
r->regno = regno;
r->info.type = type;
@@ -408,12 +404,12 @@
/* create a new node representing this PIR register */
reg = new_pir_reg(lexer, type, regno);
/* get a new PASM register for this PIR register. */
- reg->color = pasmregno;
+ reg->info.color = pasmregno;
/* create a new live interval for this symbolic register */
reg->info.interval = new_live_interval(lexer->lsr, lexer->stmt_counter,
type);
/* let the interval have a pointer to this symbolic register */
- reg->info.interval->color = ®->color;
+ reg->info.interval->color = ®->info.color;
/* link this register into the list of "colored" registers; each of
@@ -443,7 +439,7 @@
**/
/* return newly allocated register */
- return reg->color;
+ return reg->info.color;
}
@@ -474,7 +470,7 @@
if (reg) {
/* update end point of interval */
reg->info.interval->endpoint = lexer->stmt_counter;
- return reg->color;
+ return reg->info.color;
}
if (TEST_FLAG(lexer->flags, LEXER_FLAG_PASMFILE)) { /* PASM mode */
Modified: trunk/compilers/pirc/new/pirsymbol.h
==============================================================================
--- trunk/compilers/pirc/new/pirsymbol.h (original)
+++ trunk/compilers/pirc/new/pirsymbol.h Tue Dec 16 10:21:52 2008
@@ -37,8 +37,8 @@
/* structure to represent a declared local variable or parameter */
typedef struct symbol {
syminfo info;
- int color;
/*
+ int color;
pir_type type;
live_interval *interval;
*/
@@ -54,8 +54,8 @@
/* structure to represent a PIR register. */
typedef struct pir_reg {
syminfo info;
- int color;
/*
+ int color;
pir_type type;
live_interval *interval;
*/