| ... | ... | @@ -10674,6 +10674,17 @@ fn lowerFnRetTy(o: *Object, fn_info: InternPool.Key.FuncType) Allocator.Error!Bu |
| 10674 | 10674 | return o.builder.structType(.normal, &.{ .i64, .i64 }); |
| 10675 | 10675 | }, |
| 10676 | 10676 | .byval => return o.lowerType(return_type), |
| 10677 | .fields => { |
| 10678 | var types_len: usize = 0; |
| 10679 | var types: [8]Builder.Type = undefined; |
| 10680 | for (0..return_type.structFieldCount(mod)) |field_index| { |
| 10681 | const field_ty = return_type.structFieldType(field_index, mod); |
| 10682 | if (!field_ty.hasRuntimeBitsIgnoreComptime(mod)) continue; |
| 10683 | types[types_len] = try o.lowerType(field_ty); |
| 10684 | types_len += 1; |
| 10685 | } |
| 10686 | return o.builder.structType(.normal, types[0..types_len]); |
| 10687 | }, |
| 10677 | 10688 | } |
| 10678 | 10689 | }, |
| 10679 | 10690 | // TODO investigate C ABI for other architectures |
| ... | ... | @@ -10887,14 +10898,24 @@ const ParamTypeIterator = struct { |
| 10887 | 10898 | .riscv32, .riscv64 => { |
| 10888 | 10899 | it.zig_index += 1; |
| 10889 | 10900 | it.llvm_index += 1; |
| 10890 | | if (ty.toIntern() == .f16_type) { |
| 10891 | | return .as_u16; |
| 10892 | | } |
| 10901 | if (ty.toIntern() == .f16_type and |
| 10902 | !std.Target.riscv.featureSetHas(target.cpu.features, .d)) return .as_u16; |
| 10893 | 10903 | switch (riscv_c_abi.classifyType(ty, mod)) { |
| 10894 | 10904 | .memory => return .byref_mut, |
| 10895 | 10905 | .byval => return .byval, |
| 10896 | 10906 | .integer => return .abi_sized_int, |
| 10897 | 10907 | .double_integer => return Lowering{ .i64_array = 2 }, |
| 10908 | .fields => { |
| 10909 | it.types_len = 0; |
| 10910 | for (0..ty.structFieldCount(mod)) |field_index| { |
| 10911 | const field_ty = ty.structFieldType(field_index, mod); |
| 10912 | if (!field_ty.hasRuntimeBitsIgnoreComptime(mod)) continue; |
| 10913 | it.types_buffer[it.types_len] = try it.object.lowerType(field_ty); |
| 10914 | it.types_len += 1; |
| 10915 | } |
| 10916 | it.llvm_index += it.types_len - 1; |
| 10917 | return .multiple_llvm_types; |
| 10918 | }, |
| 10898 | 10919 | } |
| 10899 | 10920 | }, |
| 10900 | 10921 | // TODO investigate C ABI for other architectures |