| ... | @@ -700,8 +700,12 @@ static constexpr IrInstructionId ir_instruction_id(IrInstructionMemcpy *) { | ... | @@ -700,8 +700,12 @@ static constexpr IrInstructionId ir_instruction_id(IrInstructionMemcpy *) { |
| 700 | return IrInstructionIdMemcpy; | 700 | return IrInstructionIdMemcpy; |
| 701 | } | 701 | } |
| 702 | | 702 | |
| 703 | static constexpr IrInstructionId ir_instruction_id(IrInstructionSlice *) { | 703 | static constexpr IrInstructionId ir_instruction_id(IrInstructionSliceSrc *) { |
| 704 | return IrInstructionIdSlice; | 704 | return IrInstructionIdSliceSrc; |
| | 705 | } |
| | 706 | |
| | 707 | static constexpr IrInstructionId ir_instruction_id(IrInstructionSliceGen *) { |
| | 708 | return IrInstructionIdSliceGen; |
| 705 | } | 709 | } |
| 706 | | 710 | |
| 707 | static constexpr IrInstructionId ir_instruction_id(IrInstructionMemberCount *) { | 711 | static constexpr IrInstructionId ir_instruction_id(IrInstructionMemberCount *) { |
| ... | @@ -880,6 +884,10 @@ static constexpr IrInstructionId ir_instruction_id(IrInstructionResolveResult *) | ... | @@ -880,6 +884,10 @@ static constexpr IrInstructionId ir_instruction_id(IrInstructionResolveResult *) |
| 880 | return IrInstructionIdResolveResult; | 884 | return IrInstructionIdResolveResult; |
| 881 | } | 885 | } |
| 882 | | 886 | |
| | 887 | static constexpr IrInstructionId ir_instruction_id(IrInstructionPtrOfArrayToSlice *) { |
| | 888 | return IrInstructionIdPtrOfArrayToSlice; |
| | 889 | } |
| | 890 | |
| 883 | static constexpr IrInstructionId ir_instruction_id(IrInstructionOpaqueType *) { | 891 | static constexpr IrInstructionId ir_instruction_id(IrInstructionOpaqueType *) { |
| 884 | return IrInstructionIdOpaqueType; | 892 | return IrInstructionIdOpaqueType; |
| 885 | } | 893 | } |
| ... | @@ -2216,14 +2224,15 @@ static IrInstruction *ir_build_memcpy(IrBuilder *irb, Scope *scope, AstNode *sou | ... | @@ -2216,14 +2224,15 @@ static IrInstruction *ir_build_memcpy(IrBuilder *irb, Scope *scope, AstNode *sou |
| 2216 | return &instruction->base; | 2224 | return &instruction->base; |
| 2217 | } | 2225 | } |
| 2218 | | 2226 | |
| 2219 | static IrInstruction *ir_build_slice(IrBuilder *irb, Scope *scope, AstNode *source_node, | 2227 | static IrInstruction *ir_build_slice_src(IrBuilder *irb, Scope *scope, AstNode *source_node, |
| 2220 | IrInstruction *ptr, IrInstruction *start, IrInstruction *end, bool safety_check_on) | 2228 | IrInstruction *ptr, IrInstruction *start, IrInstruction *end, bool safety_check_on, ResultLoc *result_loc) |
| 2221 | { | 2229 | { |
| 2222 | IrInstructionSlice *instruction = ir_build_instruction<IrInstructionSlice>(irb, scope, source_node); | 2230 | IrInstructionSliceSrc *instruction = ir_build_instruction<IrInstructionSliceSrc>(irb, scope, source_node); |
| 2223 | instruction->ptr = ptr; | 2231 | instruction->ptr = ptr; |
| 2224 | instruction->start = start; | 2232 | instruction->start = start; |
| 2225 | instruction->end = end; | 2233 | instruction->end = end; |
| 2226 | instruction->safety_check_on = safety_check_on; | 2234 | instruction->safety_check_on = safety_check_on; |
| | 2235 | instruction->result_loc = result_loc; |
| 2227 | | 2236 | |
| 2228 | ir_ref_instruction(ptr, irb->current_basic_block); | 2237 | ir_ref_instruction(ptr, irb->current_basic_block); |
| 2229 | ir_ref_instruction(start, irb->current_basic_block); | 2238 | ir_ref_instruction(start, irb->current_basic_block); |
| ... | @@ -2232,6 +2241,26 @@ static IrInstruction *ir_build_slice(IrBuilder *irb, Scope *scope, AstNode *sour | ... | @@ -2232,6 +2241,26 @@ static IrInstruction *ir_build_slice(IrBuilder *irb, Scope *scope, AstNode *sour |
| 2232 | return &instruction->base; | 2241 | return &instruction->base; |
| 2233 | } | 2242 | } |
| 2234 | | 2243 | |
| | 2244 | static IrInstruction *ir_build_slice_gen(IrAnalyze *ira, IrInstruction *source_instruction, ZigType *slice_type, |
| | 2245 | IrInstruction *ptr, IrInstruction *start, IrInstruction *end, bool safety_check_on, IrInstruction *result_loc) |
| | 2246 | { |
| | 2247 | IrInstructionSliceGen *instruction = ir_build_instruction<IrInstructionSliceGen>( |
| | 2248 | &ira->new_irb, source_instruction->scope, source_instruction->source_node); |
| | 2249 | instruction->base.value.type = slice_type; |
| | 2250 | instruction->ptr = ptr; |
| | 2251 | instruction->start = start; |
| | 2252 | instruction->end = end; |
| | 2253 | instruction->safety_check_on = safety_check_on; |
| | 2254 | instruction->result_loc = result_loc; |
| | 2255 | |
| | 2256 | ir_ref_instruction(ptr, ira->new_irb.current_basic_block); |
| | 2257 | ir_ref_instruction(start, ira->new_irb.current_basic_block); |
| | 2258 | if (end) ir_ref_instruction(end, ira->new_irb.current_basic_block); |
| | 2259 | ir_ref_instruction(result_loc, ira->new_irb.current_basic_block); |
| | 2260 | |
| | 2261 | return &instruction->base; |
| | 2262 | } |
| | 2263 | |
| 2235 | static IrInstruction *ir_build_member_count(IrBuilder *irb, Scope *scope, AstNode *source_node, IrInstruction *container) { | 2264 | static IrInstruction *ir_build_member_count(IrBuilder *irb, Scope *scope, AstNode *source_node, IrInstruction *container) { |
| 2236 | IrInstructionMemberCount *instruction = ir_build_instruction<IrInstructionMemberCount>(irb, scope, source_node); | 2265 | IrInstructionMemberCount *instruction = ir_build_instruction<IrInstructionMemberCount>(irb, scope, source_node); |
| 2237 | instruction->container = container; | 2266 | instruction->container = container; |
| ... | @@ -2705,11 +2734,12 @@ static IrInstruction *ir_build_align_cast(IrBuilder *irb, Scope *scope, AstNode | ... | @@ -2705,11 +2734,12 @@ static IrInstruction *ir_build_align_cast(IrBuilder *irb, Scope *scope, AstNode |
| 2705 | } | 2734 | } |
| 2706 | | 2735 | |
| 2707 | static IrInstruction *ir_build_implicit_cast(IrBuilder *irb, Scope *scope, AstNode *source_node, | 2736 | static IrInstruction *ir_build_implicit_cast(IrBuilder *irb, Scope *scope, AstNode *source_node, |
| 2708 | IrInstruction *dest_type, IrInstruction *target) | 2737 | IrInstruction *dest_type, IrInstruction *target, ResultLoc *result_loc) |
| 2709 | { | 2738 | { |
| 2710 | IrInstructionImplicitCast *instruction = ir_build_instruction<IrInstructionImplicitCast>(irb, scope, source_node); | 2739 | IrInstructionImplicitCast *instruction = ir_build_instruction<IrInstructionImplicitCast>(irb, scope, source_node); |
| 2711 | instruction->dest_type = dest_type; | 2740 | instruction->dest_type = dest_type; |
| 2712 | instruction->target = target; | 2741 | instruction->target = target; |
| | 2742 | instruction->result_loc = result_loc; |
| 2713 | | 2743 | |
| 2714 | ir_ref_instruction(dest_type, irb->current_basic_block); | 2744 | ir_ref_instruction(dest_type, irb->current_basic_block); |
| 2715 | ir_ref_instruction(target, irb->current_basic_block); | 2745 | ir_ref_instruction(target, irb->current_basic_block); |
| ... | @@ -3082,6 +3112,21 @@ static IrInstruction *ir_build_vector_to_array(IrAnalyze *ira, IrInstruction *so | ... | @@ -3082,6 +3112,21 @@ static IrInstruction *ir_build_vector_to_array(IrAnalyze *ira, IrInstruction *so |
| 3082 | return &instruction->base; | 3112 | return &instruction->base; |
| 3083 | } | 3113 | } |
| 3084 | | 3114 | |
| | 3115 | static IrInstruction *ir_build_ptr_of_array_to_slice(IrAnalyze *ira, IrInstruction *source_instruction, |
| | 3116 | ZigType *result_type, IrInstruction *operand, IrInstruction *result_loc) |
| | 3117 | { |
| | 3118 | IrInstructionPtrOfArrayToSlice *instruction = ir_build_instruction<IrInstructionPtrOfArrayToSlice>(&ira->new_irb, |
| | 3119 | source_instruction->scope, source_instruction->source_node); |
| | 3120 | instruction->base.value.type = result_type; |
| | 3121 | instruction->operand = operand; |
| | 3122 | instruction->result_loc = result_loc; |
| | 3123 | |
| | 3124 | ir_ref_instruction(operand, ira->new_irb.current_basic_block); |
| | 3125 | ir_ref_instruction(result_loc, ira->new_irb.current_basic_block); |
| | 3126 | |
| | 3127 | return &instruction->base; |
| | 3128 | } |
| | 3129 | |
| 3085 | static IrInstruction *ir_build_array_to_vector(IrAnalyze *ira, IrInstruction *source_instruction, | 3130 | static IrInstruction *ir_build_array_to_vector(IrAnalyze *ira, IrInstruction *source_instruction, |
| 3086 | IrInstruction *array, ZigType *result_type) | 3131 | IrInstruction *array, ZigType *result_type) |
| 3087 | { | 3132 | { |
| ... | @@ -5717,7 +5762,8 @@ static IrInstruction *ir_gen_var_decl(IrBuilder *irb, Scope *scope, AstNode *nod | ... | @@ -5717,7 +5762,8 @@ static IrInstruction *ir_gen_var_decl(IrBuilder *irb, Scope *scope, AstNode *nod |
| 5717 | return irb->codegen->invalid_instruction; | 5762 | return irb->codegen->invalid_instruction; |
| 5718 | | 5763 | |
| 5719 | if (type_instruction != nullptr) { | 5764 | if (type_instruction != nullptr) { |
| 5720 | IrInstruction *implicit_cast = ir_build_implicit_cast(irb, scope, node, type_instruction, init_value); | 5765 | IrInstruction *implicit_cast = ir_build_implicit_cast(irb, scope, node, type_instruction, init_value, |
| | 5766 | &result_loc_var->base); |
| 5721 | ir_build_end_expr(irb, scope, node, implicit_cast, &result_loc_var->base); | 5767 | ir_build_end_expr(irb, scope, node, implicit_cast, &result_loc_var->base); |
| 5722 | } | 5768 | } |
| 5723 | | 5769 | |
| ... | @@ -7086,7 +7132,7 @@ static IrInstruction *ir_gen_defer(IrBuilder *irb, Scope *parent_scope, AstNode | ... | @@ -7086,7 +7132,7 @@ static IrInstruction *ir_gen_defer(IrBuilder *irb, Scope *parent_scope, AstNode |
| 7086 | return ir_build_const_void(irb, parent_scope, node); | 7132 | return ir_build_const_void(irb, parent_scope, node); |
| 7087 | } | 7133 | } |
| 7088 | | 7134 | |
| 7089 | static IrInstruction *ir_gen_slice(IrBuilder *irb, Scope *scope, AstNode *node) { | 7135 | static IrInstruction *ir_gen_slice(IrBuilder *irb, Scope *scope, AstNode *node, LVal lval, ResultLoc *result_loc) { |
| 7090 | assert(node->type == NodeTypeSliceExpr); | 7136 | assert(node->type == NodeTypeSliceExpr); |
| 7091 | | 7137 | |
| 7092 | AstNodeSliceExpr *slice_expr = &node->data.slice_expr; | 7138 | AstNodeSliceExpr *slice_expr = &node->data.slice_expr; |
| ... | @@ -7111,7 +7157,8 @@ static IrInstruction *ir_gen_slice(IrBuilder *irb, Scope *scope, AstNode *node) | ... | @@ -7111,7 +7157,8 @@ static IrInstruction *ir_gen_slice(IrBuilder *irb, Scope *scope, AstNode *node) |
| 7111 | end_value = nullptr; | 7157 | end_value = nullptr; |
| 7112 | } | 7158 | } |
| 7113 | | 7159 | |
| 7114 | return ir_build_slice(irb, scope, node, ptr_value, start_value, end_value, true); | 7160 | IrInstruction *slice = ir_build_slice_src(irb, scope, node, ptr_value, start_value, end_value, true, result_loc); |
| | 7161 | return ir_lval_wrap(irb, scope, slice, lval, result_loc); |
| 7115 | } | 7162 | } |
| 7116 | | 7163 | |
| 7117 | static IrInstruction *ir_gen_catch(IrBuilder *irb, Scope *parent_scope, AstNode *node, LVal lval, | 7164 | static IrInstruction *ir_gen_catch(IrBuilder *irb, Scope *parent_scope, AstNode *node, LVal lval, |
| ... | @@ -7659,7 +7706,7 @@ static IrInstruction *ir_gen_await_expr(IrBuilder *irb, Scope *scope, AstNode *n | ... | @@ -7659,7 +7706,7 @@ static IrInstruction *ir_gen_await_expr(IrBuilder *irb, Scope *scope, AstNode *n |
| 7659 | IrInstruction *target_promise_type = ir_build_typeof(irb, scope, node, target_inst); | 7706 | IrInstruction *target_promise_type = ir_build_typeof(irb, scope, node, target_inst); |
| 7660 | IrInstruction *promise_result_type = ir_build_promise_result_type(irb, scope, node, target_promise_type); | 7707 | IrInstruction *promise_result_type = ir_build_promise_result_type(irb, scope, node, target_promise_type); |
| 7661 | ir_build_await_bookkeeping(irb, scope, node, promise_result_type); | 7708 | ir_build_await_bookkeeping(irb, scope, node, promise_result_type); |
| 7662 | IrInstruction *undef_promise_result = ir_build_implicit_cast(irb, scope, node, promise_result_type, undef); | 7709 | IrInstruction *undef_promise_result = ir_build_implicit_cast(irb, scope, node, promise_result_type, undef, nullptr); |
| 7663 | build_decl_var_and_init(irb, scope, node, result_var, undef_promise_result, "result", const_bool_false); | 7710 | build_decl_var_and_init(irb, scope, node, result_var, undef_promise_result, "result", const_bool_false); |
| 7664 | IrInstruction *my_result_var_ptr = ir_build_var_ptr(irb, scope, node, result_var); | 7711 | IrInstruction *my_result_var_ptr = ir_build_var_ptr(irb, scope, node, result_var); |
| 7665 | ir_build_store_ptr(irb, scope, node, result_ptr_field_ptr, my_result_var_ptr); | 7712 | ir_build_store_ptr(irb, scope, node, result_ptr_field_ptr, my_result_var_ptr); |
| ... | @@ -8001,7 +8048,7 @@ static IrInstruction *ir_gen_node_raw(IrBuilder *irb, AstNode *node, Scope *scop | ... | @@ -8001,7 +8048,7 @@ static IrInstruction *ir_gen_node_raw(IrBuilder *irb, AstNode *node, Scope *scop |
| 8001 | case NodeTypeDefer: | 8048 | case NodeTypeDefer: |
| 8002 | return ir_lval_wrap(irb, scope, ir_gen_defer(irb, scope, node), lval, result_loc); | 8049 | return ir_lval_wrap(irb, scope, ir_gen_defer(irb, scope, node), lval, result_loc); |
| 8003 | case NodeTypeSliceExpr: | 8050 | case NodeTypeSliceExpr: |
| 8004 | return ir_lval_wrap(irb, scope, ir_gen_slice(irb, scope, node), lval, result_loc); | 8051 | return ir_gen_slice(irb, scope, node, lval, result_loc); |
| 8005 | case NodeTypeCatchExpr: | 8052 | case NodeTypeCatchExpr: |
| 8006 | return ir_gen_catch(irb, scope, node, lval, result_loc); | 8053 | return ir_gen_catch(irb, scope, node, lval, result_loc); |
| 8007 | case NodeTypeContainerDecl: | 8054 | case NodeTypeContainerDecl: |
| ... | @@ -8028,15 +8075,19 @@ static IrInstruction *ir_gen_node_raw(IrBuilder *irb, AstNode *node, Scope *scop | ... | @@ -8028,15 +8075,19 @@ static IrInstruction *ir_gen_node_raw(IrBuilder *irb, AstNode *node, Scope *scop |
| 8028 | zig_unreachable(); | 8075 | zig_unreachable(); |
| 8029 | } | 8076 | } |
| 8030 | | 8077 | |
| | 8078 | static ResultLoc *no_result_loc(void) { |
| | 8079 | ResultLocNone *result_loc_none = allocate<ResultLocNone>(1); |
| | 8080 | result_loc_none->base.id = ResultLocIdNone; |
| | 8081 | return &result_loc_none->base; |
| | 8082 | } |
| | 8083 | |
| 8031 | static IrInstruction *ir_gen_node_extra(IrBuilder *irb, AstNode *node, Scope *scope, LVal lval, | 8084 | static IrInstruction *ir_gen_node_extra(IrBuilder *irb, AstNode *node, Scope *scope, LVal lval, |
| 8032 | ResultLoc *result_loc) | 8085 | ResultLoc *result_loc) |
| 8033 | { | 8086 | { |
| 8034 | if (result_loc == nullptr) { | 8087 | if (result_loc == nullptr) { |
| 8035 | // Create a result location indicating there is none - but if one gets created | 8088 | // Create a result location indicating there is none - but if one gets created |
| 8036 | // it will be properly distributed. | 8089 | // it will be properly distributed. |
| 8037 | ResultLocNone *result_loc_none = allocate<ResultLocNone>(1); | 8090 | result_loc = no_result_loc(); |
| 8038 | result_loc_none->base.id = ResultLocIdNone; | | |
| 8039 | result_loc = &result_loc_none->base; | | |
| 8040 | } | 8091 | } |
| 8041 | IrInstruction *result = ir_gen_node_raw(irb, node, scope, lval, result_loc); | 8092 | IrInstruction *result = ir_gen_node_raw(irb, node, scope, lval, result_loc); |
| 8042 | irb->exec->invalid = irb->exec->invalid || (result == irb->codegen->invalid_instruction); | 8093 | irb->exec->invalid = irb->exec->invalid || (result == irb->codegen->invalid_instruction); |
| ... | @@ -8098,7 +8149,7 @@ bool ir_gen(CodeGen *codegen, AstNode *node, Scope *scope, IrExecutable *ir_exec | ... | @@ -8098,7 +8149,7 @@ bool ir_gen(CodeGen *codegen, AstNode *node, Scope *scope, IrExecutable *ir_exec |
| 8098 | // TODO mark this var decl as "no safety" e.g. disable initializing the undef value to 0xaa | 8149 | // TODO mark this var decl as "no safety" e.g. disable initializing the undef value to 0xaa |
| 8099 | ZigType *coro_frame_type = get_promise_frame_type(irb->codegen, return_type); | 8150 | ZigType *coro_frame_type = get_promise_frame_type(irb->codegen, return_type); |
| 8100 | IrInstruction *coro_frame_type_value = ir_build_const_type(irb, coro_scope, node, coro_frame_type); | 8151 | IrInstruction *coro_frame_type_value = ir_build_const_type(irb, coro_scope, node, coro_frame_type); |
| 8101 | IrInstruction *undef_coro_frame = ir_build_implicit_cast(irb, coro_scope, node, coro_frame_type_value, undef); | 8152 | IrInstruction *undef_coro_frame = ir_build_implicit_cast(irb, coro_scope, node, coro_frame_type_value, undef, nullptr); |
| 8102 | build_decl_var_and_init(irb, coro_scope, node, promise_var, undef_coro_frame, "promise", const_bool_false); | 8153 | build_decl_var_and_init(irb, coro_scope, node, promise_var, undef_coro_frame, "promise", const_bool_false); |
| 8103 | coro_promise_ptr = ir_build_var_ptr(irb, coro_scope, node, promise_var); | 8154 | coro_promise_ptr = ir_build_var_ptr(irb, coro_scope, node, promise_var); |
| 8104 | | 8155 | |
| ... | @@ -8106,7 +8157,7 @@ bool ir_gen(CodeGen *codegen, AstNode *node, Scope *scope, IrExecutable *ir_exec | ... | @@ -8106,7 +8157,7 @@ bool ir_gen(CodeGen *codegen, AstNode *node, Scope *scope, IrExecutable *ir_exec |
| 8106 | IrInstruction *null_value = ir_build_const_null(irb, coro_scope, node); | 8157 | IrInstruction *null_value = ir_build_const_null(irb, coro_scope, node); |
| 8107 | IrInstruction *await_handle_type_val = ir_build_const_type(irb, coro_scope, node, | 8158 | IrInstruction *await_handle_type_val = ir_build_const_type(irb, coro_scope, node, |
| 8108 | get_optional_type(irb->codegen, irb->codegen->builtin_types.entry_promise)); | 8159 | get_optional_type(irb->codegen, irb->codegen->builtin_types.entry_promise)); |
| 8109 | IrInstruction *null_await_handle = ir_build_implicit_cast(irb, coro_scope, node, await_handle_type_val, null_value); | 8160 | IrInstruction *null_await_handle = ir_build_implicit_cast(irb, coro_scope, node, await_handle_type_val, null_value, nullptr); |
| 8110 | build_decl_var_and_init(irb, coro_scope, node, await_handle_var, null_await_handle, "await_handle", const_bool_false); | 8161 | build_decl_var_and_init(irb, coro_scope, node, await_handle_var, null_await_handle, "await_handle", const_bool_false); |
| 8111 | irb->exec->await_handle_var_ptr = ir_build_var_ptr(irb, coro_scope, node, await_handle_var); | 8162 | irb->exec->await_handle_var_ptr = ir_build_var_ptr(irb, coro_scope, node, await_handle_var); |
| 8112 | | 8163 | |
| ... | @@ -8169,7 +8220,7 @@ bool ir_gen(CodeGen *codegen, AstNode *node, Scope *scope, IrExecutable *ir_exec | ... | @@ -8169,7 +8220,7 @@ bool ir_gen(CodeGen *codegen, AstNode *node, Scope *scope, IrExecutable *ir_exec |
| 8169 | Buf *instruction_addresses_name = buf_create_from_str("instruction_addresses"); | 8220 | Buf *instruction_addresses_name = buf_create_from_str("instruction_addresses"); |
| 8170 | IrInstruction *addrs_slice_ptr = ir_build_field_ptr(irb, scope, node, err_ret_trace_ptr, instruction_addresses_name, false); | 8221 | IrInstruction *addrs_slice_ptr = ir_build_field_ptr(irb, scope, node, err_ret_trace_ptr, instruction_addresses_name, false); |
| 8171 | | 8222 | |
| 8172 | IrInstruction *slice_value = ir_build_slice(irb, scope, node, return_addresses_ptr, zero, nullptr, false); | 8223 | IrInstruction *slice_value = ir_build_slice_src(irb, scope, node, return_addresses_ptr, zero, nullptr, false, no_result_loc()); |
| 8173 | ir_build_store_ptr(irb, scope, node, addrs_slice_ptr, slice_value); | 8224 | ir_build_store_ptr(irb, scope, node, addrs_slice_ptr, slice_value); |
| 8174 | } | 8225 | } |
| 8175 | | 8226 | |
| ... | @@ -8275,7 +8326,8 @@ bool ir_gen(CodeGen *codegen, AstNode *node, Scope *scope, IrExecutable *ir_exec | ... | @@ -8275,7 +8326,8 @@ bool ir_gen(CodeGen *codegen, AstNode *node, Scope *scope, IrExecutable *ir_exec |
| 8275 | IrInstruction *coro_mem_ptr_ref = ir_build_ref(irb, scope, node, coro_mem_ptr, true, false); | 8326 | IrInstruction *coro_mem_ptr_ref = ir_build_ref(irb, scope, node, coro_mem_ptr, true, false); |
| 8276 | IrInstruction *coro_size_ptr = ir_build_var_ptr(irb, scope, node, coro_size_var); | 8327 | IrInstruction *coro_size_ptr = ir_build_var_ptr(irb, scope, node, coro_size_var); |
| 8277 | IrInstruction *coro_size = ir_build_load_ptr(irb, scope, node, coro_size_ptr); | 8328 | IrInstruction *coro_size = ir_build_load_ptr(irb, scope, node, coro_size_ptr); |
| 8278 | IrInstruction *mem_slice = ir_build_slice(irb, scope, node, coro_mem_ptr_ref, zero, coro_size, false); | 8329 | IrInstruction *mem_slice = ir_build_slice_src(irb, scope, node, coro_mem_ptr_ref, zero, coro_size, false, |
| | 8330 | no_result_loc()); |
| 8279 | size_t arg_count = 5; | 8331 | size_t arg_count = 5; |
| 8280 | IrInstruction **args = allocate<IrInstruction *>(arg_count); | 8332 | IrInstruction **args = allocate<IrInstruction *>(arg_count); |
| 8281 | args[0] = implicit_allocator_ptr; // self | 8333 | args[0] = implicit_allocator_ptr; // self |
| ... | @@ -10417,7 +10469,6 @@ static bool eval_const_expr_implicit_cast(IrAnalyze *ira, IrInstruction *source_ | ... | @@ -10417,7 +10469,6 @@ static bool eval_const_expr_implicit_cast(IrAnalyze *ira, IrInstruction *source_ |
| 10417 | zig_unreachable(); | 10469 | zig_unreachable(); |
| 10418 | case CastOpErrSet: | 10470 | case CastOpErrSet: |
| 10419 | case CastOpBitCast: | 10471 | case CastOpBitCast: |
| 10420 | case CastOpPtrOfArrayToSlice: | | |
| 10421 | zig_panic("TODO"); | 10472 | zig_panic("TODO"); |
| 10422 | case CastOpNoop: | 10473 | case CastOpNoop: |
| 10423 | { | 10474 | { |
| ... | @@ -10574,7 +10625,7 @@ static IrInstruction *ir_resolve_ptr_of_array_to_unknown_len_ptr(IrAnalyze *ira, | ... | @@ -10574,7 +10625,7 @@ static IrInstruction *ir_resolve_ptr_of_array_to_unknown_len_ptr(IrAnalyze *ira, |
| 10574 | } | 10625 | } |
| 10575 | | 10626 | |
| 10576 | static IrInstruction *ir_resolve_ptr_of_array_to_slice(IrAnalyze *ira, IrInstruction *source_instr, | 10627 | static IrInstruction *ir_resolve_ptr_of_array_to_slice(IrAnalyze *ira, IrInstruction *source_instr, |
| 10577 | IrInstruction *value, ZigType *wanted_type) | 10628 | IrInstruction *value, ZigType *wanted_type, ResultLoc *result_loc) |
| 10578 | { | 10629 | { |
| 10579 | Error err; | 10630 | Error err; |
| 10580 | | 10631 | |
| ... | @@ -10605,11 +10656,12 @@ static IrInstruction *ir_resolve_ptr_of_array_to_slice(IrAnalyze *ira, IrInstruc | ... | @@ -10605,11 +10656,12 @@ static IrInstruction *ir_resolve_ptr_of_array_to_slice(IrAnalyze *ira, IrInstruc |
| 10605 | } | 10656 | } |
| 10606 | } | 10657 | } |
| 10607 | | 10658 | |
| 10608 | IrInstruction *result = ir_build_cast(&ira->new_irb, source_instr->scope, source_instr->source_node, | 10659 | if (result_loc == nullptr) result_loc = no_result_loc(); |
| 10609 | wanted_type, value, CastOpPtrOfArrayToSlice); | 10660 | IrInstruction *result_loc_inst = ir_resolve_result(ira, source_instr, result_loc, wanted_type, nullptr); |
| 10610 | result->value.type = wanted_type; | 10661 | if (type_is_invalid(result_loc_inst->value.type) || instr_is_unreachable(result_loc_inst)) { |
| 10611 | ir_add_alloca(ira, result, wanted_type); | 10662 | return result_loc_inst; |
| 10612 | return result; | 10663 | } |
| | 10664 | return ir_build_ptr_of_array_to_slice(ira, source_instr, wanted_type, value, result_loc_inst); |
| 10613 | } | 10665 | } |
| 10614 | | 10666 | |
| 10615 | static IrBasicBlock *ir_get_new_bb(IrAnalyze *ira, IrBasicBlock *old_bb, IrInstruction *ref_old_instruction) { | 10667 | static IrBasicBlock *ir_get_new_bb(IrAnalyze *ira, IrBasicBlock *old_bb, IrInstruction *ref_old_instruction) { |
| ... | @@ -11195,7 +11247,7 @@ static IrInstruction *ir_get_ref(IrAnalyze *ira, IrInstruction *source_instructi | ... | @@ -11195,7 +11247,7 @@ static IrInstruction *ir_get_ref(IrAnalyze *ira, IrInstruction *source_instructi |
| 11195 | } | 11247 | } |
| 11196 | | 11248 | |
| 11197 | static IrInstruction *ir_analyze_array_to_slice(IrAnalyze *ira, IrInstruction *source_instr, | 11249 | static IrInstruction *ir_analyze_array_to_slice(IrAnalyze *ira, IrInstruction *source_instr, |
| 11198 | IrInstruction *array_arg, ZigType *wanted_type) | 11250 | IrInstruction *array_arg, ZigType *wanted_type, ResultLoc *result_loc) |
| 11199 | { | 11251 | { |
| 11200 | assert(is_slice(wanted_type)); | 11252 | assert(is_slice(wanted_type)); |
| 11201 | // In this function we honor the const-ness of wanted_type, because | 11253 | // In this function we honor the const-ness of wanted_type, because |
| ... | @@ -11227,12 +11279,14 @@ static IrInstruction *ir_analyze_array_to_slice(IrAnalyze *ira, IrInstruction *s | ... | @@ -11227,12 +11279,14 @@ static IrInstruction *ir_analyze_array_to_slice(IrAnalyze *ira, IrInstruction *s |
| 11227 | | 11279 | |
| 11228 | if (!array_ptr) array_ptr = ir_get_ref(ira, source_instr, array, true, false); | 11280 | if (!array_ptr) array_ptr = ir_get_ref(ira, source_instr, array, true, false); |
| 11229 | | 11281 | |
| 11230 | IrInstruction *result = ir_build_slice(&ira->new_irb, source_instr->scope, | 11282 | if (result_loc == nullptr) result_loc = no_result_loc(); |
| 11231 | source_instr->source_node, array_ptr, start, end, false); | 11283 | IrInstruction *result_loc_inst = ir_resolve_result(ira, source_instr, result_loc, wanted_type, nullptr); |
| 11232 | result->value.type = wanted_type; | 11284 | if (type_is_invalid(result_loc_inst->value.type) || instr_is_unreachable(result_loc_inst)) { |
| | 11285 | return result_loc_inst; |
| | 11286 | } |
| | 11287 | IrInstruction *result = ir_build_slice_gen(ira, source_instr, wanted_type, array_ptr, start, end, false, result_loc_inst); |
| 11233 | result->value.data.rh_slice.id = RuntimeHintSliceIdLen; | 11288 | result->value.data.rh_slice.id = RuntimeHintSliceIdLen; |
| 11234 | result->value.data.rh_slice.len = array_type->data.array.len; | 11289 | result->value.data.rh_slice.len = array_type->data.array.len; |
| 11235 | ir_add_alloca(ira, result, result->value.type); | | |
| 11236 | | 11290 | |
| 11237 | return result; | 11291 | return result; |
| 11238 | } | 11292 | } |
| ... | @@ -11929,7 +11983,7 @@ static bool is_pointery_and_elem_is_not_pointery(ZigType *ty) { | ... | @@ -11929,7 +11983,7 @@ static bool is_pointery_and_elem_is_not_pointery(ZigType *ty) { |
| 11929 | } | 11983 | } |
| 11930 | | 11984 | |
| 11931 | static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_instr, | 11985 | static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_instr, |
| 11932 | ZigType *wanted_type, IrInstruction *value) | 11986 | ZigType *wanted_type, IrInstruction *value, ResultLoc *result_loc) |
| 11933 | { | 11987 | { |
| 11934 | Error err; | 11988 | Error err; |
| 11935 | ZigType *actual_type = value->value.type; | 11989 | ZigType *actual_type = value->value.type; |
| ... | @@ -12017,11 +12071,11 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst | ... | @@ -12017,11 +12071,11 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst |
| 12017 | actual_type->id == ZigTypeIdComptimeInt || | 12071 | actual_type->id == ZigTypeIdComptimeInt || |
| 12018 | actual_type->id == ZigTypeIdComptimeFloat) | 12072 | actual_type->id == ZigTypeIdComptimeFloat) |
| 12019 | { | 12073 | { |
| 12020 | IrInstruction *cast1 = ir_analyze_cast(ira, source_instr, wanted_type->data.error_union.payload_type, value); | 12074 | IrInstruction *cast1 = ir_analyze_cast(ira, source_instr, wanted_type->data.error_union.payload_type, value, nullptr); |
| 12021 | if (type_is_invalid(cast1->value.type)) | 12075 | if (type_is_invalid(cast1->value.type)) |
| 12022 | return ira->codegen->invalid_instruction; | 12076 | return ira->codegen->invalid_instruction; |
| 12023 | | 12077 | |
| 12024 | IrInstruction *cast2 = ir_analyze_cast(ira, source_instr, wanted_type, cast1); | 12078 | IrInstruction *cast2 = ir_analyze_cast(ira, source_instr, wanted_type, cast1, result_loc); |
| 12025 | if (type_is_invalid(cast2->value.type)) | 12079 | if (type_is_invalid(cast2->value.type)) |
| 12026 | return ira->codegen->invalid_instruction; | 12080 | return ira->codegen->invalid_instruction; |
| 12027 | | 12081 | |
| ... | @@ -12103,7 +12157,7 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst | ... | @@ -12103,7 +12157,7 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst |
| 12103 | types_match_const_cast_only(ira, ptr_type->data.pointer.child_type, actual_type->data.array.child_type, | 12157 | types_match_const_cast_only(ira, ptr_type->data.pointer.child_type, actual_type->data.array.child_type, |
| 12104 | source_node, false).id == ConstCastResultIdOk) | 12158 | source_node, false).id == ConstCastResultIdOk) |
| 12105 | { | 12159 | { |
| 12106 | return ir_analyze_array_to_slice(ira, source_instr, value, wanted_type); | 12160 | return ir_analyze_array_to_slice(ira, source_instr, value, wanted_type, result_loc); |
| 12107 | } | 12161 | } |
| 12108 | } | 12162 | } |
| 12109 | | 12163 | |
| ... | @@ -12120,11 +12174,11 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst | ... | @@ -12120,11 +12174,11 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst |
| 12120 | types_match_const_cast_only(ira, ptr_type->data.pointer.child_type, actual_type->data.array.child_type, | 12174 | types_match_const_cast_only(ira, ptr_type->data.pointer.child_type, actual_type->data.array.child_type, |
| 12121 | source_node, false).id == ConstCastResultIdOk) | 12175 | source_node, false).id == ConstCastResultIdOk) |
| 12122 | { | 12176 | { |
| 12123 | IrInstruction *cast1 = ir_analyze_cast(ira, source_instr, wanted_type->data.maybe.child_type, value); | 12177 | IrInstruction *cast1 = ir_analyze_cast(ira, source_instr, wanted_type->data.maybe.child_type, value, nullptr); |
| 12124 | if (type_is_invalid(cast1->value.type)) | 12178 | if (type_is_invalid(cast1->value.type)) |
| 12125 | return ira->codegen->invalid_instruction; | 12179 | return ira->codegen->invalid_instruction; |
| 12126 | | 12180 | |
| 12127 | IrInstruction *cast2 = ir_analyze_cast(ira, source_instr, wanted_type, cast1); | 12181 | IrInstruction *cast2 = ir_analyze_cast(ira, source_instr, wanted_type, cast1, result_loc); |
| 12128 | if (type_is_invalid(cast2->value.type)) | 12182 | if (type_is_invalid(cast2->value.type)) |
| 12129 | return ira->codegen->invalid_instruction; | 12183 | return ira->codegen->invalid_instruction; |
| 12130 | | 12184 | |
| ... | @@ -12167,7 +12221,7 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst | ... | @@ -12167,7 +12221,7 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst |
| 12167 | array_type->data.array.child_type, source_node, | 12221 | array_type->data.array.child_type, source_node, |
| 12168 | !slice_ptr_type->data.pointer.is_const).id == ConstCastResultIdOk) | 12222 | !slice_ptr_type->data.pointer.is_const).id == ConstCastResultIdOk) |
| 12169 | { | 12223 | { |
| 12170 | return ir_resolve_ptr_of_array_to_slice(ira, source_instr, value, wanted_type); | 12224 | return ir_resolve_ptr_of_array_to_slice(ira, source_instr, value, wanted_type, result_loc); |
| 12171 | } | 12225 | } |
| 12172 | } | 12226 | } |
| 12173 | | 12227 | |
| ... | @@ -12198,11 +12252,11 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst | ... | @@ -12198,11 +12252,11 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst |
| 12198 | types_match_const_cast_only(ira, ptr_type->data.pointer.child_type, actual_type->data.array.child_type, | 12252 | types_match_const_cast_only(ira, ptr_type->data.pointer.child_type, actual_type->data.array.child_type, |
| 12199 | source_node, false).id == ConstCastResultIdOk) | 12253 | source_node, false).id == ConstCastResultIdOk) |
| 12200 | { | 12254 | { |
| 12201 | IrInstruction *cast1 = ir_analyze_cast(ira, source_instr, wanted_type->data.error_union.payload_type, value); | 12255 | IrInstruction *cast1 = ir_analyze_cast(ira, source_instr, wanted_type->data.error_union.payload_type, value, nullptr); |
| 12202 | if (type_is_invalid(cast1->value.type)) | 12256 | if (type_is_invalid(cast1->value.type)) |
| 12203 | return ira->codegen->invalid_instruction; | 12257 | return ira->codegen->invalid_instruction; |
| 12204 | | 12258 | |
| 12205 | IrInstruction *cast2 = ir_analyze_cast(ira, source_instr, wanted_type, cast1); | 12259 | IrInstruction *cast2 = ir_analyze_cast(ira, source_instr, wanted_type, cast1, result_loc); |
| 12206 | if (type_is_invalid(cast2->value.type)) | 12260 | if (type_is_invalid(cast2->value.type)) |
| 12207 | return ira->codegen->invalid_instruction; | 12261 | return ira->codegen->invalid_instruction; |
| 12208 | | 12262 | |
| ... | @@ -12380,7 +12434,9 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst | ... | @@ -12380,7 +12434,9 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst |
| 12380 | return ira->codegen->invalid_instruction; | 12434 | return ira->codegen->invalid_instruction; |
| 12381 | } | 12435 | } |
| 12382 | | 12436 | |
| 12383 | static IrInstruction *ir_implicit_cast(IrAnalyze *ira, IrInstruction *value, ZigType *expected_type) { | 12437 | static IrInstruction *ir_implicit_cast_with_result(IrAnalyze *ira, IrInstruction *value, ZigType *expected_type, |
| | 12438 | ResultLoc *result_loc) |
| | 12439 | { |
| 12384 | assert(value); | 12440 | assert(value); |
| 12385 | assert(value != ira->codegen->invalid_instruction); | 12441 | assert(value != ira->codegen->invalid_instruction); |
| 12386 | assert(!expected_type || !type_is_invalid(expected_type)); | 12442 | assert(!expected_type || !type_is_invalid(expected_type)); |
| ... | @@ -12393,7 +12449,11 @@ static IrInstruction *ir_implicit_cast(IrAnalyze *ira, IrInstruction *value, Zig | ... | @@ -12393,7 +12449,11 @@ static IrInstruction *ir_implicit_cast(IrAnalyze *ira, IrInstruction *value, Zig |
| 12393 | if (value->value.type->id == ZigTypeIdUnreachable) | 12449 | if (value->value.type->id == ZigTypeIdUnreachable) |
| 12394 | return value; | 12450 | return value; |
| 12395 | | 12451 | |
| 12396 | return ir_analyze_cast(ira, value, expected_type, value); | 12452 | return ir_analyze_cast(ira, value, expected_type, value, result_loc); |
| | 12453 | } |
| | 12454 | |
| | 12455 | static IrInstruction *ir_implicit_cast(IrAnalyze *ira, IrInstruction *value, ZigType *expected_type) { |
| | 12456 | return ir_implicit_cast_with_result(ira, value, expected_type, nullptr); |
| 12397 | } | 12457 | } |
| 12398 | | 12458 | |
| 12399 | static IrInstruction *ir_get_deref(IrAnalyze *ira, IrInstruction *source_instruction, IrInstruction *ptr) { | 12459 | static IrInstruction *ir_get_deref(IrAnalyze *ira, IrInstruction *source_instruction, IrInstruction *ptr) { |
| ... | @@ -14744,7 +14804,7 @@ static IrInstruction *ir_analyze_instruction_implicit_cast(IrAnalyze *ira, IrIns | ... | @@ -14744,7 +14804,7 @@ static IrInstruction *ir_analyze_instruction_implicit_cast(IrAnalyze *ira, IrIns |
| 14744 | if (type_is_invalid(target->value.type)) | 14804 | if (type_is_invalid(target->value.type)) |
| 14745 | return ira->codegen->invalid_instruction; | 14805 | return ira->codegen->invalid_instruction; |
| 14746 | | 14806 | |
| 14747 | return ir_implicit_cast(ira, target, dest_type); | 14807 | return ir_implicit_cast_with_result(ira, target, dest_type, instruction->result_loc); |
| 14748 | } | 14808 | } |
| 14749 | | 14809 | |
| 14750 | static IrInstruction *ir_analyze_instruction_resolve_result(IrAnalyze *ira, IrInstructionResolveResult *instruction) { | 14810 | static IrInstruction *ir_analyze_instruction_resolve_result(IrAnalyze *ira, IrInstructionResolveResult *instruction) { |
| ... | @@ -15687,7 +15747,8 @@ static IrInstruction *ir_analyze_instruction_call(IrAnalyze *ira, IrInstructionC | ... | @@ -15687,7 +15747,8 @@ static IrInstruction *ir_analyze_instruction_call(IrAnalyze *ira, IrInstructionC |
| 15687 | | 15747 | |
| 15688 | IrInstruction *arg = call_instruction->args[0]->child; | 15748 | IrInstruction *arg = call_instruction->args[0]->child; |
| 15689 | | 15749 | |
| 15690 | IrInstruction *cast_instruction = ir_analyze_cast(ira, &call_instruction->base, dest_type, arg); | 15750 | IrInstruction *cast_instruction = ir_analyze_cast(ira, &call_instruction->base, dest_type, arg, |
| | 15751 | call_instruction->result_loc); |
| 15691 | if (type_is_invalid(cast_instruction->value.type)) | 15752 | if (type_is_invalid(cast_instruction->value.type)) |
| 15692 | return ira->codegen->invalid_instruction; | 15753 | return ira->codegen->invalid_instruction; |
| 15693 | return ir_finish_anal(ira, cast_instruction); | 15754 | return ir_finish_anal(ira, cast_instruction); |
| ... | @@ -21165,7 +21226,7 @@ static IrInstruction *ir_analyze_instruction_memcpy(IrAnalyze *ira, IrInstructio | ... | @@ -21165,7 +21226,7 @@ static IrInstruction *ir_analyze_instruction_memcpy(IrAnalyze *ira, IrInstructio |
| 21165 | return result; | 21226 | return result; |
| 21166 | } | 21227 | } |
| 21167 | | 21228 | |
| 21168 | static IrInstruction *ir_analyze_instruction_slice(IrAnalyze *ira, IrInstructionSlice *instruction) { | 21229 | static IrInstruction *ir_analyze_instruction_slice(IrAnalyze *ira, IrInstructionSliceSrc *instruction) { |
| 21169 | IrInstruction *ptr_ptr = instruction->ptr->child; | 21230 | IrInstruction *ptr_ptr = instruction->ptr->child; |
| 21170 | if (type_is_invalid(ptr_ptr->value.type)) | 21231 | if (type_is_invalid(ptr_ptr->value.type)) |
| 21171 | return ira->codegen->invalid_instruction; | 21232 | return ira->codegen->invalid_instruction; |
| ... | @@ -21454,12 +21515,13 @@ static IrInstruction *ir_analyze_instruction_slice(IrAnalyze *ira, IrInstruction | ... | @@ -21454,12 +21515,13 @@ static IrInstruction *ir_analyze_instruction_slice(IrAnalyze *ira, IrInstruction |
| 21454 | return result; | 21515 | return result; |
| 21455 | } | 21516 | } |
| 21456 | | 21517 | |
| 21457 | IrInstruction *new_instruction = ir_build_slice(&ira->new_irb, | 21518 | IrInstruction *result_loc = ir_resolve_result(ira, &instruction->base, instruction->result_loc, |
| 21458 | instruction->base.scope, instruction->base.source_node, | 21519 | return_type, nullptr); |
| 21459 | ptr_ptr, casted_start, end, instruction->safety_check_on); | 21520 | if (type_is_invalid(result_loc->value.type) || instr_is_unreachable(result_loc)) { |
| 21460 | new_instruction->value.type = return_type; | 21521 | return result_loc; |
| 21461 | ir_add_alloca(ira, new_instruction, return_type); | 21522 | } |
| 21462 | return new_instruction; | 21523 | return ir_build_slice_gen(ira, &instruction->base, return_type, |
| | 21524 | ptr_ptr, casted_start, end, instruction->safety_check_on, result_loc); |
| 21463 | } | 21525 | } |
| 21464 | | 21526 | |
| 21465 | static IrInstruction *ir_analyze_instruction_member_count(IrAnalyze *ira, IrInstructionMemberCount *instruction) { | 21527 | static IrInstruction *ir_analyze_instruction_member_count(IrAnalyze *ira, IrInstructionMemberCount *instruction) { |
| ... | @@ -23900,6 +23962,7 @@ static IrInstruction *ir_analyze_instruction_base(IrAnalyze *ira, IrInstruction | ... | @@ -23900,6 +23962,7 @@ static IrInstruction *ir_analyze_instruction_base(IrAnalyze *ira, IrInstruction |
| 23900 | case IrInstructionIdCmpxchgGen: | 23962 | case IrInstructionIdCmpxchgGen: |
| 23901 | case IrInstructionIdArrayToVector: | 23963 | case IrInstructionIdArrayToVector: |
| 23902 | case IrInstructionIdVectorToArray: | 23964 | case IrInstructionIdVectorToArray: |
| | 23965 | case IrInstructionIdPtrOfArrayToSlice: |
| 23903 | case IrInstructionIdAssertZero: | 23966 | case IrInstructionIdAssertZero: |
| 23904 | case IrInstructionIdAssertNonNull: | 23967 | case IrInstructionIdAssertNonNull: |
| 23905 | case IrInstructionIdResizeSlice: | 23968 | case IrInstructionIdResizeSlice: |
| ... | @@ -23908,6 +23971,7 @@ static IrInstruction *ir_analyze_instruction_base(IrAnalyze *ira, IrInstruction | ... | @@ -23908,6 +23971,7 @@ static IrInstruction *ir_analyze_instruction_base(IrAnalyze *ira, IrInstruction |
| 23908 | case IrInstructionIdCallGen: | 23971 | case IrInstructionIdCallGen: |
| 23909 | case IrInstructionIdReturnPtr: | 23972 | case IrInstructionIdReturnPtr: |
| 23910 | case IrInstructionIdAllocaGen: | 23973 | case IrInstructionIdAllocaGen: |
| | 23974 | case IrInstructionIdSliceGen: |
| 23911 | zig_unreachable(); | 23975 | zig_unreachable(); |
| 23912 | | 23976 | |
| 23913 | case IrInstructionIdReturn: | 23977 | case IrInstructionIdReturn: |
| ... | @@ -24042,8 +24106,8 @@ static IrInstruction *ir_analyze_instruction_base(IrAnalyze *ira, IrInstruction | ... | @@ -24042,8 +24106,8 @@ static IrInstruction *ir_analyze_instruction_base(IrAnalyze *ira, IrInstruction |
| 24042 | return ir_analyze_instruction_memset(ira, (IrInstructionMemset *)instruction); | 24106 | return ir_analyze_instruction_memset(ira, (IrInstructionMemset *)instruction); |
| 24043 | case IrInstructionIdMemcpy: | 24107 | case IrInstructionIdMemcpy: |
| 24044 | return ir_analyze_instruction_memcpy(ira, (IrInstructionMemcpy *)instruction); | 24108 | return ir_analyze_instruction_memcpy(ira, (IrInstructionMemcpy *)instruction); |
| 24045 | case IrInstructionIdSlice: | 24109 | case IrInstructionIdSliceSrc: |
| 24046 | return ir_analyze_instruction_slice(ira, (IrInstructionSlice *)instruction); | 24110 | return ir_analyze_instruction_slice(ira, (IrInstructionSliceSrc *)instruction); |
| 24047 | case IrInstructionIdMemberCount: | 24111 | case IrInstructionIdMemberCount: |
| 24048 | return ir_analyze_instruction_member_count(ira, (IrInstructionMemberCount *)instruction); | 24112 | return ir_analyze_instruction_member_count(ira, (IrInstructionMemberCount *)instruction); |
| 24049 | case IrInstructionIdMemberType: | 24113 | case IrInstructionIdMemberType: |
| ... | @@ -24321,6 +24385,8 @@ bool ir_has_side_effects(IrInstruction *instruction) { | ... | @@ -24321,6 +24385,8 @@ bool ir_has_side_effects(IrInstruction *instruction) { |
| 24321 | case IrInstructionIdGlobalAsm: | 24385 | case IrInstructionIdGlobalAsm: |
| 24322 | case IrInstructionIdUndeclaredIdent: | 24386 | case IrInstructionIdUndeclaredIdent: |
| 24323 | case IrInstructionIdEndExpr: | 24387 | case IrInstructionIdEndExpr: |
| | 24388 | case IrInstructionIdPtrOfArrayToSlice: |
| | 24389 | case IrInstructionIdSliceGen: |
| 24324 | return true; | 24390 | return true; |
| 24325 | | 24391 | |
| 24326 | case IrInstructionIdPhi: | 24392 | case IrInstructionIdPhi: |
| ... | @@ -24360,7 +24426,7 @@ bool ir_has_side_effects(IrInstruction *instruction) { | ... | @@ -24360,7 +24426,7 @@ bool ir_has_side_effects(IrInstruction *instruction) { |
| 24360 | case IrInstructionIdIntType: | 24426 | case IrInstructionIdIntType: |
| 24361 | case IrInstructionIdVectorType: | 24427 | case IrInstructionIdVectorType: |
| 24362 | case IrInstructionIdBoolNot: | 24428 | case IrInstructionIdBoolNot: |
| 24363 | case IrInstructionIdSlice: | 24429 | case IrInstructionIdSliceSrc: |
| 24364 | case IrInstructionIdMemberCount: | 24430 | case IrInstructionIdMemberCount: |
| 24365 | case IrInstructionIdMemberType: | 24431 | case IrInstructionIdMemberType: |
| 24366 | case IrInstructionIdMemberName: | 24432 | case IrInstructionIdMemberName: |