authorgravatar for robin@voetter.nlRobin Voetter <robin@voetter.nl> 2022-11-25 01:51:55+01:00
committergravatar for robin@voetter.nlRobin Voetter <robin@voetter.nl> 2023-04-09 01:51:47+02:00
log6dc1fafe9882bdfb063c9bc02149c4a97fcaa2b5
tree60c6e7b4d5ac2812733e87d97c67a72e142f0aa2
parent17de4a88e9d494cfd7e07ab5277b5e335a2dc9e3
signaturelock-open Commit is signed but in an unrecognized format.

std: add generic target for spirv

This adds a general target for SPIR-V compilation. Previously there was not any target machine defined for SPIR-V. TODO is to reword the features for this target. We don't really need the full list of capabilities in the features, we should only put a few features here which we can actually use during code generation.

2 files changed, 10 insertions(+), 0 deletions(-)

lib/std/target.zig+2
...@@ -1329,6 +1329,7 @@ pub const Target = struct {...@@ -1329,6 +1329,7 @@ pub const Target = struct {
1329 .amdgcn => comptime allCpusFromDecls(amdgpu.cpu),1329 .amdgcn => comptime allCpusFromDecls(amdgpu.cpu),
1330 .riscv32, .riscv64 => comptime allCpusFromDecls(riscv.cpu),1330 .riscv32, .riscv64 => comptime allCpusFromDecls(riscv.cpu),
1331 .sparc, .sparc64, .sparcel => comptime allCpusFromDecls(sparc.cpu),1331 .sparc, .sparc64, .sparcel => comptime allCpusFromDecls(sparc.cpu),
1332 .spirv32, .spirv64 => comptime allCpusFromDecls(spirv.cpu),
1332 .s390x => comptime allCpusFromDecls(s390x.cpu),1333 .s390x => comptime allCpusFromDecls(s390x.cpu),
1333 .x86, .x86_64 => comptime allCpusFromDecls(x86.cpu),1334 .x86, .x86_64 => comptime allCpusFromDecls(x86.cpu),
1334 .xtensa => comptime allCpusFromDecls(xtensa.cpu),1335 .xtensa => comptime allCpusFromDecls(xtensa.cpu),
...@@ -1392,6 +1393,7 @@ pub const Target = struct {...@@ -1392,6 +1393,7 @@ pub const Target = struct {
1392 .amdgcn => &amdgpu.cpu.generic,1393 .amdgcn => &amdgpu.cpu.generic,
1393 .riscv32 => &riscv.cpu.generic_rv32,1394 .riscv32 => &riscv.cpu.generic_rv32,
1394 .riscv64 => &riscv.cpu.generic_rv64,1395 .riscv64 => &riscv.cpu.generic_rv64,
1396 .spirv32, .spirv64 => &spirv.cpu.generic,
1395 .sparc, .sparcel => &sparc.cpu.generic,1397 .sparc, .sparcel => &sparc.cpu.generic,
1396 .sparc64 => &sparc.cpu.v9, // 64-bit SPARC needs v9 as the baseline1398 .sparc64 => &sparc.cpu.v9, // 64-bit SPARC needs v9 as the baseline
1397 .s390x => &s390x.cpu.generic,1399 .s390x => &s390x.cpu.generic,
lib/std/target/spirv.zig+8
...@@ -2081,3 +2081,11 @@ pub const all_features = blk: {...@@ -2081,3 +2081,11 @@ pub const all_features = blk: {
2081 }2081 }
2082 break :blk result;2082 break :blk result;
2083};2083};
2084
2085pub const cpu = struct {
2086 pub const generic = CpuModel{
2087 .name = "generic",
2088 .llvm_name = "generic",
2089 .features = featureSet(&[_]Feature{}),
2090 };
2091};