| ... | @@ -16,6 +16,7 @@ struct IrBuilderSrc { | ... | @@ -16,6 +16,7 @@ struct IrBuilderSrc { |
| 16 | Stage1Zir *exec; | 16 | Stage1Zir *exec; |
| 17 | IrBasicBlockSrc *current_basic_block; | 17 | IrBasicBlockSrc *current_basic_block; |
| 18 | AstNode *main_block_node; | 18 | AstNode *main_block_node; |
| | 19 | size_t next_debug_id; |
| 19 | }; | 20 | }; |
| 20 | | 21 | |
| 21 | static IrInstSrc *ir_gen_node(IrBuilderSrc *irb, AstNode *node, Scope *scope); | 22 | static IrInstSrc *ir_gen_node(IrBuilderSrc *irb, AstNode *node, Scope *scope); |
| ... | @@ -361,9 +362,9 @@ static void ir_instruction_append(IrBasicBlockSrc *basic_block, IrInstSrc *instr | ... | @@ -361,9 +362,9 @@ static void ir_instruction_append(IrBasicBlockSrc *basic_block, IrInstSrc *instr |
| 361 | basic_block->instruction_list.append(instruction); | 362 | basic_block->instruction_list.append(instruction); |
| 362 | } | 363 | } |
| 363 | | 364 | |
| 364 | static size_t exec_next_debug_id(Stage1Zir *exec) { | 365 | static size_t irb_next_debug_id(IrBuilderSrc *irb) { |
| 365 | size_t result = exec->next_debug_id; | 366 | size_t result = irb->next_debug_id; |
| 366 | exec->next_debug_id += 1; | 367 | irb->next_debug_id += 1; |
| 367 | return result; | 368 | return result; |
| 368 | } | 369 | } |
| 369 | | 370 | |
| ... | @@ -393,7 +394,7 @@ static IrBasicBlockSrc *ir_create_basic_block(IrBuilderSrc *irb, Scope *scope, c | ... | @@ -393,7 +394,7 @@ static IrBasicBlockSrc *ir_create_basic_block(IrBuilderSrc *irb, Scope *scope, c |
| 393 | IrBasicBlockSrc *result = heap::c_allocator.create<IrBasicBlockSrc>(); | 394 | IrBasicBlockSrc *result = heap::c_allocator.create<IrBasicBlockSrc>(); |
| 394 | result->scope = scope; | 395 | result->scope = scope; |
| 395 | result->name_hint = name_hint; | 396 | result->name_hint = name_hint; |
| 396 | result->debug_id = exec_next_debug_id(irb->exec); | 397 | result->debug_id = irb_next_debug_id(irb); |
| 397 | result->index = UINT32_MAX; // set later | 398 | result->index = UINT32_MAX; // set later |
| 398 | return result; | 399 | return result; |
| 399 | } | 400 | } |
| ... | @@ -936,7 +937,7 @@ static T *ir_create_instruction(IrBuilderSrc *irb, Scope *scope, AstNode *source | ... | @@ -936,7 +937,7 @@ static T *ir_create_instruction(IrBuilderSrc *irb, Scope *scope, AstNode *source |
| 936 | special_instruction->base.id = ir_inst_id(special_instruction); | 937 | special_instruction->base.id = ir_inst_id(special_instruction); |
| 937 | special_instruction->base.base.scope = scope; | 938 | special_instruction->base.base.scope = scope; |
| 938 | special_instruction->base.base.source_node = source_node; | 939 | special_instruction->base.base.source_node = source_node; |
| 939 | special_instruction->base.base.debug_id = exec_next_debug_id(irb->exec); | 940 | special_instruction->base.base.debug_id = irb_next_debug_id(irb); |
| 940 | special_instruction->base.owner_bb = irb->current_basic_block; | 941 | special_instruction->base.owner_bb = irb->current_basic_block; |
| 941 | return special_instruction; | 942 | return special_instruction; |
| 942 | } | 943 | } |
| ... | @@ -1325,7 +1326,7 @@ static IrInstSrc *ir_build_ptr_type_simple(IrBuilderSrc *irb, Scope *scope, AstN | ... | @@ -1325,7 +1326,7 @@ static IrInstSrc *ir_build_ptr_type_simple(IrBuilderSrc *irb, Scope *scope, AstN |
| 1325 | inst->base.id = is_const ? IrInstSrcIdPtrTypeSimpleConst : IrInstSrcIdPtrTypeSimple; | 1326 | inst->base.id = is_const ? IrInstSrcIdPtrTypeSimpleConst : IrInstSrcIdPtrTypeSimple; |
| 1326 | inst->base.base.scope = scope; | 1327 | inst->base.base.scope = scope; |
| 1327 | inst->base.base.source_node = source_node; | 1328 | inst->base.base.source_node = source_node; |
| 1328 | inst->base.base.debug_id = exec_next_debug_id(irb->exec); | 1329 | inst->base.base.debug_id = irb_next_debug_id(irb); |
| 1329 | inst->base.owner_bb = irb->current_basic_block; | 1330 | inst->base.owner_bb = irb->current_basic_block; |
| 1330 | ir_instruction_append(irb->current_basic_block, &inst->base); | 1331 | ir_instruction_append(irb->current_basic_block, &inst->base); |
| 1331 | | 1332 | |
| ... | @@ -2393,7 +2394,7 @@ static IrInstSrc *ir_build_check_switch_prongs(IrBuilderSrc *irb, Scope *scope, | ... | @@ -2393,7 +2394,7 @@ static IrInstSrc *ir_build_check_switch_prongs(IrBuilderSrc *irb, Scope *scope, |
| 2393 | IrInstSrcIdCheckSwitchProngsUnderYes : IrInstSrcIdCheckSwitchProngsUnderNo; | 2394 | IrInstSrcIdCheckSwitchProngsUnderYes : IrInstSrcIdCheckSwitchProngsUnderNo; |
| 2394 | instruction->base.base.scope = scope; | 2395 | instruction->base.base.scope = scope; |
| 2395 | instruction->base.base.source_node = source_node; | 2396 | instruction->base.base.source_node = source_node; |
| 2396 | instruction->base.base.debug_id = exec_next_debug_id(irb->exec); | 2397 | instruction->base.base.debug_id = irb_next_debug_id(irb); |
| 2397 | instruction->base.owner_bb = irb->current_basic_block; | 2398 | instruction->base.owner_bb = irb->current_basic_block; |
| 2398 | ir_instruction_append(irb->current_basic_block, &instruction->base); | 2399 | ir_instruction_append(irb->current_basic_block, &instruction->base); |
| 2399 | | 2400 | |
| ... | @@ -2586,7 +2587,7 @@ static IrInstSrc *ir_build_arg_type(IrBuilderSrc *irb, Scope *scope, AstNode *so | ... | @@ -2586,7 +2587,7 @@ static IrInstSrc *ir_build_arg_type(IrBuilderSrc *irb, Scope *scope, AstNode *so |
| 2586 | IrInstSrcIdArgTypeAllowVarTrue : IrInstSrcIdArgTypeAllowVarFalse; | 2587 | IrInstSrcIdArgTypeAllowVarTrue : IrInstSrcIdArgTypeAllowVarFalse; |
| 2587 | instruction->base.base.scope = scope; | 2588 | instruction->base.base.scope = scope; |
| 2588 | instruction->base.base.source_node = source_node; | 2589 | instruction->base.base.source_node = source_node; |
| 2589 | instruction->base.base.debug_id = exec_next_debug_id(irb->exec); | 2590 | instruction->base.base.debug_id = irb_next_debug_id(irb); |
| 2590 | instruction->base.owner_bb = irb->current_basic_block; | 2591 | instruction->base.owner_bb = irb->current_basic_block; |
| 2591 | ir_instruction_append(irb->current_basic_block, &instruction->base); | 2592 | ir_instruction_append(irb->current_basic_block, &instruction->base); |
| 2592 | | 2593 | |