mirror of
https://github.com/DarkPlacesEngine/gmqcc.git
synced 2025-01-31 03:50:36 +00:00
ir_function.allocated_locals now contains the number of locals a function requires, renamed code.slot to code.local, makes more sense
This commit is contained in:
parent
d69fda7fa1
commit
21b7005541
2 changed files with 8 additions and 4 deletions
8
ir.c
8
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;
|
||||
|
||||
|
|
4
ir.h
4
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;
|
||||
|
||||
|
|
Loading…
Reference in a new issue