authorgravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2023-05-26 23:29:05+03:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-05-26 21:42:19-07:00
logca16f1e8a703491bcaac0d13379d2556e8ca837d
treefefadd0912e8e3deedbf0a7261219fbd7ee5149f
parentdbd44658ff2d392451ea4f3a38ca4bd26da34314

std.Target adjustments

* move `ptrBitWidth` from Arch to Target since it needs to know about the abi * double isn't always 8 bits * AVR uses 1-byte alignment for everything in GCC

28 files changed, 180 insertions(+), 168 deletions(-)

lib/std/c/freebsd.zig+1-1
......@@ -322,7 +322,7 @@ pub const RTLD = struct {
322322
323323pub const dl_phdr_info = extern struct {
324324 /// Module relocation base.
325 dlpi_addr: if (builtin.cpu.arch.ptrBitWidth() == 32) std.elf.Elf32_Addr else std.elf.Elf64_Addr,
325 dlpi_addr: if (builtin.target.ptrBitWidth() == 32) std.elf.Elf32_Addr else std.elf.Elf64_Addr,
326326 /// Module name.
327327 dlpi_name: ?[*:0]const u8,
328328 /// Pointer to module's phdr.
lib/std/os/linux.zig+12-2
......@@ -5847,8 +5847,18 @@ pub const AUDIT = struct {
58475847 fn toAudit(arch: std.Target.Cpu.Arch) u32 {
58485848 var res: u32 = @enumToInt(arch.toElfMachine());
58495849 if (arch.endian() == .Little) res |= LE;
5850 if (arch.ptrBitWidth() == 64) res |= @"64BIT";
5851
5850 switch (arch) {
5851 .aarch64,
5852 .mips64,
5853 .mips64el,
5854 .powerpc64,
5855 .powerpc64le,
5856 .riscv64,
5857 .sparc64,
5858 .x86_64,
5859 => res |= @"64BIT",
5860 else => {},
5861 }
58525862 return res;
58535863 }
58545864 };
lib/std/target.zig+83-81
......@@ -1189,77 +1189,6 @@ pub const Target = struct {
11891189 };
11901190 }
11911191
1192 pub fn ptrBitWidth(arch: Arch) u16 {
1193 switch (arch) {
1194 .avr,
1195 .msp430,
1196 .spu_2,
1197 => return 16,
1198
1199 .arc,
1200 .arm,
1201 .armeb,
1202 .csky,
1203 .hexagon,
1204 .m68k,
1205 .le32,
1206 .mips,
1207 .mipsel,
1208 .powerpc,
1209 .powerpcle,
1210 .r600,
1211 .riscv32,
1212 .sparc,
1213 .sparcel,
1214 .tce,
1215 .tcele,
1216 .thumb,
1217 .thumbeb,
1218 .x86,
1219 .xcore,
1220 .nvptx,
1221 .amdil,
1222 .hsail,
1223 .spir,
1224 .kalimba,
1225 .shave,
1226 .lanai,
1227 .wasm32,
1228 .renderscript32,
1229 .aarch64_32,
1230 .spirv32,
1231 .loongarch32,
1232 .dxil,
1233 .xtensa,
1234 => return 32,
1235
1236 .aarch64,
1237 .aarch64_be,
1238 .mips64,
1239 .mips64el,
1240 .powerpc64,
1241 .powerpc64le,
1242 .riscv64,
1243 .x86_64,
1244 .nvptx64,
1245 .le64,
1246 .amdil64,
1247 .hsail64,
1248 .spir64,
1249 .wasm64,
1250 .renderscript64,
1251 .amdgcn,
1252 .bpfel,
1253 .bpfeb,
1254 .sparc64,
1255 .s390x,
1256 .ve,
1257 .spirv64,
1258 .loongarch64,
1259 => return 64,
1260 }
1261 }
1262
12631192 /// Returns a name that matches the lib/std/target/* source file name.
12641193 pub fn genericName(arch: Arch) []const u8 {
12651194 return switch (arch) {
......@@ -1621,7 +1550,7 @@ pub const Target = struct {
16211550 const copy = S.copy;
16221551
16231552 if (self.abi == .android) {
1624 const suffix = if (self.cpu.arch.ptrBitWidth() == 64) "64" else "";
1553 const suffix = if (self.ptrBitWidth() == 64) "64" else "";
16251554 return print(&result, "/system/bin/linker{s}", .{suffix});
16261555 }
16271556
......@@ -1904,6 +1833,83 @@ pub const Target = struct {
19041833 };
19051834 }
19061835
1836 pub fn ptrBitWidth(target: std.Target) u16 {
1837 switch (target.abi) {
1838 .gnux32, .muslx32, .gnuabin32, .gnuilp32 => return 32,
1839 .gnuabi64 => return 64,
1840 else => {},
1841 }
1842 switch (target.cpu.arch) {
1843 .avr,
1844 .msp430,
1845 .spu_2,
1846 => return 16,
1847
1848 .arc,
1849 .arm,
1850 .armeb,
1851 .csky,
1852 .hexagon,
1853 .m68k,
1854 .le32,
1855 .mips,
1856 .mipsel,
1857 .powerpc,
1858 .powerpcle,
1859 .r600,
1860 .riscv32,
1861 .sparcel,
1862 .tce,
1863 .tcele,
1864 .thumb,
1865 .thumbeb,
1866 .x86,
1867 .xcore,
1868 .nvptx,
1869 .amdil,
1870 .hsail,
1871 .spir,
1872 .kalimba,
1873 .shave,
1874 .lanai,
1875 .wasm32,
1876 .renderscript32,
1877 .aarch64_32,
1878 .spirv32,
1879 .loongarch32,
1880 .dxil,
1881 .xtensa,
1882 => return 32,
1883
1884 .aarch64,
1885 .aarch64_be,
1886 .mips64,
1887 .mips64el,
1888 .powerpc64,
1889 .powerpc64le,
1890 .riscv64,
1891 .x86_64,
1892 .nvptx64,
1893 .le64,
1894 .amdil64,
1895 .hsail64,
1896 .spir64,
1897 .wasm64,
1898 .renderscript64,
1899 .amdgcn,
1900 .bpfel,
1901 .bpfeb,
1902 .sparc64,
1903 .s390x,
1904 .ve,
1905 .spirv64,
1906 .loongarch64,
1907 => return 64,
1908
1909 .sparc => return if (std.Target.sparc.featureSetHas(target.cpu.features, .v9)) 64 else 32,
1910 }
1911 }
1912
19071913 pub const CType = enum {
19081914 char,
19091915 short,
......@@ -1930,11 +1936,10 @@ pub const Target = struct {
19301936 .ulong,
19311937 .longlong,
19321938 .ulonglong,
1939 .float,
1940 .double,
19331941 => @divExact(c_type_bit_size(t, c_type), 8),
19341942
1935 .float => 4,
1936 .double => 8,
1937
19381943 .longdouble => switch (c_type_bit_size(t, c_type)) {
19391944 16 => 2,
19401945 32 => 4,
......@@ -1990,7 +1995,7 @@ pub const Target = struct {
19901995 .char => return 8,
19911996 .short, .ushort => return 16,
19921997 .int, .uint, .float => return 32,
1993 .long, .ulong => return target.cpu.arch.ptrBitWidth(),
1998 .long, .ulong => return target.ptrBitWidth(),
19941999 .longlong, .ulonglong, .double => return 64,
19952000 .longdouble => switch (target.cpu.arch) {
19962001 .x86 => switch (target.abi) {
......@@ -2084,7 +2089,7 @@ pub const Target = struct {
20842089 .char => return 8,
20852090 .short, .ushort => return 16,
20862091 .int, .uint, .float => return 32,
2087 .long, .ulong => return target.cpu.arch.ptrBitWidth(),
2092 .long, .ulong => return target.ptrBitWidth(),
20882093 .longlong, .ulonglong, .double => return 64,
20892094 .longdouble => switch (target.cpu.arch) {
20902095 .x86 => switch (target.abi) {
......@@ -2256,10 +2261,7 @@ pub const Target = struct {
22562261 pub fn c_type_alignment(target: Target, c_type: CType) u16 {
22572262 // Overrides for unusual alignments
22582263 switch (target.cpu.arch) {
2259 .avr => switch (c_type) {
2260 .short, .ushort => return 2,
2261 else => return 1,
2262 },
2264 .avr => return 1,
22632265 .x86 => switch (target.os.tag) {
22642266 .windows, .uefi => switch (c_type) {
22652267 .longlong, .ulonglong, .double => return 8,
lib/std/zig/system/NativePaths.zig+1-1
......@@ -117,7 +117,7 @@ pub fn detect(allocator: Allocator, native_info: NativeTargetInfo) !NativePaths
117117 const triple = try native_target.linuxTriple(allocator);
118118 defer allocator.free(triple);
119119
120 const qual = native_target.cpu.arch.ptrBitWidth();
120 const qual = native_target.ptrBitWidth();
121121
122122 // TODO: $ ld --verbose | grep SEARCH_DIR
123123 // the output contains some paths that end with lib64, maybe include them too?
lib/std/zig/system/NativeTargetInfo.zig+2-2
......@@ -1095,7 +1095,7 @@ pub fn getExternalExecutor(
10951095 if (candidate.target.cpu.arch != builtin.cpu.arch) {
10961096 return bad_result;
10971097 }
1098 switch (candidate.target.cpu.arch.ptrBitWidth()) {
1098 switch (candidate.target.ptrBitWidth()) {
10991099 32 => return Executor{ .wine = "wine" },
11001100 64 => return Executor{ .wine = "wine64" },
11011101 else => return bad_result,
......@@ -1105,7 +1105,7 @@ pub fn getExternalExecutor(
11051105 },
11061106 .wasi => {
11071107 if (options.allow_wasmtime) {
1108 switch (candidate.target.cpu.arch.ptrBitWidth()) {
1108 switch (candidate.target.ptrBitWidth()) {
11091109 32 => return Executor{ .wasmtime = "wasmtime" },
11101110 else => return bad_result,
11111111 }
src/Sema.zig+1-1
......@@ -34002,7 +34002,7 @@ fn intFitsInType(
3400234002 => switch (ty.zigTypeTag()) {
3400334003 .Int => {
3400434004 const info = ty.intInfo(target);
34005 const ptr_bits = target.cpu.arch.ptrBitWidth();
34005 const ptr_bits = target.ptrBitWidth();
3400634006 return switch (info.signedness) {
3400734007 .signed => info.bits > ptr_bits,
3400834008 .unsigned => info.bits >= ptr_bits,
src/arch/aarch64/CodeGen.zig+6-6
......@@ -501,7 +501,7 @@ fn gen(self: *Self) !void {
501501 // (or w0 when pointer size is 32 bits). As this register
502502 // might get overwritten along the way, save the address
503503 // to the stack.
504 const ptr_bits = self.target.cpu.arch.ptrBitWidth();
504 const ptr_bits = self.target.ptrBitWidth();
505505 const ptr_bytes = @divExact(ptr_bits, 8);
506506 const ret_ptr_reg = self.registerAlias(.x0, Type.usize);
507507
......@@ -1512,7 +1512,7 @@ fn airSlice(self: *Self, inst: Air.Inst.Index) !void {
15121512 const len = try self.resolveInst(bin_op.rhs);
15131513 const len_ty = self.air.typeOf(bin_op.rhs);
15141514
1515 const ptr_bits = self.target.cpu.arch.ptrBitWidth();
1515 const ptr_bits = self.target.ptrBitWidth();
15161516 const ptr_bytes = @divExact(ptr_bits, 8);
15171517
15181518 const stack_offset = try self.allocMem(ptr_bytes * 2, ptr_bytes * 2, inst);
......@@ -3362,7 +3362,7 @@ fn airSlicePtr(self: *Self, inst: Air.Inst.Index) !void {
33623362fn airSliceLen(self: *Self, inst: Air.Inst.Index) !void {
33633363 const ty_op = self.air.instructions.items(.data)[inst].ty_op;
33643364 const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: {
3365 const ptr_bits = self.target.cpu.arch.ptrBitWidth();
3365 const ptr_bits = self.target.ptrBitWidth();
33663366 const ptr_bytes = @divExact(ptr_bits, 8);
33673367 const mcv = try self.resolveInst(ty_op.operand);
33683368 switch (mcv) {
......@@ -3386,7 +3386,7 @@ fn airSliceLen(self: *Self, inst: Air.Inst.Index) !void {
33863386fn airPtrSliceLenPtr(self: *Self, inst: Air.Inst.Index) !void {
33873387 const ty_op = self.air.instructions.items(.data)[inst].ty_op;
33883388 const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: {
3389 const ptr_bits = self.target.cpu.arch.ptrBitWidth();
3389 const ptr_bits = self.target.ptrBitWidth();
33903390 const ptr_bytes = @divExact(ptr_bits, 8);
33913391 const mcv = try self.resolveInst(ty_op.operand);
33923392 switch (mcv) {
......@@ -4321,7 +4321,7 @@ fn airCall(self: *Self, inst: Air.Inst.Index, modifier: std.builtin.CallModifier
43214321 } else if (self.bin_file.cast(link.File.Plan9)) |p9| {
43224322 const decl_block_index = try p9.seeDecl(func.owner_decl);
43234323 const decl_block = p9.getDeclBlock(decl_block_index);
4324 const ptr_bits = self.target.cpu.arch.ptrBitWidth();
4324 const ptr_bits = self.target.ptrBitWidth();
43254325 const ptr_bytes: u64 = @divExact(ptr_bits, 8);
43264326 const got_addr = p9.bases.data;
43274327 const got_index = decl_block.got_index.?;
......@@ -5929,7 +5929,7 @@ fn airArrayToSlice(self: *Self, inst: Air.Inst.Index) !void {
59295929 const array_ty = ptr_ty.childType();
59305930 const array_len = @intCast(u32, array_ty.arrayLen());
59315931
5932 const ptr_bits = self.target.cpu.arch.ptrBitWidth();
5932 const ptr_bits = self.target.ptrBitWidth();
59335933 const ptr_bytes = @divExact(ptr_bits, 8);
59345934
59355935 const stack_offset = try self.allocMem(ptr_bytes * 2, ptr_bytes * 2, inst);
src/arch/arm/CodeGen.zig+1-1
......@@ -1035,7 +1035,7 @@ fn allocRegOrMem(self: *Self, elem_ty: Type, reg_ok: bool, maybe_inst: ?Air.Inst
10351035
10361036 if (reg_ok) {
10371037 // Make sure the type can fit in a register before we try to allocate one.
1038 const ptr_bits = self.target.cpu.arch.ptrBitWidth();
1038 const ptr_bits = self.target.ptrBitWidth();
10391039 const ptr_bytes: u64 = @divExact(ptr_bits, 8);
10401040 if (abi_size <= ptr_bytes) {
10411041 if (self.register_manager.tryAllocReg(maybe_inst, gp)) |reg| {
src/arch/riscv64/CodeGen.zig+1-1
......@@ -826,7 +826,7 @@ fn allocRegOrMem(self: *Self, inst: Air.Inst.Index, reg_ok: bool) !MCValue {
826826
827827 if (reg_ok) {
828828 // Make sure the type can fit in a register before we try to allocate one.
829 const ptr_bits = self.target.cpu.arch.ptrBitWidth();
829 const ptr_bits = self.target.ptrBitWidth();
830830 const ptr_bytes: u64 = @divExact(ptr_bits, 8);
831831 if (abi_size <= ptr_bytes) {
832832 if (self.register_manager.tryAllocReg(inst, gp)) |reg| {
src/arch/riscv64/abi.zig+1-1
......@@ -9,7 +9,7 @@ pub const Class = enum { memory, byval, integer, double_integer };
99pub fn classifyType(ty: Type, target: std.Target) Class {
1010 std.debug.assert(ty.hasRuntimeBitsIgnoreComptime());
1111
12 const max_byval_size = target.cpu.arch.ptrBitWidth() * 2;
12 const max_byval_size = target.ptrBitWidth() * 2;
1313 switch (ty.zigTypeTag()) {
1414 .Struct => {
1515 const bit_size = ty.bitSize(target);
src/arch/sparc64/CodeGen.zig+4-4
......@@ -876,7 +876,7 @@ fn airArrayToSlice(self: *Self, inst: Air.Inst.Index) !void {
876876 const array_ty = ptr_ty.childType();
877877 const array_len = @intCast(u32, array_ty.arrayLen());
878878
879 const ptr_bits = self.target.cpu.arch.ptrBitWidth();
879 const ptr_bits = self.target.ptrBitWidth();
880880 const ptr_bytes = @divExact(ptr_bits, 8);
881881
882882 const stack_offset = try self.allocMem(inst, ptr_bytes * 2, ptr_bytes * 2);
......@@ -2241,7 +2241,7 @@ fn airPtrElemPtr(self: *Self, inst: Air.Inst.Index) !void {
22412241fn airPtrSliceLenPtr(self: *Self, inst: Air.Inst.Index) !void {
22422242 const ty_op = self.air.instructions.items(.data)[inst].ty_op;
22432243 const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: {
2244 const ptr_bits = self.target.cpu.arch.ptrBitWidth();
2244 const ptr_bits = self.target.ptrBitWidth();
22452245 const ptr_bytes = @divExact(ptr_bits, 8);
22462246 const mcv = try self.resolveInst(ty_op.operand);
22472247 switch (mcv) {
......@@ -2427,7 +2427,7 @@ fn airSlice(self: *Self, inst: Air.Inst.Index) !void {
24272427 const len = try self.resolveInst(bin_op.rhs);
24282428 const len_ty = self.air.typeOf(bin_op.rhs);
24292429
2430 const ptr_bits = self.target.cpu.arch.ptrBitWidth();
2430 const ptr_bits = self.target.ptrBitWidth();
24312431 const ptr_bytes = @divExact(ptr_bits, 8);
24322432
24332433 const stack_offset = try self.allocMem(inst, ptr_bytes * 2, ptr_bytes * 2);
......@@ -2485,7 +2485,7 @@ fn airSliceElemVal(self: *Self, inst: Air.Inst.Index) !void {
24852485fn airSliceLen(self: *Self, inst: Air.Inst.Index) !void {
24862486 const ty_op = self.air.instructions.items(.data)[inst].ty_op;
24872487 const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: {
2488 const ptr_bits = self.target.cpu.arch.ptrBitWidth();
2488 const ptr_bits = self.target.ptrBitWidth();
24892489 const ptr_bytes = @divExact(ptr_bits, 8);
24902490 const mcv = try self.resolveInst(ty_op.operand);
24912491 switch (mcv) {
src/arch/wasm/CodeGen.zig+1-1
......@@ -1684,7 +1684,7 @@ fn memcpy(func: *CodeGen, dst: WValue, src: WValue, len: WValue) !void {
16841684}
16851685
16861686fn ptrSize(func: *const CodeGen) u16 {
1687 return @divExact(func.target.cpu.arch.ptrBitWidth(), 8);
1687 return @divExact(func.target.ptrBitWidth(), 8);
16881688}
16891689
16901690fn arch(func: *const CodeGen) std.Target.Cpu.Arch {
src/arch/x86_64/CodeGen.zig+2-2
......@@ -4000,7 +4000,7 @@ fn airPtrSliceLenPtr(self: *Self, inst: Air.Inst.Index) !void {
40004000 registerAlias(dst_reg, dst_abi_size),
40014001 Memory.sib(.qword, .{
40024002 .base = .{ .reg = src_reg },
4003 .disp = @divExact(self.target.cpu.arch.ptrBitWidth(), 8),
4003 .disp = @divExact(self.target.ptrBitWidth(), 8),
40044004 }),
40054005 );
40064006
......@@ -8131,7 +8131,7 @@ fn airCall(self: *Self, inst: Air.Inst.Index, modifier: std.builtin.CallModifier
81318131 } else if (self.bin_file.cast(link.File.Plan9)) |p9| {
81328132 const decl_block_index = try p9.seeDecl(owner_decl);
81338133 const decl_block = p9.getDeclBlock(decl_block_index);
8134 const ptr_bits = self.target.cpu.arch.ptrBitWidth();
8134 const ptr_bits = self.target.ptrBitWidth();
81358135 const ptr_bytes: u64 = @divExact(ptr_bits, 8);
81368136 const got_addr = p9.bases.data;
81378137 const got_index = decl_block.got_index.?;
src/codegen.zig+6-6
......@@ -314,7 +314,7 @@ pub fn generateSymbol(
314314 },
315315 .Pointer => switch (typed_value.val.tag()) {
316316 .null_value => {
317 switch (target.cpu.arch.ptrBitWidth()) {
317 switch (target.ptrBitWidth()) {
318318 32 => {
319319 mem.writeInt(u32, try code.addManyAsArray(4), 0, endian);
320320 if (typed_value.ty.isSlice()) try code.appendNTimes(0xaa, 4);
......@@ -328,7 +328,7 @@ pub fn generateSymbol(
328328 return Result.ok;
329329 },
330330 .zero, .one, .int_u64, .int_big_positive => {
331 switch (target.cpu.arch.ptrBitWidth()) {
331 switch (target.ptrBitWidth()) {
332332 32 => {
333333 const x = typed_value.val.toUnsignedInt(target);
334334 mem.writeInt(u32, try code.addManyAsArray(4), @intCast(u32, x), endian);
......@@ -970,7 +970,7 @@ fn lowerDeclRef(
970970 return Result.ok;
971971 }
972972
973 const ptr_width = target.cpu.arch.ptrBitWidth();
973 const ptr_width = target.ptrBitWidth();
974974 const decl = module.declPtr(decl_index);
975975 const is_fn_body = decl.ty.zigTypeTag() == .Fn;
976976 if (!is_fn_body and !decl.ty.hasRuntimeBits()) {
......@@ -1059,7 +1059,7 @@ fn genDeclRef(
10591059 log.debug("genDeclRef: ty = {}, val = {}", .{ tv.ty.fmt(module), tv.val.fmtValue(tv.ty, module) });
10601060
10611061 const target = bin_file.options.target;
1062 const ptr_bits = target.cpu.arch.ptrBitWidth();
1062 const ptr_bits = target.ptrBitWidth();
10631063 const ptr_bytes: u64 = @divExact(ptr_bits, 8);
10641064
10651065 const decl = module.declPtr(decl_index);
......@@ -1137,7 +1137,7 @@ fn genUnnamedConst(
11371137 } else if (bin_file.cast(link.File.Coff)) |_| {
11381138 return GenResult.mcv(.{ .load_direct = local_sym_index });
11391139 } else if (bin_file.cast(link.File.Plan9)) |p9| {
1140 const ptr_bits = target.cpu.arch.ptrBitWidth();
1140 const ptr_bits = target.ptrBitWidth();
11411141 const ptr_bytes: u64 = @divExact(ptr_bits, 8);
11421142 const got_index = local_sym_index; // the plan9 backend returns the got_index
11431143 const got_addr = p9.bases.data + got_index * ptr_bytes;
......@@ -1168,7 +1168,7 @@ pub fn genTypedValue(
11681168 return GenResult.mcv(.undef);
11691169
11701170 const target = bin_file.options.target;
1171 const ptr_bits = target.cpu.arch.ptrBitWidth();
1171 const ptr_bits = target.ptrBitWidth();
11721172
11731173 if (!typed_value.ty.isSlice()) {
11741174 if (typed_value.val.castTag(.variable)) |payload| {
src/codegen/c/type.zig+1-1
......@@ -879,7 +879,7 @@ pub const CType = extern union {
879879 .pointer_const,
880880 .pointer_volatile,
881881 .pointer_const_volatile,
882 => @divExact(target.cpu.arch.ptrBitWidth(), 8),
882 => @divExact(target.ptrBitWidth(), 8),
883883 .uint16_t, .int16_t, .zig_f16 => 2,
884884 .uint32_t, .int32_t, .zig_f32 => 4,
885885 .uint64_t, .int64_t, .zig_f64 => 8,
src/codegen/llvm.zig+12-12
......@@ -591,7 +591,7 @@ pub const Object = struct {
591591 const target = mod.getTarget();
592592
593593 const llvm_ptr_ty = self.context.pointerType(0); // TODO: Address space
594 const llvm_usize_ty = self.context.intType(target.cpu.arch.ptrBitWidth());
594 const llvm_usize_ty = self.context.intType(target.ptrBitWidth());
595595 const type_fields = [_]*llvm.Type{
596596 llvm_ptr_ty,
597597 llvm_usize_ty,
......@@ -1114,7 +1114,7 @@ pub const Object = struct {
11141114 llvm_arg_i += 1;
11151115 const field_ptr = builder.buildStructGEP(llvm_ty, arg_ptr, field_i, "");
11161116 const store_inst = builder.buildStore(param, field_ptr);
1117 store_inst.setAlignment(target.cpu.arch.ptrBitWidth() / 8);
1117 store_inst.setAlignment(target.ptrBitWidth() / 8);
11181118 }
11191119
11201120 const is_by_ref = isByRef(param_ty);
......@@ -1718,7 +1718,7 @@ pub const Object = struct {
17181718 defer gpa.free(name);
17191719 const ptr_di_ty = dib.createPointerType(
17201720 elem_di_ty,
1721 target.cpu.arch.ptrBitWidth(),
1721 target.ptrBitWidth(),
17221722 ty.ptrAlignment(target) * 8,
17231723 name,
17241724 );
......@@ -4071,7 +4071,7 @@ pub const DeclGen = struct {
40714071 .Struct => {
40724072 if (parent_ty.containerLayout() == .Packed) {
40734073 if (!byte_aligned) return parent_llvm_ptr;
4074 const llvm_usize = dg.context.intType(target.cpu.arch.ptrBitWidth());
4074 const llvm_usize = dg.context.intType(target.ptrBitWidth());
40754075 const base_addr = parent_llvm_ptr.constPtrToInt(llvm_usize);
40764076 // count bits of fields before this one
40774077 const prev_bits = b: {
......@@ -4261,7 +4261,7 @@ pub const DeclGen = struct {
42614261 // instruction is followed by a `wrap_optional`, it will return this value
42624262 // verbatim, and the result should test as non-null.
42634263 const target = dg.module.getTarget();
4264 const int = switch (target.cpu.arch.ptrBitWidth()) {
4264 const int = switch (target.ptrBitWidth()) {
42654265 16 => llvm_usize.constInt(0xaaaa, .False),
42664266 32 => llvm_usize.constInt(0xaaaaaaaa, .False),
42674267 64 => llvm_usize.constInt(0xaaaaaaaa_aaaaaaaa, .False),
......@@ -4910,7 +4910,7 @@ pub const FuncGen = struct {
49104910 const i = @intCast(c_uint, i_usize);
49114911 const field_ptr = self.builder.buildStructGEP(llvm_ty, arg_ptr, i, "");
49124912 const load_inst = self.builder.buildLoad(field_ty, field_ptr, "");
4913 load_inst.setAlignment(target.cpu.arch.ptrBitWidth() / 8);
4913 load_inst.setAlignment(target.ptrBitWidth() / 8);
49144914 llvm_args.appendAssumeCapacity(load_inst);
49154915 }
49164916 },
......@@ -5579,7 +5579,7 @@ pub const FuncGen = struct {
55795579 const switch_br = self.air.extraData(Air.SwitchBr, pl_op.payload);
55805580 const else_block = self.context.appendBasicBlock(self.llvm_func, "Else");
55815581 const target = self.dg.module.getTarget();
5582 const llvm_usize = self.context.intType(target.cpu.arch.ptrBitWidth());
5582 const llvm_usize = self.context.intType(target.ptrBitWidth());
55835583 const cond_int = if (cond.typeOf().getTypeKind() == .Pointer)
55845584 self.builder.buildPtrToInt(cond, llvm_usize, "")
55855585 else
......@@ -5787,7 +5787,7 @@ pub const FuncGen = struct {
57875787
57885788 fn sliceOrArrayLenInBytes(fg: *FuncGen, ptr: *llvm.Value, ty: Type) *llvm.Value {
57895789 const target = fg.dg.module.getTarget();
5790 const llvm_usize_ty = fg.context.intType(target.cpu.arch.ptrBitWidth());
5790 const llvm_usize_ty = fg.context.intType(target.ptrBitWidth());
57915791 switch (ty.ptrSize()) {
57925792 .Slice => {
57935793 const len = fg.builder.buildExtractValue(ptr, 1, "");
......@@ -6085,7 +6085,7 @@ pub const FuncGen = struct {
60856085 if (field_offset == 0) {
60866086 return field_ptr;
60876087 }
6088 const llvm_usize_ty = self.context.intType(target.cpu.arch.ptrBitWidth());
6088 const llvm_usize_ty = self.context.intType(target.ptrBitWidth());
60896089
60906090 const field_ptr_int = self.builder.buildPtrToInt(field_ptr, llvm_usize_ty, "");
60916091 const base_ptr_int = self.builder.buildNUWSub(field_ptr_int, llvm_usize_ty.constInt(field_offset, .False), "");
......@@ -8534,7 +8534,7 @@ pub const FuncGen = struct {
85348534 const body_block = self.context.appendBasicBlock(self.llvm_func, "InlineMemsetBody");
85358535 const end_block = self.context.appendBasicBlock(self.llvm_func, "InlineMemsetEnd");
85368536
8537 const llvm_usize_ty = self.context.intType(target.cpu.arch.ptrBitWidth());
8537 const llvm_usize_ty = self.context.intType(target.ptrBitWidth());
85388538 const len = switch (ptr_ty.ptrSize()) {
85398539 .Slice => self.builder.buildExtractValue(dest_slice, 1, ""),
85408540 .One => llvm_usize_ty.constInt(ptr_ty.childType().arrayLen(), .False),
......@@ -10013,7 +10013,7 @@ pub const FuncGen = struct {
1001310013 fn valgrindMarkUndef(fg: *FuncGen, ptr: *llvm.Value, len: *llvm.Value) void {
1001410014 const VG_USERREQ__MAKE_MEM_UNDEFINED = 1296236545;
1001510015 const target = fg.dg.module.getTarget();
10016 const usize_llvm_ty = fg.context.intType(target.cpu.arch.ptrBitWidth());
10016 const usize_llvm_ty = fg.context.intType(target.ptrBitWidth());
1001710017 const zero = usize_llvm_ty.constInt(0, .False);
1001810018 const req = usize_llvm_ty.constInt(VG_USERREQ__MAKE_MEM_UNDEFINED, .False);
1001910019 const ptr_as_usize = fg.builder.buildPtrToInt(ptr, usize_llvm_ty, "");
......@@ -10033,7 +10033,7 @@ pub const FuncGen = struct {
1003310033 const target = fg.dg.module.getTarget();
1003410034 if (!target_util.hasValgrindSupport(target)) return default_value;
1003510035
10036 const usize_llvm_ty = fg.context.intType(target.cpu.arch.ptrBitWidth());
10036 const usize_llvm_ty = fg.context.intType(target.ptrBitWidth());
1003710037 const usize_alignment = @intCast(c_uint, Type.usize.abiSize(target));
1003810038
1003910039 const array_llvm_ty = usize_llvm_ty.arrayType(6);
src/codegen/spirv.zig+2-2
......@@ -556,7 +556,7 @@ pub const DeclGen = struct {
556556 // TODO: Double check pointer sizes here.
557557 // shared pointers might be u32...
558558 const target = self.dg.getTarget();
559 const width = @divExact(target.cpu.arch.ptrBitWidth(), 8);
559 const width = @divExact(target.ptrBitWidth(), 8);
560560 if (self.size % width != 0) {
561561 return self.dg.todo("misaligned pointer constants", .{});
562562 }
......@@ -1160,7 +1160,7 @@ pub const DeclGen = struct {
11601160
11611161 /// Create an integer type that represents 'usize'.
11621162 fn sizeType(self: *DeclGen) !SpvType.Ref {
1163 return try self.intType(.unsigned, self.getTarget().cpu.arch.ptrBitWidth());
1163 return try self.intType(.unsigned, self.getTarget().ptrBitWidth());
11641164 }
11651165
11661166 /// Generate a union type, optionally with a known field. If the tag alignment is greater
src/glibc.zig+9-9
......@@ -378,7 +378,7 @@ fn start_asm_path(comp: *Compilation, arena: Allocator, basename: []const u8) ![
378378 const is_ppc = arch == .powerpc or arch == .powerpc64 or arch == .powerpc64le;
379379 const is_aarch64 = arch == .aarch64 or arch == .aarch64_be;
380380 const is_sparc = arch == .sparc or arch == .sparcel or arch == .sparc64;
381 const is_64 = arch.ptrBitWidth() == 64;
381 const is_64 = comp.getTarget().ptrBitWidth() == 64;
382382
383383 const s = path.sep_str;
384384
......@@ -435,7 +435,6 @@ fn start_asm_path(comp: *Compilation, arena: Allocator, basename: []const u8) ![
435435
436436fn add_include_dirs(comp: *Compilation, arena: Allocator, args: *std.ArrayList([]const u8)) error{OutOfMemory}!void {
437437 const target = comp.getTarget();
438 const arch = target.cpu.arch;
439438 const opt_nptl: ?[]const u8 = if (target.os.tag == .linux) "nptl" else "htl";
440439
441440 const s = path.sep_str;
......@@ -444,11 +443,11 @@ fn add_include_dirs(comp: *Compilation, arena: Allocator, args: *std.ArrayList([
444443 try args.append(try lib_path(comp, arena, lib_libc_glibc ++ "include"));
445444
446445 if (target.os.tag == .linux) {
447 try add_include_dirs_arch(arena, args, arch, null, try lib_path(comp, arena, lib_libc_glibc ++ "sysdeps" ++ s ++ "unix" ++ s ++ "sysv" ++ s ++ "linux"));
446 try add_include_dirs_arch(arena, args, target, null, try lib_path(comp, arena, lib_libc_glibc ++ "sysdeps" ++ s ++ "unix" ++ s ++ "sysv" ++ s ++ "linux"));
448447 }
449448
450449 if (opt_nptl) |nptl| {
451 try add_include_dirs_arch(arena, args, arch, nptl, try lib_path(comp, arena, lib_libc_glibc ++ "sysdeps"));
450 try add_include_dirs_arch(arena, args, target, nptl, try lib_path(comp, arena, lib_libc_glibc ++ "sysdeps"));
452451 }
453452
454453 if (target.os.tag == .linux) {
......@@ -474,12 +473,12 @@ fn add_include_dirs(comp: *Compilation, arena: Allocator, args: *std.ArrayList([
474473 try args.append("-I");
475474 try args.append(try lib_path(comp, arena, lib_libc_glibc ++ "sysdeps" ++ s ++ "unix" ++ s ++ "sysv"));
476475
477 try add_include_dirs_arch(arena, args, arch, null, try lib_path(comp, arena, lib_libc_glibc ++ "sysdeps" ++ s ++ "unix"));
476 try add_include_dirs_arch(arena, args, target, null, try lib_path(comp, arena, lib_libc_glibc ++ "sysdeps" ++ s ++ "unix"));
478477
479478 try args.append("-I");
480479 try args.append(try lib_path(comp, arena, lib_libc_glibc ++ "sysdeps" ++ s ++ "unix"));
481480
482 try add_include_dirs_arch(arena, args, arch, null, try lib_path(comp, arena, lib_libc_glibc ++ "sysdeps"));
481 try add_include_dirs_arch(arena, args, target, null, try lib_path(comp, arena, lib_libc_glibc ++ "sysdeps"));
483482
484483 try args.append("-I");
485484 try args.append(try lib_path(comp, arena, lib_libc_glibc ++ "sysdeps" ++ s ++ "generic"));
......@@ -489,7 +488,7 @@ fn add_include_dirs(comp: *Compilation, arena: Allocator, args: *std.ArrayList([
489488
490489 try args.append("-I");
491490 try args.append(try std.fmt.allocPrint(arena, "{s}" ++ s ++ "libc" ++ s ++ "include" ++ s ++ "{s}-{s}-{s}", .{
492 comp.zig_lib_directory.path.?, @tagName(arch), @tagName(target.os.tag), @tagName(target.abi),
491 comp.zig_lib_directory.path.?, @tagName(target.cpu.arch), @tagName(target.os.tag), @tagName(target.abi),
493492 }));
494493
495494 try args.append("-I");
......@@ -508,15 +507,16 @@ fn add_include_dirs(comp: *Compilation, arena: Allocator, args: *std.ArrayList([
508507fn add_include_dirs_arch(
509508 arena: Allocator,
510509 args: *std.ArrayList([]const u8),
511 arch: std.Target.Cpu.Arch,
510 target: std.Target,
512511 opt_nptl: ?[]const u8,
513512 dir: []const u8,
514513) error{OutOfMemory}!void {
514 const arch = target.cpu.arch;
515515 const is_x86 = arch == .x86 or arch == .x86_64;
516516 const is_aarch64 = arch == .aarch64 or arch == .aarch64_be;
517517 const is_ppc = arch == .powerpc or arch == .powerpc64 or arch == .powerpc64le;
518518 const is_sparc = arch == .sparc or arch == .sparcel or arch == .sparc64;
519 const is_64 = arch.ptrBitWidth() == 64;
519 const is_64 = target.ptrBitWidth() == 64;
520520
521521 const s = path.sep_str;
522522
src/link/Coff.zig+1-1
......@@ -245,7 +245,7 @@ pub fn openPath(allocator: Allocator, sub_path: []const u8, options: link.Option
245245}
246246
247247pub fn createEmpty(gpa: Allocator, options: link.Options) !*Coff {
248 const ptr_width: PtrWidth = switch (options.target.cpu.arch.ptrBitWidth()) {
248 const ptr_width: PtrWidth = switch (options.target.ptrBitWidth()) {
249249 0...32 => .p32,
250250 33...64 => .p64,
251251 else => return error.UnsupportedCOFFArchitecture,
src/link/Coff/lld.zig+1-1
......@@ -199,7 +199,7 @@ pub fn linkWithLLD(self: *Coff, comp: *Compilation, prog_node: *std.Progress.Nod
199199 } else if (target.cpu.arch == .x86_64) {
200200 try argv.append("-MACHINE:X64");
201201 } else if (target.cpu.arch.isARM()) {
202 if (target.cpu.arch.ptrBitWidth() == 32) {
202 if (target.ptrBitWidth() == 32) {
203203 try argv.append("-MACHINE:ARM");
204204 } else {
205205 try argv.append("-MACHINE:ARM64");
src/link/Dwarf.zig+3-3
......@@ -260,7 +260,7 @@ pub const DeclState = struct {
260260 .Pointer => {
261261 if (ty.isSlice()) {
262262 // Slices are structs: struct { .ptr = *, .len = N }
263 const ptr_bits = target.cpu.arch.ptrBitWidth();
263 const ptr_bits = target.ptrBitWidth();
264264 const ptr_bytes = @intCast(u8, @divExact(ptr_bits, 8));
265265 // DW.AT.structure_type
266266 try dbg_info_buffer.ensureUnusedCapacity(2);
......@@ -751,7 +751,7 @@ pub const DeclState = struct {
751751 .memory,
752752 .linker_load,
753753 => {
754 const ptr_width = @intCast(u8, @divExact(target.cpu.arch.ptrBitWidth(), 8));
754 const ptr_width = @intCast(u8, @divExact(target.ptrBitWidth(), 8));
755755 try dbg_info.ensureUnusedCapacity(2 + ptr_width);
756756 dbg_info.appendSliceAssumeCapacity(&[2]u8{ // DW.AT.location, DW.FORM.exprloc
757757 1 + ptr_width + @boolToInt(is_ptr),
......@@ -928,7 +928,7 @@ const min_nop_size = 2;
928928const ideal_factor = 3;
929929
930930pub fn init(allocator: Allocator, bin_file: *File, target: std.Target) Dwarf {
931 const ptr_width: PtrWidth = switch (target.cpu.arch.ptrBitWidth()) {
931 const ptr_width: PtrWidth = switch (target.ptrBitWidth()) {
932932 0...32 => .p32,
933933 33...64 => .p64,
934934 else => unreachable,
src/link/Elf.zig+6-6
......@@ -273,7 +273,7 @@ pub fn openPath(allocator: Allocator, sub_path: []const u8, options: link.Option
273273}
274274
275275pub fn createEmpty(gpa: Allocator, options: link.Options) !*Elf {
276 const ptr_width: PtrWidth = switch (options.target.cpu.arch.ptrBitWidth()) {
276 const ptr_width: PtrWidth = switch (options.target.ptrBitWidth()) {
277277 0...32 => .p32,
278278 33...64 => .p64,
279279 else => return error.UnsupportedELFArchitecture,
......@@ -474,7 +474,7 @@ pub fn populateMissingMetadata(self: *Elf) !void {
474474 if (self.phdr_table_load_index == null) {
475475 self.phdr_table_load_index = @intCast(u16, self.program_headers.items.len);
476476 // TODO Same as for GOT
477 const phdr_addr: u64 = if (self.base.options.target.cpu.arch.ptrBitWidth() >= 32) 0x1000000 else 0x1000;
477 const phdr_addr: u64 = if (self.base.options.target.ptrBitWidth() >= 32) 0x1000000 else 0x1000;
478478 const p_align = self.page_size;
479479 try self.program_headers.append(gpa, .{
480480 .p_type = elf.PT_LOAD,
......@@ -521,7 +521,7 @@ pub fn populateMissingMetadata(self: *Elf) !void {
521521 // TODO instead of hard coding the vaddr, make a function to find a vaddr to put things at.
522522 // we'll need to re-use that function anyway, in case the GOT grows and overlaps something
523523 // else in virtual memory.
524 const got_addr: u32 = if (self.base.options.target.cpu.arch.ptrBitWidth() >= 32) 0x4000000 else 0x8000;
524 const got_addr: u32 = if (self.base.options.target.ptrBitWidth() >= 32) 0x4000000 else 0x8000;
525525 try self.program_headers.append(gpa, .{
526526 .p_type = elf.PT_LOAD,
527527 .p_offset = off,
......@@ -544,7 +544,7 @@ pub fn populateMissingMetadata(self: *Elf) !void {
544544 const off = self.findFreeSpace(file_size, p_align);
545545 log.debug("found PT_LOAD RO free space 0x{x} to 0x{x}", .{ off, off + file_size });
546546 // TODO Same as for GOT
547 const rodata_addr: u32 = if (self.base.options.target.cpu.arch.ptrBitWidth() >= 32) 0xc000000 else 0xa000;
547 const rodata_addr: u32 = if (self.base.options.target.ptrBitWidth() >= 32) 0xc000000 else 0xa000;
548548 try self.program_headers.append(gpa, .{
549549 .p_type = elf.PT_LOAD,
550550 .p_offset = off,
......@@ -567,7 +567,7 @@ pub fn populateMissingMetadata(self: *Elf) !void {
567567 const off = self.findFreeSpace(file_size, p_align);
568568 log.debug("found PT_LOAD RW free space 0x{x} to 0x{x}", .{ off, off + file_size });
569569 // TODO Same as for GOT
570 const rwdata_addr: u32 = if (self.base.options.target.cpu.arch.ptrBitWidth() >= 32) 0x10000000 else 0xc000;
570 const rwdata_addr: u32 = if (self.base.options.target.ptrBitWidth() >= 32) 0x10000000 else 0xc000;
571571 try self.program_headers.append(gpa, .{
572572 .p_type = elf.PT_LOAD,
573573 .p_offset = off,
......@@ -3180,7 +3180,7 @@ fn ptrWidthBytes(self: Elf) u8 {
31803180/// Does not necessarily match `ptrWidthBytes` for example can be 2 bytes
31813181/// in a 32-bit ELF file.
31823182fn archPtrWidthBytes(self: Elf) u8 {
3183 return @intCast(u8, self.base.options.target.cpu.arch.ptrBitWidth() / 8);
3183 return @intCast(u8, self.base.options.target.ptrBitWidth() / 8);
31843184}
31853185
31863186fn progHeaderTo32(phdr: elf.Elf64_Phdr) elf.Elf32_Phdr {
src/link/Elf/Atom.zig+1-1
......@@ -59,7 +59,7 @@ pub fn getOffsetTableAddress(self: Atom, elf_file: *Elf) u64 {
5959 const sym_index = self.getSymbolIndex().?;
6060 const got_entry_index = elf_file.got_table.lookup.get(sym_index).?;
6161 const target = elf_file.base.options.target;
62 const ptr_bits = target.cpu.arch.ptrBitWidth();
62 const ptr_bits = target.ptrBitWidth();
6363 const ptr_bytes: u64 = @divExact(ptr_bits, 8);
6464 const got = elf_file.program_headers.items[elf_file.phdr_got_index.?];
6565 return got.p_vaddr + got_entry_index * ptr_bytes;
src/link/Plan9.zig+1-1
......@@ -183,7 +183,7 @@ pub fn defaultBaseAddrs(arch: std.Target.Cpu.Arch) Bases {
183183pub fn createEmpty(gpa: Allocator, options: link.Options) !*Plan9 {
184184 if (options.use_llvm)
185185 return error.LLVMBackendDoesNotSupportPlan9;
186 const sixtyfour_bit: bool = switch (options.target.cpu.arch.ptrBitWidth()) {
186 const sixtyfour_bit: bool = switch (options.target.ptrBitWidth()) {
187187 0...32 => false,
188188 33...64 => true,
189189 else => return error.UnsupportedP9Architecture,
src/mingw.zig+1-1
......@@ -265,7 +265,7 @@ fn add_cc_args(
265265 });
266266
267267 const target = comp.getTarget();
268 if (target.cpu.arch.isARM() and target.cpu.arch.ptrBitWidth() == 32) {
268 if (target.cpu.arch.isARM() and target.ptrBitWidth() == 32) {
269269 try args.append("-mfpu=vfp");
270270 }
271271
src/musl.zig+1-1
......@@ -194,7 +194,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr
194194 const arch_define = try std.fmt.allocPrint(arena, "-DARCH_{s}", .{
195195 @tagName(target.cpu.arch),
196196 });
197 const clang_argv: []const []const u8 = if (target.cpu.arch.ptrBitWidth() == 64)
197 const clang_argv: []const []const u8 = if (target.ptrBitWidth() == 64)
198198 &[_][]const u8{ "-DPTR64", arch_define }
199199 else
200200 &[_][]const u8{arch_define};
src/type.zig+18-18
......@@ -2936,7 +2936,7 @@ pub const Type = extern union {
29362936 .manyptr_const_u8_sentinel_0,
29372937 .@"anyframe",
29382938 .anyframe_T,
2939 => return AbiAlignmentAdvanced{ .scalar = @divExact(target.cpu.arch.ptrBitWidth(), 8) },
2939 => return AbiAlignmentAdvanced{ .scalar = @divExact(target.ptrBitWidth(), 8) },
29402940
29412941 .c_char => return AbiAlignmentAdvanced{ .scalar = target.c_type_alignment(.char) },
29422942 .c_short => return AbiAlignmentAdvanced{ .scalar = target.c_type_alignment(.short) },
......@@ -3007,7 +3007,7 @@ pub const Type = extern union {
30073007 const child_type = ty.optionalChild(&buf);
30083008
30093009 switch (child_type.zigTypeTag()) {
3010 .Pointer => return AbiAlignmentAdvanced{ .scalar = @divExact(target.cpu.arch.ptrBitWidth(), 8) },
3010 .Pointer => return AbiAlignmentAdvanced{ .scalar = @divExact(target.ptrBitWidth(), 8) },
30113011 .ErrorSet => return abiAlignmentAdvanced(Type.anyerror, target, strat),
30123012 .NoReturn => return AbiAlignmentAdvanced{ .scalar = 0 },
30133013 else => {},
......@@ -3069,7 +3069,7 @@ pub const Type = extern union {
30693069 // We'll guess "pointer-aligned", if the struct has an
30703070 // underaligned pointer field then some allocations
30713071 // might require explicit alignment.
3072 return AbiAlignmentAdvanced{ .scalar = @divExact(target.cpu.arch.ptrBitWidth(), 8) };
3072 return AbiAlignmentAdvanced{ .scalar = @divExact(target.ptrBitWidth(), 8) };
30733073 }
30743074 _ = try sema.resolveTypeFields(ty);
30753075 }
......@@ -3195,7 +3195,7 @@ pub const Type = extern union {
31953195 // We'll guess "pointer-aligned", if the union has an
31963196 // underaligned pointer field then some allocations
31973197 // might require explicit alignment.
3198 return AbiAlignmentAdvanced{ .scalar = @divExact(target.cpu.arch.ptrBitWidth(), 8) };
3198 return AbiAlignmentAdvanced{ .scalar = @divExact(target.ptrBitWidth(), 8) };
31993199 }
32003200 _ = try sema.resolveTypeFields(ty);
32013201 }
......@@ -3419,17 +3419,17 @@ pub const Type = extern union {
34193419 .manyptr_u8,
34203420 .manyptr_const_u8,
34213421 .manyptr_const_u8_sentinel_0,
3422 => return AbiSizeAdvanced{ .scalar = @divExact(target.cpu.arch.ptrBitWidth(), 8) },
3422 => return AbiSizeAdvanced{ .scalar = @divExact(target.ptrBitWidth(), 8) },
34233423
34243424 .const_slice,
34253425 .mut_slice,
34263426 .const_slice_u8,
34273427 .const_slice_u8_sentinel_0,
3428 => return AbiSizeAdvanced{ .scalar = @divExact(target.cpu.arch.ptrBitWidth(), 8) * 2 },
3428 => return AbiSizeAdvanced{ .scalar = @divExact(target.ptrBitWidth(), 8) * 2 },
34293429
34303430 .pointer => switch (ty.castTag(.pointer).?.data.size) {
3431 .Slice => return AbiSizeAdvanced{ .scalar = @divExact(target.cpu.arch.ptrBitWidth(), 8) * 2 },
3432 else => return AbiSizeAdvanced{ .scalar = @divExact(target.cpu.arch.ptrBitWidth(), 8) },
3431 .Slice => return AbiSizeAdvanced{ .scalar = @divExact(target.ptrBitWidth(), 8) * 2 },
3432 else => return AbiSizeAdvanced{ .scalar = @divExact(target.ptrBitWidth(), 8) },
34333433 },
34343434
34353435 .c_char => return AbiSizeAdvanced{ .scalar = target.c_type_byte_size(.char) },
......@@ -3702,20 +3702,20 @@ pub const Type = extern union {
37023702 .usize,
37033703 .@"anyframe",
37043704 .anyframe_T,
3705 => return target.cpu.arch.ptrBitWidth(),
3705 => return target.ptrBitWidth(),
37063706
37073707 .const_slice,
37083708 .mut_slice,
3709 => return target.cpu.arch.ptrBitWidth() * 2,
3709 => return target.ptrBitWidth() * 2,
37103710
37113711 .const_slice_u8,
37123712 .const_slice_u8_sentinel_0,
3713 => return target.cpu.arch.ptrBitWidth() * 2,
3713 => return target.ptrBitWidth() * 2,
37143714
37153715 .optional_single_const_pointer,
37163716 .optional_single_mut_pointer,
37173717 => {
3718 return target.cpu.arch.ptrBitWidth();
3718 return target.ptrBitWidth();
37193719 },
37203720
37213721 .single_const_pointer,
......@@ -3725,18 +3725,18 @@ pub const Type = extern union {
37253725 .c_const_pointer,
37263726 .c_mut_pointer,
37273727 => {
3728 return target.cpu.arch.ptrBitWidth();
3728 return target.ptrBitWidth();
37293729 },
37303730
37313731 .pointer => switch (ty.castTag(.pointer).?.data.size) {
3732 .Slice => return target.cpu.arch.ptrBitWidth() * 2,
3733 else => return target.cpu.arch.ptrBitWidth(),
3732 .Slice => return target.ptrBitWidth() * 2,
3733 else => return target.ptrBitWidth(),
37343734 },
37353735
37363736 .manyptr_u8,
37373737 .manyptr_const_u8,
37383738 .manyptr_const_u8_sentinel_0,
3739 => return target.cpu.arch.ptrBitWidth(),
3739 => return target.ptrBitWidth(),
37403740
37413741 .c_char => return target.c_type_bit_size(.char),
37423742 .c_short => return target.c_type_bit_size(.short),
......@@ -4624,8 +4624,8 @@ pub const Type = extern union {
46244624 .i64 => return .{ .signedness = .signed, .bits = 64 },
46254625 .u128 => return .{ .signedness = .unsigned, .bits = 128 },
46264626 .i128 => return .{ .signedness = .signed, .bits = 128 },
4627 .usize => return .{ .signedness = .unsigned, .bits = target.cpu.arch.ptrBitWidth() },
4628 .isize => return .{ .signedness = .signed, .bits = target.cpu.arch.ptrBitWidth() },
4627 .usize => return .{ .signedness = .unsigned, .bits = target.ptrBitWidth() },
4628 .isize => return .{ .signedness = .signed, .bits = target.ptrBitWidth() },
46294629 .c_char => return .{ .signedness = .signed, .bits = target.c_type_bit_size(.char) },
46304630 .c_short => return .{ .signedness = .signed, .bits = target.c_type_bit_size(.short) },
46314631 .c_ushort => return .{ .signedness = .unsigned, .bits = target.c_type_bit_size(.ushort) },
src/value.zig+1-1
......@@ -1922,7 +1922,7 @@ pub const Value = extern union {
19221922 .variable,
19231923 .eu_payload_ptr,
19241924 .opt_payload_ptr,
1925 => return target.cpu.arch.ptrBitWidth(),
1925 => return target.ptrBitWidth(),
19261926
19271927 else => {
19281928 var buffer: BigIntSpace = undefined;