| ... | ... | @@ -580,6 +580,10 @@ static constexpr IrInstructionId ir_instruction_id(IrInstructionFrameAddress *) |
| 580 | 580 | return IrInstructionIdFrameAddress; |
| 581 | 581 | } |
| 582 | 582 | |
| 583 | static constexpr IrInstructionId ir_instruction_id(IrInstructionHandle *) { |
| 584 | return IrInstructionIdHandle; |
| 585 | } |
| 586 | |
| 583 | 587 | static constexpr IrInstructionId ir_instruction_id(IrInstructionAlignOf *) { |
| 584 | 588 | return IrInstructionIdAlignOf; |
| 585 | 589 | } |
| ... | ... | @@ -2240,6 +2244,17 @@ static IrInstruction *ir_build_frame_address_from(IrBuilder *irb, IrInstruction |
| 2240 | 2244 | return new_instruction; |
| 2241 | 2245 | } |
| 2242 | 2246 | |
| 2247 | static IrInstruction *ir_build_handle(IrBuilder *irb, Scope *scope, AstNode *source_node) { |
| 2248 | IrInstructionHandle *instruction = ir_build_instruction<IrInstructionHandle>(irb, scope, source_node); |
| 2249 | return &instruction->base; |
| 2250 | } |
| 2251 | |
| 2252 | static IrInstruction *ir_build_handle_from(IrBuilder *irb, IrInstruction *old_instruction) { |
| 2253 | IrInstruction *new_instruction = ir_build_handle(irb, old_instruction->scope, old_instruction->source_node); |
| 2254 | ir_link_new_instruction(new_instruction, old_instruction); |
| 2255 | return new_instruction; |
| 2256 | } |
| 2257 | |
| 2243 | 2258 | static IrInstruction *ir_build_overflow_op(IrBuilder *irb, Scope *scope, AstNode *source_node, |
| 2244 | 2259 | IrOverflowOp op, IrInstruction *type_value, IrInstruction *op1, IrInstruction *op2, |
| 2245 | 2260 | IrInstruction *result_ptr, TypeTableEntry *result_ptr_type) |
| ... | ... | @@ -4475,6 +4490,8 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo |
| 4475 | 4490 | return ir_lval_wrap(irb, scope, ir_build_return_address(irb, scope, node), lval); |
| 4476 | 4491 | case BuiltinFnIdFrameAddress: |
| 4477 | 4492 | return ir_lval_wrap(irb, scope, ir_build_frame_address(irb, scope, node), lval); |
| 4493 | case BuiltinFnIdHandle: |
| 4494 | return ir_lval_wrap(irb, scope, ir_build_handle(irb, scope, node), lval); |
| 4478 | 4495 | case BuiltinFnIdAlignOf: |
| 4479 | 4496 | { |
| 4480 | 4497 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); |
| ... | ... | @@ -19007,6 +19024,13 @@ static TypeTableEntry *ir_analyze_instruction_frame_address(IrAnalyze *ira, IrIn |
| 19007 | 19024 | return u8_ptr_const; |
| 19008 | 19025 | } |
| 19009 | 19026 | |
| 19027 | static TypeTableEntry *ir_analyze_instruction_handle(IrAnalyze *ira, IrInstructionHandle *instruction) { |
| 19028 | ir_build_handle_from(&ira->new_irb, &instruction->base); |
| 19029 | |
| 19030 | TypeTableEntry *promise_type = get_promise_type(ira->codegen, nullptr); |
| 19031 | return promise_type; |
| 19032 | } |
| 19033 | |
| 19010 | 19034 | static TypeTableEntry *ir_analyze_instruction_align_of(IrAnalyze *ira, IrInstructionAlignOf *instruction) { |
| 19011 | 19035 | IrInstruction *type_value = instruction->type_value->other; |
| 19012 | 19036 | if (type_is_invalid(type_value->value.type)) |
| ... | ... | @@ -20982,6 +21006,8 @@ static TypeTableEntry *ir_analyze_instruction_nocast(IrAnalyze *ira, IrInstructi |
| 20982 | 21006 | return ir_analyze_instruction_return_address(ira, (IrInstructionReturnAddress *)instruction); |
| 20983 | 21007 | case IrInstructionIdFrameAddress: |
| 20984 | 21008 | return ir_analyze_instruction_frame_address(ira, (IrInstructionFrameAddress *)instruction); |
| 21009 | case IrInstructionIdHandle: |
| 21010 | return ir_analyze_instruction_handle(ira, (IrInstructionHandle *)instruction); |
| 20985 | 21011 | case IrInstructionIdAlignOf: |
| 20986 | 21012 | return ir_analyze_instruction_align_of(ira, (IrInstructionAlignOf *)instruction); |
| 20987 | 21013 | case IrInstructionIdOverflowOp: |
| ... | ... | @@ -21274,6 +21300,7 @@ bool ir_has_side_effects(IrInstruction *instruction) { |
| 21274 | 21300 | case IrInstructionIdAlignOf: |
| 21275 | 21301 | case IrInstructionIdReturnAddress: |
| 21276 | 21302 | case IrInstructionIdFrameAddress: |
| 21303 | case IrInstructionIdHandle: |
| 21277 | 21304 | case IrInstructionIdTestErr: |
| 21278 | 21305 | case IrInstructionIdUnwrapErrCode: |
| 21279 | 21306 | case IrInstructionIdOptionalWrap: |