mirror of
https://github.com/DarkPlacesEngine/gmqcc.git
synced 2025-03-22 02:31:28 +00:00
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
This commit is contained in:
parent
1172e2b8cc
commit
aee7bf0de0
1 changed files with 24 additions and 8 deletions
32
ir.c
32
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];
|
||||
|
|
Loading…
Reference in a new issue