| ... | @@ -10883,6 +10883,7 @@ static void ir_start_bb(IrAnalyze *ira, IrBasicBlock *old_bb, IrBasicBlock *cons | ... | @@ -10883,6 +10883,7 @@ static void ir_start_bb(IrAnalyze *ira, IrBasicBlock *old_bb, IrBasicBlock *cons |
| 10883 | ira->instruction_index = 0; | 10883 | ira->instruction_index = 0; |
| 10884 | ira->old_irb.current_basic_block = old_bb; | 10884 | ira->old_irb.current_basic_block = old_bb; |
| 10885 | ira->const_predecessor_bb = const_predecessor_bb; | 10885 | ira->const_predecessor_bb = const_predecessor_bb; |
| | 10886 | ira->old_bb_index = old_bb->index; |
| 10886 | } | 10887 | } |
| 10887 | | 10888 | |
| 10888 | static IrInstruction *ira_suspend(IrAnalyze *ira, IrInstruction *old_instruction, IrBasicBlock *next_bb, | 10889 | static IrInstruction *ira_suspend(IrAnalyze *ira, IrInstruction *old_instruction, IrBasicBlock *next_bb, |
| ... | @@ -10894,6 +10895,14 @@ static IrInstruction *ira_suspend(IrAnalyze *ira, IrInstruction *old_instruction | ... | @@ -10894,6 +10895,14 @@ static IrInstruction *ira_suspend(IrAnalyze *ira, IrInstruction *old_instruction |
| 10894 | ira->new_irb.exec->basic_block_list.append(ira->new_irb.current_basic_block); | 10895 | ira->new_irb.exec->basic_block_list.append(ira->new_irb.current_basic_block); |
| 10895 | } | 10896 | } |
| 10896 | | 10897 | |
| | 10898 | //if (ira->codegen->verbose_ir) { |
| | 10899 | // fprintf(stderr, "suspend %s_%zu %s_%zu #%zu (%zu,%zu)\n", ira->old_irb.current_basic_block->name_hint, |
| | 10900 | // ira->old_irb.current_basic_block->debug_id, |
| | 10901 | // ira->old_irb.exec->basic_block_list.at(ira->old_bb_index)->name_hint, |
| | 10902 | // ira->old_irb.exec->basic_block_list.at(ira->old_bb_index)->debug_id, |
| | 10903 | // ira->old_irb.current_basic_block->instruction_list.at(ira->instruction_index)->debug_id, |
| | 10904 | // ira->old_bb_index, ira->instruction_index); |
| | 10905 | //} |
| 10897 | suspend_pos->basic_block_index = ira->old_bb_index; | 10906 | suspend_pos->basic_block_index = ira->old_bb_index; |
| 10898 | suspend_pos->instruction_index = ira->instruction_index; | 10907 | suspend_pos->instruction_index = ira->instruction_index; |
| 10899 | | 10908 | |
| ... | @@ -10914,10 +10923,19 @@ static IrInstruction *ira_suspend(IrAnalyze *ira, IrInstruction *old_instruction | ... | @@ -10914,10 +10923,19 @@ static IrInstruction *ira_suspend(IrAnalyze *ira, IrInstruction *old_instruction |
| 10914 | | 10923 | |
| 10915 | static IrInstruction *ira_resume(IrAnalyze *ira) { | 10924 | static IrInstruction *ira_resume(IrAnalyze *ira) { |
| 10916 | IrSuspendPosition pos = ira->resume_stack.pop(); | 10925 | IrSuspendPosition pos = ira->resume_stack.pop(); |
| | 10926 | //if (ira->codegen->verbose_ir) { |
| | 10927 | // fprintf(stderr, "resume (%zu,%zu) ", pos.basic_block_index, pos.instruction_index); |
| | 10928 | //} |
| 10917 | ira->old_bb_index = pos.basic_block_index; | 10929 | ira->old_bb_index = pos.basic_block_index; |
| 10918 | ira->old_irb.current_basic_block = ira->old_irb.exec->basic_block_list.at(ira->old_bb_index); | 10930 | ira->old_irb.current_basic_block = ira->old_irb.exec->basic_block_list.at(ira->old_bb_index); |
| 10919 | ira->old_irb.current_basic_block->suspended = false; | 10931 | ira->old_irb.current_basic_block->suspended = false; |
| 10920 | ira->instruction_index = pos.instruction_index; | 10932 | ira->instruction_index = pos.instruction_index; |
| | 10933 | assert(pos.instruction_index < ira->old_irb.current_basic_block->instruction_list.length); |
| | 10934 | //if (ira->codegen->verbose_ir) { |
| | 10935 | // fprintf(stderr, "%s_%zu #%zu\n", ira->old_irb.current_basic_block->name_hint, |
| | 10936 | // ira->old_irb.current_basic_block->debug_id, |
| | 10937 | // ira->old_irb.current_basic_block->instruction_list.at(pos.instruction_index)->debug_id); |
| | 10938 | //} |
| 10921 | ira->const_predecessor_bb = nullptr; | 10939 | ira->const_predecessor_bb = nullptr; |
| 10922 | ira->new_irb.current_basic_block = ira->old_irb.current_basic_block->other; | 10940 | ira->new_irb.current_basic_block = ira->old_irb.current_basic_block->other; |
| 10923 | assert(ira->new_irb.current_basic_block != nullptr); | 10941 | assert(ira->new_irb.current_basic_block != nullptr); |
| ... | @@ -24999,6 +25017,9 @@ ZigType *ir_analyze(CodeGen *codegen, IrExecutable *old_exec, IrExecutable *new_ | ... | @@ -24999,6 +25017,9 @@ ZigType *ir_analyze(CodeGen *codegen, IrExecutable *old_exec, IrExecutable *new_ |
| 24999 | continue; | 25017 | continue; |
| 25000 | } | 25018 | } |
| 25001 | | 25019 | |
| | 25020 | //if (ira->codegen->verbose_ir) { |
| | 25021 | // fprintf(stderr, "analyze #%zu\n", old_instruction->debug_id); |
| | 25022 | //} |
| 25002 | IrInstruction *new_instruction = ir_analyze_instruction_base(ira, old_instruction); | 25023 | IrInstruction *new_instruction = ir_analyze_instruction_base(ira, old_instruction); |
| 25003 | if (new_instruction != nullptr) { | 25024 | if (new_instruction != nullptr) { |
| 25004 | ir_assert(new_instruction->value.type != nullptr || new_instruction->value.type != nullptr, old_instruction); | 25025 | ir_assert(new_instruction->value.type != nullptr || new_instruction->value.type != nullptr, old_instruction); |