authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-06-03 21:40:56-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-06-03 21:40:56-04:00
log143d6ada8f93872b94a8f20927e11cae243028d9
tree779fd513b42ed24ecd9d37ba3122e78ad8ca0df8
parentd4054e35fe3a6ba4b4f0d1a0da0e0149f21b49a4
signature Commit is signed but in an unrecognized format.

no-copy semantics for for loops

Note that only the index variable requires a stack allocation, and the memcpy for the element is gone. ```zig export fn entry() void { var buf: [10]i32 = undefined; for (buf) |x| {} } ``` ```llvm define void @entry() #2 !dbg !35 { Entry: %buf = alloca [10 x i32], align 4 %i = alloca i64, align 8 %0 = bitcast [10 x i32]* %buf to i8*, !dbg !47 call void @llvm.memset.p0i8.i64(i8* align 4 %0, i8 -86, i64 40, i1 false), !dbg !47 call void @llvm.dbg.declare(metadata [10 x i32]* %buf, metadata !39, metadata !DIExpression()), !dbg !47 store i64 0, i64* %i, align 8, !dbg !48 call void @llvm.dbg.declare(metadata i64* %i, metadata !45, metadata !DIExpression()), !dbg !48 br label %ForCond, !dbg !48 ForCond: ; preds = %ForBody, %Entry %1 = load i64, i64* %i, align 8, !dbg !48 %2 = icmp ult i64 %1, 10, !dbg !48 br i1 %2, label %ForBody, label %ForEnd, !dbg !48 ForBody: ; preds = %ForCond %3 = getelementptr inbounds [10 x i32], [10 x i32]* %buf, i64 0, i64 %1, !dbg !48 call void @llvm.dbg.declare(metadata i32* %3, metadata !46, metadata !DIExpression()), !dbg !49 %4 = add nuw i64 %1, 1, !dbg !48 store i64 %4, i64* %i, align 8, !dbg !48 br label %ForCond, !dbg !48 ForEnd: ; preds = %ForCond ret void, !dbg !50 } ```

5 files changed, 44 insertions(+), 178 deletions(-)

