| ... | ... | @@ -260,6 +260,7 @@ pub const Target = struct { |
| 260 | 260 | .emscripten, |
| 261 | 261 | .driverkit, |
| 262 | 262 | .shadermodel, |
| 263 | .liteos, |
| 263 | 264 | .uefi, |
| 264 | 265 | .opencl, // TODO: OpenCL versions |
| 265 | 266 | .glsl450, // TODO: GLSL versions |
| ... | ... | @@ -396,7 +397,7 @@ pub const Target = struct { |
| 396 | 397 | /// On Darwin, we always link libSystem which contains libc. |
| 397 | 398 | /// Similarly on FreeBSD and NetBSD we always link system libc |
| 398 | 399 | /// since this is the stable syscall interface. |
| 399 | | pub inline fn requiresLibC(os: Os) bool { |
| 400 | pub fn requiresLibC(os: Os) bool { |
| 400 | 401 | return switch (os.tag) { |
| 401 | 402 | .freebsd, |
| 402 | 403 | .netbsd, |
| ... | ... | @@ -438,6 +439,7 @@ pub const Target = struct { |
| 438 | 439 | .emscripten, |
| 439 | 440 | .driverkit, |
| 440 | 441 | .shadermodel, |
| 442 | .liteos, |
| 441 | 443 | .uefi, |
| 442 | 444 | .opencl, |
| 443 | 445 | .glsl450, |
| ... | ... | @@ -566,6 +568,7 @@ pub const Target = struct { |
| 566 | 568 | .watchos, |
| 567 | 569 | .driverkit, |
| 568 | 570 | .shadermodel, |
| 571 | .liteos, // TODO: audit this |
| 569 | 572 | => return .none, |
| 570 | 573 | } |
| 571 | 574 | } |
| ... | ... | @@ -976,7 +979,7 @@ pub const Target = struct { |
| 976 | 979 | return error.UnknownCpuModel; |
| 977 | 980 | } |
| 978 | 981 | |
| 979 | | pub inline fn toElfMachine(arch: Arch) std.elf.EM { |
| 982 | pub fn toElfMachine(arch: Arch) std.elf.EM { |
| 980 | 983 | return switch (arch) { |
| 981 | 984 | .avr => .AVR, |
| 982 | 985 | .msp430 => .MSP430, |
| ... | ... | @@ -1041,7 +1044,7 @@ pub const Target = struct { |
| 1041 | 1044 | }; |
| 1042 | 1045 | } |
| 1043 | 1046 | |
| 1044 | | pub inline fn toCoffMachine(arch: Arch) std.coff.MachineType { |
| 1047 | pub fn toCoffMachine(arch: Arch) std.coff.MachineType { |
| 1045 | 1048 | return switch (arch) { |
| 1046 | 1049 | .avr => .Unknown, |
| 1047 | 1050 | .msp430 => .Unknown, |
| ... | ... | @@ -1106,7 +1109,7 @@ pub const Target = struct { |
| 1106 | 1109 | }; |
| 1107 | 1110 | } |
| 1108 | 1111 | |
| 1109 | | pub inline fn endian(arch: Arch) std.builtin.Endian { |
| 1112 | pub fn endian(arch: Arch) std.builtin.Endian { |
| 1110 | 1113 | return switch (arch) { |
| 1111 | 1114 | .avr, |
| 1112 | 1115 | .arm, |
| ... | ... | @@ -1177,7 +1180,7 @@ pub const Target = struct { |
| 1177 | 1180 | } |
| 1178 | 1181 | |
| 1179 | 1182 | /// Returns whether this architecture supports the address space |
| 1180 | | pub inline fn supportsAddressSpace(arch: Arch, address_space: std.builtin.AddressSpace) bool { |
| 1183 | pub fn supportsAddressSpace(arch: Arch, address_space: std.builtin.AddressSpace) bool { |
| 1181 | 1184 | const is_nvptx = arch == .nvptx or arch == .nvptx64; |
| 1182 | 1185 | const is_spirv = arch == .spirv32 or arch == .spirv64; |
| 1183 | 1186 | const is_gpu = is_nvptx or is_spirv or arch == .amdgcn; |
| ... | ... | @@ -1715,6 +1718,7 @@ pub const Target = struct { |
| 1715 | 1718 | .hurd, |
| 1716 | 1719 | .driverkit, |
| 1717 | 1720 | .shadermodel, |
| 1721 | .liteos, |
| 1718 | 1722 | => return result, |
| 1719 | 1723 | } |
| 1720 | 1724 | } |
| ... | ... | @@ -1743,7 +1747,7 @@ pub const Target = struct { |
| 1743 | 1747 | }; |
| 1744 | 1748 | } |
| 1745 | 1749 | |
| 1746 | | pub inline fn maxIntAlignment(target: Target) u16 { |
| 1750 | pub fn maxIntAlignment(target: Target) u16 { |
| 1747 | 1751 | return switch (target.cpu.arch) { |
| 1748 | 1752 | .avr => 1, |
| 1749 | 1753 | .msp430 => 2, |
| ... | ... | @@ -1833,7 +1837,7 @@ pub const Target = struct { |
| 1833 | 1837 | }; |
| 1834 | 1838 | } |
| 1835 | 1839 | |
| 1836 | | pub inline fn ptrBitWidth(target: Target) u16 { |
| 1840 | pub fn ptrBitWidth(target: Target) u16 { |
| 1837 | 1841 | switch (target.abi) { |
| 1838 | 1842 | .gnux32, .muslx32, .gnuabin32, .gnuilp32 => return 32, |
| 1839 | 1843 | .gnuabi64 => return 64, |
| ... | ... | @@ -1910,7 +1914,7 @@ pub const Target = struct { |
| 1910 | 1914 | } |
| 1911 | 1915 | } |
| 1912 | 1916 | |
| 1913 | | pub inline fn stackAlignment(target: Target) u16 { |
| 1917 | pub fn stackAlignment(target: Target) u16 { |
| 1914 | 1918 | return switch (target.cpu.arch) { |
| 1915 | 1919 | .m68k => 2, |
| 1916 | 1920 | .amdgcn => 4, |
| ... | ... | @@ -1955,7 +1959,7 @@ pub const Target = struct { |
| 1955 | 1959 | /// Default signedness of `char` for the native C compiler for this target |
| 1956 | 1960 | /// Note that char signedness is implementation-defined and many compilers provide |
| 1957 | 1961 | /// an option to override the default signedness e.g. GCC's -funsigned-char / -fsigned-char |
| 1958 | | pub inline fn charSignedness(target: Target) std.builtin.Signedness { |
| 1962 | pub fn charSignedness(target: Target) std.builtin.Signedness { |
| 1959 | 1963 | switch (target.cpu.arch) { |
| 1960 | 1964 | .aarch64, |
| 1961 | 1965 | .aarch64_32, |
| ... | ... | @@ -1994,7 +1998,7 @@ pub const Target = struct { |
| 1994 | 1998 | longdouble, |
| 1995 | 1999 | }; |
| 1996 | 2000 | |
| 1997 | | pub inline fn c_type_byte_size(t: Target, c_type: CType) u16 { |
| 2001 | pub fn c_type_byte_size(t: Target, c_type: CType) u16 { |
| 1998 | 2002 | return switch (c_type) { |
| 1999 | 2003 | .char, |
| 2000 | 2004 | .short, |
| ... | ... | @@ -2020,7 +2024,7 @@ pub const Target = struct { |
| 2020 | 2024 | }; |
| 2021 | 2025 | } |
| 2022 | 2026 | |
| 2023 | | pub inline fn c_type_bit_size(target: Target, c_type: CType) u16 { |
| 2027 | pub fn c_type_bit_size(target: Target, c_type: CType) u16 { |
| 2024 | 2028 | switch (target.os.tag) { |
| 2025 | 2029 | .freestanding, .other => switch (target.cpu.arch) { |
| 2026 | 2030 | .msp430 => switch (c_type) { |
| ... | ... | @@ -2330,11 +2334,12 @@ pub const Target = struct { |
| 2330 | 2334 | .vulkan, |
| 2331 | 2335 | .driverkit, |
| 2332 | 2336 | .shadermodel, |
| 2337 | .liteos, |
| 2333 | 2338 | => @panic("TODO specify the C integer and float type sizes for this OS"), |
| 2334 | 2339 | } |
| 2335 | 2340 | } |
| 2336 | 2341 | |
| 2337 | | pub inline fn c_type_alignment(target: Target, c_type: CType) u16 { |
| 2342 | pub fn c_type_alignment(target: Target, c_type: CType) u16 { |
| 2338 | 2343 | // Overrides for unusual alignments |
| 2339 | 2344 | switch (target.cpu.arch) { |
| 2340 | 2345 | .avr => return 1, |
| ... | ... | @@ -2441,7 +2446,7 @@ pub const Target = struct { |
| 2441 | 2446 | ); |
| 2442 | 2447 | } |
| 2443 | 2448 | |
| 2444 | | pub inline fn c_type_preferred_alignment(target: Target, c_type: CType) u16 { |
| 2449 | pub fn c_type_preferred_alignment(target: Target, c_type: CType) u16 { |
| 2445 | 2450 | // Overrides for unusual alignments |
| 2446 | 2451 | switch (target.cpu.arch) { |
| 2447 | 2452 | .arm, .armeb, .thumb, .thumbeb => switch (target.os.tag) { |