| author | |
| committer | |
| log | ab607d455e47c35b980c3281ef5c3fb433a770a7 |
| tree | 061c85fb946c1dc9693c5912ae6336e27ffb58cc |
| parent | 9a6babf482047042d71d3d390933e08b7fb7c925 |
5 files changed, 35 insertions(+), 0 deletions(-)
lib/std/target.zig+23| ... | @@ -57,6 +57,7 @@ pub const Target = struct { | ... | @@ -57,6 +57,7 @@ pub const Target = struct { |
| 57 | wasi, | 57 | wasi, |
| 58 | emscripten, | 58 | emscripten, |
| 59 | uefi, | 59 | uefi, |
| 60 | opencl, // SPIR-V on OpenCL | ||
| 60 | other, | 61 | other, |
| 61 | 62 | ||
| 62 | pub fn isDarwin(tag: Tag) bool { | 63 | pub fn isDarwin(tag: Tag) bool { |
| ... | @@ -248,6 +249,7 @@ pub const Target = struct { | ... | @@ -248,6 +249,7 @@ pub const Target = struct { |
| 248 | .wasi, | 249 | .wasi, |
| 249 | .emscripten, | 250 | .emscripten, |
| 250 | .uefi, | 251 | .uefi, |
| 252 | .opencl, | ||
| 251 | .other, | 253 | .other, |
| 252 | => return .{ .none = {} }, | 254 | => return .{ .none = {} }, |
| 253 | 255 | ||
| ... | @@ -403,6 +405,7 @@ pub const Target = struct { | ... | @@ -403,6 +405,7 @@ pub const Target = struct { |
| 403 | .wasi, | 405 | .wasi, |
| 404 | .emscripten, | 406 | .emscripten, |
| 405 | .uefi, | 407 | .uefi, |
| 408 | .opencl, | ||
| 406 | .other, | 409 | .other, |
| 407 | => false, | 410 | => false, |
| 408 | }; | 411 | }; |
| ... | @@ -421,6 +424,7 @@ pub const Target = struct { | ... | @@ -421,6 +424,7 @@ pub const Target = struct { |
| 421 | pub const powerpc = @import("target/powerpc.zig"); | 424 | pub const powerpc = @import("target/powerpc.zig"); |
| 422 | pub const riscv = @import("target/riscv.zig"); | 425 | pub const riscv = @import("target/riscv.zig"); |
| 423 | pub const sparc = @import("target/sparc.zig"); | 426 | pub const sparc = @import("target/sparc.zig"); |
| 427 | pub const spirv = @import("target/spirv.zig"); | ||
| 424 | pub const systemz = @import("target/systemz.zig"); | 428 | pub const systemz = @import("target/systemz.zig"); |
| 425 | pub const wasm = @import("target/wasm.zig"); | 429 | pub const wasm = @import("target/wasm.zig"); |
| 426 | pub const x86 = @import("target/x86.zig"); | 430 | pub const x86 = @import("target/x86.zig"); |
| ... | @@ -493,6 +497,8 @@ pub const Target = struct { | ... | @@ -493,6 +497,8 @@ pub const Target = struct { |
| 493 | .wasi, | 497 | .wasi, |
| 494 | .emscripten, | 498 | .emscripten, |
| 495 | => return .musl, | 499 | => return .musl, |
| 500 | .opencl, // TODO: Where should this go? | ||
| 501 | => return .none, | ||
| 496 | } | 502 | } |
| 497 | } | 503 | } |
| 498 | 504 | ||
| ... | @@ -528,6 +534,7 @@ pub const Target = struct { | ... | @@ -528,6 +534,7 @@ pub const Target = struct { |
| 528 | macho, | 534 | macho, |
| 529 | wasm, | 535 | wasm, |
| 530 | c, | 536 | c, |
| 537 | spirv, | ||
| 531 | hex, | 538 | hex, |
| 532 | raw, | 539 | raw, |
| 533 | }; | 540 | }; |
| ... | @@ -744,6 +751,8 @@ pub const Target = struct { | ... | @@ -744,6 +751,8 @@ pub const Target = struct { |
| 744 | // Stage1 currently assumes that architectures above this comment | 751 | // Stage1 currently assumes that architectures above this comment |
| 745 | // map one-to-one with the ZigLLVM_ArchType enum. | 752 | // map one-to-one with the ZigLLVM_ArchType enum. |
| 746 | spu_2, | 753 | spu_2, |
| 754 | spirv32, | ||
| 755 | spirv64, | ||
| 747 | 756 | ||
| 748 | pub fn isARM(arch: Arch) bool { | 757 | pub fn isARM(arch: Arch) bool { |
| 749 | return switch (arch) { | 758 | return switch (arch) { |
| ... | @@ -857,6 +866,8 @@ pub const Target = struct { | ... | @@ -857,6 +866,8 @@ pub const Target = struct { |
| 857 | .s390x => ._S390, | 866 | .s390x => ._S390, |
| 858 | .ve => ._NONE, | 867 | .ve => ._NONE, |
| 859 | .spu_2 => ._SPU_2, | 868 | .spu_2 => ._SPU_2, |
| 869 | .spirv32 => ._NONE, | ||
| 870 | .spirv64 => ._NONE, | ||
| 860 | }; | 871 | }; |
| 861 | } | 872 | } |
| 862 | 873 | ||
| ... | @@ -914,6 +925,8 @@ pub const Target = struct { | ... | @@ -914,6 +925,8 @@ pub const Target = struct { |
| 914 | .s390x => .Unknown, | 925 | .s390x => .Unknown, |
| 915 | .ve => .Unknown, | 926 | .ve => .Unknown, |
| 916 | .spu_2 => .Unknown, | 927 | .spu_2 => .Unknown, |
| 928 | .spirv32 => .Unknown, | ||
| 929 | .spirv64 => .Unknown, | ||
| 917 | }; | 930 | }; |
| 918 | } | 931 | } |
| 919 | 932 | ||
| ... | @@ -957,6 +970,9 @@ pub const Target = struct { | ... | @@ -957,6 +970,9 @@ pub const Target = struct { |
| 957 | .shave, | 970 | .shave, |
| 958 | .ve, | 971 | .ve, |
| 959 | .spu_2, | 972 | .spu_2, |
| 973 | // GPU bitness is opaque. For now, assume little endian. | ||
| 974 | .spirv32, | ||
| 975 | .spirv64, | ||
| 960 | => .Little, | 976 | => .Little, |
| 961 | 977 | ||
| 962 | .arc, | 978 | .arc, |
| ... | @@ -1012,6 +1028,7 @@ pub const Target = struct { | ... | @@ -1012,6 +1028,7 @@ pub const Target = struct { |
| 1012 | .wasm32, | 1028 | .wasm32, |
| 1013 | .renderscript32, | 1029 | .renderscript32, |
| 1014 | .aarch64_32, | 1030 | .aarch64_32, |
| 1031 | .spirv32, | ||
| 1015 | => return 32, | 1032 | => return 32, |
| 1016 | 1033 | ||
| 1017 | .aarch64, | 1034 | .aarch64, |
| ... | @@ -1035,6 +1052,7 @@ pub const Target = struct { | ... | @@ -1035,6 +1052,7 @@ pub const Target = struct { |
| 1035 | .sparcv9, | 1052 | .sparcv9, |
| 1036 | .s390x, | 1053 | .s390x, |
| 1037 | .ve, | 1054 | .ve, |
| 1055 | .spirv64, | ||
| 1038 | => return 64, | 1056 | => return 64, |
| 1039 | } | 1057 | } |
| 1040 | } | 1058 | } |
| ... | @@ -1057,6 +1075,7 @@ pub const Target = struct { | ... | @@ -1057,6 +1075,7 @@ pub const Target = struct { |
| 1057 | .i386, .x86_64 => "x86", | 1075 | .i386, .x86_64 => "x86", |
| 1058 | .nvptx, .nvptx64 => "nvptx", | 1076 | .nvptx, .nvptx64 => "nvptx", |
| 1059 | .wasm32, .wasm64 => "wasm", | 1077 | .wasm32, .wasm64 => "wasm", |
| 1078 | .spirv32, .spirv64 => "spir-v", | ||
| 1060 | else => @tagName(arch), | 1079 | else => @tagName(arch), |
| 1061 | }; | 1080 | }; |
| 1062 | } | 1081 | } |
| ... | @@ -1347,6 +1366,7 @@ pub const Target = struct { | ... | @@ -1347,6 +1366,7 @@ pub const Target = struct { |
| 1347 | .uefi, | 1366 | .uefi, |
| 1348 | .windows, | 1367 | .windows, |
| 1349 | .emscripten, | 1368 | .emscripten, |
| 1369 | .opencl, | ||
| 1350 | .other, | 1370 | .other, |
| 1351 | => return false, | 1371 | => return false, |
| 1352 | else => return true, | 1372 | else => return true, |
| ... | @@ -1482,6 +1502,8 @@ pub const Target = struct { | ... | @@ -1482,6 +1502,8 @@ pub const Target = struct { |
| 1482 | .nvptx64, | 1502 | .nvptx64, |
| 1483 | .spu_2, | 1503 | .spu_2, |
| 1484 | .avr, | 1504 | .avr, |
| 1505 | .spirv32, | ||
| 1506 | .spirv64, | ||
| 1485 | => return result, | 1507 | => return result, |
| 1486 | 1508 | ||
| 1487 | // TODO go over each item in this list and either move it to the above list, or | 1509 | // TODO go over each item in this list and either move it to the above list, or |
| ... | @@ -1524,6 +1546,7 @@ pub const Target = struct { | ... | @@ -1524,6 +1546,7 @@ pub const Target = struct { |
| 1524 | .windows, | 1546 | .windows, |
| 1525 | .emscripten, | 1547 | .emscripten, |
| 1526 | .wasi, | 1548 | .wasi, |
| 1549 | .opencl, | ||
| 1527 | .other, | 1550 | .other, |
| 1528 | => return result, | 1551 | => return result, |
| 1529 | 1552 |
lib/std/zig.zig+1| ... | @@ -141,6 +141,7 @@ pub fn binNameAlloc(allocator: *std.mem.Allocator, options: BinNameOptions) erro | ... | @@ -141,6 +141,7 @@ pub fn binNameAlloc(allocator: *std.mem.Allocator, options: BinNameOptions) erro |
| 141 | .Lib => return std.fmt.allocPrint(allocator, "{s}.wasm", .{root_name}), | 141 | .Lib => return std.fmt.allocPrint(allocator, "{s}.wasm", .{root_name}), |
| 142 | }, | 142 | }, |
| 143 | .c => return std.fmt.allocPrint(allocator, "{s}.c", .{root_name}), | 143 | .c => return std.fmt.allocPrint(allocator, "{s}.c", .{root_name}), |
| 144 | .spirv => return std.fmt.allocPrint(allocator, "{s}.spv", .{root_name}), | ||
| 144 | .hex => return std.fmt.allocPrint(allocator, "{s}.ihex", .{root_name}), | 145 | .hex => return std.fmt.allocPrint(allocator, "{s}.ihex", .{root_name}), |
| 145 | .raw => return std.fmt.allocPrint(allocator, "{s}.bin", .{root_name}), | 146 | .raw => return std.fmt.allocPrint(allocator, "{s}.bin", .{root_name}), |
| 146 | } | 147 | } |
lib/std/zig/cross_target.zig+2| ... | @@ -130,6 +130,7 @@ pub const CrossTarget = struct { | ... | @@ -130,6 +130,7 @@ pub const CrossTarget = struct { |
| 130 | .wasi, | 130 | .wasi, |
| 131 | .emscripten, | 131 | .emscripten, |
| 132 | .uefi, | 132 | .uefi, |
| 133 | .opencl, | ||
| 133 | .other, | 134 | .other, |
| 134 | => { | 135 | => { |
| 135 | self.os_version_min = .{ .none = {} }; | 136 | self.os_version_min = .{ .none = {} }; |
| ... | @@ -730,6 +731,7 @@ pub const CrossTarget = struct { | ... | @@ -730,6 +731,7 @@ pub const CrossTarget = struct { |
| 730 | .wasi, | 731 | .wasi, |
| 731 | .emscripten, | 732 | .emscripten, |
| 732 | .uefi, | 733 | .uefi, |
| 734 | .opencl, | ||
| 733 | .other, | 735 | .other, |
| 734 | => return error.InvalidOperatingSystemVersion, | 736 | => return error.InvalidOperatingSystemVersion, |
| 735 | 737 |
src/link.zig+8| ... | @@ -133,6 +133,7 @@ pub const File = struct { | ... | @@ -133,6 +133,7 @@ pub const File = struct { |
| 133 | macho: MachO.TextBlock, | 133 | macho: MachO.TextBlock, |
| 134 | c: C.DeclBlock, | 134 | c: C.DeclBlock, |
| 135 | wasm: void, | 135 | wasm: void, |
| 136 | spirv: void, | ||
| 136 | }; | 137 | }; |
| 137 | 138 | ||
| 138 | pub const LinkFn = union { | 139 | pub const LinkFn = union { |
| ... | @@ -141,6 +142,7 @@ pub const File = struct { | ... | @@ -141,6 +142,7 @@ pub const File = struct { |
| 141 | macho: MachO.SrcFn, | 142 | macho: MachO.SrcFn, |
| 142 | c: C.FnBlock, | 143 | c: C.FnBlock, |
| 143 | wasm: ?Wasm.FnData, | 144 | wasm: ?Wasm.FnData, |
| 145 | spirv: void, | ||
| 144 | }; | 146 | }; |
| 145 | 147 | ||
| 146 | pub const Export = union { | 148 | pub const Export = union { |
| ... | @@ -149,6 +151,7 @@ pub const File = struct { | ... | @@ -149,6 +151,7 @@ pub const File = struct { |
| 149 | macho: MachO.Export, | 151 | macho: MachO.Export, |
| 150 | c: void, | 152 | c: void, |
| 151 | wasm: void, | 153 | wasm: void, |
| 154 | spirv: void, | ||
| 152 | }; | 155 | }; |
| 153 | 156 | ||
| 154 | /// For DWARF .debug_info. | 157 | /// For DWARF .debug_info. |
| ... | @@ -177,6 +180,7 @@ pub const File = struct { | ... | @@ -177,6 +180,7 @@ pub const File = struct { |
| 177 | .macho => &(try MachO.createEmpty(allocator, options)).base, | 180 | .macho => &(try MachO.createEmpty(allocator, options)).base, |
| 178 | .wasm => &(try Wasm.createEmpty(allocator, options)).base, | 181 | .wasm => &(try Wasm.createEmpty(allocator, options)).base, |
| 179 | .c => unreachable, // Reported error earlier. | 182 | .c => unreachable, // Reported error earlier. |
| 183 | .spirv => return error.SpirVObjectFormatUnimplemented, | ||
| 180 | .hex => return error.HexObjectFormatUnimplemented, | 184 | .hex => return error.HexObjectFormatUnimplemented, |
| 181 | .raw => return error.RawObjectFormatUnimplemented, | 185 | .raw => return error.RawObjectFormatUnimplemented, |
| 182 | }; | 186 | }; |
| ... | @@ -192,6 +196,7 @@ pub const File = struct { | ... | @@ -192,6 +196,7 @@ pub const File = struct { |
| 192 | .macho => &(try MachO.createEmpty(allocator, options)).base, | 196 | .macho => &(try MachO.createEmpty(allocator, options)).base, |
| 193 | .wasm => &(try Wasm.createEmpty(allocator, options)).base, | 197 | .wasm => &(try Wasm.createEmpty(allocator, options)).base, |
| 194 | .c => unreachable, // Reported error earlier. | 198 | .c => unreachable, // Reported error earlier. |
| 199 | .spirv => return error.SpirVObjectFormatUnimplemented, | ||
| 195 | .hex => return error.HexObjectFormatUnimplemented, | 200 | .hex => return error.HexObjectFormatUnimplemented, |
| 196 | .raw => return error.RawObjectFormatUnimplemented, | 201 | .raw => return error.RawObjectFormatUnimplemented, |
| 197 | }; | 202 | }; |
| ... | @@ -207,6 +212,7 @@ pub const File = struct { | ... | @@ -207,6 +212,7 @@ pub const File = struct { |
| 207 | .macho => &(try MachO.openPath(allocator, sub_path, options)).base, | 212 | .macho => &(try MachO.openPath(allocator, sub_path, options)).base, |
| 208 | .wasm => &(try Wasm.openPath(allocator, sub_path, options)).base, | 213 | .wasm => &(try Wasm.openPath(allocator, sub_path, options)).base, |
| 209 | .c => &(try C.openPath(allocator, sub_path, options)).base, | 214 | .c => &(try C.openPath(allocator, sub_path, options)).base, |
| 215 | .spirv => return error.SpirVObjectFormatUnimplemented, | ||
| 210 | .hex => return error.HexObjectFormatUnimplemented, | 216 | .hex => return error.HexObjectFormatUnimplemented, |
| 211 | .raw => return error.RawObjectFormatUnimplemented, | 217 | .raw => return error.RawObjectFormatUnimplemented, |
| 212 | }; | 218 | }; |
| ... | @@ -595,6 +601,7 @@ pub const File = struct { | ... | @@ -595,6 +601,7 @@ pub const File = struct { |
| 595 | macho, | 601 | macho, |
| 596 | c, | 602 | c, |
| 597 | wasm, | 603 | wasm, |
| 604 | spirv, | ||
| 598 | }; | 605 | }; |
| 599 | 606 | ||
| 600 | pub const ErrorFlags = struct { | 607 | pub const ErrorFlags = struct { |
| ... | @@ -605,6 +612,7 @@ pub const File = struct { | ... | @@ -605,6 +612,7 @@ pub const File = struct { |
| 605 | pub const Coff = @import("link/Coff.zig"); | 612 | pub const Coff = @import("link/Coff.zig"); |
| 606 | pub const Elf = @import("link/Elf.zig"); | 613 | pub const Elf = @import("link/Elf.zig"); |
| 607 | pub const MachO = @import("link/MachO.zig"); | 614 | pub const MachO = @import("link/MachO.zig"); |
| 615 | pub const SpirV = @import("link/SpirV.zig"); | ||
| 608 | pub const Wasm = @import("link/Wasm.zig"); | 616 | pub const Wasm = @import("link/Wasm.zig"); |
| 609 | }; | 617 | }; |
| 610 | 618 |
src/type.zig+1| ... | @@ -3597,6 +3597,7 @@ pub const CType = enum { | ... | @@ -3597,6 +3597,7 @@ pub const CType = enum { |
| 3597 | .amdpal, | 3597 | .amdpal, |
| 3598 | .hermit, | 3598 | .hermit, |
| 3599 | .hurd, | 3599 | .hurd, |
| 3600 | .opencl, | ||
| 3600 | => @panic("TODO specify the C integer and float type sizes for this OS"), | 3601 | => @panic("TODO specify the C integer and float type sizes for this OS"), |
| 3601 | } | 3602 | } |
| 3602 | } | 3603 | } |