| ... | @@ -7122,8 +7122,8 @@ fn lowerSystemVFnRetTy(o: *Object, fn_info: InternPool.Key.FuncType) Allocator.E | ... | @@ -7122,8 +7122,8 @@ fn lowerSystemVFnRetTy(o: *Object, fn_info: InternPool.Key.FuncType) Allocator.E |
| 7122 | } | 7122 | } |
| 7123 | | 7123 | |
| 7124 | /// This function deliberately does not handle `_BitInt` because it typically | 7124 | /// This function deliberately does not handle `_BitInt` because it typically |
| 7125 | /// has different ABI than regular integer types, and there is no currently no | 7125 | /// has different ABI than regular integer types, and there is currently no way |
| 7126 | /// way to determine whether a Zig integer type is meant to represent e.g. `int` | 7126 | /// to determine whether a Zig integer type is meant to represent e.g. `int` |
| 7127 | /// or `_BitInt(32)`. | 7127 | /// or `_BitInt(32)`. |
| 7128 | pub fn ccAbiPromoteInt(cc: std.lang.CallingConvention, zcu: *Zcu, ty: Type) ?std.lang.Signedness { | 7128 | pub fn ccAbiPromoteInt(cc: std.lang.CallingConvention, zcu: *Zcu, ty: Type) ?std.lang.Signedness { |
| 7129 | switch (cc) { | 7129 | switch (cc) { |
| ... | @@ -7131,11 +7131,13 @@ pub fn ccAbiPromoteInt(cc: std.lang.CallingConvention, zcu: *Zcu, ty: Type) ?std | ... | @@ -7131,11 +7131,13 @@ pub fn ccAbiPromoteInt(cc: std.lang.CallingConvention, zcu: *Zcu, ty: Type) ?std |
| 7131 | else => {}, | 7131 | else => {}, |
| 7132 | } | 7132 | } |
| 7133 | | 7133 | |
| 7134 | const int_info = switch (ty.zigTypeTag(zcu)) { | 7134 | const ty_tag = ty.zigTypeTag(zcu); |
| | 7135 | const int_info = switch (ty_tag) { |
| 7135 | .bool => Type.u1.intInfo(zcu), | 7136 | .bool => Type.u1.intInfo(zcu), |
| 7136 | else => if (ty.isAbiInt(zcu)) ty.intInfo(zcu) else return null, | 7137 | else => if (ty.isAbiInt(zcu)) ty.intInfo(zcu) else return null, |
| 7137 | }; | 7138 | }; |
| 7138 | assert(int_info.bits >= 0); | 7139 | |
| | 7140 | assert(int_info.bits == 0 or (int_info.bits == 1 and ty_tag == .bool) or std.math.isPowerOfTwo(int_info.bits)); |
| 7139 | | 7141 | |
| 7140 | const target = zcu.getTarget(); | 7142 | const target = zcu.getTarget(); |
| 7141 | return switch (target.cpu.arch) { | 7143 | return switch (target.cpu.arch) { |
| ... | @@ -7143,7 +7145,7 @@ pub fn ccAbiPromoteInt(cc: std.lang.CallingConvention, zcu: *Zcu, ty: Type) ?std | ... | @@ -7143,7 +7145,7 @@ pub fn ccAbiPromoteInt(cc: std.lang.CallingConvention, zcu: *Zcu, ty: Type) ?std |
| 7143 | .aarch64_be, | 7145 | .aarch64_be, |
| 7144 | => switch (target.os.tag) { | 7146 | => switch (target.os.tag) { |
| 7145 | .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => switch (int_info.bits) { | 7147 | .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => switch (int_info.bits) { |
| 7146 | 8, 16 => int_info.signedness, | 7148 | 1, 8, 16 => int_info.signedness, |
| 7147 | else => null, | 7149 | else => null, |
| 7148 | }, | 7150 | }, |
| 7149 | else => null, | 7151 | else => null, |
| ... | @@ -7151,7 +7153,7 @@ pub fn ccAbiPromoteInt(cc: std.lang.CallingConvention, zcu: *Zcu, ty: Type) ?std | ... | @@ -7151,7 +7153,7 @@ pub fn ccAbiPromoteInt(cc: std.lang.CallingConvention, zcu: *Zcu, ty: Type) ?std |
| 7151 | | 7153 | |
| 7152 | .avr, | 7154 | .avr, |
| 7153 | => switch (int_info.bits) { | 7155 | => switch (int_info.bits) { |
| 7154 | 8 => int_info.signedness, | 7156 | 1, 8 => int_info.signedness, |
| 7155 | else => null, | 7157 | else => null, |
| 7156 | }, | 7158 | }, |
| 7157 | | 7159 | |
| ... | @@ -7162,7 +7164,7 @@ pub fn ccAbiPromoteInt(cc: std.lang.CallingConvention, zcu: *Zcu, ty: Type) ?std | ... | @@ -7162,7 +7164,7 @@ pub fn ccAbiPromoteInt(cc: std.lang.CallingConvention, zcu: *Zcu, ty: Type) ?std |
| 7162 | .riscv64, | 7164 | .riscv64, |
| 7163 | .riscv64be, | 7165 | .riscv64be, |
| 7164 | => switch (int_info.bits) { | 7166 | => switch (int_info.bits) { |
| 7165 | 8, 16 => int_info.signedness, | 7167 | 1, 8, 16 => int_info.signedness, |
| 7166 | 32 => .signed, | 7168 | 32 => .signed, |
| 7167 | else => null, | 7169 | else => null, |
| 7168 | }, | 7170 | }, |
| ... | @@ -7172,7 +7174,7 @@ pub fn ccAbiPromoteInt(cc: std.lang.CallingConvention, zcu: *Zcu, ty: Type) ?std | ... | @@ -7172,7 +7174,7 @@ pub fn ccAbiPromoteInt(cc: std.lang.CallingConvention, zcu: *Zcu, ty: Type) ?std |
| 7172 | .mips64, | 7174 | .mips64, |
| 7173 | .mips64el, | 7175 | .mips64el, |
| 7174 | => switch (int_info.bits) { | 7176 | => switch (int_info.bits) { |
| 7175 | 8, 16, 64 => int_info.signedness, | 7177 | 1, 8, 16, 64 => int_info.signedness, |
| 7176 | 32 => .signed, | 7178 | 32 => .signed, |
| 7177 | else => null, | 7179 | else => null, |
| 7178 | }, | 7180 | }, |
| ... | @@ -7183,12 +7185,12 @@ pub fn ccAbiPromoteInt(cc: std.lang.CallingConvention, zcu: *Zcu, ty: Type) ?std | ... | @@ -7183,12 +7185,12 @@ pub fn ccAbiPromoteInt(cc: std.lang.CallingConvention, zcu: *Zcu, ty: Type) ?std |
| 7183 | .sparc64, | 7185 | .sparc64, |
| 7184 | .ve, | 7186 | .ve, |
| 7185 | => switch (int_info.bits) { | 7187 | => switch (int_info.bits) { |
| 7186 | 8, 16, 32 => int_info.signedness, | 7188 | 1, 8, 16, 32 => int_info.signedness, |
| 7187 | else => null, | 7189 | else => null, |
| 7188 | }, | 7190 | }, |
| 7189 | | 7191 | |
| 7190 | else => switch (int_info.bits) { | 7192 | else => switch (int_info.bits) { |
| 7191 | 8, 16 => int_info.signedness, | 7193 | 1, 8, 16 => int_info.signedness, |
| 7192 | else => null, | 7194 | else => null, |
| 7193 | }, | 7195 | }, |
| 7194 | }; | 7196 | }; |