| ... | @@ -992,12 +992,21 @@ fn airArg(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -992,12 +992,21 @@ fn airArg(self: *Self, inst: Air.Inst.Index) !void { |
| 992 | self.arg_index += 1; | 992 | self.arg_index += 1; |
| 993 | | 993 | |
| 994 | const ty = self.air.typeOfIndex(inst); | 994 | const ty = self.air.typeOfIndex(inst); |
| 995 | _ = ty; | | |
| 996 | | 995 | |
| 997 | const result = self.args[arg_index]; | 996 | const arg = self.args[arg_index]; |
| 998 | // TODO support stack-only arguments | 997 | const mcv = blk: { |
| 999 | // TODO Copy registers to the stack | 998 | switch (arg) { |
| 1000 | const mcv = result; | 999 | .stack_offset => |off| { |
| | 1000 | const mod = self.bin_file.options.module.?; |
| | 1001 | const abi_size = math.cast(u32, ty.abiSize(self.target.*)) orelse { |
| | 1002 | return self.fail("type '{}' too big to fit into stack frame", .{ty.fmt(mod)}); |
| | 1003 | }; |
| | 1004 | const offset = off + abi_size; |
| | 1005 | break :blk MCValue{ .stack_offset = offset }; |
| | 1006 | }, |
| | 1007 | else => break :blk arg, |
| | 1008 | } |
| | 1009 | }; |
| 1001 | | 1010 | |
| 1002 | try self.genArgDbgInfo(inst, mcv, @intCast(u32, arg_index)); | 1011 | try self.genArgDbgInfo(inst, mcv, @intCast(u32, arg_index)); |
| 1003 | | 1012 | |
| ... | @@ -4182,7 +4191,7 @@ fn resolveInst(self: *Self, inst: Air.Inst.Ref) InnerError!MCValue { | ... | @@ -4182,7 +4191,7 @@ fn resolveInst(self: *Self, inst: Air.Inst.Ref) InnerError!MCValue { |
| 4182 | const ref_int = @enumToInt(inst); | 4191 | const ref_int = @enumToInt(inst); |
| 4183 | if (ref_int < Air.Inst.Ref.typed_value_map.len) { | 4192 | if (ref_int < Air.Inst.Ref.typed_value_map.len) { |
| 4184 | const tv = Air.Inst.Ref.typed_value_map[ref_int]; | 4193 | const tv = Air.Inst.Ref.typed_value_map[ref_int]; |
| 4185 | if (!tv.ty.hasRuntimeBits() and !tv.ty.isError()) { | 4194 | if (!tv.ty.hasRuntimeBitsIgnoreComptime() and !tv.ty.isError()) { |
| 4186 | return MCValue{ .none = {} }; | 4195 | return MCValue{ .none = {} }; |
| 4187 | } | 4196 | } |
| 4188 | return self.genTypedValue(tv); | 4197 | return self.genTypedValue(tv); |
| ... | @@ -4190,7 +4199,7 @@ fn resolveInst(self: *Self, inst: Air.Inst.Ref) InnerError!MCValue { | ... | @@ -4190,7 +4199,7 @@ fn resolveInst(self: *Self, inst: Air.Inst.Ref) InnerError!MCValue { |
| 4190 | | 4199 | |
| 4191 | // If the type has no codegen bits, no need to store it. | 4200 | // If the type has no codegen bits, no need to store it. |
| 4192 | const inst_ty = self.air.typeOf(inst); | 4201 | const inst_ty = self.air.typeOf(inst); |
| 4193 | if (!inst_ty.hasRuntimeBits() and !inst_ty.isError()) | 4202 | if (!inst_ty.hasRuntimeBitsIgnoreComptime() and !inst_ty.isError()) |
| 4194 | return MCValue{ .none = {} }; | 4203 | return MCValue{ .none = {} }; |
| 4195 | | 4204 | |
| 4196 | const inst_index = @intCast(Air.Inst.Index, ref_int - Air.Inst.Ref.typed_value_map.len); | 4205 | const inst_index = @intCast(Air.Inst.Index, ref_int - Air.Inst.Ref.typed_value_map.len); |