On Tue Jan 24 17:54:14 2023 +0000, Francisco Casas wrote:
In later patches there is the need to insert an intermediate step between allocating register reservations and performing the register allocation perse:
allocate_register_reservations(ctx); request_object_registers_for_allocation(ctx); allocate_temp_registers(ctx, entry_func);
This `request_object_registers_for_allocation()` takes care of setting the count of reserved registers for object arrays. In particular, for sampler arrays, this count is given by the last sampler of the array that is actually used in the shader. So, all these register counts have to be calculated previously to make `get_allocated_object()` simple. Also, I think it is a nice way of taking a little bit of complexity away from `allocate_objects()`.
I still don't understand why there's a need to refactor anything? (And, if we do, it doesn't belong in this patch). What about register allocation can't be done with the loop we have?