Removing the old LIFE_RANGE_WITHOUT_LAST_READ support

This commit is contained in:
Wolfgang (Blub) Bumiller 2012-08-19 21:00:42 +02:00
parent 211b11f154
commit ede98f5521

80
ir.c
View file

@ -970,13 +970,8 @@ bool ir_values_overlap(const ir_value *a, const ir_value *b)
/* check if the entries overlap, for that, /* check if the entries overlap, for that,
* both must start before the other one ends. * both must start before the other one ends.
*/ */
#if defined(LIFE_RANGE_WITHOUT_LAST_READ)
if (la->start <= lb->end &&
lb->start <= la->end)
#else
if (la->start < lb->end && if (la->start < lb->end &&
lb->start < la->end) lb->start < la->end)
#endif
{ {
return true; return true;
} }
@ -2042,17 +2037,9 @@ static bool ir_block_life_propagate(ir_block *self, ir_block *prev, bool *change
size_t i, o, p; size_t i, o, p;
/* bitmasks which operands are read from or written to */ /* bitmasks which operands are read from or written to */
size_t read, write; size_t read, write;
#if defined(LIFE_RANGE_WITHOUT_LAST_READ)
size_t rd;
new_reads_t new_reads;
#endif
char dbg_ind[16] = { '#', '0' }; char dbg_ind[16] = { '#', '0' };
(void)dbg_ind; (void)dbg_ind;
#if defined(LIFE_RANGE_WITHOUT_LAST_READ)
MEM_VECTOR_INIT(&new_reads, v);
#endif
if (prev) if (prev)
{ {
if (!ir_block_life_prop_previous(self, prev, changed)) if (!ir_block_life_prop_previous(self, prev, changed))
@ -2068,38 +2055,22 @@ static bool ir_block_life_propagate(ir_block *self, ir_block *prev, bool *change
for (p = 0; p < instr->phi_count; ++p) for (p = 0; p < instr->phi_count; ++p)
{ {
value = instr->phi[p].value; value = instr->phi[p].value;
#if ! defined(LIFE_RANGE_WITHOUT_LAST_READ)
if (!ir_block_living_find(self, value, NULL) && if (!ir_block_living_find(self, value, NULL) &&
!ir_block_living_add(self, value)) !ir_block_living_add(self, value))
{ {
goto on_error; return false;
} }
#else
if (!new_reads_t_v_find(&new_reads, value, NULL))
{
if (!new_reads_t_v_add(&new_reads, value))
goto on_error;
}
#endif
} }
/* call params are read operands too */ /* call params are read operands too */
for (p = 0; p < instr->params_count; ++p) for (p = 0; p < instr->params_count; ++p)
{ {
value = instr->params[p]; value = instr->params[p];
#if ! defined(LIFE_RANGE_WITHOUT_LAST_READ)
if (!ir_block_living_find(self, value, NULL) && if (!ir_block_living_find(self, value, NULL) &&
!ir_block_living_add(self, value)) !ir_block_living_add(self, value))
{ {
goto on_error; return false;
} }
#else
if (!new_reads_t_v_find(&new_reads, value, NULL))
{
if (!new_reads_t_v_add(&new_reads, value))
goto on_error;
}
#endif
} }
/* See which operands are read and write operands */ /* See which operands are read and write operands */
@ -2124,20 +2095,11 @@ static bool ir_block_life_propagate(ir_block *self, ir_block *prev, bool *change
/* read operands */ /* read operands */
if (read & (1<<o)) if (read & (1<<o))
{ {
#if ! defined(LIFE_RANGE_WITHOUT_LAST_READ)
if (!ir_block_living_find(self, value, NULL) && if (!ir_block_living_find(self, value, NULL) &&
!ir_block_living_add(self, value)) !ir_block_living_add(self, value))
{ {
goto on_error; return false;
} }
#else
/* fprintf(stderr, "read: %s\n", value->_name); */
if (!new_reads_t_v_find(&new_reads, value, NULL))
{
if (!new_reads_t_v_add(&new_reads, value))
goto on_error;
}
#endif
} }
/* write operands */ /* write operands */
@ -2149,13 +2111,7 @@ static bool ir_block_life_propagate(ir_block *self, ir_block *prev, bool *change
{ {
size_t idx; size_t idx;
bool in_living = ir_block_living_find(self, value, &idx); bool in_living = ir_block_living_find(self, value, &idx);
#if defined(LIFE_RANGE_WITHOUT_LAST_READ)
size_t readidx;
bool in_reads = new_reads_t_v_find(&new_reads, value, &readidx);
if (!in_living && !in_reads)
#else
if (!in_living) if (!in_living)
#endif
{ {
/* If the value isn't alive it hasn't been read before... */ /* If the value isn't alive it hasn't been read before... */
/* TODO: See if the warning can be emitted during parsing or AST processing /* TODO: See if the warning can be emitted during parsing or AST processing
@ -2184,16 +2140,8 @@ static bool ir_block_life_propagate(ir_block *self, ir_block *prev, bool *change
*/ */
*changed = *changed || tempbool; *changed = *changed || tempbool;
/* Then remove */ /* Then remove */
#if ! defined(LIFE_RANGE_WITHOUT_LAST_READ)
if (!ir_block_living_remove(self, idx)) if (!ir_block_living_remove(self, idx))
goto on_error; return false;
#else
if (in_reads)
{
if (!new_reads_t_v_remove(&new_reads, readidx))
goto on_error;
}
#endif
} }
} }
} }
@ -2202,21 +2150,6 @@ static bool ir_block_life_propagate(ir_block *self, ir_block *prev, bool *change
/*fprintf(stderr, "living added values\n");*/ /*fprintf(stderr, "living added values\n");*/
*changed = *changed || tempbool; *changed = *changed || tempbool;
#if defined(LIFE_RANGE_WITHOUT_LAST_READ)
/* new reads: */
for (rd = 0; rd < new_reads.v_count; ++rd)
{
if (!ir_block_living_find(self, new_reads.v[rd], NULL)) {
if (!ir_block_living_add(self, new_reads.v[rd]))
goto on_error;
}
if (!i && !self->entries_count) {
/* fix the top */
*changed = *changed || ir_value_life_merge(new_reads.v[rd], instr->eid);
}
}
MEM_VECTOR_CLEAR(&new_reads, v);
#endif
} }
if (self->run_id == self->owner->run_id) if (self->run_id == self->owner->run_id)
@ -2231,11 +2164,6 @@ static bool ir_block_life_propagate(ir_block *self, ir_block *prev, bool *change
} }
return true; return true;
on_error:
#if defined(LIFE_RANGE_WITHOUT_LAST_READ)
MEM_VECTOR_CLEAR(&new_reads, v);
#endif
return false;
} }
/*********************************************************************** /***********************************************************************