From 710f580e1548bd7e69e39d63fd419ecae06a13d7 Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Tue, 25 Dec 2012 21:03:26 +0100 Subject: [PATCH] liferange calc now sets the 'locked' flag on values when reaching a CALL --- ir.c | 23 +++++++++++++++++++---- ir.h | 2 ++ 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/ir.c b/ir.c index 17bf16b..7d35e7f 100644 --- a/ir.c +++ b/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); diff --git a/ir.h b/ir.h index a39efca..e85eb45 100644 --- a/ir.h +++ b/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; -- 2.39.2