Reorganize backend code
This commit is contained in:
parent
38e7193b4d
commit
4077ac19d4
@ -23591,11 +23591,13 @@ fn void code_generation(Thread* restrict thread, CodegenOptions options)
|
||||
cfg_build_and_global_schedule(builder, thread, function, (GlobalScheduleOptions) {
|
||||
.dataflow = 1,
|
||||
});
|
||||
auto node_count = thread->buffer.nodes.length;
|
||||
|
||||
auto node_count = thread->buffer.nodes.length;
|
||||
VirtualBuffer(VirtualRegister) virtual_registers = {};
|
||||
auto* virtual_register_map = arena_allocate(thread->arena, u32, round_up_to_next_power_of_2(node_count + 16));
|
||||
{
|
||||
u32 max_ins = 0;
|
||||
u32 virtual_register_count = 1;
|
||||
auto* virtual_register_map = arena_allocate(thread->arena, u32, round_up_to_next_power_of_2( node_count + 16));
|
||||
VirtualBuffer(u32) spills = {};
|
||||
|
||||
for (u32 i = 0; i < builder->basic_blocks.length; i += 1)
|
||||
@ -23660,7 +23662,6 @@ fn void code_generation(Thread* restrict thread, CodegenOptions options)
|
||||
print("Assigning VR{u32} to node #{u32} ({s})\n", virtual_register_id, geti(node_index), node_id_to_string(node->id));
|
||||
}
|
||||
}
|
||||
|
||||
auto ins = (Slice(RegisterMaskIndex)) {
|
||||
.pointer = arena_allocate(thread->arena, RegisterMaskIndex, max_ins),
|
||||
.length = max_ins,
|
||||
@ -23668,7 +23669,6 @@ fn void code_generation(Thread* restrict thread, CodegenOptions options)
|
||||
// TODO: remove?
|
||||
memset(ins.pointer, 0, sizeof(RegisterMaskIndex) * max_ins);
|
||||
|
||||
VirtualBuffer(VirtualRegister) virtual_registers = {};
|
||||
vb_ensure_capacity(&virtual_registers, cast_to(u32, u64, round_up_to_next_power_of_2(virtual_register_count + 16)));
|
||||
virtual_registers.length = virtual_register_count;
|
||||
|
||||
@ -24110,9 +24110,9 @@ fn void code_generation(Thread* restrict thread, CodegenOptions options)
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Basic block scheduling
|
||||
|
||||
for (u32 i = 0; i < builder->basic_blocks.length; i += 1)
|
||||
{
|
||||
auto* basic_block = &builder->basic_blocks.pointer[i];
|
||||
|
Loading…
x
Reference in New Issue
Block a user