| ... | ... | @@ -1703,9 +1703,18 @@ fn airStructFieldVal(self: *Self, inst: Air.Inst.Index) !void { |
| 1703 | 1703 | const struct_field_offset = @intCast(u32, struct_ty.structFieldOffset(index, self.target.*)); |
| 1704 | 1704 | const struct_field_ty = struct_ty.structFieldType(index); |
| 1705 | 1705 | const struct_field_size = @intCast(u32, struct_field_ty.abiSize(self.target.*)); |
| 1706 | const adjusted_field_offset = struct_size - struct_field_offset - struct_field_size; |
| 1707 | |
| 1706 | 1708 | switch (mcv) { |
| 1709 | .dead, .unreach => unreachable, |
| 1710 | .stack_argument_offset => |off| { |
| 1711 | break :result MCValue{ .stack_argument_offset = off + adjusted_field_offset }; |
| 1712 | }, |
| 1707 | 1713 | .stack_offset => |off| { |
| 1708 | | break :result MCValue{ .stack_offset = off + struct_size - struct_field_offset - struct_field_size }; |
| 1714 | break :result MCValue{ .stack_offset = off + adjusted_field_offset }; |
| 1715 | }, |
| 1716 | .memory => |addr| { |
| 1717 | break :result MCValue{ .memory = addr + adjusted_field_offset }; |
| 1709 | 1718 | }, |
| 1710 | 1719 | else => return self.fail("TODO implement codegen struct_field_val for {}", .{mcv}), |
| 1711 | 1720 | } |