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