authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2024-08-12 09:02:46+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2024-08-12 09:03:08+02:00
log9f1fb45201e59945acc7e48fc394bba4064d52f5
tree800ed9eb2de2c731cca7b733cf2697cd2fefc04d
parent8af4d651088abba258c40cefdf8f9140cf1d8b57
signaturebadge-check Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

llvm: Move some OS selection prongs for clarity.

This makes it clearer which OSs are not known to or supported by LLVM at all vs the ones where we're intentionally passing choosing "unknown".

1 files changed, 9 insertions(+), 10 deletions(-)

src/codegen/llvm.zig+9-10
...@@ -110,7 +110,7 @@ pub fn targetTriple(allocator: Allocator, target: std.Target) ![]const u8 {...@@ -110,7 +110,7 @@ pub fn targetTriple(allocator: Allocator, target: std.Target) ![]const u8 {
110 .netbsd => "netbsd",110 .netbsd => "netbsd",
111 .openbsd => "openbsd",111 .openbsd => "openbsd",
112 .solaris, .illumos => "solaris",112 .solaris, .illumos => "solaris",
113 .windows => "windows",113 .windows, .uefi => "windows",
114 .zos => "zos",114 .zos => "zos",
115 .haiku => "haiku",115 .haiku => "haiku",
116 .rtems => "rtems",116 .rtems => "rtems",
...@@ -128,7 +128,6 @@ pub fn targetTriple(allocator: Allocator, target: std.Target) ![]const u8 {...@@ -128,7 +128,6 @@ pub fn targetTriple(allocator: Allocator, target: std.Target) ![]const u8 {
128 .hurd => "hurd",128 .hurd => "hurd",
129 .wasi => "wasi",129 .wasi => "wasi",
130 .emscripten => "emscripten",130 .emscripten => "emscripten",
131 .uefi => "windows",
132 .macos => "macosx",131 .macos => "macosx",
133 .ios => "ios",132 .ios => "ios",
134 .tvos => "tvos",133 .tvos => "tvos",
...@@ -205,14 +204,7 @@ pub fn targetTriple(allocator: Allocator, target: std.Target) ![]const u8 {...@@ -205,14 +204,7 @@ pub fn targetTriple(allocator: Allocator, target: std.Target) ![]const u8 {
205204
206pub fn targetOs(os_tag: std.Target.Os.Tag) llvm.OSType {205pub fn targetOs(os_tag: std.Target.Os.Tag) llvm.OSType {
207 return switch (os_tag) {206 return switch (os_tag) {
208 .freestanding,207 .freestanding => .UnknownOS,
209 .other,
210 .opencl,
211 .opengl,
212 .plan9,
213 .contiki,
214 => .UnknownOS,
215
216 .windows, .uefi => .Win32,208 .windows, .uefi => .Win32,
217 .dragonfly => .DragonFly,209 .dragonfly => .DragonFly,
218 .freebsd => .FreeBSD,210 .freebsd => .FreeBSD,
...@@ -231,6 +223,7 @@ pub fn targetOs(os_tag: std.Target.Os.Tag) llvm.OSType {...@@ -231,6 +223,7 @@ pub fn targetOs(os_tag: std.Target.Os.Tag) llvm.OSType {
231 .cuda => .CUDA,223 .cuda => .CUDA,
232 .nvcl => .NVCL,224 .nvcl => .NVCL,
233 .amdhsa => .AMDHSA,225 .amdhsa => .AMDHSA,
226 .opencl => .UnknownOS, // https://llvm.org/docs/SPIRVUsage.html#target-triples
234 .ps4 => .PS4,227 .ps4 => .PS4,
235 .ps5 => .PS5,228 .ps5 => .PS5,
236 .elfiamcu => .ELFIAMCU,229 .elfiamcu => .ELFIAMCU,
...@@ -247,6 +240,12 @@ pub fn targetOs(os_tag: std.Target.Os.Tag) llvm.OSType {...@@ -247,6 +240,12 @@ pub fn targetOs(os_tag: std.Target.Os.Tag) llvm.OSType {
247 .shadermodel => .ShaderModel,240 .shadermodel => .ShaderModel,
248 .vulkan => .Vulkan,241 .vulkan => .Vulkan,
249 .serenity => .Serenity,242 .serenity => .Serenity,
243
244 .opengl,
245 .plan9,
246 .contiki,
247 .other,
248 => .UnknownOS,
250 };249 };
251}250}
252251