From 07fe60ded1727d528d3ae36b892aa7c84262ed96 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Thu, 6 Oct 2016 01:09:01 -0400 Subject: IR in 2 passes --- src/codegen.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'src/codegen.cpp') diff --git a/src/codegen.cpp b/src/codegen.cpp index 2cf56169a6..fdf41415ae 100644 --- a/src/codegen.cpp +++ b/src/codegen.cpp @@ -2921,13 +2921,12 @@ static LLVMValueRef ir_render_instruction(CodeGen *g, IrExecutable *executable, static void ir_render(CodeGen *g, FnTableEntry *fn_entry) { assert(fn_entry); - IrExecutable *executable = &fn_entry->ir_executable; - assert(executable->basic_block_count > 0); - for (size_t i = 0; i < executable->basic_block_count; i += 1) { - IrBasicBlock *current_block = executable->basic_block_list[i]; - for (IrInstruction *instruction = current_block->first; instruction != nullptr; - instruction = instruction->next) - { + IrExecutable *executable = &fn_entry->analyzed_executable; + assert(executable->basic_block_list.length > 0); + for (size_t block_i = 0; block_i < executable->basic_block_list.length; block_i += 1) { + IrBasicBlock *current_block = executable->basic_block_list.at(block_i); + for (size_t instr_i = 0; instr_i < current_block->instruction_list.length; instr_i += 1) { + IrInstruction *instruction = current_block->instruction_list.at(instr_i); instruction->llvm_value = ir_render_instruction(g, executable, instruction); } } -- cgit v1.2.3