mirror of
https://github.com/DarkPlacesEngine/gmqcc.git
synced 2024-11-27 14:12:36 +00:00
ir_values which are members of a vector should know that, so that liferange calc can use the vector rather than the member
This commit is contained in:
parent
9420c01538
commit
fe3b1b2e8d
2 changed files with 10 additions and 1 deletions
10
ir.c
10
ir.c
|
@ -641,6 +641,7 @@ ir_value* ir_value_var(const char *name, int storetype, int vtype)
|
|||
self->members[0] = NULL;
|
||||
self->members[1] = NULL;
|
||||
self->members[2] = NULL;
|
||||
self->memberof = NULL;
|
||||
|
||||
MEM_VECTOR_INIT(self, life);
|
||||
return self;
|
||||
|
@ -684,6 +685,7 @@ ir_value* ir_value_vector_member(ir_value *self, unsigned int member)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
m->memberof = self;
|
||||
return m;
|
||||
}
|
||||
|
||||
|
@ -1824,7 +1826,7 @@ bool ir_function_calculate_liferanges(ir_function *self)
|
|||
ir_block *block = self->blocks[0];
|
||||
for (i = 0; i < block->living_count; ++i) {
|
||||
ir_value *v = block->living[i];
|
||||
if (v->name[0] == '#' || v->name[0] == '%')
|
||||
if (v->memberof || v->store != store_local)
|
||||
continue;
|
||||
if (irwarning(v->context, WARN_USED_UNINITIALIZED,
|
||||
"variable `%s` may be used uninitialized in this function", v->name))
|
||||
|
@ -2086,6 +2088,8 @@ static bool ir_block_life_propagate(ir_block *self, ir_block *prev, bool *change
|
|||
for (p = 0; p < instr->phi_count; ++p)
|
||||
{
|
||||
value = instr->phi[p].value;
|
||||
if (value->memberof)
|
||||
value = value->memberof;
|
||||
if (!ir_block_living_find(self, value, NULL) &&
|
||||
!ir_block_living_add(self, value))
|
||||
{
|
||||
|
@ -2097,6 +2101,8 @@ static bool ir_block_life_propagate(ir_block *self, ir_block *prev, bool *change
|
|||
for (p = 0; p < instr->params_count; ++p)
|
||||
{
|
||||
value = instr->params[p];
|
||||
if (value->memberof)
|
||||
value = value->memberof;
|
||||
if (!ir_block_living_find(self, value, NULL) &&
|
||||
!ir_block_living_add(self, value))
|
||||
{
|
||||
|
@ -2114,6 +2120,8 @@ static bool ir_block_life_propagate(ir_block *self, ir_block *prev, bool *change
|
|||
continue;
|
||||
|
||||
value = instr->_ops[o];
|
||||
if (value->memberof)
|
||||
value = value->memberof;
|
||||
|
||||
/* We only care about locals */
|
||||
/* we also calculate parameter liferanges so that locals
|
||||
|
|
1
ir.h
1
ir.h
|
@ -68,6 +68,7 @@ typedef struct ir_value_s {
|
|||
|
||||
/* for acessing vectors */
|
||||
struct ir_value_s *members[3];
|
||||
struct ir_value_s *memberof;
|
||||
|
||||
/* For the temp allocator */
|
||||
MEM_VECTOR_MAKE(ir_life_entry_t, life);
|
||||
|
|
Loading…
Reference in a new issue