| ... | @@ -111,6 +111,7 @@ static IrInstruction *ir_analyze_container_field_ptr(IrAnalyze *ira, Buf *field_ | ... | @@ -111,6 +111,7 @@ static IrInstruction *ir_analyze_container_field_ptr(IrAnalyze *ira, Buf *field_ |
| 111 | static IrInstruction *ir_get_var_ptr(IrAnalyze *ira, IrInstruction *instruction, | 111 | static IrInstruction *ir_get_var_ptr(IrAnalyze *ira, IrInstruction *instruction, |
| 112 | VariableTableEntry *var, bool is_const_ptr, bool is_volatile_ptr); | 112 | VariableTableEntry *var, bool is_const_ptr, bool is_volatile_ptr); |
| 113 | static TypeTableEntry *ir_resolve_atomic_operand_type(IrAnalyze *ira, IrInstruction *op); | 113 | static TypeTableEntry *ir_resolve_atomic_operand_type(IrAnalyze *ira, IrInstruction *op); |
| | 114 | static IrInstruction *ir_lval_wrap(IrBuilder *irb, Scope *scope, IrInstruction *value, LVal lval); |
| 114 | | 115 | |
| 115 | ConstExprValue *const_ptr_pointee(CodeGen *g, ConstExprValue *const_val) { | 116 | ConstExprValue *const_ptr_pointee(CodeGen *g, ConstExprValue *const_val) { |
| 116 | assert(const_val->type->id == TypeTableEntryIdPointer); | 117 | assert(const_val->type->id == TypeTableEntryIdPointer); |
| ... | @@ -1033,12 +1034,27 @@ static IrInstruction *ir_build_elem_ptr_from(IrBuilder *irb, IrInstruction *old_ | ... | @@ -1033,12 +1034,27 @@ static IrInstruction *ir_build_elem_ptr_from(IrBuilder *irb, IrInstruction *old_ |
| 1033 | return new_instruction; | 1034 | return new_instruction; |
| 1034 | } | 1035 | } |
| 1035 | | 1036 | |
| | 1037 | static IrInstruction *ir_build_field_ptr_instruction(IrBuilder *irb, Scope *scope, AstNode *source_node, |
| | 1038 | IrInstruction *container_ptr, IrInstruction *field_name_expr) |
| | 1039 | { |
| | 1040 | IrInstructionFieldPtr *instruction = ir_build_instruction<IrInstructionFieldPtr>(irb, scope, source_node); |
| | 1041 | instruction->container_ptr = container_ptr; |
| | 1042 | instruction->field_name_buffer = nullptr; |
| | 1043 | instruction->field_name_expr = field_name_expr; |
| | 1044 | |
| | 1045 | ir_ref_instruction(container_ptr, irb->current_basic_block); |
| | 1046 | ir_ref_instruction(field_name_expr, irb->current_basic_block); |
| | 1047 | |
| | 1048 | return &instruction->base; |
| | 1049 | } |
| | 1050 | |
| 1036 | static IrInstruction *ir_build_field_ptr(IrBuilder *irb, Scope *scope, AstNode *source_node, | 1051 | static IrInstruction *ir_build_field_ptr(IrBuilder *irb, Scope *scope, AstNode *source_node, |
| 1037 | IrInstruction *container_ptr, Buf *field_name) | 1052 | IrInstruction *container_ptr, Buf *field_name) |
| 1038 | { | 1053 | { |
| 1039 | IrInstructionFieldPtr *instruction = ir_build_instruction<IrInstructionFieldPtr>(irb, scope, source_node); | 1054 | IrInstructionFieldPtr *instruction = ir_build_instruction<IrInstructionFieldPtr>(irb, scope, source_node); |
| 1040 | instruction->container_ptr = container_ptr; | 1055 | instruction->container_ptr = container_ptr; |
| 1041 | instruction->field_name = field_name; | 1056 | instruction->field_name_buffer = field_name; |
| | 1057 | instruction->field_name_expr = nullptr; |
| 1042 | | 1058 | |
| 1043 | ir_ref_instruction(container_ptr, irb->current_basic_block); | 1059 | ir_ref_instruction(container_ptr, irb->current_basic_block); |
| 1044 | | 1060 | |
| ... | @@ -3524,7 +3540,7 @@ static IrInstruction *ir_gen_array_access(IrBuilder *irb, Scope *scope, AstNode | ... | @@ -3524,7 +3540,7 @@ static IrInstruction *ir_gen_array_access(IrBuilder *irb, Scope *scope, AstNode |
| 3524 | return ir_build_load_ptr(irb, scope, node, ptr_instruction); | 3540 | return ir_build_load_ptr(irb, scope, node, ptr_instruction); |
| 3525 | } | 3541 | } |
| 3526 | | 3542 | |
| 3527 | static IrInstruction *ir_gen_field_access(IrBuilder *irb, Scope *scope, AstNode *node, LVal lval) { | 3543 | static IrInstruction *ir_gen_field_access(IrBuilder *irb, Scope *scope, AstNode *node) { |
| 3528 | assert(node->type == NodeTypeFieldAccessExpr); | 3544 | assert(node->type == NodeTypeFieldAccessExpr); |
| 3529 | | 3545 | |
| 3530 | AstNode *container_ref_node = node->data.field_access_expr.struct_expr; | 3546 | AstNode *container_ref_node = node->data.field_access_expr.struct_expr; |
| ... | @@ -3534,11 +3550,7 @@ static IrInstruction *ir_gen_field_access(IrBuilder *irb, Scope *scope, AstNode | ... | @@ -3534,11 +3550,7 @@ static IrInstruction *ir_gen_field_access(IrBuilder *irb, Scope *scope, AstNode |
| 3534 | if (container_ref_instruction == irb->codegen->invalid_instruction) | 3550 | if (container_ref_instruction == irb->codegen->invalid_instruction) |
| 3535 | return container_ref_instruction; | 3551 | return container_ref_instruction; |
| 3536 | | 3552 | |
| 3537 | IrInstruction *ptr_instruction = ir_build_field_ptr(irb, scope, node, container_ref_instruction, field_name); | 3553 | return ir_build_field_ptr(irb, scope, node, container_ref_instruction, field_name); |
| 3538 | if (lval.is_ptr) | | |
| 3539 | return ptr_instruction; | | |
| 3540 | | | |
| 3541 | return ir_build_load_ptr(irb, scope, node, ptr_instruction); | | |
| 3542 | } | 3554 | } |
| 3543 | | 3555 | |
| 3544 | static IrInstruction *ir_gen_overflow_op(IrBuilder *irb, Scope *scope, AstNode *node, IrOverflowOp op) { | 3556 | static IrInstruction *ir_gen_overflow_op(IrBuilder *irb, Scope *scope, AstNode *node, IrOverflowOp op) { |
| ... | @@ -3569,7 +3581,7 @@ static IrInstruction *ir_gen_overflow_op(IrBuilder *irb, Scope *scope, AstNode * | ... | @@ -3569,7 +3581,7 @@ static IrInstruction *ir_gen_overflow_op(IrBuilder *irb, Scope *scope, AstNode * |
| 3569 | return ir_build_overflow_op(irb, scope, node, op, type_value, op1, op2, result_ptr, nullptr); | 3581 | return ir_build_overflow_op(irb, scope, node, op, type_value, op1, op2, result_ptr, nullptr); |
| 3570 | } | 3582 | } |
| 3571 | | 3583 | |
| 3572 | static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNode *node) { | 3584 | static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNode *node, LVal lval) { |
| 3573 | assert(node->type == NodeTypeFnCallExpr); | 3585 | assert(node->type == NodeTypeFnCallExpr); |
| 3574 | | 3586 | |
| 3575 | AstNode *fn_ref_expr = node->data.fn_call_expr.fn_ref_expr; | 3587 | AstNode *fn_ref_expr = node->data.fn_call_expr.fn_ref_expr; |
| ... | @@ -3601,7 +3613,9 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo | ... | @@ -3601,7 +3613,9 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo |
| 3601 | IrInstruction *arg = ir_gen_node(irb, arg_node, scope); | 3613 | IrInstruction *arg = ir_gen_node(irb, arg_node, scope); |
| 3602 | if (arg == irb->codegen->invalid_instruction) | 3614 | if (arg == irb->codegen->invalid_instruction) |
| 3603 | return arg; | 3615 | return arg; |
| 3604 | return ir_build_typeof(irb, scope, node, arg); | 3616 | |
| | 3617 | IrInstruction *type_of = ir_build_typeof(irb, scope, node, arg); |
| | 3618 | return ir_lval_wrap(irb, scope, type_of, lval); |
| 3605 | } | 3619 | } |
| 3606 | case BuiltinFnIdSetCold: | 3620 | case BuiltinFnIdSetCold: |
| 3607 | { | 3621 | { |
| ... | @@ -3610,7 +3624,8 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo | ... | @@ -3610,7 +3624,8 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo |
| 3610 | if (arg0_value == irb->codegen->invalid_instruction) | 3624 | if (arg0_value == irb->codegen->invalid_instruction) |
| 3611 | return arg0_value; | 3625 | return arg0_value; |
| 3612 | | 3626 | |
| 3613 | return ir_build_set_cold(irb, scope, node, arg0_value); | 3627 | IrInstruction *set_cold = ir_build_set_cold(irb, scope, node, arg0_value); |
| | 3628 | return ir_lval_wrap(irb, scope, set_cold, lval); |
| 3614 | } | 3629 | } |
| 3615 | case BuiltinFnIdSetRuntimeSafety: | 3630 | case BuiltinFnIdSetRuntimeSafety: |
| 3616 | { | 3631 | { |
| ... | @@ -3619,7 +3634,8 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo | ... | @@ -3619,7 +3634,8 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo |
| 3619 | if (arg0_value == irb->codegen->invalid_instruction) | 3634 | if (arg0_value == irb->codegen->invalid_instruction) |
| 3620 | return arg0_value; | 3635 | return arg0_value; |
| 3621 | | 3636 | |
| 3622 | return ir_build_set_runtime_safety(irb, scope, node, arg0_value); | 3637 | IrInstruction *set_safety = ir_build_set_runtime_safety(irb, scope, node, arg0_value); |
| | 3638 | return ir_lval_wrap(irb, scope, set_safety, lval); |
| 3623 | } | 3639 | } |
| 3624 | case BuiltinFnIdSetFloatMode: | 3640 | case BuiltinFnIdSetFloatMode: |
| 3625 | { | 3641 | { |
| ... | @@ -3633,7 +3649,8 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo | ... | @@ -3633,7 +3649,8 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo |
| 3633 | if (arg1_value == irb->codegen->invalid_instruction) | 3649 | if (arg1_value == irb->codegen->invalid_instruction) |
| 3634 | return arg1_value; | 3650 | return arg1_value; |
| 3635 | | 3651 | |
| 3636 | return ir_build_set_float_mode(irb, scope, node, arg0_value, arg1_value); | 3652 | IrInstruction *set_float_mode = ir_build_set_float_mode(irb, scope, node, arg0_value, arg1_value); |
| | 3653 | return ir_lval_wrap(irb, scope, set_float_mode, lval); |
| 3637 | } | 3654 | } |
| 3638 | case BuiltinFnIdSizeof: | 3655 | case BuiltinFnIdSizeof: |
| 3639 | { | 3656 | { |
| ... | @@ -3642,7 +3659,8 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo | ... | @@ -3642,7 +3659,8 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo |
| 3642 | if (arg0_value == irb->codegen->invalid_instruction) | 3659 | if (arg0_value == irb->codegen->invalid_instruction) |
| 3643 | return arg0_value; | 3660 | return arg0_value; |
| 3644 | | 3661 | |
| 3645 | return ir_build_size_of(irb, scope, node, arg0_value); | 3662 | IrInstruction *size_of = ir_build_size_of(irb, scope, node, arg0_value); |
| | 3663 | return ir_lval_wrap(irb, scope, size_of, lval); |
| 3646 | } | 3664 | } |
| 3647 | case BuiltinFnIdCtz: | 3665 | case BuiltinFnIdCtz: |
| 3648 | { | 3666 | { |
| ... | @@ -3651,7 +3669,8 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo | ... | @@ -3651,7 +3669,8 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo |
| 3651 | if (arg0_value == irb->codegen->invalid_instruction) | 3669 | if (arg0_value == irb->codegen->invalid_instruction) |
| 3652 | return arg0_value; | 3670 | return arg0_value; |
| 3653 | | 3671 | |
| 3654 | return ir_build_ctz(irb, scope, node, arg0_value); | 3672 | IrInstruction *ctz = ir_build_ctz(irb, scope, node, arg0_value); |
| | 3673 | return ir_lval_wrap(irb, scope, ctz, lval); |
| 3655 | } | 3674 | } |
| 3656 | case BuiltinFnIdClz: | 3675 | case BuiltinFnIdClz: |
| 3657 | { | 3676 | { |
| ... | @@ -3660,7 +3679,8 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo | ... | @@ -3660,7 +3679,8 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo |
| 3660 | if (arg0_value == irb->codegen->invalid_instruction) | 3679 | if (arg0_value == irb->codegen->invalid_instruction) |
| 3661 | return arg0_value; | 3680 | return arg0_value; |
| 3662 | | 3681 | |
| 3663 | return ir_build_clz(irb, scope, node, arg0_value); | 3682 | IrInstruction *clz = ir_build_clz(irb, scope, node, arg0_value); |
| | 3683 | return ir_lval_wrap(irb, scope, clz, lval); |
| 3664 | } | 3684 | } |
| 3665 | case BuiltinFnIdImport: | 3685 | case BuiltinFnIdImport: |
| 3666 | { | 3686 | { |
| ... | @@ -3669,11 +3689,13 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo | ... | @@ -3669,11 +3689,13 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo |
| 3669 | if (arg0_value == irb->codegen->invalid_instruction) | 3689 | if (arg0_value == irb->codegen->invalid_instruction) |
| 3670 | return arg0_value; | 3690 | return arg0_value; |
| 3671 | | 3691 | |
| 3672 | return ir_build_import(irb, scope, node, arg0_value); | 3692 | IrInstruction *import = ir_build_import(irb, scope, node, arg0_value); |
| | 3693 | return ir_lval_wrap(irb, scope, import, lval); |
| 3673 | } | 3694 | } |
| 3674 | case BuiltinFnIdCImport: | 3695 | case BuiltinFnIdCImport: |
| 3675 | { | 3696 | { |
| 3676 | return ir_build_c_import(irb, scope, node); | 3697 | IrInstruction *c_import = ir_build_c_import(irb, scope, node); |
| | 3698 | return ir_lval_wrap(irb, scope, c_import, lval); |
| 3677 | } | 3699 | } |
| 3678 | case BuiltinFnIdCInclude: | 3700 | case BuiltinFnIdCInclude: |
| 3679 | { | 3701 | { |
| ... | @@ -3687,7 +3709,8 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo | ... | @@ -3687,7 +3709,8 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo |
| 3687 | return irb->codegen->invalid_instruction; | 3709 | return irb->codegen->invalid_instruction; |
| 3688 | } | 3710 | } |
| 3689 | | 3711 | |
| 3690 | return ir_build_c_include(irb, scope, node, arg0_value); | 3712 | IrInstruction *c_include = ir_build_c_include(irb, scope, node, arg0_value); |
| | 3713 | return ir_lval_wrap(irb, scope, c_include, lval); |
| 3691 | } | 3714 | } |
| 3692 | case BuiltinFnIdCDefine: | 3715 | case BuiltinFnIdCDefine: |
| 3693 | { | 3716 | { |
| ... | @@ -3706,7 +3729,8 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo | ... | @@ -3706,7 +3729,8 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo |
| 3706 | return irb->codegen->invalid_instruction; | 3729 | return irb->codegen->invalid_instruction; |
| 3707 | } | 3730 | } |
| 3708 | | 3731 | |
| 3709 | return ir_build_c_define(irb, scope, node, arg0_value, arg1_value); | 3732 | IrInstruction *c_define = ir_build_c_define(irb, scope, node, arg0_value, arg1_value); |
| | 3733 | return ir_lval_wrap(irb, scope, c_define, lval); |
| 3710 | } | 3734 | } |
| 3711 | case BuiltinFnIdCUndef: | 3735 | case BuiltinFnIdCUndef: |
| 3712 | { | 3736 | { |
| ... | @@ -3720,7 +3744,8 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo | ... | @@ -3720,7 +3744,8 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo |
| 3720 | return irb->codegen->invalid_instruction; | 3744 | return irb->codegen->invalid_instruction; |
| 3721 | } | 3745 | } |
| 3722 | | 3746 | |
| 3723 | return ir_build_c_undef(irb, scope, node, arg0_value); | 3747 | IrInstruction *c_undef = ir_build_c_undef(irb, scope, node, arg0_value); |
| | 3748 | return ir_lval_wrap(irb, scope, c_undef, lval); |
| 3724 | } | 3749 | } |
| 3725 | case BuiltinFnIdMaxValue: | 3750 | case BuiltinFnIdMaxValue: |
| 3726 | { | 3751 | { |
| ... | @@ -3729,7 +3754,8 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo | ... | @@ -3729,7 +3754,8 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo |
| 3729 | if (arg0_value == irb->codegen->invalid_instruction) | 3754 | if (arg0_value == irb->codegen->invalid_instruction) |
| 3730 | return arg0_value; | 3755 | return arg0_value; |
| 3731 | | 3756 | |
| 3732 | return ir_build_max_value(irb, scope, node, arg0_value); | 3757 | IrInstruction *max_value = ir_build_max_value(irb, scope, node, arg0_value); |
| | 3758 | return ir_lval_wrap(irb, scope, max_value, lval); |
| 3733 | } | 3759 | } |
| 3734 | case BuiltinFnIdMinValue: | 3760 | case BuiltinFnIdMinValue: |
| 3735 | { | 3761 | { |
| ... | @@ -3738,7 +3764,8 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo | ... | @@ -3738,7 +3764,8 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo |
| 3738 | if (arg0_value == irb->codegen->invalid_instruction) | 3764 | if (arg0_value == irb->codegen->invalid_instruction) |
| 3739 | return arg0_value; | 3765 | return arg0_value; |
| 3740 | | 3766 | |
| 3741 | return ir_build_min_value(irb, scope, node, arg0_value); | 3767 | IrInstruction *min_value = ir_build_min_value(irb, scope, node, arg0_value); |
| | 3768 | return ir_lval_wrap(irb, scope, min_value, lval); |
| 3742 | } | 3769 | } |
| 3743 | case BuiltinFnIdCompileErr: | 3770 | case BuiltinFnIdCompileErr: |
| 3744 | { | 3771 | { |
| ... | @@ -3747,7 +3774,8 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo | ... | @@ -3747,7 +3774,8 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo |
| 3747 | if (arg0_value == irb->codegen->invalid_instruction) | 3774 | if (arg0_value == irb->codegen->invalid_instruction) |
| 3748 | return arg0_value; | 3775 | return arg0_value; |
| 3749 | | 3776 | |
| 3750 | return ir_build_compile_err(irb, scope, node, arg0_value); | 3777 | IrInstruction *compile_err = ir_build_compile_err(irb, scope, node, arg0_value); |
| | 3778 | return ir_lval_wrap(irb, scope, compile_err, lval); |
| 3751 | } | 3779 | } |
| 3752 | case BuiltinFnIdCompileLog: | 3780 | case BuiltinFnIdCompileLog: |
| 3753 | { | 3781 | { |
| ... | @@ -3760,7 +3788,8 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo | ... | @@ -3760,7 +3788,8 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo |
| 3760 | return irb->codegen->invalid_instruction; | 3788 | return irb->codegen->invalid_instruction; |
| 3761 | } | 3789 | } |
| 3762 | | 3790 | |
| 3763 | return ir_build_compile_log(irb, scope, node, actual_param_count, args); | 3791 | IrInstruction *compile_log = ir_build_compile_log(irb, scope, node, actual_param_count, args); |
| | 3792 | return ir_lval_wrap(irb, scope, compile_log, lval); |
| 3764 | } | 3793 | } |
| 3765 | case BuiltinFnIdErrName: | 3794 | case BuiltinFnIdErrName: |
| 3766 | { | 3795 | { |
| ... | @@ -3769,7 +3798,8 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo | ... | @@ -3769,7 +3798,8 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo |
| 3769 | if (arg0_value == irb->codegen->invalid_instruction) | 3798 | if (arg0_value == irb->codegen->invalid_instruction) |
| 3770 | return arg0_value; | 3799 | return arg0_value; |
| 3771 | | 3800 | |
| 3772 | return ir_build_err_name(irb, scope, node, arg0_value); | 3801 | IrInstruction *err_name = ir_build_err_name(irb, scope, node, arg0_value); |
| | 3802 | return ir_lval_wrap(irb, scope, err_name, lval); |
| 3773 | } | 3803 | } |
| 3774 | case BuiltinFnIdEmbedFile: | 3804 | case BuiltinFnIdEmbedFile: |
| 3775 | { | 3805 | { |
| ... | @@ -3778,7 +3808,8 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo | ... | @@ -3778,7 +3808,8 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo |
| 3778 | if (arg0_value == irb->codegen->invalid_instruction) | 3808 | if (arg0_value == irb->codegen->invalid_instruction) |
| 3779 | return arg0_value; | 3809 | return arg0_value; |
| 3780 | | 3810 | |
| 3781 | return ir_build_embed_file(irb, scope, node, arg0_value); | 3811 | IrInstruction *embed_file = ir_build_embed_file(irb, scope, node, arg0_value); |
| | 3812 | return ir_lval_wrap(irb, scope, embed_file, lval); |
| 3782 | } | 3813 | } |
| 3783 | case BuiltinFnIdCmpxchgWeak: | 3814 | case BuiltinFnIdCmpxchgWeak: |
| 3784 | case BuiltinFnIdCmpxchgStrong: | 3815 | case BuiltinFnIdCmpxchgStrong: |
| ... | @@ -3813,9 +3844,10 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo | ... | @@ -3813,9 +3844,10 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo |
| 3813 | if (arg5_value == irb->codegen->invalid_instruction) | 3844 | if (arg5_value == irb->codegen->invalid_instruction) |
| 3814 | return arg5_value; | 3845 | return arg5_value; |
| 3815 | | 3846 | |
| 3816 | return ir_build_cmpxchg(irb, scope, node, arg0_value, arg1_value, | 3847 | IrInstruction *cmpxchg = ir_build_cmpxchg(irb, scope, node, arg0_value, arg1_value, |
| 3817 | arg2_value, arg3_value, arg4_value, arg5_value, (builtin_fn->id == BuiltinFnIdCmpxchgWeak), | 3848 | arg2_value, arg3_value, arg4_value, arg5_value, (builtin_fn->id == BuiltinFnIdCmpxchgWeak), |
| 3818 | nullptr, AtomicOrderUnordered, AtomicOrderUnordered); | 3849 | nullptr, AtomicOrderUnordered, AtomicOrderUnordered); |
| | 3850 | return ir_lval_wrap(irb, scope, cmpxchg, lval); |
| 3819 | } | 3851 | } |
| 3820 | case BuiltinFnIdFence: | 3852 | case BuiltinFnIdFence: |
| 3821 | { | 3853 | { |
| ... | @@ -3824,7 +3856,8 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo | ... | @@ -3824,7 +3856,8 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo |
| 3824 | if (arg0_value == irb->codegen->invalid_instruction) | 3856 | if (arg0_value == irb->codegen->invalid_instruction) |
| 3825 | return arg0_value; | 3857 | return arg0_value; |
| 3826 | | 3858 | |
| 3827 | return ir_build_fence(irb, scope, node, arg0_value, AtomicOrderUnordered); | 3859 | IrInstruction *fence = ir_build_fence(irb, scope, node, arg0_value, AtomicOrderUnordered); |
| | 3860 | return ir_lval_wrap(irb, scope, fence, lval); |
| 3828 | } | 3861 | } |
| 3829 | case BuiltinFnIdDivExact: | 3862 | case BuiltinFnIdDivExact: |
| 3830 | { | 3863 | { |
| ... | @@ -3838,7 +3871,8 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo | ... | @@ -3838,7 +3871,8 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo |
| 3838 | if (arg1_value == irb->codegen->invalid_instruction) | 3871 | if (arg1_value == irb->codegen->invalid_instruction) |
| 3839 | return arg1_value; | 3872 | return arg1_value; |
| 3840 | | 3873 | |
| 3841 | return ir_build_bin_op(irb, scope, node, IrBinOpDivExact, arg0_value, arg1_value, true); | 3874 | IrInstruction *bin_op = ir_build_bin_op(irb, scope, node, IrBinOpDivExact, arg0_value, arg1_value, true); |
| | 3875 | return ir_lval_wrap(irb, scope, bin_op, lval); |
| 3842 | } | 3876 | } |
| 3843 | case BuiltinFnIdDivTrunc: | 3877 | case BuiltinFnIdDivTrunc: |
| 3844 | { | 3878 | { |
| ... | @@ -3852,7 +3886,8 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo | ... | @@ -3852,7 +3886,8 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo |
| 3852 | if (arg1_value == irb->codegen->invalid_instruction) | 3886 | if (arg1_value == irb->codegen->invalid_instruction) |
| 3853 | return arg1_value; | 3887 | return arg1_value; |
| 3854 | | 3888 | |
| 3855 | return ir_build_bin_op(irb, scope, node, IrBinOpDivTrunc, arg0_value, arg1_value, true); | 3889 | IrInstruction *bin_op = ir_build_bin_op(irb, scope, node, IrBinOpDivTrunc, arg0_value, arg1_value, true); |
| | 3890 | return ir_lval_wrap(irb, scope, bin_op, lval); |
| 3856 | } | 3891 | } |
| 3857 | case BuiltinFnIdDivFloor: | 3892 | case BuiltinFnIdDivFloor: |
| 3858 | { | 3893 | { |
| ... | @@ -3866,7 +3901,8 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo | ... | @@ -3866,7 +3901,8 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo |
| 3866 | if (arg1_value == irb->codegen->invalid_instruction) | 3901 | if (arg1_value == irb->codegen->invalid_instruction) |
| 3867 | return arg1_value; | 3902 | return arg1_value; |
| 3868 | | 3903 | |
| 3869 | return ir_build_bin_op(irb, scope, node, IrBinOpDivFloor, arg0_value, arg1_value, true); | 3904 | IrInstruction *bin_op = ir_build_bin_op(irb, scope, node, IrBinOpDivFloor, arg0_value, arg1_value, true); |
| | 3905 | return ir_lval_wrap(irb, scope, bin_op, lval); |
| 3870 | } | 3906 | } |
| 3871 | case BuiltinFnIdRem: | 3907 | case BuiltinFnIdRem: |
| 3872 | { | 3908 | { |
| ... | @@ -3880,7 +3916,8 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo | ... | @@ -3880,7 +3916,8 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo |
| 3880 | if (arg1_value == irb->codegen->invalid_instruction) | 3916 | if (arg1_value == irb->codegen->invalid_instruction) |
| 3881 | return arg1_value; | 3917 | return arg1_value; |
| 3882 | | 3918 | |
| 3883 | return ir_build_bin_op(irb, scope, node, IrBinOpRemRem, arg0_value, arg1_value, true); | 3919 | IrInstruction *bin_op = ir_build_bin_op(irb, scope, node, IrBinOpRemRem, arg0_value, arg1_value, true); |
| | 3920 | return ir_lval_wrap(irb, scope, bin_op, lval); |
| 3884 | } | 3921 | } |
| 3885 | case BuiltinFnIdMod: | 3922 | case BuiltinFnIdMod: |
| 3886 | { | 3923 | { |
| ... | @@ -3894,7 +3931,8 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo | ... | @@ -3894,7 +3931,8 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo |
| 3894 | if (arg1_value == irb->codegen->invalid_instruction) | 3931 | if (arg1_value == irb->codegen->invalid_instruction) |
| 3895 | return arg1_value; | 3932 | return arg1_value; |
| 3896 | | 3933 | |
| 3897 | return ir_build_bin_op(irb, scope, node, IrBinOpRemMod, arg0_value, arg1_value, true); | 3934 | IrInstruction *bin_op = ir_build_bin_op(irb, scope, node, IrBinOpRemMod, arg0_value, arg1_value, true); |
| | 3935 | return ir_lval_wrap(irb, scope, bin_op, lval); |
| 3898 | } | 3936 | } |
| 3899 | case BuiltinFnIdSqrt: | 3937 | case BuiltinFnIdSqrt: |
| 3900 | { | 3938 | { |
| ... | @@ -3908,7 +3946,8 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo | ... | @@ -3908,7 +3946,8 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo |
| 3908 | if (arg1_value == irb->codegen->invalid_instruction) | 3946 | if (arg1_value == irb->codegen->invalid_instruction) |
| 3909 | return arg1_value; | 3947 | return arg1_value; |
| 3910 | | 3948 | |
| 3911 | return ir_build_sqrt(irb, scope, node, arg0_value, arg1_value); | 3949 | IrInstruction *ir_sqrt = ir_build_sqrt(irb, scope, node, arg0_value, arg1_value); |
| | 3950 | return ir_lval_wrap(irb, scope, ir_sqrt, lval); |
| 3912 | } | 3951 | } |
| 3913 | case BuiltinFnIdTruncate: | 3952 | case BuiltinFnIdTruncate: |
| 3914 | { | 3953 | { |
| ... | @@ -3922,7 +3961,8 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo | ... | @@ -3922,7 +3961,8 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo |
| 3922 | if (arg1_value == irb->codegen->invalid_instruction) | 3961 | if (arg1_value == irb->codegen->invalid_instruction) |
| 3923 | return arg1_value; | 3962 | return arg1_value; |
| 3924 | | 3963 | |
| 3925 | return ir_build_truncate(irb, scope, node, arg0_value, arg1_value); | 3964 | IrInstruction *truncate = ir_build_truncate(irb, scope, node, arg0_value, arg1_value); |
| | 3965 | return ir_lval_wrap(irb, scope, truncate, lval); |
| 3926 | } | 3966 | } |
| 3927 | case BuiltinFnIdIntType: | 3967 | case BuiltinFnIdIntType: |
| 3928 | { | 3968 | { |
| ... | @@ -3936,7 +3976,8 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo | ... | @@ -3936,7 +3976,8 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo |
| 3936 | if (arg1_value == irb->codegen->invalid_instruction) | 3976 | if (arg1_value == irb->codegen->invalid_instruction) |
| 3937 | return arg1_value; | 3977 | return arg1_value; |
| 3938 | | 3978 | |
| 3939 | return ir_build_int_type(irb, scope, node, arg0_value, arg1_value); | 3979 | IrInstruction *int_type = ir_build_int_type(irb, scope, node, arg0_value, arg1_value); |
| | 3980 | return ir_lval_wrap(irb, scope, int_type, lval); |
| 3940 | } | 3981 | } |
| 3941 | case BuiltinFnIdMemcpy: | 3982 | case BuiltinFnIdMemcpy: |
| 3942 | { | 3983 | { |
| ... | @@ -3955,7 +3996,8 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo | ... | @@ -3955,7 +3996,8 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo |
| 3955 | if (arg2_value == irb->codegen->invalid_instruction) | 3996 | if (arg2_value == irb->codegen->invalid_instruction) |
| 3956 | return arg2_value; | 3997 | return arg2_value; |
| 3957 | | 3998 | |
| 3958 | return ir_build_memcpy(irb, scope, node, arg0_value, arg1_value, arg2_value); | 3999 | IrInstruction *ir_memcpy = ir_build_memcpy(irb, scope, node, arg0_value, arg1_value, arg2_value); |
| | 4000 | return ir_lval_wrap(irb, scope, ir_memcpy, lval); |
| 3959 | } | 4001 | } |
| 3960 | case BuiltinFnIdMemset: | 4002 | case BuiltinFnIdMemset: |
| 3961 | { | 4003 | { |
| ... | @@ -3974,7 +4016,8 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo | ... | @@ -3974,7 +4016,8 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo |
| 3974 | if (arg2_value == irb->codegen->invalid_instruction) | 4016 | if (arg2_value == irb->codegen->invalid_instruction) |
| 3975 | return arg2_value; | 4017 | return arg2_value; |
| 3976 | | 4018 | |
| 3977 | return ir_build_memset(irb, scope, node, arg0_value, arg1_value, arg2_value); | 4019 | IrInstruction *ir_memset = ir_build_memset(irb, scope, node, arg0_value, arg1_value, arg2_value); |
| | 4020 | return ir_lval_wrap(irb, scope, ir_memset, lval); |
| 3978 | } | 4021 | } |
| 3979 | case BuiltinFnIdMemberCount: | 4022 | case BuiltinFnIdMemberCount: |
| 3980 | { | 4023 | { |
| ... | @@ -3983,7 +4026,8 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo | ... | @@ -3983,7 +4026,8 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo |
| 3983 | if (arg0_value == irb->codegen->invalid_instruction) | 4026 | if (arg0_value == irb->codegen->invalid_instruction) |
| 3984 | return arg0_value; | 4027 | return arg0_value; |
| 3985 | | 4028 | |
| 3986 | return ir_build_member_count(irb, scope, node, arg0_value); | 4029 | IrInstruction *member_count = ir_build_member_count(irb, scope, node, arg0_value); |
| | 4030 | return ir_lval_wrap(irb, scope, member_count, lval); |
| 3987 | } | 4031 | } |
| 3988 | case BuiltinFnIdMemberType: | 4032 | case BuiltinFnIdMemberType: |
| 3989 | { | 4033 | { |
| ... | @@ -3998,7 +4042,8 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo | ... | @@ -3998,7 +4042,8 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo |
| 3998 | return arg1_value; | 4042 | return arg1_value; |
| 3999 | | 4043 | |
| 4000 | | 4044 | |
| 4001 | return ir_build_member_type(irb, scope, node, arg0_value, arg1_value); | 4045 | IrInstruction *member_type = ir_build_member_type(irb, scope, node, arg0_value, arg1_value); |
| | 4046 | return ir_lval_wrap(irb, scope, member_type, lval); |
| 4002 | } | 4047 | } |
| 4003 | case BuiltinFnIdMemberName: | 4048 | case BuiltinFnIdMemberName: |
| 4004 | { | 4049 | { |
| ... | @@ -4013,14 +4058,34 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo | ... | @@ -4013,14 +4058,34 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo |
| 4013 | return arg1_value; | 4058 | return arg1_value; |
| 4014 | | 4059 | |
| 4015 | | 4060 | |
| 4016 | return ir_build_member_name(irb, scope, node, arg0_value, arg1_value); | 4061 | IrInstruction *member_name = ir_build_member_name(irb, scope, node, arg0_value, arg1_value); |
| | 4062 | return ir_lval_wrap(irb, scope, member_name, lval); |
| | 4063 | } |
| | 4064 | case BuiltinFnIdField: |
| | 4065 | { |
| | 4066 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); |
| | 4067 | IrInstruction *arg0_value = ir_gen_node_extra(irb, arg0_node, scope, LVAL_PTR); |
| | 4068 | if (arg0_value == irb->codegen->invalid_instruction) |
| | 4069 | return arg0_value; |
| | 4070 | |
| | 4071 | AstNode *arg1_node = node->data.fn_call_expr.params.at(1); |
| | 4072 | IrInstruction *arg1_value = ir_gen_node(irb, arg1_node, scope); |
| | 4073 | if (arg1_value == irb->codegen->invalid_instruction) |
| | 4074 | return arg1_value; |
| | 4075 | |
| | 4076 | IrInstruction *ptr_instruction = ir_build_field_ptr_instruction(irb, scope, node, arg0_value, arg1_value); |
| | 4077 | |
| | 4078 | if (lval.is_ptr) |
| | 4079 | return ptr_instruction; |
| | 4080 | |
| | 4081 | return ir_build_load_ptr(irb, scope, node, ptr_instruction); |
| 4017 | } | 4082 | } |
| 4018 | case BuiltinFnIdBreakpoint: | 4083 | case BuiltinFnIdBreakpoint: |
| 4019 | return ir_build_breakpoint(irb, scope, node); | 4084 | return ir_lval_wrap(irb, scope, ir_build_breakpoint(irb, scope, node), lval); |
| 4020 | case BuiltinFnIdReturnAddress: | 4085 | case BuiltinFnIdReturnAddress: |
| 4021 | return ir_build_return_address(irb, scope, node); | 4086 | return ir_lval_wrap(irb, scope, ir_build_return_address(irb, scope, node), lval); |
| 4022 | case BuiltinFnIdFrameAddress: | 4087 | case BuiltinFnIdFrameAddress: |
| 4023 | return ir_build_frame_address(irb, scope, node); | 4088 | return ir_lval_wrap(irb, scope, ir_build_frame_address(irb, scope, node), lval); |
| 4024 | case BuiltinFnIdAlignOf: | 4089 | case BuiltinFnIdAlignOf: |
| 4025 | { | 4090 | { |
| 4026 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); | 4091 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); |
| ... | @@ -4028,16 +4093,17 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo | ... | @@ -4028,16 +4093,17 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo |
| 4028 | if (arg0_value == irb->codegen->invalid_instruction) | 4093 | if (arg0_value == irb->codegen->invalid_instruction) |
| 4029 | return arg0_value; | 4094 | return arg0_value; |
| 4030 | | 4095 | |
| 4031 | return ir_build_align_of(irb, scope, node, arg0_value); | 4096 | IrInstruction *align_of = ir_build_align_of(irb, scope, node, arg0_value); |
| | 4097 | return ir_lval_wrap(irb, scope, align_of, lval); |
| 4032 | } | 4098 | } |
| 4033 | case BuiltinFnIdAddWithOverflow: | 4099 | case BuiltinFnIdAddWithOverflow: |
| 4034 | return ir_gen_overflow_op(irb, scope, node, IrOverflowOpAdd); | 4100 | return ir_lval_wrap(irb, scope, ir_gen_overflow_op(irb, scope, node, IrOverflowOpAdd), lval); |
| 4035 | case BuiltinFnIdSubWithOverflow: | 4101 | case BuiltinFnIdSubWithOverflow: |
| 4036 | return ir_gen_overflow_op(irb, scope, node, IrOverflowOpSub); | 4102 | return ir_lval_wrap(irb, scope, ir_gen_overflow_op(irb, scope, node, IrOverflowOpSub), lval); |
| 4037 | case BuiltinFnIdMulWithOverflow: | 4103 | case BuiltinFnIdMulWithOverflow: |
| 4038 | return ir_gen_overflow_op(irb, scope, node, IrOverflowOpMul); | 4104 | return ir_lval_wrap(irb, scope, ir_gen_overflow_op(irb, scope, node, IrOverflowOpMul), lval); |
| 4039 | case BuiltinFnIdShlWithOverflow: | 4105 | case BuiltinFnIdShlWithOverflow: |
| 4040 | return ir_gen_overflow_op(irb, scope, node, IrOverflowOpShl); | 4106 | return ir_lval_wrap(irb, scope, ir_gen_overflow_op(irb, scope, node, IrOverflowOpShl), lval); |
| 4041 | case BuiltinFnIdTypeName: | 4107 | case BuiltinFnIdTypeName: |
| 4042 | { | 4108 | { |
| 4043 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); | 4109 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); |
| ... | @@ -4045,7 +4111,8 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo | ... | @@ -4045,7 +4111,8 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo |
| 4045 | if (arg0_value == irb->codegen->invalid_instruction) | 4111 | if (arg0_value == irb->codegen->invalid_instruction) |
| 4046 | return arg0_value; | 4112 | return arg0_value; |
| 4047 | | 4113 | |
| 4048 | return ir_build_type_name(irb, scope, node, arg0_value); | 4114 | IrInstruction *type_name = ir_build_type_name(irb, scope, node, arg0_value); |
| | 4115 | return ir_lval_wrap(irb, scope, type_name, lval); |
| 4049 | } | 4116 | } |
| 4050 | case BuiltinFnIdCanImplicitCast: | 4117 | case BuiltinFnIdCanImplicitCast: |
| 4051 | { | 4118 | { |
| ... | @@ -4059,7 +4126,8 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo | ... | @@ -4059,7 +4126,8 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo |
| 4059 | if (arg1_value == irb->codegen->invalid_instruction) | 4126 | if (arg1_value == irb->codegen->invalid_instruction) |
| 4060 | return arg1_value; | 4127 | return arg1_value; |
| 4061 | | 4128 | |
| 4062 | return ir_build_can_implicit_cast(irb, scope, node, arg0_value, arg1_value); | 4129 | IrInstruction *can_implicit_cast = ir_build_can_implicit_cast(irb, scope, node, arg0_value, arg1_value); |
| | 4130 | return ir_lval_wrap(irb, scope, can_implicit_cast, lval); |
| 4063 | } | 4131 | } |
| 4064 | case BuiltinFnIdPanic: | 4132 | case BuiltinFnIdPanic: |
| 4065 | { | 4133 | { |
| ... | @@ -4068,7 +4136,8 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo | ... | @@ -4068,7 +4136,8 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo |
| 4068 | if (arg0_value == irb->codegen->invalid_instruction) | 4136 | if (arg0_value == irb->codegen->invalid_instruction) |
| 4069 | return arg0_value; | 4137 | return arg0_value; |
| 4070 | | 4138 | |
| 4071 | return ir_build_panic(irb, scope, node, arg0_value); | 4139 | IrInstruction *panic = ir_build_panic(irb, scope, node, arg0_value); |
| | 4140 | return ir_lval_wrap(irb, scope, panic, lval); |
| 4072 | } | 4141 | } |
| 4073 | case BuiltinFnIdPtrCast: | 4142 | case BuiltinFnIdPtrCast: |
| 4074 | { | 4143 | { |
| ... | @@ -4082,7 +4151,8 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo | ... | @@ -4082,7 +4151,8 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo |
| 4082 | if (arg1_value == irb->codegen->invalid_instruction) | 4151 | if (arg1_value == irb->codegen->invalid_instruction) |
| 4083 | return arg1_value; | 4152 | return arg1_value; |
| 4084 | | 4153 | |
| 4085 | return ir_build_ptr_cast(irb, scope, node, arg0_value, arg1_value); | 4154 | IrInstruction *ptr_cast = ir_build_ptr_cast(irb, scope, node, arg0_value, arg1_value); |
| | 4155 | return ir_lval_wrap(irb, scope, ptr_cast, lval); |
| 4086 | } | 4156 | } |
| 4087 | case BuiltinFnIdBitCast: | 4157 | case BuiltinFnIdBitCast: |
| 4088 | { | 4158 | { |
| ... | @@ -4096,7 +4166,8 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo | ... | @@ -4096,7 +4166,8 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo |
| 4096 | if (arg1_value == irb->codegen->invalid_instruction) | 4166 | if (arg1_value == irb->codegen->invalid_instruction) |
| 4097 | return arg1_value; | 4167 | return arg1_value; |
| 4098 | | 4168 | |
| 4099 | return ir_build_bit_cast(irb, scope, node, arg0_value, arg1_value); | 4169 | IrInstruction *bit_cast = ir_build_bit_cast(irb, scope, node, arg0_value, arg1_value); |
| | 4170 | return ir_lval_wrap(irb, scope, bit_cast, lval); |
| 4100 | } | 4171 | } |
| 4101 | case BuiltinFnIdIntToPtr: | 4172 | case BuiltinFnIdIntToPtr: |
| 4102 | { | 4173 | { |
| ... | @@ -4110,7 +4181,8 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo | ... | @@ -4110,7 +4181,8 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo |
| 4110 | if (arg1_value == irb->codegen->invalid_instruction) | 4181 | if (arg1_value == irb->codegen->invalid_instruction) |
| 4111 | return arg1_value; | 4182 | return arg1_value; |
| 4112 | | 4183 | |
| 4113 | return ir_build_int_to_ptr(irb, scope, node, arg0_value, arg1_value); | 4184 | IrInstruction *int_to_ptr = ir_build_int_to_ptr(irb, scope, node, arg0_value, arg1_value); |
| | 4185 | return ir_lval_wrap(irb, scope, int_to_ptr, lval); |
| 4114 | } | 4186 | } |
| 4115 | case BuiltinFnIdPtrToInt: | 4187 | case BuiltinFnIdPtrToInt: |
| 4116 | { | 4188 | { |
| ... | @@ -4119,7 +4191,8 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo | ... | @@ -4119,7 +4191,8 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo |
| 4119 | if (arg0_value == irb->codegen->invalid_instruction) | 4191 | if (arg0_value == irb->codegen->invalid_instruction) |
| 4120 | return arg0_value; | 4192 | return arg0_value; |
| 4121 | | 4193 | |
| 4122 | return ir_build_ptr_to_int(irb, scope, node, arg0_value); | 4194 | IrInstruction *ptr_to_int = ir_build_ptr_to_int(irb, scope, node, arg0_value); |
| | 4195 | return ir_lval_wrap(irb, scope, ptr_to_int, lval); |
| 4123 | } | 4196 | } |
| 4124 | case BuiltinFnIdTagName: | 4197 | case BuiltinFnIdTagName: |
| 4125 | { | 4198 | { |
| ... | @@ -4129,7 +4202,8 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo | ... | @@ -4129,7 +4202,8 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo |
| 4129 | return arg0_value; | 4202 | return arg0_value; |
| 4130 | | 4203 | |
| 4131 | IrInstruction *actual_tag = ir_build_union_tag(irb, scope, node, arg0_value); | 4204 | IrInstruction *actual_tag = ir_build_union_tag(irb, scope, node, arg0_value); |
| 4132 | return ir_build_tag_name(irb, scope, node, actual_tag); | 4205 | IrInstruction *tag_name = ir_build_tag_name(irb, scope, node, actual_tag); |
| | 4206 | return ir_lval_wrap(irb, scope, tag_name, lval); |
| 4133 | } | 4207 | } |
| 4134 | case BuiltinFnIdTagType: | 4208 | case BuiltinFnIdTagType: |
| 4135 | { | 4209 | { |
| ... | @@ -4138,7 +4212,8 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo | ... | @@ -4138,7 +4212,8 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo |
| 4138 | if (arg0_value == irb->codegen->invalid_instruction) | 4212 | if (arg0_value == irb->codegen->invalid_instruction) |
| 4139 | return arg0_value; | 4213 | return arg0_value; |
| 4140 | | 4214 | |
| 4141 | return ir_build_tag_type(irb, scope, node, arg0_value); | 4215 | IrInstruction *tag_type = ir_build_tag_type(irb, scope, node, arg0_value); |
| | 4216 | return ir_lval_wrap(irb, scope, tag_type, lval); |
| 4142 | } | 4217 | } |
| 4143 | case BuiltinFnIdFieldParentPtr: | 4218 | case BuiltinFnIdFieldParentPtr: |
| 4144 | { | 4219 | { |
| ... | @@ -4157,7 +4232,8 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo | ... | @@ -4157,7 +4232,8 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo |
| 4157 | if (arg2_value == irb->codegen->invalid_instruction) | 4232 | if (arg2_value == irb->codegen->invalid_instruction) |
| 4158 | return arg2_value; | 4233 | return arg2_value; |
| 4159 | | 4234 | |
| 4160 | return ir_build_field_parent_ptr(irb, scope, node, arg0_value, arg1_value, arg2_value, nullptr); | 4235 | IrInstruction *field_parent_ptr = ir_build_field_parent_ptr(irb, scope, node, arg0_value, arg1_value, arg2_value, nullptr); |
| | 4236 | return ir_lval_wrap(irb, scope, field_parent_ptr, lval); |
| 4161 | } | 4237 | } |
| 4162 | case BuiltinFnIdOffsetOf: | 4238 | case BuiltinFnIdOffsetOf: |
| 4163 | { | 4239 | { |
| ... | @@ -4171,7 +4247,8 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo | ... | @@ -4171,7 +4247,8 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo |
| 4171 | if (arg1_value == irb->codegen->invalid_instruction) | 4247 | if (arg1_value == irb->codegen->invalid_instruction) |
| 4172 | return arg1_value; | 4248 | return arg1_value; |
| 4173 | | 4249 | |
| 4174 | return ir_build_offset_of(irb, scope, node, arg0_value, arg1_value); | 4250 | IrInstruction *offset_of = ir_build_offset_of(irb, scope, node, arg0_value, arg1_value); |
| | 4251 | return ir_lval_wrap(irb, scope, offset_of, lval); |
| 4175 | } | 4252 | } |
| 4176 | case BuiltinFnIdInlineCall: | 4253 | case BuiltinFnIdInlineCall: |
| 4177 | case BuiltinFnIdNoInlineCall: | 4254 | case BuiltinFnIdNoInlineCall: |
| ... | @@ -4197,7 +4274,8 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo | ... | @@ -4197,7 +4274,8 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo |
| 4197 | } | 4274 | } |
| 4198 | FnInline fn_inline = (builtin_fn->id == BuiltinFnIdInlineCall) ? FnInlineAlways : FnInlineNever; | 4275 | FnInline fn_inline = (builtin_fn->id == BuiltinFnIdInlineCall) ? FnInlineAlways : FnInlineNever; |
| 4199 | | 4276 | |
| 4200 | return ir_build_call(irb, scope, node, nullptr, fn_ref, arg_count, args, false, fn_inline, false, nullptr); | 4277 | IrInstruction *call = ir_build_call(irb, scope, node, nullptr, fn_ref, arg_count, args, false, fn_inline, false, nullptr); |
| | 4278 | return ir_lval_wrap(irb, scope, call, lval); |
| 4201 | } | 4279 | } |
| 4202 | case BuiltinFnIdTypeId: | 4280 | case BuiltinFnIdTypeId: |
| 4203 | { | 4281 | { |
| ... | @@ -4206,7 +4284,8 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo | ... | @@ -4206,7 +4284,8 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo |
| 4206 | if (arg0_value == irb->codegen->invalid_instruction) | 4284 | if (arg0_value == irb->codegen->invalid_instruction) |
| 4207 | return arg0_value; | 4285 | return arg0_value; |
| 4208 | | 4286 | |
| 4209 | return ir_build_type_id(irb, scope, node, arg0_value); | 4287 | IrInstruction *type_id = ir_build_type_id(irb, scope, node, arg0_value); |
| | 4288 | return ir_lval_wrap(irb, scope, type_id, lval); |
| 4210 | } | 4289 | } |
| 4211 | case BuiltinFnIdShlExact: | 4290 | case BuiltinFnIdShlExact: |
| 4212 | { | 4291 | { |
| ... | @@ -4220,7 +4299,8 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo | ... | @@ -4220,7 +4299,8 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo |
| 4220 | if (arg1_value == irb->codegen->invalid_instruction) | 4299 | if (arg1_value == irb->codegen->invalid_instruction) |
| 4221 | return arg1_value; | 4300 | return arg1_value; |
| 4222 | | 4301 | |
| 4223 | return ir_build_bin_op(irb, scope, node, IrBinOpBitShiftLeftExact, arg0_value, arg1_value, true); | 4302 | IrInstruction *bin_op = ir_build_bin_op(irb, scope, node, IrBinOpBitShiftLeftExact, arg0_value, arg1_value, true); |
| | 4303 | return ir_lval_wrap(irb, scope, bin_op, lval); |
| 4224 | } | 4304 | } |
| 4225 | case BuiltinFnIdShrExact: | 4305 | case BuiltinFnIdShrExact: |
| 4226 | { | 4306 | { |
| ... | @@ -4234,7 +4314,8 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo | ... | @@ -4234,7 +4314,8 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo |
| 4234 | if (arg1_value == irb->codegen->invalid_instruction) | 4314 | if (arg1_value == irb->codegen->invalid_instruction) |
| 4235 | return arg1_value; | 4315 | return arg1_value; |
| 4236 | | 4316 | |
| 4237 | return ir_build_bin_op(irb, scope, node, IrBinOpBitShiftRightExact, arg0_value, arg1_value, true); | 4317 | IrInstruction *bin_op = ir_build_bin_op(irb, scope, node, IrBinOpBitShiftRightExact, arg0_value, arg1_value, true); |
| | 4318 | return ir_lval_wrap(irb, scope, bin_op, lval); |
| 4238 | } | 4319 | } |
| 4239 | case BuiltinFnIdSetEvalBranchQuota: | 4320 | case BuiltinFnIdSetEvalBranchQuota: |
| 4240 | { | 4321 | { |
| ... | @@ -4243,7 +4324,8 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo | ... | @@ -4243,7 +4324,8 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo |
| 4243 | if (arg0_value == irb->codegen->invalid_instruction) | 4324 | if (arg0_value == irb->codegen->invalid_instruction) |
| 4244 | return arg0_value; | 4325 | return arg0_value; |
| 4245 | | 4326 | |
| 4246 | return ir_build_set_eval_branch_quota(irb, scope, node, arg0_value); | 4327 | IrInstruction *set_eval_branch_quota = ir_build_set_eval_branch_quota(irb, scope, node, arg0_value); |
| | 4328 | return ir_lval_wrap(irb, scope, set_eval_branch_quota, lval); |
| 4247 | } | 4329 | } |
| 4248 | case BuiltinFnIdAlignCast: | 4330 | case BuiltinFnIdAlignCast: |
| 4249 | { | 4331 | { |
| ... | @@ -4257,10 +4339,14 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo | ... | @@ -4257,10 +4339,14 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo |
| 4257 | if (arg1_value == irb->codegen->invalid_instruction) | 4339 | if (arg1_value == irb->codegen->invalid_instruction) |
| 4258 | return arg1_value; | 4340 | return arg1_value; |
| 4259 | | 4341 | |
| 4260 | return ir_build_align_cast(irb, scope, node, arg0_value, arg1_value); | 4342 | IrInstruction *align_cast = ir_build_align_cast(irb, scope, node, arg0_value, arg1_value); |
| | 4343 | return ir_lval_wrap(irb, scope, align_cast, lval); |
| 4261 | } | 4344 | } |
| 4262 | case BuiltinFnIdOpaqueType: | 4345 | case BuiltinFnIdOpaqueType: |
| 4263 | return ir_build_opaque_type(irb, scope, node); | 4346 | { |
| | 4347 | IrInstruction *opaque_type = ir_build_opaque_type(irb, scope, node); |
| | 4348 | return ir_lval_wrap(irb, scope, opaque_type, lval); |
| | 4349 | } |
| 4264 | case BuiltinFnIdSetAlignStack: | 4350 | case BuiltinFnIdSetAlignStack: |
| 4265 | { | 4351 | { |
| 4266 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); | 4352 | AstNode *arg0_node = node->data.fn_call_expr.params.at(0); |
| ... | @@ -4268,7 +4354,8 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo | ... | @@ -4268,7 +4354,8 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo |
| 4268 | if (arg0_value == irb->codegen->invalid_instruction) | 4354 | if (arg0_value == irb->codegen->invalid_instruction) |
| 4269 | return arg0_value; | 4355 | return arg0_value; |
| 4270 | | 4356 | |
| 4271 | return ir_build_set_align_stack(irb, scope, node, arg0_value); | 4357 | IrInstruction *set_align_stack = ir_build_set_align_stack(irb, scope, node, arg0_value); |
| | 4358 | return ir_lval_wrap(irb, scope, set_align_stack, lval); |
| 4272 | } | 4359 | } |
| 4273 | case BuiltinFnIdArgType: | 4360 | case BuiltinFnIdArgType: |
| 4274 | { | 4361 | { |
| ... | @@ -4282,7 +4369,8 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo | ... | @@ -4282,7 +4369,8 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo |
| 4282 | if (arg1_value == irb->codegen->invalid_instruction) | 4369 | if (arg1_value == irb->codegen->invalid_instruction) |
| 4283 | return arg1_value; | 4370 | return arg1_value; |
| 4284 | | 4371 | |
| 4285 | return ir_build_arg_type(irb, scope, node, arg0_value, arg1_value); | 4372 | IrInstruction *arg_type = ir_build_arg_type(irb, scope, node, arg0_value, arg1_value); |
| | 4373 | return ir_lval_wrap(irb, scope, arg_type, lval); |
| 4286 | } | 4374 | } |
| 4287 | case BuiltinFnIdExport: | 4375 | case BuiltinFnIdExport: |
| 4288 | { | 4376 | { |
| ... | @@ -4301,11 +4389,13 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo | ... | @@ -4301,11 +4389,13 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo |
| 4301 | if (arg2_value == irb->codegen->invalid_instruction) | 4389 | if (arg2_value == irb->codegen->invalid_instruction) |
| 4302 | return arg2_value; | 4390 | return arg2_value; |
| 4303 | | 4391 | |
| 4304 | return ir_build_export(irb, scope, node, arg0_value, arg1_value, arg2_value); | 4392 | IrInstruction *ir_export = ir_build_export(irb, scope, node, arg0_value, arg1_value, arg2_value); |
| | 4393 | return ir_lval_wrap(irb, scope, ir_export, lval); |
| 4305 | } | 4394 | } |
| 4306 | case BuiltinFnIdErrorReturnTrace: | 4395 | case BuiltinFnIdErrorReturnTrace: |
| 4307 | { | 4396 | { |
| 4308 | return ir_build_error_return_trace(irb, scope, node, IrInstructionErrorReturnTrace::Null); | 4397 | IrInstruction *error_return_trace = ir_build_error_return_trace(irb, scope, node, IrInstructionErrorReturnTrace::Null); |
| | 4398 | return ir_lval_wrap(irb, scope, error_return_trace, lval); |
| 4309 | } | 4399 | } |
| 4310 | case BuiltinFnIdAtomicRmw: | 4400 | case BuiltinFnIdAtomicRmw: |
| 4311 | { | 4401 | { |
| ... | @@ -4364,11 +4454,11 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo | ... | @@ -4364,11 +4454,11 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo |
| 4364 | zig_unreachable(); | 4454 | zig_unreachable(); |
| 4365 | } | 4455 | } |
| 4366 | | 4456 | |
| 4367 | static IrInstruction *ir_gen_fn_call(IrBuilder *irb, Scope *scope, AstNode *node) { | 4457 | static IrInstruction *ir_gen_fn_call(IrBuilder *irb, Scope *scope, AstNode *node, LVal lval) { |
| 4368 | assert(node->type == NodeTypeFnCallExpr); | 4458 | assert(node->type == NodeTypeFnCallExpr); |
| 4369 | | 4459 | |
| 4370 | if (node->data.fn_call_expr.is_builtin) | 4460 | if (node->data.fn_call_expr.is_builtin) |
| 4371 | return ir_gen_builtin_fn_call(irb, scope, node); | 4461 | return ir_gen_builtin_fn_call(irb, scope, node, lval); |
| 4372 | | 4462 | |
| 4373 | AstNode *fn_ref_node = node->data.fn_call_expr.fn_ref_expr; | 4463 | AstNode *fn_ref_node = node->data.fn_call_expr.fn_ref_expr; |
| 4374 | IrInstruction *fn_ref = ir_gen_node(irb, fn_ref_node, scope); | 4464 | IrInstruction *fn_ref = ir_gen_node(irb, fn_ref_node, scope); |
| ... | @@ -4394,7 +4484,8 @@ static IrInstruction *ir_gen_fn_call(IrBuilder *irb, Scope *scope, AstNode *node | ... | @@ -4394,7 +4484,8 @@ static IrInstruction *ir_gen_fn_call(IrBuilder *irb, Scope *scope, AstNode *node |
| 4394 | } | 4484 | } |
| 4395 | } | 4485 | } |
| 4396 | | 4486 | |
| 4397 | return ir_build_call(irb, scope, node, nullptr, fn_ref, arg_count, args, false, FnInlineAuto, is_async, async_allocator); | 4487 | IrInstruction *fn_call = ir_build_call(irb, scope, node, nullptr, fn_ref, arg_count, args, false, FnInlineAuto, is_async, async_allocator); |
| | 4488 | return ir_lval_wrap(irb, scope, fn_call, lval); |
| 4398 | } | 4489 | } |
| 4399 | | 4490 | |
| 4400 | static IrInstruction *ir_gen_if_bool_expr(IrBuilder *irb, Scope *scope, AstNode *node) { | 4491 | static IrInstruction *ir_gen_if_bool_expr(IrBuilder *irb, Scope *scope, AstNode *node) { |
| ... | @@ -6410,7 +6501,7 @@ static IrInstruction *ir_gen_node_raw(IrBuilder *irb, AstNode *node, Scope *scop | ... | @@ -6410,7 +6501,7 @@ static IrInstruction *ir_gen_node_raw(IrBuilder *irb, AstNode *node, Scope *scop |
| 6410 | case NodeTypeSymbol: | 6501 | case NodeTypeSymbol: |
| 6411 | return ir_gen_symbol(irb, scope, node, lval); | 6502 | return ir_gen_symbol(irb, scope, node, lval); |
| 6412 | case NodeTypeFnCallExpr: | 6503 | case NodeTypeFnCallExpr: |
| 6413 | return ir_lval_wrap(irb, scope, ir_gen_fn_call(irb, scope, node), lval); | 6504 | return ir_gen_fn_call(irb, scope, node, lval); |
| 6414 | case NodeTypeIfBoolExpr: | 6505 | case NodeTypeIfBoolExpr: |
| 6415 | return ir_lval_wrap(irb, scope, ir_gen_if_bool_expr(irb, scope, node), lval); | 6506 | return ir_lval_wrap(irb, scope, ir_gen_if_bool_expr(irb, scope, node), lval); |
| 6416 | case NodeTypePrefixOpExpr: | 6507 | case NodeTypePrefixOpExpr: |
| ... | @@ -6430,7 +6521,13 @@ static IrInstruction *ir_gen_node_raw(IrBuilder *irb, AstNode *node, Scope *scop | ... | @@ -6430,7 +6521,13 @@ static IrInstruction *ir_gen_node_raw(IrBuilder *irb, AstNode *node, Scope *scop |
| 6430 | case NodeTypeReturnExpr: | 6521 | case NodeTypeReturnExpr: |
| 6431 | return ir_gen_return(irb, scope, node, lval); | 6522 | return ir_gen_return(irb, scope, node, lval); |
| 6432 | case NodeTypeFieldAccessExpr: | 6523 | case NodeTypeFieldAccessExpr: |
| 6433 | return ir_gen_field_access(irb, scope, node, lval); | 6524 | { |
| | 6525 | IrInstruction *ptr_instruction = ir_gen_field_access(irb, scope, node); |
| | 6526 | if (lval.is_ptr) |
| | 6527 | return ptr_instruction; |
| | 6528 | |
| | 6529 | return ir_build_load_ptr(irb, scope, node, ptr_instruction); |
| | 6530 | } |
| 6434 | case NodeTypeThisLiteral: | 6531 | case NodeTypeThisLiteral: |
| 6435 | return ir_lval_wrap(irb, scope, ir_gen_this_literal(irb, scope, node), lval); | 6532 | return ir_lval_wrap(irb, scope, ir_gen_this_literal(irb, scope, node), lval); |
| 6436 | case NodeTypeBoolLiteral: | 6533 | case NodeTypeBoolLiteral: |
| ... | @@ -13458,7 +13555,15 @@ static TypeTableEntry *ir_analyze_instruction_field_ptr(IrAnalyze *ira, IrInstru | ... | @@ -13458,7 +13555,15 @@ static TypeTableEntry *ir_analyze_instruction_field_ptr(IrAnalyze *ira, IrInstru |
| 13458 | zig_unreachable(); | 13555 | zig_unreachable(); |
| 13459 | } | 13556 | } |
| 13460 | | 13557 | |
| 13461 | Buf *field_name = field_ptr_instruction->field_name; | 13558 | Buf *field_name = field_ptr_instruction->field_name_buffer; |
| | 13559 | if (!field_name) { |
| | 13560 | IrInstruction *field_name_expr = field_ptr_instruction->field_name_expr->other; |
| | 13561 | field_name = ir_resolve_str(ira, field_name_expr); |
| | 13562 | if (!field_name) |
| | 13563 | return ira->codegen->builtin_types.entry_invalid; |
| | 13564 | } |
| | 13565 | |
| | 13566 | |
| 13462 | AstNode *source_node = field_ptr_instruction->base.source_node; | 13567 | AstNode *source_node = field_ptr_instruction->base.source_node; |
| 13463 | | 13568 | |
| 13464 | if (type_is_invalid(container_type)) { | 13569 | if (type_is_invalid(container_type)) { |