Skip to content

Commit

Permalink
std.Target: Remove Cpu.Arch.dxil and ObjectFormat.dxcontainer.
Browse files Browse the repository at this point in the history
See: https://devblogs.microsoft.com/directx/directx-adopting-spir-v

Since we never hooked up the (experimental) DirectX LLVM backend, we've never
actually supported targeting DXIL in Zig. With Microsoft moving away from DXIL,
that seems very unlikely to change.
  • Loading branch information
alexrp committed Sep 20, 2024
1 parent d83a3f1 commit e1e27dc
Show file tree
Hide file tree
Showing 9 changed files with 5 additions and 25 deletions.
3 changes: 0 additions & 3 deletions lib/compiler/aro/aro/target.zig
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,6 @@ pub fn get32BitArchVariant(target: std.Target) ?std.Target {
.spirv,
.spirv32,
.loongarch32,
.dxil,
.xtensa,
=> {}, // Already 32 bit

Expand All @@ -509,7 +508,6 @@ pub fn get64BitArchVariant(target: std.Target) ?std.Target {
.arc,
.avr,
.csky,
.dxil,
.hexagon,
.kalimba,
.lanai,
Expand Down Expand Up @@ -578,7 +576,6 @@ pub fn toLLVMTriple(target: std.Target, buf: []u8) []const u8 {
.bpfel => "bpfel",
.bpfeb => "bpfeb",
.csky => "csky",
.dxil => "dxil",
.hexagon => "hexagon",
.loongarch32 => "loongarch32",
.loongarch64 => "loongarch64",
Expand Down
16 changes: 4 additions & 12 deletions lib/std/Target.zig
Original file line number Diff line number Diff line change
Expand Up @@ -788,8 +788,6 @@ pub const ObjectFormat = enum {
c,
/// The Common Object File Format used by Windows and UEFI.
coff,
/// The DirectX Container format containing either DXIL or DXBC.
dxcontainer,
/// The Executable and Linkable Format used by many Unixes.
elf,
/// The Generalized Object File Format used by z/OS.
Expand All @@ -811,11 +809,13 @@ pub const ObjectFormat = enum {
/// The eXtended Common Object File Format used by AIX.
xcoff,

// LLVM tags deliberately omitted:
// - dxcontainer

pub fn fileExt(of: ObjectFormat, arch: Cpu.Arch) [:0]const u8 {
return switch (of) {
.c => ".c",
.coff => ".obj",
.dxcontainer => ".dxil",
.elf, .goff, .macho, .wasm, .xcoff => ".o",
.hex => ".ihex",
.nvptx => ".ptx",
Expand All @@ -833,7 +833,6 @@ pub const ObjectFormat = enum {
.uefi, .windows => .coff,
.zos => .goff,
else => switch (arch) {
.dxil => .dxcontainer,
.nvptx, .nvptx64 => .nvptx,
.spirv, .spirv32, .spirv64 => .spirv,
.wasm32, .wasm64 => .wasm,
Expand Down Expand Up @@ -873,7 +872,6 @@ pub fn toElfMachine(target: Target) std.elf.EM {
.xcore => .XCORE,
.xtensa => .XTENSA,

.dxil,
.nvptx,
.nvptx64,
.spirv,
Expand Down Expand Up @@ -907,7 +905,6 @@ pub fn toCoffMachine(target: Target) std.coff.MachineType {
.bpfel,
.bpfeb,
.csky,
.dxil,
.hexagon,
.kalimba,
.lanai,
Expand Down Expand Up @@ -1133,7 +1130,6 @@ pub const Cpu = struct {
bpfel,
bpfeb,
csky,
dxil,
hexagon,
kalimba,
lanai,
Expand Down Expand Up @@ -1172,6 +1168,7 @@ pub const Cpu = struct {
// - aarch64_32
// - amdil
// - amdil64
// - dxil
// - le32
// - le64
// - r600
Expand Down Expand Up @@ -1344,7 +1341,6 @@ pub const Cpu = struct {
.spirv,
.spirv32,
.spirv64,
.dxil,
.loongarch32,
.loongarch64,
.arc,
Expand Down Expand Up @@ -1817,7 +1813,6 @@ pub const DynamicLinker = struct {
.kalimba,
.lanai,
.ve,
.dxil,
.loongarch32,
.xtensa,
=> none,
Expand Down Expand Up @@ -1913,7 +1908,6 @@ pub fn ptrBitWidth_cpu_abi(cpu: Cpu, abi: Abi) u16 {
.sparc,
.spirv32,
.loongarch32,
.dxil,
.xtensa,
=> 32,

Expand Down Expand Up @@ -2415,7 +2409,6 @@ pub fn cTypeAlignment(target: Target, c_type: CType) u16 {
.csky,
.x86,
.xcore,
.dxil,
.loongarch32,
.kalimba,
.spu_2,
Expand Down Expand Up @@ -2519,7 +2512,6 @@ pub fn cTypePreferredAlignment(target: Target, c_type: CType) u16 {

.csky,
.xcore,
.dxil,
.loongarch32,
.kalimba,
.spu_2,
Expand Down
1 change: 0 additions & 1 deletion lib/std/zig.zig
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,6 @@ pub fn binNameAlloc(allocator: Allocator, options: BinNameOptions) error{OutOfMe
}),
},
.nvptx => return std.fmt.allocPrint(allocator, "{s}.ptx", .{root_name}),
.dxcontainer => return std.fmt.allocPrint(allocator, "{s}.dxil", .{root_name}),
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/Compilation/Config.zig
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ pub fn resolve(options: Options) ResolveError!Config {
.windows, .uefi => .code_view,
else => .{ .dwarf = .@"32" },
},
.spirv, .nvptx, .dxcontainer, .hex, .raw, .plan9 => .strip,
.spirv, .nvptx, .hex, .raw, .plan9 => .strip,
};
};

Expand Down
1 change: 0 additions & 1 deletion src/Type.zig
Original file line number Diff line number Diff line change
Expand Up @@ -1703,7 +1703,6 @@ pub fn maxIntAlignment(target: std.Target, use_llvm: bool) u16 {
.spirv32,
.ve,
.spirv64,
.dxil,
.loongarch32,
.loongarch64,
.xtensa,
Expand Down
1 change: 0 additions & 1 deletion src/Zcu.zig
Original file line number Diff line number Diff line change
Expand Up @@ -3010,7 +3010,6 @@ pub fn atomicPtrAlignment(
.wasm32,
.csky,
.spirv32,
.dxil,
.loongarch32,
.xtensa,
=> 32,
Expand Down
3 changes: 0 additions & 3 deletions src/codegen/llvm.zig
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ pub fn targetTriple(allocator: Allocator, target: std.Target) ![]const u8 {
.bpfel => "bpfel",
.bpfeb => "bpfeb",
.csky => "csky",
.dxil => "dxil",
.hexagon => "hexagon",
.loongarch32 => "loongarch32",
.loongarch64 => "loongarch64",
Expand Down Expand Up @@ -263,7 +262,6 @@ pub fn targetArch(arch_tag: std.Target.Cpu.Arch) llvm.ArchType {
.bpfel => .bpfel,
.bpfeb => .bpfeb,
.csky => .csky,
.dxil => .dxil,
.hexagon => .hexagon,
.loongarch32 => .loongarch32,
.loongarch64 => .loongarch64,
Expand Down Expand Up @@ -12726,7 +12724,6 @@ pub fn initializeLLVMTarget(arch: std.Target.Cpu.Arch) void {
.spirv,
.spirv32,
.spirv64,
.dxil,
=> {},

// LLVM does does not have a backend for these.
Expand Down
1 change: 0 additions & 1 deletion src/link.zig
Original file line number Diff line number Diff line change
Expand Up @@ -932,7 +932,6 @@ pub const File = struct {
.xcoff => @panic("TODO implement xcoff object format"),
.hex => @panic("TODO implement hex object format"),
.raw => @panic("TODO implement raw object format"),
.dxcontainer => @panic("TODO implement dxcontainer object format"),
};
}

Expand Down
2 changes: 0 additions & 2 deletions src/target.zig
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ pub fn hasLlvmSupport(target: std.Target, ofmt: std.Target.ObjectFormat) bool {
=> return false,

.coff,
.dxcontainer,
.elf,
.goff,
.hex,
Expand Down Expand Up @@ -161,7 +160,6 @@ pub fn hasLlvmSupport(target: std.Target, ofmt: std.Target.ObjectFormat) bool {
=> true,

// An LLVM backend exists but we don't currently support using it.
.dxil,
.spirv,
.spirv32,
.spirv64,
Expand Down

0 comments on commit e1e27dc

Please sign in to comment.