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