| ... | ... | @@ -992,12 +992,21 @@ fn airArg(self: *Self, inst: Air.Inst.Index) !void { |
| 992 | 992 | self.arg_index += 1; |
| 993 | 993 | |
| 994 | 994 | const ty = self.air.typeOfIndex(inst); |
| 995 | | _ = ty; |
| 996 | 995 | |
| 997 | | const result = self.args[arg_index]; |
| 998 | | // TODO support stack-only arguments |
| 999 | | // TODO Copy registers to the stack |
| 1000 | | const mcv = result; |
| 996 | const arg = self.args[arg_index]; |
| 997 | const mcv = blk: { |
| 998 | switch (arg) { |
| 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 | 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 | 4191 | const ref_int = @enumToInt(inst); |
| 4183 | 4192 | if (ref_int < Air.Inst.Ref.typed_value_map.len) { |
| 4184 | 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 | 4195 | return MCValue{ .none = {} }; |
| 4187 | 4196 | } |
| 4188 | 4197 | return self.genTypedValue(tv); |
| ... | ... | @@ -4190,7 +4199,7 @@ fn resolveInst(self: *Self, inst: Air.Inst.Ref) InnerError!MCValue { |
| 4190 | 4199 | |
| 4191 | 4200 | // If the type has no codegen bits, no need to store it. |
| 4192 | 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 | 4203 | return MCValue{ .none = {} }; |
| 4195 | 4204 | |
| 4196 | 4205 | const inst_index = @intCast(Air.Inst.Index, ref_int - Air.Inst.Ref.typed_value_map.len); |