BRANCH_TODO-1
...@@ -3,7 +3,6 @@ Scratch pad for stuff to do before merging master...@@ -3,7 +3,6 @@ Scratch pad for stuff to do before merging master
33
4migrate ir_build_var_decl_src to use ir_build_alloca_src and explicitly initialize4migrate ir_build_var_decl_src to use ir_build_alloca_src and explicitly initialize
55
6 * for loops
7 * switch expression6 * switch expression
8 * struct initializations7 * struct initializations
9 * function call parameters8 * function call parameters
src/all_types.hpp-14
...@@ -2191,8 +2191,6 @@ enum IrInstructionId {...@@ -2191,8 +2191,6 @@ enum IrInstructionId {
2191 IrInstructionIdUnionInit,2191 IrInstructionIdUnionInit,
2192 IrInstructionIdUnreachable,2192 IrInstructionIdUnreachable,
2193 IrInstructionIdTypeOf,2193 IrInstructionIdTypeOf,
2194 IrInstructionIdToPtrType,
2195 IrInstructionIdPtrTypeChild,
2196 IrInstructionIdSetCold,2194 IrInstructionIdSetCold,
2197 IrInstructionIdSetRuntimeSafety,2195 IrInstructionIdSetRuntimeSafety,
2198 IrInstructionIdSetFloatMode,2196 IrInstructionIdSetFloatMode,
...@@ -2679,18 +2677,6 @@ struct IrInstructionTypeOf {...@@ -2679,18 +2677,6 @@ struct IrInstructionTypeOf {
2679 IrInstruction *value;2677 IrInstruction *value;
2680};2678};
26812679
2682struct IrInstructionToPtrType {
2683 IrInstruction base;
2684
2685 IrInstruction *ptr;
2686};
2687
2688struct IrInstructionPtrTypeChild {
2689 IrInstruction base;
2690
2691 IrInstruction *value;
2692};
2693
2694struct IrInstructionSetCold {2680struct IrInstructionSetCold {
2695 IrInstruction base;2681 IrInstruction base;
26962682
src/codegen.cpp-2
...@@ -5539,8 +5539,6 @@ static LLVMValueRef ir_render_instruction(CodeGen *g, IrExecutable *executable,...@@ -5539,8 +5539,6 @@ static LLVMValueRef ir_render_instruction(CodeGen *g, IrExecutable *executable,
5539 case IrInstructionIdInvalid:5539 case IrInstructionIdInvalid:
5540 case IrInstructionIdConst:5540 case IrInstructionIdConst:
5541 case IrInstructionIdTypeOf:5541 case IrInstructionIdTypeOf:
5542 case IrInstructionIdToPtrType:
5543 case IrInstructionIdPtrTypeChild:
5544 case IrInstructionIdFieldPtr:5542 case IrInstructionIdFieldPtr:
5545 case IrInstructionIdSetCold:5543 case IrInstructionIdSetCold:
5546 case IrInstructionIdSetRuntimeSafety:5544 case IrInstructionIdSetRuntimeSafety:
src/ir.cpp+44-143
...@@ -523,14 +523,6 @@ static constexpr IrInstructionId ir_instruction_id(IrInstructionTypeOf *) {...@@ -523,14 +523,6 @@ static constexpr IrInstructionId ir_instruction_id(IrInstructionTypeOf *) {
523 return IrInstructionIdTypeOf;523 return IrInstructionIdTypeOf;
524}524}
525525
526static constexpr IrInstructionId ir_instruction_id(IrInstructionToPtrType *) {
527 return IrInstructionIdToPtrType;
528}
529
530static constexpr IrInstructionId ir_instruction_id(IrInstructionPtrTypeChild *) {
531 return IrInstructionIdPtrTypeChild;
532}
533
534static constexpr IrInstructionId ir_instruction_id(IrInstructionSetCold *) {526static constexpr IrInstructionId ir_instruction_id(IrInstructionSetCold *) {
535 return IrInstructionIdSetCold;527 return IrInstructionIdSetCold;
536}528}
...@@ -1657,27 +1649,6 @@ static IrInstruction *ir_build_typeof(IrBuilder *irb, Scope *scope, AstNode *sou...@@ -1657,27 +1649,6 @@ static IrInstruction *ir_build_typeof(IrBuilder *irb, Scope *scope, AstNode *sou
1657 return &instruction->base;1649 return &instruction->base;
1658}1650}
16591651
1660static IrInstruction *ir_build_to_ptr_type(IrBuilder *irb, Scope *scope, AstNode *source_node, IrInstruction *ptr) {
1661 IrInstructionToPtrType *instruction = ir_build_instruction<IrInstructionToPtrType>(irb, scope, source_node);
1662 instruction->ptr = ptr;
1663
1664 ir_ref_instruction(ptr, irb->current_basic_block);
1665
1666 return &instruction->base;
1667}
1668
1669static IrInstruction *ir_build_ptr_type_child(IrBuilder *irb, Scope *scope, AstNode *source_node,
1670 IrInstruction *value)
1671{
1672 IrInstructionPtrTypeChild *instruction = ir_build_instruction<IrInstructionPtrTypeChild>(
1673 irb, scope, source_node);
1674 instruction->value = value;
1675
1676 ir_ref_instruction(value, irb->current_basic_block);
1677
1678 return &instruction->base;
1679}
1680
1681static IrInstruction *ir_build_set_cold(IrBuilder *irb, Scope *scope, AstNode *source_node, IrInstruction *is_cold) {1652static IrInstruction *ir_build_set_cold(IrBuilder *irb, Scope *scope, AstNode *source_node, IrInstruction *is_cold) {
1682 IrInstructionSetCold *instruction = ir_build_instruction<IrInstructionSetCold>(irb, scope, source_node);1653 IrInstructionSetCold *instruction = ir_build_instruction<IrInstructionSetCold>(irb, scope, source_node);
1683 instruction->is_cold = is_cold;1654 instruction->is_cold = is_cold;
...@@ -5611,6 +5582,14 @@ static IrInstruction *ir_gen_container_init_expr(IrBuilder *irb, Scope *scope, A...@@ -5611,6 +5582,14 @@ static IrInstruction *ir_gen_container_init_expr(IrBuilder *irb, Scope *scope, A
5611 }5582 }
5612}5583}
56135584
5585static ResultLocVar *create_var_result_loc(IrInstruction *alloca, ZigVar *var) {
5586 ResultLocVar *result_loc_var = allocate<ResultLocVar>(1);
5587 result_loc_var->base.id = ResultLocIdVar;
5588 result_loc_var->base.source_instruction = alloca;
5589 result_loc_var->var = var;
5590 return result_loc_var;
5591}
5592
5614static IrInstruction *ir_gen_var_decl(IrBuilder *irb, Scope *scope, AstNode *node) {5593static IrInstruction *ir_gen_var_decl(IrBuilder *irb, Scope *scope, AstNode *node) {
5615 assert(node->type == NodeTypeVariableDeclaration);5594 assert(node->type == NodeTypeVariableDeclaration);
56165595
...@@ -5669,10 +5648,7 @@ static IrInstruction *ir_gen_var_decl(IrBuilder *irb, Scope *scope, AstNode *nod...@@ -5669,10 +5648,7 @@ static IrInstruction *ir_gen_var_decl(IrBuilder *irb, Scope *scope, AstNode *nod
5669 buf_ptr(variable_declaration->symbol), is_comptime);5648 buf_ptr(variable_declaration->symbol), is_comptime);
56705649
5671 // Create a result location for the initialization expression.5650 // Create a result location for the initialization expression.
5672 ResultLocVar *result_loc_var = allocate<ResultLocVar>(1);5651 ResultLocVar *result_loc_var = create_var_result_loc(alloca, var);
5673 result_loc_var->base.id = ResultLocIdVar;
5674 result_loc_var->base.source_instruction = alloca;
5675 result_loc_var->var = var;
5676 ResultLoc *init_result_loc = (type_instruction == nullptr) ? &result_loc_var->base : nullptr;5652 ResultLoc *init_result_loc = (type_instruction == nullptr) ? &result_loc_var->base : nullptr;
56775653
5678 // Temporarily set the name of the IrExecutable to the VariableDeclaration5654 // Temporarily set the name of the IrExecutable to the VariableDeclaration
...@@ -5975,73 +5951,62 @@ static IrInstruction *ir_gen_for_expr(IrBuilder *irb, Scope *parent_scope, AstNo...@@ -5975,73 +5951,62 @@ static IrInstruction *ir_gen_for_expr(IrBuilder *irb, Scope *parent_scope, AstNo
5975 if (array_val_ptr == irb->codegen->invalid_instruction)5951 if (array_val_ptr == irb->codegen->invalid_instruction)
5976 return array_val_ptr;5952 return array_val_ptr;
59775953
5978 IrInstruction *pointer_type = ir_build_to_ptr_type(irb, parent_scope, array_node, array_val_ptr);
5979
5980 IrInstruction *elem_var_type;
5981 if (node->data.for_expr.elem_is_ptr) {
5982 elem_var_type = pointer_type;
5983 } else {
5984 elem_var_type = ir_build_ptr_type_child(irb, parent_scope, elem_node, pointer_type);
5985 }
5986
5987 IrInstruction *is_comptime = ir_build_const_bool(irb, parent_scope, node,5954 IrInstruction *is_comptime = ir_build_const_bool(irb, parent_scope, node,
5988 ir_should_inline(irb->exec, parent_scope) || node->data.for_expr.is_inline);5955 ir_should_inline(irb->exec, parent_scope) || node->data.for_expr.is_inline);
59895956
5990 // TODO make it an error to write to element variable or i variable.
5991 Buf *elem_var_name = elem_node->data.symbol_expr.symbol;
5992 ZigVar *elem_var = ir_create_var(irb, elem_node, parent_scope, elem_var_name, true, false, false, is_comptime);
5993 Scope *child_scope = elem_var->child_scope;
5994
5995 IrInstruction *undef = ir_build_const_undefined(irb, parent_scope, elem_node);
5996 IrInstruction *undef_elem_var_type = ir_build_implicit_cast(irb, parent_scope, elem_node, elem_var_type, undef);
5997 ir_build_var_decl_src(irb, child_scope, elem_node, elem_var, nullptr, undef_elem_var_type);
5998 IrInstruction *elem_var_ptr = ir_build_var_ptr(irb, child_scope, node, elem_var);
5999
6000 AstNode *index_var_source_node;5957 AstNode *index_var_source_node;
6001 ZigVar *index_var;5958 ZigVar *index_var;
5959 const char *index_var_name;
6002 if (index_node) {5960 if (index_node) {
6003 index_var_source_node = index_node;5961 index_var_source_node = index_node;
6004 Buf *index_var_name = index_node->data.symbol_expr.symbol;5962 Buf *index_var_name_buf = index_node->data.symbol_expr.symbol;
6005 index_var = ir_create_var(irb, index_node, child_scope, index_var_name, true, false, false, is_comptime);5963 index_var = ir_create_var(irb, index_node, parent_scope, index_var_name_buf, true, false, false, is_comptime);
5964 index_var_name = buf_ptr(index_var_name_buf);
6006 } else {5965 } else {
6007 index_var_source_node = node;5966 index_var_source_node = node;
6008 index_var = ir_create_var(irb, node, child_scope, nullptr, true, false, true, is_comptime);5967 index_var = ir_create_var(irb, node, parent_scope, nullptr, true, false, true, is_comptime);
5968 index_var_name = "i";
6009 }5969 }
6010 child_scope = index_var->child_scope;5970 parent_scope = index_var->parent_scope;
60115971
6012 IrInstruction *zero = ir_build_const_usize(irb, child_scope, node, 0);5972 IrInstruction *index_alloca = ir_build_alloca_src(irb, parent_scope, node, nullptr, index_var_name, is_comptime);
6013 IrInstruction *one = ir_build_const_usize(irb, child_scope, node, 1);5973 ResultLocVar *var_result_loc = create_var_result_loc(index_alloca, index_var);
6014 ir_build_var_decl_src(irb, child_scope, index_var_source_node, index_var, nullptr, zero);5974 IrInstruction *zero = ir_build_const_usize(irb, parent_scope, node, 0);
6015 IrInstruction *index_ptr = ir_build_var_ptr(irb, child_scope, node, index_var);5975 ir_build_end_expr(irb, parent_scope, node, zero, &var_result_loc->base);
5976 ir_build_var_decl_src(irb, parent_scope, index_var_source_node, index_var, nullptr, index_alloca);
60165977
5978 IrInstruction *one = ir_build_const_usize(irb, parent_scope, node, 1);
5979 IrInstruction *index_ptr = ir_build_var_ptr(irb, parent_scope, node, index_var);
60175980
6018 IrBasicBlock *cond_block = ir_create_basic_block(irb, child_scope, "ForCond");5981
6019 IrBasicBlock *body_block = ir_create_basic_block(irb, child_scope, "ForBody");5982 IrBasicBlock *cond_block = ir_create_basic_block(irb, parent_scope, "ForCond");
6020 IrBasicBlock *end_block = ir_create_basic_block(irb, child_scope, "ForEnd");5983 IrBasicBlock *body_block = ir_create_basic_block(irb, parent_scope, "ForBody");
6021 IrBasicBlock *else_block = else_node ? ir_create_basic_block(irb, child_scope, "ForElse") : end_block;5984 IrBasicBlock *end_block = ir_create_basic_block(irb, parent_scope, "ForEnd");
6022 IrBasicBlock *continue_block = ir_create_basic_block(irb, child_scope, "ForContinue");5985 IrBasicBlock *else_block = else_node ? ir_create_basic_block(irb, parent_scope, "ForElse") : end_block;
5986 IrBasicBlock *continue_block = ir_create_basic_block(irb, parent_scope, "ForContinue");
60235987
6024 Buf *len_field_name = buf_create_from_str("len");5988 Buf *len_field_name = buf_create_from_str("len");
6025 IrInstruction *len_ref = ir_build_field_ptr(irb, child_scope, node, array_val_ptr, len_field_name);5989 IrInstruction *len_ref = ir_build_field_ptr(irb, parent_scope, node, array_val_ptr, len_field_name);
6026 IrInstruction *len_val = ir_build_load_ptr(irb, child_scope, node, len_ref);5990 IrInstruction *len_val = ir_build_load_ptr(irb, parent_scope, node, len_ref);
6027 ir_build_br(irb, child_scope, node, cond_block, is_comptime);5991 ir_build_br(irb, parent_scope, node, cond_block, is_comptime);
60285992
6029 ir_set_cursor_at_end_and_append_block(irb, cond_block);5993 ir_set_cursor_at_end_and_append_block(irb, cond_block);
6030 IrInstruction *index_val = ir_build_load_ptr(irb, child_scope, node, index_ptr);5994 IrInstruction *index_val = ir_build_load_ptr(irb, parent_scope, node, index_ptr);
6031 IrInstruction *cond = ir_build_bin_op(irb, child_scope, node, IrBinOpCmpLessThan, index_val, len_val, false);5995 IrInstruction *cond = ir_build_bin_op(irb, parent_scope, node, IrBinOpCmpLessThan, index_val, len_val, false);
6032 IrBasicBlock *after_cond_block = irb->current_basic_block;5996 IrBasicBlock *after_cond_block = irb->current_basic_block;
6033 IrInstruction *void_else_value = else_node ? nullptr : ir_mark_gen(ir_build_const_void(irb, parent_scope, node));5997 IrInstruction *void_else_value = else_node ? nullptr : ir_mark_gen(ir_build_const_void(irb, parent_scope, node));
6034 ir_mark_gen(ir_build_cond_br(irb, child_scope, node, cond, body_block, else_block, is_comptime));5998 ir_mark_gen(ir_build_cond_br(irb, parent_scope, node, cond, body_block, else_block, is_comptime));
60355999
6036 ir_set_cursor_at_end_and_append_block(irb, body_block);6000 ir_set_cursor_at_end_and_append_block(irb, body_block);
6037 IrInstruction *elem_ptr = ir_build_elem_ptr(irb, child_scope, node, array_val_ptr, index_val, false, PtrLenSingle);6001 IrInstruction *elem_ptr = ir_build_elem_ptr(irb, parent_scope, node, array_val_ptr, index_val, false, PtrLenSingle);
6038 IrInstruction *elem_val;6002 // TODO make it an error to write to element variable or i variable.
6039 if (node->data.for_expr.elem_is_ptr) {6003 Buf *elem_var_name = elem_node->data.symbol_expr.symbol;
6040 elem_val = elem_ptr;6004 ZigVar *elem_var = ir_create_var(irb, elem_node, parent_scope, elem_var_name, true, false, false, is_comptime);
6041 } else {6005 Scope *child_scope = elem_var->child_scope;
6042 elem_val = ir_build_load_ptr(irb, child_scope, node, elem_ptr);6006
6043 }6007 IrInstruction *var_ptr = node->data.for_expr.elem_is_ptr ?
6044 ir_mark_gen(ir_build_store_ptr(irb, child_scope, node, elem_var_ptr, elem_val));6008 ir_build_ref(irb, parent_scope, elem_node, elem_ptr, true, false) : elem_ptr;
6009 ir_build_var_decl_src(irb, parent_scope, elem_node, elem_var, nullptr, var_ptr);
60456010
6046 ZigList<IrInstruction *> incoming_values = {0};6011 ZigList<IrInstruction *> incoming_values = {0};
6047 ZigList<IrBasicBlock *> incoming_blocks = {0};6012 ZigList<IrBasicBlock *> incoming_blocks = {0};
...@@ -16901,64 +16866,6 @@ static IrInstruction *ir_analyze_instruction_typeof(IrAnalyze *ira, IrInstructio...@@ -16901,64 +16866,6 @@ static IrInstruction *ir_analyze_instruction_typeof(IrAnalyze *ira, IrInstructio
16901 return ir_const_type(ira, &typeof_instruction->base, type_entry);16866 return ir_const_type(ira, &typeof_instruction->base, type_entry);
16902}16867}
1690316868
16904static IrInstruction *ir_analyze_instruction_to_ptr_type(IrAnalyze *ira,
16905 IrInstructionToPtrType *to_ptr_type_instruction)
16906{
16907 Error err;
16908 IrInstruction *ptr_ptr = to_ptr_type_instruction->ptr->child;
16909 if (type_is_invalid(ptr_ptr->value.type))
16910 return ira->codegen->invalid_instruction;
16911
16912 ZigType *ptr_ptr_type = ptr_ptr->value.type;
16913 assert(ptr_ptr_type->id == ZigTypeIdPointer);
16914 ZigType *type_entry = ptr_ptr_type->data.pointer.child_type;
16915
16916 ZigType *ptr_type;
16917 if (type_entry->id == ZigTypeIdArray) {
16918 ptr_type = get_pointer_to_type(ira->codegen, type_entry->data.array.child_type, ptr_ptr_type->data.pointer.is_const);
16919 } else if (is_array_ref(type_entry)) {
16920 ptr_type = get_pointer_to_type(ira->codegen,
16921 type_entry->data.pointer.child_type->data.array.child_type, type_entry->data.pointer.is_const);
16922 } else if (is_slice(type_entry)) {
16923 ZigType *slice_ptr_type = type_entry->data.structure.fields[0].type_entry;
16924 ptr_type = adjust_ptr_len(ira->codegen, slice_ptr_type, PtrLenSingle);
16925 // If the pointer is over-aligned, we may have to reduce it based on the alignment of the element type.
16926 if (slice_ptr_type->data.pointer.explicit_alignment != 0) {
16927 ZigType *elem_type = slice_ptr_type->data.pointer.child_type;
16928 if ((err = type_resolve(ira->codegen, elem_type, ResolveStatusAlignmentKnown)))
16929 return ira->codegen->invalid_instruction;
16930 uint32_t elem_align = get_abi_alignment(ira->codegen, elem_type);
16931 uint32_t reduced_align = min(elem_align, slice_ptr_type->data.pointer.explicit_alignment);
16932 ptr_type = adjust_ptr_align(ira->codegen, ptr_type, reduced_align);
16933 }
16934 } else if (type_entry->id == ZigTypeIdArgTuple) {
16935 zig_panic("TODO for loop on var args");
16936 } else {
16937 ir_add_error_node(ira, to_ptr_type_instruction->base.source_node,
16938 buf_sprintf("expected array type, found '%s'", buf_ptr(&type_entry->name)));
16939 return ira->codegen->invalid_instruction;
16940 }
16941
16942 return ir_const_type(ira, &to_ptr_type_instruction->base, ptr_type);
16943}
16944
16945static IrInstruction *ir_analyze_instruction_ptr_type_child(IrAnalyze *ira,
16946 IrInstructionPtrTypeChild *ptr_type_child_instruction)
16947{
16948 IrInstruction *type_value = ptr_type_child_instruction->value->child;
16949 ZigType *type_entry = ir_resolve_type(ira, type_value);
16950 if (type_is_invalid(type_entry))
16951 return ira->codegen->invalid_instruction;
16952
16953 if (type_entry->id != ZigTypeIdPointer) {
16954 ir_add_error_node(ira, ptr_type_child_instruction->base.source_node,
16955 buf_sprintf("expected pointer type, found '%s'", buf_ptr(&type_entry->name)));
16956 return ira->codegen->invalid_instruction;
16957 }
16958
16959 return ir_const_type(ira, &ptr_type_child_instruction->base, type_entry->data.pointer.child_type);
16960}
16961
16962static IrInstruction *ir_analyze_instruction_set_cold(IrAnalyze *ira, IrInstructionSetCold *instruction) {16869static IrInstruction *ir_analyze_instruction_set_cold(IrAnalyze *ira, IrInstructionSetCold *instruction) {
16963 if (ira->new_irb.exec->is_inline) {16870 if (ira->new_irb.exec->is_inline) {
16964 // ignore setCold when running functions at compile time16871 // ignore setCold when running functions at compile time
...@@ -23751,10 +23658,6 @@ static IrInstruction *ir_analyze_instruction_base(IrAnalyze *ira, IrInstruction...@@ -23751,10 +23658,6 @@ static IrInstruction *ir_analyze_instruction_base(IrAnalyze *ira, IrInstruction
23751 return ir_analyze_instruction_phi(ira, (IrInstructionPhi *)instruction);23658 return ir_analyze_instruction_phi(ira, (IrInstructionPhi *)instruction);
23752 case IrInstructionIdTypeOf:23659 case IrInstructionIdTypeOf:
23753 return ir_analyze_instruction_typeof(ira, (IrInstructionTypeOf *)instruction);23660 return ir_analyze_instruction_typeof(ira, (IrInstructionTypeOf *)instruction);
23754 case IrInstructionIdToPtrType:
23755 return ir_analyze_instruction_to_ptr_type(ira, (IrInstructionToPtrType *)instruction);
23756 case IrInstructionIdPtrTypeChild:
23757 return ir_analyze_instruction_ptr_type_child(ira, (IrInstructionPtrTypeChild *)instruction);
23758 case IrInstructionIdSetCold:23661 case IrInstructionIdSetCold:
23759 return ir_analyze_instruction_set_cold(ira, (IrInstructionSetCold *)instruction);23662 return ir_analyze_instruction_set_cold(ira, (IrInstructionSetCold *)instruction);
23760 case IrInstructionIdSetRuntimeSafety:23663 case IrInstructionIdSetRuntimeSafety:
...@@ -24152,8 +24055,6 @@ bool ir_has_side_effects(IrInstruction *instruction) {...@@ -24152,8 +24055,6 @@ bool ir_has_side_effects(IrInstruction *instruction) {
24152 case IrInstructionIdVarPtr:24055 case IrInstructionIdVarPtr:
24153 case IrInstructionIdReturnPtr:24056 case IrInstructionIdReturnPtr:
24154 case IrInstructionIdTypeOf:24057 case IrInstructionIdTypeOf:
24155 case IrInstructionIdToPtrType:
24156 case IrInstructionIdPtrTypeChild:
24157 case IrInstructionIdStructFieldPtr:24058 case IrInstructionIdStructFieldPtr:
24158 case IrInstructionIdUnionFieldPtr:24059 case IrInstructionIdUnionFieldPtr:
24159 case IrInstructionIdArrayType:24060 case IrInstructionIdArrayType:
src/ir_print.cpp-18
...@@ -414,18 +414,6 @@ static void ir_print_typeof(IrPrint *irp, IrInstructionTypeOf *instruction) {...@@ -414,18 +414,6 @@ static void ir_print_typeof(IrPrint *irp, IrInstructionTypeOf *instruction) {
414 fprintf(irp->f, ")");414 fprintf(irp->f, ")");
415}415}
416416
417static void ir_print_to_ptr_type(IrPrint *irp, IrInstructionToPtrType *instruction) {
418 fprintf(irp->f, "@toPtrType(");
419 ir_print_other_instruction(irp, instruction->ptr);
420 fprintf(irp->f, ")");
421}
422
423static void ir_print_ptr_type_child(IrPrint *irp, IrInstructionPtrTypeChild *instruction) {
424 fprintf(irp->f, "@ptrTypeChild(");
425 ir_print_other_instruction(irp, instruction->value);
426 fprintf(irp->f, ")");
427}
428
429static void ir_print_field_ptr(IrPrint *irp, IrInstructionFieldPtr *instruction) {417static void ir_print_field_ptr(IrPrint *irp, IrInstructionFieldPtr *instruction) {
430 if (instruction->field_name_buffer) {418 if (instruction->field_name_buffer) {
431 fprintf(irp->f, "fieldptr ");419 fprintf(irp->f, "fieldptr ");
...@@ -1625,12 +1613,6 @@ static void ir_print_instruction(IrPrint *irp, IrInstruction *instruction) {...@@ -1625,12 +1613,6 @@ static void ir_print_instruction(IrPrint *irp, IrInstruction *instruction) {
1625 case IrInstructionIdTypeOf:1613 case IrInstructionIdTypeOf:
1626 ir_print_typeof(irp, (IrInstructionTypeOf *)instruction);1614 ir_print_typeof(irp, (IrInstructionTypeOf *)instruction);
1627 break;1615 break;
1628 case IrInstructionIdToPtrType:
1629 ir_print_to_ptr_type(irp, (IrInstructionToPtrType *)instruction);
1630 break;
1631 case IrInstructionIdPtrTypeChild:
1632 ir_print_ptr_type_child(irp, (IrInstructionPtrTypeChild *)instruction);
1633 break;
1634 case IrInstructionIdFieldPtr:1616 case IrInstructionIdFieldPtr:
1635 ir_print_field_ptr(irp, (IrInstructionFieldPtr *)instruction);1617 ir_print_field_ptr(irp, (IrInstructionFieldPtr *)instruction);
1636 break;1618 break;