| ... | ... | @@ -4197,7 +4197,7 @@ pub const FuncGen = struct { |
| 4197 | 4197 | } |
| 4198 | 4198 | |
| 4199 | 4199 | var it = iterateParamTypes(self.dg, fn_info); |
| 4200 | | while (it.next()) |lowering| switch (lowering) { |
| 4200 | while (it.nextCall(self, args)) |lowering| switch (lowering) { |
| 4201 | 4201 | .no_bits => continue, |
| 4202 | 4202 | .byval => { |
| 4203 | 4203 | const arg = args[it.zig_index - 1]; |
| ... | ... | @@ -9004,10 +9004,26 @@ const ParamTypeIterator = struct { |
| 9004 | 9004 | slice, |
| 9005 | 9005 | }; |
| 9006 | 9006 | |
| 9007 | | fn next(it: *ParamTypeIterator) ?Lowering { |
| 9007 | pub fn next(it: *ParamTypeIterator) ?Lowering { |
| 9008 | 9008 | if (it.zig_index >= it.fn_info.param_types.len) return null; |
| 9009 | | |
| 9010 | 9009 | const ty = it.fn_info.param_types[it.zig_index]; |
| 9010 | return nextInner(it, ty); |
| 9011 | } |
| 9012 | |
| 9013 | /// `airCall` uses this instead of `next` so that it can take into account variadic functions. |
| 9014 | pub fn nextCall(it: *ParamTypeIterator, fg: *FuncGen, args: []const Air.Inst.Ref) ?Lowering { |
| 9015 | if (it.zig_index >= it.fn_info.param_types.len) { |
| 9016 | if (it.zig_index >= args.len) { |
| 9017 | return null; |
| 9018 | } else { |
| 9019 | return nextInner(it, fg.air.typeOf(args[it.zig_index])); |
| 9020 | } |
| 9021 | } else { |
| 9022 | return nextInner(it, it.fn_info.param_types[it.zig_index]); |
| 9023 | } |
| 9024 | } |
| 9025 | |
| 9026 | fn nextInner(it: *ParamTypeIterator, ty: Type) ?Lowering { |
| 9011 | 9027 | if (!ty.hasRuntimeBitsIgnoreComptime()) { |
| 9012 | 9028 | it.zig_index += 1; |
| 9013 | 9029 | return .no_bits; |