| author | |
| committer | |
| log | 0f61d1f0df887081d60558256e10944633eb868f |
| tree | 2c850d79196b43f37ffeb90595607b63dda977f3 |
| parent | b83c037f9ffd7a4285de41c95827615fcbdbbf2f |
2 files changed, 18 insertions(+), 2 deletions(-)
src/arch/x86_64/abi.zig+10-2| ... | ... | @@ -5,7 +5,7 @@ const assert = std.debug.assert; |
| 5 | 5 | const Register = @import("bits.zig").Register; |
| 6 | 6 | const RegisterManagerFn = @import("../../register_manager.zig").RegisterManager; |
| 7 | 7 | |
| 8 | pub const Class = enum { integer, sse, sseup, x87, x87up, complex_x87, memory, none }; | |
| 8 | pub const Class = enum { integer, sse, sseup, x87, x87up, complex_x87, memory, none, win_i128 }; | |
| 9 | 9 | |
| 10 | 10 | pub fn classifyWindows(ty: Type, target: Target) Class { |
| 11 | 11 | // https://docs.microsoft.com/en-gb/cpp/build/x64-calling-convention?view=vs-2017 |
| ... | ... | @@ -34,7 +34,15 @@ pub fn classifyWindows(ty: Type, target: Target) Class { |
| 34 | 34 | => switch (ty.abiSize(target)) { |
| 35 | 35 | 0 => unreachable, |
| 36 | 36 | 1, 2, 4, 8 => return .integer, |
| 37 | else => return .memory, | |
| 37 | else => switch (ty.zigTypeTag()) { | |
| 38 | .Int => return .win_i128, | |
| 39 | .Struct, .Union => if (ty.containerLayout() == .Packed) { | |
| 40 | return .win_i128; | |
| 41 | } else { | |
| 42 | return .memory; | |
| 43 | }, | |
| 44 | else => return .memory, | |
| 45 | }, | |
| 38 | 46 | }, |
| 39 | 47 | |
| 40 | 48 | .Float, .Vector => return .sse, |
src/codegen/llvm.zig+8| ... | ... | @@ -9687,6 +9687,7 @@ fn lowerFnRetTy(dg: *DeclGen, fn_info: Type.Payload.Function.Data) !*const llvm. |
| 9687 | 9687 | return dg.context.intType(@intCast(c_uint, abi_size * 8)); |
| 9688 | 9688 | } |
| 9689 | 9689 | }, |
| 9690 | .win_i128 => return dg.context.intType(64).vectorType(2), | |
| 9690 | 9691 | .memory => return dg.context.voidType(), |
| 9691 | 9692 | .sse => return dg.lowerType(fn_info.return_type), |
| 9692 | 9693 | else => unreachable, |
| ... | ... | @@ -9727,6 +9728,7 @@ fn lowerFnRetTy(dg: *DeclGen, fn_info: Type.Payload.Function.Data) !*const llvm. |
| 9727 | 9728 | @panic("TODO"); |
| 9728 | 9729 | }, |
| 9729 | 9730 | .memory => unreachable, // handled above |
| 9731 | .win_i128 => unreachable, // windows only | |
| 9730 | 9732 | .none => break, |
| 9731 | 9733 | } |
| 9732 | 9734 | } |
| ... | ... | @@ -9851,6 +9853,11 @@ const ParamTypeIterator = struct { |
| 9851 | 9853 | return .abi_sized_int; |
| 9852 | 9854 | } |
| 9853 | 9855 | }, |
| 9856 | .win_i128 => { | |
| 9857 | it.zig_index += 1; | |
| 9858 | it.llvm_index += 1; | |
| 9859 | return .byref; | |
| 9860 | }, | |
| 9854 | 9861 | .memory => { |
| 9855 | 9862 | it.zig_index += 1; |
| 9856 | 9863 | it.llvm_index += 1; |
| ... | ... | @@ -9905,6 +9912,7 @@ const ParamTypeIterator = struct { |
| 9905 | 9912 | @panic("TODO"); |
| 9906 | 9913 | }, |
| 9907 | 9914 | .memory => unreachable, // handled above |
| 9915 | .win_i128 => unreachable, // windows only | |
| 9908 | 9916 | .none => break, |
| 9909 | 9917 | } |
| 9910 | 9918 | } |