Skip to content

Commit

Permalink
[pirc] start duplicating info for symbols/pir_reg; old code will be r…
Browse files Browse the repository at this point in the history
…emoved shortly.

git-svn-id: https://svn.parrot.org/parrot/trunk@33966 d31e2699-5ff4-0310-a27c-f18f2fbe73fe
  • Loading branch information
kjs committed Dec 16, 2008
1 parent 1685e19 commit ce5c5e6
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 7 deletions.
12 changes: 7 additions & 5 deletions compilers/pirc/new/pircompunit.c
Expand Up @@ -444,9 +444,9 @@ targets_equal(target const * const left, target const * const right) {

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 */
Expand All @@ -456,8 +456,8 @@ targets_equal(target const * const left, target const * const right) {
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;
}

Expand Down Expand Up @@ -521,6 +521,8 @@ target_from_symbol(lexer_state * const lexer, symbol * const sym) {
t->s.sym = sym; /* set a pointer from target to symbol */
t->flags = sym->flags; /* copy the flags */

t->info = &sym->info;

return t;
}

Expand Down
2 changes: 1 addition & 1 deletion compilers/pirc/new/pircompunit.h
Expand Up @@ -201,7 +201,7 @@ typedef struct target {
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 */
Expand Down
12 changes: 11 additions & 1 deletion compilers/pirc/new/pirsymbol.c
Expand Up @@ -167,10 +167,15 @@ PARROT_CANNOT_RETURN_NULL
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;
}
Expand Down Expand Up @@ -329,10 +334,15 @@ static pir_reg *
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;
Expand Down

0 comments on commit ce5c5e6

Please sign in to comment.