From e06ac9537e94cf4863de7ca64112d7a63af60008 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Tue, 8 Feb 2022 21:10:29 -0700 Subject: [PATCH] stage2: fix x86_64-windows C ABI It didn't return integer status for pointers and also it incorrectly returned memory for optionals sometimes. --- src/arch/x86_64/abi.zig | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/src/arch/x86_64/abi.zig b/src/arch/x86_64/abi.zig index a6c71d398f..b0ab1acefd 100644 --- a/src/arch/x86_64/abi.zig +++ b/src/arch/x86_64/abi.zig @@ -18,10 +18,34 @@ pub fn classifyWindows(ty: Type, target: Target) Class { else => return .memory, } return switch (ty.zigTypeTag()) { - .Int, .Bool, .Enum, .Void, .NoReturn, .ErrorSet, .Struct, .Union => .integer, - .Optional => if (ty.isPtrLikeOptional()) return .integer else return .memory, + .Pointer, + .Int, + .Bool, + .Enum, + .Void, + .NoReturn, + .ErrorSet, + .Struct, + .Union, + .Optional, + .Array, + .ErrorUnion, + .AnyFrame, + .Frame, + => .integer, + .Float, .Vector => .sse, - else => unreachable, + + .Type, + .ComptimeFloat, + .ComptimeInt, + .Undefined, + .Null, + .BoundFn, + .Fn, + .Opaque, + .EnumLiteral, + => unreachable, }; }