Skip to content

Commit

Permalink
[pirc] remove field #3 ("color") from symbol/pir_reg.
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.parrot.org/parrot/trunk@33970 d31e2699-5ff4-0310-a27c-f18f2fbe73fe
  • Loading branch information
kjs committed Dec 16, 2008
1 parent d3cd300 commit f9f13e9
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 19 deletions.
2 changes: 1 addition & 1 deletion compilers/pirc/new/pircompunit.c
Expand Up @@ -2087,7 +2087,7 @@ convert_inv_to_instr(lexer_state * const lexer, invocation * const inv) {

/* 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);
Expand Down
8 changes: 4 additions & 4 deletions compilers/pirc/new/piremit.c
Expand Up @@ -97,10 +97,10 @@ print_target(lexer_state *lexer, target * const t) {
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)
Expand Down Expand Up @@ -432,9 +432,9 @@ respectively.
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);
}

/*
Expand Down
20 changes: 8 additions & 12 deletions compilers/pirc/new/pirsymbol.c
Expand Up @@ -80,12 +80,12 @@ Assign a new register to symbol C<sym>, and create a new live interval for C<sym
*/
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.
Expand Down Expand Up @@ -170,8 +170,6 @@ new_symbol(NOTNULL(lexer_state * const lexer), NOTNULL(char const * const name),
/* 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;
Expand Down Expand Up @@ -260,7 +258,7 @@ check_unused_symbols(NOTNULL(lexer_state * const lexer)) {
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);

Expand Down Expand Up @@ -298,7 +296,7 @@ find_symbol(NOTNULL(lexer_state * const lexer), NOTNULL(char const * const name)
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 */
Expand Down Expand Up @@ -335,8 +333,6 @@ 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->color = NO_REG_ALLOCATED;
r->regno = regno;

r->info.type = type;
Expand Down Expand Up @@ -408,12 +404,12 @@ use_register(NOTNULL(lexer_state * const lexer), pir_type type, int regno, int p
/* 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 = &reg->color;
reg->info.interval->color = &reg->info.color;


/* link this register into the list of "colored" registers; each of
Expand Down Expand Up @@ -443,7 +439,7 @@ use_register(NOTNULL(lexer_state * const lexer), pir_type type, int regno, int p
**/

/* return newly allocated register */
return reg->color;
return reg->info.color;
}


Expand Down Expand Up @@ -474,7 +470,7 @@ color_reg(NOTNULL(lexer_state * const lexer), pir_type type, int regno) {
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 */
Expand Down
4 changes: 2 additions & 2 deletions compilers/pirc/new/pirsymbol.h
Expand Up @@ -37,8 +37,8 @@ typedef struct syminfo {
/* structure to represent a declared local variable or parameter */
typedef struct symbol {
syminfo info;
int color;
/*
int color;
pir_type type;
live_interval *interval;
*/
Expand All @@ -54,8 +54,8 @@ typedef struct symbol {
/* structure to represent a PIR register. */
typedef struct pir_reg {
syminfo info;
int color;
/*
int color;
pir_type type;
live_interval *interval;
*/
Expand Down

0 comments on commit f9f13e9

Please sign in to comment.