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 {
8181 .spirv => "spirv",
8282 .spirv32 => "spirv32",
8383 .spirv64 => "spirv64",
84 .kalimba => "kalimba",
8584 .lanai => "lanai",
8685 .wasm32 => "wasm32",
8786 .wasm64 => "wasm64",
8887 .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().
9092 };
9193 try llvm_triple.appendSlice(llvm_arch);
9294 try llvm_triple.appendSlice("-unknown-");
......@@ -12083,14 +12085,16 @@ pub fn initializeLLVMTarget(arch: std.Target.Cpu.Arch) void {
1208312085 llvm.LLVMInitializeLoongArchAsmParser();
1208412086 },
1208512087
12086 // LLVM backends that have no initialization functions.
12088 // We don't currently support using these backends.
1208712089 .spirv,
1208812090 .spirv32,
1208912091 .spirv64,
12090 .kalimba,
1209112092 .dxil,
1209212093 => {},
1209312094
12094 .spu_2 => unreachable, // LLVM does not support this backend
12095 // LLVM does does not have a backend for these.
12096 .kalimba,
12097 .spu_2,
12098 => unreachable,
1209512099 }
1209612100}
src/target.zig+11-6
......@@ -119,7 +119,6 @@ pub fn hasLlvmSupport(target: std.Target, ofmt: std.Target.ObjectFormat) bool {
119119 .bpfel,
120120 .bpfeb,
121121 .csky,
122 .dxil,
123122 .hexagon,
124123 .loongarch32,
125124 .loongarch64,
......@@ -147,17 +146,23 @@ pub fn hasLlvmSupport(target: std.Target, ofmt: std.Target.ObjectFormat) bool {
147146 .xtensa,
148147 .nvptx,
149148 .nvptx64,
150 .spirv,
151 .spirv32,
152 .spirv64,
153 .kalimba,
154149 .lanai,
155150 .wasm32,
156151 .wasm64,
157152 .ve,
158153 => 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,
161166 };
162167}
163168