| ... | ... | @@ -391,6 +391,10 @@ static constexpr IrInstructionId ir_instruction_id(IrInstructionMemberCount *) { |
| 391 | 391 | return IrInstructionIdMemberCount; |
| 392 | 392 | } |
| 393 | 393 | |
| 394 | static constexpr IrInstructionId ir_instruction_id(IrInstructionBreakpoint *) { |
| 395 | return IrInstructionIdBreakpoint; |
| 396 | } |
| 397 | |
| 394 | 398 | template<typename T> |
| 395 | 399 | static T *ir_create_instruction(IrExecutable *exec, Scope *scope, AstNode *source_node) { |
| 396 | 400 | T *special_instruction = allocate<T>(1); |
| ... | ... | @@ -1609,6 +1613,17 @@ static IrInstruction *ir_build_member_count(IrBuilder *irb, Scope *scope, AstNod |
| 1609 | 1613 | return &instruction->base; |
| 1610 | 1614 | } |
| 1611 | 1615 | |
| 1616 | static IrInstruction *ir_build_breakpoint(IrBuilder *irb, Scope *scope, AstNode *source_node) { |
| 1617 | IrInstructionBreakpoint *instruction = ir_build_instruction<IrInstructionBreakpoint>(irb, scope, source_node); |
| 1618 | return &instruction->base; |
| 1619 | } |
| 1620 | |
| 1621 | static IrInstruction *ir_build_breakpoint_from(IrBuilder *irb, IrInstruction *old_instruction) { |
| 1622 | IrInstruction *new_instruction = ir_build_breakpoint(irb, old_instruction->scope, old_instruction->source_node); |
| 1623 | ir_link_new_instruction(new_instruction, old_instruction); |
| 1624 | return new_instruction; |
| 1625 | } |
| 1626 | |
| 1612 | 1627 | static void ir_gen_defers_for_block(IrBuilder *irb, Scope *inner_scope, Scope *outer_scope, |
| 1613 | 1628 | bool gen_error_defers, bool gen_maybe_defers) |
| 1614 | 1629 | { |
| ... | ... | @@ -2491,12 +2506,13 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo |
| 2491 | 2506 | |
| 2492 | 2507 | return ir_build_member_count(irb, scope, node, arg0_value); |
| 2493 | 2508 | } |
| 2509 | case BuiltinFnIdBreakpoint: |
| 2510 | return ir_build_breakpoint(irb, scope, node); |
| 2494 | 2511 | case BuiltinFnIdAlignof: |
| 2495 | 2512 | case BuiltinFnIdAddWithOverflow: |
| 2496 | 2513 | case BuiltinFnIdSubWithOverflow: |
| 2497 | 2514 | case BuiltinFnIdMulWithOverflow: |
| 2498 | 2515 | case BuiltinFnIdShlWithOverflow: |
| 2499 | | case BuiltinFnIdBreakpoint: |
| 2500 | 2516 | case BuiltinFnIdReturnAddress: |
| 2501 | 2517 | case BuiltinFnIdFrameAddress: |
| 2502 | 2518 | zig_panic("TODO IR gen more builtin functions"); |
| ... | ... | @@ -8456,6 +8472,11 @@ static TypeTableEntry *ir_analyze_instruction_member_count(IrAnalyze *ira, IrIns |
| 8456 | 8472 | return ira->codegen->builtin_types.entry_num_lit_int; |
| 8457 | 8473 | } |
| 8458 | 8474 | |
| 8475 | static TypeTableEntry *ir_analyze_instruction_breakpoint(IrAnalyze *ira, IrInstructionBreakpoint *instruction) { |
| 8476 | ir_build_breakpoint_from(&ira->new_irb, &instruction->base); |
| 8477 | return ira->codegen->builtin_types.entry_void; |
| 8478 | } |
| 8479 | |
| 8459 | 8480 | static TypeTableEntry *ir_analyze_instruction_nocast(IrAnalyze *ira, IrInstruction *instruction) { |
| 8460 | 8481 | switch (instruction->id) { |
| 8461 | 8482 | case IrInstructionIdInvalid: |
| ... | ... | @@ -8580,6 +8601,8 @@ static TypeTableEntry *ir_analyze_instruction_nocast(IrAnalyze *ira, IrInstructi |
| 8580 | 8601 | return ir_analyze_instruction_slice(ira, (IrInstructionSlice *)instruction); |
| 8581 | 8602 | case IrInstructionIdMemberCount: |
| 8582 | 8603 | return ir_analyze_instruction_member_count(ira, (IrInstructionMemberCount *)instruction); |
| 8604 | case IrInstructionIdBreakpoint: |
| 8605 | return ir_analyze_instruction_breakpoint(ira, (IrInstructionBreakpoint *)instruction); |
| 8583 | 8606 | case IrInstructionIdCast: |
| 8584 | 8607 | case IrInstructionIdStructFieldPtr: |
| 8585 | 8608 | case IrInstructionIdEnumFieldPtr: |
| ... | ... | @@ -8683,6 +8706,7 @@ bool ir_has_side_effects(IrInstruction *instruction) { |
| 8683 | 8706 | case IrInstructionIdFence: |
| 8684 | 8707 | case IrInstructionIdMemset: |
| 8685 | 8708 | case IrInstructionIdMemcpy: |
| 8709 | case IrInstructionIdBreakpoint: |
| 8686 | 8710 | return true; |
| 8687 | 8711 | case IrInstructionIdPhi: |
| 8688 | 8712 | case IrInstructionIdUnOp: |
| ... | ... | @@ -8787,9 +8811,6 @@ bool ir_has_side_effects(IrInstruction *instruction) { |
| 8787 | 8811 | // align_in_bytes, false); |
| 8788 | 8812 | // } |
| 8789 | 8813 | // } |
| 8790 | | // case BuiltinFnIdBreakpoint: |
| 8791 | | // mark_impure_fn(g, context, node); |
| 8792 | | // return g->builtin_types.entry_void; |
| 8793 | 8814 | // case BuiltinFnIdReturnAddress: |
| 8794 | 8815 | // case BuiltinFnIdFrameAddress: |
| 8795 | 8816 | // mark_impure_fn(g, context, node); |
| ... | ... | @@ -9035,8 +9056,6 @@ bool ir_has_side_effects(IrInstruction *instruction) { |
| 9035 | 9056 | // zig_unreachable(); |
| 9036 | 9057 | // case BuiltinFnIdCompileVar: |
| 9037 | 9058 | // return nullptr; |
| 9038 | | // case BuiltinFnIdBreakpoint: |
| 9039 | | // return LLVMBuildCall(g->builder, g->trap_fn_val, nullptr, 0, ""); |
| 9040 | 9059 | // case BuiltinFnIdFrameAddress: |
| 9041 | 9060 | // case BuiltinFnIdReturnAddress: |
| 9042 | 9061 | // { |