remember the maximum amount of required function-locals

This commit is contained in:
Wolfgang Bumiller 2012-12-23 16:31:01 +01:00
parent 7998a98818
commit 88a6437840
2 changed files with 10 additions and 0 deletions

7
ir.c
View file

@ -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
View file

@ -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 */