| ... | @@ -4001,12 +4001,20 @@ static IrInstruction *ir_gen_bin_op_id(IrBuilder *irb, Scope *scope, AstNode *no | ... | @@ -4001,12 +4001,20 @@ static IrInstruction *ir_gen_bin_op_id(IrBuilder *irb, Scope *scope, AstNode *no |
| 4001 | | 4001 | |
| 4002 | static IrInstruction *ir_gen_assign(IrBuilder *irb, Scope *scope, AstNode *node) { | 4002 | static IrInstruction *ir_gen_assign(IrBuilder *irb, Scope *scope, AstNode *node) { |
| 4003 | IrInstruction *lvalue = ir_gen_node_extra(irb, node->data.bin_op_expr.op1, scope, LValPtr, nullptr); | 4003 | IrInstruction *lvalue = ir_gen_node_extra(irb, node->data.bin_op_expr.op1, scope, LValPtr, nullptr); |
| 4004 | IrInstruction *rvalue = ir_gen_node(irb, node->data.bin_op_expr.op2, scope); | 4004 | if (lvalue == irb->codegen->invalid_instruction) |
| | 4005 | return irb->codegen->invalid_instruction; |
| 4005 | | 4006 | |
| 4006 | if (lvalue == irb->codegen->invalid_instruction || rvalue == irb->codegen->invalid_instruction) | 4007 | ResultLocInstruction *result_loc_inst = allocate<ResultLocInstruction>(1); |
| | 4008 | result_loc_inst->base.id = ResultLocIdInstruction; |
| | 4009 | result_loc_inst->base.source_instruction = lvalue; |
| | 4010 | ir_ref_instruction(lvalue, irb->current_basic_block); |
| | 4011 | ir_build_reset_result(irb, scope, node, &result_loc_inst->base); |
| | 4012 | |
| | 4013 | IrInstruction *rvalue = ir_gen_node_extra(irb, node->data.bin_op_expr.op2, scope, LValNone, |
| | 4014 | &result_loc_inst->base); |
| | 4015 | if (rvalue == irb->codegen->invalid_instruction) |
| 4007 | return irb->codegen->invalid_instruction; | 4016 | return irb->codegen->invalid_instruction; |
| 4008 | | 4017 | |
| 4009 | ir_build_store_ptr(irb, scope, node, lvalue, rvalue); | | |
| 4010 | return ir_build_const_void(irb, scope, node); | 4018 | return ir_build_const_void(irb, scope, node); |
| 4011 | } | 4019 | } |
| 4012 | | 4020 | |
| ... | @@ -17477,6 +17485,7 @@ static IrInstruction *ir_analyze_instruction_elem_ptr(IrAnalyze *ira, IrInstruct | ... | @@ -17477,6 +17485,7 @@ static IrInstruction *ir_analyze_instruction_elem_ptr(IrAnalyze *ira, IrInstruct |
| 17477 | return result; | 17485 | return result; |
| 17478 | } else if (is_slice(array_type)) { | 17486 | } else if (is_slice(array_type)) { |
| 17479 | ConstExprValue *ptr_field = &array_ptr_val->data.x_struct.fields[slice_ptr_index]; | 17487 | ConstExprValue *ptr_field = &array_ptr_val->data.x_struct.fields[slice_ptr_index]; |
| | 17488 | ir_assert(ptr_field != nullptr, &elem_ptr_instruction->base); |
| 17480 | if (ptr_field->data.x_ptr.special == ConstPtrSpecialHardCodedAddr) { | 17489 | if (ptr_field->data.x_ptr.special == ConstPtrSpecialHardCodedAddr) { |
| 17481 | IrInstruction *result = ir_build_elem_ptr(&ira->new_irb, elem_ptr_instruction->base.scope, | 17490 | IrInstruction *result = ir_build_elem_ptr(&ira->new_irb, elem_ptr_instruction->base.scope, |
| 17482 | elem_ptr_instruction->base.source_node, array_ptr, casted_elem_index, false, | 17491 | elem_ptr_instruction->base.source_node, array_ptr, casted_elem_index, false, |
| ... | @@ -17663,7 +17672,7 @@ static IrInstruction *ir_analyze_struct_field_ptr(IrAnalyze *ira, IrInstruction | ... | @@ -17663,7 +17672,7 @@ static IrInstruction *ir_analyze_struct_field_ptr(IrAnalyze *ira, IrInstruction |
| 17663 | return ira->codegen->invalid_instruction; | 17672 | return ira->codegen->invalid_instruction; |
| 17664 | if (type_is_invalid(struct_val->type)) | 17673 | if (type_is_invalid(struct_val->type)) |
| 17665 | return ira->codegen->invalid_instruction; | 17674 | return ira->codegen->invalid_instruction; |
| 17666 | if (struct_val->special == ConstValSpecialUndef && initializing) { | 17675 | if (initializing && struct_val->special == ConstValSpecialUndef) { |
| 17667 | struct_val->data.x_struct.fields = create_const_vals(struct_type->data.structure.src_field_count); | 17676 | struct_val->data.x_struct.fields = create_const_vals(struct_type->data.structure.src_field_count); |
| 17668 | struct_val->special = ConstValSpecialStatic; | 17677 | struct_val->special = ConstValSpecialStatic; |
| 17669 | for (size_t i = 0; i < struct_type->data.structure.src_field_count; i += 1) { | 17678 | for (size_t i = 0; i < struct_type->data.structure.src_field_count; i += 1) { |
| ... | @@ -18764,7 +18773,7 @@ static IrInstruction *ir_analyze_unwrap_optional_payload(IrAnalyze *ira, IrInstr | ... | @@ -18764,7 +18773,7 @@ static IrInstruction *ir_analyze_unwrap_optional_payload(IrAnalyze *ira, IrInstr |
| 18764 | if (optional_val == nullptr) | 18773 | if (optional_val == nullptr) |
| 18765 | return ira->codegen->invalid_instruction; | 18774 | return ira->codegen->invalid_instruction; |
| 18766 | | 18775 | |
| 18767 | if (initializing && optional_val->special == ConstValSpecialUndef) { | 18776 | if (initializing) { |
| 18768 | switch (type_has_one_possible_value(ira->codegen, child_type)) { | 18777 | switch (type_has_one_possible_value(ira->codegen, child_type)) { |
| 18769 | case OnePossibleValueInvalid: | 18778 | case OnePossibleValueInvalid: |
| 18770 | return ira->codegen->invalid_instruction; | 18779 | return ira->codegen->invalid_instruction; |
| ... | @@ -23260,7 +23269,7 @@ static IrInstruction *ir_analyze_unwrap_error_payload(IrAnalyze *ira, IrInstruct | ... | @@ -23260,7 +23269,7 @@ static IrInstruction *ir_analyze_unwrap_error_payload(IrAnalyze *ira, IrInstruct |
| 23260 | ConstExprValue *err_union_val = const_ptr_pointee(ira, ira->codegen, ptr_val, source_instr->source_node); | 23269 | ConstExprValue *err_union_val = const_ptr_pointee(ira, ira->codegen, ptr_val, source_instr->source_node); |
| 23261 | if (err_union_val == nullptr) | 23270 | if (err_union_val == nullptr) |
| 23262 | return ira->codegen->invalid_instruction; | 23271 | return ira->codegen->invalid_instruction; |
| 23263 | if (err_union_val->special == ConstValSpecialUndef && initializing) { | 23272 | if (initializing && err_union_val->special == ConstValSpecialUndef) { |
| 23264 | ConstExprValue *vals = create_const_vals(2); | 23273 | ConstExprValue *vals = create_const_vals(2); |
| 23265 | ConstExprValue *err_set_val = &vals[0]; | 23274 | ConstExprValue *err_set_val = &vals[0]; |
| 23266 | ConstExprValue *payload_val = &vals[1]; | 23275 | ConstExprValue *payload_val = &vals[1]; |