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.
This commit is contained in:
Robin Voetter 2022-11-25 01:51:55 +01:00
parent 17de4a88e9
commit 6dc1fafe98
No known key found for this signature in database
GPG Key ID: E755662F227CB468
2 changed files with 10 additions and 0 deletions

View File

@ -1329,6 +1329,7 @@ pub const Target = struct {
.amdgcn => comptime allCpusFromDecls(amdgpu.cpu),
.riscv32, .riscv64 => comptime allCpusFromDecls(riscv.cpu),
.sparc, .sparc64, .sparcel => comptime allCpusFromDecls(sparc.cpu),
.spirv32, .spirv64 => comptime allCpusFromDecls(spirv.cpu),
.s390x => comptime allCpusFromDecls(s390x.cpu),
.x86, .x86_64 => comptime allCpusFromDecls(x86.cpu),
.xtensa => comptime allCpusFromDecls(xtensa.cpu),
@ -1392,6 +1393,7 @@ pub const Target = struct {
.amdgcn => &amdgpu.cpu.generic,
.riscv32 => &riscv.cpu.generic_rv32,
.riscv64 => &riscv.cpu.generic_rv64,
.spirv32, .spirv64 => &spirv.cpu.generic,
.sparc, .sparcel => &sparc.cpu.generic,
.sparc64 => &sparc.cpu.v9, // 64-bit SPARC needs v9 as the baseline
.s390x => &s390x.cpu.generic,

View File

@ -2081,3 +2081,11 @@ pub const all_features = blk: {
}
break :blk result;
};
pub const cpu = struct {
pub const generic = CpuModel{
.name = "generic",
.llvm_name = "generic",
.features = featureSet(&[_]Feature{}),
};
};