mirror of
https://github.com/DarkPlacesEngine/gmqcc.git
synced 2025-03-22 10:41:43 +00:00
remember the maximum amount of required function-locals
This commit is contained in:
parent
7998a98818
commit
88a6437840
2 changed files with 10 additions and 0 deletions
7
ir.c
7
ir.c
|
@ -285,6 +285,8 @@ ir_builder* ir_builder_new(const char *modulename)
|
|||
self->htfields = util_htnew(IR_HT_SIZE);
|
||||
self->htfunctions = util_htnew(IR_HT_SIZE);
|
||||
|
||||
self->max_locals = 0;
|
||||
|
||||
self->str_immediate = 0;
|
||||
self->name = NULL;
|
||||
if (!ir_builder_set_name(self, modulename)) {
|
||||
|
@ -3477,6 +3479,11 @@ bool ir_builder_generate(ir_builder *self, const char *filename)
|
|||
if (!ir_builder_gen_global(self, self->globals[i], false)) {
|
||||
return false;
|
||||
}
|
||||
if (self->globals[i]->vtype == TYPE_FUNCTION) {
|
||||
ir_function *func = self->globals[i]->constval.vfunc;
|
||||
if (func && self->max_locals < func->allocated_locals)
|
||||
self->max_locals = func->allocated_locals;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < vec_size(self->fields); ++i)
|
||||
|
|
3
ir.h
3
ir.h
|
@ -312,6 +312,9 @@ typedef struct ir_builder_s
|
|||
|
||||
ir_value **extparams;
|
||||
|
||||
/* the highest func->allocated_locals */
|
||||
size_t max_locals;
|
||||
|
||||
const char **filenames;
|
||||
qcint *filestrings;
|
||||
/* we cache the #IMMEDIATE string here */
|
||||
|
|
Loading…
Reference in a new issue