Author: kjs
Date: Tue Dec 16 10:17:06 2008
New Revision: 33968
Modified:
trunk/compilers/pirc/new/pir.y
trunk/compilers/pirc/new/pircompunit.c
trunk/compilers/pirc/new/piremit.c
trunk/compilers/pirc/new/pirparser.c
trunk/compilers/pirc/new/pirsymbol.c
trunk/compilers/pirc/new/pirsymbol.h
Log:
[pirc] remove field #2 ("type") from symbol/pir_reg.
Modified: trunk/compilers/pirc/new/pir.y
==============================================================================
--- trunk/compilers/pirc/new/pir.y (original)
+++ trunk/compilers/pirc/new/pir.y Tue Dec 16 10:17:06 2008
@@ -981,7 +981,7 @@
yypirerror(yyscanner, lexer, "indexed object '%s'
not declared", instr);
sym = new_symbol(lexer, instr, PMC_TYPE);
}
- else if (sym->type != PMC_TYPE)
+ else if (sym->info.type != PMC_TYPE)
/* found symbol, now check it's a PMC */
yypirerror(yyscanner, lexer,
"indexed object '%s' must be of type
'pmc'", instr);
@@ -1029,7 +1029,7 @@
if (TEST_FLAG($1->flags, TARGET_FLAG_IS_REG))
$$ = $1;
else { /* it's not a register, so it must be a
declared symbol */
- if ($1->s.sym->type != PMC_TYPE)
+ if ($1->s.sym->info.type != PMC_TYPE)
yypirerror(yyscanner, lexer,
"indexed object '%s' is not of type
'pmc'",
$1->s.sym->name);
@@ -1174,7 +1174,7 @@
}
else {
/* at this point, sym is not NULL, even if there
was an error */
- if (sym->type != PMC_TYPE)
+ if (sym->info.type != PMC_TYPE)
yypirerror(yyscanner, lexer,
"indexed object '%s' must be of type
'pmc'", $3);
@@ -1195,7 +1195,7 @@
yypirerror(yyscanner, lexer, "indexed object
'%s' not declared", $3);
sym = new_symbol(lexer, $3, PMC_TYPE);
}
- else if (sym->type != PMC_TYPE)
+ else if (sym->info.type != PMC_TYPE)
yypirerror(yyscanner, lexer,
"indexed object '%s' must be of type
'pmc'", $3);
@@ -1297,7 +1297,7 @@
/* create a dummy symbol so we can continue
without seg. faults */
sym = new_symbol(lexer, $1, PMC_TYPE);
}
- else if (sym->type != PMC_TYPE)
+ else if (sym->info.type != PMC_TYPE)
yypirerror(yyscanner, lexer,
"indexed object '%s' must be of type
'pmc'", $1);
/* at this point sym is a valid (possibly dummy)
object for sure */
@@ -1576,7 +1576,7 @@
{ /* if $4 is not a register, it must be a declared
symbol */
if (!TEST_FLAG($4->flags, TARGET_FLAG_IS_REG)) {
- if ($4->s.sym->type != PMC_TYPE) /* a .lex must
be a PMC */
+ if ($4->s.sym->info.type != PMC_TYPE) /* a .lex
must be a PMC */
yypirerror(yyscanner, lexer, "lexical '%s'
must be of type 'pmc'",
$4->s.sym->name);
}
@@ -1697,7 +1697,7 @@
if (sym == NULL)
yypirerror(yyscanner, lexer,
"symbol '%s' was not declared",
$1->s.sym->name);
- else if ($1->s.sym->type != PMC_TYPE)
+ else if ($1->s.sym->info.type != PMC_TYPE)
yypirerror(yyscanner, lexer,
"cannot invoke method: '%s' is
not of type 'pmc'",
$1->s.sym->name);
@@ -1739,8 +1739,8 @@
/* make sure sym is not NULL */
sym = new_symbol(lexer, $1, PMC_TYPE);
}
- else if (sym->type != PMC_TYPE
- && sym->type != STRING_TYPE)
+ else if (sym->info.type != PMC_TYPE
+ && sym->info.type != STRING_TYPE)
yypirerror(yyscanner, lexer,
"method '%s' must be of type 'pmc' or
'string'", $1);
@@ -3300,9 +3300,9 @@
switch (iter->type) {
case EXPR_TARGET:
if (TEST_FLAG(iter->expr.t->flags, TARGET_FLAG_IS_REG))
- *instr_writer++ = type_codes[iter->expr.t->s.reg->type];
+ *instr_writer++ = type_codes[iter->expr.t->s.reg->info.type];
else
- *instr_writer++ = type_codes[iter->expr.t->s.sym->type];
+ *instr_writer++ = type_codes[iter->expr.t->s.sym->info.type];
if (iter->expr.t->key) {
*instr_writer++ = '_';
@@ -3312,9 +3312,9 @@
&&
( (iter->expr.t->key->expr->expr.t->flags &
TARGET_FLAG_IS_REG)
?
- (iter->expr.t->key->expr->expr.t->s.reg->type ==
PMC_TYPE)
+ (iter->expr.t->key->expr->expr.t->s.reg->info.type ==
PMC_TYPE)
:
- (iter->expr.t->key->expr->expr.t->s.sym->type ==
PMC_TYPE)
+ (iter->expr.t->key->expr->expr.t->s.sym->info.type ==
PMC_TYPE)
)
) {
/* the key is a target, and its type is a PMC. In that
case, do not
@@ -3330,9 +3330,9 @@
(
(iter->expr.t->key->expr->expr.t->flags &
TARGET_FLAG_IS_REG)
?
- (iter->expr.t->key->expr->expr.t->s.reg->type ==
INT_TYPE)
+ (iter->expr.t->key->expr->expr.t->s.reg->info.type ==
INT_TYPE)
:
- (iter->expr.t->key->expr->expr.t->s.sym->type ==
INT_TYPE)
+ (iter->expr.t->key->expr->expr.t->s.sym->info.type ==
INT_TYPE)
)
)
Modified: trunk/compilers/pirc/new/pircompunit.c
==============================================================================
--- trunk/compilers/pirc/new/pircompunit.c (original)
+++ trunk/compilers/pirc/new/pircompunit.c Tue Dec 16 10:17:06 2008
@@ -647,12 +647,12 @@
*/
/* :slurpy can only be set on a PMC parameter */
- if (TEST_FLAG(flag, TARGET_FLAG_SLURPY) && param->s.sym->type != PMC_TYPE)
+ if (TEST_FLAG(flag, TARGET_FLAG_SLURPY) && param->s.sym->info.type !=
PMC_TYPE)
yypirerror(lexer->yyscanner, lexer,
"cannot set :slurpy flag on non-pmc %s",
param->s.sym->name);
/* :opt_flag can only be set on a int parameter */
- if (TEST_FLAG(flag, TARGET_FLAG_OPT_FLAG) && param->s.sym->type !=
INT_TYPE)
+ if (TEST_FLAG(flag, TARGET_FLAG_OPT_FLAG) && param->s.sym->info.type !=
INT_TYPE)
yypirerror(lexer->yyscanner, lexer,
"cannot set :opt_flag flag on non-int %s",
param->s.sym->name);
@@ -1862,9 +1862,9 @@
switch (argvalue->type) {
case EXPR_TARGET:
if (TEST_FLAG(argvalue->expr.t->flags, TARGET_FLAG_IS_REG))
- flag |= argvalue->expr.t->s.reg->type;
+ flag |= argvalue->expr.t->s.reg->info.type;
else
- flag |= argvalue->expr.t->s.sym->type;
+ flag |= argvalue->expr.t->s.sym->info.type;
break;
case EXPR_CONSTANT:
flag |= argvalue->expr.c->type;
Modified: trunk/compilers/pirc/new/piremit.c
==============================================================================
--- trunk/compilers/pirc/new/piremit.c (original)
+++ trunk/compilers/pirc/new/piremit.c Tue Dec 16 10:17:06 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->type],
t->s.reg->color);
+ fprintf(out, "%c%d", pir_register_types[t->s.reg->info.type],
t->s.reg->color);
}
else
- fprintf(out, "%c%d", pir_register_types[t->s.sym->type],
t->s.sym->color);
+ fprintf(out, "%c%d", pir_register_types[t->s.sym->info.type],
t->s.sym->color);
/* if the target has a key, print that too */
if (t->key)
Modified: trunk/compilers/pirc/new/pirparser.c
==============================================================================
--- trunk/compilers/pirc/new/pirparser.c (original)
+++ trunk/compilers/pirc/new/pirparser.c Tue Dec 16 10:17:06 2008
@@ -2977,7 +2977,7 @@
yypirerror(yyscanner, lexer, "indexed object '%s'
not declared", instr);
sym = new_symbol(lexer, instr, PMC_TYPE);
}
- else if (sym->type != PMC_TYPE)
+ else if (sym->info.type != PMC_TYPE)
/* found symbol, now check it's a PMC */
yypirerror(yyscanner, lexer,
"indexed object '%s' must be of type
'pmc'", instr);
@@ -3037,7 +3037,7 @@
if (TEST_FLAG((yyvsp[(1) - (2)].targ)->flags,
TARGET_FLAG_IS_REG))
(yyval.targ) = (yyvsp[(1) - (2)].targ);
else { /* it's not a register, so it must be a
declared symbol */
- if ((yyvsp[(1) - (2)].targ)->s.sym->type !=
PMC_TYPE)
+ if ((yyvsp[(1) - (2)].targ)->s.sym->info.type
!= PMC_TYPE)
yypirerror(yyscanner, lexer,
"indexed object '%s' is not of type
'pmc'",
(yyvsp[(1) -
(2)].targ)->s.sym->name);
@@ -3202,7 +3202,7 @@
}
else {
/* at this point, sym is not NULL, even if there
was an error */
- if (sym->type != PMC_TYPE)
+ if (sym->info.type != PMC_TYPE)
yypirerror(yyscanner, lexer,
"indexed object '%s' must be of type
'pmc'", (yyvsp[(3) - (4)].sval));
@@ -3226,7 +3226,7 @@
yypirerror(yyscanner, lexer, "indexed object
'%s' not declared", (yyvsp[(3) - (4)].sval));
sym = new_symbol(lexer, (yyvsp[(3) - (4)].sval),
PMC_TYPE);
}
- else if (sym->type != PMC_TYPE)
+ else if (sym->info.type != PMC_TYPE)
yypirerror(yyscanner, lexer,
"indexed object '%s' must be of type
'pmc'", (yyvsp[(3) - (4)].sval));
@@ -3361,7 +3361,7 @@
/* create a dummy symbol so we can continue
without seg. faults */
sym = new_symbol(lexer, (yyvsp[(1) - (4)].sval),
PMC_TYPE);
}
- else if (sym->type != PMC_TYPE)
+ else if (sym->info.type != PMC_TYPE)
yypirerror(yyscanner, lexer,
"indexed object '%s' must be of type
'pmc'", (yyvsp[(1) - (4)].sval));
/* at this point sym is a valid (possibly dummy)
object for sure */
@@ -3754,7 +3754,7 @@
{ /* if $4 is not a register, it must be a declared symbol */
if (!TEST_FLAG((yyvsp[(4) - (5)].targ)->flags,
TARGET_FLAG_IS_REG)) {
- if ((yyvsp[(4) - (5)].targ)->s.sym->type !=
PMC_TYPE) /* a .lex must be a PMC */
+ if ((yyvsp[(4) - (5)].targ)->s.sym->info.type !=
PMC_TYPE) /* a .lex must be a PMC */
yypirerror(yyscanner, lexer, "lexical '%s'
must be of type 'pmc'",
(yyvsp[(4) -
(5)].targ)->s.sym->name);
}
@@ -3897,7 +3897,7 @@
if (sym == NULL)
yypirerror(yyscanner, lexer,
"symbol '%s' was not declared",
(yyvsp[(1) - (4)].targ)->s.sym->name);
- else if ((yyvsp[(1) - (4)].targ)->s.sym->type
!= PMC_TYPE)
+ else if ((yyvsp[(1) -
(4)].targ)->s.sym->info.type != PMC_TYPE)
yypirerror(yyscanner, lexer,
"cannot invoke method: '%s' is
not of type 'pmc'",
(yyvsp[(1) -
(4)].targ)->s.sym->name);
@@ -3945,8 +3945,8 @@
/* make sure sym is not NULL */
sym = new_symbol(lexer, (yyvsp[(1) -
(1)].sval), PMC_TYPE);
}
- else if (sym->type != PMC_TYPE
- && sym->type != STRING_TYPE)
+ else if (sym->info.type != PMC_TYPE
+ && sym->info.type != STRING_TYPE)
yypirerror(yyscanner, lexer,
"method '%s' must be of type 'pmc' or
'string'", (yyvsp[(1) - (1)].sval));
@@ -5989,9 +5989,9 @@
switch (iter->type) {
case EXPR_TARGET:
if (TEST_FLAG(iter->expr.t->flags, TARGET_FLAG_IS_REG))
- *instr_writer++ = type_codes[iter->expr.t->s.reg->type];
+ *instr_writer++ = type_codes[iter->expr.t->s.reg->info.type];
else
- *instr_writer++ = type_codes[iter->expr.t->s.sym->type];
+ *instr_writer++ = type_codes[iter->expr.t->s.sym->info.type];
if (iter->expr.t->key) {
*instr_writer++ = '_';
@@ -6001,9 +6001,9 @@
&&
( (iter->expr.t->key->expr->expr.t->flags &
TARGET_FLAG_IS_REG)
?
- (iter->expr.t->key->expr->expr.t->s.reg->type ==
PMC_TYPE)
+ (iter->expr.t->key->expr->expr.t->s.reg->info.type ==
PMC_TYPE)
:
- (iter->expr.t->key->expr->expr.t->s.sym->type ==
PMC_TYPE)
+ (iter->expr.t->key->expr->expr.t->s.sym->info.type ==
PMC_TYPE)
)
) {
/* the key is a target, and its type is a PMC. In that
case, do not
@@ -6019,9 +6019,9 @@
(
(iter->expr.t->key->expr->expr.t->flags &
TARGET_FLAG_IS_REG)
?
- (iter->expr.t->key->expr->expr.t->s.reg->type ==
INT_TYPE)
+ (iter->expr.t->key->expr->expr.t->s.reg->info.type ==
INT_TYPE)
:
- (iter->expr.t->key->expr->expr.t->s.sym->type ==
INT_TYPE)
+ (iter->expr.t->key->expr->expr.t->s.sym->info.type ==
INT_TYPE)
)
)
Modified: trunk/compilers/pirc/new/pirsymbol.c
==============================================================================
--- trunk/compilers/pirc/new/pirsymbol.c (original)
+++ trunk/compilers/pirc/new/pirsymbol.c Tue Dec 16 10:17:06 2008
@@ -80,9 +80,9 @@
*/
void
assign_vanilla_register(NOTNULL(lexer_state * const lexer), symbol * const
sym) {
- sym->color = next_register(lexer, sym->type);
+ sym->color = next_register(lexer, sym->info.type);
- sym->info.interval = new_live_interval(lexer->lsr, lexer->stmt_counter,
sym->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;
@@ -169,7 +169,7 @@
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;
@@ -227,7 +227,7 @@
b = new_bucket(lexer);
bucket_symbol(b) = iter;
store_bucket(table, b, hash);
- iter->type = type;
+ iter->info.type = type;
}
@@ -335,7 +335,7 @@
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;
Modified: trunk/compilers/pirc/new/pirsymbol.h
==============================================================================
--- trunk/compilers/pirc/new/pirsymbol.h (original)
+++ trunk/compilers/pirc/new/pirsymbol.h Tue Dec 16 10:17:06 2008
@@ -38,8 +38,9 @@
typedef struct symbol {
syminfo info;
int color;
+ /*
pir_type type;
- /* live_interval *interval;
+ live_interval *interval;
*/
char const *name; /* name of this symbol */
@@ -54,8 +55,9 @@
typedef struct pir_reg {
syminfo info;
int color;
+ /*
pir_type type;
- /* live_interval *interval;
+ live_interval *interval;
*/
int regno; /* symbolic (PIR) register number */