mirror of
https://github.com/DarkPlacesEngine/gmqcc.git
synced 2025-03-22 02:31:28 +00:00
liferange calc now sets the 'locked' flag on values when reaching a CALL
This commit is contained in:
parent
35ba2dcaf9
commit
710f580e15
2 changed files with 21 additions and 4 deletions
23
ir.c
23
ir.c
|
@ -987,6 +987,7 @@ ir_value* ir_value_var(const char *name, int storetype, int vtype)
|
|||
self->memberof = NULL;
|
||||
|
||||
self->unique_life = false;
|
||||
self->locked = false;
|
||||
|
||||
self->life = NULL;
|
||||
return self;
|
||||
|
@ -2289,15 +2290,24 @@ static bool ir_block_living_add_instr(ir_block *self, size_t eid)
|
|||
for (i = 0; i != vec_size(self->living); ++i)
|
||||
{
|
||||
tempbool = ir_value_life_merge(self->living[i], eid);
|
||||
/* debug
|
||||
if (tempbool)
|
||||
irerror(self->context, "block_living_add_instr() value instruction added %s: %i", self->living[i]->_name, (int)eid);
|
||||
*/
|
||||
changed = changed || tempbool;
|
||||
}
|
||||
return changed;
|
||||
}
|
||||
|
||||
static bool ir_block_living_lock(ir_block *self)
|
||||
{
|
||||
size_t i;
|
||||
bool changed = false;
|
||||
for (i = 0; i != vec_size(self->living); ++i)
|
||||
{
|
||||
if (!self->living[i]->locked)
|
||||
changed = true;
|
||||
self->living[i]->locked = true;
|
||||
}
|
||||
return changed;
|
||||
}
|
||||
|
||||
static bool ir_block_life_prop_previous(ir_block* self, ir_block *prev, bool *changed)
|
||||
{
|
||||
size_t i;
|
||||
|
@ -2502,6 +2512,11 @@ static bool ir_block_life_propagate(ir_block *self, ir_block *prev, bool *change
|
|||
vec_push(self->living, value->members[mem]);
|
||||
}
|
||||
}
|
||||
/* on a call, all these values must be "locked" */
|
||||
if (instr->opcode >= INSTR_CALL0 && instr->opcode <= INSTR_CALL8) {
|
||||
if (ir_block_living_lock(self))
|
||||
*changed = true;
|
||||
}
|
||||
|
||||
/* (A) */
|
||||
tempbool = ir_block_living_add_instr(self, instr->eid);
|
||||
|
|
2
ir.h
2
ir.h
|
@ -77,6 +77,8 @@ typedef struct ir_value_s {
|
|||
|
||||
/* arrays will never overlap with temps */
|
||||
bool unique_life;
|
||||
/* temps living during a CALL must be locked */
|
||||
bool locked;
|
||||
|
||||
/* For the temp allocator */
|
||||
ir_life_entry_t *life;
|
||||
|
|
Loading…
Reference in a new issue