Generate only one daglabel for value operands.

As each value is now unique, their labels can also be unique, which will
improve CSE.
This commit is contained in:
Bill Currie 2012-07-19 10:42:05 +09:00
parent 16869cabd1
commit 0c58cd9067
2 changed files with 12 additions and 3 deletions

View file

@ -158,6 +158,7 @@ typedef struct {
typedef struct ex_value_s {
struct ex_value_s *next;
struct daglabel_s *daglabel;///< dag label for this value
etype_t type;
union {
const char *string_val; ///< string constant

View file

@ -89,6 +89,7 @@ operand_label (operand_t *op)
{
operand_t *o;
symbol_t *sym = 0;
ex_value_t *val = 0;
daglabel_t *label;
if (!op)
@ -108,11 +109,18 @@ operand_label (operand_t *op)
label = new_label ();
label->op = op;
sym->daglabel = label;
} else {
if (o->op_type != op_value && o->op_type != op_pointer)
debug (0, "unexpected operand type: %d", o->op_type);
} else if (o->op_type == op_value) {
val = o->o.value;
if (val->daglabel)
return val->daglabel;
label = new_label ();
label->op = op;
val->daglabel = label;
} else if (o->op_type == op_pointer) {
label = new_label ();
label->op = op;
} else {
internal_error (0, "unexpected operand type: %d", o->op_type);
}
return label;
}