From: Wolfgang (Blub) Bumiller Date: Mon, 25 Jun 2012 15:43:10 +0000 (+0200) Subject: ir_function.allocated_locals now contains the number of locals a function requires... X-Git-Tag: 0.1-rc1~475 X-Git-Url: https://git.xonotic.org/?p=xonotic%2Fgmqcc.git;a=commitdiff_plain;h=21b70055415a67d80494fecbad900060af09e5aa ir_function.allocated_locals now contains the number of locals a function requires, renamed code.slot to code.local, makes more sense --- diff --git a/ir.c b/ir.c index f8804d7..ccf9da5 100644 --- a/ir.c +++ b/ir.c @@ -1581,11 +1581,11 @@ bool ir_function_allocate_locals(ir_function *self) if (v->vtype == TYPE_VECTOR || v->vtype == TYPE_VARIANT) alloc.sizes[a] = 3; - self->values[i]->code.slot = a; + self->values[i]->code.local = a; break; } if (a >= alloc.locals_count) { - self->values[i]->code.slot = alloc.locals_count; + self->values[i]->code.local = alloc.locals_count; if (!function_allocator_alloc(&alloc, v)) goto error; } @@ -1602,9 +1602,11 @@ bool ir_function_allocate_locals(ir_function *self) goto error; } + self->allocated_locals = pos + alloc.sizes[alloc.sizes_count-1]; + /* Take over the actual slot positions */ for (i = 0; i < self->values_count; ++i) - self->values[i]->code.slot = alloc.positions[self->values[i]->code.slot]; + self->values[i]->code.local = alloc.positions[self->values[i]->code.local]; goto cleanup; diff --git a/ir.h b/ir.h index 3cb045c..a611dba 100644 --- a/ir.h +++ b/ir.h @@ -59,7 +59,7 @@ typedef struct ir_value_s { int32_t globaladdr; int32_t name; /* filled by the local-allocator */ - int32_t slot; + int32_t local; } code; /* For the temp allocator */ @@ -222,6 +222,8 @@ typedef struct ir_function_s /* locally defined variables */ MEM_VECTOR_MAKE(ir_value*, locals); + size_t allocated_locals; + ir_block* first; ir_block* last;