| ... | @@ -2761,6 +2761,8 @@ fn genInst(cg: *CodeGen, inst: Air.Inst.Index) Error!void { | ... | @@ -2761,6 +2761,8 @@ fn genInst(cg: *CodeGen, inst: Air.Inst.Index) Error!void { |
| 2761 | .struct_field_val => try cg.airStructFieldVal(inst), | 2761 | .struct_field_val => try cg.airStructFieldVal(inst), |
| 2762 | .field_parent_ptr => try cg.airFieldParentPtr(inst), | 2762 | .field_parent_ptr => try cg.airFieldParentPtr(inst), |
| 2763 | | 2763 | |
| | 2764 | .struct_field_ptr => try cg.airStructFieldPtr(inst), |
| | 2765 | |
| 2764 | .struct_field_ptr_index_0 => try cg.airStructFieldPtrIndex(inst, 0), | 2766 | .struct_field_ptr_index_0 => try cg.airStructFieldPtrIndex(inst, 0), |
| 2765 | .struct_field_ptr_index_1 => try cg.airStructFieldPtrIndex(inst, 1), | 2767 | .struct_field_ptr_index_1 => try cg.airStructFieldPtrIndex(inst, 1), |
| 2766 | .struct_field_ptr_index_2 => try cg.airStructFieldPtrIndex(inst, 2), | 2768 | .struct_field_ptr_index_2 => try cg.airStructFieldPtrIndex(inst, 2), |
| ... | @@ -4806,6 +4808,15 @@ fn structFieldPtr( | ... | @@ -4806,6 +4808,15 @@ fn structFieldPtr( |
| 4806 | } | 4808 | } |
| 4807 | } | 4809 | } |
| 4808 | | 4810 | |
| | 4811 | fn airStructFieldPtr(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| | 4812 | const ty_pl = cg.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; |
| | 4813 | const struct_field = cg.air.extraData(Air.StructField, ty_pl.payload).data; |
| | 4814 | const struct_ptr = try cg.resolve(struct_field.struct_operand); |
| | 4815 | const struct_ptr_ty = cg.typeOf(struct_field.struct_operand); |
| | 4816 | const result_ptr_ty = cg.typeOfIndex(inst); |
| | 4817 | return try cg.structFieldPtr(result_ptr_ty, struct_ptr_ty, struct_ptr, struct_field.field_index); |
| | 4818 | } |
| | 4819 | |
| 4809 | fn airStructFieldPtrIndex(cg: *CodeGen, inst: Air.Inst.Index, field_index: u32) !?Id { | 4820 | fn airStructFieldPtrIndex(cg: *CodeGen, inst: Air.Inst.Index, field_index: u32) !?Id { |
| 4810 | const ty_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | 4821 | const ty_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; |
| 4811 | const struct_ptr = try cg.resolve(ty_op.operand); | 4822 | const struct_ptr = try cg.resolve(ty_op.operand); |