authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-08-07 22:50:08-07:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2024-08-07 22:50:08-07:00
log61fbdebd61678465f72319d93c69e64e2ed3d0a2
tree3514d4f1b69582c37fab48e0aa7b7792c4d0f5d5
parent468b976f63b0938f2a799261b536167959c059b4
parent746f20d21fcd6a0a9ccbf662cd381f16c5064cd6
signaturebadge-check Signed by PGP key B5690EEEBB952194

Merge pull request #20969 from alexrp/llvm-unsup-targets

`llvm`: Fix hasLlvmSupport() for dxil, spirv[32,64], and kalimba.

2 files changed, 20 insertions(+), 11 deletions(-)

src/codegen/llvm.zig+9-5
...@@ -81,12 +81,14 @@ pub fn targetTriple(allocator: Allocator, target: std.Target) ![]const u8 {...@@ -81,12 +81,14 @@ pub fn targetTriple(allocator: Allocator, target: std.Target) ![]const u8 {
81 .spirv => "spirv",81 .spirv => "spirv",
82 .spirv32 => "spirv32",82 .spirv32 => "spirv32",
83 .spirv64 => "spirv64",83 .spirv64 => "spirv64",
84 .kalimba => "kalimba",
85 .lanai => "lanai",84 .lanai => "lanai",
86 .wasm32 => "wasm32",85 .wasm32 => "wasm32",
87 .wasm64 => "wasm64",86 .wasm64 => "wasm64",
88 .ve => "ve",87 .ve => "ve",
89 .spu_2 => return error.@"LLVM backend does not support SPU Mark II",88
89 .kalimba,
90 .spu_2,
91 => unreachable, // Gated by hasLlvmSupport().
90 };92 };
91 try llvm_triple.appendSlice(llvm_arch);93 try llvm_triple.appendSlice(llvm_arch);
92 try llvm_triple.appendSlice("-unknown-");94 try llvm_triple.appendSlice("-unknown-");
...@@ -12083,14 +12085,16 @@ pub fn initializeLLVMTarget(arch: std.Target.Cpu.Arch) void {...@@ -12083,14 +12085,16 @@ pub fn initializeLLVMTarget(arch: std.Target.Cpu.Arch) void {
12083 llvm.LLVMInitializeLoongArchAsmParser();12085 llvm.LLVMInitializeLoongArchAsmParser();
12084 },12086 },
1208512087
12086 // LLVM backends that have no initialization functions.12088 // We don't currently support using these backends.
12087 .spirv,12089 .spirv,
12088 .spirv32,12090 .spirv32,
12089 .spirv64,12091 .spirv64,
12090 .kalimba,
12091 .dxil,12092 .dxil,
12092 => {},12093 => {},
1209312094
12094 .spu_2 => unreachable, // LLVM does not support this backend12095 // LLVM does does not have a backend for these.
12096 .kalimba,
12097 .spu_2,
12098 => unreachable,
12095 }12099 }
12096}12100}
src/target.zig+11-6
...@@ -119,7 +119,6 @@ pub fn hasLlvmSupport(target: std.Target, ofmt: std.Target.ObjectFormat) bool {...@@ -119,7 +119,6 @@ pub fn hasLlvmSupport(target: std.Target, ofmt: std.Target.ObjectFormat) bool {
119 .bpfel,119 .bpfel,
120 .bpfeb,120 .bpfeb,
121 .csky,121 .csky,
122 .dxil,
123 .hexagon,122 .hexagon,
124 .loongarch32,123 .loongarch32,
125 .loongarch64,124 .loongarch64,
...@@ -147,17 +146,23 @@ pub fn hasLlvmSupport(target: std.Target, ofmt: std.Target.ObjectFormat) bool {...@@ -147,17 +146,23 @@ pub fn hasLlvmSupport(target: std.Target, ofmt: std.Target.ObjectFormat) bool {
147 .xtensa,146 .xtensa,
148 .nvptx,147 .nvptx,
149 .nvptx64,148 .nvptx64,
150 .spirv,
151 .spirv32,
152 .spirv64,
153 .kalimba,
154 .lanai,149 .lanai,
155 .wasm32,150 .wasm32,
156 .wasm64,151 .wasm64,
157 .ve,152 .ve,
158 => true,153 => true,
159154
160 .spu_2 => false,155 // An LLVM backend exists but we don't currently support using it.
156 .dxil,
157 .spirv,
158 .spirv32,
159 .spirv64,
160 => false,
161
162 // No LLVM backend exists.
163 .kalimba,
164 .spu_2,
165 => false,
161 };166 };
162}167}
163168