From aee7bf0de07e810deccb43a5cee08c713b9b28e6 Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Tue, 25 Dec 2012 23:51:29 +0100 Subject: [PATCH] Actually generate the vector member ir_values in ir_function_finalize, since ir_builder_gen_global is too late / happens after life ranges; this should fix -Ooverlap-locals --- ir.c | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/ir.c b/ir.c index 0189c2e..6f9e488 100644 --- a/ir.c +++ b/ir.c @@ -736,6 +736,8 @@ bool ir_function_pass_tailrecursion(ir_function *self) bool ir_function_finalize(ir_function *self) { + size_t i; + if (self->builtin) return true; @@ -756,6 +758,27 @@ bool ir_function_finalize(ir_function *self) if (!ir_function_naive_phi(self)) return false; + for (i = 0; i < vec_size(self->locals); ++i) { + ir_value *v = self->locals[i]; + if (v->vtype == TYPE_VECTOR || + (v->vtype == TYPE_FIELD && v->outtype == TYPE_VECTOR)) + { + ir_value_vector_member(v, 0); + ir_value_vector_member(v, 1); + ir_value_vector_member(v, 2); + } + } + for (i = 0; i < vec_size(self->values); ++i) { + ir_value *v = self->values[i]; + if (v->vtype == TYPE_VECTOR || + (v->vtype == TYPE_FIELD && v->outtype == TYPE_VECTOR)) + { + ir_value_vector_member(v, 0); + ir_value_vector_member(v, 1); + ir_value_vector_member(v, 2); + } + } + ir_function_enumerate(self); if (!ir_function_calculate_liferanges(self)) @@ -3301,12 +3324,8 @@ static bool ir_builder_gen_global(ir_builder *self, ir_value *global, bool isloc case TYPE_FIELD: if (pushdef) { vec_push(code_defs, def); - if (global->fieldtype == TYPE_VECTOR) { + if (global->fieldtype == TYPE_VECTOR) gen_vector_defs(def, global->name); - ir_value_vector_member(global, 0); - ir_value_vector_member(global, 1); - ir_value_vector_member(global, 2); - } } return gen_global_field(global); case TYPE_ENTITY: @@ -3342,9 +3361,6 @@ static bool ir_builder_gen_global(ir_builder *self, ir_value *global, bool isloc case TYPE_VECTOR: { size_t d; - ir_value_vector_member(global, 0); - ir_value_vector_member(global, 1); - ir_value_vector_member(global, 2); ir_value_code_setaddr(global, vec_size(code_globals)); if (global->hasvalue) { iptr = (int32_t*)&global->constval.ivec[0]; -- 2.39.2