Skip to content

Commit

Permalink
llvm: Move some OS selection prongs for clarity.
Browse files Browse the repository at this point in the history
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".
  • Loading branch information
alexrp committed Aug 12, 2024
1 parent 8af4d65 commit 9f1fb45
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions src/codegen/llvm.zig
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ pub fn targetTriple(allocator: Allocator, target: std.Target) ![]const u8 {
.netbsd => "netbsd",
.openbsd => "openbsd",
.solaris, .illumos => "solaris",
.windows => "windows",
.windows, .uefi => "windows",
.zos => "zos",
.haiku => "haiku",
.rtems => "rtems",
Expand All @@ -128,7 +128,6 @@ pub fn targetTriple(allocator: Allocator, target: std.Target) ![]const u8 {
.hurd => "hurd",
.wasi => "wasi",
.emscripten => "emscripten",
.uefi => "windows",
.macos => "macosx",
.ios => "ios",
.tvos => "tvos",
Expand Down Expand Up @@ -205,14 +204,7 @@ pub fn targetTriple(allocator: Allocator, target: std.Target) ![]const u8 {

pub fn targetOs(os_tag: std.Target.Os.Tag) llvm.OSType {
return switch (os_tag) {
.freestanding,
.other,
.opencl,
.opengl,
.plan9,
.contiki,
=> .UnknownOS,

.freestanding => .UnknownOS,
.windows, .uefi => .Win32,
.dragonfly => .DragonFly,
.freebsd => .FreeBSD,
Expand All @@ -231,6 +223,7 @@ pub fn targetOs(os_tag: std.Target.Os.Tag) llvm.OSType {
.cuda => .CUDA,
.nvcl => .NVCL,
.amdhsa => .AMDHSA,
.opencl => .UnknownOS, // https://llvm.org/docs/SPIRVUsage.html#target-triples
.ps4 => .PS4,
.ps5 => .PS5,
.elfiamcu => .ELFIAMCU,
Expand All @@ -247,6 +240,12 @@ pub fn targetOs(os_tag: std.Target.Os.Tag) llvm.OSType {
.shadermodel => .ShaderModel,
.vulkan => .Vulkan,
.serenity => .Serenity,

.opengl,
.plan9,
.contiki,
.other,
=> .UnknownOS,
};
}

Expand Down

0 comments on commit 9f1fb45

Please sign in to comment.