| author | |
| committer | |
| log | 69a26976ed2b624d99d364b642f78ca6bb59e5b6 |
| tree | 6d46a6cd4bfbe85f89ea889d6bd1ba2a1e8304b4 |
| parent | 115e0894dbd39e8baa15f9b883105697a8af201b |
Converts usages of `@intFromEnum` and `@enumFromInt` to instead use the
new `@backingInt` and `@fromBackingInt` builtins.346 files changed, 9039 insertions(+), 9039 deletions(-)
lib/build-web/fuzz.zig+9-9| ... | ... | @@ -94,11 +94,11 @@ const SourceLocationIndex = enum(u32) { |
| 94 | 94 | _, |
| 95 | 95 | |
| 96 | 96 | fn haveCoverage(sli: SourceLocationIndex) bool { |
| 97 | return @intFromEnum(sli) < coverage_source_locations.items.len; | |
| 97 | return @backingInt(sli) < coverage_source_locations.items.len; | |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | fn ptr(sli: SourceLocationIndex) *Coverage.SourceLocation { |
| 101 | return &coverage_source_locations.items[@intFromEnum(sli)]; | |
| 101 | return &coverage_source_locations.items[@backingInt(sli)]; | |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | fn sourceLocationLinkHtml( |
| ... | ... | @@ -114,7 +114,7 @@ const SourceLocationIndex = enum(u32) { |
| 114 | 114 | try out.print(gpa, ":{d}:{d} </code><button class=\"linkish\" onclick=\"wasm_exports.fuzzSelectSli({d});\">View</button>", .{ |
| 115 | 115 | sl.line, |
| 116 | 116 | sl.column, |
| 117 | @intFromEnum(sli), | |
| 117 | @backingInt(sli), | |
| 118 | 118 | }); |
| 119 | 119 | } |
| 120 | 120 | |
| ... | ... | @@ -132,7 +132,7 @@ const SourceLocationIndex = enum(u32) { |
| 132 | 132 | var buf: std.ArrayList(u8) = .empty; |
| 133 | 133 | defer buf.deinit(gpa); |
| 134 | 134 | sli.appendPath(&buf) catch @panic("OOM"); |
| 135 | return @enumFromInt(Walk.files.getIndex(buf.items) orelse return null); | |
| 135 | return @fromBackingInt(@intCast(Walk.files.getIndex(buf.items) orelse return null)); | |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | fn fileHtml( |
| ... | ... | @@ -166,7 +166,7 @@ fn computeSourceAnnotations( |
| 166 | 166 | |
| 167 | 167 | for (source_locations, 0..) |sl, sli_usize| { |
| 168 | 168 | if (sl.file != cov_file_index) continue; |
| 169 | const sli: SourceLocationIndex = @enumFromInt(sli_usize); | |
| 169 | const sli: SourceLocationIndex = @fromBackingInt(@intCast(sli_usize)); | |
| 170 | 170 | try locs.append(gpa, sli); |
| 171 | 171 | } |
| 172 | 172 | |
| ... | ... | @@ -199,7 +199,7 @@ fn computeSourceAnnotations( |
| 199 | 199 | if (next_sl.line > line or (next_sl.line == line and next_sl.column >= column)) break; |
| 200 | 200 | try annotations.append(gpa, .{ |
| 201 | 201 | .file_byte_offset = offset, |
| 202 | .dom_id = @intFromEnum(next_sli), | |
| 202 | .dom_id = @backingInt(next_sli), | |
| 203 | 203 | }); |
| 204 | 204 | next_loc_index += 1; |
| 205 | 205 | } |
| ... | ... | @@ -240,7 +240,7 @@ fn unpackSourcesInner(tar_bytes: []u8) !void { |
| 240 | 240 | break :p .{ "root", std.mem.endsWith(u8, file_name, "/root.zig") }; |
| 241 | 241 | }; |
| 242 | 242 | const gop = try Walk.modules.getOrPut(gpa, mod_name); |
| 243 | const file: Walk.File.Index = @enumFromInt(Walk.files.entries.len); | |
| 243 | const file: Walk.File.Index = @fromBackingInt(@intCast(Walk.files.entries.len)); | |
| 244 | 244 | if (!gop.found_existing or is_module_root) gop.value_ptr.* = file; |
| 245 | 245 | const file_bytes = tar_reader.take(@intCast(tar_file.size)) catch unreachable; |
| 246 | 246 | it.unread_file_bytes = 0; // we have read the whole thing |
| ... | ... | @@ -323,7 +323,7 @@ fn updateCoverage() error{OutOfMemory}!void { |
| 323 | 323 | u64, |
| 324 | 324 | recent_coverage_update.items[@sizeOf(abi.fuzz.CoverageUpdateHeader)..][0 .. n_bitset_elems * @sizeOf(u64)], |
| 325 | 325 | ); |
| 326 | var sli: SourceLocationIndex = @enumFromInt(0); | |
| 326 | var sli: SourceLocationIndex = @fromBackingInt(@intCast(0)); | |
| 327 | 327 | for (covered_bits) |elem| { |
| 328 | 328 | try covered.ensureUnusedCapacity(gpa, 64); |
| 329 | 329 | for (0..@bitSizeOf(u64)) |i| { |
| ... | ... | @@ -332,7 +332,7 @@ fn updateCoverage() error{OutOfMemory}!void { |
| 332 | 332 | covered.appendAssumeCapacity(sli); |
| 333 | 333 | } |
| 334 | 334 | } |
| 335 | sli = @enumFromInt(@intFromEnum(sli) + 1); | |
| 335 | sli = @fromBackingInt(@intCast(@backingInt(sli) + 1)); | |
| 336 | 336 | } |
| 337 | 337 | } |
| 338 | 338 |
lib/build-web/main.zig+3-3| ... | ... | @@ -80,7 +80,7 @@ export fn message_begin(len: usize) [*]u8 { |
| 80 | 80 | export fn message_end() void { |
| 81 | 81 | const msg_bytes = message_buffer.items; |
| 82 | 82 | |
| 83 | const tag: abi.ToClientTag = @enumFromInt(msg_bytes[0]); | |
| 83 | const tag: abi.ToClientTag = @fromBackingInt(@intCast(msg_bytes[0])); | |
| 84 | 84 | switch (tag) { |
| 85 | 85 | _ => @panic("malformed message"), |
| 86 | 86 | |
| ... | ... | @@ -151,7 +151,7 @@ fn helloMessage(msg_bytes: []align(4) u8) Allocator.Error!void { |
| 151 | 151 | for (steps, step_name_lens, 0..) |*step_out, name_len, step_idx| { |
| 152 | 152 | step_out.* = .{ |
| 153 | 153 | .name = duped_step_name_data[name_off..][0..name_len], |
| 154 | .status = @enumFromInt(@as(u2, @truncate(step_status_bits[step_idx / 4] >> @intCast((step_idx % 4) * 2)))), | |
| 154 | .status = @fromBackingInt(@intCast(@as(u2, @truncate(step_status_bits[step_idx / 4] >> @intCast((step_idx % 4) * 2))))), | |
| 155 | 155 | }; |
| 156 | 156 | name_off += name_len; |
| 157 | 157 | } |
| ... | ... | @@ -180,7 +180,7 @@ export fn stepName(idx: usize) String { |
| 180 | 180 | return .init(step_list[idx].name); |
| 181 | 181 | } |
| 182 | 182 | export fn stepStatus(idx: usize) u8 { |
| 183 | return @intFromEnum(step_list[idx].status); | |
| 183 | return @backingInt(step_list[idx].status); | |
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | export fn rebuild() void { |
lib/c/malloc.zig+3-3| ... | ... | @@ -183,8 +183,8 @@ fn memalign(alloc_alignment: usize, n: usize) callconv(.c) ?[*]align(alignment_b |
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | fn posix_memalign(result: *?[*]align(alignment_bytes) u8, alloc_alignment: usize, n: usize) callconv(.c) c_int { |
| 186 | if (alloc_alignment < @sizeOf(*anyopaque)) return @intFromEnum(std.c.E.INVAL); | |
| 187 | result.* = aligned_alloc_inner(alloc_alignment, n) orelse return @intFromEnum(std.c.E.NOMEM); | |
| 186 | if (alloc_alignment < @sizeOf(*anyopaque)) return @backingInt(std.c.E.INVAL); | |
| 187 | result.* = aligned_alloc_inner(alloc_alignment, n) orelse return @backingInt(std.c.E.NOMEM); | |
| 188 | 188 | return 0; |
| 189 | 189 | } |
| 190 | 190 | |
| ... | ... | @@ -192,6 +192,6 @@ fn posix_memalign(result: *?[*]align(alignment_bytes) u8, alloc_alignment: usize |
| 192 | 192 | /// `null`. |
| 193 | 193 | fn nomem() ?[*]align(alignment_bytes) u8 { |
| 194 | 194 | @branchHint(.cold); |
| 195 | std.c._errno().* = @intFromEnum(std.c.E.NOMEM); | |
| 195 | std.c._errno().* = @backingInt(std.c.E.NOMEM); | |
| 196 | 196 | return null; |
| 197 | 197 | } |
lib/c/pthread.zig+3-3| ... | ... | @@ -17,7 +17,7 @@ comptime { |
| 17 | 17 | |
| 18 | 18 | const SpinLock = enum(c.pthread_spinlock_t) { |
| 19 | 19 | unlocked = if (builtin.target.isMinGW()) -1 else 0, |
| 20 | locked = if (builtin.target.isMinGW()) 0 else @intFromEnum(c.E.BUSY), | |
| 20 | locked = if (builtin.target.isMinGW()) 0 else @backingInt(c.E.BUSY), | |
| 21 | 21 | }; |
| 22 | 22 | |
| 23 | 23 | fn pthread_spin_init(s: *c.pthread_spinlock_t, pshared: c_int) callconv(.c) c_int { |
| ... | ... | @@ -35,12 +35,12 @@ fn pthread_spin_destroy(s: *c.pthread_spinlock_t) callconv(.c) c_int { |
| 35 | 35 | |
| 36 | 36 | fn pthread_spin_trylock(s: *c.pthread_spinlock_t) callconv(.c) c_int { |
| 37 | 37 | const spin: *SpinLock = @ptrCast(s); |
| 38 | return if (@cmpxchgStrong(SpinLock, spin, .unlocked, .locked, .acquire, .monotonic)) |_| @intFromEnum(c.E.BUSY) else 0; | |
| 38 | return if (@cmpxchgStrong(SpinLock, spin, .unlocked, .locked, .acquire, .monotonic)) |_| @backingInt(c.E.BUSY) else 0; | |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | fn pthread_spin_lock(s: *c.pthread_spinlock_t) callconv(.c) c_int { |
| 42 | 42 | const spin: *SpinLock = @ptrCast(s); |
| 43 | if (builtin.single_threaded and @atomicLoad(SpinLock, spin, .monotonic) == .locked) return @intFromEnum(c.E.DEADLK); | |
| 43 | if (builtin.single_threaded and @atomicLoad(SpinLock, spin, .monotonic) == .locked) return @backingInt(c.E.DEADLK); | |
| 44 | 44 | |
| 45 | 45 | while (@cmpxchgWeak(SpinLock, spin, .unlocked, .locked, .acquire, .monotonic)) |_| { |
| 46 | 46 | std.atomic.spinLoopHint(); |
lib/c/stdlib.zig+4-4| ... | ... | @@ -138,7 +138,7 @@ fn stringToInteger(comptime T: type, noalias buf: [*:0]const u8, noalias maybe_e |
| 138 | 138 | end.* = buf; |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | std.c._errno().* = @intFromEnum(std.c.E.INVAL); | |
| 141 | std.c._errno().* = @backingInt(std.c.E.INVAL); | |
| 142 | 142 | return 0; |
| 143 | 143 | } |
| 144 | 144 | |
| ... | ... | @@ -192,7 +192,7 @@ fn stringToInteger(comptime T: type, noalias buf: [*:0]const u8, noalias maybe_e |
| 192 | 192 | |
| 193 | 193 | if (@typeInfo(T).int.signedness == .unsigned) { |
| 194 | 194 | const result = parseDigitsWithSignGenericCharacter(T, u8, digits, maybe_end, real_base, .pos) catch { |
| 195 | std.c._errno().* = @intFromEnum(std.c.E.RANGE); | |
| 195 | std.c._errno().* = @backingInt(std.c.E.RANGE); | |
| 196 | 196 | return std.math.maxInt(T); |
| 197 | 197 | }; |
| 198 | 198 | |
| ... | ... | @@ -200,12 +200,12 @@ fn stringToInteger(comptime T: type, noalias buf: [*:0]const u8, noalias maybe_e |
| 200 | 200 | } |
| 201 | 201 | |
| 202 | 202 | if (negative) return parseDigitsWithSignGenericCharacter(T, u8, digits, maybe_end, real_base, .neg) catch blk: { |
| 203 | std.c._errno().* = @intFromEnum(std.c.E.RANGE); | |
| 203 | std.c._errno().* = @backingInt(std.c.E.RANGE); | |
| 204 | 204 | break :blk std.math.minInt(T); |
| 205 | 205 | }; |
| 206 | 206 | |
| 207 | 207 | return parseDigitsWithSignGenericCharacter(T, u8, digits, maybe_end, real_base, .pos) catch blk: { |
| 208 | std.c._errno().* = @intFromEnum(std.c.E.RANGE); | |
| 208 | std.c._errno().* = @backingInt(std.c.E.RANGE); | |
| 209 | 209 | break :blk std.math.maxInt(T); |
| 210 | 210 | }; |
| 211 | 211 | } |
lib/c/sys/reboot.zig+1-1| ... | ... | @@ -12,5 +12,5 @@ comptime { |
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | fn rebootLinux(cmd: c_int) callconv(.c) c_int { |
| 15 | return errno(std.os.linux.reboot(.MAGIC1, .MAGIC2, @enumFromInt(cmd), null)); | |
| 15 | return errno(std.os.linux.reboot(.MAGIC1, .MAGIC2, @fromBackingInt(@intCast(cmd)), null)); | |
| 16 | 16 | } |
lib/c/unistd.zig+6-6| ... | ... | @@ -105,26 +105,26 @@ fn dupLinux(fd: c_int) callconv(.c) c_int { |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | fn dup2Linux(old: c_int, new: c_int) callconv(.c) c_int { |
| 108 | const busy: usize = @bitCast(-@as(isize, @intFromEnum(linux.E.BUSY))); | |
| 108 | const busy: usize = @bitCast(-@as(isize, @backingInt(linux.E.BUSY))); | |
| 109 | 109 | var res = busy; |
| 110 | 110 | while (res == busy) res = linux.dup2(old, new); |
| 111 | 111 | return errno(res); |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | fn dup3Linux(old: c_int, new: c_int, flags: c_int) callconv(.c) c_int { |
| 115 | const busy: usize = @bitCast(-@as(isize, @intFromEnum(linux.E.BUSY))); | |
| 115 | const busy: usize = @bitCast(-@as(isize, @backingInt(linux.E.BUSY))); | |
| 116 | 116 | var res = busy; |
| 117 | 117 | |
| 118 | 118 | if (@hasField(linux.SYS, "dup3")) { |
| 119 | 119 | while (res == busy) res = linux.dup3(old, new, @intCast(flags)); |
| 120 | 120 | } else if (@hasField(linux.SYS, "dup2")) { |
| 121 | 121 | const cloexec: c_int = @bitCast(linux.O{ .CLOEXEC = true }); |
| 122 | const inval: usize = @bitCast(-@as(isize, @intFromEnum(linux.E.INVAL))); | |
| 122 | const inval: usize = @bitCast(-@as(isize, @backingInt(linux.E.INVAL))); | |
| 123 | 123 | if (old == new or (flags & ~cloexec != 0)) return errno(inval); |
| 124 | 124 | while (res == busy) res = linux.dup2(old, new); |
| 125 | 125 | _ = if (res >= 0 and (flags & cloexec == cloexec)) linux.fcntl(new, linux.F.SETFD, linux.FD_CLOEXEC); |
| 126 | 126 | } else { |
| 127 | return errno(@bitCast(-@as(isize, @intFromEnum(linux.E.NOSYS)))); | |
| 127 | return errno(@bitCast(-@as(isize, @backingInt(linux.E.NOSYS)))); | |
| 128 | 128 | } |
| 129 | 129 | return errno(res); |
| 130 | 130 | } |
| ... | ... | @@ -238,7 +238,7 @@ fn close(fd: std.c.fd_t) callconv(.c) c_int { |
| 238 | 238 | const signed: isize = @bitCast(linux.close(fd)); |
| 239 | 239 | if (signed < 0) { |
| 240 | 240 | @branchHint(.unlikely); |
| 241 | if (-signed == @intFromEnum(linux.E.INTR)) return 0; | |
| 241 | if (-signed == @backingInt(linux.E.INTR)) return 0; | |
| 242 | 242 | std.c._errno().* = @intCast(-signed); |
| 243 | 243 | return -1; |
| 244 | 244 | } |
| ... | ... | @@ -253,7 +253,7 @@ fn closeWasi(fd: std.c.fd_t) callconv(.c) c_int { |
| 253 | 253 | switch (std.os.wasi.fd_close(fd)) { |
| 254 | 254 | .SUCCESS => return 0, |
| 255 | 255 | else => |e| { |
| 256 | std.c._errno().* = @intFromEnum(e); | |
| 256 | std.c._errno().* = @backingInt(e); | |
| 257 | 257 | return -1; |
| 258 | 258 | }, |
| 259 | 259 | } |
lib/compiler/Maker.zig+8-8| ... | ... | @@ -589,10 +589,10 @@ pub fn main(init: process.Init.Minimal) !void { |
| 589 | 589 | graph.cache.addPrefix(graph.local_cache_root); |
| 590 | 590 | graph.cache.addPrefix(global_cache_directory); |
| 591 | 591 | graph.cache.addPrefix(graph.build_root_directory); |
| 592 | comptime assert(0 == @intFromEnum(std.zig.Server.Message.PathPrefix.cwd)); | |
| 593 | comptime assert(1 == @intFromEnum(std.zig.Server.Message.PathPrefix.zig_lib)); | |
| 594 | comptime assert(2 == @intFromEnum(std.zig.Server.Message.PathPrefix.local_cache)); | |
| 595 | comptime assert(3 == @intFromEnum(std.zig.Server.Message.PathPrefix.global_cache)); | |
| 592 | comptime assert(0 == @backingInt(std.zig.Server.Message.PathPrefix.cwd)); | |
| 593 | comptime assert(1 == @backingInt(std.zig.Server.Message.PathPrefix.zig_lib)); | |
| 594 | comptime assert(2 == @backingInt(std.zig.Server.Message.PathPrefix.local_cache)); | |
| 595 | comptime assert(3 == @backingInt(std.zig.Server.Message.PathPrefix.global_cache)); | |
| 596 | 596 | |
| 597 | 597 | graph.cache.hash.addBytes(builtin.zig_version_string); |
| 598 | 598 | |
| ... | ... | @@ -1406,7 +1406,7 @@ fn configure(graph: *Graph, options: ConfigureOptions) !ScannedConfig { |
| 1406 | 1406 | var top_level_steps: std.array_hash_map.String(Configuration.Step.Index) = .empty; |
| 1407 | 1407 | for (configuration.steps, 0..) |*conf_step, step_index_usize| { |
| 1408 | 1408 | if (conf_step.owner != .root) continue; |
| 1409 | const step_index: Configuration.Step.Index = @enumFromInt(step_index_usize); | |
| 1409 | const step_index: Configuration.Step.Index = @fromBackingInt(@intCast(step_index_usize)); | |
| 1410 | 1410 | const flags = conf_step.flags(c); |
| 1411 | 1411 | switch (flags.tag) { |
| 1412 | 1412 | .top_level => { |
| ... | ... | @@ -2017,7 +2017,7 @@ fn countSubProcesses(maker: *Maker) usize { |
| 2017 | 2017 | } |
| 2018 | 2018 | |
| 2019 | 2019 | pub fn stepByIndex(maker: *const Maker, i: Configuration.Step.Index) *Step { |
| 2020 | return &maker.steps[@intFromEnum(i)]; | |
| 2020 | return &maker.steps[@backingInt(i)]; | |
| 2021 | 2021 | } |
| 2022 | 2022 | |
| 2023 | 2023 | fn prepare(maker: *Maker, step_names: []const []const u8) !void { |
| ... | ... | @@ -2029,7 +2029,7 @@ fn prepare(maker: *Maker, step_names: []const []const u8) !void { |
| 2029 | 2029 | const c = &maker.scanned_config.configuration; |
| 2030 | 2030 | |
| 2031 | 2031 | for (maker.steps, 0..) |*step, step_index_usize| { |
| 2032 | const step_index: Configuration.Step.Index = @enumFromInt(step_index_usize); | |
| 2032 | const step_index: Configuration.Step.Index = @fromBackingInt(@intCast(step_index_usize)); | |
| 2033 | 2033 | step.* = .{ .extended = .init(step_index.ptr(c).flags(c).tag) }; |
| 2034 | 2034 | } |
| 2035 | 2035 | |
| ... | ... | @@ -3060,7 +3060,7 @@ pub fn resolveLazyPathIndexAbs( |
| 3060 | 3060 | } |
| 3061 | 3061 | |
| 3062 | 3062 | pub fn generatedPath(maker: *const Maker, index: Configuration.GeneratedFileIndex) *Path { |
| 3063 | return &maker.generated_files[@intFromEnum(index)]; | |
| 3063 | return &maker.generated_files[@backingInt(index)]; | |
| 3064 | 3064 | } |
| 3065 | 3065 | |
| 3066 | 3066 | pub fn packagePath( |
lib/compiler/Maker/Fetch.zig+6-6| ... | ... | @@ -826,7 +826,7 @@ fn runResource( |
| 826 | 826 | .notes_len = notes_len, |
| 827 | 827 | }); |
| 828 | 828 | const notes_start = try eb.reserveNotes(notes_len); |
| 829 | eb.extra.items[notes_start] = @intFromEnum(try eb.addErrorMessage(.{ | |
| 829 | eb.extra.items[notes_start] = @backingInt(try eb.addErrorMessage(.{ | |
| 830 | 830 | .msg = try eb.printString("expected .hash = {q},", .{computed_package_hash.toSlice()}), |
| 831 | 831 | })); |
| 832 | 832 | return error.FetchFailed; |
| ... | ... | @@ -1297,7 +1297,7 @@ fn initResource(f: *Fetch, uri: std.Uri, resource: *Resource, reader_buffer: []u |
| 1297 | 1297 | .notes_len = notes_len, |
| 1298 | 1298 | }); |
| 1299 | 1299 | const notes_start = try eb.reserveNotes(notes_len); |
| 1300 | eb.extra.items[notes_start] = @intFromEnum(try eb.addErrorMessage(.{ | |
| 1300 | eb.extra.items[notes_start] = @backingInt(try eb.addErrorMessage(.{ | |
| 1301 | 1301 | .msg = try eb.printString("try .url = \"{f}#{f}\",", .{ |
| 1302 | 1302 | uri.fmt(.{ .scheme = true, .authority = true, .path = true }), |
| 1303 | 1303 | want_oid, |
| ... | ... | @@ -1472,7 +1472,7 @@ fn unpackTarball(f: *Fetch, out_dir: Io.Dir, reader: *Io.Reader) RunError!Unpack |
| 1472 | 1472 | switch (item) { |
| 1473 | 1473 | .unable_to_create_file => |i| res.unableToCreateFile(stripRoot(i.file_name, res.root_dir), i.code), |
| 1474 | 1474 | .unable_to_create_sym_link => |i| res.unableToCreateSymLink(stripRoot(i.file_name, res.root_dir), i.link_name, i.code), |
| 1475 | .unsupported_file_type => |i| res.unsupportedFileType(stripRoot(i.file_name, res.root_dir), @intFromEnum(i.file_type)), | |
| 1475 | .unsupported_file_type => |i| res.unsupportedFileType(stripRoot(i.file_name, res.root_dir), @backingInt(i.file_type)), | |
| 1476 | 1476 | .components_outside_stripped_prefix => unreachable, // unreachable with strip_components = 0 |
| 1477 | 1477 | } |
| 1478 | 1478 | } |
| ... | ... | @@ -2205,21 +2205,21 @@ const UnpackResult = struct { |
| 2205 | 2205 | if (item.excluded(filter)) continue; |
| 2206 | 2206 | switch (item) { |
| 2207 | 2207 | .unable_to_create_sym_link => |info| { |
| 2208 | eb.extra.items[note_i] = @intFromEnum(try eb.addErrorMessage(.{ | |
| 2208 | eb.extra.items[note_i] = @backingInt(try eb.addErrorMessage(.{ | |
| 2209 | 2209 | .msg = try eb.printString("unable to create symlink from '{s}' to '{s}': {s}", .{ |
| 2210 | 2210 | info.file_name, info.link_name, @errorName(info.code), |
| 2211 | 2211 | }), |
| 2212 | 2212 | })); |
| 2213 | 2213 | }, |
| 2214 | 2214 | .unable_to_create_file => |info| { |
| 2215 | eb.extra.items[note_i] = @intFromEnum(try eb.addErrorMessage(.{ | |
| 2215 | eb.extra.items[note_i] = @backingInt(try eb.addErrorMessage(.{ | |
| 2216 | 2216 | .msg = try eb.printString("unable to create file '{s}': {s}", .{ |
| 2217 | 2217 | info.file_name, @errorName(info.code), |
| 2218 | 2218 | }), |
| 2219 | 2219 | })); |
| 2220 | 2220 | }, |
| 2221 | 2221 | .unsupported_file_type => |info| { |
| 2222 | eb.extra.items[note_i] = @intFromEnum(try eb.addErrorMessage(.{ | |
| 2222 | eb.extra.items[note_i] = @backingInt(try eb.addErrorMessage(.{ | |
| 2223 | 2223 | .msg = try eb.printString("file '{s}' has unsupported type '{c}'", .{ |
| 2224 | 2224 | info.file_name, info.file_type, |
| 2225 | 2225 | }), |
lib/compiler/Maker/Fetch/git.zig+1-1| ... | ... | @@ -1107,7 +1107,7 @@ pub const Session = struct { |
| 1107 | 1107 | return error.ReadFailed; |
| 1108 | 1108 | }) { |
| 1109 | 1109 | .flush => return error.EndOfStream, |
| 1110 | .data => |data| switch (@as(StreamCode, @enumFromInt(data[0]))) { | |
| 1110 | .data => |data| switch (@as(StreamCode, @fromBackingInt(@intCast(data[0])))) { | |
| 1111 | 1111 | .pack_data => { |
| 1112 | 1112 | input.toss(1); |
| 1113 | 1113 | fs.remaining_len = data.len - 1; |
lib/compiler/Maker/ScannedConfig.zig+4-4| ... | ... | @@ -26,11 +26,11 @@ pub fn print(sc: *const ScannedConfig, w: *Writer) Writer.Error!void { |
| 26 | 26 | try tf.end(); |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | try s.field("default_step", @intFromEnum(c.default_step), .{}); | |
| 29 | try s.field("default_step", @backingInt(c.default_step), .{}); | |
| 30 | 30 | { |
| 31 | 31 | var sf = try s.beginStructField("top_level_steps", .{}); |
| 32 | 32 | for (sc.top_level_steps.keys(), sc.top_level_steps.values()) |name, step| { |
| 33 | try sf.field(name, @intFromEnum(step), .{}); | |
| 33 | try sf.field(name, @backingInt(step), .{}); | |
| 34 | 34 | } |
| 35 | 35 | try sf.end(); |
| 36 | 36 | } |
| ... | ... | @@ -122,7 +122,7 @@ fn printValue(sc: *const ScannedConfig, s: *Serializer, comptime Field: type, fi |
| 122 | 122 | } else if (std.enums.tagName(Field, field_value)) |name| { |
| 123 | 123 | try s.ident(name); |
| 124 | 124 | } else { |
| 125 | try s.int(@intFromEnum(field_value)); | |
| 125 | try s.int(@backingInt(field_value)); | |
| 126 | 126 | } |
| 127 | 127 | }, |
| 128 | 128 | .@"struct" => |info| switch (info.layout) { |
| ... | ... | @@ -152,7 +152,7 @@ fn printValue(sc: *const ScannedConfig, s: *Serializer, comptime Field: type, fi |
| 152 | 152 | inline else => |tag| { |
| 153 | 153 | var sub_struct = try s.beginStruct(.{}); |
| 154 | 154 | try sub_struct.fieldPrefix(@tagName(tag)); |
| 155 | try printValue(sc, s, @FieldType(Field.Union, @tagName(tag)), @enumFromInt(elem)); | |
| 155 | try printValue(sc, s, @FieldType(Field.Union, @tagName(tag)), @fromBackingInt(@intCast(elem))); | |
| 156 | 156 | try sub_struct.end(); |
| 157 | 157 | }, |
| 158 | 158 | }; |
lib/compiler/Maker/Step.zig+1-1| ... | ... | @@ -610,7 +610,7 @@ fn zigProcessUpdate(step_index: Configuration.Step.Index, maker: *Maker, zp: *Zi |
| 610 | 610 | const conf_step = step_index.ptr(conf); |
| 611 | 611 | var it = std.mem.splitScalar(u8, body, 0); |
| 612 | 612 | while (it.next()) |prefixed_path| { |
| 613 | const prefix_index: std.zig.Server.Message.PathPrefix = @enumFromInt(prefixed_path[0] - 1); | |
| 613 | const prefix_index: std.zig.Server.Message.PathPrefix = @fromBackingInt(@intCast(prefixed_path[0] - 1)); | |
| 614 | 614 | const sub_path = try arena.dupe(u8, prefixed_path[1..]); |
| 615 | 615 | const sub_path_dirname = Dir.path.dirname(sub_path) orelse ""; |
| 616 | 616 | switch (prefix_index) { |
lib/compiler/Maker/Step/Compile.zig+2-2| ... | ... | @@ -132,7 +132,7 @@ const ModuleListContext = struct { |
| 132 | 132 | |
| 133 | 133 | pub fn hash(ctx: @This(), key: ModuleList) u32 { |
| 134 | 134 | _ = ctx; |
| 135 | return std.hash.int(@intFromEnum(key.keys()[0])); | |
| 135 | return std.hash.int(@backingInt(key.keys()[0])); | |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | const Adapter = struct { |
| ... | ... | @@ -144,7 +144,7 @@ const ModuleListContext = struct { |
| 144 | 144 | |
| 145 | 145 | pub fn hash(ctx: @This(), key: Configuration.Module.Index) u32 { |
| 146 | 146 | _ = ctx; |
| 147 | return std.hash.int(@intFromEnum(key)); | |
| 147 | return std.hash.int(@backingInt(key)); | |
| 148 | 148 | } |
| 149 | 149 | }; |
| 150 | 150 | }; |
lib/compiler/Maker/Step/Run.zig+3-3| ... | ... | @@ -1380,7 +1380,7 @@ fn sendRunFuzzTestMessage( |
| 1380 | 1380 | w.interface.writeStruct(header, .little) catch |err| switch (err) { |
| 1381 | 1381 | error.WriteFailed => return w.err.?, |
| 1382 | 1382 | }; |
| 1383 | w.interface.writeByte(@intFromEnum(kind)) catch |err| switch (err) { | |
| 1383 | w.interface.writeByte(@backingInt(kind)) catch |err| switch (err) { | |
| 1384 | 1384 | error.WriteFailed => return w.err.?, |
| 1385 | 1385 | }; |
| 1386 | 1386 | w.interface.writeInt(u64, amount_or_instance, .little) catch |err| switch (err) { |
| ... | ... | @@ -2106,8 +2106,8 @@ fn runCommand( |
| 2106 | 2106 | if (conf_run.expect_term_value.value) |expected_term_value| { |
| 2107 | 2107 | const expected_term: process.Child.Term = switch (conf_run.flags2.expect_term_status) { |
| 2108 | 2108 | .exited => .{ .exited = @intCast(expected_term_value) }, |
| 2109 | .signal => .{ .signal = @enumFromInt(expected_term_value) }, | |
| 2110 | .stopped => .{ .stopped = @enumFromInt(expected_term_value) }, | |
| 2109 | .signal => .{ .signal = @fromBackingInt(@intCast(expected_term_value)) }, | |
| 2110 | .stopped => .{ .stopped = @fromBackingInt(@intCast(expected_term_value)) }, | |
| 2111 | 2111 | .unknown => .{ .unknown = expected_term_value }, |
| 2112 | 2112 | }; |
| 2113 | 2113 | if (!termMatches(expected_term, generic_result.term)) { |
lib/compiler/Maker/Watch.zig+1-1| ... | ... | @@ -903,7 +903,7 @@ pub const Match = struct { |
| 903 | 903 | pub const Context = struct { |
| 904 | 904 | pub fn hash(self: Context, a: Match) u32 { |
| 905 | 905 | _ = self; |
| 906 | var hasher = Hash.init(@intFromEnum(a.step_index)); | |
| 906 | var hasher = Hash.init(@backingInt(a.step_index)); | |
| 907 | 907 | hasher.update(a.basename); |
| 908 | 908 | return @truncate(hasher.final()); |
| 909 | 909 | } |
lib/compiler/Maker/WebServer.zig+10-10| ... | ... | @@ -257,7 +257,7 @@ pub fn updateStepStatus( |
| 257 | 257 | const ptr = &configured.step_status_bits[step_idx / 4]; |
| 258 | 258 | const bit_offset: u3 = @intCast((step_idx % 4) * 2); |
| 259 | 259 | const old_bits: u2 = @truncate(@atomicLoad(u8, ptr, .monotonic) >> bit_offset); |
| 260 | const mask = @as(u8, @intFromEnum(new_status) ^ old_bits) << bit_offset; | |
| 260 | const mask = @as(u8, @backingInt(new_status) ^ old_bits) << bit_offset; | |
| 261 | 261 | _ = @atomicRmw(u8, ptr, .Xor, mask, .monotonic); |
| 262 | 262 | ws.notifyUpdate(); |
| 263 | 263 | } |
| ... | ... | @@ -426,16 +426,16 @@ fn serveWebSocket(ws: *WebServer, sock: *http.Server.WebSocket) !noreturn { |
| 426 | 426 | const cur_byte = @atomicLoad(u8, shared, .monotonic); |
| 427 | 427 | if (prev_byte.* == cur_byte) continue; |
| 428 | 428 | const cur: [4]abi.StepUpdate.Status = .{ |
| 429 | @enumFromInt(@as(u2, @truncate(cur_byte >> 0))), | |
| 430 | @enumFromInt(@as(u2, @truncate(cur_byte >> 2))), | |
| 431 | @enumFromInt(@as(u2, @truncate(cur_byte >> 4))), | |
| 432 | @enumFromInt(@as(u2, @truncate(cur_byte >> 6))), | |
| 429 | @fromBackingInt(@intCast(@as(u2, @truncate(cur_byte >> 0)))), | |
| 430 | @fromBackingInt(@intCast(@as(u2, @truncate(cur_byte >> 2)))), | |
| 431 | @fromBackingInt(@intCast(@as(u2, @truncate(cur_byte >> 4)))), | |
| 432 | @fromBackingInt(@intCast(@as(u2, @truncate(cur_byte >> 6)))), | |
| 433 | 433 | }; |
| 434 | 434 | const prev: [4]abi.StepUpdate.Status = .{ |
| 435 | @enumFromInt(@as(u2, @truncate(prev_byte.* >> 0))), | |
| 436 | @enumFromInt(@as(u2, @truncate(prev_byte.* >> 2))), | |
| 437 | @enumFromInt(@as(u2, @truncate(prev_byte.* >> 4))), | |
| 438 | @enumFromInt(@as(u2, @truncate(prev_byte.* >> 6))), | |
| 435 | @fromBackingInt(@intCast(@as(u2, @truncate(prev_byte.* >> 0)))), | |
| 436 | @fromBackingInt(@intCast(@as(u2, @truncate(prev_byte.* >> 2)))), | |
| 437 | @fromBackingInt(@intCast(@as(u2, @truncate(prev_byte.* >> 4)))), | |
| 438 | @fromBackingInt(@intCast(@as(u2, @truncate(prev_byte.* >> 6)))), | |
| 439 | 439 | }; |
| 440 | 440 | for (cur, prev, byte_idx * 4..) |cur_status, prev_status, step_idx| { |
| 441 | 441 | const msg: abi.StepUpdate = .{ .step_idx = @intCast(step_idx), .bits = .{ .status = cur_status } }; |
| ... | ... | @@ -469,7 +469,7 @@ fn recvWebSocketMessages(ws: *WebServer, sock: *http.Server.WebSocket) void { |
| 469 | 469 | const msg = sock.readSmallMessage() catch return; |
| 470 | 470 | if (msg.opcode != .binary) continue; |
| 471 | 471 | if (msg.data.len == 0) continue; |
| 472 | const tag: abi.ToServerTag = @enumFromInt(msg.data[0]); | |
| 472 | const tag: abi.ToServerTag = @fromBackingInt(@intCast(msg.data[0])); | |
| 473 | 473 | switch (tag) { |
| 474 | 474 | _ => continue, |
| 475 | 475 | .rebuild => while (true) { |
lib/compiler/aro/aro/Attribute.zig+3-3| ... | ... | @@ -154,7 +154,7 @@ pub const Formatting = struct { |
| 154 | 154 | if (@typeInfo(Unwrapped) != .@"enum") unreachable; |
| 155 | 155 | |
| 156 | 156 | const enum_field_names = @typeInfo(Unwrapped).@"enum".field_names; |
| 157 | const quote = comptime quoteChar(@enumFromInt(@intFromEnum(tag))); | |
| 157 | const quote = comptime quoteChar(@fromBackingInt(@intCast(@backingInt(tag)))); | |
| 158 | 158 | comptime var values: []const u8 = quote ++ enum_field_names[0] ++ quote; |
| 159 | 159 | inline for (enum_field_names[1..]) |enum_field_name| { |
| 160 | 160 | values = values ++ ", "; |
| ... | ... | @@ -344,7 +344,7 @@ fn diagnoseField( |
| 344 | 344 | pub fn diagnose(attr: Tag, arguments: *Arguments, arg_idx: u32, res: Parser.Result, arg_start: TokenIndex, node: Tree.Node, p: *Parser) !bool { |
| 345 | 345 | switch (attr) { |
| 346 | 346 | inline else => |tag| { |
| 347 | const decl_name = @typeInfo(attributes).@"struct".decl_names[@intFromEnum(tag)]; | |
| 347 | const decl_name = @typeInfo(attributes).@"struct".decl_names[@backingInt(tag)]; | |
| 348 | 348 | const max_arg_count = comptime maxArgCount(tag); |
| 349 | 349 | if (arg_idx >= max_arg_count) { |
| 350 | 350 | try p.err(arg_start, .attribute_too_many_args, .{ @tagName(attr), max_arg_count }); |
| ... | ... | @@ -735,7 +735,7 @@ pub const Arguments = blk: { |
| 735 | 735 | }; |
| 736 | 736 | |
| 737 | 737 | pub fn ArgumentsForTag(comptime tag: Tag) type { |
| 738 | const decl_name = @typeInfo(attributes).@"struct".decl_names[@intFromEnum(tag)]; | |
| 738 | const decl_name = @typeInfo(attributes).@"struct".decl_names[@backingInt(tag)]; | |
| 739 | 739 | return @field(attributes, decl_name); |
| 740 | 740 | } |
| 741 | 741 |
lib/compiler/aro/aro/Builtins.zig+2-2| ... | ... | @@ -360,7 +360,7 @@ pub fn fromName(comp: *Compilation, name: []const u8) ?FromName { |
| 360 | 360 | fn fromNameExtra(name: []const u8, comptime arch: std.meta.Tag(Tag)) ?FromName { |
| 361 | 361 | const list = @field(@This(), @tagName(arch)); |
| 362 | 362 | const tag = list.tagFromName(name) orelse return null; |
| 363 | const builtin = list.data[@intFromEnum(tag)]; | |
| 363 | const builtin = list.data[@backingInt(tag)]; | |
| 364 | 364 | |
| 365 | 365 | return .{ |
| 366 | 366 | .tag = @unionInit(Tag, @tagName(arch), tag), |
| ... | ... | @@ -392,7 +392,7 @@ test "all builtins" { |
| 392 | 392 | for (features) |valid_feature| { |
| 393 | 393 | if (std.mem.eql(u8, feature, valid_feature.name)) continue :outer; |
| 394 | 394 | } |
| 395 | std.debug.panic("unknown feature {s} on {t}\n", .{ feature, @as(list.Tag, @enumFromInt(index)) }); | |
| 395 | std.debug.panic("unknown feature {s} on {t}\n", .{ feature, @as(list.Tag, @fromBackingInt(@intCast(index))) }); | |
| 396 | 396 | } |
| 397 | 397 | } |
| 398 | 398 | } |
lib/compiler/aro/aro/CodeGen.zig+3-3| ... | ... | @@ -718,7 +718,7 @@ fn genExpr(c: *CodeGen, node_index: Node.Index) Error!Ir.Ref { |
| 718 | 718 | } |
| 719 | 719 | |
| 720 | 720 | try c.builder.startBlock(then_label); |
| 721 | if (c.builder.instructions.items(.ty)[@intFromEnum(c.cond_dummy_ref)] == .i1) { | |
| 721 | if (c.builder.instructions.items(.ty)[@backingInt(c.cond_dummy_ref)] == .i1) { | |
| 722 | 722 | c.cond_dummy_ref = try c.addUn(.zext, c.cond_dummy_ref, cond_qt); |
| 723 | 723 | } |
| 724 | 724 | const then_val = try c.genExpr(conditional.then_expr); |
| ... | ... | @@ -895,7 +895,7 @@ fn genLval(c: *CodeGen, node_index: Node.Index) Error!Ir.Ref { |
| 895 | 895 | } |
| 896 | 896 | |
| 897 | 897 | const duped_name = try c.builder.arena.allocator().dupeSentinel(u8, slice, 0); |
| 898 | const ref: Ir.Ref = @enumFromInt(c.builder.instructions.len); | |
| 898 | const ref: Ir.Ref = @fromBackingInt(@intCast(c.builder.instructions.len)); | |
| 899 | 899 | try c.builder.instructions.append(c.builder.gpa, .{ .tag = .symbol, .data = .{ .label = duped_name }, .ty = .ptr }); |
| 900 | 900 | return ref; |
| 901 | 901 | }, |
| ... | ... | @@ -1113,7 +1113,7 @@ fn genCall(c: *CodeGen, call: Node.Call) Error!Ir.Ref { |
| 1113 | 1113 | } |
| 1114 | 1114 | |
| 1115 | 1115 | const duped_name = try c.builder.arena.allocator().dupeSentinel(u8, slice, 0); |
| 1116 | const ref: Ir.Ref = @enumFromInt(c.builder.instructions.len); | |
| 1116 | const ref: Ir.Ref = @fromBackingInt(@intCast(c.builder.instructions.len)); | |
| 1117 | 1117 | try c.builder.instructions.append(c.builder.gpa, .{ .tag = .symbol, .data = .{ .label = duped_name }, .ty = .ptr }); |
| 1118 | 1118 | break :blk ref; |
| 1119 | 1119 | }, |
lib/compiler/aro/aro/Compilation.zig+9-9| ... | ... | @@ -595,7 +595,7 @@ fn generateSystemDefines(comp: *Compilation, w: *Io.Writer) !void { |
| 595 | 595 | |
| 596 | 596 | .{ .mmx, "__MMX__" }, |
| 597 | 597 | }) |fs| { |
| 598 | if (features.isEnabled(@intFromEnum(fs[0]))) { | |
| 598 | if (features.isEnabled(@backingInt(fs[0]))) { | |
| 599 | 599 | try define(w, fs[1]); |
| 600 | 600 | } |
| 601 | 601 | } |
| ... | ... | @@ -808,7 +808,7 @@ fn generateSystemDefines(comp: *Compilation, w: *Io.Writer) !void { |
| 808 | 808 | .{ .d128, "SYSREG128" }, |
| 809 | 809 | .{ .gcs, "GCS" }, |
| 810 | 810 | }) |fs| { |
| 811 | if (features.isEnabled(@intFromEnum(fs[0]))) { | |
| 811 | if (features.isEnabled(@backingInt(fs[0]))) { | |
| 812 | 812 | try w.print("#define __ARM_FEATURE_{s} 1\n", .{fs[1]}); |
| 813 | 813 | } |
| 814 | 814 | } |
| ... | ... | @@ -1013,7 +1013,7 @@ fn generateSystemDefines(comp: *Compilation, w: *Io.Writer) !void { |
| 1013 | 1013 | // TODO: clang treats __FLT_EVAL_METHOD__ as a special-cased macro because evaluating it within a scope |
| 1014 | 1014 | // where `#pragma clang fp eval_method(X)` has been called produces an error diagnostic. |
| 1015 | 1015 | const flt_eval_method = comp.langopts.fp_eval_method orelse target.defaultFpEvalMethod(); |
| 1016 | try w.print("#define __FLT_EVAL_METHOD__ {d}\n", .{@intFromEnum(flt_eval_method)}); | |
| 1016 | try w.print("#define __FLT_EVAL_METHOD__ {d}\n", .{@backingInt(flt_eval_method)}); | |
| 1017 | 1017 | |
| 1018 | 1018 | try w.writeAll( |
| 1019 | 1019 | \\#define __FLT_RADIX__ 2 |
| ... | ... | @@ -1028,13 +1028,13 @@ fn generateSystemDefines(comp: *Compilation, w: *Io.Writer) !void { |
| 1028 | 1028 | \\#define __pic__ {0d} |
| 1029 | 1029 | \\#define __PIC__ {0d} |
| 1030 | 1030 | \\ |
| 1031 | , .{@intFromEnum(comp.code_gen_options.pic_level)}); | |
| 1031 | , .{@backingInt(comp.code_gen_options.pic_level)}); | |
| 1032 | 1032 | if (comp.code_gen_options.is_pie) { |
| 1033 | 1033 | try w.print( |
| 1034 | 1034 | \\#define __pie__ {0d} |
| 1035 | 1035 | \\#define __PIE__ {0d} |
| 1036 | 1036 | \\ |
| 1037 | , .{@intFromEnum(comp.code_gen_options.pic_level)}); | |
| 1037 | , .{@backingInt(comp.code_gen_options.pic_level)}); | |
| 1038 | 1038 | } |
| 1039 | 1039 | }, |
| 1040 | 1040 | } |
| ... | ... | @@ -1459,7 +1459,7 @@ pub fn hasClangStyleBoundsSafety(comp: *const Compilation) bool { |
| 1459 | 1459 | |
| 1460 | 1460 | pub fn getSource(comp: *const Compilation, id: Source.Id) Source { |
| 1461 | 1461 | if (id.alias) { |
| 1462 | return comp.source_aliases.items[@intFromEnum(id.index)]; | |
| 1462 | return comp.source_aliases.items[@backingInt(id.index)]; | |
| 1463 | 1463 | } |
| 1464 | 1464 | if (id.index == .generated) return .{ |
| 1465 | 1465 | .path = "<scratch space>", |
| ... | ... | @@ -1468,7 +1468,7 @@ pub fn getSource(comp: *const Compilation, id: Source.Id) Source { |
| 1468 | 1468 | .splice_locs = &.{}, |
| 1469 | 1469 | .kind = .user, |
| 1470 | 1470 | }; |
| 1471 | return comp.sources.values()[@intFromEnum(id.index)]; | |
| 1471 | return comp.sources.values()[@backingInt(id.index)]; | |
| 1472 | 1472 | } |
| 1473 | 1473 | |
| 1474 | 1474 | /// Creates a Source from `buf` and adds it to the Compilation |
| ... | ... | @@ -1488,7 +1488,7 @@ pub fn addSourceFromOwnedBuffer(comp: *Compilation, path: []const u8, buf: []u8, |
| 1488 | 1488 | var splice_list: std.ArrayList(u32) = .empty; |
| 1489 | 1489 | defer splice_list.deinit(comp.gpa); |
| 1490 | 1490 | |
| 1491 | const source_id: Source.Id = .{ .index = @enumFromInt(comp.sources.count()) }; | |
| 1491 | const source_id: Source.Id = .{ .index = @fromBackingInt(@intCast(comp.sources.count())) }; | |
| 1492 | 1492 | |
| 1493 | 1493 | var i: u32 = 0; |
| 1494 | 1494 | var backslash_loc: u32 = undefined; |
| ... | ... | @@ -1690,7 +1690,7 @@ pub fn addSourceFromFile(comp: *Compilation, file: std.Io.File, path: []const u8 |
| 1690 | 1690 | pub fn addSourceAlias(comp: *Compilation, source: Source.Id, new_path: []const u8, new_kind: Source.Kind) !Source.Id { |
| 1691 | 1691 | var aliased_source = comp.getSource(source); |
| 1692 | 1692 | aliased_source.path = new_path; |
| 1693 | aliased_source.id = .{ .index = @enumFromInt(comp.source_aliases.items.len), .alias = true }; | |
| 1693 | aliased_source.id = .{ .index = @fromBackingInt(@intCast(comp.source_aliases.items.len)), .alias = true }; | |
| 1694 | 1694 | aliased_source.kind = new_kind; |
| 1695 | 1695 | try comp.source_aliases.append(comp.gpa, aliased_source); |
| 1696 | 1696 | return aliased_source.id; |
lib/compiler/aro/aro/Diagnostics.zig+1-1| ... | ... | @@ -405,7 +405,7 @@ pub fn effectiveKind(d: *Diagnostics, message: anytype) Message.Kind { |
| 405 | 405 | |
| 406 | 406 | // Use extension diagnostic behavior if not set explicitly. |
| 407 | 407 | if (message.extension and !set_explicit) { |
| 408 | kind = @enumFromInt(@max(@intFromEnum(kind), @intFromEnum(d.state.extensions))); | |
| 408 | kind = @fromBackingInt(@intCast(@max(@backingInt(kind), @backingInt(d.state.extensions)))); | |
| 409 | 409 | } |
| 410 | 410 | |
| 411 | 411 | // Make diagnostic a warning if -Weverything is set. |
lib/compiler/aro/aro/Hideset.zig+6-6| ... | ... | @@ -67,8 +67,8 @@ const Iterator = struct { |
| 67 | 67 | |
| 68 | 68 | fn next(self: *Iterator) ?Identifier { |
| 69 | 69 | if (self.i == .none) return null; |
| 70 | defer self.i = self.slice.items(.next)[@intFromEnum(self.i)]; | |
| 71 | return self.slice.items(.identifier)[@intFromEnum(self.i)]; | |
| 70 | defer self.i = self.slice.items(.next)[@backingInt(self.i)]; | |
| 71 | return self.slice.items(.identifier)[@backingInt(self.i)]; | |
| 72 | 72 | } |
| 73 | 73 | }; |
| 74 | 74 | |
| ... | ... | @@ -118,14 +118,14 @@ fn createNodeAssumeCapacity(self: *Hideset, identifier: Identifier) Index { |
| 118 | 118 | fn createNodeAssumeCapacityExtra(self: *Hideset, identifier: Identifier, next: Index) Index { |
| 119 | 119 | const next_idx = self.linked_list.len; |
| 120 | 120 | self.linked_list.appendAssumeCapacity(.{ .identifier = identifier, .next = next }); |
| 121 | return @enumFromInt(next_idx); | |
| 121 | return @fromBackingInt(@intCast(next_idx)); | |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | /// Create a new list with `identifier` at the front followed by `tail` |
| 125 | 125 | pub fn prepend(self: *Hideset, loc: Source.Location, tail: Index) !Index { |
| 126 | 126 | const new_idx = self.linked_list.len; |
| 127 | 127 | try self.linked_list.append(self.comp.gpa, .{ .identifier = Identifier.fromLocation(loc), .next = tail }); |
| 128 | return @enumFromInt(new_idx); | |
| 128 | return @fromBackingInt(@intCast(new_idx)); | |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | /// Attach elements of `b` to the front of `a` (if they're not in `a`) |
| ... | ... | @@ -163,7 +163,7 @@ fn len(self: *const Hideset, list: Index) usize { |
| 163 | 163 | var cur = list; |
| 164 | 164 | var count: usize = 0; |
| 165 | 165 | while (cur != .none) : (count += 1) { |
| 166 | cur = nexts[@intFromEnum(cur)]; | |
| 166 | cur = nexts[@backingInt(cur)]; | |
| 167 | 167 | } |
| 168 | 168 | return count; |
| 169 | 169 | } |
| ... | ... | @@ -189,7 +189,7 @@ pub fn intersection(self: *Hideset, a: Index, b: Index) !Index { |
| 189 | 189 | head = new_idx; |
| 190 | 190 | } |
| 191 | 191 | if (cur != .none) { |
| 192 | self.linked_list.items(.next)[@intFromEnum(cur)] = new_idx; | |
| 192 | self.linked_list.items(.next)[@backingInt(cur)] = new_idx; | |
| 193 | 193 | } |
| 194 | 194 | cur = new_idx; |
| 195 | 195 | } |
lib/compiler/aro/aro/LangOpts.zig+1-1| ... | ... | @@ -75,7 +75,7 @@ pub const Standard = enum { |
| 75 | 75 | }); |
| 76 | 76 | |
| 77 | 77 | pub fn atLeast(self: Standard, other: Standard) bool { |
| 78 | return @intFromEnum(self) >= @intFromEnum(other); | |
| 78 | return @backingInt(self) >= @backingInt(other); | |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | pub fn isGNU(standard: Standard) bool { |
lib/compiler/aro/aro/Parser.zig+39-39| ... | ... | @@ -316,7 +316,7 @@ fn validateExtendedIdentifier(p: *Parser) !bool { |
| 316 | 316 | // Check NFC normalization. |
| 317 | 317 | if (!normalized) continue; |
| 318 | 318 | const canonical_class = char_info.getCanonicalClass(codepoint); |
| 319 | if (@intFromEnum(last_canonical_class) > @intFromEnum(canonical_class) and | |
| 319 | if (@backingInt(last_canonical_class) > @backingInt(canonical_class) and | |
| 320 | 320 | canonical_class != .not_reordered) |
| 321 | 321 | { |
| 322 | 322 | normalized = false; |
| ... | ... | @@ -515,7 +515,7 @@ fn formatResult(p: *Parser, w: *std.Io.Writer, fmt: []const u8, res: Result) !us |
| 515 | 515 | .null => try w.writeAll("nullptr_t"), |
| 516 | 516 | else => if (try res.val.print(res.qt, p.comp, w)) |nested| switch (nested) { |
| 517 | 517 | .pointer => |ptr| { |
| 518 | const ptr_node: Node.Index = @enumFromInt(ptr.node); | |
| 518 | const ptr_node: Node.Index = @fromBackingInt(@intCast(ptr.node)); | |
| 519 | 519 | const decl_name = p.tree.tokSlice(ptr_node.tok(&p.tree)); |
| 520 | 520 | try ptr.offset.printPointer(decl_name, p.comp, w); |
| 521 | 521 | }, |
| ... | ... | @@ -666,16 +666,16 @@ fn addList(p: *Parser, nodes: []const Node.Index) Allocator.Error!Tree.Node.Rang |
| 666 | 666 | |
| 667 | 667 | /// Recursively sets the defintion field of `tentative_decl` to `definition`. |
| 668 | 668 | pub fn setTentativeDeclDefinition(p: *Parser, tentative_decl: Node.Index, definition: Node.Index) void { |
| 669 | const node_data = &p.tree.nodes.items(.data)[@intFromEnum(tentative_decl)]; | |
| 670 | switch (p.tree.nodes.items(.tag)[@intFromEnum(tentative_decl)]) { | |
| 669 | const node_data = &p.tree.nodes.items(.data)[@backingInt(tentative_decl)]; | |
| 670 | switch (p.tree.nodes.items(.tag)[@backingInt(tentative_decl)]) { | |
| 671 | 671 | .fn_proto => {}, |
| 672 | 672 | .variable => {}, |
| 673 | 673 | else => return, |
| 674 | 674 | } |
| 675 | 675 | |
| 676 | const prev: Node.OptIndex = @enumFromInt(node_data[2]); | |
| 676 | const prev: Node.OptIndex = @fromBackingInt(@intCast(node_data[2])); | |
| 677 | 677 | |
| 678 | node_data[2] = @intFromEnum(definition); | |
| 678 | node_data[2] = @backingInt(definition); | |
| 679 | 679 | if (prev.unpack()) |some| { |
| 680 | 680 | p.setTentativeDeclDefinition(some, definition); |
| 681 | 681 | } |
| ... | ... | @@ -687,20 +687,20 @@ fn clearNonTentativeDefinitions(p: *Parser) void { |
| 687 | 687 | const tags = p.tree.nodes.items(.tag); |
| 688 | 688 | const data = p.tree.nodes.items(.data); |
| 689 | 689 | for (p.tree.root_decls.items) |root_decl| { |
| 690 | switch (tags[@intFromEnum(root_decl)]) { | |
| 690 | switch (tags[@backingInt(root_decl)]) { | |
| 691 | 691 | .fn_proto => { |
| 692 | const node_data = &data[@intFromEnum(root_decl)]; | |
| 693 | if (node_data[2] != @intFromEnum(Node.OptIndex.null)) { | |
| 692 | const node_data = &data[@backingInt(root_decl)]; | |
| 693 | if (node_data[2] != @backingInt(Node.OptIndex.null)) { | |
| 694 | 694 | if (tags[node_data[2]] != .fn_def) { |
| 695 | node_data[2] = @intFromEnum(Node.OptIndex.null); | |
| 695 | node_data[2] = @backingInt(Node.OptIndex.null); | |
| 696 | 696 | } |
| 697 | 697 | } |
| 698 | 698 | }, |
| 699 | 699 | .variable => { |
| 700 | const node_data = &data[@intFromEnum(root_decl)]; | |
| 701 | if (node_data[2] != @intFromEnum(Node.OptIndex.null)) { | |
| 700 | const node_data = &data[@backingInt(root_decl)]; | |
| 701 | if (node_data[2] != @backingInt(Node.OptIndex.null)) { | |
| 702 | 702 | if (tags[node_data[2]] != .variable_def) { |
| 703 | node_data[2] = @intFromEnum(Node.OptIndex.null); | |
| 703 | node_data[2] = @backingInt(Node.OptIndex.null); | |
| 704 | 704 | } |
| 705 | 705 | } |
| 706 | 706 | }, |
| ... | ... | @@ -1326,7 +1326,7 @@ fn decl(p: *Parser) Error!bool { |
| 1326 | 1326 | .qt = p.func.qt.?, |
| 1327 | 1327 | .body = body, |
| 1328 | 1328 | .definition = null, |
| 1329 | } }, @intFromEnum(decl_node)); | |
| 1329 | } }, @backingInt(decl_node)); | |
| 1330 | 1330 | |
| 1331 | 1331 | try p.decl_buf.append(gpa, decl_node); |
| 1332 | 1332 | |
| ... | ... | @@ -1358,7 +1358,7 @@ fn decl(p: *Parser) Error!bool { |
| 1358 | 1358 | .name_tok = init_d.d.name, |
| 1359 | 1359 | .qt = init_d.d.qt, |
| 1360 | 1360 | .implicit = false, |
| 1361 | } }, @intFromEnum(decl_node)); | |
| 1361 | } }, @backingInt(decl_node)); | |
| 1362 | 1362 | } else if (init_d.d.declarator_type == .func or init_d.d.qt.is(p.comp, .func)) { |
| 1363 | 1363 | try decl_spec.validateFnDecl(p); |
| 1364 | 1364 | try p.tree.setNode(.{ .function = .{ |
| ... | ... | @@ -1368,7 +1368,7 @@ fn decl(p: *Parser) Error!bool { |
| 1368 | 1368 | .@"inline" = decl_spec.@"inline" != null, |
| 1369 | 1369 | .body = null, |
| 1370 | 1370 | .definition = null, |
| 1371 | } }, @intFromEnum(decl_node)); | |
| 1371 | } }, @backingInt(decl_node)); | |
| 1372 | 1372 | } else { |
| 1373 | 1373 | try decl_spec.validateDecl(p, init_d.asm_label); |
| 1374 | 1374 | var node_qt = init_d.d.qt; |
| ... | ... | @@ -1400,7 +1400,7 @@ fn decl(p: *Parser) Error!bool { |
| 1400 | 1400 | .initializer = if (init_d.initializer) |some| some.node else null, |
| 1401 | 1401 | .definition = null, |
| 1402 | 1402 | }, |
| 1403 | }, @intFromEnum(decl_node)); | |
| 1403 | }, @backingInt(decl_node)); | |
| 1404 | 1404 | } |
| 1405 | 1405 | try p.decl_buf.append(gpa, decl_node); |
| 1406 | 1406 | |
| ... | ... | @@ -2425,7 +2425,7 @@ fn recordSpec(p: *Parser) Error!QualType { |
| 2425 | 2425 | const record_ty: Type.Record = .{ |
| 2426 | 2426 | .name = interned_name, |
| 2427 | 2427 | .layout = null, |
| 2428 | .decl_node = @enumFromInt(reserved_index), | |
| 2428 | .decl_node = @fromBackingInt(@intCast(reserved_index)), | |
| 2429 | 2429 | .fields = &.{}, |
| 2430 | 2430 | }; |
| 2431 | 2431 | const record_qt = try p.comp.type_store.put(gpa, if (is_struct) |
| ... | ... | @@ -2451,7 +2451,7 @@ fn recordSpec(p: *Parser) Error!QualType { |
| 2451 | 2451 | .{ .struct_forward_decl = fw } |
| 2452 | 2452 | else |
| 2453 | 2453 | .{ .union_forward_decl = fw }, reserved_index); |
| 2454 | try p.decl_buf.append(gpa, @enumFromInt(reserved_index)); | |
| 2454 | try p.decl_buf.append(gpa, @fromBackingInt(@intCast(reserved_index))); | |
| 2455 | 2455 | return attributed_qt; |
| 2456 | 2456 | } |
| 2457 | 2457 | }; |
| ... | ... | @@ -2481,7 +2481,7 @@ fn recordSpec(p: *Parser) Error!QualType { |
| 2481 | 2481 | // can be specified after the closing rbrace, which we haven't encountered yet. |
| 2482 | 2482 | const record_ty: Type.Record = .{ |
| 2483 | 2483 | .name = interned_name, |
| 2484 | .decl_node = @enumFromInt(reserved_index), | |
| 2484 | .decl_node = @fromBackingInt(@intCast(reserved_index)), | |
| 2485 | 2485 | .layout = null, |
| 2486 | 2486 | .fields = &.{}, |
| 2487 | 2487 | }; |
| ... | ... | @@ -2505,7 +2505,7 @@ fn recordSpec(p: *Parser) Error!QualType { |
| 2505 | 2505 | break :blk .{ record_ty, record_qt }; |
| 2506 | 2506 | }; |
| 2507 | 2507 | |
| 2508 | try p.decl_buf.append(gpa, @enumFromInt(reserved_index)); | |
| 2508 | try p.decl_buf.append(gpa, @fromBackingInt(@intCast(reserved_index))); | |
| 2509 | 2509 | const decl_buf_top = p.decl_buf.items.len; |
| 2510 | 2510 | const record_buf_top = p.record_buf.items.len; |
| 2511 | 2511 | errdefer p.decl_buf.items.len = decl_buf_top - 1; |
| ... | ... | @@ -2557,15 +2557,15 @@ fn recordSpec(p: *Parser) Error!QualType { |
| 2557 | 2557 | .pointer_alignment_bits = 8, |
| 2558 | 2558 | .required_alignment_bits = 8, |
| 2559 | 2559 | }; |
| 2560 | record_ty.decl_node = @enumFromInt(reserved_index); | |
| 2560 | record_ty.decl_node = @fromBackingInt(@intCast(reserved_index)); | |
| 2561 | 2561 | |
| 2562 | 2562 | const base_type = qt.base(p.comp); |
| 2563 | 2563 | if (is_struct) { |
| 2564 | 2564 | std.debug.assert(base_type.type.@"struct".name == record_ty.name); |
| 2565 | try p.comp.type_store.set(gpa, .{ .@"struct" = record_ty }, @intFromEnum(base_type.qt._index)); | |
| 2565 | try p.comp.type_store.set(gpa, .{ .@"struct" = record_ty }, @backingInt(base_type.qt._index)); | |
| 2566 | 2566 | } else { |
| 2567 | 2567 | std.debug.assert(base_type.type.@"union".name == record_ty.name); |
| 2568 | try p.comp.type_store.set(gpa, .{ .@"union" = record_ty }, @intFromEnum(base_type.qt._index)); | |
| 2568 | try p.comp.type_store.set(gpa, .{ .@"union" = record_ty }, @backingInt(base_type.qt._index)); | |
| 2569 | 2569 | } |
| 2570 | 2570 | break :blk false; |
| 2571 | 2571 | }; |
| ... | ... | @@ -2597,7 +2597,7 @@ fn recordSpec(p: *Parser) Error!QualType { |
| 2597 | 2597 | // Override previous incomplete layout and fields. |
| 2598 | 2598 | const base_qt = qt.base(p.comp).qt; |
| 2599 | 2599 | const ts = &p.comp.type_store; |
| 2600 | var extra_index = ts.types.items(.data)[@intFromEnum(base_qt._index)][1]; | |
| 2600 | var extra_index = ts.types.items(.data)[@backingInt(base_qt._index)][1]; | |
| 2601 | 2601 | |
| 2602 | 2602 | const layout_size = 5; |
| 2603 | 2603 | comptime std.debug.assert(@sizeOf(Type.Record.Layout) == @sizeOf(u32) * layout_size); |
| ... | ... | @@ -2804,7 +2804,7 @@ fn recordDecl(p: *Parser) Error!bool { |
| 2804 | 2804 | .name = interned_name, |
| 2805 | 2805 | .qt = qt, |
| 2806 | 2806 | .name_tok = name_tok, |
| 2807 | .bit_width = if (bits) |some| @enumFromInt(some) else .null, | |
| 2807 | .bit_width = if (bits) |some| @fromBackingInt(@intCast(some)) else .null, | |
| 2808 | 2808 | ._attr_index = attr_index, |
| 2809 | 2809 | ._attr_len = attr_len, |
| 2810 | 2810 | }); |
| ... | ... | @@ -2951,7 +2951,7 @@ fn enumSpec(p: *Parser) Error!QualType { |
| 2951 | 2951 | .tag = fixed_qt, |
| 2952 | 2952 | .fixed = fixed_qt != null, |
| 2953 | 2953 | .incomplete = true, |
| 2954 | .decl_node = @enumFromInt(reserved_index), | |
| 2954 | .decl_node = @fromBackingInt(@intCast(reserved_index)), | |
| 2955 | 2955 | .fields = &.{}, |
| 2956 | 2956 | } }); |
| 2957 | 2957 | |
| ... | ... | @@ -3001,7 +3001,7 @@ fn enumSpec(p: *Parser) Error!QualType { |
| 3001 | 3001 | // can be specified after the closing rbrace, which we haven't encountered yet. |
| 3002 | 3002 | const enum_ty: Type.Enum = .{ |
| 3003 | 3003 | .name = interned_name, |
| 3004 | .decl_node = @enumFromInt(reserved_index), | |
| 3004 | .decl_node = @fromBackingInt(@intCast(reserved_index)), | |
| 3005 | 3005 | .tag = fixed_qt, |
| 3006 | 3006 | .incomplete = true, |
| 3007 | 3007 | .fixed = fixed_qt != null, |
| ... | ... | @@ -3012,7 +3012,7 @@ fn enumSpec(p: *Parser) Error!QualType { |
| 3012 | 3012 | }; |
| 3013 | 3013 | |
| 3014 | 3014 | // reserve space for this enum |
| 3015 | try p.decl_buf.append(gpa, @enumFromInt(reserved_index)); | |
| 3015 | try p.decl_buf.append(gpa, @fromBackingInt(@intCast(reserved_index))); | |
| 3016 | 3016 | const decl_buf_top = p.decl_buf.items.len; |
| 3017 | 3017 | const list_buf_top = p.list_buf.items.len; |
| 3018 | 3018 | const enum_buf_top = p.enum_buf.items.len; |
| ... | ... | @@ -3076,17 +3076,17 @@ fn enumSpec(p: *Parser) Error!QualType { |
| 3076 | 3076 | new_field_node.enum_field.init = res.node; |
| 3077 | 3077 | } |
| 3078 | 3078 | |
| 3079 | try p.tree.setNode(new_field_node, @intFromEnum(field_node)); | |
| 3079 | try p.tree.setNode(new_field_node, @backingInt(field_node)); | |
| 3080 | 3080 | } |
| 3081 | 3081 | } |
| 3082 | 3082 | |
| 3083 | 3083 | { // Override previous incomplete type |
| 3084 | 3084 | enum_ty.fields = enum_fields; |
| 3085 | 3085 | enum_ty.incomplete = false; |
| 3086 | enum_ty.decl_node = @enumFromInt(reserved_index); | |
| 3086 | enum_ty.decl_node = @fromBackingInt(@intCast(reserved_index)); | |
| 3087 | 3087 | const base_type = attributed_qt.base(p.comp); |
| 3088 | 3088 | std.debug.assert(base_type.type.@"enum".name == enum_ty.name); |
| 3089 | try p.comp.type_store.set(gpa, .{ .@"enum" = enum_ty }, @intFromEnum(base_type.qt._index)); | |
| 3089 | try p.comp.type_store.set(gpa, .{ .@"enum" = enum_ty }, @backingInt(base_type.qt._index)); | |
| 3090 | 3090 | } |
| 3091 | 3091 | |
| 3092 | 3092 | // declare a symbol for the type |
| ... | ... | @@ -3619,7 +3619,7 @@ fn declarator( |
| 3619 | 3619 | else => unreachable, |
| 3620 | 3620 | } |
| 3621 | 3621 | // Child type is always stored in repr.data[0] |
| 3622 | p.comp.type_store.types.items(.data)[@intFromEnum(cur._index)][0] = @bitCast(outer); | |
| 3622 | p.comp.type_store.types.items(.data)[@backingInt(cur._index)][0] = @bitCast(outer); | |
| 3623 | 3623 | break; |
| 3624 | 3624 | } |
| 3625 | 3625 | } |
| ... | ... | @@ -5565,7 +5565,7 @@ fn pointerValue(p: *Parser, node: Node.Index, offset: Value) !Value { |
| 5565 | 5565 | const var_name = try p.comp.internString(p.tokSlice(decl_ref.name_tok)); |
| 5566 | 5566 | const sym = p.syms.findSymbol(var_name) orelse return .{}; |
| 5567 | 5567 | const sym_node = sym.node.unpack() orelse return .{}; |
| 5568 | return Value.pointer(.{ .node = @intFromEnum(sym_node), .offset = offset.ref() }, p.comp); | |
| 5568 | return Value.pointer(.{ .node = @backingInt(sym_node), .offset = offset.ref() }, p.comp); | |
| 5569 | 5569 | }, |
| 5570 | 5570 | .string_literal_expr => return p.tree.value_map.get(node).?, |
| 5571 | 5571 | else => return .{}, |
| ... | ... | @@ -10066,7 +10066,7 @@ fn stringLiteral(p: *Parser) Error!Result { |
| 10066 | 10066 | const strings_top = p.strings.items.len; |
| 10067 | 10067 | defer p.strings.items.len = strings_top; |
| 10068 | 10068 | |
| 10069 | const literal_start = mem.alignForward(usize, strings_top, @intFromEnum(char_width)); | |
| 10069 | const literal_start = mem.alignForward(usize, strings_top, @backingInt(char_width)); | |
| 10070 | 10070 | try p.strings.resize(gpa, literal_start); |
| 10071 | 10071 | |
| 10072 | 10072 | while (p.tok_i < string_end) : (p.tok_i += 1) { |
| ... | ... | @@ -10082,7 +10082,7 @@ fn stringLiteral(p: *Parser) Error!Result { |
| 10082 | 10082 | .incorrect_encoding_is_error = count > 1, |
| 10083 | 10083 | }; |
| 10084 | 10084 | |
| 10085 | try p.strings.ensureUnusedCapacity(gpa, (slice.len + 1) * @intFromEnum(char_width)); // +1 for null terminator | |
| 10085 | try p.strings.ensureUnusedCapacity(gpa, (slice.len + 1) * @backingInt(char_width)); // +1 for null terminator | |
| 10086 | 10086 | while (try char_literal_parser.next()) |item| switch (item) { |
| 10087 | 10087 | .value => |v| { |
| 10088 | 10088 | switch (char_width) { |
| ... | ... | @@ -10143,7 +10143,7 @@ fn stringLiteral(p: *Parser) Error!Result { |
| 10143 | 10143 | }, |
| 10144 | 10144 | }; |
| 10145 | 10145 | } |
| 10146 | p.strings.appendNTimesAssumeCapacity(0, @intFromEnum(char_width)); | |
| 10146 | p.strings.appendNTimesAssumeCapacity(0, @backingInt(char_width)); | |
| 10147 | 10147 | const slice = p.strings.items[literal_start..]; |
| 10148 | 10148 | |
| 10149 | 10149 | // TODO this won't do anything if there is a cache hit |
| ... | ... | @@ -10158,7 +10158,7 @@ fn stringLiteral(p: *Parser) Error!Result { |
| 10158 | 10158 | |
| 10159 | 10159 | const array_qt = try p.comp.type_store.put(gpa, .{ .array = .{ |
| 10160 | 10160 | .elem = string_kind.elementType(p.comp), |
| 10161 | .len = .{ .fixed = @divExact(slice.len, @intFromEnum(char_width)) }, | |
| 10161 | .len = .{ .fixed = @divExact(slice.len, @backingInt(char_width)) }, | |
| 10162 | 10162 | } }); |
| 10163 | 10163 | const res: Result = .{ |
| 10164 | 10164 | .qt = array_qt, |
| ... | ... | @@ -10503,7 +10503,7 @@ fn parseInt(p: *Parser, prefix: NumberPrefix, buf: []const u8, suffix: NumberSuf |
| 10503 | 10503 | if (prefix == .binary) { |
| 10504 | 10504 | try p.err(tok_i, .binary_integer_literal, .{}); |
| 10505 | 10505 | } |
| 10506 | const base = @intFromEnum(prefix); | |
| 10506 | const base = @backingInt(prefix); | |
| 10507 | 10507 | var res = if (suffix.isBitInt()) |
| 10508 | 10508 | try p.bitInt(base, buf, suffix, tok_i) |
| 10509 | 10509 | else |
lib/compiler/aro/aro/Preprocessor.zig+2-2| ... | ... | @@ -45,11 +45,11 @@ const IfContext = struct { |
| 45 | 45 | level: u8, |
| 46 | 46 | |
| 47 | 47 | fn get(self: *const IfContext) Nesting { |
| 48 | return @enumFromInt(std.mem.readPackedInt(Backing, &self.kind, @as(usize, self.level) * 2, .native)); | |
| 48 | return @fromBackingInt(@intCast(std.mem.readPackedInt(Backing, &self.kind, @as(usize, self.level) * 2, .native))); | |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | fn set(self: *IfContext, context: Nesting) void { |
| 52 | std.mem.writePackedInt(Backing, &self.kind, @as(usize, self.level) * 2, @intFromEnum(context), .native); | |
| 52 | std.mem.writePackedInt(Backing, &self.kind, @as(usize, self.level) * 2, @backingInt(context), .native); | |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | fn increment(self: *IfContext) bool { |
lib/compiler/aro/aro/StringInterner.zig+3-3| ... | ... | @@ -10,12 +10,12 @@ pub const StringId = enum(u32) { |
| 10 | 10 | |
| 11 | 11 | pub fn lookup(id: StringId, comp: *const Compilation) []const u8 { |
| 12 | 12 | if (id == .empty) return ""; |
| 13 | return comp.string_interner.table.keys()[@intFromEnum(id)]; | |
| 13 | return comp.string_interner.table.keys()[@backingInt(id)]; | |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | pub fn lookupExtra(id: StringId, si: StringInterner) []const u8 { |
| 17 | 17 | if (id == .empty) return ""; |
| 18 | return si.table.keys()[@intFromEnum(id)]; | |
| 18 | return si.table.keys()[@backingInt(id)]; | |
| 19 | 19 | } |
| 20 | 20 | }; |
| 21 | 21 | |
| ... | ... | @@ -31,5 +31,5 @@ pub fn intern(si: *StringInterner, allocator: mem.Allocator, str: []const u8) !S |
| 31 | 31 | if (str.len == 0) return .empty; |
| 32 | 32 | |
| 33 | 33 | const gop = try si.table.getOrPut(allocator, str); |
| 34 | return @enumFromInt(gop.index); | |
| 34 | return @fromBackingInt(@intCast(gop.index)); | |
| 35 | 35 | } |
lib/compiler/aro/aro/Target.zig+6-6| ... | ... | @@ -104,14 +104,14 @@ pub const SubArch = enum { |
| 104 | 104 | |
| 105 | 105 | pub fn toFeature(sub: SubArch, arch: Cpu.Arch) ?std.Target.Cpu.Feature.Set.Index { |
| 106 | 106 | if (arch.isPowerPC()) { |
| 107 | if (sub == .powerpc_spe) return @intFromEnum(std.Target.powerpc.Feature.spe); | |
| 107 | if (sub == .powerpc_spe) return @backingInt(std.Target.powerpc.Feature.spe); | |
| 108 | 108 | } else if (arch.isMIPS32()) { |
| 109 | return @intFromEnum(std.Target.mips.Feature.mips32r6); | |
| 109 | return @backingInt(std.Target.mips.Feature.mips32r6); | |
| 110 | 110 | } else if (arch.isMIPS64()) { |
| 111 | return @intFromEnum(std.Target.mips.Feature.mips64r6); | |
| 111 | return @backingInt(std.Target.mips.Feature.mips64r6); | |
| 112 | 112 | } else if (arch.isSpirV()) { |
| 113 | 113 | const spirv = std.Target.spirv.Feature; |
| 114 | return @intFromEnum(switch (sub) { | |
| 114 | return @backingInt(switch (sub) { | |
| 115 | 115 | .spirv_v10 => spirv.v1_0, |
| 116 | 116 | .spirv_v11 => spirv.v1_1, |
| 117 | 117 | .spirv_v12 => spirv.v1_2, |
| ... | ... | @@ -123,7 +123,7 @@ pub const SubArch = enum { |
| 123 | 123 | }); |
| 124 | 124 | } else if (arch.isAARCH64()) { |
| 125 | 125 | const aarch64 = std.Target.aarch64.Feature; |
| 126 | return @intFromEnum(switch (sub) { | |
| 126 | return @backingInt(switch (sub) { | |
| 127 | 127 | .arm_v8_1a => aarch64.v8_1a, |
| 128 | 128 | .arm_v8_2a => aarch64.v8_2a, |
| 129 | 129 | .arm_v8_3a => aarch64.v8_3a, |
| ... | ... | @@ -149,7 +149,7 @@ pub const SubArch = enum { |
| 149 | 149 | }); |
| 150 | 150 | } else if (arch.isArm()) { |
| 151 | 151 | const arm = std.Target.arm.Feature; |
| 152 | return @intFromEnum(switch (sub) { | |
| 152 | return @backingInt(switch (sub) { | |
| 153 | 153 | .arm_v4t => arm.v4t, |
| 154 | 154 | .arm_v5 => arm.v5t, |
| 155 | 155 | .arm_v5te => arm.v5te, |
lib/compiler/aro/aro/Tokenizer.zig+2-2| ... | ... | @@ -1218,7 +1218,7 @@ pub fn next(self: *Tokenizer) Token { |
| 1218 | 1218 | break; |
| 1219 | 1219 | }, |
| 1220 | 1220 | .hex4, .hex8 => { |
| 1221 | self.index += @intFromEnum(ucn_kind); | |
| 1221 | self.index += @backingInt(ucn_kind); | |
| 1222 | 1222 | id = .extended_identifier; |
| 1223 | 1223 | state = .extended_identifier; |
| 1224 | 1224 | }, |
| ... | ... | @@ -1458,7 +1458,7 @@ pub fn next(self: *Tokenizer) Token { |
| 1458 | 1458 | }, |
| 1459 | 1459 | .hex4, .hex8 => { |
| 1460 | 1460 | state = .extended_identifier; |
| 1461 | self.index += @intFromEnum(ucn_kind); | |
| 1461 | self.index += @backingInt(ucn_kind); | |
| 1462 | 1462 | }, |
| 1463 | 1463 | } |
| 1464 | 1464 | }, |
lib/compiler/aro/aro/Tree.zig+269-269| ... | ... | @@ -732,9 +732,9 @@ pub const Node = union(enum) { |
| 732 | 732 | _, |
| 733 | 733 | |
| 734 | 734 | pub fn get(index: Index, tree: *const Tree) Node { |
| 735 | const node_tok = tree.nodes.items(.tok)[@intFromEnum(index)]; | |
| 736 | const node_data = &tree.nodes.items(.data)[@intFromEnum(index)]; | |
| 737 | return switch (tree.nodes.items(.tag)[@intFromEnum(index)]) { | |
| 735 | const node_tok = tree.nodes.items(.tok)[@backingInt(index)]; | |
| 736 | const node_data = &tree.nodes.items(.data)[@backingInt(index)]; | |
| 737 | return switch (tree.nodes.items(.tag)[@backingInt(index)]) { | |
| 738 | 738 | .empty_decl => .{ |
| 739 | 739 | .empty_decl = .{ |
| 740 | 740 | .semicolon = node_tok, |
| ... | ... | @@ -743,7 +743,7 @@ pub const Node = union(enum) { |
| 743 | 743 | .static_assert => .{ |
| 744 | 744 | .static_assert = .{ |
| 745 | 745 | .assert_tok = node_tok, |
| 746 | .cond = @enumFromInt(node_data[0]), | |
| 746 | .cond = @fromBackingInt(@intCast(node_data[0])), | |
| 747 | 747 | .message = unpackOptIndex(node_data[1]), |
| 748 | 748 | }, |
| 749 | 749 | }, |
| ... | ... | @@ -768,7 +768,7 @@ pub const Node = union(enum) { |
| 768 | 768 | .qt = @bitCast(node_data[0]), |
| 769 | 769 | .static = attr.static, |
| 770 | 770 | .@"inline" = attr.@"inline", |
| 771 | .body = @enumFromInt(node_data[2]), | |
| 771 | .body = @fromBackingInt(@intCast(node_data[2])), | |
| 772 | 772 | .definition = null, |
| 773 | 773 | }, |
| 774 | 774 | }; |
| ... | ... | @@ -838,7 +838,7 @@ pub const Node = union(enum) { |
| 838 | 838 | .global_asm => .{ |
| 839 | 839 | .global_asm = .{ |
| 840 | 840 | .asm_tok = node_tok, |
| 841 | .asm_str = @enumFromInt(node_data[0]), | |
| 841 | .asm_str = @fromBackingInt(@intCast(node_data[0])), | |
| 842 | 842 | }, |
| 843 | 843 | }, |
| 844 | 844 | .struct_decl => .{ |
| ... | ... | @@ -922,7 +922,7 @@ pub const Node = union(enum) { |
| 922 | 922 | .labeled_stmt = .{ |
| 923 | 923 | .label_tok = node_tok, |
| 924 | 924 | .qt = @bitCast(node_data[0]), |
| 925 | .body = @enumFromInt(node_data[1]), | |
| 925 | .body = @fromBackingInt(@intCast(node_data[1])), | |
| 926 | 926 | }, |
| 927 | 927 | }, |
| 928 | 928 | .compound_stmt => .{ |
| ... | ... | @@ -940,44 +940,44 @@ pub const Node = union(enum) { |
| 940 | 940 | .if_stmt => .{ |
| 941 | 941 | .if_stmt = .{ |
| 942 | 942 | .if_tok = node_tok, |
| 943 | .cond = @enumFromInt(node_data[0]), | |
| 944 | .then_body = @enumFromInt(node_data[1]), | |
| 943 | .cond = @fromBackingInt(@intCast(node_data[0])), | |
| 944 | .then_body = @fromBackingInt(@intCast(node_data[1])), | |
| 945 | 945 | .else_body = unpackOptIndex(node_data[2]), |
| 946 | 946 | }, |
| 947 | 947 | }, |
| 948 | 948 | .switch_stmt => .{ |
| 949 | 949 | .switch_stmt = .{ |
| 950 | 950 | .switch_tok = node_tok, |
| 951 | .cond = @enumFromInt(node_data[0]), | |
| 952 | .body = @enumFromInt(node_data[1]), | |
| 951 | .cond = @fromBackingInt(@intCast(node_data[0])), | |
| 952 | .body = @fromBackingInt(@intCast(node_data[1])), | |
| 953 | 953 | }, |
| 954 | 954 | }, |
| 955 | 955 | .case_stmt => .{ |
| 956 | 956 | .case_stmt = .{ |
| 957 | 957 | .case_tok = node_tok, |
| 958 | .start = @enumFromInt(node_data[0]), | |
| 958 | .start = @fromBackingInt(@intCast(node_data[0])), | |
| 959 | 959 | .end = unpackOptIndex(node_data[1]), |
| 960 | .body = @enumFromInt(node_data[2]), | |
| 960 | .body = @fromBackingInt(@intCast(node_data[2])), | |
| 961 | 961 | }, |
| 962 | 962 | }, |
| 963 | 963 | .default_stmt => .{ |
| 964 | 964 | .default_stmt = .{ |
| 965 | 965 | .default_tok = node_tok, |
| 966 | .body = @enumFromInt(node_data[0]), | |
| 966 | .body = @fromBackingInt(@intCast(node_data[0])), | |
| 967 | 967 | }, |
| 968 | 968 | }, |
| 969 | 969 | .while_stmt => .{ |
| 970 | 970 | .while_stmt = .{ |
| 971 | 971 | .while_tok = node_tok, |
| 972 | .cond = @enumFromInt(node_data[0]), | |
| 973 | .body = @enumFromInt(node_data[1]), | |
| 972 | .cond = @fromBackingInt(@intCast(node_data[0])), | |
| 973 | .body = @fromBackingInt(@intCast(node_data[1])), | |
| 974 | 974 | }, |
| 975 | 975 | }, |
| 976 | 976 | .do_while_stmt => .{ |
| 977 | 977 | .do_while_stmt = .{ |
| 978 | 978 | .do_tok = node_tok, |
| 979 | .cond = @enumFromInt(node_data[0]), | |
| 980 | .body = @enumFromInt(node_data[1]), | |
| 979 | .cond = @fromBackingInt(@intCast(node_data[0])), | |
| 980 | .body = @fromBackingInt(@intCast(node_data[1])), | |
| 981 | 981 | }, |
| 982 | 982 | }, |
| 983 | 983 | .for_decl => .{ |
| ... | ... | @@ -986,7 +986,7 @@ pub const Node = union(enum) { |
| 986 | 986 | .init = .{ .decls = @ptrCast(tree.extra.items[node_data[0]..][0 .. node_data[1] - 2]) }, |
| 987 | 987 | .cond = unpackOptIndex(tree.extra.items[node_data[0] + node_data[1] - 2]), |
| 988 | 988 | .incr = unpackOptIndex(tree.extra.items[node_data[0] + node_data[1] - 1]), |
| 989 | .body = @enumFromInt(node_data[2]), | |
| 989 | .body = @fromBackingInt(@intCast(node_data[2])), | |
| 990 | 990 | }, |
| 991 | 991 | }, |
| 992 | 992 | .for_expr => .{ |
| ... | ... | @@ -995,7 +995,7 @@ pub const Node = union(enum) { |
| 995 | 995 | .init = .{ .expr = unpackOptIndex(node_data[0]) }, |
| 996 | 996 | .cond = unpackOptIndex(tree.extra.items[node_data[1]]), |
| 997 | 997 | .incr = unpackOptIndex(tree.extra.items[node_data[1] + 1]), |
| 998 | .body = @enumFromInt(node_data[2]), | |
| 998 | .body = @fromBackingInt(@intCast(node_data[2])), | |
| 999 | 999 | }, |
| 1000 | 1000 | }, |
| 1001 | 1001 | .goto_stmt => .{ |
| ... | ... | @@ -1006,7 +1006,7 @@ pub const Node = union(enum) { |
| 1006 | 1006 | .computed_goto_stmt => .{ |
| 1007 | 1007 | .computed_goto_stmt = .{ |
| 1008 | 1008 | .goto_tok = node_tok, |
| 1009 | .expr = @enumFromInt(node_data[0]), | |
| 1009 | .expr = @fromBackingInt(@intCast(node_data[0])), | |
| 1010 | 1010 | }, |
| 1011 | 1011 | }, |
| 1012 | 1012 | .continue_stmt => .{ |
| ... | ... | @@ -1030,7 +1030,7 @@ pub const Node = union(enum) { |
| 1030 | 1030 | .return_tok = node_tok, |
| 1031 | 1031 | .return_qt = @bitCast(node_data[0]), |
| 1032 | 1032 | .operand = .{ |
| 1033 | .expr = @enumFromInt(node_data[1]), | |
| 1033 | .expr = @fromBackingInt(@intCast(node_data[1])), | |
| 1034 | 1034 | }, |
| 1035 | 1035 | }, |
| 1036 | 1036 | }, |
| ... | ... | @@ -1082,7 +1082,7 @@ pub const Node = union(enum) { |
| 1082 | 1082 | return .{ |
| 1083 | 1083 | .asm_stmt = .{ |
| 1084 | 1084 | .asm_tok = node_tok, |
| 1085 | .asm_str = @enumFromInt(node_data[0]), | |
| 1085 | .asm_str = @fromBackingInt(@intCast(node_data[0])), | |
| 1086 | 1086 | .outputs = @ptrCast(outputs), |
| 1087 | 1087 | .inputs = @ptrCast(inputs), |
| 1088 | 1088 | .clobbers = @ptrCast(clobbers), |
| ... | ... | @@ -1094,7 +1094,7 @@ pub const Node = union(enum) { |
| 1094 | 1094 | .asm_stmt_simple => .{ |
| 1095 | 1095 | .asm_stmt = .{ |
| 1096 | 1096 | .asm_tok = node_tok, |
| 1097 | .asm_str = @enumFromInt(node_data[0]), | |
| 1097 | .asm_str = @fromBackingInt(@intCast(node_data[0])), | |
| 1098 | 1098 | .outputs = &.{}, |
| 1099 | 1099 | .inputs = &.{}, |
| 1100 | 1100 | .clobbers = &.{}, |
| ... | ... | @@ -1106,255 +1106,255 @@ pub const Node = union(enum) { |
| 1106 | 1106 | .assign_expr = .{ |
| 1107 | 1107 | .op_tok = node_tok, |
| 1108 | 1108 | .qt = @bitCast(node_data[0]), |
| 1109 | .lhs = @enumFromInt(node_data[1]), | |
| 1110 | .rhs = @enumFromInt(node_data[2]), | |
| 1109 | .lhs = @fromBackingInt(@intCast(node_data[1])), | |
| 1110 | .rhs = @fromBackingInt(@intCast(node_data[2])), | |
| 1111 | 1111 | }, |
| 1112 | 1112 | }, |
| 1113 | 1113 | .mul_assign_expr => .{ |
| 1114 | 1114 | .mul_assign_expr = .{ |
| 1115 | 1115 | .op_tok = node_tok, |
| 1116 | 1116 | .qt = @bitCast(node_data[0]), |
| 1117 | .lhs = @enumFromInt(node_data[1]), | |
| 1118 | .rhs = @enumFromInt(node_data[2]), | |
| 1117 | .lhs = @fromBackingInt(@intCast(node_data[1])), | |
| 1118 | .rhs = @fromBackingInt(@intCast(node_data[2])), | |
| 1119 | 1119 | }, |
| 1120 | 1120 | }, |
| 1121 | 1121 | .div_assign_expr => .{ |
| 1122 | 1122 | .div_assign_expr = .{ |
| 1123 | 1123 | .op_tok = node_tok, |
| 1124 | 1124 | .qt = @bitCast(node_data[0]), |
| 1125 | .lhs = @enumFromInt(node_data[1]), | |
| 1126 | .rhs = @enumFromInt(node_data[2]), | |
| 1125 | .lhs = @fromBackingInt(@intCast(node_data[1])), | |
| 1126 | .rhs = @fromBackingInt(@intCast(node_data[2])), | |
| 1127 | 1127 | }, |
| 1128 | 1128 | }, |
| 1129 | 1129 | .mod_assign_expr => .{ |
| 1130 | 1130 | .mod_assign_expr = .{ |
| 1131 | 1131 | .op_tok = node_tok, |
| 1132 | 1132 | .qt = @bitCast(node_data[0]), |
| 1133 | .lhs = @enumFromInt(node_data[1]), | |
| 1134 | .rhs = @enumFromInt(node_data[2]), | |
| 1133 | .lhs = @fromBackingInt(@intCast(node_data[1])), | |
| 1134 | .rhs = @fromBackingInt(@intCast(node_data[2])), | |
| 1135 | 1135 | }, |
| 1136 | 1136 | }, |
| 1137 | 1137 | .add_assign_expr => .{ |
| 1138 | 1138 | .add_assign_expr = .{ |
| 1139 | 1139 | .op_tok = node_tok, |
| 1140 | 1140 | .qt = @bitCast(node_data[0]), |
| 1141 | .lhs = @enumFromInt(node_data[1]), | |
| 1142 | .rhs = @enumFromInt(node_data[2]), | |
| 1141 | .lhs = @fromBackingInt(@intCast(node_data[1])), | |
| 1142 | .rhs = @fromBackingInt(@intCast(node_data[2])), | |
| 1143 | 1143 | }, |
| 1144 | 1144 | }, |
| 1145 | 1145 | .sub_assign_expr => .{ |
| 1146 | 1146 | .sub_assign_expr = .{ |
| 1147 | 1147 | .op_tok = node_tok, |
| 1148 | 1148 | .qt = @bitCast(node_data[0]), |
| 1149 | .lhs = @enumFromInt(node_data[1]), | |
| 1150 | .rhs = @enumFromInt(node_data[2]), | |
| 1149 | .lhs = @fromBackingInt(@intCast(node_data[1])), | |
| 1150 | .rhs = @fromBackingInt(@intCast(node_data[2])), | |
| 1151 | 1151 | }, |
| 1152 | 1152 | }, |
| 1153 | 1153 | .shl_assign_expr => .{ |
| 1154 | 1154 | .shl_assign_expr = .{ |
| 1155 | 1155 | .op_tok = node_tok, |
| 1156 | 1156 | .qt = @bitCast(node_data[0]), |
| 1157 | .lhs = @enumFromInt(node_data[1]), | |
| 1158 | .rhs = @enumFromInt(node_data[2]), | |
| 1157 | .lhs = @fromBackingInt(@intCast(node_data[1])), | |
| 1158 | .rhs = @fromBackingInt(@intCast(node_data[2])), | |
| 1159 | 1159 | }, |
| 1160 | 1160 | }, |
| 1161 | 1161 | .shr_assign_expr => .{ |
| 1162 | 1162 | .shr_assign_expr = .{ |
| 1163 | 1163 | .op_tok = node_tok, |
| 1164 | 1164 | .qt = @bitCast(node_data[0]), |
| 1165 | .lhs = @enumFromInt(node_data[1]), | |
| 1166 | .rhs = @enumFromInt(node_data[2]), | |
| 1165 | .lhs = @fromBackingInt(@intCast(node_data[1])), | |
| 1166 | .rhs = @fromBackingInt(@intCast(node_data[2])), | |
| 1167 | 1167 | }, |
| 1168 | 1168 | }, |
| 1169 | 1169 | .bit_and_assign_expr => .{ |
| 1170 | 1170 | .bit_and_assign_expr = .{ |
| 1171 | 1171 | .op_tok = node_tok, |
| 1172 | 1172 | .qt = @bitCast(node_data[0]), |
| 1173 | .lhs = @enumFromInt(node_data[1]), | |
| 1174 | .rhs = @enumFromInt(node_data[2]), | |
| 1173 | .lhs = @fromBackingInt(@intCast(node_data[1])), | |
| 1174 | .rhs = @fromBackingInt(@intCast(node_data[2])), | |
| 1175 | 1175 | }, |
| 1176 | 1176 | }, |
| 1177 | 1177 | .bit_xor_assign_expr => .{ |
| 1178 | 1178 | .bit_xor_assign_expr = .{ |
| 1179 | 1179 | .op_tok = node_tok, |
| 1180 | 1180 | .qt = @bitCast(node_data[0]), |
| 1181 | .lhs = @enumFromInt(node_data[1]), | |
| 1182 | .rhs = @enumFromInt(node_data[2]), | |
| 1181 | .lhs = @fromBackingInt(@intCast(node_data[1])), | |
| 1182 | .rhs = @fromBackingInt(@intCast(node_data[2])), | |
| 1183 | 1183 | }, |
| 1184 | 1184 | }, |
| 1185 | 1185 | .bit_or_assign_expr => .{ |
| 1186 | 1186 | .bit_or_assign_expr = .{ |
| 1187 | 1187 | .op_tok = node_tok, |
| 1188 | 1188 | .qt = @bitCast(node_data[0]), |
| 1189 | .lhs = @enumFromInt(node_data[1]), | |
| 1190 | .rhs = @enumFromInt(node_data[2]), | |
| 1189 | .lhs = @fromBackingInt(@intCast(node_data[1])), | |
| 1190 | .rhs = @fromBackingInt(@intCast(node_data[2])), | |
| 1191 | 1191 | }, |
| 1192 | 1192 | }, |
| 1193 | 1193 | .compound_assign_dummy_expr => .{ |
| 1194 | 1194 | .compound_assign_dummy_expr = .{ |
| 1195 | 1195 | .op_tok = node_tok, |
| 1196 | 1196 | .qt = @bitCast(node_data[0]), |
| 1197 | .operand = @enumFromInt(node_data[1]), | |
| 1197 | .operand = @fromBackingInt(@intCast(node_data[1])), | |
| 1198 | 1198 | }, |
| 1199 | 1199 | }, |
| 1200 | 1200 | .comma_expr => .{ |
| 1201 | 1201 | .comma_expr = .{ |
| 1202 | 1202 | .op_tok = node_tok, |
| 1203 | 1203 | .qt = @bitCast(node_data[0]), |
| 1204 | .lhs = @enumFromInt(node_data[1]), | |
| 1205 | .rhs = @enumFromInt(node_data[2]), | |
| 1204 | .lhs = @fromBackingInt(@intCast(node_data[1])), | |
| 1205 | .rhs = @fromBackingInt(@intCast(node_data[2])), | |
| 1206 | 1206 | }, |
| 1207 | 1207 | }, |
| 1208 | 1208 | .bool_or_expr => .{ |
| 1209 | 1209 | .bool_or_expr = .{ |
| 1210 | 1210 | .op_tok = node_tok, |
| 1211 | 1211 | .qt = @bitCast(node_data[0]), |
| 1212 | .lhs = @enumFromInt(node_data[1]), | |
| 1213 | .rhs = @enumFromInt(node_data[2]), | |
| 1212 | .lhs = @fromBackingInt(@intCast(node_data[1])), | |
| 1213 | .rhs = @fromBackingInt(@intCast(node_data[2])), | |
| 1214 | 1214 | }, |
| 1215 | 1215 | }, |
| 1216 | 1216 | .bool_and_expr => .{ |
| 1217 | 1217 | .bool_and_expr = .{ |
| 1218 | 1218 | .op_tok = node_tok, |
| 1219 | 1219 | .qt = @bitCast(node_data[0]), |
| 1220 | .lhs = @enumFromInt(node_data[1]), | |
| 1221 | .rhs = @enumFromInt(node_data[2]), | |
| 1220 | .lhs = @fromBackingInt(@intCast(node_data[1])), | |
| 1221 | .rhs = @fromBackingInt(@intCast(node_data[2])), | |
| 1222 | 1222 | }, |
| 1223 | 1223 | }, |
| 1224 | 1224 | .bit_or_expr => .{ |
| 1225 | 1225 | .bit_or_expr = .{ |
| 1226 | 1226 | .op_tok = node_tok, |
| 1227 | 1227 | .qt = @bitCast(node_data[0]), |
| 1228 | .lhs = @enumFromInt(node_data[1]), | |
| 1229 | .rhs = @enumFromInt(node_data[2]), | |
| 1228 | .lhs = @fromBackingInt(@intCast(node_data[1])), | |
| 1229 | .rhs = @fromBackingInt(@intCast(node_data[2])), | |
| 1230 | 1230 | }, |
| 1231 | 1231 | }, |
| 1232 | 1232 | .bit_xor_expr => .{ |
| 1233 | 1233 | .bit_xor_expr = .{ |
| 1234 | 1234 | .op_tok = node_tok, |
| 1235 | 1235 | .qt = @bitCast(node_data[0]), |
| 1236 | .lhs = @enumFromInt(node_data[1]), | |
| 1237 | .rhs = @enumFromInt(node_data[2]), | |
| 1236 | .lhs = @fromBackingInt(@intCast(node_data[1])), | |
| 1237 | .rhs = @fromBackingInt(@intCast(node_data[2])), | |
| 1238 | 1238 | }, |
| 1239 | 1239 | }, |
| 1240 | 1240 | .bit_and_expr => .{ |
| 1241 | 1241 | .bit_and_expr = .{ |
| 1242 | 1242 | .op_tok = node_tok, |
| 1243 | 1243 | .qt = @bitCast(node_data[0]), |
| 1244 | .lhs = @enumFromInt(node_data[1]), | |
| 1245 | .rhs = @enumFromInt(node_data[2]), | |
| 1244 | .lhs = @fromBackingInt(@intCast(node_data[1])), | |
| 1245 | .rhs = @fromBackingInt(@intCast(node_data[2])), | |
| 1246 | 1246 | }, |
| 1247 | 1247 | }, |
| 1248 | 1248 | .equal_expr => .{ |
| 1249 | 1249 | .equal_expr = .{ |
| 1250 | 1250 | .op_tok = node_tok, |
| 1251 | 1251 | .qt = @bitCast(node_data[0]), |
| 1252 | .lhs = @enumFromInt(node_data[1]), | |
| 1253 | .rhs = @enumFromInt(node_data[2]), | |
| 1252 | .lhs = @fromBackingInt(@intCast(node_data[1])), | |
| 1253 | .rhs = @fromBackingInt(@intCast(node_data[2])), | |
| 1254 | 1254 | }, |
| 1255 | 1255 | }, |
| 1256 | 1256 | .not_equal_expr => .{ |
| 1257 | 1257 | .not_equal_expr = .{ |
| 1258 | 1258 | .op_tok = node_tok, |
| 1259 | 1259 | .qt = @bitCast(node_data[0]), |
| 1260 | .lhs = @enumFromInt(node_data[1]), | |
| 1261 | .rhs = @enumFromInt(node_data[2]), | |
| 1260 | .lhs = @fromBackingInt(@intCast(node_data[1])), | |
| 1261 | .rhs = @fromBackingInt(@intCast(node_data[2])), | |
| 1262 | 1262 | }, |
| 1263 | 1263 | }, |
| 1264 | 1264 | .less_than_expr => .{ |
| 1265 | 1265 | .less_than_expr = .{ |
| 1266 | 1266 | .op_tok = node_tok, |
| 1267 | 1267 | .qt = @bitCast(node_data[0]), |
| 1268 | .lhs = @enumFromInt(node_data[1]), | |
| 1269 | .rhs = @enumFromInt(node_data[2]), | |
| 1268 | .lhs = @fromBackingInt(@intCast(node_data[1])), | |
| 1269 | .rhs = @fromBackingInt(@intCast(node_data[2])), | |
| 1270 | 1270 | }, |
| 1271 | 1271 | }, |
| 1272 | 1272 | .less_than_equal_expr => .{ |
| 1273 | 1273 | .less_than_equal_expr = .{ |
| 1274 | 1274 | .op_tok = node_tok, |
| 1275 | 1275 | .qt = @bitCast(node_data[0]), |
| 1276 | .lhs = @enumFromInt(node_data[1]), | |
| 1277 | .rhs = @enumFromInt(node_data[2]), | |
| 1276 | .lhs = @fromBackingInt(@intCast(node_data[1])), | |
| 1277 | .rhs = @fromBackingInt(@intCast(node_data[2])), | |
| 1278 | 1278 | }, |
| 1279 | 1279 | }, |
| 1280 | 1280 | .greater_than_expr => .{ |
| 1281 | 1281 | .greater_than_expr = .{ |
| 1282 | 1282 | .op_tok = node_tok, |
| 1283 | 1283 | .qt = @bitCast(node_data[0]), |
| 1284 | .lhs = @enumFromInt(node_data[1]), | |
| 1285 | .rhs = @enumFromInt(node_data[2]), | |
| 1284 | .lhs = @fromBackingInt(@intCast(node_data[1])), | |
| 1285 | .rhs = @fromBackingInt(@intCast(node_data[2])), | |
| 1286 | 1286 | }, |
| 1287 | 1287 | }, |
| 1288 | 1288 | .greater_than_equal_expr => .{ |
| 1289 | 1289 | .greater_than_equal_expr = .{ |
| 1290 | 1290 | .op_tok = node_tok, |
| 1291 | 1291 | .qt = @bitCast(node_data[0]), |
| 1292 | .lhs = @enumFromInt(node_data[1]), | |
| 1293 | .rhs = @enumFromInt(node_data[2]), | |
| 1292 | .lhs = @fromBackingInt(@intCast(node_data[1])), | |
| 1293 | .rhs = @fromBackingInt(@intCast(node_data[2])), | |
| 1294 | 1294 | }, |
| 1295 | 1295 | }, |
| 1296 | 1296 | .shl_expr => .{ |
| 1297 | 1297 | .shl_expr = .{ |
| 1298 | 1298 | .op_tok = node_tok, |
| 1299 | 1299 | .qt = @bitCast(node_data[0]), |
| 1300 | .lhs = @enumFromInt(node_data[1]), | |
| 1301 | .rhs = @enumFromInt(node_data[2]), | |
| 1300 | .lhs = @fromBackingInt(@intCast(node_data[1])), | |
| 1301 | .rhs = @fromBackingInt(@intCast(node_data[2])), | |
| 1302 | 1302 | }, |
| 1303 | 1303 | }, |
| 1304 | 1304 | .shr_expr => .{ |
| 1305 | 1305 | .shr_expr = .{ |
| 1306 | 1306 | .op_tok = node_tok, |
| 1307 | 1307 | .qt = @bitCast(node_data[0]), |
| 1308 | .lhs = @enumFromInt(node_data[1]), | |
| 1309 | .rhs = @enumFromInt(node_data[2]), | |
| 1308 | .lhs = @fromBackingInt(@intCast(node_data[1])), | |
| 1309 | .rhs = @fromBackingInt(@intCast(node_data[2])), | |
| 1310 | 1310 | }, |
| 1311 | 1311 | }, |
| 1312 | 1312 | .add_expr => .{ |
| 1313 | 1313 | .add_expr = .{ |
| 1314 | 1314 | .op_tok = node_tok, |
| 1315 | 1315 | .qt = @bitCast(node_data[0]), |
| 1316 | .lhs = @enumFromInt(node_data[1]), | |
| 1317 | .rhs = @enumFromInt(node_data[2]), | |
| 1316 | .lhs = @fromBackingInt(@intCast(node_data[1])), | |
| 1317 | .rhs = @fromBackingInt(@intCast(node_data[2])), | |
| 1318 | 1318 | }, |
| 1319 | 1319 | }, |
| 1320 | 1320 | .sub_expr => .{ |
| 1321 | 1321 | .sub_expr = .{ |
| 1322 | 1322 | .op_tok = node_tok, |
| 1323 | 1323 | .qt = @bitCast(node_data[0]), |
| 1324 | .lhs = @enumFromInt(node_data[1]), | |
| 1325 | .rhs = @enumFromInt(node_data[2]), | |
| 1324 | .lhs = @fromBackingInt(@intCast(node_data[1])), | |
| 1325 | .rhs = @fromBackingInt(@intCast(node_data[2])), | |
| 1326 | 1326 | }, |
| 1327 | 1327 | }, |
| 1328 | 1328 | .mul_expr => .{ |
| 1329 | 1329 | .mul_expr = .{ |
| 1330 | 1330 | .op_tok = node_tok, |
| 1331 | 1331 | .qt = @bitCast(node_data[0]), |
| 1332 | .lhs = @enumFromInt(node_data[1]), | |
| 1333 | .rhs = @enumFromInt(node_data[2]), | |
| 1332 | .lhs = @fromBackingInt(@intCast(node_data[1])), | |
| 1333 | .rhs = @fromBackingInt(@intCast(node_data[2])), | |
| 1334 | 1334 | }, |
| 1335 | 1335 | }, |
| 1336 | 1336 | .div_expr => .{ |
| 1337 | 1337 | .div_expr = .{ |
| 1338 | 1338 | .op_tok = node_tok, |
| 1339 | 1339 | .qt = @bitCast(node_data[0]), |
| 1340 | .lhs = @enumFromInt(node_data[1]), | |
| 1341 | .rhs = @enumFromInt(node_data[2]), | |
| 1340 | .lhs = @fromBackingInt(@intCast(node_data[1])), | |
| 1341 | .rhs = @fromBackingInt(@intCast(node_data[2])), | |
| 1342 | 1342 | }, |
| 1343 | 1343 | }, |
| 1344 | 1344 | .mod_expr => .{ |
| 1345 | 1345 | .mod_expr = .{ |
| 1346 | 1346 | .op_tok = node_tok, |
| 1347 | 1347 | .qt = @bitCast(node_data[0]), |
| 1348 | .lhs = @enumFromInt(node_data[1]), | |
| 1349 | .rhs = @enumFromInt(node_data[2]), | |
| 1348 | .lhs = @fromBackingInt(@intCast(node_data[1])), | |
| 1349 | .rhs = @fromBackingInt(@intCast(node_data[2])), | |
| 1350 | 1350 | }, |
| 1351 | 1351 | }, |
| 1352 | 1352 | .explicit_cast => .{ |
| 1353 | 1353 | .cast = .{ |
| 1354 | 1354 | .l_paren = node_tok, |
| 1355 | 1355 | .qt = @bitCast(node_data[0]), |
| 1356 | .kind = @enumFromInt(node_data[1]), | |
| 1357 | .operand = @enumFromInt(node_data[2]), | |
| 1356 | .kind = @fromBackingInt(@intCast(node_data[1])), | |
| 1357 | .operand = @fromBackingInt(@intCast(node_data[2])), | |
| 1358 | 1358 | .implicit = false, |
| 1359 | 1359 | }, |
| 1360 | 1360 | }, |
| ... | ... | @@ -1362,8 +1362,8 @@ pub const Node = union(enum) { |
| 1362 | 1362 | .cast = .{ |
| 1363 | 1363 | .l_paren = node_tok, |
| 1364 | 1364 | .qt = @bitCast(node_data[0]), |
| 1365 | .kind = @enumFromInt(node_data[1]), | |
| 1366 | .operand = @enumFromInt(node_data[2]), | |
| 1365 | .kind = @fromBackingInt(@intCast(node_data[1])), | |
| 1366 | .operand = @fromBackingInt(@intCast(node_data[2])), | |
| 1367 | 1367 | .implicit = true, |
| 1368 | 1368 | }, |
| 1369 | 1369 | }, |
| ... | ... | @@ -1371,105 +1371,105 @@ pub const Node = union(enum) { |
| 1371 | 1371 | .addr_of_expr = .{ |
| 1372 | 1372 | .op_tok = node_tok, |
| 1373 | 1373 | .qt = @bitCast(node_data[0]), |
| 1374 | .operand = @enumFromInt(node_data[1]), | |
| 1374 | .operand = @fromBackingInt(@intCast(node_data[1])), | |
| 1375 | 1375 | }, |
| 1376 | 1376 | }, |
| 1377 | 1377 | .deref_expr => .{ |
| 1378 | 1378 | .deref_expr = .{ |
| 1379 | 1379 | .op_tok = node_tok, |
| 1380 | 1380 | .qt = @bitCast(node_data[0]), |
| 1381 | .operand = @enumFromInt(node_data[1]), | |
| 1381 | .operand = @fromBackingInt(@intCast(node_data[1])), | |
| 1382 | 1382 | }, |
| 1383 | 1383 | }, |
| 1384 | 1384 | .plus_expr => .{ |
| 1385 | 1385 | .plus_expr = .{ |
| 1386 | 1386 | .op_tok = node_tok, |
| 1387 | 1387 | .qt = @bitCast(node_data[0]), |
| 1388 | .operand = @enumFromInt(node_data[1]), | |
| 1388 | .operand = @fromBackingInt(@intCast(node_data[1])), | |
| 1389 | 1389 | }, |
| 1390 | 1390 | }, |
| 1391 | 1391 | .negate_expr => .{ |
| 1392 | 1392 | .negate_expr = .{ |
| 1393 | 1393 | .op_tok = node_tok, |
| 1394 | 1394 | .qt = @bitCast(node_data[0]), |
| 1395 | .operand = @enumFromInt(node_data[1]), | |
| 1395 | .operand = @fromBackingInt(@intCast(node_data[1])), | |
| 1396 | 1396 | }, |
| 1397 | 1397 | }, |
| 1398 | 1398 | .bit_not_expr => .{ |
| 1399 | 1399 | .bit_not_expr = .{ |
| 1400 | 1400 | .op_tok = node_tok, |
| 1401 | 1401 | .qt = @bitCast(node_data[0]), |
| 1402 | .operand = @enumFromInt(node_data[1]), | |
| 1402 | .operand = @fromBackingInt(@intCast(node_data[1])), | |
| 1403 | 1403 | }, |
| 1404 | 1404 | }, |
| 1405 | 1405 | .bool_not_expr => .{ |
| 1406 | 1406 | .bool_not_expr = .{ |
| 1407 | 1407 | .op_tok = node_tok, |
| 1408 | 1408 | .qt = @bitCast(node_data[0]), |
| 1409 | .operand = @enumFromInt(node_data[1]), | |
| 1409 | .operand = @fromBackingInt(@intCast(node_data[1])), | |
| 1410 | 1410 | }, |
| 1411 | 1411 | }, |
| 1412 | 1412 | .pre_inc_expr => .{ |
| 1413 | 1413 | .pre_inc_expr = .{ |
| 1414 | 1414 | .op_tok = node_tok, |
| 1415 | 1415 | .qt = @bitCast(node_data[0]), |
| 1416 | .operand = @enumFromInt(node_data[1]), | |
| 1416 | .operand = @fromBackingInt(@intCast(node_data[1])), | |
| 1417 | 1417 | }, |
| 1418 | 1418 | }, |
| 1419 | 1419 | .pre_dec_expr => .{ |
| 1420 | 1420 | .pre_dec_expr = .{ |
| 1421 | 1421 | .op_tok = node_tok, |
| 1422 | 1422 | .qt = @bitCast(node_data[0]), |
| 1423 | .operand = @enumFromInt(node_data[1]), | |
| 1423 | .operand = @fromBackingInt(@intCast(node_data[1])), | |
| 1424 | 1424 | }, |
| 1425 | 1425 | }, |
| 1426 | 1426 | .imag_expr => .{ |
| 1427 | 1427 | .imag_expr = .{ |
| 1428 | 1428 | .op_tok = node_tok, |
| 1429 | 1429 | .qt = @bitCast(node_data[0]), |
| 1430 | .operand = @enumFromInt(node_data[1]), | |
| 1430 | .operand = @fromBackingInt(@intCast(node_data[1])), | |
| 1431 | 1431 | }, |
| 1432 | 1432 | }, |
| 1433 | 1433 | .real_expr => .{ |
| 1434 | 1434 | .real_expr = .{ |
| 1435 | 1435 | .op_tok = node_tok, |
| 1436 | 1436 | .qt = @bitCast(node_data[0]), |
| 1437 | .operand = @enumFromInt(node_data[1]), | |
| 1437 | .operand = @fromBackingInt(@intCast(node_data[1])), | |
| 1438 | 1438 | }, |
| 1439 | 1439 | }, |
| 1440 | 1440 | .post_inc_expr => .{ |
| 1441 | 1441 | .post_inc_expr = .{ |
| 1442 | 1442 | .op_tok = node_tok, |
| 1443 | 1443 | .qt = @bitCast(node_data[0]), |
| 1444 | .operand = @enumFromInt(node_data[1]), | |
| 1444 | .operand = @fromBackingInt(@intCast(node_data[1])), | |
| 1445 | 1445 | }, |
| 1446 | 1446 | }, |
| 1447 | 1447 | .post_dec_expr => .{ |
| 1448 | 1448 | .post_dec_expr = .{ |
| 1449 | 1449 | .op_tok = node_tok, |
| 1450 | 1450 | .qt = @bitCast(node_data[0]), |
| 1451 | .operand = @enumFromInt(node_data[1]), | |
| 1451 | .operand = @fromBackingInt(@intCast(node_data[1])), | |
| 1452 | 1452 | }, |
| 1453 | 1453 | }, |
| 1454 | 1454 | .paren_expr => .{ |
| 1455 | 1455 | .paren_expr = .{ |
| 1456 | 1456 | .op_tok = node_tok, |
| 1457 | 1457 | .qt = @bitCast(node_data[0]), |
| 1458 | .operand = @enumFromInt(node_data[1]), | |
| 1458 | .operand = @fromBackingInt(@intCast(node_data[1])), | |
| 1459 | 1459 | }, |
| 1460 | 1460 | }, |
| 1461 | 1461 | .stmt_expr => .{ |
| 1462 | 1462 | .stmt_expr = .{ |
| 1463 | 1463 | .op_tok = node_tok, |
| 1464 | 1464 | .qt = @bitCast(node_data[0]), |
| 1465 | .operand = @enumFromInt(node_data[1]), | |
| 1465 | .operand = @fromBackingInt(@intCast(node_data[1])), | |
| 1466 | 1466 | }, |
| 1467 | 1467 | }, |
| 1468 | 1468 | .cond_dummy_expr => .{ |
| 1469 | 1469 | .cond_dummy_expr = .{ |
| 1470 | 1470 | .op_tok = node_tok, |
| 1471 | 1471 | .qt = @bitCast(node_data[0]), |
| 1472 | .operand = @enumFromInt(node_data[1]), | |
| 1472 | .operand = @fromBackingInt(@intCast(node_data[1])), | |
| 1473 | 1473 | }, |
| 1474 | 1474 | }, |
| 1475 | 1475 | .addr_of_label => .{ |
| ... | ... | @@ -1482,15 +1482,15 @@ pub const Node = union(enum) { |
| 1482 | 1482 | .array_access_expr = .{ |
| 1483 | 1483 | .l_bracket_tok = node_tok, |
| 1484 | 1484 | .qt = @bitCast(node_data[0]), |
| 1485 | .base = @enumFromInt(node_data[1]), | |
| 1486 | .index = @enumFromInt(node_data[2]), | |
| 1485 | .base = @fromBackingInt(@intCast(node_data[1])), | |
| 1486 | .index = @fromBackingInt(@intCast(node_data[2])), | |
| 1487 | 1487 | }, |
| 1488 | 1488 | }, |
| 1489 | 1489 | .call_expr => .{ |
| 1490 | 1490 | .call_expr = .{ |
| 1491 | 1491 | .l_paren_tok = node_tok, |
| 1492 | 1492 | .qt = @bitCast(node_data[0]), |
| 1493 | .callee = @enumFromInt(tree.extra.items[node_data[1]]), | |
| 1493 | .callee = @fromBackingInt(@intCast(tree.extra.items[node_data[1]])), | |
| 1494 | 1494 | .args = @ptrCast(tree.extra.items[node_data[1] + 1 ..][0 .. node_data[2] - 1]), |
| 1495 | 1495 | }, |
| 1496 | 1496 | }, |
| ... | ... | @@ -1498,7 +1498,7 @@ pub const Node = union(enum) { |
| 1498 | 1498 | .call_expr = .{ |
| 1499 | 1499 | .l_paren_tok = node_tok, |
| 1500 | 1500 | .qt = @bitCast(node_data[0]), |
| 1501 | .callee = @enumFromInt(node_data[1]), | |
| 1501 | .callee = @fromBackingInt(@intCast(node_data[1])), | |
| 1502 | 1502 | .args = unPackElems(node_data[2..]), |
| 1503 | 1503 | }, |
| 1504 | 1504 | }, |
| ... | ... | @@ -1520,7 +1520,7 @@ pub const Node = union(enum) { |
| 1520 | 1520 | .member_access_expr = .{ |
| 1521 | 1521 | .access_tok = node_tok, |
| 1522 | 1522 | .qt = @bitCast(node_data[0]), |
| 1523 | .base = @enumFromInt(node_data[1]), | |
| 1523 | .base = @fromBackingInt(@intCast(node_data[1])), | |
| 1524 | 1524 | .member_index = node_data[2], |
| 1525 | 1525 | }, |
| 1526 | 1526 | }, |
| ... | ... | @@ -1528,7 +1528,7 @@ pub const Node = union(enum) { |
| 1528 | 1528 | .member_access_ptr_expr = .{ |
| 1529 | 1529 | .access_tok = node_tok, |
| 1530 | 1530 | .qt = @bitCast(node_data[0]), |
| 1531 | .base = @enumFromInt(node_data[1]), | |
| 1531 | .base = @fromBackingInt(@intCast(node_data[1])), | |
| 1532 | 1532 | .member_index = node_data[2], |
| 1533 | 1533 | }, |
| 1534 | 1534 | }, |
| ... | ... | @@ -1536,14 +1536,14 @@ pub const Node = union(enum) { |
| 1536 | 1536 | .decl_ref_expr = .{ |
| 1537 | 1537 | .name_tok = node_tok, |
| 1538 | 1538 | .qt = @bitCast(node_data[0]), |
| 1539 | .decl = @enumFromInt(node_data[1]), | |
| 1539 | .decl = @fromBackingInt(@intCast(node_data[1])), | |
| 1540 | 1540 | }, |
| 1541 | 1541 | }, |
| 1542 | 1542 | .enumeration_ref => .{ |
| 1543 | 1543 | .enumeration_ref = .{ |
| 1544 | 1544 | .name_tok = node_tok, |
| 1545 | 1545 | .qt = @bitCast(node_data[0]), |
| 1546 | .decl = @enumFromInt(node_data[1]), | |
| 1546 | .decl = @fromBackingInt(@intCast(node_data[1])), | |
| 1547 | 1547 | }, |
| 1548 | 1548 | }, |
| 1549 | 1549 | .builtin_ref => .{ |
| ... | ... | @@ -1574,7 +1574,7 @@ pub const Node = union(enum) { |
| 1574 | 1574 | .char_literal = .{ |
| 1575 | 1575 | .literal_tok = node_tok, |
| 1576 | 1576 | .qt = @bitCast(node_data[0]), |
| 1577 | .kind = @enumFromInt(node_data[1]), | |
| 1577 | .kind = @fromBackingInt(@intCast(node_data[1])), | |
| 1578 | 1578 | }, |
| 1579 | 1579 | }, |
| 1580 | 1580 | .float_literal => .{ |
| ... | ... | @@ -1587,14 +1587,14 @@ pub const Node = union(enum) { |
| 1587 | 1587 | .string_literal_expr = .{ |
| 1588 | 1588 | .literal_tok = node_tok, |
| 1589 | 1589 | .qt = @bitCast(node_data[0]), |
| 1590 | .kind = @enumFromInt(node_data[1]), | |
| 1590 | .kind = @fromBackingInt(@intCast(node_data[1])), | |
| 1591 | 1591 | }, |
| 1592 | 1592 | }, |
| 1593 | 1593 | .imaginary_literal => .{ |
| 1594 | 1594 | .imaginary_literal = .{ |
| 1595 | 1595 | .op_tok = node_tok, |
| 1596 | 1596 | .qt = @bitCast(node_data[0]), |
| 1597 | .operand = @enumFromInt(node_data[1]), | |
| 1597 | .operand = @fromBackingInt(@intCast(node_data[1])), | |
| 1598 | 1598 | }, |
| 1599 | 1599 | }, |
| 1600 | 1600 | .sizeof_expr => .{ |
| ... | ... | @@ -1618,8 +1618,8 @@ pub const Node = union(enum) { |
| 1618 | 1618 | .generic_expr = .{ |
| 1619 | 1619 | .generic_tok = node_tok, |
| 1620 | 1620 | .qt = @bitCast(node_data[0]), |
| 1621 | .controlling = @enumFromInt(node_data[1]), | |
| 1622 | .chosen = @enumFromInt(node_data[2]), | |
| 1621 | .controlling = @fromBackingInt(@intCast(node_data[1])), | |
| 1622 | .chosen = @fromBackingInt(@intCast(node_data[2])), | |
| 1623 | 1623 | .rest = &.{}, |
| 1624 | 1624 | }, |
| 1625 | 1625 | }, |
| ... | ... | @@ -1627,8 +1627,8 @@ pub const Node = union(enum) { |
| 1627 | 1627 | .generic_expr = .{ |
| 1628 | 1628 | .generic_tok = node_tok, |
| 1629 | 1629 | .qt = @bitCast(node_data[0]), |
| 1630 | .controlling = @enumFromInt(tree.extra.items[node_data[1]]), | |
| 1631 | .chosen = @enumFromInt(tree.extra.items[node_data[1] + 1]), | |
| 1630 | .controlling = @fromBackingInt(@intCast(tree.extra.items[node_data[1]])), | |
| 1631 | .chosen = @fromBackingInt(@intCast(tree.extra.items[node_data[1] + 1])), | |
| 1632 | 1632 | .rest = @ptrCast(tree.extra.items[node_data[1] + 2 ..][0 .. node_data[2] - 2]), |
| 1633 | 1633 | }, |
| 1634 | 1634 | }, |
| ... | ... | @@ -1636,40 +1636,40 @@ pub const Node = union(enum) { |
| 1636 | 1636 | .generic_association_expr = .{ |
| 1637 | 1637 | .colon_tok = node_tok, |
| 1638 | 1638 | .association_qt = @bitCast(node_data[0]), |
| 1639 | .expr = @enumFromInt(node_data[1]), | |
| 1639 | .expr = @fromBackingInt(@intCast(node_data[1])), | |
| 1640 | 1640 | }, |
| 1641 | 1641 | }, |
| 1642 | 1642 | .generic_default_expr => .{ |
| 1643 | 1643 | .generic_default_expr = .{ |
| 1644 | 1644 | .default_tok = node_tok, |
| 1645 | .expr = @enumFromInt(node_data[0]), | |
| 1645 | .expr = @fromBackingInt(@intCast(node_data[0])), | |
| 1646 | 1646 | }, |
| 1647 | 1647 | }, |
| 1648 | 1648 | .binary_cond_expr => .{ |
| 1649 | 1649 | .binary_cond_expr = .{ |
| 1650 | 1650 | .cond_tok = node_tok, |
| 1651 | 1651 | .qt = @bitCast(node_data[0]), |
| 1652 | .cond = @enumFromInt(node_data[1]), | |
| 1653 | .then_expr = @enumFromInt(tree.extra.items[node_data[2]]), | |
| 1654 | .else_expr = @enumFromInt(tree.extra.items[node_data[2] + 1]), | |
| 1652 | .cond = @fromBackingInt(@intCast(node_data[1])), | |
| 1653 | .then_expr = @fromBackingInt(@intCast(tree.extra.items[node_data[2]])), | |
| 1654 | .else_expr = @fromBackingInt(@intCast(tree.extra.items[node_data[2] + 1])), | |
| 1655 | 1655 | }, |
| 1656 | 1656 | }, |
| 1657 | 1657 | .cond_expr => .{ |
| 1658 | 1658 | .cond_expr = .{ |
| 1659 | 1659 | .cond_tok = node_tok, |
| 1660 | 1660 | .qt = @bitCast(node_data[0]), |
| 1661 | .cond = @enumFromInt(node_data[1]), | |
| 1662 | .then_expr = @enumFromInt(tree.extra.items[node_data[2]]), | |
| 1663 | .else_expr = @enumFromInt(tree.extra.items[node_data[2] + 1]), | |
| 1661 | .cond = @fromBackingInt(@intCast(node_data[1])), | |
| 1662 | .then_expr = @fromBackingInt(@intCast(tree.extra.items[node_data[2]])), | |
| 1663 | .else_expr = @fromBackingInt(@intCast(tree.extra.items[node_data[2] + 1])), | |
| 1664 | 1664 | }, |
| 1665 | 1665 | }, |
| 1666 | 1666 | .builtin_choose_expr => .{ |
| 1667 | 1667 | .builtin_choose_expr = .{ |
| 1668 | 1668 | .cond_tok = node_tok, |
| 1669 | 1669 | .qt = @bitCast(node_data[0]), |
| 1670 | .cond = @enumFromInt(node_data[1]), | |
| 1671 | .then_expr = @enumFromInt(tree.extra.items[node_data[2]]), | |
| 1672 | .else_expr = @enumFromInt(tree.extra.items[node_data[2] + 1]), | |
| 1670 | .cond = @fromBackingInt(@intCast(node_data[1])), | |
| 1671 | .then_expr = @fromBackingInt(@intCast(tree.extra.items[node_data[2]])), | |
| 1672 | .else_expr = @fromBackingInt(@intCast(tree.extra.items[node_data[2] + 1])), | |
| 1673 | 1673 | }, |
| 1674 | 1674 | }, |
| 1675 | 1675 | .builtin_types_compatible_p => .{ |
| ... | ... | @@ -1683,15 +1683,15 @@ pub const Node = union(enum) { |
| 1683 | 1683 | .builtin_convertvector = .{ |
| 1684 | 1684 | .builtin_tok = node_tok, |
| 1685 | 1685 | .dest_qt = @bitCast(node_data[0]), |
| 1686 | .operand = @enumFromInt(node_data[1]), | |
| 1686 | .operand = @fromBackingInt(@intCast(node_data[1])), | |
| 1687 | 1687 | }, |
| 1688 | 1688 | }, |
| 1689 | 1689 | .builtin_shufflevector => .{ |
| 1690 | 1690 | .builtin_shufflevector = .{ |
| 1691 | 1691 | .builtin_tok = node_tok, |
| 1692 | 1692 | .qt = @bitCast(node_data[0]), |
| 1693 | .lhs = @enumFromInt(tree.extra.items[node_data[1]]), | |
| 1694 | .rhs = @enumFromInt(tree.extra.items[node_data[1] + 1]), | |
| 1693 | .lhs = @fromBackingInt(@intCast(tree.extra.items[node_data[1]])), | |
| 1694 | .rhs = @fromBackingInt(@intCast(tree.extra.items[node_data[1] + 1])), | |
| 1695 | 1695 | .indexes = @ptrCast(tree.extra.items[node_data[1] + 2 ..][0..node_data[2]]), |
| 1696 | 1696 | }, |
| 1697 | 1697 | }, |
| ... | ... | @@ -1767,7 +1767,7 @@ pub const Node = union(enum) { |
| 1767 | 1767 | else |
| 1768 | 1768 | .auto, |
| 1769 | 1769 | .thread_local = attr.thread_local, |
| 1770 | .initializer = @enumFromInt(node_data[2]), | |
| 1770 | .initializer = @fromBackingInt(@intCast(node_data[2])), | |
| 1771 | 1771 | }, |
| 1772 | 1772 | }; |
| 1773 | 1773 | }, |
| ... | ... | @@ -1775,7 +1775,7 @@ pub const Node = union(enum) { |
| 1775 | 1775 | } |
| 1776 | 1776 | |
| 1777 | 1777 | pub fn tok(index: Index, tree: *const Tree) TokenIndex { |
| 1778 | return tree.nodes.items(.tok)[@intFromEnum(index)]; | |
| 1778 | return tree.nodes.items(.tok)[@backingInt(index)]; | |
| 1779 | 1779 | } |
| 1780 | 1780 | |
| 1781 | 1781 | pub fn loc(index: Index, tree: *const Tree) Source.Location { |
| ... | ... | @@ -1788,7 +1788,7 @@ pub const Node = union(enum) { |
| 1788 | 1788 | } |
| 1789 | 1789 | |
| 1790 | 1790 | pub fn qtOrNull(index: Index, tree: *const Tree) ?QualType { |
| 1791 | return switch (tree.nodes.items(.tag)[@intFromEnum(index)]) { | |
| 1791 | return switch (tree.nodes.items(.tag)[@backingInt(index)]) { | |
| 1792 | 1792 | .empty_decl, |
| 1793 | 1793 | .static_assert, |
| 1794 | 1794 | .compound_stmt, |
| ... | ... | @@ -1819,7 +1819,7 @@ pub const Node = union(enum) { |
| 1819 | 1819 | .builtin_types_compatible_p => .int, |
| 1820 | 1820 | else => { |
| 1821 | 1821 | // If a node is typed the type is stored in data[0]. |
| 1822 | return @bitCast(tree.nodes.items(.data)[@intFromEnum(index)][0]); | |
| 1822 | return @bitCast(tree.nodes.items(.data)[@backingInt(index)][0]); | |
| 1823 | 1823 | }, |
| 1824 | 1824 | }; |
| 1825 | 1825 | } |
| ... | ... | @@ -1830,15 +1830,15 @@ pub const Node = union(enum) { |
| 1830 | 1830 | _, |
| 1831 | 1831 | |
| 1832 | 1832 | pub fn unpack(opt: OptIndex) ?Index { |
| 1833 | return if (opt == .null) null else @enumFromInt(@intFromEnum(opt)); | |
| 1833 | return if (opt == .null) null else @fromBackingInt(@intCast(@backingInt(opt))); | |
| 1834 | 1834 | } |
| 1835 | 1835 | |
| 1836 | 1836 | pub fn pack(index: Index) OptIndex { |
| 1837 | return @enumFromInt(@intFromEnum(index)); | |
| 1837 | return @fromBackingInt(@intCast(@backingInt(index))); | |
| 1838 | 1838 | } |
| 1839 | 1839 | |
| 1840 | 1840 | pub fn packOpt(optional: ?Index) OptIndex { |
| 1841 | return if (optional) |some| @enumFromInt(@intFromEnum(some)) else .null; | |
| 1841 | return if (optional) |some| @fromBackingInt(@intCast(@backingInt(some))) else .null; | |
| 1842 | 1842 | } |
| 1843 | 1843 | }; |
| 1844 | 1844 | |
| ... | ... | @@ -2013,7 +2013,7 @@ pub const Node = union(enum) { |
| 2013 | 2013 | pub fn addNode(tree: *Tree, node: Node) !Node.Index { |
| 2014 | 2014 | const index = try tree.nodes.addOne(tree.comp.gpa); |
| 2015 | 2015 | try tree.setNode(node, index); |
| 2016 | return @enumFromInt(index); | |
| 2016 | return @fromBackingInt(@intCast(index)); | |
| 2017 | 2017 | } |
| 2018 | 2018 | |
| 2019 | 2019 | pub fn setNode(tree: *Tree, node: Node, index: usize) !void { |
| ... | ... | @@ -2025,7 +2025,7 @@ pub fn setNode(tree: *Tree, node: Node, index: usize) !void { |
| 2025 | 2025 | }, |
| 2026 | 2026 | .static_assert => |assert| { |
| 2027 | 2027 | repr.tag = .static_assert; |
| 2028 | repr.data[0] = @intFromEnum(assert.cond); | |
| 2028 | repr.data[0] = @backingInt(assert.cond); | |
| 2029 | 2029 | repr.data[1] = packOptIndex(assert.message); |
| 2030 | 2030 | repr.tok = assert.assert_tok; |
| 2031 | 2031 | }, |
| ... | ... | @@ -2037,7 +2037,7 @@ pub fn setNode(tree: *Tree, node: Node, index: usize) !void { |
| 2037 | 2037 | .@"inline" = function.@"inline", |
| 2038 | 2038 | }); |
| 2039 | 2039 | if (function.body) |some| { |
| 2040 | repr.data[2] = @intFromEnum(some); | |
| 2040 | repr.data[2] = @backingInt(some); | |
| 2041 | 2041 | } else { |
| 2042 | 2042 | repr.data[2] = packOptIndex(function.definition); |
| 2043 | 2043 | } |
| ... | ... | @@ -2062,7 +2062,7 @@ pub fn setNode(tree: *Tree, node: Node, index: usize) !void { |
| 2062 | 2062 | .register = variable.storage_class == .register, |
| 2063 | 2063 | }); |
| 2064 | 2064 | if (variable.initializer) |some| { |
| 2065 | repr.data[2] = @intFromEnum(some); | |
| 2065 | repr.data[2] = @backingInt(some); | |
| 2066 | 2066 | } else { |
| 2067 | 2067 | repr.data[2] = packOptIndex(variable.definition); |
| 2068 | 2068 | } |
| ... | ... | @@ -2076,7 +2076,7 @@ pub fn setNode(tree: *Tree, node: Node, index: usize) !void { |
| 2076 | 2076 | }, |
| 2077 | 2077 | .global_asm => |global_asm| { |
| 2078 | 2078 | repr.tag = .global_asm; |
| 2079 | repr.data[0] = @intFromEnum(global_asm.asm_str); | |
| 2079 | repr.data[0] = @backingInt(global_asm.asm_str); | |
| 2080 | 2080 | repr.tok = global_asm.asm_tok; |
| 2081 | 2081 | }, |
| 2082 | 2082 | .struct_decl => |decl| { |
| ... | ... | @@ -2151,7 +2151,7 @@ pub fn setNode(tree: *Tree, node: Node, index: usize) !void { |
| 2151 | 2151 | .labeled_stmt => |labeled| { |
| 2152 | 2152 | repr.tag = .labeled_stmt; |
| 2153 | 2153 | repr.data[0] = @bitCast(labeled.qt); |
| 2154 | repr.data[1] = @intFromEnum(labeled.body); | |
| 2154 | repr.data[1] = @backingInt(labeled.body); | |
| 2155 | 2155 | repr.tok = labeled.label_tok; |
| 2156 | 2156 | }, |
| 2157 | 2157 | .compound_stmt => |compound| { |
| ... | ... | @@ -2167,39 +2167,39 @@ pub fn setNode(tree: *Tree, node: Node, index: usize) !void { |
| 2167 | 2167 | }, |
| 2168 | 2168 | .if_stmt => |@"if"| { |
| 2169 | 2169 | repr.tag = .if_stmt; |
| 2170 | repr.data[0] = @intFromEnum(@"if".cond); | |
| 2171 | repr.data[1] = @intFromEnum(@"if".then_body); | |
| 2170 | repr.data[0] = @backingInt(@"if".cond); | |
| 2171 | repr.data[1] = @backingInt(@"if".then_body); | |
| 2172 | 2172 | repr.data[2] = packOptIndex(@"if".else_body); |
| 2173 | 2173 | repr.tok = @"if".if_tok; |
| 2174 | 2174 | }, |
| 2175 | 2175 | .switch_stmt => |@"switch"| { |
| 2176 | 2176 | repr.tag = .switch_stmt; |
| 2177 | repr.data[0] = @intFromEnum(@"switch".cond); | |
| 2178 | repr.data[1] = @intFromEnum(@"switch".body); | |
| 2177 | repr.data[0] = @backingInt(@"switch".cond); | |
| 2178 | repr.data[1] = @backingInt(@"switch".body); | |
| 2179 | 2179 | repr.tok = @"switch".switch_tok; |
| 2180 | 2180 | }, |
| 2181 | 2181 | .case_stmt => |case| { |
| 2182 | 2182 | repr.tag = .case_stmt; |
| 2183 | repr.data[0] = @intFromEnum(case.start); | |
| 2183 | repr.data[0] = @backingInt(case.start); | |
| 2184 | 2184 | repr.data[1] = packOptIndex(case.end); |
| 2185 | 2185 | repr.data[2] = packOptIndex(case.body); |
| 2186 | 2186 | repr.tok = case.case_tok; |
| 2187 | 2187 | }, |
| 2188 | 2188 | .default_stmt => |default| { |
| 2189 | 2189 | repr.tag = .default_stmt; |
| 2190 | repr.data[0] = @intFromEnum(default.body); | |
| 2190 | repr.data[0] = @backingInt(default.body); | |
| 2191 | 2191 | repr.tok = default.default_tok; |
| 2192 | 2192 | }, |
| 2193 | 2193 | .while_stmt => |@"while"| { |
| 2194 | 2194 | repr.tag = .while_stmt; |
| 2195 | repr.data[0] = @intFromEnum(@"while".cond); | |
| 2196 | repr.data[1] = @intFromEnum(@"while".body); | |
| 2195 | repr.data[0] = @backingInt(@"while".cond); | |
| 2196 | repr.data[1] = @backingInt(@"while".body); | |
| 2197 | 2197 | repr.tok = @"while".while_tok; |
| 2198 | 2198 | }, |
| 2199 | 2199 | .do_while_stmt => |do_while| { |
| 2200 | 2200 | repr.tag = .do_while_stmt; |
| 2201 | repr.data[0] = @intFromEnum(do_while.cond); | |
| 2202 | repr.data[1] = @intFromEnum(do_while.body); | |
| 2201 | repr.data[0] = @backingInt(do_while.cond); | |
| 2202 | repr.data[1] = @backingInt(do_while.body); | |
| 2203 | 2203 | repr.tok = do_while.do_tok; |
| 2204 | 2204 | }, |
| 2205 | 2205 | .for_stmt => |@"for"| { |
| ... | ... | @@ -2223,7 +2223,7 @@ pub fn setNode(tree: *Tree, node: Node, index: usize) !void { |
| 2223 | 2223 | tree.extra.appendAssumeCapacity(packOptIndex(@"for".incr)); |
| 2224 | 2224 | }, |
| 2225 | 2225 | } |
| 2226 | repr.data[2] = @intFromEnum(@"for".body); | |
| 2226 | repr.data[2] = @backingInt(@"for".body); | |
| 2227 | 2227 | repr.tok = @"for".for_tok; |
| 2228 | 2228 | }, |
| 2229 | 2229 | .goto_stmt => |goto| { |
| ... | ... | @@ -2232,7 +2232,7 @@ pub fn setNode(tree: *Tree, node: Node, index: usize) !void { |
| 2232 | 2232 | }, |
| 2233 | 2233 | .computed_goto_stmt => |computed_goto| { |
| 2234 | 2234 | repr.tag = .computed_goto_stmt; |
| 2235 | repr.data[0] = @intFromEnum(computed_goto.expr); | |
| 2235 | repr.data[0] = @backingInt(computed_goto.expr); | |
| 2236 | 2236 | repr.tok = computed_goto.goto_tok; |
| 2237 | 2237 | }, |
| 2238 | 2238 | .continue_stmt => |@"continue"| { |
| ... | ... | @@ -2253,7 +2253,7 @@ pub fn setNode(tree: *Tree, node: Node, index: usize) !void { |
| 2253 | 2253 | switch (@"return".operand) { |
| 2254 | 2254 | .expr => |expr| { |
| 2255 | 2255 | repr.tag = .return_stmt; |
| 2256 | repr.data[1] = @intFromEnum(expr); | |
| 2256 | repr.data[1] = @backingInt(expr); | |
| 2257 | 2257 | }, |
| 2258 | 2258 | .none => { |
| 2259 | 2259 | repr.tag = .return_none_stmt; |
| ... | ... | @@ -2267,7 +2267,7 @@ pub fn setNode(tree: *Tree, node: Node, index: usize) !void { |
| 2267 | 2267 | }, |
| 2268 | 2268 | .asm_stmt => |asm_stmt| { |
| 2269 | 2269 | repr.tok = asm_stmt.asm_tok; |
| 2270 | repr.data[0] = @intFromEnum(asm_stmt.asm_str); | |
| 2270 | repr.data[0] = @backingInt(asm_stmt.asm_str); | |
| 2271 | 2271 | if (asm_stmt.outputs.len == 0 and asm_stmt.inputs.len == 0 and asm_stmt.clobbers.len == 0 and asm_stmt.labels.len == 0) { |
| 2272 | 2272 | repr.tag = .asm_stmt_simple; |
| 2273 | 2273 | repr.data[1] = @bitCast(asm_stmt.quals); |
| ... | ... | @@ -2302,314 +2302,314 @@ pub fn setNode(tree: *Tree, node: Node, index: usize) !void { |
| 2302 | 2302 | .assign_expr => |bin| { |
| 2303 | 2303 | repr.tag = .assign_expr; |
| 2304 | 2304 | repr.data[0] = @bitCast(bin.qt); |
| 2305 | repr.data[1] = @intFromEnum(bin.lhs); | |
| 2306 | repr.data[2] = @intFromEnum(bin.rhs); | |
| 2305 | repr.data[1] = @backingInt(bin.lhs); | |
| 2306 | repr.data[2] = @backingInt(bin.rhs); | |
| 2307 | 2307 | repr.tok = bin.op_tok; |
| 2308 | 2308 | }, |
| 2309 | 2309 | .mul_assign_expr => |bin| { |
| 2310 | 2310 | repr.tag = .mul_assign_expr; |
| 2311 | 2311 | repr.data[0] = @bitCast(bin.qt); |
| 2312 | repr.data[1] = @intFromEnum(bin.lhs); | |
| 2313 | repr.data[2] = @intFromEnum(bin.rhs); | |
| 2312 | repr.data[1] = @backingInt(bin.lhs); | |
| 2313 | repr.data[2] = @backingInt(bin.rhs); | |
| 2314 | 2314 | repr.tok = bin.op_tok; |
| 2315 | 2315 | }, |
| 2316 | 2316 | .div_assign_expr => |bin| { |
| 2317 | 2317 | repr.tag = .div_assign_expr; |
| 2318 | 2318 | repr.data[0] = @bitCast(bin.qt); |
| 2319 | repr.data[1] = @intFromEnum(bin.lhs); | |
| 2320 | repr.data[2] = @intFromEnum(bin.rhs); | |
| 2319 | repr.data[1] = @backingInt(bin.lhs); | |
| 2320 | repr.data[2] = @backingInt(bin.rhs); | |
| 2321 | 2321 | repr.tok = bin.op_tok; |
| 2322 | 2322 | }, |
| 2323 | 2323 | .mod_assign_expr => |bin| { |
| 2324 | 2324 | repr.tag = .mod_assign_expr; |
| 2325 | 2325 | repr.data[0] = @bitCast(bin.qt); |
| 2326 | repr.data[1] = @intFromEnum(bin.lhs); | |
| 2327 | repr.data[2] = @intFromEnum(bin.rhs); | |
| 2326 | repr.data[1] = @backingInt(bin.lhs); | |
| 2327 | repr.data[2] = @backingInt(bin.rhs); | |
| 2328 | 2328 | repr.tok = bin.op_tok; |
| 2329 | 2329 | }, |
| 2330 | 2330 | .add_assign_expr => |bin| { |
| 2331 | 2331 | repr.tag = .add_assign_expr; |
| 2332 | 2332 | repr.data[0] = @bitCast(bin.qt); |
| 2333 | repr.data[1] = @intFromEnum(bin.lhs); | |
| 2334 | repr.data[2] = @intFromEnum(bin.rhs); | |
| 2333 | repr.data[1] = @backingInt(bin.lhs); | |
| 2334 | repr.data[2] = @backingInt(bin.rhs); | |
| 2335 | 2335 | repr.tok = bin.op_tok; |
| 2336 | 2336 | }, |
| 2337 | 2337 | .sub_assign_expr => |bin| { |
| 2338 | 2338 | repr.tag = .sub_assign_expr; |
| 2339 | 2339 | repr.data[0] = @bitCast(bin.qt); |
| 2340 | repr.data[1] = @intFromEnum(bin.lhs); | |
| 2341 | repr.data[2] = @intFromEnum(bin.rhs); | |
| 2340 | repr.data[1] = @backingInt(bin.lhs); | |
| 2341 | repr.data[2] = @backingInt(bin.rhs); | |
| 2342 | 2342 | repr.tok = bin.op_tok; |
| 2343 | 2343 | }, |
| 2344 | 2344 | .shl_assign_expr => |bin| { |
| 2345 | 2345 | repr.tag = .shl_assign_expr; |
| 2346 | 2346 | repr.data[0] = @bitCast(bin.qt); |
| 2347 | repr.data[1] = @intFromEnum(bin.lhs); | |
| 2348 | repr.data[2] = @intFromEnum(bin.rhs); | |
| 2347 | repr.data[1] = @backingInt(bin.lhs); | |
| 2348 | repr.data[2] = @backingInt(bin.rhs); | |
| 2349 | 2349 | repr.tok = bin.op_tok; |
| 2350 | 2350 | }, |
| 2351 | 2351 | .shr_assign_expr => |bin| { |
| 2352 | 2352 | repr.tag = .shr_assign_expr; |
| 2353 | 2353 | repr.data[0] = @bitCast(bin.qt); |
| 2354 | repr.data[1] = @intFromEnum(bin.lhs); | |
| 2355 | repr.data[2] = @intFromEnum(bin.rhs); | |
| 2354 | repr.data[1] = @backingInt(bin.lhs); | |
| 2355 | repr.data[2] = @backingInt(bin.rhs); | |
| 2356 | 2356 | repr.tok = bin.op_tok; |
| 2357 | 2357 | }, |
| 2358 | 2358 | .bit_and_assign_expr => |bin| { |
| 2359 | 2359 | repr.tag = .bit_and_assign_expr; |
| 2360 | 2360 | repr.data[0] = @bitCast(bin.qt); |
| 2361 | repr.data[1] = @intFromEnum(bin.lhs); | |
| 2362 | repr.data[2] = @intFromEnum(bin.rhs); | |
| 2361 | repr.data[1] = @backingInt(bin.lhs); | |
| 2362 | repr.data[2] = @backingInt(bin.rhs); | |
| 2363 | 2363 | repr.tok = bin.op_tok; |
| 2364 | 2364 | }, |
| 2365 | 2365 | .bit_xor_assign_expr => |bin| { |
| 2366 | 2366 | repr.tag = .bit_xor_assign_expr; |
| 2367 | 2367 | repr.data[0] = @bitCast(bin.qt); |
| 2368 | repr.data[1] = @intFromEnum(bin.lhs); | |
| 2369 | repr.data[2] = @intFromEnum(bin.rhs); | |
| 2368 | repr.data[1] = @backingInt(bin.lhs); | |
| 2369 | repr.data[2] = @backingInt(bin.rhs); | |
| 2370 | 2370 | repr.tok = bin.op_tok; |
| 2371 | 2371 | }, |
| 2372 | 2372 | .bit_or_assign_expr => |bin| { |
| 2373 | 2373 | repr.tag = .bit_or_assign_expr; |
| 2374 | 2374 | repr.data[0] = @bitCast(bin.qt); |
| 2375 | repr.data[1] = @intFromEnum(bin.lhs); | |
| 2376 | repr.data[2] = @intFromEnum(bin.rhs); | |
| 2375 | repr.data[1] = @backingInt(bin.lhs); | |
| 2376 | repr.data[2] = @backingInt(bin.rhs); | |
| 2377 | 2377 | repr.tok = bin.op_tok; |
| 2378 | 2378 | }, |
| 2379 | 2379 | .compound_assign_dummy_expr => |un| { |
| 2380 | 2380 | repr.tag = .compound_assign_dummy_expr; |
| 2381 | 2381 | repr.data[0] = @bitCast(un.qt); |
| 2382 | repr.data[1] = @intFromEnum(un.operand); | |
| 2382 | repr.data[1] = @backingInt(un.operand); | |
| 2383 | 2383 | repr.tok = un.op_tok; |
| 2384 | 2384 | }, |
| 2385 | 2385 | .comma_expr => |bin| { |
| 2386 | 2386 | repr.tag = .comma_expr; |
| 2387 | 2387 | repr.data[0] = @bitCast(bin.qt); |
| 2388 | repr.data[1] = @intFromEnum(bin.lhs); | |
| 2389 | repr.data[2] = @intFromEnum(bin.rhs); | |
| 2388 | repr.data[1] = @backingInt(bin.lhs); | |
| 2389 | repr.data[2] = @backingInt(bin.rhs); | |
| 2390 | 2390 | repr.tok = bin.op_tok; |
| 2391 | 2391 | }, |
| 2392 | 2392 | .bool_or_expr => |bin| { |
| 2393 | 2393 | repr.tag = .bool_or_expr; |
| 2394 | 2394 | repr.data[0] = @bitCast(bin.qt); |
| 2395 | repr.data[1] = @intFromEnum(bin.lhs); | |
| 2396 | repr.data[2] = @intFromEnum(bin.rhs); | |
| 2395 | repr.data[1] = @backingInt(bin.lhs); | |
| 2396 | repr.data[2] = @backingInt(bin.rhs); | |
| 2397 | 2397 | repr.tok = bin.op_tok; |
| 2398 | 2398 | }, |
| 2399 | 2399 | .bool_and_expr => |bin| { |
| 2400 | 2400 | repr.tag = .bool_and_expr; |
| 2401 | 2401 | repr.data[0] = @bitCast(bin.qt); |
| 2402 | repr.data[1] = @intFromEnum(bin.lhs); | |
| 2403 | repr.data[2] = @intFromEnum(bin.rhs); | |
| 2402 | repr.data[1] = @backingInt(bin.lhs); | |
| 2403 | repr.data[2] = @backingInt(bin.rhs); | |
| 2404 | 2404 | repr.tok = bin.op_tok; |
| 2405 | 2405 | }, |
| 2406 | 2406 | .bit_or_expr => |bin| { |
| 2407 | 2407 | repr.tag = .bit_or_expr; |
| 2408 | 2408 | repr.data[0] = @bitCast(bin.qt); |
| 2409 | repr.data[1] = @intFromEnum(bin.lhs); | |
| 2410 | repr.data[2] = @intFromEnum(bin.rhs); | |
| 2409 | repr.data[1] = @backingInt(bin.lhs); | |
| 2410 | repr.data[2] = @backingInt(bin.rhs); | |
| 2411 | 2411 | repr.tok = bin.op_tok; |
| 2412 | 2412 | }, |
| 2413 | 2413 | .bit_xor_expr => |bin| { |
| 2414 | 2414 | repr.tag = .bit_xor_expr; |
| 2415 | 2415 | repr.data[0] = @bitCast(bin.qt); |
| 2416 | repr.data[1] = @intFromEnum(bin.lhs); | |
| 2417 | repr.data[2] = @intFromEnum(bin.rhs); | |
| 2416 | repr.data[1] = @backingInt(bin.lhs); | |
| 2417 | repr.data[2] = @backingInt(bin.rhs); | |
| 2418 | 2418 | repr.tok = bin.op_tok; |
| 2419 | 2419 | }, |
| 2420 | 2420 | .bit_and_expr => |bin| { |
| 2421 | 2421 | repr.tag = .bit_and_expr; |
| 2422 | 2422 | repr.data[0] = @bitCast(bin.qt); |
| 2423 | repr.data[1] = @intFromEnum(bin.lhs); | |
| 2424 | repr.data[2] = @intFromEnum(bin.rhs); | |
| 2423 | repr.data[1] = @backingInt(bin.lhs); | |
| 2424 | repr.data[2] = @backingInt(bin.rhs); | |
| 2425 | 2425 | repr.tok = bin.op_tok; |
| 2426 | 2426 | }, |
| 2427 | 2427 | .equal_expr => |bin| { |
| 2428 | 2428 | repr.tag = .equal_expr; |
| 2429 | 2429 | repr.data[0] = @bitCast(bin.qt); |
| 2430 | repr.data[1] = @intFromEnum(bin.lhs); | |
| 2431 | repr.data[2] = @intFromEnum(bin.rhs); | |
| 2430 | repr.data[1] = @backingInt(bin.lhs); | |
| 2431 | repr.data[2] = @backingInt(bin.rhs); | |
| 2432 | 2432 | repr.tok = bin.op_tok; |
| 2433 | 2433 | }, |
| 2434 | 2434 | .not_equal_expr => |bin| { |
| 2435 | 2435 | repr.tag = .not_equal_expr; |
| 2436 | 2436 | repr.data[0] = @bitCast(bin.qt); |
| 2437 | repr.data[1] = @intFromEnum(bin.lhs); | |
| 2438 | repr.data[2] = @intFromEnum(bin.rhs); | |
| 2437 | repr.data[1] = @backingInt(bin.lhs); | |
| 2438 | repr.data[2] = @backingInt(bin.rhs); | |
| 2439 | 2439 | repr.tok = bin.op_tok; |
| 2440 | 2440 | }, |
| 2441 | 2441 | .less_than_expr => |bin| { |
| 2442 | 2442 | repr.tag = .less_than_expr; |
| 2443 | 2443 | repr.data[0] = @bitCast(bin.qt); |
| 2444 | repr.data[1] = @intFromEnum(bin.lhs); | |
| 2445 | repr.data[2] = @intFromEnum(bin.rhs); | |
| 2444 | repr.data[1] = @backingInt(bin.lhs); | |
| 2445 | repr.data[2] = @backingInt(bin.rhs); | |
| 2446 | 2446 | repr.tok = bin.op_tok; |
| 2447 | 2447 | }, |
| 2448 | 2448 | .less_than_equal_expr => |bin| { |
| 2449 | 2449 | repr.tag = .less_than_equal_expr; |
| 2450 | 2450 | repr.data[0] = @bitCast(bin.qt); |
| 2451 | repr.data[1] = @intFromEnum(bin.lhs); | |
| 2452 | repr.data[2] = @intFromEnum(bin.rhs); | |
| 2451 | repr.data[1] = @backingInt(bin.lhs); | |
| 2452 | repr.data[2] = @backingInt(bin.rhs); | |
| 2453 | 2453 | repr.tok = bin.op_tok; |
| 2454 | 2454 | }, |
| 2455 | 2455 | .greater_than_expr => |bin| { |
| 2456 | 2456 | repr.tag = .greater_than_expr; |
| 2457 | 2457 | repr.data[0] = @bitCast(bin.qt); |
| 2458 | repr.data[1] = @intFromEnum(bin.lhs); | |
| 2459 | repr.data[2] = @intFromEnum(bin.rhs); | |
| 2458 | repr.data[1] = @backingInt(bin.lhs); | |
| 2459 | repr.data[2] = @backingInt(bin.rhs); | |
| 2460 | 2460 | repr.tok = bin.op_tok; |
| 2461 | 2461 | }, |
| 2462 | 2462 | .greater_than_equal_expr => |bin| { |
| 2463 | 2463 | repr.tag = .greater_than_equal_expr; |
| 2464 | 2464 | repr.data[0] = @bitCast(bin.qt); |
| 2465 | repr.data[1] = @intFromEnum(bin.lhs); | |
| 2466 | repr.data[2] = @intFromEnum(bin.rhs); | |
| 2465 | repr.data[1] = @backingInt(bin.lhs); | |
| 2466 | repr.data[2] = @backingInt(bin.rhs); | |
| 2467 | 2467 | repr.tok = bin.op_tok; |
| 2468 | 2468 | }, |
| 2469 | 2469 | .shl_expr => |bin| { |
| 2470 | 2470 | repr.tag = .shl_expr; |
| 2471 | 2471 | repr.data[0] = @bitCast(bin.qt); |
| 2472 | repr.data[1] = @intFromEnum(bin.lhs); | |
| 2473 | repr.data[2] = @intFromEnum(bin.rhs); | |
| 2472 | repr.data[1] = @backingInt(bin.lhs); | |
| 2473 | repr.data[2] = @backingInt(bin.rhs); | |
| 2474 | 2474 | repr.tok = bin.op_tok; |
| 2475 | 2475 | }, |
| 2476 | 2476 | .shr_expr => |bin| { |
| 2477 | 2477 | repr.tag = .shr_expr; |
| 2478 | 2478 | repr.data[0] = @bitCast(bin.qt); |
| 2479 | repr.data[1] = @intFromEnum(bin.lhs); | |
| 2480 | repr.data[2] = @intFromEnum(bin.rhs); | |
| 2479 | repr.data[1] = @backingInt(bin.lhs); | |
| 2480 | repr.data[2] = @backingInt(bin.rhs); | |
| 2481 | 2481 | repr.tok = bin.op_tok; |
| 2482 | 2482 | }, |
| 2483 | 2483 | .add_expr => |bin| { |
| 2484 | 2484 | repr.tag = .add_expr; |
| 2485 | 2485 | repr.data[0] = @bitCast(bin.qt); |
| 2486 | repr.data[1] = @intFromEnum(bin.lhs); | |
| 2487 | repr.data[2] = @intFromEnum(bin.rhs); | |
| 2486 | repr.data[1] = @backingInt(bin.lhs); | |
| 2487 | repr.data[2] = @backingInt(bin.rhs); | |
| 2488 | 2488 | repr.tok = bin.op_tok; |
| 2489 | 2489 | }, |
| 2490 | 2490 | .sub_expr => |bin| { |
| 2491 | 2491 | repr.tag = .sub_expr; |
| 2492 | 2492 | repr.data[0] = @bitCast(bin.qt); |
| 2493 | repr.data[1] = @intFromEnum(bin.lhs); | |
| 2494 | repr.data[2] = @intFromEnum(bin.rhs); | |
| 2493 | repr.data[1] = @backingInt(bin.lhs); | |
| 2494 | repr.data[2] = @backingInt(bin.rhs); | |
| 2495 | 2495 | repr.tok = bin.op_tok; |
| 2496 | 2496 | }, |
| 2497 | 2497 | .mul_expr => |bin| { |
| 2498 | 2498 | repr.tag = .mul_expr; |
| 2499 | 2499 | repr.data[0] = @bitCast(bin.qt); |
| 2500 | repr.data[1] = @intFromEnum(bin.lhs); | |
| 2501 | repr.data[2] = @intFromEnum(bin.rhs); | |
| 2500 | repr.data[1] = @backingInt(bin.lhs); | |
| 2501 | repr.data[2] = @backingInt(bin.rhs); | |
| 2502 | 2502 | repr.tok = bin.op_tok; |
| 2503 | 2503 | }, |
| 2504 | 2504 | .div_expr => |bin| { |
| 2505 | 2505 | repr.tag = .div_expr; |
| 2506 | 2506 | repr.data[0] = @bitCast(bin.qt); |
| 2507 | repr.data[1] = @intFromEnum(bin.lhs); | |
| 2508 | repr.data[2] = @intFromEnum(bin.rhs); | |
| 2507 | repr.data[1] = @backingInt(bin.lhs); | |
| 2508 | repr.data[2] = @backingInt(bin.rhs); | |
| 2509 | 2509 | repr.tok = bin.op_tok; |
| 2510 | 2510 | }, |
| 2511 | 2511 | .mod_expr => |bin| { |
| 2512 | 2512 | repr.tag = .mod_expr; |
| 2513 | 2513 | repr.data[0] = @bitCast(bin.qt); |
| 2514 | repr.data[1] = @intFromEnum(bin.lhs); | |
| 2515 | repr.data[2] = @intFromEnum(bin.rhs); | |
| 2514 | repr.data[1] = @backingInt(bin.lhs); | |
| 2515 | repr.data[2] = @backingInt(bin.rhs); | |
| 2516 | 2516 | repr.tok = bin.op_tok; |
| 2517 | 2517 | }, |
| 2518 | 2518 | .cast => |cast| { |
| 2519 | 2519 | repr.tag = if (cast.implicit) .implicit_cast else .explicit_cast; |
| 2520 | 2520 | repr.data[0] = @bitCast(cast.qt); |
| 2521 | repr.data[1] = @intFromEnum(cast.kind); | |
| 2522 | repr.data[2] = @intFromEnum(cast.operand); | |
| 2521 | repr.data[1] = @backingInt(cast.kind); | |
| 2522 | repr.data[2] = @backingInt(cast.operand); | |
| 2523 | 2523 | repr.tok = cast.l_paren; |
| 2524 | 2524 | }, |
| 2525 | 2525 | .addr_of_expr => |un| { |
| 2526 | 2526 | repr.tag = .addr_of_expr; |
| 2527 | 2527 | repr.data[0] = @bitCast(un.qt); |
| 2528 | repr.data[1] = @intFromEnum(un.operand); | |
| 2528 | repr.data[1] = @backingInt(un.operand); | |
| 2529 | 2529 | repr.tok = un.op_tok; |
| 2530 | 2530 | }, |
| 2531 | 2531 | .deref_expr => |un| { |
| 2532 | 2532 | repr.tag = .deref_expr; |
| 2533 | 2533 | repr.data[0] = @bitCast(un.qt); |
| 2534 | repr.data[1] = @intFromEnum(un.operand); | |
| 2534 | repr.data[1] = @backingInt(un.operand); | |
| 2535 | 2535 | repr.tok = un.op_tok; |
| 2536 | 2536 | }, |
| 2537 | 2537 | .plus_expr => |un| { |
| 2538 | 2538 | repr.tag = .plus_expr; |
| 2539 | 2539 | repr.data[0] = @bitCast(un.qt); |
| 2540 | repr.data[1] = @intFromEnum(un.operand); | |
| 2540 | repr.data[1] = @backingInt(un.operand); | |
| 2541 | 2541 | repr.tok = un.op_tok; |
| 2542 | 2542 | }, |
| 2543 | 2543 | .negate_expr => |un| { |
| 2544 | 2544 | repr.tag = .negate_expr; |
| 2545 | 2545 | repr.data[0] = @bitCast(un.qt); |
| 2546 | repr.data[1] = @intFromEnum(un.operand); | |
| 2546 | repr.data[1] = @backingInt(un.operand); | |
| 2547 | 2547 | repr.tok = un.op_tok; |
| 2548 | 2548 | }, |
| 2549 | 2549 | .bit_not_expr => |un| { |
| 2550 | 2550 | repr.tag = .bit_not_expr; |
| 2551 | 2551 | repr.data[0] = @bitCast(un.qt); |
| 2552 | repr.data[1] = @intFromEnum(un.operand); | |
| 2552 | repr.data[1] = @backingInt(un.operand); | |
| 2553 | 2553 | repr.tok = un.op_tok; |
| 2554 | 2554 | }, |
| 2555 | 2555 | .bool_not_expr => |un| { |
| 2556 | 2556 | repr.tag = .bool_not_expr; |
| 2557 | 2557 | repr.data[0] = @bitCast(un.qt); |
| 2558 | repr.data[1] = @intFromEnum(un.operand); | |
| 2558 | repr.data[1] = @backingInt(un.operand); | |
| 2559 | 2559 | repr.tok = un.op_tok; |
| 2560 | 2560 | }, |
| 2561 | 2561 | .pre_inc_expr => |un| { |
| 2562 | 2562 | repr.tag = .pre_inc_expr; |
| 2563 | 2563 | repr.data[0] = @bitCast(un.qt); |
| 2564 | repr.data[1] = @intFromEnum(un.operand); | |
| 2564 | repr.data[1] = @backingInt(un.operand); | |
| 2565 | 2565 | repr.tok = un.op_tok; |
| 2566 | 2566 | }, |
| 2567 | 2567 | .pre_dec_expr => |un| { |
| 2568 | 2568 | repr.tag = .pre_dec_expr; |
| 2569 | 2569 | repr.data[0] = @bitCast(un.qt); |
| 2570 | repr.data[1] = @intFromEnum(un.operand); | |
| 2570 | repr.data[1] = @backingInt(un.operand); | |
| 2571 | 2571 | repr.tok = un.op_tok; |
| 2572 | 2572 | }, |
| 2573 | 2573 | .imag_expr => |un| { |
| 2574 | 2574 | repr.tag = .imag_expr; |
| 2575 | 2575 | repr.data[0] = @bitCast(un.qt); |
| 2576 | repr.data[1] = @intFromEnum(un.operand); | |
| 2576 | repr.data[1] = @backingInt(un.operand); | |
| 2577 | 2577 | repr.tok = un.op_tok; |
| 2578 | 2578 | }, |
| 2579 | 2579 | .real_expr => |un| { |
| 2580 | 2580 | repr.tag = .real_expr; |
| 2581 | 2581 | repr.data[0] = @bitCast(un.qt); |
| 2582 | repr.data[1] = @intFromEnum(un.operand); | |
| 2582 | repr.data[1] = @backingInt(un.operand); | |
| 2583 | 2583 | repr.tok = un.op_tok; |
| 2584 | 2584 | }, |
| 2585 | 2585 | .post_inc_expr => |un| { |
| 2586 | 2586 | repr.tag = .post_inc_expr; |
| 2587 | 2587 | repr.data[0] = @bitCast(un.qt); |
| 2588 | repr.data[1] = @intFromEnum(un.operand); | |
| 2588 | repr.data[1] = @backingInt(un.operand); | |
| 2589 | 2589 | repr.tok = un.op_tok; |
| 2590 | 2590 | }, |
| 2591 | 2591 | .post_dec_expr => |un| { |
| 2592 | 2592 | repr.tag = .post_dec_expr; |
| 2593 | 2593 | repr.data[0] = @bitCast(un.qt); |
| 2594 | repr.data[1] = @intFromEnum(un.operand); | |
| 2594 | repr.data[1] = @backingInt(un.operand); | |
| 2595 | 2595 | repr.tok = un.op_tok; |
| 2596 | 2596 | }, |
| 2597 | 2597 | .paren_expr => |un| { |
| 2598 | 2598 | repr.tag = .paren_expr; |
| 2599 | 2599 | repr.data[0] = @bitCast(un.qt); |
| 2600 | repr.data[1] = @intFromEnum(un.operand); | |
| 2600 | repr.data[1] = @backingInt(un.operand); | |
| 2601 | 2601 | repr.tok = un.op_tok; |
| 2602 | 2602 | }, |
| 2603 | 2603 | .stmt_expr => |un| { |
| 2604 | 2604 | repr.tag = .stmt_expr; |
| 2605 | 2605 | repr.data[0] = @bitCast(un.qt); |
| 2606 | repr.data[1] = @intFromEnum(un.operand); | |
| 2606 | repr.data[1] = @backingInt(un.operand); | |
| 2607 | 2607 | repr.tok = un.op_tok; |
| 2608 | 2608 | }, |
| 2609 | 2609 | .cond_dummy_expr => |un| { |
| 2610 | 2610 | repr.tag = .cond_dummy_expr; |
| 2611 | 2611 | repr.data[0] = @bitCast(un.qt); |
| 2612 | repr.data[1] = @intFromEnum(un.operand); | |
| 2612 | repr.data[1] = @backingInt(un.operand); | |
| 2613 | 2613 | repr.tok = un.op_tok; |
| 2614 | 2614 | }, |
| 2615 | 2615 | .addr_of_label => |addr_of| { |
| ... | ... | @@ -2620,8 +2620,8 @@ pub fn setNode(tree: *Tree, node: Node, index: usize) !void { |
| 2620 | 2620 | .array_access_expr => |access| { |
| 2621 | 2621 | repr.tag = .array_access_expr; |
| 2622 | 2622 | repr.data[0] = @bitCast(access.qt); |
| 2623 | repr.data[1] = @intFromEnum(access.base); | |
| 2624 | repr.data[2] = @intFromEnum(access.index); | |
| 2623 | repr.data[1] = @backingInt(access.base); | |
| 2624 | repr.data[2] = @backingInt(access.index); | |
| 2625 | 2625 | repr.tok = access.l_bracket_tok; |
| 2626 | 2626 | }, |
| 2627 | 2627 | .call_expr => |call| { |
| ... | ... | @@ -2632,11 +2632,11 @@ pub fn setNode(tree: *Tree, node: Node, index: usize) !void { |
| 2632 | 2632 | const len: u32 = @intCast(call.args.len + 1); |
| 2633 | 2633 | repr.data[2] = len; |
| 2634 | 2634 | try tree.extra.ensureUnusedCapacity(tree.comp.gpa, len); |
| 2635 | tree.extra.appendAssumeCapacity(@intFromEnum(call.callee)); | |
| 2635 | tree.extra.appendAssumeCapacity(@backingInt(call.callee)); | |
| 2636 | 2636 | tree.extra.appendSliceAssumeCapacity(@ptrCast(call.args)); |
| 2637 | 2637 | } else { |
| 2638 | 2638 | repr.tag = .call_expr_one; |
| 2639 | repr.data[1] = @intFromEnum(call.callee); | |
| 2639 | repr.data[1] = @backingInt(call.callee); | |
| 2640 | 2640 | repr.data[2] = packElem(call.args, 0); |
| 2641 | 2641 | } |
| 2642 | 2642 | repr.tok = call.l_paren_tok; |
| ... | ... | @@ -2656,27 +2656,27 @@ pub fn setNode(tree: *Tree, node: Node, index: usize) !void { |
| 2656 | 2656 | .member_access_expr => |access| { |
| 2657 | 2657 | repr.tag = .member_access_expr; |
| 2658 | 2658 | repr.data[0] = @bitCast(access.qt); |
| 2659 | repr.data[1] = @intFromEnum(access.base); | |
| 2659 | repr.data[1] = @backingInt(access.base); | |
| 2660 | 2660 | repr.data[2] = access.member_index; |
| 2661 | 2661 | repr.tok = access.access_tok; |
| 2662 | 2662 | }, |
| 2663 | 2663 | .member_access_ptr_expr => |access| { |
| 2664 | 2664 | repr.tag = .member_access_ptr_expr; |
| 2665 | 2665 | repr.data[0] = @bitCast(access.qt); |
| 2666 | repr.data[1] = @intFromEnum(access.base); | |
| 2666 | repr.data[1] = @backingInt(access.base); | |
| 2667 | 2667 | repr.data[2] = access.member_index; |
| 2668 | 2668 | repr.tok = access.access_tok; |
| 2669 | 2669 | }, |
| 2670 | 2670 | .decl_ref_expr => |decl_ref| { |
| 2671 | 2671 | repr.tag = .decl_ref_expr; |
| 2672 | 2672 | repr.data[0] = @bitCast(decl_ref.qt); |
| 2673 | repr.data[1] = @intFromEnum(decl_ref.decl); | |
| 2673 | repr.data[1] = @backingInt(decl_ref.decl); | |
| 2674 | 2674 | repr.tok = decl_ref.name_tok; |
| 2675 | 2675 | }, |
| 2676 | 2676 | .enumeration_ref => |enumeration_ref| { |
| 2677 | 2677 | repr.tag = .enumeration_ref; |
| 2678 | 2678 | repr.data[0] = @bitCast(enumeration_ref.qt); |
| 2679 | repr.data[1] = @intFromEnum(enumeration_ref.decl); | |
| 2679 | repr.data[1] = @backingInt(enumeration_ref.decl); | |
| 2680 | 2680 | repr.tok = enumeration_ref.name_tok; |
| 2681 | 2681 | }, |
| 2682 | 2682 | .builtin_ref => |builtin_ref| { |
| ... | ... | @@ -2702,7 +2702,7 @@ pub fn setNode(tree: *Tree, node: Node, index: usize) !void { |
| 2702 | 2702 | .char_literal => |literal| { |
| 2703 | 2703 | repr.tag = .char_literal; |
| 2704 | 2704 | repr.data[0] = @bitCast(literal.qt); |
| 2705 | repr.data[1] = @intFromEnum(literal.kind); | |
| 2705 | repr.data[1] = @backingInt(literal.kind); | |
| 2706 | 2706 | repr.tok = literal.literal_tok; |
| 2707 | 2707 | }, |
| 2708 | 2708 | .float_literal => |literal| { |
| ... | ... | @@ -2713,13 +2713,13 @@ pub fn setNode(tree: *Tree, node: Node, index: usize) !void { |
| 2713 | 2713 | .string_literal_expr => |literal| { |
| 2714 | 2714 | repr.tag = .string_literal_expr; |
| 2715 | 2715 | repr.data[0] = @bitCast(literal.qt); |
| 2716 | repr.data[1] = @intFromEnum(literal.kind); | |
| 2716 | repr.data[1] = @backingInt(literal.kind); | |
| 2717 | 2717 | repr.tok = literal.literal_tok; |
| 2718 | 2718 | }, |
| 2719 | 2719 | .imaginary_literal => |un| { |
| 2720 | 2720 | repr.tag = .imaginary_literal; |
| 2721 | 2721 | repr.data[0] = @bitCast(un.qt); |
| 2722 | repr.data[1] = @intFromEnum(un.operand); | |
| 2722 | repr.data[1] = @backingInt(un.operand); | |
| 2723 | 2723 | repr.tok = un.op_tok; |
| 2724 | 2724 | }, |
| 2725 | 2725 | .sizeof_expr => |type_info| { |
| ... | ... | @@ -2744,45 +2744,45 @@ pub fn setNode(tree: *Tree, node: Node, index: usize) !void { |
| 2744 | 2744 | const len: u32 = @intCast(generic.rest.len + 2); |
| 2745 | 2745 | repr.data[2] = len; |
| 2746 | 2746 | try tree.extra.ensureUnusedCapacity(tree.comp.gpa, len); |
| 2747 | tree.extra.appendAssumeCapacity(@intFromEnum(generic.controlling)); | |
| 2748 | tree.extra.appendAssumeCapacity(@intFromEnum(generic.chosen)); | |
| 2747 | tree.extra.appendAssumeCapacity(@backingInt(generic.controlling)); | |
| 2748 | tree.extra.appendAssumeCapacity(@backingInt(generic.chosen)); | |
| 2749 | 2749 | tree.extra.appendSliceAssumeCapacity(@ptrCast(generic.rest)); |
| 2750 | 2750 | } else { |
| 2751 | 2751 | repr.tag = .generic_expr_zero; |
| 2752 | repr.data[1] = @intFromEnum(generic.controlling); | |
| 2753 | repr.data[2] = @intFromEnum(generic.chosen); | |
| 2752 | repr.data[1] = @backingInt(generic.controlling); | |
| 2753 | repr.data[2] = @backingInt(generic.chosen); | |
| 2754 | 2754 | } |
| 2755 | 2755 | repr.tok = generic.generic_tok; |
| 2756 | 2756 | }, |
| 2757 | 2757 | .generic_association_expr => |association| { |
| 2758 | 2758 | repr.tag = .generic_association_expr; |
| 2759 | 2759 | repr.data[0] = @bitCast(association.association_qt); |
| 2760 | repr.data[1] = @intFromEnum(association.expr); | |
| 2760 | repr.data[1] = @backingInt(association.expr); | |
| 2761 | 2761 | repr.tok = association.colon_tok; |
| 2762 | 2762 | }, |
| 2763 | 2763 | .generic_default_expr => |default| { |
| 2764 | 2764 | repr.tag = .generic_default_expr; |
| 2765 | repr.data[0] = @intFromEnum(default.expr); | |
| 2765 | repr.data[0] = @backingInt(default.expr); | |
| 2766 | 2766 | repr.tok = default.default_tok; |
| 2767 | 2767 | }, |
| 2768 | 2768 | .binary_cond_expr => |cond| { |
| 2769 | 2769 | repr.tag = .binary_cond_expr; |
| 2770 | 2770 | repr.data[0] = @bitCast(cond.qt); |
| 2771 | repr.data[1] = @intFromEnum(cond.cond); | |
| 2771 | repr.data[1] = @backingInt(cond.cond); | |
| 2772 | 2772 | repr.data[2], _ = try tree.addExtra(&.{ cond.then_expr, cond.else_expr }); |
| 2773 | 2773 | repr.tok = cond.cond_tok; |
| 2774 | 2774 | }, |
| 2775 | 2775 | .cond_expr => |cond| { |
| 2776 | 2776 | repr.tag = .cond_expr; |
| 2777 | 2777 | repr.data[0] = @bitCast(cond.qt); |
| 2778 | repr.data[1] = @intFromEnum(cond.cond); | |
| 2778 | repr.data[1] = @backingInt(cond.cond); | |
| 2779 | 2779 | repr.data[2], _ = try tree.addExtra(&.{ cond.then_expr, cond.else_expr }); |
| 2780 | 2780 | repr.tok = cond.cond_tok; |
| 2781 | 2781 | }, |
| 2782 | 2782 | .builtin_choose_expr => |cond| { |
| 2783 | 2783 | repr.tag = .builtin_choose_expr; |
| 2784 | 2784 | repr.data[0] = @bitCast(cond.qt); |
| 2785 | repr.data[1] = @intFromEnum(cond.cond); | |
| 2785 | repr.data[1] = @backingInt(cond.cond); | |
| 2786 | 2786 | repr.data[2], _ = try tree.addExtra(&.{ cond.then_expr, cond.else_expr }); |
| 2787 | 2787 | repr.tok = cond.cond_tok; |
| 2788 | 2788 | }, |
| ... | ... | @@ -2795,7 +2795,7 @@ pub fn setNode(tree: *Tree, node: Node, index: usize) !void { |
| 2795 | 2795 | .builtin_convertvector => |builtin| { |
| 2796 | 2796 | repr.tag = .builtin_convertvector; |
| 2797 | 2797 | repr.data[0] = @bitCast(builtin.dest_qt); |
| 2798 | repr.data[1] = @intFromEnum(builtin.operand); | |
| 2798 | repr.data[1] = @backingInt(builtin.operand); | |
| 2799 | 2799 | repr.tok = builtin.builtin_tok; |
| 2800 | 2800 | }, |
| 2801 | 2801 | .builtin_shufflevector => |builtin| { |
| ... | ... | @@ -2805,8 +2805,8 @@ pub fn setNode(tree: *Tree, node: Node, index: usize) !void { |
| 2805 | 2805 | repr.data[2] = @intCast(builtin.indexes.len); |
| 2806 | 2806 | repr.tok = builtin.builtin_tok; |
| 2807 | 2807 | try tree.extra.ensureUnusedCapacity(tree.comp.gpa, builtin.indexes.len + 2); |
| 2808 | tree.extra.appendAssumeCapacity(@intFromEnum(builtin.lhs)); | |
| 2809 | tree.extra.appendAssumeCapacity(@intFromEnum(builtin.rhs)); | |
| 2808 | tree.extra.appendAssumeCapacity(@backingInt(builtin.lhs)); | |
| 2809 | tree.extra.appendAssumeCapacity(@backingInt(builtin.rhs)); | |
| 2810 | 2810 | tree.extra.appendSliceAssumeCapacity(@ptrCast(builtin.indexes)); |
| 2811 | 2811 | }, |
| 2812 | 2812 | .builtin_va_arg_pack => |builtin| { |
| ... | ... | @@ -2867,7 +2867,7 @@ pub fn setNode(tree: *Tree, node: Node, index: usize) !void { |
| 2867 | 2867 | .register = literal.storage_class == .register, |
| 2868 | 2868 | .thread_local = literal.thread_local, |
| 2869 | 2869 | }); |
| 2870 | repr.data[2] = @intFromEnum(literal.initializer); | |
| 2870 | repr.data[2] = @backingInt(literal.initializer); | |
| 2871 | 2871 | repr.tok = literal.l_paren_tok; |
| 2872 | 2872 | }, |
| 2873 | 2873 | } |
| ... | ... | @@ -2875,19 +2875,19 @@ pub fn setNode(tree: *Tree, node: Node, index: usize) !void { |
| 2875 | 2875 | } |
| 2876 | 2876 | |
| 2877 | 2877 | fn packOptIndex(opt: ?Node.Index) u32 { |
| 2878 | return @intFromEnum(Node.OptIndex.packOpt(opt)); | |
| 2878 | return @backingInt(Node.OptIndex.packOpt(opt)); | |
| 2879 | 2879 | } |
| 2880 | 2880 | |
| 2881 | 2881 | fn unpackOptIndex(idx: u32) ?Node.Index { |
| 2882 | return @as(Node.OptIndex, @enumFromInt(idx)).unpack(); | |
| 2882 | return @as(Node.OptIndex, @fromBackingInt(@intCast(idx))).unpack(); | |
| 2883 | 2883 | } |
| 2884 | 2884 | |
| 2885 | 2885 | fn packElem(nodes: []const Node.Index, index: usize) u32 { |
| 2886 | return if (nodes.len > index) @intFromEnum(nodes[index]) else @intFromEnum(Node.OptIndex.null); | |
| 2886 | return if (nodes.len > index) @backingInt(nodes[index]) else @backingInt(Node.OptIndex.null); | |
| 2887 | 2887 | } |
| 2888 | 2888 | |
| 2889 | 2889 | fn unPackElems(data: []const u32) []const Node.Index { |
| 2890 | const sentinel = @intFromEnum(Node.OptIndex.null); | |
| 2890 | const sentinel = @backingInt(Node.OptIndex.null); | |
| 2891 | 2891 | for (data, 0..) |item, i| { |
| 2892 | 2892 | if (item == sentinel) return @ptrCast(data[0..i]); |
| 2893 | 2893 | } |
| ... | ... | @@ -3146,7 +3146,7 @@ fn dumpNode( |
| 3146 | 3146 | _ = try ptr.offset.print(tree.comp.type_store.ptrdiff, tree.comp, w); |
| 3147 | 3147 | }, |
| 3148 | 3148 | else => { |
| 3149 | const ptr_node: Node.Index = @enumFromInt(ptr.node); | |
| 3149 | const ptr_node: Node.Index = @fromBackingInt(@intCast(ptr.node)); | |
| 3150 | 3150 | const decl_name = tree.tokSlice(ptr_node.tok(tree)); |
| 3151 | 3151 | try ptr.offset.printPointer(decl_name, tree.comp, w); |
| 3152 | 3152 | }, |
| ... | ... | @@ -3212,7 +3212,7 @@ fn dumpNode( |
| 3212 | 3212 | try w.splatByteAll(' ', level + half); |
| 3213 | 3213 | try w.writeAll("definition: "); |
| 3214 | 3214 | try term.setColor(NAME); |
| 3215 | try w.print("0x{X}\n", .{@intFromEnum(definition)}); | |
| 3215 | try w.print("0x{X}\n", .{@backingInt(definition)}); | |
| 3216 | 3216 | try term.setColor(.reset); |
| 3217 | 3217 | } |
| 3218 | 3218 | }, |
| ... | ... | @@ -3268,7 +3268,7 @@ fn dumpNode( |
| 3268 | 3268 | try w.splatByteAll(' ', level + half); |
| 3269 | 3269 | try w.writeAll("definition: "); |
| 3270 | 3270 | try term.setColor(NAME); |
| 3271 | try w.print("0x{X}\n", .{@intFromEnum(definition)}); | |
| 3271 | try w.print("0x{X}\n", .{@backingInt(definition)}); | |
| 3272 | 3272 | try term.setColor(.reset); |
| 3273 | 3273 | } |
| 3274 | 3274 | }, |
lib/compiler/aro/aro/TypeStore.zig+44-44| ... | ... | @@ -226,13 +226,13 @@ pub const QualType = packed struct(u32) { |
| 226 | 226 | else => {}, |
| 227 | 227 | } |
| 228 | 228 | |
| 229 | const repr = comp.type_store.types.get(@intFromEnum(qt._index)); | |
| 229 | const repr = comp.type_store.types.get(@backingInt(qt._index)); | |
| 230 | 230 | return switch (repr.tag) { |
| 231 | 231 | .complex => .{ .complex = @bitCast(repr.data[0]) }, |
| 232 | 232 | .atomic => .{ .atomic = @bitCast(repr.data[0]) }, |
| 233 | 233 | .bit_int => .{ .bit_int = .{ |
| 234 | 234 | .bits = @intCast(repr.data[0]), |
| 235 | .signedness = @enumFromInt(repr.data[1]), | |
| 235 | .signedness = @fromBackingInt(@intCast(repr.data[1])), | |
| 236 | 236 | } }, |
| 237 | 237 | .func_zero => .{ .func = .{ |
| 238 | 238 | .return_type = @bitCast(repr.data[0]), |
| ... | ... | @@ -280,7 +280,7 @@ pub const QualType = packed struct(u32) { |
| 280 | 280 | }, |
| 281 | 281 | .pointer => .{ .pointer = .{ |
| 282 | 282 | .child = @bitCast(repr.data[0]), |
| 283 | .bounds = @enumFromInt(repr.data[1]), | |
| 283 | .bounds = @fromBackingInt(@intCast(repr.data[1])), | |
| 284 | 284 | } }, |
| 285 | 285 | .pointer_decayed => .{ .pointer = .{ |
| 286 | 286 | .child = @bitCast(repr.data[0]), |
| ... | ... | @@ -300,7 +300,7 @@ pub const QualType = packed struct(u32) { |
| 300 | 300 | } }, |
| 301 | 301 | .array_variable => .{ .array = .{ |
| 302 | 302 | .elem = @bitCast(repr.data[0]), |
| 303 | .len = .{ .variable = @enumFromInt(repr.data[1]) }, | |
| 303 | .len = .{ .variable = @fromBackingInt(@intCast(repr.data[1])) }, | |
| 304 | 304 | } }, |
| 305 | 305 | .array_unspecified_variable => .{ .array = .{ |
| 306 | 306 | .elem = @bitCast(repr.data[0]), |
| ... | ... | @@ -322,8 +322,8 @@ pub const QualType = packed struct(u32) { |
| 322 | 322 | const extra_fields = extra[repr.data[1] + layout_size + 2 ..][0 .. fields_len * field_size]; |
| 323 | 323 | |
| 324 | 324 | const record: Type.Record = .{ |
| 325 | .name = @enumFromInt(repr.data[0]), | |
| 326 | .decl_node = @enumFromInt(extra[repr.data[1]]), | |
| 325 | .name = @fromBackingInt(@intCast(repr.data[0])), | |
| 326 | .decl_node = @fromBackingInt(@intCast(extra[repr.data[1]])), | |
| 327 | 327 | .layout = layout, |
| 328 | 328 | .fields = std.mem.bytesAsSlice(Type.Record.Field, std.mem.sliceAsBytes(extra_fields)), |
| 329 | 329 | }; |
| ... | ... | @@ -334,14 +334,14 @@ pub const QualType = packed struct(u32) { |
| 334 | 334 | }; |
| 335 | 335 | }, |
| 336 | 336 | .struct_incomplete => .{ .@"struct" = .{ |
| 337 | .name = @enumFromInt(repr.data[0]), | |
| 338 | .decl_node = @enumFromInt(repr.data[1]), | |
| 337 | .name = @fromBackingInt(@intCast(repr.data[0])), | |
| 338 | .decl_node = @fromBackingInt(@intCast(repr.data[1])), | |
| 339 | 339 | .layout = null, |
| 340 | 340 | .fields = &.{}, |
| 341 | 341 | } }, |
| 342 | 342 | .union_incomplete => .{ .@"union" = .{ |
| 343 | .name = @enumFromInt(repr.data[0]), | |
| 344 | .decl_node = @enumFromInt(repr.data[1]), | |
| 343 | .name = @fromBackingInt(@intCast(repr.data[0])), | |
| 344 | .decl_node = @fromBackingInt(@intCast(repr.data[1])), | |
| 345 | 345 | .layout = null, |
| 346 | 346 | .fields = &.{}, |
| 347 | 347 | } }, |
| ... | ... | @@ -354,8 +354,8 @@ pub const QualType = packed struct(u32) { |
| 354 | 354 | const extra_fields = extra[repr.data[1] + 3 ..][0 .. fields_len * field_size]; |
| 355 | 355 | |
| 356 | 356 | return .{ .@"enum" = .{ |
| 357 | .name = @enumFromInt(extra[repr.data[1]]), | |
| 358 | .decl_node = @enumFromInt(extra[repr.data[1] + 1]), | |
| 357 | .name = @fromBackingInt(@intCast(extra[repr.data[1]])), | |
| 358 | .decl_node = @fromBackingInt(@intCast(extra[repr.data[1] + 1])), | |
| 359 | 359 | .tag = @bitCast(repr.data[0]), |
| 360 | 360 | .incomplete = false, |
| 361 | 361 | .fixed = repr.tag == .enum_fixed, |
| ... | ... | @@ -365,8 +365,8 @@ pub const QualType = packed struct(u32) { |
| 365 | 365 | .enum_incomplete => .{ |
| 366 | 366 | .@"enum" = .{ |
| 367 | 367 | .tag = null, |
| 368 | .name = @enumFromInt(repr.data[0]), | |
| 369 | .decl_node = @enumFromInt(repr.data[1]), | |
| 368 | .name = @fromBackingInt(@intCast(repr.data[0])), | |
| 369 | .decl_node = @fromBackingInt(@intCast(repr.data[1])), | |
| 370 | 370 | .incomplete = true, |
| 371 | 371 | .fixed = false, |
| 372 | 372 | .fields = &.{}, |
| ... | ... | @@ -375,8 +375,8 @@ pub const QualType = packed struct(u32) { |
| 375 | 375 | .enum_incomplete_fixed => .{ |
| 376 | 376 | .@"enum" = .{ |
| 377 | 377 | .tag = @bitCast(repr.data[0]), |
| 378 | .name = @enumFromInt(comp.type_store.extra.items[repr.data[1]]), | |
| 379 | .decl_node = @enumFromInt(comp.type_store.extra.items[repr.data[1] + 1]), | |
| 378 | .name = @fromBackingInt(@intCast(comp.type_store.extra.items[repr.data[1]])), | |
| 379 | .decl_node = @fromBackingInt(@intCast(comp.type_store.extra.items[repr.data[1] + 1])), | |
| 380 | 380 | .incomplete = true, |
| 381 | 381 | .fixed = true, |
| 382 | 382 | .fields = &.{}, |
| ... | ... | @@ -388,12 +388,12 @@ pub const QualType = packed struct(u32) { |
| 388 | 388 | } }, |
| 389 | 389 | .typeof_expr => .{ .typeof = .{ |
| 390 | 390 | .base = @bitCast(repr.data[0]), |
| 391 | .expr = @enumFromInt(repr.data[1]), | |
| 391 | .expr = @fromBackingInt(@intCast(repr.data[1])), | |
| 392 | 392 | } }, |
| 393 | 393 | .typedef => .{ .typedef = .{ |
| 394 | 394 | .base = @bitCast(repr.data[0]), |
| 395 | .name = @enumFromInt(comp.type_store.extra.items[repr.data[1]]), | |
| 396 | .decl_node = @enumFromInt(comp.type_store.extra.items[repr.data[1] + 1]), | |
| 395 | .name = @fromBackingInt(@intCast(comp.type_store.extra.items[repr.data[1]])), | |
| 396 | .decl_node = @fromBackingInt(@intCast(comp.type_store.extra.items[repr.data[1] + 1])), | |
| 397 | 397 | } }, |
| 398 | 398 | .attributed => { |
| 399 | 399 | const extra = comp.type_store.extra.items; |
| ... | ... | @@ -1694,7 +1694,7 @@ pub const Type = union(enum) { |
| 1694 | 1694 | |
| 1695 | 1695 | pub fn unpack(width: @This()) ?u32 { |
| 1696 | 1696 | if (width == .null) return null; |
| 1697 | return @intFromEnum(width); | |
| 1697 | return @backingInt(width); | |
| 1698 | 1698 | } |
| 1699 | 1699 | } = .null, |
| 1700 | 1700 | layout: Field.Layout = .{ |
| ... | ... | @@ -1881,7 +1881,7 @@ pub fn putExtra(ts: *TypeStore, gpa: std.mem.Allocator, ty: Type) !Index { |
| 1881 | 1881 | } |
| 1882 | 1882 | const index = try ts.types.addOne(gpa); |
| 1883 | 1883 | try ts.set(gpa, ty, index); |
| 1884 | return @enumFromInt(index); | |
| 1884 | return @fromBackingInt(@intCast(index)); | |
| 1885 | 1885 | } |
| 1886 | 1886 | |
| 1887 | 1887 | pub fn set(ts: *TypeStore, gpa: std.mem.Allocator, ty: Type, index: usize) !void { |
| ... | ... | @@ -1899,7 +1899,7 @@ pub fn set(ts: *TypeStore, gpa: std.mem.Allocator, ty: Type, index: usize) !void |
| 1899 | 1899 | .bit_int => |bit_int| { |
| 1900 | 1900 | repr.tag = .bit_int; |
| 1901 | 1901 | repr.data[0] = bit_int.bits; |
| 1902 | repr.data[1] = @intFromEnum(bit_int.signedness); | |
| 1902 | repr.data[1] = @backingInt(bit_int.signedness); | |
| 1903 | 1903 | }, |
| 1904 | 1904 | .atomic => |atomic| { |
| 1905 | 1905 | repr.tag = .atomic; |
| ... | ... | @@ -1950,7 +1950,7 @@ pub fn set(ts: *TypeStore, gpa: std.mem.Allocator, ty: Type, index: usize) !void |
| 1950 | 1950 | repr.data[1] = @bitCast(array); |
| 1951 | 1951 | } else { |
| 1952 | 1952 | repr.tag = .pointer; |
| 1953 | repr.data[1] = @intFromEnum(pointer.bounds); | |
| 1953 | repr.data[1] = @backingInt(pointer.bounds); | |
| 1954 | 1954 | } |
| 1955 | 1955 | }, |
| 1956 | 1956 | .array => |array| { |
| ... | ... | @@ -1973,7 +1973,7 @@ pub fn set(ts: *TypeStore, gpa: std.mem.Allocator, ty: Type, index: usize) !void |
| 1973 | 1973 | }, |
| 1974 | 1974 | .variable => |expr| { |
| 1975 | 1975 | repr.tag = .array_variable; |
| 1976 | repr.data[1] = @intFromEnum(expr); | |
| 1976 | repr.data[1] = @backingInt(expr); | |
| 1977 | 1977 | }, |
| 1978 | 1978 | .unspecified_variable => { |
| 1979 | 1979 | repr.tag = .array_unspecified_variable; |
| ... | ... | @@ -1986,7 +1986,7 @@ pub fn set(ts: *TypeStore, gpa: std.mem.Allocator, ty: Type, index: usize) !void |
| 1986 | 1986 | repr.data[1] = vector.len; |
| 1987 | 1987 | }, |
| 1988 | 1988 | .@"struct", .@"union" => |record| record: { |
| 1989 | repr.data[0] = @intFromEnum(record.name); | |
| 1989 | repr.data[0] = @backingInt(record.name); | |
| 1990 | 1990 | const layout = record.layout orelse { |
| 1991 | 1991 | std.debug.assert(record.fields.len == 0); |
| 1992 | 1992 | repr.tag = switch (ty) { |
| ... | ... | @@ -1994,7 +1994,7 @@ pub fn set(ts: *TypeStore, gpa: std.mem.Allocator, ty: Type, index: usize) !void |
| 1994 | 1994 | .@"union" => .union_incomplete, |
| 1995 | 1995 | else => unreachable, |
| 1996 | 1996 | }; |
| 1997 | repr.data[1] = @intFromEnum(record.decl_node); | |
| 1997 | repr.data[1] = @backingInt(record.decl_node); | |
| 1998 | 1998 | break :record; |
| 1999 | 1999 | }; |
| 2000 | 2000 | repr.tag = switch (ty) { |
| ... | ... | @@ -2012,7 +2012,7 @@ pub fn set(ts: *TypeStore, gpa: std.mem.Allocator, ty: Type, index: usize) !void |
| 2012 | 2012 | comptime std.debug.assert(@sizeOf(Type.Record.Field) == @sizeOf(u32) * field_size); |
| 2013 | 2013 | try ts.extra.ensureUnusedCapacity(gpa, record.fields.len * field_size + layout_size + 2); |
| 2014 | 2014 | |
| 2015 | ts.extra.appendAssumeCapacity(@intFromEnum(record.decl_node)); | |
| 2015 | ts.extra.appendAssumeCapacity(@backingInt(record.decl_node)); | |
| 2016 | 2016 | const casted_layout: *const [layout_size]u32 = @ptrCast(&layout); |
| 2017 | 2017 | ts.extra.appendSliceAssumeCapacity(casted_layout); |
| 2018 | 2018 | ts.extra.appendAssumeCapacity(@intCast(record.fields.len)); |
| ... | ... | @@ -2030,13 +2030,13 @@ pub fn set(ts: *TypeStore, gpa: std.mem.Allocator, ty: Type, index: usize) !void |
| 2030 | 2030 | repr.data[0] = @bitCast(@"enum".tag.?); |
| 2031 | 2031 | repr.data[1] = @intCast(ts.extra.items.len); |
| 2032 | 2032 | try ts.extra.appendSlice(gpa, &.{ |
| 2033 | @intFromEnum(@"enum".name), | |
| 2034 | @intFromEnum(@"enum".decl_node), | |
| 2033 | @backingInt(@"enum".name), | |
| 2034 | @backingInt(@"enum".decl_node), | |
| 2035 | 2035 | }); |
| 2036 | 2036 | } else { |
| 2037 | 2037 | repr.tag = .enum_incomplete; |
| 2038 | repr.data[0] = @intFromEnum(@"enum".name); | |
| 2039 | repr.data[1] = @intFromEnum(@"enum".decl_node); | |
| 2038 | repr.data[0] = @backingInt(@"enum".name); | |
| 2039 | repr.data[1] = @backingInt(@"enum".decl_node); | |
| 2040 | 2040 | } |
| 2041 | 2041 | break :@"enum"; |
| 2042 | 2042 | } |
| ... | ... | @@ -2050,8 +2050,8 @@ pub fn set(ts: *TypeStore, gpa: std.mem.Allocator, ty: Type, index: usize) !void |
| 2050 | 2050 | comptime std.debug.assert(@sizeOf(Type.Enum.Field) == @sizeOf(u32) * field_size); |
| 2051 | 2051 | try ts.extra.ensureUnusedCapacity(gpa, @"enum".fields.len * field_size + 3); |
| 2052 | 2052 | |
| 2053 | ts.extra.appendAssumeCapacity(@intFromEnum(@"enum".name)); | |
| 2054 | ts.extra.appendAssumeCapacity(@intFromEnum(@"enum".decl_node)); | |
| 2053 | ts.extra.appendAssumeCapacity(@backingInt(@"enum".name)); | |
| 2054 | ts.extra.appendAssumeCapacity(@backingInt(@"enum".decl_node)); | |
| 2055 | 2055 | ts.extra.appendAssumeCapacity(@intCast(@"enum".fields.len)); |
| 2056 | 2056 | |
| 2057 | 2057 | for (@"enum".fields) |*field| { |
| ... | ... | @@ -2063,7 +2063,7 @@ pub fn set(ts: *TypeStore, gpa: std.mem.Allocator, ty: Type, index: usize) !void |
| 2063 | 2063 | repr.data[0] = @bitCast(typeof.base); |
| 2064 | 2064 | if (typeof.expr) |some| { |
| 2065 | 2065 | repr.tag = .typeof_expr; |
| 2066 | repr.data[1] = @intFromEnum(some); | |
| 2066 | repr.data[1] = @backingInt(some); | |
| 2067 | 2067 | } else { |
| 2068 | 2068 | repr.tag = .typeof; |
| 2069 | 2069 | } |
| ... | ... | @@ -2073,8 +2073,8 @@ pub fn set(ts: *TypeStore, gpa: std.mem.Allocator, ty: Type, index: usize) !void |
| 2073 | 2073 | repr.data[0] = @bitCast(typedef.base); |
| 2074 | 2074 | repr.data[1] = @intCast(ts.extra.items.len); |
| 2075 | 2075 | try ts.extra.appendSlice(gpa, &.{ |
| 2076 | @intFromEnum(typedef.name), | |
| 2077 | @intFromEnum(typedef.decl_node), | |
| 2076 | @backingInt(typedef.name), | |
| 2077 | @backingInt(typedef.decl_node), | |
| 2078 | 2078 | }); |
| 2079 | 2079 | }, |
| 2080 | 2080 | .attributed => |attributed| { |
| ... | ... | @@ -2194,7 +2194,7 @@ fn generateNsConstantStringType(ts: *TypeStore, comp: *Compilation) !QualType { |
| 2194 | 2194 | }; |
| 2195 | 2195 | record.fields = &fields; |
| 2196 | 2196 | record.layout = record_layout.compute(&fields, qt, comp, null) catch unreachable; |
| 2197 | try ts.set(comp.gpa, .{ .@"struct" = record }, @intFromEnum(qt._index)); | |
| 2197 | try ts.set(comp.gpa, .{ .@"struct" = record }, @backingInt(qt._index)); | |
| 2198 | 2198 | |
| 2199 | 2199 | return qt; |
| 2200 | 2200 | } |
| ... | ... | @@ -2282,7 +2282,7 @@ fn generateVaListType(ts: *TypeStore, comp: *Compilation) !QualType { |
| 2282 | 2282 | }; |
| 2283 | 2283 | record.fields = &fields; |
| 2284 | 2284 | record.layout = record_layout.compute(&fields, qt, comp, null) catch unreachable; |
| 2285 | try ts.set(comp.gpa, .{ .@"struct" = record }, @intFromEnum(qt._index)); | |
| 2285 | try ts.set(comp.gpa, .{ .@"struct" = record }, @backingInt(qt._index)); | |
| 2286 | 2286 | |
| 2287 | 2287 | return qt; |
| 2288 | 2288 | }, |
| ... | ... | @@ -2300,7 +2300,7 @@ fn generateVaListType(ts: *TypeStore, comp: *Compilation) !QualType { |
| 2300 | 2300 | }; |
| 2301 | 2301 | record.fields = &fields; |
| 2302 | 2302 | record.layout = record_layout.compute(&fields, qt, comp, null) catch unreachable; |
| 2303 | try ts.set(comp.gpa, .{ .@"struct" = record }, @intFromEnum(qt._index)); | |
| 2303 | try ts.set(comp.gpa, .{ .@"struct" = record }, @backingInt(qt._index)); | |
| 2304 | 2304 | |
| 2305 | 2305 | return qt; |
| 2306 | 2306 | }, |
| ... | ... | @@ -2321,7 +2321,7 @@ fn generateVaListType(ts: *TypeStore, comp: *Compilation) !QualType { |
| 2321 | 2321 | }; |
| 2322 | 2322 | record.fields = &fields; |
| 2323 | 2323 | record.layout = record_layout.compute(&fields, qt, comp, null) catch unreachable; |
| 2324 | try ts.set(comp.gpa, .{ .@"struct" = record }, @intFromEnum(qt._index)); | |
| 2324 | try ts.set(comp.gpa, .{ .@"struct" = record }, @backingInt(qt._index)); | |
| 2325 | 2325 | |
| 2326 | 2326 | break :blk qt; |
| 2327 | 2327 | }, |
| ... | ... | @@ -2343,7 +2343,7 @@ fn generateVaListType(ts: *TypeStore, comp: *Compilation) !QualType { |
| 2343 | 2343 | }; |
| 2344 | 2344 | record.fields = &fields; |
| 2345 | 2345 | record.layout = record_layout.compute(&fields, qt, comp, null) catch unreachable; |
| 2346 | try ts.set(comp.gpa, .{ .@"struct" = record }, @intFromEnum(qt._index)); | |
| 2346 | try ts.set(comp.gpa, .{ .@"struct" = record }, @backingInt(qt._index)); | |
| 2347 | 2347 | |
| 2348 | 2348 | break :blk qt; |
| 2349 | 2349 | }, |
| ... | ... | @@ -2363,7 +2363,7 @@ fn generateVaListType(ts: *TypeStore, comp: *Compilation) !QualType { |
| 2363 | 2363 | }; |
| 2364 | 2364 | record.fields = &fields; |
| 2365 | 2365 | record.layout = record_layout.compute(&fields, qt, comp, null) catch unreachable; |
| 2366 | try ts.set(comp.gpa, .{ .@"struct" = record }, @intFromEnum(qt._index)); | |
| 2366 | try ts.set(comp.gpa, .{ .@"struct" = record }, @backingInt(qt._index)); | |
| 2367 | 2367 | |
| 2368 | 2368 | break :blk qt; |
| 2369 | 2369 | }, |
| ... | ... | @@ -2384,7 +2384,7 @@ fn generateVaListType(ts: *TypeStore, comp: *Compilation) !QualType { |
| 2384 | 2384 | }; |
| 2385 | 2385 | record.fields = &fields; |
| 2386 | 2386 | record.layout = record_layout.compute(&fields, qt, comp, null) catch unreachable; |
| 2387 | try ts.set(comp.gpa, .{ .@"struct" = record }, @intFromEnum(qt._index)); | |
| 2387 | try ts.set(comp.gpa, .{ .@"struct" = record }, @backingInt(qt._index)); | |
| 2388 | 2388 | |
| 2389 | 2389 | break :blk qt; |
| 2390 | 2390 | }, |
| ... | ... | @@ -2404,7 +2404,7 @@ fn generateVaListType(ts: *TypeStore, comp: *Compilation) !QualType { |
| 2404 | 2404 | }; |
| 2405 | 2405 | record.fields = &fields; |
| 2406 | 2406 | record.layout = record_layout.compute(&fields, qt, comp, null) catch unreachable; |
| 2407 | try ts.set(comp.gpa, .{ .@"struct" = record }, @intFromEnum(qt._index)); | |
| 2407 | try ts.set(comp.gpa, .{ .@"struct" = record }, @backingInt(qt._index)); | |
| 2408 | 2408 | |
| 2409 | 2409 | return qt; |
| 2410 | 2410 | }, |
lib/compiler/aro/aro/Value.zig+5-5| ... | ... | @@ -21,7 +21,7 @@ pub const @"null" = Value{ .opt_ref = .null }; |
| 21 | 21 | |
| 22 | 22 | pub fn intern(comp: *Compilation, k: Interner.Key) !Value { |
| 23 | 23 | const r = try comp.interner.put(comp.gpa, k); |
| 24 | return .{ .opt_ref = @enumFromInt(@intFromEnum(r)) }; | |
| 24 | return .{ .opt_ref = @fromBackingInt(@intCast(@backingInt(r))) }; | |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | pub fn int(i: anytype, comp: *Compilation) !Value { |
| ... | ... | @@ -39,11 +39,11 @@ pub fn pointer(r: Interner.Key.Pointer, comp: *Compilation) !Value { |
| 39 | 39 | |
| 40 | 40 | pub fn ref(v: Value) Interner.Ref { |
| 41 | 41 | std.debug.assert(v.opt_ref != .none); |
| 42 | return @enumFromInt(@intFromEnum(v.opt_ref)); | |
| 42 | return @fromBackingInt(@intCast(@backingInt(v.opt_ref))); | |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | pub fn fromRef(r: Interner.Ref) Value { |
| 46 | return .{ .opt_ref = @enumFromInt(@intFromEnum(r)) }; | |
| 46 | return .{ .opt_ref = @fromBackingInt(@intCast(@backingInt(r))) }; | |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | pub fn is(v: Value, tag: std.meta.Tag(Interner.Key), comp: *const Compilation) bool { |
| ... | ... | @@ -1114,8 +1114,8 @@ pub fn print(v: Value, qt: QualType, comp: *const Compilation, w: *std.Io.Writer |
| 1114 | 1114 | } |
| 1115 | 1115 | |
| 1116 | 1116 | pub fn printString(bytes: []const u8, qt: QualType, comp: *const Compilation, w: *std.Io.Writer) std.Io.Writer.Error!void { |
| 1117 | const size: Compilation.CharUnitSize = @enumFromInt(qt.childType(comp).sizeof(comp)); | |
| 1118 | const without_null = bytes[0 .. bytes.len - @intFromEnum(size)]; | |
| 1117 | const size: Compilation.CharUnitSize = @fromBackingInt(@intCast(qt.childType(comp).sizeof(comp))); | |
| 1118 | const without_null = bytes[0 .. bytes.len - @backingInt(size)]; | |
| 1119 | 1119 | try w.writeByte('"'); |
| 1120 | 1120 | switch (size) { |
| 1121 | 1121 | .@"1" => try std.zig.stringEscape(without_null, w), |
lib/compiler/aro/aro/text_literal.zig+1-1| ... | ... | @@ -508,7 +508,7 @@ pub const Parser = struct { |
| 508 | 508 | }, |
| 509 | 509 | }; |
| 510 | 510 | for (slice) |c| { |
| 511 | const char = std.fmt.charToDigit(c, @intFromEnum(base)) catch break; | |
| 511 | const char = std.fmt.charToDigit(c, @backingInt(base)) catch break; | |
| 512 | 512 | val, const overflow = @shlWithOverflow(val, base.log2()); |
| 513 | 513 | if (overflow != 0) overflowed = true; |
| 514 | 514 | val += char; |
lib/compiler/aro/assembly_backend/x86_64.zig+1-1| ... | ... | @@ -166,7 +166,7 @@ fn genDecls(c: *AsmCodeGen) !void { |
| 166 | 166 | if (c.tree.comp.code_gen_options.debug != .strip) { |
| 167 | 167 | const sources = c.tree.comp.sources.values(); |
| 168 | 168 | for (sources) |source| { |
| 169 | try c.data.print(" .file {d} \"{s}\"\n", .{ @intFromEnum(source.id.index) + 1, source.path }); | |
| 169 | try c.data.print(" .file {d} \"{s}\"\n", .{ @backingInt(source.id.index) + 1, source.path }); | |
| 170 | 170 | } |
| 171 | 171 | } |
| 172 | 172 |
lib/compiler/aro/backend/Interner.zig+6-6| ... | ... | @@ -22,7 +22,7 @@ const KeyAdapter = struct { |
| 22 | 22 | |
| 23 | 23 | pub fn eql(adapter: KeyAdapter, a: Key, b_void: void, b_map_index: usize) bool { |
| 24 | 24 | _ = b_void; |
| 25 | return adapter.interner.get(@as(Ref, @enumFromInt(b_map_index))).eql(a); | |
| 25 | return adapter.interner.get(@as(Ref, @fromBackingInt(@intCast(b_map_index)))).eql(a); | |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | pub fn hash(adapter: KeyAdapter, a: Key) u32 { |
| ... | ... | @@ -582,7 +582,7 @@ pub fn put(i: *Interner, gpa: Allocator, key: Key) !Ref { |
| 582 | 582 | if (key.toRef()) |some| return some; |
| 583 | 583 | const adapter: KeyAdapter = .{ .interner = i }; |
| 584 | 584 | const gop = try i.map.getOrPutAdapted(gpa, key, adapter); |
| 585 | if (gop.found_existing) return @enumFromInt(gop.index); | |
| 585 | if (gop.found_existing) return @fromBackingInt(@intCast(gop.index)); | |
| 586 | 586 | try i.items.ensureUnusedCapacity(gpa, 1); |
| 587 | 587 | |
| 588 | 588 | switch (key) { |
| ... | ... | @@ -751,7 +751,7 @@ pub fn put(i: *Interner, gpa: Allocator, key: Key) !Ref { |
| 751 | 751 | => unreachable, |
| 752 | 752 | } |
| 753 | 753 | |
| 754 | return @enumFromInt(gop.index); | |
| 754 | return @fromBackingInt(@intCast(gop.index)); | |
| 755 | 755 | } |
| 756 | 756 | |
| 757 | 757 | fn addExtra(i: *Interner, gpa: Allocator, extra: anytype) Allocator.Error!u32 { |
| ... | ... | @@ -765,7 +765,7 @@ fn addExtraAssumeCapacity(i: *Interner, extra: anytype) u32 { |
| 765 | 765 | const info = @typeInfo(@TypeOf(extra)).@"struct"; |
| 766 | 766 | inline for (info.field_names, info.field_types) |field_name, field_type| { |
| 767 | 767 | i.extra.appendAssumeCapacity(switch (field_type) { |
| 768 | Ref => @intFromEnum(@field(extra, field_name)), | |
| 768 | Ref => @backingInt(@field(extra, field_name)), | |
| 769 | 769 | u32 => @field(extra, field_name), |
| 770 | 770 | else => @compileError("bad field type: " ++ @typeName(field_type)), |
| 771 | 771 | }); |
| ... | ... | @@ -800,7 +800,7 @@ pub fn get(i: *const Interner, ref: Ref) Key { |
| 800 | 800 | else => {}, |
| 801 | 801 | } |
| 802 | 802 | |
| 803 | const item = i.items.get(@intFromEnum(ref)); | |
| 803 | const item = i.items.get(@backingInt(ref)); | |
| 804 | 804 | const data = item.data; |
| 805 | 805 | return switch (item.tag) { |
| 806 | 806 | .int_ty => .{ .int_ty = @intCast(data) }, |
| ... | ... | @@ -896,7 +896,7 @@ fn extraDataTrail(i: *const Interner, comptime T: type, index: usize) struct { d |
| 896 | 896 | inline for (info.field_names, info.field_types, 0..) |field_name, field_type, field_i| { |
| 897 | 897 | const int32 = i.extra.items[field_i + index]; |
| 898 | 898 | @field(result, field_name) = switch (field_type) { |
| 899 | Ref => @enumFromInt(int32), | |
| 899 | Ref => @fromBackingInt(@intCast(int32)), | |
| 900 | 900 | u32 => int32, |
| 901 | 901 | else => @compileError("bad field type: " ++ @typeName(field_type)), |
| 902 | 902 | }; |
lib/compiler/aro/backend/Ir.zig+14-14| ... | ... | @@ -81,7 +81,7 @@ pub const Builder = struct { |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | pub fn addArg(b: *Builder, ty: Interner.Ref) Allocator.Error!Ref { |
| 84 | const ref: Ref = @enumFromInt(b.instructions.len); | |
| 84 | const ref: Ref = @fromBackingInt(@intCast(b.instructions.len)); | |
| 85 | 85 | try b.instructions.append(b.gpa, .{ .tag = .arg, .data = .{ .none = {} }, .ty = ty }); |
| 86 | 86 | try b.body.insert(b.gpa, b.arg_count, ref); |
| 87 | 87 | b.arg_count += 1; |
| ... | ... | @@ -89,7 +89,7 @@ pub const Builder = struct { |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | pub fn addAlloc(b: *Builder, size: u32, @"align": u32) Allocator.Error!Ref { |
| 92 | const ref: Ref = @enumFromInt(b.instructions.len); | |
| 92 | const ref: Ref = @fromBackingInt(@intCast(b.instructions.len)); | |
| 93 | 93 | try b.instructions.append(b.gpa, .{ |
| 94 | 94 | .tag = .alloc, |
| 95 | 95 | .data = .{ .alloc = .{ .size = size, .@"align" = @"align" } }, |
| ... | ... | @@ -101,14 +101,14 @@ pub const Builder = struct { |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | pub fn addInst(b: *Builder, tag: Ir.Inst.Tag, data: Ir.Inst.Data, ty: Interner.Ref) Allocator.Error!Ref { |
| 104 | const ref: Ref = @enumFromInt(b.instructions.len); | |
| 104 | const ref: Ref = @fromBackingInt(@intCast(b.instructions.len)); | |
| 105 | 105 | try b.instructions.append(b.gpa, .{ .tag = tag, .data = data, .ty = ty }); |
| 106 | 106 | try b.body.append(b.gpa, ref); |
| 107 | 107 | return ref; |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | pub fn makeLabel(b: *Builder, name: [*:0]const u8) Allocator.Error!Ref { |
| 111 | const ref: Ref = @enumFromInt(b.instructions.len); | |
| 111 | const ref: Ref = @fromBackingInt(@intCast(b.instructions.len)); | |
| 112 | 112 | try b.instructions.append(b.gpa, .{ .tag = .label, .data = .{ .label = name }, .ty = .void }); |
| 113 | 113 | return ref; |
| 114 | 114 | } |
| ... | ... | @@ -146,7 +146,7 @@ pub const Builder = struct { |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | pub fn addConstant(b: *Builder, val: Interner.Ref, ty: Interner.Ref) Allocator.Error!Ref { |
| 149 | const ref: Ref = @enumFromInt(b.instructions.len); | |
| 149 | const ref: Ref = @fromBackingInt(@intCast(b.instructions.len)); | |
| 150 | 150 | try b.instructions.append(b.gpa, .{ |
| 151 | 151 | .tag = .constant, |
| 152 | 152 | .data = .{ .constant = val }, |
| ... | ... | @@ -158,7 +158,7 @@ pub const Builder = struct { |
| 158 | 158 | pub fn addPhi(b: *Builder, inputs: []const Inst.Phi.Input, ty: Interner.Ref) Allocator.Error!Ref { |
| 159 | 159 | const a = b.arena.allocator(); |
| 160 | 160 | const input_refs = try a.alloc(Ref, inputs.len * 2 + 1); |
| 161 | input_refs[0] = @enumFromInt(inputs.len); | |
| 161 | input_refs[0] = @fromBackingInt(@intCast(inputs.len)); | |
| 162 | 162 | @memcpy(input_refs[1..], std.mem.bytesAsSlice(Ref, std.mem.sliceAsBytes(inputs))); |
| 163 | 163 | |
| 164 | 164 | return b.addInst(.phi, .{ .phi = .{ .ptr = input_refs.ptr } }, ty); |
| ... | ... | @@ -359,7 +359,7 @@ pub const Inst = struct { |
| 359 | 359 | }; |
| 360 | 360 | |
| 361 | 361 | pub fn inputs(p: Phi) []Input { |
| 362 | const len = @intFromEnum(p.ptr[0]) * 2; | |
| 362 | const len = @backingInt(p.ptr[0]) * 2; | |
| 363 | 363 | const slice = (p.ptr + 1)[0..len]; |
| 364 | 364 | return std.mem.bytesAsSlice(Input, std.mem.sliceAsBytes(slice)); |
| 365 | 365 | } |
| ... | ... | @@ -403,8 +403,8 @@ fn dumpDecl(ir: *const Ir, decl: *const Decl, gpa: Allocator, name: []const u8, |
| 403 | 403 | defer label_map.deinit(gpa); |
| 404 | 404 | |
| 405 | 405 | const ret_inst = decl.body.items[decl.body.items.len - 1]; |
| 406 | const ret_operand = data[@intFromEnum(ret_inst)].un; | |
| 407 | const ret_ty = decl.instructions.items(.ty)[@intFromEnum(ret_operand)]; | |
| 406 | const ret_operand = data[@backingInt(ret_inst)].un; | |
| 407 | const ret_ty = decl.instructions.items(.ty)[@backingInt(ret_operand)]; | |
| 408 | 408 | try ir.writeType(ret_ty, term); |
| 409 | 409 | try term.setColor(REF); |
| 410 | 410 | try w.print(" @{s}", .{name}); |
| ... | ... | @@ -414,7 +414,7 @@ fn dumpDecl(ir: *const Ir, decl: *const Decl, gpa: Allocator, name: []const u8, |
| 414 | 414 | var arg_count: u32 = 0; |
| 415 | 415 | while (true) : (arg_count += 1) { |
| 416 | 416 | const ref = decl.body.items[arg_count]; |
| 417 | if (tags[@intFromEnum(ref)] != .arg) break; | |
| 417 | if (tags[@backingInt(ref)] != .arg) break; | |
| 418 | 418 | if (arg_count != 0) try w.writeAll(", "); |
| 419 | 419 | try ref_map.put(gpa, ref, {}); |
| 420 | 420 | try ir.writeRef(decl, &ref_map, ref, term); |
| ... | ... | @@ -422,14 +422,14 @@ fn dumpDecl(ir: *const Ir, decl: *const Decl, gpa: Allocator, name: []const u8, |
| 422 | 422 | } |
| 423 | 423 | try w.writeAll(") {\n"); |
| 424 | 424 | for (decl.body.items[arg_count..]) |ref| { |
| 425 | switch (tags[@intFromEnum(ref)]) { | |
| 425 | switch (tags[@backingInt(ref)]) { | |
| 426 | 426 | .label => try label_map.put(gpa, ref, {}), |
| 427 | 427 | else => {}, |
| 428 | 428 | } |
| 429 | 429 | } |
| 430 | 430 | |
| 431 | 431 | for (decl.body.items[arg_count..]) |ref| { |
| 432 | const i = @intFromEnum(ref); | |
| 432 | const i = @backingInt(ref); | |
| 433 | 433 | const tag = tags[i]; |
| 434 | 434 | switch (tag) { |
| 435 | 435 | .arg, .constant, .symbol => unreachable, |
| ... | ... | @@ -664,7 +664,7 @@ fn writeValue(ir: Ir, val: Interner.Ref, term: std.Io.Terminal) !void { |
| 664 | 664 | fn writeRef(ir: Ir, decl: *const Decl, ref_map: *RefMap, ref: Ref, term: std.Io.Terminal) !void { |
| 665 | 665 | const w = term.writer; |
| 666 | 666 | assert(ref != .none); |
| 667 | const index = @intFromEnum(ref); | |
| 667 | const index = @backingInt(ref); | |
| 668 | 668 | const ty_ref = decl.instructions.items(.ty)[index]; |
| 669 | 669 | if (decl.instructions.items(.tag)[index] == .constant) { |
| 670 | 670 | try ir.writeType(ty_ref, term); |
| ... | ... | @@ -698,7 +698,7 @@ fn writeNewRef(ir: Ir, gpa: Allocator, decl: *const Decl, ref_map: *RefMap, ref: |
| 698 | 698 | fn writeLabel(decl: *const Decl, label_map: *RefMap, ref: Ref, term: std.Io.Terminal) !void { |
| 699 | 699 | const w = term.writer; |
| 700 | 700 | assert(ref != .none); |
| 701 | const index = @intFromEnum(ref); | |
| 701 | const index = @backingInt(ref); | |
| 702 | 702 | const label = decl.instructions.items(.data)[index].label; |
| 703 | 703 | try term.setColor(REF); |
| 704 | 704 | const label_index = label_map.getIndex(ref).?; |
lib/compiler/objcopy.zig+2-2| ... | ... | @@ -600,7 +600,7 @@ const HexWriter = struct { |
| 600 | 600 | const parts = addressParts(self.address); |
| 601 | 601 | sum +%= parts[0]; |
| 602 | 602 | sum +%= parts[1]; |
| 603 | sum +%= @intFromEnum(self.payload); | |
| 603 | sum +%= @backingInt(self.payload); | |
| 604 | 604 | for (payload_bytes) |byte| { |
| 605 | 605 | sum +%= byte; |
| 606 | 606 | } |
| ... | ... | @@ -618,7 +618,7 @@ const HexWriter = struct { |
| 618 | 618 | const line = try std.fmt.bufPrint(&outbuf, ":{0X:0>2}{1X:0>4}{2X:0>2}{3X}{4X:0>2}" ++ linesep, .{ |
| 619 | 619 | @as(u8, @intCast(payload_bytes.len)), |
| 620 | 620 | self.address, |
| 621 | @intFromEnum(self.payload), | |
| 621 | @backingInt(self.payload), | |
| 622 | 622 | payload_bytes, |
| 623 | 623 | self.checksum(), |
| 624 | 624 | }); |
lib/compiler/objdump.zig+12-12| ... | ... | @@ -594,7 +594,7 @@ const coff = struct { |
| 594 | 594 | |
| 595 | 595 | const member_sig = try r.peek(4); |
| 596 | 596 | const machine: std.coff.IMAGE.FILE.MACHINE = |
| 597 | @enumFromInt(std.mem.readInt(u16, member_sig[0..2], .little)); | |
| 597 | @fromBackingInt(@intCast(std.mem.readInt(u16, member_sig[0..2], .little))); | |
| 598 | 598 | const sig = std.mem.readInt(u16, member_sig[2..4], .little); |
| 599 | 599 | |
| 600 | 600 | const is_imp_lib = machine == std.coff.IMAGE.FILE.MACHINE.UNKNOWN and sig == 0xffff; |
| ... | ... | @@ -723,7 +723,7 @@ const coff = struct { |
| 723 | 723 | if (d.opts.file_headers and d.element(.@"header-name")) |
| 724 | 724 | try w.writeAll("COFF Optional Header:\n"); |
| 725 | 725 | |
| 726 | const magic: std.coff.OptionalHeader.Magic = @enumFromInt(try r.peekInt(u16, .little)); | |
| 726 | const magic: std.coff.OptionalHeader.Magic = @fromBackingInt(@intCast(try r.peekInt(u16, .little))); | |
| 727 | 727 | const num_directory_entries, const image_base = switch (magic) { |
| 728 | 728 | inline .PE32, .@"PE32+" => |v| num_data_dirs: { |
| 729 | 729 | const OptionalHeader = if (v == .PE32) |
| ... | ... | @@ -795,7 +795,7 @@ const coff = struct { |
| 795 | 795 | if (d.opts.file_headers) |
| 796 | 796 | try w.print( |
| 797 | 797 | "{x: >16} {x: >8} {t}\n", |
| 798 | .{ dir.virtual_address, dir.size, @as(DIRECTORY_ENTRY, @enumFromInt(dir_i)) }, | |
| 798 | .{ dir.virtual_address, dir.size, @as(DIRECTORY_ENTRY, @fromBackingInt(@intCast(dir_i))) }, | |
| 799 | 799 | ); |
| 800 | 800 | } |
| 801 | 801 | if (d.opts.file_headers and d.element(.newlines)) try w.writeByte('\n'); |
| ... | ... | @@ -980,7 +980,7 @@ const coff = struct { |
| 980 | 980 | .ABSOLUTE => w.writeAll(" ABS"), |
| 981 | 981 | .DEBUG => w.writeAll("DEBUG"), |
| 982 | 982 | else => |v| { |
| 983 | const backing = @intFromEnum(v); | |
| 983 | const backing = @backingInt(v); | |
| 984 | 984 | const fmt = "{x: >5}"; |
| 985 | 985 | if (backing >= 0) |
| 986 | 986 | try w.print(fmt, .{@as(u15, @intCast(backing))}) |
| ... | ... | @@ -1009,7 +1009,7 @@ const coff = struct { |
| 1009 | 1009 | .complex_type = .FUNCTION, |
| 1010 | 1010 | .base_type = .NULL, |
| 1011 | 1011 | } and |
| 1012 | @intFromEnum(symbol.section_number) > 0) | |
| 1012 | @backingInt(symbol.section_number) > 0) | |
| 1013 | 1013 | { |
| 1014 | 1014 | try w.writeAll("TODO function aux symbol"); |
| 1015 | 1015 | } else if (symbol.type == std.coff.SymType{ |
| ... | ... | @@ -1064,10 +1064,10 @@ const coff = struct { |
| 1064 | 1064 | symbol.value == 0 and |
| 1065 | 1065 | switch (symbol.section_number) { |
| 1066 | 1066 | .UNDEFINED, .DEBUG, .ABSOLUTE => false, |
| 1067 | else => |sn| @intFromEnum(sn) > 0, | |
| 1067 | else => |sn| @backingInt(sn) > 0, | |
| 1068 | 1068 | }) |
| 1069 | 1069 | { |
| 1070 | const section_i: u15 = @intCast(@intFromEnum(symbol.section_number) - 1); | |
| 1070 | const section_i: u15 = @intCast(@backingInt(symbol.section_number) - 1); | |
| 1071 | 1071 | try w.writeAll(" Section "); |
| 1072 | 1072 | |
| 1073 | 1073 | if (section_i >= sections.items.len) { |
| ... | ... | @@ -1160,7 +1160,7 @@ const coff = struct { |
| 1160 | 1160 | void => try w.writeAll("(unknown arch)"), |
| 1161 | 1161 | else => |RelocationType| try w.print( |
| 1162 | 1162 | "{t: <17} ", |
| 1163 | .{@as(RelocationType, @enumFromInt(reloc.type))}, | |
| 1163 | .{@as(RelocationType, @fromBackingInt(@intCast(reloc.type)))}, | |
| 1164 | 1164 | ), |
| 1165 | 1165 | }, |
| 1166 | 1166 | } |
| ... | ... | @@ -1263,7 +1263,7 @@ const coff = struct { |
| 1263 | 1263 | |
| 1264 | 1264 | // All the variable length fields should be contained within this directory. |
| 1265 | 1265 | // Read it entirely to avoid needing to seek per-name when iterating. |
| 1266 | const dir = image_info.?.data_dirs[@intFromEnum(DIRECTORY_ENTRY.EXPORT)]; | |
| 1266 | const dir = image_info.?.data_dirs[@backingInt(DIRECTORY_ENTRY.EXPORT)]; | |
| 1267 | 1267 | const dir_end_rva = dir.virtual_address + dir.size; |
| 1268 | 1268 | const dir_loc = fr.logicalPos(); |
| 1269 | 1269 | const dir_slice = try r.readAlloc(gpa, dir.size); |
| ... | ... | @@ -1533,8 +1533,8 @@ const coff = struct { |
| 1533 | 1533 | data_dirs: []const std.coff.ImageDataDirectory, |
| 1534 | 1534 | entry: DIRECTORY_ENTRY, |
| 1535 | 1535 | ) !?u16 { |
| 1536 | if (@intFromEnum(entry) < data_dirs.len) blk: { | |
| 1537 | const rva = data_dirs[@intFromEnum(entry)].virtual_address; | |
| 1536 | if (@backingInt(entry) < data_dirs.len) blk: { | |
| 1537 | const rva = data_dirs[@backingInt(entry)].virtual_address; | |
| 1538 | 1538 | if (rva == 0) break :blk; |
| 1539 | 1539 | |
| 1540 | 1540 | const section_index = sectionContainingRva(rva_index, sections, rva) orelse |
| ... | ... | @@ -1603,7 +1603,7 @@ const coff = struct { |
| 1603 | 1603 | .ABSOLUTE => w.writeAll(" ABS"), |
| 1604 | 1604 | .DEBUG => w.writeAll("DEBUG"), |
| 1605 | 1605 | else => |v| { |
| 1606 | const backing = @intFromEnum(v); | |
| 1606 | const backing = @backingInt(v); | |
| 1607 | 1607 | const fmt = "{x: >5}"; |
| 1608 | 1608 | if (backing >= 0) |
| 1609 | 1609 | try w.print(fmt, .{@as(u15, @intCast(backing))}) |
lib/compiler/reduce.zig+1-1| ... | ... | @@ -198,7 +198,7 @@ pub fn main(init: std.process.Init) !void { |
| 198 | 198 | |
| 199 | 199 | if (zir.hasCompileErrors()) { |
| 200 | 200 | more_fixups.clearRetainingCapacity(); |
| 201 | const payload_index = zir.extra[@intFromEnum(Zir.ExtraIndex.compile_errors)]; | |
| 201 | const payload_index = zir.extra[@backingInt(Zir.ExtraIndex.compile_errors)]; | |
| 202 | 202 | assert(payload_index != 0); |
| 203 | 203 | const header = zir.extraData(Zir.Inst.CompileErrors, payload_index); |
| 204 | 204 | var extra_index = header.end; |
lib/compiler/resinator/bmp.zig+1-1| ... | ... | @@ -124,7 +124,7 @@ pub fn read(reader: *std.Io.Reader, max_size: u64) ReadError!BitmapInfo { |
| 124 | 124 | |
| 125 | 125 | bitmap_info.colors_in_palette = try dib_header.numColorsInTable(); |
| 126 | 126 | bitmap_info.bytes_per_color_palette_element = 4; |
| 127 | bitmap_info.compression = @enumFromInt(dib_header.biCompression); | |
| 127 | bitmap_info.compression = @fromBackingInt(@intCast(dib_header.biCompression)); | |
| 128 | 128 | |
| 129 | 129 | if (bitmap_info.getByteLenBetweenHeadersAndPixels() < bitmap_info.getBitmasksByteLen()) { |
| 130 | 130 | return error.MissingBitfieldMasks; |
lib/compiler/resinator/cli.zig+1-1| ... | ... | @@ -369,7 +369,7 @@ pub const Options = struct { |
| 369 | 369 | try writer.print("Default language: {s} (id=0x{x})\n", .{ language_name, language_id }); |
| 370 | 370 | |
| 371 | 371 | const code_page = self.default_code_page orelse .windows1252; |
| 372 | try writer.print("Default codepage: {s} (id={})\n", .{ @tagName(code_page), @intFromEnum(code_page) }); | |
| 372 | try writer.print("Default codepage: {s} (id={})\n", .{ @tagName(code_page), @backingInt(code_page) }); | |
| 373 | 373 | } |
| 374 | 374 | }; |
| 375 | 375 |
lib/compiler/resinator/code_pages.zig+2-2| ... | ... | @@ -191,7 +191,7 @@ pub const CodePage = blk: { |
| 191 | 191 | |
| 192 | 192 | pub fn isSupported(code_page: CodePage) bool { |
| 193 | 193 | inline for (@typeInfo(SupportedCodePage).@"enum".field_names) |field_name| { |
| 194 | if (@intFromEnum(code_page) == @intFromEnum(@field(SupportedCodePage, field_name))) { | |
| 194 | if (@backingInt(code_page) == @backingInt(@field(SupportedCodePage, field_name))) { | |
| 195 | 195 | return true; |
| 196 | 196 | } |
| 197 | 197 | } |
| ... | ... | @@ -213,7 +213,7 @@ pub fn getByIdentifier(identifier: u16) !CodePage { |
| 213 | 213 | pub fn getByIdentifierEnsureSupported(identifier: u16) !SupportedCodePage { |
| 214 | 214 | const code_page = try getByIdentifier(identifier); |
| 215 | 215 | return if (isSupported(code_page)) |
| 216 | @enumFromInt(@intFromEnum(code_page)) | |
| 216 | @fromBackingInt(@intCast(@backingInt(code_page))) | |
| 217 | 217 | else |
| 218 | 218 | error.UnsupportedCodePage; |
| 219 | 219 | } |
lib/compiler/resinator/compile.zig+8-8| ... | ... | @@ -606,7 +606,7 @@ pub const Compiler = struct { |
| 606 | 606 | .GROUP_CURSOR => .ANICURSOR, |
| 607 | 607 | else => unreachable, |
| 608 | 608 | }; |
| 609 | header.type_value.ordinal = @intFromEnum(new_predefined_type); | |
| 609 | header.type_value.ordinal = @backingInt(new_predefined_type); | |
| 610 | 610 | header.memory_flags = MemoryFlags.defaults(new_predefined_type); |
| 611 | 611 | header.applyMemoryFlags(node.common_resource_attributes, self.source); |
| 612 | 612 | header.data_size = std.math.cast(u32, try file_reader.getSize()) orelse { |
| ... | ... | @@ -668,7 +668,7 @@ pub const Compiler = struct { |
| 668 | 668 | applyToGroupMemoryFlags(&header.memory_flags, node.common_resource_attributes, self.source); |
| 669 | 669 | |
| 670 | 670 | const first_icon_id = self.state.icon_id; |
| 671 | const entry_type = if (predefined_type == .GROUP_ICON) @intFromEnum(res.RT.ICON) else @intFromEnum(res.RT.CURSOR); | |
| 671 | const entry_type = if (predefined_type == .GROUP_ICON) @backingInt(res.RT.ICON) else @backingInt(res.RT.CURSOR); | |
| 672 | 672 | for (icon_dir.entries, 0..) |*entry, entry_i_usize| { |
| 673 | 673 | // We know that the entry index must fit within a u16, so |
| 674 | 674 | // cast it here to simplify usage sites. |
| ... | ... | @@ -1909,7 +1909,7 @@ pub const Compiler = struct { |
| 1909 | 1909 | } |
| 1910 | 1910 | |
| 1911 | 1911 | if (res.ControlClass.fromControl(control_type)) |control_class| { |
| 1912 | const ordinal = NameOrOrdinal{ .ordinal = @intFromEnum(control_class) }; | |
| 1912 | const ordinal = NameOrOrdinal{ .ordinal = @backingInt(control_class) }; | |
| 1913 | 1913 | try ordinal.write(data_writer); |
| 1914 | 1914 | } else { |
| 1915 | 1915 | const class_node = control.class.?; |
| ... | ... | @@ -1944,7 +1944,7 @@ pub const Compiler = struct { |
| 1944 | 1944 | const parsed = try self.parseQuotedStringAsWideString(literal_node.token); |
| 1945 | 1945 | defer self.allocator.free(parsed); |
| 1946 | 1946 | if (rc.ControlClass.fromWideString(parsed)) |control_class| { |
| 1947 | const ordinal = NameOrOrdinal{ .ordinal = @intFromEnum(control_class) }; | |
| 1947 | const ordinal = NameOrOrdinal{ .ordinal = @backingInt(control_class) }; | |
| 1948 | 1948 | try ordinal.write(data_writer); |
| 1949 | 1949 | } else { |
| 1950 | 1950 | // NUL acts as a terminator |
| ... | ... | @@ -1959,7 +1959,7 @@ pub const Compiler = struct { |
| 1959 | 1959 | const literal_slice = literal_node.token.slice(self.source); |
| 1960 | 1960 | // This succeeding is guaranteed by the parser |
| 1961 | 1961 | const control_class = rc.ControlClass.map.get(literal_slice) orelse unreachable; |
| 1962 | const ordinal = NameOrOrdinal{ .ordinal = @intFromEnum(control_class) }; | |
| 1962 | const ordinal = NameOrOrdinal{ .ordinal = @backingInt(control_class) }; | |
| 1963 | 1963 | try ordinal.write(data_writer); |
| 1964 | 1964 | } |
| 1965 | 1965 | } |
| ... | ... | @@ -2620,7 +2620,7 @@ pub const Compiler = struct { |
| 2620 | 2620 | const type_value = type: { |
| 2621 | 2621 | const resource_type = ResourceType.fromString(type_bytes); |
| 2622 | 2622 | if (res.RT.fromResource(resource_type)) |rt_constant| { |
| 2623 | break :type NameOrOrdinal{ .ordinal = @intFromEnum(rt_constant) }; | |
| 2623 | break :type NameOrOrdinal{ .ordinal = @backingInt(rt_constant) }; | |
| 2624 | 2624 | } else { |
| 2625 | 2625 | break :type try NameOrOrdinal.fromString(allocator, type_bytes); |
| 2626 | 2626 | } |
| ... | ... | @@ -2974,7 +2974,7 @@ pub const FontDir = struct { |
| 2974 | 2974 | |
| 2975 | 2975 | var header = Compiler.ResourceHeader{ |
| 2976 | 2976 | .name_value = try NameOrOrdinal.nameFromString(compiler.allocator, .{ .slice = "FONTDIR", .code_page = .windows1252 }), |
| 2977 | .type_value = NameOrOrdinal{ .ordinal = @intFromEnum(res.RT.FONTDIR) }, | |
| 2977 | .type_value = NameOrOrdinal{ .ordinal = @backingInt(res.RT.FONTDIR) }, | |
| 2978 | 2978 | .memory_flags = res.MemoryFlags.defaults(res.RT.FONTDIR), |
| 2979 | 2979 | .language = compiler.state.language, |
| 2980 | 2980 | .version = compiler.state.version, |
| ... | ... | @@ -3230,7 +3230,7 @@ pub const StringTable = struct { |
| 3230 | 3230 | |
| 3231 | 3231 | const header = Compiler.ResourceHeader{ |
| 3232 | 3232 | .name_value = .{ .ordinal = block_id }, |
| 3233 | .type_value = .{ .ordinal = @intFromEnum(res.RT.STRING) }, | |
| 3233 | .type_value = .{ .ordinal = @backingInt(res.RT.STRING) }, | |
| 3234 | 3234 | .memory_flags = self.memory_flags, |
| 3235 | 3235 | .language = language, |
| 3236 | 3236 | .version = self.version, |
lib/compiler/resinator/cvtres.zig+15-15| ... | ... | @@ -40,7 +40,7 @@ pub const Resource = struct { |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | pub fn isDlgInclude(resource: Resource) bool { |
| 43 | return resource.type_value == .ordinal and resource.type_value.ordinal == @intFromEnum(res.RT.DLGINCLUDE); | |
| 43 | return resource.type_value == .ordinal and resource.type_value.ordinal == @backingInt(res.RT.DLGINCLUDE); | |
| 44 | 44 | } |
| 45 | 45 | }; |
| 46 | 46 | |
| ... | ... | @@ -306,7 +306,7 @@ pub fn writeCoff( |
| 306 | 306 | try writeSymbol(writer, .{ |
| 307 | 307 | .name = ".rsrc$01".*, |
| 308 | 308 | .value = 0, |
| 309 | .section_number = @enumFromInt(1), | |
| 309 | .section_number = @fromBackingInt(@intCast(1)), | |
| 310 | 310 | .type = .{ |
| 311 | 311 | .base_type = .NULL, |
| 312 | 312 | .complex_type = .NULL, |
| ... | ... | @@ -327,7 +327,7 @@ pub fn writeCoff( |
| 327 | 327 | try writeSymbol(writer, .{ |
| 328 | 328 | .name = ".rsrc$02".*, |
| 329 | 329 | .value = 0, |
| 330 | .section_number = @enumFromInt(2), | |
| 330 | .section_number = @fromBackingInt(@intCast(2)), | |
| 331 | 331 | .type = .{ |
| 332 | 332 | .base_type = .NULL, |
| 333 | 333 | .complex_type = .NULL, |
| ... | ... | @@ -383,10 +383,10 @@ pub fn writeCoff( |
| 383 | 383 | fn writeSymbol(writer: *std.Io.Writer, symbol: std.coff.Symbol) !void { |
| 384 | 384 | try writer.writeAll(&symbol.name); |
| 385 | 385 | try writer.writeInt(u32, symbol.value, .little); |
| 386 | try writer.writeInt(i16, @intFromEnum(symbol.section_number), .little); | |
| 387 | try writer.writeInt(u8, @intFromEnum(symbol.type.base_type), .little); | |
| 388 | try writer.writeInt(u8, @intFromEnum(symbol.type.complex_type), .little); | |
| 389 | try writer.writeInt(u8, @intFromEnum(symbol.storage_class), .little); | |
| 386 | try writer.writeInt(i16, @backingInt(symbol.section_number), .little); | |
| 387 | try writer.writeInt(u8, @backingInt(symbol.type.base_type), .little); | |
| 388 | try writer.writeInt(u8, @backingInt(symbol.type.complex_type), .little); | |
| 389 | try writer.writeInt(u8, @backingInt(symbol.storage_class), .little); | |
| 390 | 390 | try writer.writeInt(u8, symbol.number_of_aux_symbols, .little); |
| 391 | 391 | } |
| 392 | 392 | |
| ... | ... | @@ -396,7 +396,7 @@ fn writeSectionDefinition(writer: *std.Io.Writer, def: std.coff.SectionDefinitio |
| 396 | 396 | try writer.writeInt(u16, def.number_of_linenumbers, .little); |
| 397 | 397 | try writer.writeInt(u32, def.checksum, .little); |
| 398 | 398 | try writer.writeInt(u16, def.number, .little); |
| 399 | try writer.writeInt(u8, @intFromEnum(def.selection), .little); | |
| 399 | try writer.writeInt(u8, @backingInt(def.selection), .little); | |
| 400 | 400 | try writer.writeAll(&def.unused); |
| 401 | 401 | } |
| 402 | 402 | |
| ... | ... | @@ -890,7 +890,7 @@ const ResourceTree = struct { |
| 890 | 890 | symbols[i] = .{ |
| 891 | 891 | .name = name_buf, |
| 892 | 892 | .value = relocation.data_offset, |
| 893 | .section_number = @enumFromInt(2), | |
| 893 | .section_number = @fromBackingInt(@intCast(2)), | |
| 894 | 894 | .type = .{ |
| 895 | 895 | .base_type = .NULL, |
| 896 | 896 | .complex_type = .NULL, |
| ... | ... | @@ -1056,7 +1056,7 @@ pub const supported_targets = struct { |
| 1056 | 1056 | comptime { |
| 1057 | 1057 | const info = @typeInfo(Arch).@"enum"; |
| 1058 | 1058 | for (info.field_names, info.field_values) |field_name, field_value| { |
| 1059 | _ = std.mem.indexOfScalar(Arch, ordered_for_display, @enumFromInt(field_value)) orelse { | |
| 1059 | _ = std.mem.indexOfScalar(Arch, ordered_for_display, @fromBackingInt(@intCast(field_value))) orelse { | |
| 1060 | 1060 | @compileError(std.fmt.comptimePrint("'{s}' missing from ordered_for_display", .{field_name})); |
| 1061 | 1061 | }; |
| 1062 | 1062 | } |
| ... | ... | @@ -1089,11 +1089,11 @@ pub const supported_targets = struct { |
| 1089 | 1089 | // https://learn.microsoft.com/en-us/windows/win32/debug/pe-format#type-indicators |
| 1090 | 1090 | pub fn rvaRelocationTypeIndicator(target: std.coff.IMAGE.FILE.MACHINE) ?u16 { |
| 1091 | 1091 | return switch (target) { |
| 1092 | .AMD64 => @intFromEnum(std.coff.IMAGE.REL.AMD64.ADDR32NB), | |
| 1093 | .I386 => @intFromEnum(std.coff.IMAGE.REL.I386.DIR32NB), | |
| 1094 | .ARMNT => @intFromEnum(std.coff.IMAGE.REL.ARM.ADDR32NB), | |
| 1095 | .ARM64, .ARM64EC, .ARM64X => @intFromEnum(std.coff.IMAGE.REL.ARM64.ADDR32NB), | |
| 1096 | .IA64 => @intFromEnum(std.coff.IMAGE.REL.IA64.DIR32NB), | |
| 1092 | .AMD64 => @backingInt(std.coff.IMAGE.REL.AMD64.ADDR32NB), | |
| 1093 | .I386 => @backingInt(std.coff.IMAGE.REL.I386.DIR32NB), | |
| 1094 | .ARMNT => @backingInt(std.coff.IMAGE.REL.ARM.ADDR32NB), | |
| 1095 | .ARM64, .ARM64EC, .ARM64X => @backingInt(std.coff.IMAGE.REL.ARM64.ADDR32NB), | |
| 1096 | .IA64 => @backingInt(std.coff.IMAGE.REL.IA64.DIR32NB), | |
| 1097 | 1097 | .EBC => 0x1, // This is what cvtres.exe writes for this target, unsure where it comes from |
| 1098 | 1098 | else => null, |
| 1099 | 1099 | }; |
lib/compiler/resinator/ico.zig+1-1| ... | ... | @@ -123,7 +123,7 @@ pub const IconDir = struct { |
| 123 | 123 | |
| 124 | 124 | pub fn writeResData(self: IconDir, writer: *std.Io.Writer, first_image_id: u16) !void { |
| 125 | 125 | try writer.writeInt(u16, 0, .little); |
| 126 | try writer.writeInt(u16, @intFromEnum(self.image_type), .little); | |
| 126 | try writer.writeInt(u16, @backingInt(self.image_type), .little); | |
| 127 | 127 | // We know that entries.len must fit into a u16 |
| 128 | 128 | try writer.writeInt(u16, @as(u16, @intCast(self.entries.len)), .little); |
| 129 | 129 |
lib/compiler/resinator/lang.zig+1-1| ... | ... | @@ -74,7 +74,7 @@ test parseInt { |
| 74 | 74 | pub fn tagToInt(tag: []const u8) error{InvalidLanguageTag}!u16 { |
| 75 | 75 | const maybe_id = try tagToId(tag); |
| 76 | 76 | if (maybe_id) |id| { |
| 77 | return @intFromEnum(id); | |
| 77 | return @backingInt(id); | |
| 78 | 78 | } else { |
| 79 | 79 | return LOCALE_CUSTOM_UNSPECIFIED; |
| 80 | 80 | } |
lib/compiler/resinator/parse.zig+4-4| ... | ... | @@ -151,7 +151,7 @@ pub const Parser = struct { |
| 151 | 151 | }; |
| 152 | 152 | try self.nextToken(.normal); |
| 153 | 153 | |
| 154 | const type_i = @intFromEnum(optional_statement_type); | |
| 154 | const type_i = @backingInt(optional_statement_type); | |
| 155 | 155 | if (last_statement_per_type[type_i] != null) { |
| 156 | 156 | statement_type_has_duplicates[type_i] = true; |
| 157 | 157 | } |
| ... | ... | @@ -300,13 +300,13 @@ pub const Parser = struct { |
| 300 | 300 | const slice = statement_identifier.slice(self.lexer.buffer); |
| 301 | 301 | const optional_statement_type = rc.OptionalStatements.map.get(slice) orelse |
| 302 | 302 | rc.OptionalStatements.dialog_map.get(slice).?; |
| 303 | break :type_i @intFromEnum(optional_statement_type); | |
| 303 | break :type_i @backingInt(optional_statement_type); | |
| 304 | 304 | }, |
| 305 | 305 | .font_statement => { |
| 306 | break :type_i @intFromEnum(rc.OptionalStatements.font); | |
| 306 | break :type_i @backingInt(rc.OptionalStatements.font); | |
| 307 | 307 | }, |
| 308 | 308 | .language_statement => { |
| 309 | break :type_i @intFromEnum(rc.OptionalStatements.language); | |
| 309 | break :type_i @backingInt(rc.OptionalStatements.language); | |
| 310 | 310 | }, |
| 311 | 311 | else => unreachable, |
| 312 | 312 | } |
lib/compiler/resinator/rc.zig+8-8| ... | ... | @@ -76,7 +76,7 @@ pub const ResourceType = enum { |
| 76 | 76 | const maybe_ordinal = res.NameOrOrdinal.maybeOrdinalFromString(bytes); |
| 77 | 77 | if (maybe_ordinal) |ordinal| { |
| 78 | 78 | if (ordinal.ordinal >= 256) return .user_defined; |
| 79 | return fromRT(@enumFromInt(ordinal.ordinal)); | |
| 79 | return fromRT(@fromBackingInt(@intCast(ordinal.ordinal))); | |
| 80 | 80 | } |
| 81 | 81 | return map.get(bytes.slice) orelse .user_defined; |
| 82 | 82 | } |
| ... | ... | @@ -133,13 +133,13 @@ pub const ResourceType = enum { |
| 133 | 133 | .toolbar, .versioninfo, .vxd => @tagName(resource), |
| 134 | 134 | // zig fmt: on |
| 135 | 135 | .user_defined => "user-defined", |
| 136 | .cursor_num => std.fmt.comptimePrint("{d} (cursor)", .{@intFromEnum(res.RT.CURSOR)}), | |
| 137 | .icon_num => std.fmt.comptimePrint("{d} (icon)", .{@intFromEnum(res.RT.ICON)}), | |
| 138 | .string_num => std.fmt.comptimePrint("{d} (string)", .{@intFromEnum(res.RT.STRING)}), | |
| 139 | .anicursor_num => std.fmt.comptimePrint("{d} (anicursor)", .{@intFromEnum(res.RT.ANICURSOR)}), | |
| 140 | .aniicon_num => std.fmt.comptimePrint("{d} (aniicon)", .{@intFromEnum(res.RT.ANIICON)}), | |
| 141 | .fontdir_num => std.fmt.comptimePrint("{d} (fontdir)", .{@intFromEnum(res.RT.FONTDIR)}), | |
| 142 | .manifest_num => std.fmt.comptimePrint("{d} (manifest)", .{@intFromEnum(res.RT.MANIFEST)}), | |
| 136 | .cursor_num => std.fmt.comptimePrint("{d} (cursor)", .{@backingInt(res.RT.CURSOR)}), | |
| 137 | .icon_num => std.fmt.comptimePrint("{d} (icon)", .{@backingInt(res.RT.ICON)}), | |
| 138 | .string_num => std.fmt.comptimePrint("{d} (string)", .{@backingInt(res.RT.STRING)}), | |
| 139 | .anicursor_num => std.fmt.comptimePrint("{d} (anicursor)", .{@backingInt(res.RT.ANICURSOR)}), | |
| 140 | .aniicon_num => std.fmt.comptimePrint("{d} (aniicon)", .{@backingInt(res.RT.ANIICON)}), | |
| 141 | .fontdir_num => std.fmt.comptimePrint("{d} (fontdir)", .{@backingInt(res.RT.FONTDIR)}), | |
| 142 | .manifest_num => std.fmt.comptimePrint("{d} (manifest)", .{@backingInt(res.RT.MANIFEST)}), | |
| 143 | 143 | }; |
| 144 | 144 | } |
| 145 | 145 | }; |
lib/compiler/resinator/res.zig+2-2| ... | ... | @@ -407,7 +407,7 @@ pub const NameOrOrdinal = union(enum) { |
| 407 | 407 | switch (self) { |
| 408 | 408 | .ordinal => |ordinal| { |
| 409 | 409 | if (ordinal >= 256) return null; |
| 410 | switch (@as(RT, @enumFromInt(ordinal))) { | |
| 410 | switch (@as(RT, @fromBackingInt(@intCast(ordinal)))) { | |
| 411 | 411 | .ACCELERATOR, |
| 412 | 412 | .ANICURSOR, |
| 413 | 413 | .ANIICON, |
| ... | ... | @@ -456,7 +456,7 @@ pub const NameOrOrdinal = union(enum) { |
| 456 | 456 | try w.print("{f}", .{std.unicode.fmtUtf16Le(name)}); |
| 457 | 457 | }, |
| 458 | 458 | .ordinal => |ordinal| { |
| 459 | if (std.enums.tagName(RT, @enumFromInt(ordinal))) |predefined_type_name| { | |
| 459 | if (std.enums.tagName(RT, @fromBackingInt(@intCast(ordinal)))) |predefined_type_name| { | |
| 460 | 460 | try w.print("{s}", .{predefined_type_name}); |
| 461 | 461 | } else { |
| 462 | 462 | try w.print("{d}", .{ordinal}); |
lib/compiler/test_runner.zig+5-5| ... | ... | @@ -187,7 +187,7 @@ fn mainServer(init: std.process.Init.Minimal) !void { |
| 187 | 187 | defer io_instance.deinit(); |
| 188 | 188 | const io = io_instance.io(); |
| 189 | 189 | |
| 190 | const mode: fuzz_abi.LimitKind = @enumFromInt(try server.receiveBody_u8()); | |
| 190 | const mode: fuzz_abi.LimitKind = @fromBackingInt(@intCast(try server.receiveBody_u8())); | |
| 191 | 191 | const amount_or_instance = try server.receiveBody_u64(); |
| 192 | 192 | const main_instance = mode == .iterations or amount_or_instance == 0; |
| 193 | 193 | |
| ... | ... | @@ -249,7 +249,7 @@ fn mainServer(init: std.process.Init.Minimal) !void { |
| 249 | 249 | }, |
| 250 | 250 | |
| 251 | 251 | else => { |
| 252 | std.debug.print("unsupported message: {x}\n", .{@intFromEnum(hdr.tag)}); | |
| 252 | std.debug.print("unsupported message: {x}\n", .{@backingInt(hdr.tag)}); | |
| 253 | 253 | std.process.exit(1); |
| 254 | 254 | }, |
| 255 | 255 | } |
| ... | ... | @@ -351,10 +351,10 @@ pub fn log( |
| 351 | 351 | args: anytype, |
| 352 | 352 | ) void { |
| 353 | 353 | @disableInstrumentation(); |
| 354 | if (@intFromEnum(message_level) <= @intFromEnum(std.log.Level.err)) { | |
| 354 | if (@backingInt(message_level) <= @backingInt(std.log.Level.err)) { | |
| 355 | 355 | log_err_count +|= 1; |
| 356 | 356 | } |
| 357 | if (@intFromEnum(message_level) <= @intFromEnum(testing.log_level)) { | |
| 357 | if (@backingInt(message_level) <= @backingInt(testing.log_level)) { | |
| 358 | 358 | std.debug.print( |
| 359 | 359 | "[" ++ @tagName(scope) ++ "] (" ++ @tagName(message_level) ++ "): " ++ format ++ "\n", |
| 360 | 360 | args, |
| ... | ... | @@ -513,7 +513,7 @@ var fuzz_runner: if (builtin.fuzz) struct { |
| 513 | 513 | while (true) { |
| 514 | 514 | const hdr = try server.receiveMessage(); |
| 515 | 515 | if (hdr.tag != .new_fuzz_input) { |
| 516 | panic("unexpected message: {x}\n", .{@intFromEnum(hdr.tag)}); | |
| 516 | panic("unexpected message: {x}\n", .{@backingInt(hdr.tag)}); | |
| 517 | 517 | } |
| 518 | 518 | const test_i = try server.receiveBody_u32(); |
| 519 | 519 | const input_len = hdr.bytes_len - 4; |
lib/compiler/translate-c/ast.zig+10-10| ... | ... | @@ -252,7 +252,7 @@ pub const Node = extern union { |
| 252 | 252 | root_ref, |
| 253 | 253 | |
| 254 | 254 | pub const last_no_payload_tag = Tag.@"break"; |
| 255 | pub const no_payload_count = @intFromEnum(last_no_payload_tag) + 1; | |
| 255 | pub const no_payload_count = @backingInt(last_no_payload_tag) + 1; | |
| 256 | 256 | |
| 257 | 257 | pub fn Type(comptime t: Tag) type { |
| 258 | 258 | return switch (t) { |
| ... | ... | @@ -416,8 +416,8 @@ pub const Node = extern union { |
| 416 | 416 | } |
| 417 | 417 | |
| 418 | 418 | pub fn init(comptime t: Tag) Node { |
| 419 | comptime std.debug.assert(@intFromEnum(t) < Tag.no_payload_count); | |
| 420 | return .{ .tag_if_small_enough = @intFromEnum(t) }; | |
| 419 | comptime std.debug.assert(@backingInt(t) < Tag.no_payload_count); | |
| 420 | return .{ .tag_if_small_enough = @backingInt(t) }; | |
| 421 | 421 | } |
| 422 | 422 | |
| 423 | 423 | pub fn create(comptime t: Tag, ally: Allocator, data: Data(t)) error{OutOfMemory}!Node { |
| ... | ... | @@ -436,7 +436,7 @@ pub const Node = extern union { |
| 436 | 436 | |
| 437 | 437 | pub fn tag(self: Node) Tag { |
| 438 | 438 | if (self.tag_if_small_enough < Tag.no_payload_count) { |
| 439 | return @enumFromInt(@as(std.meta.Tag(Tag), @intCast(self.tag_if_small_enough))); | |
| 439 | return @fromBackingInt(@intCast(@as(std.meta.Tag(Tag), @intCast(self.tag_if_small_enough)))); | |
| 440 | 440 | } else { |
| 441 | 441 | return self.ptr_otherwise.tag; |
| 442 | 442 | } |
| ... | ... | @@ -453,7 +453,7 @@ pub const Node = extern union { |
| 453 | 453 | } |
| 454 | 454 | |
| 455 | 455 | pub fn initPayload(payload: *Payload) Node { |
| 456 | std.debug.assert(@intFromEnum(payload.tag) >= Tag.no_payload_count); | |
| 456 | std.debug.assert(@backingInt(payload.tag) >= Tag.no_payload_count); | |
| 457 | 457 | return .{ .ptr_otherwise = payload }; |
| 458 | 458 | } |
| 459 | 459 | |
| ... | ... | @@ -913,13 +913,13 @@ const Context = struct { |
| 913 | 913 | fn listToSpan(c: *Context, list: []const NodeIndex) Allocator.Error!NodeSubRange { |
| 914 | 914 | try c.extra_data.appendSlice(c.gpa, @ptrCast(list)); |
| 915 | 915 | return .{ |
| 916 | .start = @enumFromInt(c.extra_data.items.len - list.len), | |
| 917 | .end = @enumFromInt(c.extra_data.items.len), | |
| 916 | .start = @fromBackingInt(@intCast(c.extra_data.items.len - list.len)), | |
| 917 | .end = @fromBackingInt(@intCast(c.extra_data.items.len)), | |
| 918 | 918 | }; |
| 919 | 919 | } |
| 920 | 920 | |
| 921 | 921 | fn addNode(c: *Context, elem: std.zig.Ast.Node) Allocator.Error!NodeIndex { |
| 922 | const result: NodeIndex = @enumFromInt(c.nodes.len); | |
| 922 | const result: NodeIndex = @fromBackingInt(@intCast(c.nodes.len)); | |
| 923 | 923 | try c.nodes.append(c.gpa, elem); |
| 924 | 924 | return result; |
| 925 | 925 | } |
| ... | ... | @@ -927,14 +927,14 @@ const Context = struct { |
| 927 | 927 | fn addExtra(c: *Context, extra: anytype) Allocator.Error!std.zig.Ast.ExtraIndex { |
| 928 | 928 | const info = @typeInfo(@TypeOf(extra)).@"struct"; |
| 929 | 929 | try c.extra_data.ensureUnusedCapacity(c.gpa, info.field_names.len); |
| 930 | const result: std.zig.Ast.ExtraIndex = @enumFromInt(c.extra_data.items.len); | |
| 930 | const result: std.zig.Ast.ExtraIndex = @fromBackingInt(@intCast(c.extra_data.items.len)); | |
| 931 | 931 | inline for (info.field_names, info.field_types) |field_name, field_type| { |
| 932 | 932 | const data: u32 = switch (field_type) { |
| 933 | 933 | NodeIndex, |
| 934 | 934 | std.zig.Ast.Node.OptionalIndex, |
| 935 | 935 | std.zig.Ast.OptionalTokenIndex, |
| 936 | 936 | std.zig.Ast.ExtraIndex, |
| 937 | => @intFromEnum(@field(extra, field_name)), | |
| 937 | => @backingInt(@field(extra, field_name)), | |
| 938 | 938 | TokenIndex, |
| 939 | 939 | => @field(extra, field_name), |
| 940 | 940 | else => @compileError("unexpected field type"), |
lib/compiler/translate-c/main.zig+1-1| ... | ... | @@ -189,7 +189,7 @@ fn translate(d: *aro.Driver, tc: *aro.Toolchain, args: []const [:0]const u8, zig |
| 189 | 189 | if (val_str.len != 1 or val_str[0] < '0' or val_str[0] > '3') { |
| 190 | 190 | return d.fatal("-fstrict-flex-arrays= requires a value of '0', '1', '2', or '3'", .{}); |
| 191 | 191 | } |
| 192 | strict_flex_arrays = @enumFromInt(val_str[0] - '0'); | |
| 192 | strict_flex_arrays = @fromBackingInt(@intCast(val_str[0] - '0')); | |
| 193 | 193 | } else { |
| 194 | 194 | aro_args.appendAssumeCapacity(arg); |
| 195 | 195 | } |
lib/compiler_rt/cmpdf2.zig+1-1| ... | ... | @@ -25,7 +25,7 @@ comptime { |
| 25 | 25 | /// Note that this matches the definition of `__ledf2`, `__eqdf2`, `__nedf2`, `__cmpdf2`, |
| 26 | 26 | /// and `__ltdf2`. |
| 27 | 27 | fn __cmpdf2(a: f64, b: f64) callconv(.c) i32 { |
| 28 | return @intFromEnum(comparef.cmpf2(f64, comparef.LE, a, b)); | |
| 28 | return @backingInt(comparef.cmpf2(f64, comparef.LE, a, b)); | |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | /// "These functions return a value less than or equal to zero if neither argument is NaN, |
lib/compiler_rt/cmptf2.zig+15-15| ... | ... | @@ -41,7 +41,7 @@ comptime { |
| 41 | 41 | /// Note that this matches the definition of `__letf2`, `__eqtf2`, `__netf2`, `__cmptf2`, |
| 42 | 42 | /// and `__lttf2`. |
| 43 | 43 | fn __cmptf2(a: f128, b: f128) callconv(.c) i32 { |
| 44 | return @intFromEnum(comparef.cmpf2(f128, comparef.LE, a, b)); | |
| 44 | return @backingInt(comparef.cmpf2(f128, comparef.LE, a, b)); | |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | /// "These functions return a value less than or equal to zero if neither argument is NaN, |
| ... | ... | @@ -78,68 +78,68 @@ const SparcFCMP = enum(i32) { |
| 78 | 78 | }; |
| 79 | 79 | |
| 80 | 80 | fn _Qp_cmp(a: *const f128, b: *const f128) callconv(.c) i32 { |
| 81 | return @intFromEnum(comparef.cmpf2(f128, SparcFCMP, a.*, b.*)); | |
| 81 | return @backingInt(comparef.cmpf2(f128, SparcFCMP, a.*, b.*)); | |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | fn _Qp_feq(a: *const f128, b: *const f128) callconv(.c) bool { |
| 85 | return @as(SparcFCMP, @enumFromInt(_Qp_cmp(a, b))) == .Equal; | |
| 85 | return @as(SparcFCMP, @fromBackingInt(@intCast(_Qp_cmp(a, b)))) == .Equal; | |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | fn _Qp_fne(a: *const f128, b: *const f128) callconv(.c) bool { |
| 89 | return @as(SparcFCMP, @enumFromInt(_Qp_cmp(a, b))) != .Equal; | |
| 89 | return @as(SparcFCMP, @fromBackingInt(@intCast(_Qp_cmp(a, b)))) != .Equal; | |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | fn _Qp_flt(a: *const f128, b: *const f128) callconv(.c) bool { |
| 93 | return @as(SparcFCMP, @enumFromInt(_Qp_cmp(a, b))) == .Less; | |
| 93 | return @as(SparcFCMP, @fromBackingInt(@intCast(_Qp_cmp(a, b)))) == .Less; | |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | fn _Qp_fgt(a: *const f128, b: *const f128) callconv(.c) bool { |
| 97 | return @as(SparcFCMP, @enumFromInt(_Qp_cmp(a, b))) == .Greater; | |
| 97 | return @as(SparcFCMP, @fromBackingInt(@intCast(_Qp_cmp(a, b)))) == .Greater; | |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | fn _Qp_fge(a: *const f128, b: *const f128) callconv(.c) bool { |
| 101 | return switch (@as(SparcFCMP, @enumFromInt(_Qp_cmp(a, b)))) { | |
| 101 | return switch (@as(SparcFCMP, @fromBackingInt(@intCast(_Qp_cmp(a, b))))) { | |
| 102 | 102 | .Equal, .Greater => true, |
| 103 | 103 | .Less, .Unordered => false, |
| 104 | 104 | }; |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | fn _Qp_fle(a: *const f128, b: *const f128) callconv(.c) bool { |
| 108 | return switch (@as(SparcFCMP, @enumFromInt(_Qp_cmp(a, b)))) { | |
| 108 | return switch (@as(SparcFCMP, @fromBackingInt(@intCast(_Qp_cmp(a, b))))) { | |
| 109 | 109 | .Equal, .Less => true, |
| 110 | 110 | .Greater, .Unordered => false, |
| 111 | 111 | }; |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | fn _Q_cmp(a: f128, b: f128) callconv(.c) i32 { |
| 115 | return @intFromEnum(comparef.cmpf2(f128, SparcFCMP, a, b)); | |
| 115 | return @backingInt(comparef.cmpf2(f128, SparcFCMP, a, b)); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | fn _Q_feq(a: f128, b: f128) callconv(.c) bool { |
| 119 | return @as(SparcFCMP, @enumFromInt(_Q_cmp(a, b))) == .Equal; | |
| 119 | return @as(SparcFCMP, @fromBackingInt(@intCast(_Q_cmp(a, b)))) == .Equal; | |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | fn _Q_fne(a: f128, b: f128) callconv(.c) bool { |
| 123 | return @as(SparcFCMP, @enumFromInt(_Q_cmp(a, b))) != .Equal; | |
| 123 | return @as(SparcFCMP, @fromBackingInt(@intCast(_Q_cmp(a, b)))) != .Equal; | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | fn _Q_flt(a: f128, b: f128) callconv(.c) bool { |
| 127 | return @as(SparcFCMP, @enumFromInt(_Q_cmp(a, b))) == .Less; | |
| 127 | return @as(SparcFCMP, @fromBackingInt(@intCast(_Q_cmp(a, b)))) == .Less; | |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | fn _Q_fgt(a: f128, b: f128) callconv(.c) bool { |
| 131 | return @as(SparcFCMP, @enumFromInt(_Q_cmp(a, b))) == .Greater; | |
| 131 | return @as(SparcFCMP, @fromBackingInt(@intCast(_Q_cmp(a, b)))) == .Greater; | |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | fn _Q_fge(a: f128, b: f128) callconv(.c) bool { |
| 135 | return switch (@as(SparcFCMP, @enumFromInt(_Q_cmp(a, b)))) { | |
| 135 | return switch (@as(SparcFCMP, @fromBackingInt(@intCast(_Q_cmp(a, b))))) { | |
| 136 | 136 | .Equal, .Greater => true, |
| 137 | 137 | .Less, .Unordered => false, |
| 138 | 138 | }; |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | fn _Q_fle(a: f128, b: f128) callconv(.c) bool { |
| 142 | return switch (@as(SparcFCMP, @enumFromInt(_Q_cmp(a, b)))) { | |
| 142 | return switch (@as(SparcFCMP, @fromBackingInt(@intCast(_Q_cmp(a, b))))) { | |
| 143 | 143 | .Equal, .Less => true, |
| 144 | 144 | .Greater, .Unordered => false, |
| 145 | 145 | }; |
lib/compiler_rt/cmpxf2.zig+1-1| ... | ... | @@ -19,7 +19,7 @@ comptime { |
| 19 | 19 | /// Note that this matches the definition of `__lexf2`, `__eqxf2`, `__nexf2`, `__cmpxf2`, |
| 20 | 20 | /// and `__ltxf2`. |
| 21 | 21 | fn __cmpxf2(a: f80, b: f80) callconv(.c) i32 { |
| 22 | return @intFromEnum(comparef.cmp_f80(comparef.LE, a, b)); | |
| 22 | return @backingInt(comparef.cmp_f80(comparef.LE, a, b)); | |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | /// "These functions return a value less than or equal to zero if neither argument is NaN, |
lib/compiler_rt/comparef.zig+2-2| ... | ... | @@ -52,7 +52,7 @@ pub fn __unordtf2(a: f128, b: f128) callconv(.c) i32 { |
| 52 | 52 | /// Note that this matches the definition of `__lesf2`, `__eqsf2`, `__nesf2`, `__cmpsf2`, |
| 53 | 53 | /// and `__ltsf2`. |
| 54 | 54 | fn __cmpsf2(a: f32, b: f32) callconv(.c) i32 { |
| 55 | return @intFromEnum(cmpf2(f32, LE, a, b)); | |
| 55 | return @backingInt(cmpf2(f32, LE, a, b)); | |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | /// "These functions return a value less than or equal to zero if neither argument is NaN, |
| ... | ... | @@ -100,7 +100,7 @@ fn __aeabi_fcmple(a: f32, b: f32) callconv(.{ .arm_aapcs = .{} }) i32 { |
| 100 | 100 | /// Note that this matches the definition of `__lehf2`, `__eqhf2`, `__nehf2`, `__cmphf2`, |
| 101 | 101 | /// and `__lthf2`. |
| 102 | 102 | fn __cmphf2(a: f16, b: f16) callconv(.c) i32 { |
| 103 | return @intFromEnum(cmpf2(f16, LE, a, b)); | |
| 103 | return @backingInt(cmpf2(f16, LE, a, b)); | |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | /// "These functions return a value less than or equal to zero if neither argument is NaN, |
lib/compiler_rt/gedf2.zig+1-1| ... | ... | @@ -17,7 +17,7 @@ comptime { |
| 17 | 17 | /// "These functions return a value greater than or equal to zero if neither |
| 18 | 18 | /// argument is NaN, and a is greater than or equal to b." |
| 19 | 19 | pub fn __gedf2(a: f64, b: f64) callconv(.c) i32 { |
| 20 | return @intFromEnum(comparef.cmpf2(f64, comparef.GE, a, b)); | |
| 20 | return @backingInt(comparef.cmpf2(f64, comparef.GE, a, b)); | |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | /// "These functions return a value greater than zero if neither argument is NaN, |
lib/compiler_rt/gehf2.zig+1-1| ... | ... | @@ -11,7 +11,7 @@ comptime { |
| 11 | 11 | /// "These functions return a value greater than or equal to zero if neither |
| 12 | 12 | /// argument is NaN, and a is greater than or equal to b." |
| 13 | 13 | pub fn __gehf2(a: f16, b: f16) callconv(.c) i32 { |
| 14 | return @intFromEnum(comparef.cmpf2(f16, comparef.GE, a, b)); | |
| 14 | return @backingInt(comparef.cmpf2(f16, comparef.GE, a, b)); | |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | /// "These functions return a value greater than zero if neither argument is NaN, |
lib/compiler_rt/gesf2.zig+1-1| ... | ... | @@ -17,7 +17,7 @@ comptime { |
| 17 | 17 | /// "These functions return a value greater than or equal to zero if neither |
| 18 | 18 | /// argument is NaN, and a is greater than or equal to b." |
| 19 | 19 | pub fn __gesf2(a: f32, b: f32) callconv(.c) i32 { |
| 20 | return @intFromEnum(comparef.cmpf2(f32, comparef.GE, a, b)); | |
| 20 | return @backingInt(comparef.cmpf2(f32, comparef.GE, a, b)); | |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | /// "These functions return a value greater than zero if neither argument is NaN, |
lib/compiler_rt/getf2.zig+1-1| ... | ... | @@ -16,7 +16,7 @@ comptime { |
| 16 | 16 | /// "These functions return a value greater than or equal to zero if neither |
| 17 | 17 | /// argument is NaN, and a is greater than or equal to b." |
| 18 | 18 | fn __getf2(a: f128, b: f128) callconv(.c) i32 { |
| 19 | return @intFromEnum(comparef.cmpf2(f128, comparef.GE, a, b)); | |
| 19 | return @backingInt(comparef.cmpf2(f128, comparef.GE, a, b)); | |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | /// "These functions return a value greater than zero if neither argument is NaN, |
lib/compiler_rt/gexf2.zig+1-1| ... | ... | @@ -7,7 +7,7 @@ comptime { |
| 7 | 7 | } |
| 8 | 8 | |
| 9 | 9 | fn __gexf2(a: f80, b: f80) callconv(.c) i32 { |
| 10 | return @intFromEnum(comparef.cmp_f80(comparef.GE, a, b)); | |
| 10 | return @backingInt(comparef.cmp_f80(comparef.GE, a, b)); | |
| 11 | 11 | } |
| 12 | 12 | |
| 13 | 13 | fn __gtxf2(a: f80, b: f80) callconv(.c) i32 { |
lib/docs/wasm/Decl.zig+2-2| ... | ... | @@ -24,7 +24,7 @@ pub const Index = enum(u32) { |
| 24 | 24 | _, |
| 25 | 25 | |
| 26 | 26 | pub fn get(i: Index) *Decl { |
| 27 | return &Walk.decls.items[@intFromEnum(i)]; | |
| 27 | return &Walk.decls.items[@backingInt(i)]; | |
| 28 | 28 | } |
| 29 | 29 | }; |
| 30 | 30 | |
| ... | ... | @@ -130,7 +130,7 @@ pub fn get_child(decl: *const Decl, name: []const u8) ?Decl.Index { |
| 130 | 130 | // Find a decl with this function as the parent, with a name matching `name` |
| 131 | 131 | for (Walk.decls.items, 0..) |*candidate, i| { |
| 132 | 132 | if (candidate.parent != .none and candidate.parent.get() == decl and std.mem.eql(u8, candidate.extra_info().name, name)) { |
| 133 | return @enumFromInt(i); | |
| 133 | return @fromBackingInt(@intCast(i)); | |
| 134 | 134 | } |
| 135 | 135 | } |
| 136 | 136 |
lib/docs/wasm/Walk.zig+5-5| ... | ... | @@ -68,13 +68,13 @@ pub const File = struct { |
| 68 | 68 | .file = i, |
| 69 | 69 | .parent = parent_decl, |
| 70 | 70 | }); |
| 71 | const decl_index: Decl.Index = @enumFromInt(decls.items.len - 1); | |
| 71 | const decl_index: Decl.Index = @fromBackingInt(@intCast(decls.items.len - 1)); | |
| 72 | 72 | try i.get().node_decls.put(gpa, node, decl_index); |
| 73 | 73 | return decl_index; |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | pub fn get(i: File.Index) *File { |
| 77 | return &files.values()[@intFromEnum(i)]; | |
| 77 | return &files.values()[@backingInt(i)]; | |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | pub fn get_ast(i: File.Index) *Ast { |
| ... | ... | @@ -82,7 +82,7 @@ pub const File = struct { |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | pub fn path(i: File.Index) []const u8 { |
| 85 | return files.keys()[@intFromEnum(i)]; | |
| 85 | return files.keys()[@backingInt(i)]; | |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | pub fn findRootDecl(file_index: File.Index) Decl.Index { |
| ... | ... | @@ -329,7 +329,7 @@ pub const File = struct { |
| 329 | 329 | base_path, file_path, resolved_path, |
| 330 | 330 | }); |
| 331 | 331 | if (files.getIndex(resolved_path)) |imported_file_index| { |
| 332 | return .{ .alias = File.Index.findRootDecl(@enumFromInt(imported_file_index)) }; | |
| 332 | return .{ .alias = File.Index.findRootDecl(@fromBackingInt(@intCast(imported_file_index))) }; | |
| 333 | 333 | } else { |
| 334 | 334 | log.warn("import target '{s}' did not resolve to any file", .{resolved_path}); |
| 335 | 335 | } |
| ... | ... | @@ -388,7 +388,7 @@ pub const ModuleIndex = enum(u32) { |
| 388 | 388 | pub fn add_file(file_name: []const u8, bytes: []u8) !File.Index { |
| 389 | 389 | const ast = try parse(file_name, bytes); |
| 390 | 390 | assert(ast.errors.len == 0); |
| 391 | const file_index: File.Index = @enumFromInt(files.entries.len); | |
| 391 | const file_index: File.Index = @fromBackingInt(@intCast(files.entries.len)); | |
| 392 | 392 | try files.put(gpa, file_name, .{ .ast = ast }); |
| 393 | 393 | |
| 394 | 394 | var w: Walk = .{ |
lib/docs/wasm/main.zig+9-9| ... | ... | @@ -90,7 +90,7 @@ export fn query_exec(ignore_case: bool) [*]Decl.Index { |
| 90 | 90 | query_exec_fallible(query, ignore_case) catch |err| switch (err) { |
| 91 | 91 | error.OutOfMemory => @panic("OOM"), |
| 92 | 92 | }; |
| 93 | query_results.items[0] = @enumFromInt(query_results.items.len - 1); | |
| 93 | query_results.items[0] = @fromBackingInt(@intCast(query_results.items.len - 1)); | |
| 94 | 94 | return query_results.items.ptr; |
| 95 | 95 | } |
| 96 | 96 | |
| ... | ... | @@ -165,7 +165,7 @@ fn query_exec_fallible(query: []const u8, ignore_case: bool) !void { |
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | if (query_results.items.len < max_matched_items or bypass_limit) { |
| 168 | try query_results.append(gpa, @enumFromInt(decl_index)); | |
| 168 | try query_results.append(gpa, @fromBackingInt(@intCast(decl_index))); | |
| 169 | 169 | try g.scores.append(gpa, .{ |
| 170 | 170 | .points = points, |
| 171 | 171 | .segments = @intCast(count_scalar(g.full_path_search_text.items, '.')), |
| ... | ... | @@ -717,8 +717,8 @@ fn render_docs( |
| 717 | 717 | node: markdown.Document.Node.Index, |
| 718 | 718 | writer: *Writer, |
| 719 | 719 | ) Writer.Error!void { |
| 720 | const data = doc.nodes.items(.data)[@intFromEnum(node)]; | |
| 721 | switch (doc.nodes.items(.tag)[@intFromEnum(node)]) { | |
| 720 | const data = doc.nodes.items(.data)[@backingInt(node)]; | |
| 721 | switch (doc.nodes.items(.tag)[@backingInt(node)]) { | |
| 722 | 722 | .code_span => { |
| 723 | 723 | try writer.writeAll("<code>"); |
| 724 | 724 | const content = doc.string(data.text.content); |
| ... | ... | @@ -806,7 +806,7 @@ fn unpackInner(tar_bytes: []u8) !void { |
| 806 | 806 | if (std.mem.indexOfScalar(u8, file_name, '/')) |pkg_name_end| { |
| 807 | 807 | const pkg_name = file_name[0..pkg_name_end]; |
| 808 | 808 | const gop = try Walk.modules.getOrPut(gpa, pkg_name); |
| 809 | const file: Walk.File.Index = @enumFromInt(Walk.files.entries.len); | |
| 809 | const file: Walk.File.Index = @fromBackingInt(@intCast(Walk.files.entries.len)); | |
| 810 | 810 | if (!gop.found_existing or |
| 811 | 811 | std.mem.eql(u8, file_name[pkg_name_end..], "/root.zig") or |
| 812 | 812 | std.mem.eql(u8, file_name[pkg_name_end + 1 .. file_name.len - ".zig".len], pkg_name)) |
| ... | ... | @@ -837,7 +837,7 @@ export fn module_name(index: u32) String { |
| 837 | 837 | } |
| 838 | 838 | |
| 839 | 839 | export fn find_module_root(pkg: Walk.ModuleIndex) Decl.Index { |
| 840 | const root_file = Walk.modules.values()[@intFromEnum(pkg)]; | |
| 840 | const root_file = Walk.modules.values()[@backingInt(pkg)]; | |
| 841 | 841 | const result = root_file.findRootDecl(); |
| 842 | 842 | assert(result != .none); |
| 843 | 843 | return result; |
| ... | ... | @@ -854,7 +854,7 @@ export fn set_input_string(len: usize) [*]u8 { |
| 854 | 854 | /// Looks up the root struct decl corresponding to a file by path. |
| 855 | 855 | /// Uses `input_string`. |
| 856 | 856 | export fn find_file_root() Decl.Index { |
| 857 | const file: Walk.File.Index = @enumFromInt(Walk.files.getIndex(input_string.items) orelse return .none); | |
| 857 | const file: Walk.File.Index = @fromBackingInt(@intCast(Walk.files.getIndex(input_string.items) orelse return .none)); | |
| 858 | 858 | return file.findRootDecl(); |
| 859 | 859 | } |
| 860 | 860 | |
| ... | ... | @@ -874,7 +874,7 @@ export fn find_decl() Decl.Index { |
| 874 | 874 | if (std.mem.eql(u8, g.match_fqn.items, input_string.items)) { |
| 875 | 875 | //const path = @as(Decl.Index, @enumFromInt(decl_index)).get().file.path(); |
| 876 | 876 | //log.debug("find_decl '{s}' found in {s}", .{ input_string.items, path }); |
| 877 | return @enumFromInt(decl_index); | |
| 877 | return @fromBackingInt(@intCast(decl_index)); | |
| 878 | 878 | } |
| 879 | 879 | } |
| 880 | 880 | return .none; |
| ... | ... | @@ -930,7 +930,7 @@ export fn namespace_members(parent: Decl.Index, include_private: bool) Slice(Dec |
| 930 | 930 | for (Walk.decls.items, 0..) |*decl, i| { |
| 931 | 931 | if (decl.parent == parent) { |
| 932 | 932 | if (include_private or decl.is_pub()) { |
| 933 | g.members.append(gpa, @enumFromInt(i)) catch @panic("OOM"); | |
| 933 | g.members.append(gpa, @fromBackingInt(@intCast(i))) catch @panic("OOM"); | |
| 934 | 934 | } |
| 935 | 935 | } |
| 936 | 936 | } |
lib/docs/wasm/markdown/Document.zig+4-4| ... | ... | @@ -126,8 +126,8 @@ pub const Node = struct { |
| 126 | 126 | |
| 127 | 127 | pub fn asNumber(start: ListStart) ?u30 { |
| 128 | 128 | if (start == .unordered) return null; |
| 129 | assert(@intFromEnum(start) <= 999_999_999); | |
| 130 | return @intFromEnum(start); | |
| 129 | assert(@backingInt(start) <= 999_999_999); | |
| 130 | return @backingInt(start); | |
| 131 | 131 | } |
| 132 | 132 | }; |
| 133 | 133 | |
| ... | ... | @@ -171,7 +171,7 @@ pub fn ExtraData(comptime T: type) type { |
| 171 | 171 | |
| 172 | 172 | pub fn extraData(doc: Document, comptime T: type, index: ExtraIndex) ExtraData(T) { |
| 173 | 173 | const info = @typeInfo(T).@"struct"; |
| 174 | var i: usize = @intFromEnum(index); | |
| 174 | var i: usize = @backingInt(index); | |
| 175 | 175 | var result: T = undefined; |
| 176 | 176 | inline for (info.field_names, info.field_types) |field_name, field_type| { |
| 177 | 177 | @field(result, field_name) = switch (field_type) { |
| ... | ... | @@ -189,6 +189,6 @@ pub fn extraChildren(doc: Document, index: ExtraIndex) []const Node.Index { |
| 189 | 189 | } |
| 190 | 190 | |
| 191 | 191 | pub fn string(doc: Document, index: StringIndex) [:0]const u8 { |
| 192 | const start = @intFromEnum(index); | |
| 192 | const start = @backingInt(index); | |
| 193 | 193 | return std.mem.span(@as([*:0]u8, @ptrCast(doc.string_bytes[start..].ptr))); |
| 194 | 194 | } |
lib/docs/wasm/markdown/Parser.zig+10-10| ... | ... | @@ -444,7 +444,7 @@ fn appendBlockStart(p: *Parser, block_start: BlockStart) !void { |
| 444 | 444 | const header_data = datas[p.scratch_extra.getLast().?]; |
| 445 | 445 | for (p.extraChildren(header_data.container.children), 0..) |header_cell, i| { |
| 446 | 446 | const alignment = if (i < alignments.len) alignments[i] else .unset; |
| 447 | const cell_data = &datas[@intFromEnum(header_cell)].table_cell; | |
| 447 | const cell_data = &datas[@backingInt(header_cell)].table_cell; | |
| 448 | 448 | cell_data.info.alignment = alignment; |
| 449 | 449 | cell_data.info.header = true; |
| 450 | 450 | } |
| ... | ... | @@ -847,7 +847,7 @@ fn closeLastBlock(p: *Parser) !void { |
| 847 | 847 | .tag = .list, |
| 848 | 848 | .data = .{ .list = .{ |
| 849 | 849 | .start = switch (b.data.list.marker) { |
| 850 | .number_dot, .number_paren => @enumFromInt(b.data.list.start), | |
| 850 | .number_dot, .number_paren => @fromBackingInt(@intCast(b.data.list.start)), | |
| 851 | 851 | .@"-", .@"*", .@"+" => .unordered, |
| 852 | 852 | }, |
| 853 | 853 | .children = children, |
| ... | ... | @@ -1087,7 +1087,7 @@ const InlineParser = struct { |
| 1087 | 1087 | } |
| 1088 | 1088 | } |
| 1089 | 1089 | try ip.parent.string_bytes.append(ip.parent.allocator, 0); |
| 1090 | return @enumFromInt(string_top); | |
| 1090 | return @fromBackingInt(@intCast(string_top)); | |
| 1091 | 1091 | } |
| 1092 | 1092 | |
| 1093 | 1093 | /// Parses an autolink, starting at the opening `<`. `ip.pos` is left at the |
| ... | ... | @@ -1478,7 +1478,7 @@ const InlineParser = struct { |
| 1478 | 1478 | try ip.parent.addScratchExtraNode(try ip.parent.addNode(.{ |
| 1479 | 1479 | .tag = .text, |
| 1480 | 1480 | .data = .{ .text = .{ |
| 1481 | .content = @enumFromInt(string_start), | |
| 1481 | .content = @fromBackingInt(@intCast(string_start)), | |
| 1482 | 1482 | } }, |
| 1483 | 1483 | })); |
| 1484 | 1484 | string_start = ip.parent.string_bytes.items.len; |
| ... | ... | @@ -1495,7 +1495,7 @@ const InlineParser = struct { |
| 1495 | 1495 | try ip.parent.addScratchExtraNode(try ip.parent.addNode(.{ |
| 1496 | 1496 | .tag = .text, |
| 1497 | 1497 | .data = .{ .text = .{ |
| 1498 | .content = @enumFromInt(string_start), | |
| 1498 | .content = @fromBackingInt(@intCast(string_start)), | |
| 1499 | 1499 | } }, |
| 1500 | 1500 | })); |
| 1501 | 1501 | } |
| ... | ... | @@ -1575,7 +1575,7 @@ fn parseInlines(p: *Parser, content: []const u8) !ExtraIndex { |
| 1575 | 1575 | |
| 1576 | 1576 | pub fn extraData(p: Parser, comptime T: type, index: ExtraIndex) ExtraData(T) { |
| 1577 | 1577 | const info = @typeInfo(T).@"struct"; |
| 1578 | var i: usize = @intFromEnum(index); | |
| 1578 | var i: usize = @backingInt(index); | |
| 1579 | 1579 | var result: T = undefined; |
| 1580 | 1580 | inline for (info.field_names, info.field_types) |field_name, field_type| { |
| 1581 | 1581 | @field(result, field_name) = switch (field_type) { |
| ... | ... | @@ -1593,7 +1593,7 @@ pub fn extraChildren(p: Parser, index: ExtraIndex) []const Node.Index { |
| 1593 | 1593 | } |
| 1594 | 1594 | |
| 1595 | 1595 | fn addNode(p: *Parser, node: Node) !Node.Index { |
| 1596 | const index: Node.Index = @enumFromInt(@as(u32, @intCast(p.nodes.len))); | |
| 1596 | const index: Node.Index = @fromBackingInt(@intCast(@as(u32, @intCast(p.nodes.len)))); | |
| 1597 | 1597 | try p.nodes.append(p.allocator, node); |
| 1598 | 1598 | return index; |
| 1599 | 1599 | } |
| ... | ... | @@ -1601,7 +1601,7 @@ fn addNode(p: *Parser, node: Node) !Node.Index { |
| 1601 | 1601 | fn addString(p: *Parser, s: []const u8) !StringIndex { |
| 1602 | 1602 | if (s.len == 0) return .empty; |
| 1603 | 1603 | |
| 1604 | const index: StringIndex = @enumFromInt(@as(u32, @intCast(p.string_bytes.items.len))); | |
| 1604 | const index: StringIndex = @fromBackingInt(@intCast(@as(u32, @intCast(p.string_bytes.items.len)))); | |
| 1605 | 1605 | try p.string_bytes.ensureUnusedCapacity(p.allocator, s.len + 1); |
| 1606 | 1606 | p.string_bytes.appendSliceAssumeCapacity(s); |
| 1607 | 1607 | p.string_bytes.appendAssumeCapacity(0); |
| ... | ... | @@ -1609,7 +1609,7 @@ fn addString(p: *Parser, s: []const u8) !StringIndex { |
| 1609 | 1609 | } |
| 1610 | 1610 | |
| 1611 | 1611 | fn addExtraChildren(p: *Parser, nodes: []const Node.Index) !ExtraIndex { |
| 1612 | const index: ExtraIndex = @enumFromInt(@as(u32, @intCast(p.extra.items.len))); | |
| 1612 | const index: ExtraIndex = @fromBackingInt(@intCast(@as(u32, @intCast(p.extra.items.len)))); | |
| 1613 | 1613 | try p.extra.ensureUnusedCapacity(p.allocator, nodes.len + 1); |
| 1614 | 1614 | p.extra.appendAssumeCapacity(@intCast(nodes.len)); |
| 1615 | 1615 | p.extra.appendSliceAssumeCapacity(@ptrCast(nodes)); |
| ... | ... | @@ -1617,7 +1617,7 @@ fn addExtraChildren(p: *Parser, nodes: []const Node.Index) !ExtraIndex { |
| 1617 | 1617 | } |
| 1618 | 1618 | |
| 1619 | 1619 | fn addScratchExtraNode(p: *Parser, node: Node.Index) !void { |
| 1620 | try p.scratch_extra.append(p.allocator, @intFromEnum(node)); | |
| 1620 | try p.scratch_extra.append(p.allocator, @backingInt(node)); | |
| 1621 | 1621 | } |
| 1622 | 1622 | |
| 1623 | 1623 | fn addScratchStringLine(p: *Parser, line: []const u8) !void { |
lib/docs/wasm/markdown/renderer.zig+6-6| ... | ... | @@ -31,8 +31,8 @@ pub fn Renderer(comptime Context: type) type { |
| 31 | 31 | node: Node.Index, |
| 32 | 32 | writer: *Writer, |
| 33 | 33 | ) Writer.Error!void { |
| 34 | const data = doc.nodes.items(.data)[@intFromEnum(node)]; | |
| 35 | switch (doc.nodes.items(.tag)[@intFromEnum(node)]) { | |
| 34 | const data = doc.nodes.items(.data)[@backingInt(node)]; | |
| 35 | switch (doc.nodes.items(.tag)[@backingInt(node)]) { | |
| 36 | 36 | .root => { |
| 37 | 37 | for (doc.extraChildren(data.container.children)) |child| { |
| 38 | 38 | try r.renderFn(r, doc, child, writer); |
| ... | ... | @@ -60,8 +60,8 @@ pub fn Renderer(comptime Context: type) type { |
| 60 | 60 | .list_item => { |
| 61 | 61 | try writer.writeAll("<li>"); |
| 62 | 62 | for (doc.extraChildren(data.list_item.children)) |child| { |
| 63 | if (data.list_item.tight and doc.nodes.items(.tag)[@intFromEnum(child)] == .paragraph) { | |
| 64 | const para_data = doc.nodes.items(.data)[@intFromEnum(child)]; | |
| 63 | if (data.list_item.tight and doc.nodes.items(.tag)[@backingInt(child)] == .paragraph) { | |
| 64 | const para_data = doc.nodes.items(.data)[@backingInt(child)]; | |
| 65 | 65 | for (doc.extraChildren(para_data.container.children)) |para_child| { |
| 66 | 66 | try r.renderFn(r, doc, para_child, writer); |
| 67 | 67 | } |
| ... | ... | @@ -191,8 +191,8 @@ pub fn renderInlineNodeText( |
| 191 | 191 | node: Node.Index, |
| 192 | 192 | writer: *Writer, |
| 193 | 193 | ) Writer.Error!void { |
| 194 | const data = doc.nodes.items(.data)[@intFromEnum(node)]; | |
| 195 | switch (doc.nodes.items(.tag)[@intFromEnum(node)]) { | |
| 194 | const data = doc.nodes.items(.data)[@backingInt(node)]; | |
| 195 | switch (doc.nodes.items(.tag)[@backingInt(node)]) { | |
| 196 | 196 | .root, |
| 197 | 197 | .list, |
| 198 | 198 | .list_item, |
lib/fuzzer.zig+29-29| ... | ... | @@ -830,7 +830,7 @@ const Fuzzer = struct { |
| 830 | 830 | .seen_uids = .empty, |
| 831 | 831 | |
| 832 | 832 | .corpus = .empty, |
| 833 | .corpus_pos = @enumFromInt(0), | |
| 833 | .corpus_pos = @fromBackingInt(@intCast(0)), | |
| 834 | 834 | .start_mut_corpus = math.maxInt(u32), |
| 835 | 835 | .dirname = dirname, |
| 836 | 836 | .lock_file = lock_file, |
| ... | ... | @@ -965,14 +965,14 @@ const Fuzzer = struct { |
| 965 | 965 | var i: usize = t.start_mut_corpus; |
| 966 | 966 | while (i < t.corpus.len) { |
| 967 | 967 | if (ref[i].best_i_len == 0) { |
| 968 | f.removeInput(@enumFromInt(i)); | |
| 968 | f.removeInput(@fromBackingInt(@intCast(i))); | |
| 969 | 969 | } else { |
| 970 | 970 | i += 1; |
| 971 | 971 | } |
| 972 | 972 | } |
| 973 | 973 | } |
| 974 | 974 | |
| 975 | t.corpus_pos = @enumFromInt(0); | |
| 975 | t.corpus_pos = @fromBackingInt(@intCast(0)); | |
| 976 | 976 | } |
| 977 | 977 | |
| 978 | 978 | const CorpusFileName = struct { |
| ... | ... | @@ -1084,12 +1084,12 @@ const Fuzzer = struct { |
| 1084 | 1084 | |
| 1085 | 1085 | fn removeBest(f: *Fuzzer, i: Input.Index, best_i: u32) void { |
| 1086 | 1086 | const t = &f.tests[f.test_i]; |
| 1087 | const ref = &t.corpus.items(.ref)[@intFromEnum(i)]; | |
| 1087 | const ref = &t.corpus.items(.ref)[@backingInt(i)]; | |
| 1088 | 1088 | const list_i = mem.indexOfScalar(u32, ref.best_i_buf[0..ref.best_i_len], best_i).?; |
| 1089 | 1089 | ref.best_i_len -= 1; |
| 1090 | 1090 | ref.best_i_buf[list_i] = ref.best_i_buf[ref.best_i_len]; |
| 1091 | 1091 | |
| 1092 | if (ref.best_i_len == 0 and @intFromEnum(i) >= t.start_mut_corpus) { | |
| 1092 | if (ref.best_i_len == 0 and @backingInt(i) >= t.start_mut_corpus) { | |
| 1093 | 1093 | // The input is no longer valuable, so remove it. |
| 1094 | 1094 | f.removeInput(i); |
| 1095 | 1095 | } |
| ... | ... | @@ -1097,10 +1097,10 @@ const Fuzzer = struct { |
| 1097 | 1097 | |
| 1098 | 1098 | fn removeInput(f: *Fuzzer, i: Input.Index) void { |
| 1099 | 1099 | const t = &f.tests[f.test_i]; |
| 1100 | const ref = &t.corpus.items(.ref)[@intFromEnum(i)]; | |
| 1101 | assert(ref.best_i_len == 0 and @intFromEnum(i) >= t.start_mut_corpus); | |
| 1100 | const ref = &t.corpus.items(.ref)[@backingInt(i)]; | |
| 1101 | assert(ref.best_i_len == 0 and @backingInt(i) >= t.start_mut_corpus); | |
| 1102 | 1102 | |
| 1103 | var removed_input = t.corpus.get(@intFromEnum(i)); | |
| 1103 | var removed_input = t.corpus.get(@backingInt(i)); | |
| 1104 | 1104 | for ( |
| 1105 | 1105 | removed_input.data.uid_slices.keys(), |
| 1106 | 1106 | removed_input.data.uid_slices.values(), |
| ... | ... | @@ -1135,18 +1135,18 @@ const Fuzzer = struct { |
| 1135 | 1135 | } |
| 1136 | 1136 | } |
| 1137 | 1137 | removed_input.deinit(); |
| 1138 | t.corpus.swapRemove(@intFromEnum(i)); | |
| 1138 | t.corpus.swapRemove(@backingInt(i)); | |
| 1139 | 1139 | |
| 1140 | if (@intFromEnum(i) != t.corpus.len) { | |
| 1140 | if (@backingInt(i) != t.corpus.len) { | |
| 1141 | 1141 | // The last item was moved so its refs need updated. |
| 1142 | 1142 | // `ref` can be reused since it was a swap remove. |
| 1143 | 1143 | for (ref.best_i_buf[0..ref.best_i_len]) |update_pc_i| { |
| 1144 | 1144 | const best = &t.bests.input_buf[update_pc_i]; |
| 1145 | assert(@intFromEnum(best.min) == t.corpus.len or | |
| 1146 | @intFromEnum(best.max) == t.corpus.len); | |
| 1145 | assert(@backingInt(best.min) == t.corpus.len or | |
| 1146 | @backingInt(best.max) == t.corpus.len); | |
| 1147 | 1147 | |
| 1148 | if (@intFromEnum(best.min) == t.corpus.len) best.min = i; | |
| 1149 | if (@intFromEnum(best.max) == t.corpus.len) best.max = i; | |
| 1148 | if (@backingInt(best.min) == t.corpus.len) best.min = i; | |
| 1149 | if (@backingInt(best.max) == t.corpus.len) best.max = i; | |
| 1150 | 1150 | } |
| 1151 | 1151 | } |
| 1152 | 1152 | |
| ... | ... | @@ -1161,8 +1161,8 @@ const Fuzzer = struct { |
| 1161 | 1161 | }) catch |e| panic("failed to open '{s}': {t}", .{ readlock_name, e }); |
| 1162 | 1162 | defer readlock_file.close(io); |
| 1163 | 1163 | |
| 1164 | const removed_name = removed_cname.inputName(@intFromEnum(i) - t.start_mut_corpus); | |
| 1165 | if (@intFromEnum(i) == t.corpus.len) { | |
| 1164 | const removed_name = removed_cname.inputName(@backingInt(i) - t.start_mut_corpus); | |
| 1165 | if (@backingInt(i) == t.corpus.len) { | |
| 1166 | 1166 | exec.cache_f.deleteFile(io, removed_name) catch |e| panic( |
| 1167 | 1167 | "failed to remove corpus file '{s}': {t}", |
| 1168 | 1168 | .{ removed_name, e }, |
| ... | ... | @@ -1201,7 +1201,7 @@ const Fuzzer = struct { |
| 1201 | 1201 | // omitted (i.e. test corpus inputs and filesystem inputs cannot be dropped) |
| 1202 | 1202 | ) { |
| 1203 | 1203 | f.input_builder.reset(); |
| 1204 | t.corpus_pos = @enumFromInt(0); | |
| 1204 | t.corpus_pos = @fromBackingInt(@intCast(0)); | |
| 1205 | 1205 | return; |
| 1206 | 1206 | } |
| 1207 | 1207 | |
| ... | ... | @@ -1250,7 +1250,7 @@ const Fuzzer = struct { |
| 1250 | 1250 | } |
| 1251 | 1251 | |
| 1252 | 1252 | // Must come after the above since some inputs may be removed |
| 1253 | const input_i: Input.Index = @enumFromInt(t.corpus.len); | |
| 1253 | const input_i: Input.Index = @fromBackingInt(@intCast(t.corpus.len)); | |
| 1254 | 1254 | if (input_i == Input.Index.reserved_start) { |
| 1255 | 1255 | @panic("corpus size limit exceeded"); |
| 1256 | 1256 | } |
| ... | ... | @@ -1295,7 +1295,7 @@ const Fuzzer = struct { |
| 1295 | 1295 | if (best_i_list.items.len == 0 and new_is_mut) { |
| 1296 | 1296 | assert(best_i_list.capacity == 0); |
| 1297 | 1297 | f.input_builder.reset(); |
| 1298 | t.corpus_pos = @enumFromInt(0); | |
| 1298 | t.corpus_pos = @fromBackingInt(@intCast(0)); | |
| 1299 | 1299 | return; |
| 1300 | 1300 | } |
| 1301 | 1301 | |
| ... | ... | @@ -1338,7 +1338,7 @@ const Fuzzer = struct { |
| 1338 | 1338 | _ = @atomicRmw(usize, &exec.seenPcsHeader().unique_runs, .Add, 1, .monotonic); |
| 1339 | 1339 | // Write new input to the cache |
| 1340 | 1340 | var cname: CorpusFileName = .fromTest(t.dirname); |
| 1341 | const name = cname.inputName(@intFromEnum(input_i) - t.start_mut_corpus); | |
| 1341 | const name = cname.inputName(@backingInt(input_i) - t.start_mut_corpus); | |
| 1342 | 1342 | exec.cache_f.writeFile(io, .{ .sub_path = name, .data = bytes, .flags = .{ |
| 1343 | 1343 | .exclusive = true, |
| 1344 | 1344 | } }) catch |e| panic("failed to write corpus file '{s}': {t}", .{ name, e }); |
| ... | ... | @@ -1377,7 +1377,7 @@ const Fuzzer = struct { |
| 1377 | 1377 | |
| 1378 | 1378 | const t = &f.tests[f.test_i]; |
| 1379 | 1379 | const corpus = t.corpus.slice(); |
| 1380 | const corpus_i = @intFromEnum(t.corpus_pos); | |
| 1380 | const corpus_i = @backingInt(t.corpus_pos); | |
| 1381 | 1381 | |
| 1382 | 1382 | var small_entronopy: SmallEntronopy = .{ .bits = f.rngInt(u64) }; |
| 1383 | 1383 | var n_mutate = mutCount(small_entronopy.take(u16)); |
| ... | ... | @@ -1436,8 +1436,8 @@ const Fuzzer = struct { |
| 1436 | 1436 | abi.runner_broadcast_input(f.test_i, .fromSlice(f.mmap_input.inputSlice())); |
| 1437 | 1437 | f.newInput(); |
| 1438 | 1438 | } else { |
| 1439 | assert(@intFromEnum(t.corpus_pos) < t.corpus.len); | |
| 1440 | t.corpus_pos = @enumFromInt((@intFromEnum(t.corpus_pos) + 1) % t.corpus.len); | |
| 1439 | assert(@backingInt(t.corpus_pos) < t.corpus.len); | |
| 1440 | t.corpus_pos = @fromBackingInt(@intCast((@backingInt(t.corpus_pos) + 1) % t.corpus.len)); | |
| 1441 | 1441 | } |
| 1442 | 1442 | f.mmap_input.clearRetainingCapacity(); |
| 1443 | 1443 | } |
| ... | ... | @@ -1669,7 +1669,7 @@ const Fuzzer = struct { |
| 1669 | 1669 | } { |
| 1670 | 1670 | const t = &f.tests[f.test_i]; |
| 1671 | 1671 | const corpus = t.corpus.slice(); |
| 1672 | const corpus_i = @intFromEnum(t.corpus_pos); | |
| 1672 | const corpus_i = @backingInt(t.corpus_pos); | |
| 1673 | 1673 | const data = &corpus.items(.data)[corpus_i]; |
| 1674 | 1674 | var small_entronopy: SmallEntronopy = .{ .bits = f.rngInt(u64) }; |
| 1675 | 1675 | |
| ... | ... | @@ -1689,7 +1689,7 @@ const Fuzzer = struct { |
| 1689 | 1689 | f.uid_data_i.items[uid_i] += 1; |
| 1690 | 1690 | const mut_i = std.simd.firstIndexOfValue( |
| 1691 | 1691 | @as(@Vector(4, u32), f.mut_data.i), |
| 1692 | data_i + @as(u32, @intCast(data.ints.len)) * @intFromEnum(uid.kind), | |
| 1692 | data_i + @as(u32, @intCast(data.ints.len)) * @backingInt(uid.kind), | |
| 1693 | 1693 | ) orelse { |
| 1694 | 1694 | @branchHint(.likely); |
| 1695 | 1695 | switch (uid.kind) { |
| ... | ... | @@ -1918,7 +1918,7 @@ const Fuzzer = struct { |
| 1918 | 1918 | pub fn nextInt(f: *Fuzzer, uid: Uid, weights: []const abi.Weight) u64 { |
| 1919 | 1919 | const t = &f.tests[f.test_i]; |
| 1920 | 1920 | f.req_values += 1; |
| 1921 | if (@intFromEnum(t.corpus_pos) >= @intFromEnum(Input.Index.reserved_start)) { | |
| 1921 | if (@backingInt(t.corpus_pos) >= @backingInt(Input.Index.reserved_start)) { | |
| 1922 | 1922 | @branchHint(.unlikely); |
| 1923 | 1923 | const int = f.bytes_input.valueWeightedWithHash(u64, weights, undefined); |
| 1924 | 1924 | if (t.corpus_pos == .bytes_fresh) { |
| ... | ... | @@ -1942,7 +1942,7 @@ const Fuzzer = struct { |
| 1942 | 1942 | pub fn nextEos(f: *Fuzzer, uid: Uid, weights: []const abi.Weight) bool { |
| 1943 | 1943 | const t = &f.tests[f.test_i]; |
| 1944 | 1944 | f.req_values += 1; |
| 1945 | if (@intFromEnum(t.corpus_pos) >= @intFromEnum(Input.Index.reserved_start)) { | |
| 1945 | if (@backingInt(t.corpus_pos) >= @backingInt(Input.Index.reserved_start)) { | |
| 1946 | 1946 | @branchHint(.unlikely); |
| 1947 | 1947 | const eos = f.bytes_input.eosWeightedWithHash(weights, undefined); |
| 1948 | 1948 | if (t.corpus_pos == .bytes_fresh) { |
| ... | ... | @@ -2059,7 +2059,7 @@ const Fuzzer = struct { |
| 2059 | 2059 | f.req_values += 1; |
| 2060 | 2060 | f.req_bytes +%= @truncate(out.len); // This function should panic since the 32-bit |
| 2061 | 2061 | // data limit is exceeded, so wrapping is fine. |
| 2062 | if (@intFromEnum(t.corpus_pos) >= @intFromEnum(Input.Index.reserved_start)) { | |
| 2062 | if (@backingInt(t.corpus_pos) >= @backingInt(Input.Index.reserved_start)) { | |
| 2063 | 2063 | @branchHint(.unlikely); |
| 2064 | 2064 | f.bytes_input.bytesWeightedWithHash(out, weights, undefined); |
| 2065 | 2065 | if (t.corpus_pos == .bytes_fresh) { |
| ... | ... | @@ -2149,7 +2149,7 @@ const Fuzzer = struct { |
| 2149 | 2149 | ) u32 { |
| 2150 | 2150 | const t = &f.tests[f.test_i]; |
| 2151 | 2151 | f.req_values += 1; |
| 2152 | if (@intFromEnum(t.corpus_pos) >= @intFromEnum(Input.Index.reserved_start)) { | |
| 2152 | if (@backingInt(t.corpus_pos) >= @backingInt(Input.Index.reserved_start)) { | |
| 2153 | 2153 | @branchHint(.unlikely); |
| 2154 | 2154 | const n = f.bytes_input.sliceWeightedWithHash( |
| 2155 | 2155 | buf, |
lib/std/Build.zig+2-2| ... | ... | @@ -145,7 +145,7 @@ pub const Graph = struct { |
| 145 | 145 | |
| 146 | 146 | pub fn addGeneratedFile(graph: *Graph, owner: *Step) Configuration.GeneratedFileIndex { |
| 147 | 147 | graph.generated_files.append(graph.arena, owner) catch @panic("OOM"); |
| 148 | return @enumFromInt(graph.generated_files.items.len - 1); | |
| 148 | return @fromBackingInt(@intCast(graph.generated_files.items.len - 1)); | |
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | pub fn dupeString(graph: *const Graph, bytes: []const u8) []const u8 { |
| ... | ... | @@ -2607,7 +2607,7 @@ pub const LazyPath = union(enum) { |
| 2607 | 2607 | .src_path, .cwd_relative, .relative, .dependency => {}, |
| 2608 | 2608 | .generated => |gen| { |
| 2609 | 2609 | const graph = other_step.owner.graph; |
| 2610 | const generated_owner_step = graph.generated_files.items[@intFromEnum(gen.index)]; | |
| 2610 | const generated_owner_step = graph.generated_files.items[@backingInt(gen.index)]; | |
| 2611 | 2611 | other_step.dependOn(generated_owner_step); |
| 2612 | 2612 | }, |
| 2613 | 2613 | } |
lib/std/Build/Configuration.zig+64-64| ... | ... | @@ -109,7 +109,7 @@ pub const Wip = struct { |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | pub fn hash(ctx: @This(), key: String) u64 { |
| 112 | return std.hash_map.hashString(std.mem.sliceTo(ctx.bytes[@intFromEnum(key)..], 0)); | |
| 112 | return std.hash_map.hashString(std.mem.sliceTo(ctx.bytes[@backingInt(key)..], 0)); | |
| 113 | 113 | } |
| 114 | 114 | }; |
| 115 | 115 | |
| ... | ... | @@ -117,7 +117,7 @@ pub const Wip = struct { |
| 117 | 117 | bytes: []const u8, |
| 118 | 118 | |
| 119 | 119 | pub fn eql(ctx: @This(), a: []const u8, b: String) bool { |
| 120 | return std.mem.eql(u8, a, std.mem.sliceTo(ctx.bytes[@intFromEnum(b)..], 0)); | |
| 120 | return std.mem.eql(u8, a, std.mem.sliceTo(ctx.bytes[@backingInt(b)..], 0)); | |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | pub fn hash(_: @This(), adapted_key: []const u8) u64 { |
| ... | ... | @@ -192,7 +192,7 @@ pub const Wip = struct { |
| 192 | 192 | if (gop.found_existing) return gop.key_ptr.*; |
| 193 | 193 | |
| 194 | 194 | try wip.string_bytes.ensureUnusedCapacity(gpa, bytes.len + 1); |
| 195 | const new_off: String = @enumFromInt(wip.string_bytes.items.len); | |
| 195 | const new_off: String = @fromBackingInt(@intCast(wip.string_bytes.items.len)); | |
| 196 | 196 | |
| 197 | 197 | wip.string_bytes.appendSliceAssumeCapacity(bytes); |
| 198 | 198 | wip.string_bytes.appendAssumeCapacity(0); |
| ... | ... | @@ -213,7 +213,7 @@ pub const Wip = struct { |
| 213 | 213 | const revert_index: u32 = @intCast(wip.extra.items.len); |
| 214 | 214 | const added = try wip.extra.addManyAsSlice(gpa, list.len + 1); |
| 215 | 215 | added[0] = @intCast(list.len); |
| 216 | for (added[1..], list) |*d, s| d.* = @intFromEnum(try addString(wip, s)); | |
| 216 | for (added[1..], list) |*d, s| d.* = @backingInt(try addString(wip, s)); | |
| 217 | 217 | const gop = try wip.dedupe_table.getOrPutContext(gpa, .{ |
| 218 | 218 | .index = revert_index, |
| 219 | 219 | .len = @intCast(added.len), |
| ... | ... | @@ -221,10 +221,10 @@ pub const Wip = struct { |
| 221 | 221 | |
| 222 | 222 | if (gop.found_existing) { |
| 223 | 223 | wip.extra.items.len = revert_index; |
| 224 | return @enumFromInt(gop.key_ptr.index); | |
| 224 | return @fromBackingInt(@intCast(gop.key_ptr.index)); | |
| 225 | 225 | } |
| 226 | 226 | |
| 227 | return @enumFromInt(revert_index); | |
| 227 | return @fromBackingInt(@intCast(revert_index)); | |
| 228 | 228 | } |
| 229 | 229 | |
| 230 | 230 | pub fn addBytes(wip: *Wip, bytes: []const u8) Allocator.Error!Bytes { |
| ... | ... | @@ -296,7 +296,7 @@ pub const Wip = struct { |
| 296 | 296 | .extra = wip.extra.items, |
| 297 | 297 | })); |
| 298 | 298 | if (gop.found_existing) { |
| 299 | wip.extra.items.len = @intFromEnum(result_index); | |
| 299 | wip.extra.items.len = @backingInt(result_index); | |
| 300 | 300 | return .init(gop.key_ptr.*); |
| 301 | 301 | } else { |
| 302 | 302 | return .init(result_index); |
| ... | ... | @@ -371,7 +371,7 @@ pub const Wip = struct { |
| 371 | 371 | .extra = wip.extra.items, |
| 372 | 372 | })); |
| 373 | 373 | if (gop.found_existing) { |
| 374 | wip.extra.items.len = @intFromEnum(result_index); | |
| 374 | wip.extra.items.len = @backingInt(result_index); | |
| 375 | 375 | return gop.key_ptr.*; |
| 376 | 376 | } else { |
| 377 | 377 | return result_index; |
| ... | ... | @@ -410,14 +410,14 @@ pub const Wip = struct { |
| 410 | 410 | |
| 411 | 411 | if (gop.found_existing) { |
| 412 | 412 | wip.extra.items.len = revert_index; |
| 413 | return @enumFromInt(gop.key_ptr.index); | |
| 413 | return @fromBackingInt(@intCast(gop.key_ptr.index)); | |
| 414 | 414 | } |
| 415 | 415 | |
| 416 | return @enumFromInt(new_index); | |
| 416 | return @fromBackingInt(@intCast(new_index)); | |
| 417 | 417 | } |
| 418 | 418 | |
| 419 | 419 | pub fn addExtraReserved(wip: *Wip, comptime T: type, v: T) T.Index { |
| 420 | return @enumFromInt(addExtraReservedErased(wip, T, v)); | |
| 420 | return @fromBackingInt(@intCast(addExtraReservedErased(wip, T, v))); | |
| 421 | 421 | } |
| 422 | 422 | |
| 423 | 423 | pub fn addExtraReservedErased(wip: *Wip, comptime T: type, v: T) u32 { |
| ... | ... | @@ -428,17 +428,17 @@ pub const Wip = struct { |
| 428 | 428 | |
| 429 | 429 | fn addExtraOptionalStringAssumeCapacity(wip: *Wip, optional_string: ?String) void { |
| 430 | 430 | const string = optional_string orelse return; |
| 431 | wip.extra.appendAssumeCapacity(@intFromEnum(string)); | |
| 431 | wip.extra.appendAssumeCapacity(@backingInt(string)); | |
| 432 | 432 | } |
| 433 | 433 | |
| 434 | 434 | pub fn addGeneratedFile(wip: *Wip) GeneratedFileIndex { |
| 435 | 435 | defer wip.next_generated_file_index += 1; |
| 436 | return @enumFromInt(wip.next_generated_file_index); | |
| 436 | return @fromBackingInt(@intCast(wip.next_generated_file_index)); | |
| 437 | 437 | } |
| 438 | 438 | |
| 439 | 439 | /// Returned slice expires upon next append to the configuration. |
| 440 | 440 | pub fn stringSlice(wip: *const Wip, s: String) [:0]const u8 { |
| 441 | const start_slice = wip.string_bytes.items[@intFromEnum(s)..]; | |
| 441 | const start_slice = wip.string_bytes.items[@backingInt(s)..]; | |
| 442 | 442 | return start_slice[0..std.mem.indexOfScalar(u8, start_slice, 0).? :0]; |
| 443 | 443 | } |
| 444 | 444 | }; |
| ... | ... | @@ -503,7 +503,7 @@ pub const Step = extern struct { |
| 503 | 503 | _, |
| 504 | 504 | |
| 505 | 505 | pub fn ptr(i: Index, c: *const Configuration) *const Step { |
| 506 | return &c.steps[@intFromEnum(i)]; | |
| 506 | return &c.steps[@backingInt(i)]; | |
| 507 | 507 | } |
| 508 | 508 | }; |
| 509 | 509 | |
| ... | ... | @@ -1134,7 +1134,7 @@ pub const Step = extern struct { |
| 1134 | 1134 | .undef => .undef, |
| 1135 | 1135 | .defined => .defined, |
| 1136 | 1136 | _ => { |
| 1137 | const value = extraData(c, Value, @intFromEnum(this)); | |
| 1137 | const value = extraData(c, Value, @backingInt(this)); | |
| 1138 | 1138 | return switch (value.flags.tag) { |
| 1139 | 1139 | .ident => .{ .ident = value.ident.value.?.slice(c) }, |
| 1140 | 1140 | .string => .{ .string = value.string.value.?.slice(c) }, |
| ... | ... | @@ -1457,7 +1457,7 @@ pub const Step = extern struct { |
| 1457 | 1457 | }; |
| 1458 | 1458 | |
| 1459 | 1459 | pub fn flags(s: *const Step, c: *const Configuration) Flags { |
| 1460 | return @bitCast(c.extra[@intFromEnum(s.extended)]); | |
| 1460 | return @bitCast(c.extra[@backingInt(s.extended)]); | |
| 1461 | 1461 | } |
| 1462 | 1462 | }; |
| 1463 | 1463 | |
| ... | ... | @@ -1466,12 +1466,12 @@ pub const MaxRss = enum(u32) { |
| 1466 | 1466 | _, |
| 1467 | 1467 | |
| 1468 | 1468 | pub fn toBytes(mr: MaxRss) u64 { |
| 1469 | const x: usize = @intFromEnum(mr); | |
| 1469 | const x: usize = @backingInt(mr); | |
| 1470 | 1470 | return x << 8; |
| 1471 | 1471 | } |
| 1472 | 1472 | |
| 1473 | 1473 | pub fn fromBytes(bytes: u64) MaxRss { |
| 1474 | return @enumFromInt(bytes >> 8); | |
| 1474 | return @fromBackingInt(@intCast(bytes >> 8)); | |
| 1475 | 1475 | } |
| 1476 | 1476 | }; |
| 1477 | 1477 | |
| ... | ... | @@ -1499,7 +1499,7 @@ pub const LazyPath = union(@This().Tag) { |
| 1499 | 1499 | _, |
| 1500 | 1500 | |
| 1501 | 1501 | pub fn get(this: @This(), c: *const Configuration) LazyPath { |
| 1502 | return extraData(c, LazyPath, @intFromEnum(this)); | |
| 1502 | return extraData(c, LazyPath, @backingInt(this)); | |
| 1503 | 1503 | } |
| 1504 | 1504 | }; |
| 1505 | 1505 | |
| ... | ... | @@ -1511,7 +1511,7 @@ pub const LazyPath = union(@This().Tag) { |
| 1511 | 1511 | pub fn unwrap(this: @This()) ?Index { |
| 1512 | 1512 | return switch (this) { |
| 1513 | 1513 | .none => null, |
| 1514 | else => @enumFromInt(@intFromEnum(this)), | |
| 1514 | else => @fromBackingInt(@intCast(@backingInt(this))), | |
| 1515 | 1515 | }; |
| 1516 | 1516 | } |
| 1517 | 1517 | }; |
| ... | ... | @@ -1578,13 +1578,13 @@ pub const OptionalGeneratedFileIndex = enum(u32) { |
| 1578 | 1578 | _, |
| 1579 | 1579 | |
| 1580 | 1580 | pub fn init(i: ?GeneratedFileIndex) OptionalGeneratedFileIndex { |
| 1581 | return @enumFromInt(@intFromEnum(i orelse return .none)); | |
| 1581 | return @fromBackingInt(@intCast(@backingInt(i orelse return .none))); | |
| 1582 | 1582 | } |
| 1583 | 1583 | |
| 1584 | 1584 | pub fn unwrap(this: @This()) ?GeneratedFileIndex { |
| 1585 | 1585 | return switch (this) { |
| 1586 | 1586 | .none => null, |
| 1587 | else => @enumFromInt(@intFromEnum(this)), | |
| 1587 | else => @fromBackingInt(@intCast(@backingInt(this))), | |
| 1588 | 1588 | }; |
| 1589 | 1589 | } |
| 1590 | 1590 | }; |
| ... | ... | @@ -1601,7 +1601,7 @@ pub const Package = struct { |
| 1601 | 1601 | /// Returns `null` for root package. |
| 1602 | 1602 | pub fn get(i: @This(), c: *const Configuration) ?Package { |
| 1603 | 1603 | if (i == .root) return null; |
| 1604 | return extraData(c, Package, @intFromEnum(i)); | |
| 1604 | return extraData(c, Package, @backingInt(i)); | |
| 1605 | 1605 | } |
| 1606 | 1606 | |
| 1607 | 1607 | pub fn depPrefixSlice(i: @This(), c: *const Configuration) [:0]const u8 { |
| ... | ... | @@ -1616,7 +1616,7 @@ pub const Package = struct { |
| 1616 | 1616 | _, |
| 1617 | 1617 | |
| 1618 | 1618 | pub fn init(i: Index) OptionalIndex { |
| 1619 | const result: OptionalIndex = @enumFromInt(@intFromEnum(i)); | |
| 1619 | const result: OptionalIndex = @fromBackingInt(@intCast(@backingInt(i))); | |
| 1620 | 1620 | assert(result != .none); |
| 1621 | 1621 | return result; |
| 1622 | 1622 | } |
| ... | ... | @@ -1625,7 +1625,7 @@ pub const Package = struct { |
| 1625 | 1625 | return switch (this) { |
| 1626 | 1626 | .none => null, |
| 1627 | 1627 | .root => .root, |
| 1628 | _ => @enumFromInt(@intFromEnum(this)), | |
| 1628 | _ => @fromBackingInt(@intCast(@backingInt(this))), | |
| 1629 | 1629 | }; |
| 1630 | 1630 | } |
| 1631 | 1631 | }; |
| ... | ... | @@ -1710,7 +1710,7 @@ pub const Module = struct { |
| 1710 | 1710 | _, |
| 1711 | 1711 | |
| 1712 | 1712 | pub fn get(this: @This(), c: *const Configuration) Module { |
| 1713 | return extraData(c, Module, @intFromEnum(this)); | |
| 1713 | return extraData(c, Module, @backingInt(this)); | |
| 1714 | 1714 | } |
| 1715 | 1715 | }; |
| 1716 | 1716 | |
| ... | ... | @@ -1802,7 +1802,7 @@ pub const ImportTable = struct { |
| 1802 | 1802 | pub fn get(this: @This(), c: *const Configuration) ImportTable { |
| 1803 | 1803 | return switch (this) { |
| 1804 | 1804 | .invalid => unreachable, |
| 1805 | _ => extraData(c, ImportTable, @intFromEnum(this)), | |
| 1805 | _ => extraData(c, ImportTable, @backingInt(this)), | |
| 1806 | 1806 | }; |
| 1807 | 1807 | } |
| 1808 | 1808 | }; |
| ... | ... | @@ -1815,7 +1815,7 @@ pub const Deps = struct { |
| 1815 | 1815 | _, |
| 1816 | 1816 | |
| 1817 | 1817 | pub fn get(this: @This(), c: *const Configuration) Deps { |
| 1818 | return extraData(c, Deps, @intFromEnum(this)); | |
| 1818 | return extraData(c, Deps, @backingInt(this)); | |
| 1819 | 1819 | } |
| 1820 | 1820 | |
| 1821 | 1821 | pub fn slice(this: @This(), c: *const Configuration) []const Step.Index { |
| ... | ... | @@ -1839,8 +1839,8 @@ pub const StringList = enum(u32) { |
| 1839 | 1839 | _, |
| 1840 | 1840 | |
| 1841 | 1841 | pub fn slice(this: @This(), c: *const Configuration) []const String { |
| 1842 | const len = c.extra[@intFromEnum(this)]; | |
| 1843 | return @ptrCast(c.extra[@intFromEnum(this) + 1 ..][0..len]); | |
| 1842 | const len = c.extra[@backingInt(this)]; | |
| 1843 | return @ptrCast(c.extra[@backingInt(this) + 1 ..][0..len]); | |
| 1844 | 1844 | } |
| 1845 | 1845 | }; |
| 1846 | 1846 | |
| ... | ... | @@ -1850,14 +1850,14 @@ pub const OptionalStringList = enum(u32) { |
| 1850 | 1850 | |
| 1851 | 1851 | pub fn init(opt_string_list: ?StringList) OptionalStringList { |
| 1852 | 1852 | const sl = opt_string_list orelse return .none; |
| 1853 | const result: OptionalStringList = @enumFromInt(@intFromEnum(sl)); | |
| 1853 | const result: OptionalStringList = @fromBackingInt(@intCast(@backingInt(sl))); | |
| 1854 | 1854 | assert(result != .none); |
| 1855 | 1855 | return result; |
| 1856 | 1856 | } |
| 1857 | 1857 | |
| 1858 | 1858 | pub fn unwrap(this: @This()) ?StringList { |
| 1859 | 1859 | if (this == .none) return null; |
| 1860 | return @enumFromInt(@intFromEnum(this)); | |
| 1860 | return @fromBackingInt(@intCast(@backingInt(this))); | |
| 1861 | 1861 | } |
| 1862 | 1862 | |
| 1863 | 1863 | pub fn slice(this: @This(), c: *const Configuration) ?[]const String { |
| ... | ... | @@ -1889,8 +1889,8 @@ pub const InstallDestDir = enum(u32) { |
| 1889 | 1889 | _, |
| 1890 | 1890 | |
| 1891 | 1891 | pub fn initCustom(sub_path: String) InstallDestDir { |
| 1892 | assert(@intFromEnum(sub_path) < @intFromEnum(InstallDestDir.none)); | |
| 1893 | return @enumFromInt(@intFromEnum(sub_path)); | |
| 1892 | assert(@backingInt(sub_path) < @backingInt(InstallDestDir.none)); | |
| 1893 | return @fromBackingInt(@intCast(@backingInt(sub_path))); | |
| 1894 | 1894 | } |
| 1895 | 1895 | |
| 1896 | 1896 | pub const Unpacked = union(enum) { |
| ... | ... | @@ -1908,7 +1908,7 @@ pub const InstallDestDir = enum(u32) { |
| 1908 | 1908 | .lib => .lib, |
| 1909 | 1909 | .bin => .bin, |
| 1910 | 1910 | .header => .header, |
| 1911 | _ => .{ .sub_path = @enumFromInt(@intFromEnum(this)) }, | |
| 1911 | _ => .{ .sub_path = @fromBackingInt(@intCast(@backingInt(this))) }, | |
| 1912 | 1912 | }; |
| 1913 | 1913 | } |
| 1914 | 1914 | }; |
| ... | ... | @@ -1922,14 +1922,14 @@ pub const OptionalString = enum(u32) { |
| 1922 | 1922 | _, |
| 1923 | 1923 | |
| 1924 | 1924 | pub fn init(s: String) OptionalString { |
| 1925 | const result: OptionalString = @enumFromInt(@intFromEnum(s)); | |
| 1925 | const result: OptionalString = @fromBackingInt(@intCast(@backingInt(s))); | |
| 1926 | 1926 | assert(result != .none); |
| 1927 | 1927 | return result; |
| 1928 | 1928 | } |
| 1929 | 1929 | |
| 1930 | 1930 | pub fn unwrap(this: @This()) ?String { |
| 1931 | 1931 | if (this == .none) return null; |
| 1932 | return @enumFromInt(@intFromEnum(this)); | |
| 1932 | return @fromBackingInt(@intCast(@backingInt(this))); | |
| 1933 | 1933 | } |
| 1934 | 1934 | |
| 1935 | 1935 | pub fn slice(this: @This(), c: *const Configuration) ?[:0]const u8 { |
| ... | ... | @@ -1945,7 +1945,7 @@ pub const String = enum(u32) { |
| 1945 | 1945 | _, |
| 1946 | 1946 | |
| 1947 | 1947 | pub fn slice(index: String, c: *const Configuration) [:0]const u8 { |
| 1948 | const start_slice = c.string_bytes[@intFromEnum(index)..]; | |
| 1948 | const start_slice = c.string_bytes[@backingInt(index)..]; | |
| 1949 | 1949 | return start_slice[0..std.mem.indexOfScalar(u8, start_slice, 0).? :0]; |
| 1950 | 1950 | } |
| 1951 | 1951 | }; |
| ... | ... | @@ -1975,13 +1975,13 @@ pub const Alignment = enum(u6) { |
| 1975 | 1975 | |
| 1976 | 1976 | pub fn init(optional_alignment: ?std.mem.Alignment) @This() { |
| 1977 | 1977 | const a = optional_alignment orelse return .none; |
| 1978 | return @enumFromInt(@intFromEnum(a)); | |
| 1978 | return @fromBackingInt(@intCast(@backingInt(a))); | |
| 1979 | 1979 | } |
| 1980 | 1980 | |
| 1981 | 1981 | pub fn toBytes(a: @This()) ?u64 { |
| 1982 | 1982 | return switch (a) { |
| 1983 | 1983 | .none => null, |
| 1984 | else => @as(u64, 1) << @intFromEnum(a), | |
| 1984 | else => @as(u64, 1) << @backingInt(a), | |
| 1985 | 1985 | }; |
| 1986 | 1986 | } |
| 1987 | 1987 | }; |
| ... | ... | @@ -2015,7 +2015,7 @@ pub const SystemLib = struct { |
| 2015 | 2015 | _, |
| 2016 | 2016 | |
| 2017 | 2017 | pub fn get(this: @This(), c: *const Configuration) SystemLib { |
| 2018 | return extraData(c, SystemLib, @intFromEnum(this)); | |
| 2018 | return extraData(c, SystemLib, @backingInt(this)); | |
| 2019 | 2019 | } |
| 2020 | 2020 | }; |
| 2021 | 2021 | |
| ... | ... | @@ -2054,7 +2054,7 @@ pub const CSourceFiles = struct { |
| 2054 | 2054 | _, |
| 2055 | 2055 | |
| 2056 | 2056 | pub fn get(this: @This(), c: *const Configuration) CSourceFiles { |
| 2057 | return extraData(c, CSourceFiles, @intFromEnum(this)); | |
| 2057 | return extraData(c, CSourceFiles, @backingInt(this)); | |
| 2058 | 2058 | } |
| 2059 | 2059 | }; |
| 2060 | 2060 | |
| ... | ... | @@ -2074,7 +2074,7 @@ pub const CSourceFile = struct { |
| 2074 | 2074 | _, |
| 2075 | 2075 | |
| 2076 | 2076 | pub fn get(this: @This(), c: *const Configuration) CSourceFile { |
| 2077 | return extraData(c, CSourceFile, @intFromEnum(this)); | |
| 2077 | return extraData(c, CSourceFile, @backingInt(this)); | |
| 2078 | 2078 | } |
| 2079 | 2079 | }; |
| 2080 | 2080 | |
| ... | ... | @@ -2095,7 +2095,7 @@ pub const RcSourceFile = struct { |
| 2095 | 2095 | _, |
| 2096 | 2096 | |
| 2097 | 2097 | pub fn get(this: @This(), c: *const Configuration) RcSourceFile { |
| 2098 | return extraData(c, RcSourceFile, @intFromEnum(this)); | |
| 2098 | return extraData(c, RcSourceFile, @backingInt(this)); | |
| 2099 | 2099 | } |
| 2100 | 2100 | }; |
| 2101 | 2101 | |
| ... | ... | @@ -2149,7 +2149,7 @@ pub const ResolvedTarget = struct { |
| 2149 | 2149 | _, |
| 2150 | 2150 | |
| 2151 | 2151 | pub fn get(this: @This(), c: *const Configuration) ResolvedTarget { |
| 2152 | return extraData(c, ResolvedTarget, @intFromEnum(this)); | |
| 2152 | return extraData(c, ResolvedTarget, @backingInt(this)); | |
| 2153 | 2153 | } |
| 2154 | 2154 | }; |
| 2155 | 2155 | |
| ... | ... | @@ -2158,7 +2158,7 @@ pub const ResolvedTarget = struct { |
| 2158 | 2158 | _, |
| 2159 | 2159 | |
| 2160 | 2160 | pub fn init(i: Index) OptionalIndex { |
| 2161 | const result: OptionalIndex = @enumFromInt(@intFromEnum(i)); | |
| 2161 | const result: OptionalIndex = @fromBackingInt(@intCast(@backingInt(i))); | |
| 2162 | 2162 | assert(result != .none); |
| 2163 | 2163 | return result; |
| 2164 | 2164 | } |
| ... | ... | @@ -2166,7 +2166,7 @@ pub const ResolvedTarget = struct { |
| 2166 | 2166 | pub fn unwrap(this: @This()) ?Index { |
| 2167 | 2167 | return switch (this) { |
| 2168 | 2168 | .none => null, |
| 2169 | _ => @enumFromInt(@intFromEnum(this)), | |
| 2169 | _ => @fromBackingInt(@intCast(@backingInt(this))), | |
| 2170 | 2170 | }; |
| 2171 | 2171 | } |
| 2172 | 2172 | |
| ... | ... | @@ -2219,15 +2219,15 @@ pub const TargetQuery = struct { |
| 2219 | 2219 | _, |
| 2220 | 2220 | |
| 2221 | 2221 | pub fn extraSlice(i: Index, extra: []const u32) []const u32 { |
| 2222 | return extra[@intFromEnum(i)..][0..length(i, extra)]; | |
| 2222 | return extra[@backingInt(i)..][0..length(i, extra)]; | |
| 2223 | 2223 | } |
| 2224 | 2224 | |
| 2225 | 2225 | pub fn length(i: Index, extra: []const u32) usize { |
| 2226 | return Storage.dataLength(extra, @intFromEnum(i), TargetQuery); | |
| 2226 | return Storage.dataLength(extra, @backingInt(i), TargetQuery); | |
| 2227 | 2227 | } |
| 2228 | 2228 | |
| 2229 | 2229 | pub fn get(this: @This(), c: *const Configuration) TargetQuery { |
| 2230 | return extraData(c, TargetQuery, @intFromEnum(this)); | |
| 2230 | return extraData(c, TargetQuery, @backingInt(this)); | |
| 2231 | 2231 | } |
| 2232 | 2232 | }; |
| 2233 | 2233 | |
| ... | ... | @@ -2236,7 +2236,7 @@ pub const TargetQuery = struct { |
| 2236 | 2236 | _, |
| 2237 | 2237 | |
| 2238 | 2238 | pub fn init(i: Index) OptionalIndex { |
| 2239 | const result: OptionalIndex = @enumFromInt(@intFromEnum(i)); | |
| 2239 | const result: OptionalIndex = @fromBackingInt(@intCast(@backingInt(i))); | |
| 2240 | 2240 | assert(result != .none); |
| 2241 | 2241 | return result; |
| 2242 | 2242 | } |
| ... | ... | @@ -2244,7 +2244,7 @@ pub const TargetQuery = struct { |
| 2244 | 2244 | pub fn unwrap(this: @This()) ?Index { |
| 2245 | 2245 | return switch (this) { |
| 2246 | 2246 | .none => null, |
| 2247 | _ => @enumFromInt(@intFromEnum(this)), | |
| 2247 | _ => @fromBackingInt(@intCast(@backingInt(this))), | |
| 2248 | 2248 | }; |
| 2249 | 2249 | } |
| 2250 | 2250 | |
| ... | ... | @@ -2927,7 +2927,7 @@ pub const Storage = enum { |
| 2927 | 2927 | pub const storage: Storage = .extended; |
| 2928 | 2928 | |
| 2929 | 2929 | pub fn tag(this: @This(), c: *const Configuration) @FieldType(BaseFlags, "tag") { |
| 2930 | const base_flags: BaseFlags = @bitCast(c.extra[@intFromEnum(this)]); | |
| 2930 | const base_flags: BaseFlags = @bitCast(c.extra[@backingInt(this)]); | |
| 2931 | 2931 | return base_flags.tag; |
| 2932 | 2932 | } |
| 2933 | 2933 | |
| ... | ... | @@ -2936,14 +2936,14 @@ pub const Storage = enum { |
| 2936 | 2936 | const info = @typeInfo(S.Flags).@"struct"; |
| 2937 | 2937 | break :blk info.field_attrs[0].defaultValue(info.field_types[0]).?; |
| 2938 | 2938 | }; |
| 2939 | const base_flags: BaseFlags = @bitCast(c.extra[@intFromEnum(this)]); | |
| 2939 | const base_flags: BaseFlags = @bitCast(c.extra[@backingInt(this)]); | |
| 2940 | 2940 | if (base_flags.tag != wanted_tag) return null; |
| 2941 | var i: usize = @intFromEnum(this); | |
| 2941 | var i: usize = @backingInt(this); | |
| 2942 | 2942 | return data(c.extra, &i, S); |
| 2943 | 2943 | } |
| 2944 | 2944 | |
| 2945 | 2945 | pub fn get(this: @This(), buffer: []const u32) U { |
| 2946 | var i: usize = @intFromEnum(this); | |
| 2946 | var i: usize = @backingInt(this); | |
| 2947 | 2947 | const base_flags: BaseFlags = @bitCast(buffer[i]); |
| 2948 | 2948 | return switch (base_flags.tag) { |
| 2949 | 2949 | inline else => |t| @unionInit(U, @tagName(t), data(buffer, &i, @FieldType(U, @tagName(t)))), |
| ... | ... | @@ -3071,7 +3071,7 @@ pub const Storage = enum { |
| 3071 | 3071 | pub fn get(this: *const @This(), extra: []const u32, i: usize) Union { |
| 3072 | 3072 | const elem = slice(this, extra)[i]; |
| 3073 | 3073 | return switch (this.tag(extra, i)) { |
| 3074 | inline else => |comptime_tag| @unionInit(Union, @tagName(comptime_tag), @enumFromInt(elem)), | |
| 3074 | inline else => |comptime_tag| @unionInit(Union, @tagName(comptime_tag), @fromBackingInt(@intCast(elem))), | |
| 3075 | 3075 | }; |
| 3076 | 3076 | } |
| 3077 | 3077 | |
| ... | ... | @@ -3109,7 +3109,7 @@ pub const Storage = enum { |
| 3109 | 3109 | inline else => |comptime_tag| @unionInit( |
| 3110 | 3110 | T, |
| 3111 | 3111 | @tagName(comptime_tag), |
| 3112 | data(buffer, i, info.field_types[@intFromEnum(comptime_tag)]), | |
| 3112 | data(buffer, i, info.field_types[@backingInt(comptime_tag)]), | |
| 3113 | 3113 | ), |
| 3114 | 3114 | }; |
| 3115 | 3115 | }, |
| ... | ... | @@ -3133,7 +3133,7 @@ pub const Storage = enum { |
| 3133 | 3133 | }, |
| 3134 | 3134 | .@"enum" => { |
| 3135 | 3135 | defer i.* += 1; |
| 3136 | return @enumFromInt(buffer[i.*]); | |
| 3136 | return @fromBackingInt(@intCast(buffer[i.*])); | |
| 3137 | 3137 | }, |
| 3138 | 3138 | .@"struct" => |info| switch (info.layout) { |
| 3139 | 3139 | .@"packed" => switch (info.backing_integer.?) { |
| ... | ... | @@ -3176,7 +3176,7 @@ pub const Storage = enum { |
| 3176 | 3176 | buffer, |
| 3177 | 3177 | i, |
| 3178 | 3178 | container, |
| 3179 | @typeInfo(Field.Union).@"union".field_types[@intFromEnum(comptime_tag)], | |
| 3179 | @typeInfo(Field.Union).@"union".field_types[@backingInt(comptime_tag)], | |
| 3180 | 3180 | ), |
| 3181 | 3181 | ), |
| 3182 | 3182 | }, |
| ... | ... | @@ -3324,7 +3324,7 @@ pub const Storage = enum { |
| 3324 | 3324 | else => comptime unreachable, |
| 3325 | 3325 | }, |
| 3326 | 3326 | .@"enum" => { |
| 3327 | buffer[i] = @intFromEnum(value); | |
| 3327 | buffer[i] = @backingInt(value); | |
| 3328 | 3328 | return 1; |
| 3329 | 3329 | }, |
| 3330 | 3330 | .@"struct" => |info| switch (info.layout) { |
| ... | ... | @@ -3379,7 +3379,7 @@ pub const Storage = enum { |
| 3379 | 3379 | const field_names = @typeInfo(Field.Elem).@"struct".field_names; |
| 3380 | 3380 | inline for (0..field_names.len) |field_i| @memcpy( |
| 3381 | 3381 | buffer[i + 1 + field_i * len ..][0..len], |
| 3382 | @as([]const u32, @ptrCast(value.mal.items(@enumFromInt(field_i)))), | |
| 3382 | @as([]const u32, @ptrCast(value.mal.items(@fromBackingInt(@intCast(field_i))))), | |
| 3383 | 3383 | ); |
| 3384 | 3384 | return 1 + field_names.len * len; |
| 3385 | 3385 | }, |
| ... | ... | @@ -3429,7 +3429,7 @@ fn IndexType(comptime T: type) type { |
| 3429 | 3429 | _, |
| 3430 | 3430 | |
| 3431 | 3431 | pub fn get(this: @This(), c: *const Configuration) T { |
| 3432 | return extraData(c, T, @intFromEnum(this)); | |
| 3432 | return extraData(c, T, @backingInt(this)); | |
| 3433 | 3433 | } |
| 3434 | 3434 | }; |
| 3435 | 3435 | } |
lib/std/Build/Serialize.zig+11-11| ... | ... | @@ -75,7 +75,7 @@ pub fn write(b: *std.Build, wc: *Configuration.Wip, writer: *std.Io.Writer) !voi |
| 75 | 75 | // Add and then de-duplicate dependencies. |
| 76 | 76 | const dep_steps = try arena.alloc(Configuration.Step.Index, step.dependencies.items.len); |
| 77 | 77 | for (dep_steps, step.dependencies.items) |*dest, src| |
| 78 | dest.* = @enumFromInt(s.step_map.getIndex(src).?); | |
| 78 | dest.* = @fromBackingInt(@intCast(s.step_map.getIndex(src).?)); | |
| 79 | 79 | |
| 80 | 80 | const deps: Configuration.Deps.Index = try wc.addDeduped(Configuration.Deps, .{ |
| 81 | 81 | .steps = .{ .slice = dep_steps }, |
| ... | ... | @@ -87,7 +87,7 @@ pub fn write(b: *std.Build, wc: *Configuration.Wip, writer: *std.Io.Writer) !voi |
| 87 | 87 | .owner = try s.builderToPackage(step.owner), |
| 88 | 88 | .deps = deps, |
| 89 | 89 | .max_rss = .fromBytes(step.max_rss), |
| 90 | .extended = @enumFromInt(switch (step.tag) { | |
| 90 | .extended = @fromBackingInt(@intCast(switch (step.tag) { | |
| 91 | 91 | .top_level => e: { |
| 92 | 92 | const top_level: *Step.TopLevel = @fieldParentPtr("step", step); |
| 93 | 93 | break :e try wc.addExtraErased(Configuration.Step.TopLevel, .{ |
| ... | ... | @@ -445,8 +445,8 @@ pub fn write(b: *std.Build, wc: *Configuration.Wip, writer: *std.Io.Writer) !voi |
| 445 | 445 | }, |
| 446 | 446 | .expect_term => |t| expect_term = switch (t) { |
| 447 | 447 | .exited => |x| .{ .status = .exited, .value = x }, |
| 448 | .signal => |x| .{ .status = .signal, .value = @intFromEnum(x) }, | |
| 449 | .stopped => |x| .{ .status = .stopped, .value = @intFromEnum(x) }, | |
| 448 | .signal => |x| .{ .status = .signal, .value = @backingInt(x) }, | |
| 449 | .stopped => |x| .{ .status = .stopped, .value = @backingInt(x) }, | |
| 450 | 450 | .unknown => |x| .{ .status = .unknown, .value = x }, |
| 451 | 451 | }, |
| 452 | 452 | .expect_stderr_snapshot => |path| expect_stderr_snapshot = try s.addLazyPath(path), |
| ... | ... | @@ -656,7 +656,7 @@ pub fn write(b: *std.Build, wc: *Configuration.Wip, writer: *std.Io.Writer) !voi |
| 656 | 656 | .args = .{ .slice = args }, |
| 657 | 657 | }); |
| 658 | 658 | }, |
| 659 | }), | |
| 659 | })), | |
| 660 | 660 | }); |
| 661 | 661 | } |
| 662 | 662 | } |
| ... | ... | @@ -734,7 +734,7 @@ fn builderToPackage(s: *Serialize, b: *std.Build) !Configuration.Package.Index { |
| 734 | 734 | |
| 735 | 735 | fn addOptionalLazyPathEnum(s: *Serialize, lp: ?std.Build.LazyPath) !Configuration.LazyPath.OptionalIndex { |
| 736 | 736 | const wc = s.wc; |
| 737 | return @enumFromInt(switch (lp orelse return .none) { | |
| 737 | return @fromBackingInt(@intCast(switch (lp orelse return .none) { | |
| 738 | 738 | .src_path => |src_path| i: { |
| 739 | 739 | const sub_path = try wc.addString(src_path.sub_path); |
| 740 | 740 | break :i try wc.addExtraErased(Configuration.LazyPath.SourcePath, .{ |
| ... | ... | @@ -770,7 +770,7 @@ fn addOptionalLazyPathEnum(s: *Serialize, lp: ?std.Build.LazyPath) !Configuratio |
| 770 | 770 | .sub_path = sub_path, |
| 771 | 771 | }); |
| 772 | 772 | }, |
| 773 | }); | |
| 773 | })); | |
| 774 | 774 | } |
| 775 | 775 | |
| 776 | 776 | fn addOptionalLazyPath(s: *Serialize, lp: ?std.Build.LazyPath) !?Configuration.LazyPath.Index { |
| ... | ... | @@ -778,7 +778,7 @@ fn addOptionalLazyPath(s: *Serialize, lp: ?std.Build.LazyPath) !?Configuration.L |
| 778 | 778 | } |
| 779 | 779 | |
| 780 | 780 | fn addLazyPath(s: *Serialize, lp: std.Build.LazyPath) !Configuration.LazyPath.Index { |
| 781 | return @enumFromInt(@intFromEnum(try addOptionalLazyPathEnum(s, lp))); | |
| 781 | return @fromBackingInt(@intCast(@backingInt(try addOptionalLazyPathEnum(s, lp)))); | |
| 782 | 782 | } |
| 783 | 783 | |
| 784 | 784 | fn addOptionalSemVer(s: *Serialize, sem_ver: ?std.SemanticVersion) !?Configuration.String { |
| ... | ... | @@ -1163,17 +1163,17 @@ fn addModule(s: *Serialize, m: *std.Build.Module) !Configuration.Module.Index { |
| 1163 | 1163 | |
| 1164 | 1164 | comptime assert(std.mem.eql(u8, @typeInfo(Configuration.Module).@"struct".field_names[2], "import_table")); |
| 1165 | 1165 | comptime assert(@typeInfo(Configuration.Module).@"struct".field_types[2] == Configuration.ImportTable.Index); |
| 1166 | assert(wc.extra.items[@intFromEnum(module_index) + 2] == @intFromEnum(Configuration.ImportTable.Index.invalid)); | |
| 1166 | assert(wc.extra.items[@backingInt(module_index) + 2] == @backingInt(Configuration.ImportTable.Index.invalid)); | |
| 1167 | 1167 | const import_table_index = try wc.addDeduped(Configuration.ImportTable, .{ |
| 1168 | 1168 | .imports = .{ .mal = imports }, |
| 1169 | 1169 | }); |
| 1170 | wc.extra.items[@intFromEnum(module_index) + 2] = @intFromEnum(import_table_index); | |
| 1170 | wc.extra.items[@backingInt(module_index) + 2] = @backingInt(import_table_index); | |
| 1171 | 1171 | |
| 1172 | 1172 | return module_index; |
| 1173 | 1173 | } |
| 1174 | 1174 | |
| 1175 | 1175 | fn stepIndex(s: *const Serialize, step: *Step) Configuration.Step.Index { |
| 1176 | return @enumFromInt(s.step_map.getIndex(step).?); | |
| 1176 | return @fromBackingInt(@intCast(s.step_map.getIndex(step).?)); | |
| 1177 | 1177 | } |
| 1178 | 1178 | |
| 1179 | 1179 | fn addOptionalResolvedTarget( |
lib/std/Build/abi.zig+1-1| ... | ... | @@ -265,7 +265,7 @@ pub const fuzz = struct { |
| 265 | 265 | return switch (@typeInfo(T)) { |
| 266 | 266 | .comptime_int => x, |
| 267 | 267 | .bool => @intFromBool(x), |
| 268 | .@"enum" => @intFromEnum(x), | |
| 268 | .@"enum" => @backingInt(x), | |
| 269 | 269 | else => @as(@Int(.unsigned, @bitSizeOf(T)), @bitCast(x)), |
| 270 | 270 | |
| 271 | 271 | .int => |i| x: { |
lib/std/Io.zig+15-15| ... | ... | @@ -437,14 +437,14 @@ pub const Operation = union(enum) { |
| 437 | 437 | _, |
| 438 | 438 | |
| 439 | 439 | pub fn fromIndex(i: usize) OptionalIndex { |
| 440 | const oi: OptionalIndex = @enumFromInt(i); | |
| 440 | const oi: OptionalIndex = @fromBackingInt(@intCast(i)); | |
| 441 | 441 | assert(oi != .none); |
| 442 | 442 | return oi; |
| 443 | 443 | } |
| 444 | 444 | |
| 445 | 445 | pub fn toIndex(oi: OptionalIndex) u32 { |
| 446 | 446 | assert(oi != .none); |
| 447 | return @intFromEnum(oi); | |
| 447 | return @backingInt(oi); | |
| 448 | 448 | } |
| 449 | 449 | }; |
| 450 | 450 | pub const List = struct { |
| ... | ... | @@ -640,13 +640,13 @@ pub const Limit = enum(usize) { |
| 640 | 640 | |
| 641 | 641 | /// `math.maxInt(usize)` is interpreted to mean `.unlimited`. |
| 642 | 642 | pub fn limited(n: usize) Limit { |
| 643 | return @enumFromInt(n); | |
| 643 | return @fromBackingInt(@intCast(n)); | |
| 644 | 644 | } |
| 645 | 645 | |
| 646 | 646 | /// Any value grater than `math.maxInt(usize)` is interpreted to mean |
| 647 | 647 | /// `.unlimited`. |
| 648 | 648 | pub fn limited64(n: u64) Limit { |
| 649 | return @enumFromInt(@min(n, math.maxInt(usize))); | |
| 649 | return @fromBackingInt(@intCast(@min(n, math.maxInt(usize)))); | |
| 650 | 650 | } |
| 651 | 651 | |
| 652 | 652 | pub fn countVec(data: []const []const u8) Limit { |
| ... | ... | @@ -656,7 +656,7 @@ pub const Limit = enum(usize) { |
| 656 | 656 | } |
| 657 | 657 | |
| 658 | 658 | pub fn min(a: Limit, b: Limit) Limit { |
| 659 | return @enumFromInt(@min(@intFromEnum(a), @intFromEnum(b))); | |
| 659 | return @fromBackingInt(@intCast(@min(@backingInt(a), @backingInt(b)))); | |
| 660 | 660 | } |
| 661 | 661 | |
| 662 | 662 | pub fn max(a: Limit, b: Limit) Limit { |
| ... | ... | @@ -664,15 +664,15 @@ pub const Limit = enum(usize) { |
| 664 | 664 | return .unlimited; |
| 665 | 665 | } |
| 666 | 666 | |
| 667 | return @enumFromInt(@max(@intFromEnum(a), @intFromEnum(b))); | |
| 667 | return @fromBackingInt(@intCast(@max(@backingInt(a), @backingInt(b)))); | |
| 668 | 668 | } |
| 669 | 669 | |
| 670 | 670 | pub fn minInt(l: Limit, n: usize) usize { |
| 671 | return @min(n, @intFromEnum(l)); | |
| 671 | return @min(n, @backingInt(l)); | |
| 672 | 672 | } |
| 673 | 673 | |
| 674 | 674 | pub fn minInt64(l: Limit, n: u64) usize { |
| 675 | return @min(n, @intFromEnum(l)); | |
| 675 | return @min(n, @backingInt(l)); | |
| 676 | 676 | } |
| 677 | 677 | |
| 678 | 678 | pub fn slice(l: Limit, s: []u8) []u8 { |
| ... | ... | @@ -685,14 +685,14 @@ pub const Limit = enum(usize) { |
| 685 | 685 | |
| 686 | 686 | pub fn toInt(l: Limit) ?usize { |
| 687 | 687 | return switch (l) { |
| 688 | else => @intFromEnum(l), | |
| 688 | else => @backingInt(l), | |
| 689 | 689 | .unlimited => null, |
| 690 | 690 | }; |
| 691 | 691 | } |
| 692 | 692 | |
| 693 | 693 | pub fn toInt64(l: Limit) ?u64 { |
| 694 | 694 | return switch (l) { |
| 695 | else => @intFromEnum(l), | |
| 695 | else => @backingInt(l), | |
| 696 | 696 | .unlimited => null, |
| 697 | 697 | }; |
| 698 | 698 | } |
| ... | ... | @@ -702,7 +702,7 @@ pub const Limit = enum(usize) { |
| 702 | 702 | /// between end-of-stream and reaching the limit. |
| 703 | 703 | pub fn slice1(l: Limit, non_empty_buffer: []u8) []u8 { |
| 704 | 704 | assert(non_empty_buffer.len >= 1); |
| 705 | return non_empty_buffer[0..@min(@intFromEnum(l) +| 1, non_empty_buffer.len)]; | |
| 705 | return non_empty_buffer[0..@min(@backingInt(l) +| 1, non_empty_buffer.len)]; | |
| 706 | 706 | } |
| 707 | 707 | |
| 708 | 708 | pub fn nonzero(l: Limit) bool { |
| ... | ... | @@ -713,8 +713,8 @@ pub const Limit = enum(usize) { |
| 713 | 713 | /// limit would be exceeded. |
| 714 | 714 | pub fn subtract(l: Limit, amount: usize) ?Limit { |
| 715 | 715 | if (l == .unlimited) return .unlimited; |
| 716 | if (amount > @intFromEnum(l)) return null; | |
| 717 | return @enumFromInt(@intFromEnum(l) - amount); | |
| 716 | if (amount > @backingInt(l)) return null; | |
| 717 | return @fromBackingInt(@intCast(@backingInt(l) - amount)); | |
| 718 | 718 | } |
| 719 | 719 | }; |
| 720 | 720 | |
| ... | ... | @@ -1583,7 +1583,7 @@ pub fn futexWait(io: Io, comptime T: type, ptr: *align(@alignOf(u32)) const T, e |
| 1583 | 1583 | /// three possible wake-up reasons if necessary. |
| 1584 | 1584 | pub fn futexWaitTimeout(io: Io, comptime T: type, ptr: *align(@alignOf(u32)) const T, expected: T, timeout: Timeout) Cancelable!void { |
| 1585 | 1585 | const expected_int: u32 = switch (@typeInfo(T)) { |
| 1586 | .@"enum" => @bitCast(@intFromEnum(expected)), | |
| 1586 | .@"enum" => @bitCast(@backingInt(expected)), | |
| 1587 | 1587 | else => @bitCast(expected), |
| 1588 | 1588 | }; |
| 1589 | 1589 | return io.vtable.futexWait(io.userdata, @ptrCast(ptr), expected_int, timeout); |
| ... | ... | @@ -1593,7 +1593,7 @@ pub fn futexWaitTimeout(io: Io, comptime T: type, ptr: *align(@alignOf(u32)) con |
| 1593 | 1593 | /// For a description of cancelation and cancelation points, see `Future.cancel`. |
| 1594 | 1594 | pub fn futexWaitUncancelable(io: Io, comptime T: type, ptr: *align(@alignOf(u32)) const T, expected: T) void { |
| 1595 | 1595 | const expected_int: u32 = switch (@typeInfo(T)) { |
| 1596 | .@"enum" => @bitCast(@intFromEnum(expected)), | |
| 1596 | .@"enum" => @bitCast(@backingInt(expected)), | |
| 1597 | 1597 | else => @bitCast(expected), |
| 1598 | 1598 | }; |
| 1599 | 1599 | io.vtable.futexWaitUncancelable(io.userdata, @ptrCast(ptr), expected_int); |
lib/std/Io/Dispatch.zig+11-11| ... | ... | @@ -124,15 +124,15 @@ const Fiber = struct { |
| 124 | 124 | const shift = 1; |
| 125 | 125 | |
| 126 | 126 | fn subWrap(lhs: Awaiting, rhs: Awaiting) Awaiting { |
| 127 | return @enumFromInt(@intFromEnum(lhs) -% @intFromEnum(rhs)); | |
| 127 | return @fromBackingInt(@intCast(@backingInt(lhs) -% @backingInt(rhs))); | |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | fn fromCancelable(cancelable: *Cancelable) Awaiting { |
| 131 | return @enumFromInt(@shrExact(@intFromPtr(cancelable), shift)); | |
| 131 | return @fromBackingInt(@intCast(@shrExact(@intFromPtr(cancelable), shift))); | |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | fn toCancelable(awaiting: Awaiting) *Cancelable { |
| 135 | return @ptrFromInt(@shlExact(@as(usize, @intFromEnum(awaiting)), shift)); | |
| 135 | return @ptrFromInt(@shlExact(@as(usize, @backingInt(awaiting)), shift)); | |
| 136 | 136 | } |
| 137 | 137 | }; |
| 138 | 138 | |
| ... | ... | @@ -157,7 +157,7 @@ const Fiber = struct { |
| 157 | 157 | const unblocked: CancelProtection = .{ .user = .unblocked, .acknowledged = false }; |
| 158 | 158 | |
| 159 | 159 | fn check(cancel_protection: CancelProtection) Io.CancelProtection { |
| 160 | return @enumFromInt(@intFromBool(cancel_protection != unblocked)); | |
| 160 | return @fromBackingInt(@intCast(@intFromBool(cancel_protection != unblocked))); | |
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | fn acknowledge(cancel_protection: *CancelProtection) void { |
| ... | ... | @@ -1892,7 +1892,7 @@ fn deviceIoControl(o: *const Io.Operation.DeviceIoControl) Io.Cancelable!i32 { |
| 1892 | 1892 | switch (c.errno(rc)) { |
| 1893 | 1893 | .SUCCESS => return rc, |
| 1894 | 1894 | .INTR => {}, |
| 1895 | else => |err| return -@as(i32, @intFromEnum(err)), | |
| 1895 | else => |err| return -@as(i32, @backingInt(err)), | |
| 1896 | 1896 | } |
| 1897 | 1897 | } |
| 1898 | 1898 | } |
| ... | ... | @@ -2805,7 +2805,7 @@ fn dirRealPathFile( |
| 2805 | 2805 | assert(redundant_pointer == out_buffer.ptr); |
| 2806 | 2806 | return std.mem.indexOfScalar(u8, out_buffer, 0) orelse out_buffer.len; |
| 2807 | 2807 | } |
| 2808 | const err: c.E = @enumFromInt(c._errno().*); | |
| 2808 | const err: c.E = @fromBackingInt(@intCast(c._errno().*)); | |
| 2809 | 2809 | switch (err) { |
| 2810 | 2810 | .INTR => {}, |
| 2811 | 2811 | .INVAL => return errnoBug(err), |
| ... | ... | @@ -3347,12 +3347,12 @@ fn fileWriteFileStreaming( |
| 3347 | 3347 | ) File.Writer.WriteFileError!usize { |
| 3348 | 3348 | const ev: *Evented = @ptrCast(@alignCast(userdata)); |
| 3349 | 3349 | const reader_buffered = file_reader.interface.buffered(); |
| 3350 | if (reader_buffered.len >= @intFromEnum(limit)) { | |
| 3350 | if (reader_buffered.len >= @backingInt(limit)) { | |
| 3351 | 3351 | const n = try fileWriteStreaming(ev, file, header, &.{limit.slice(reader_buffered)}, 1); |
| 3352 | 3352 | file_reader.interface.toss(n -| header.len); |
| 3353 | 3353 | return n; |
| 3354 | 3354 | } |
| 3355 | const file_limit = @intFromEnum(limit) - reader_buffered.len; | |
| 3355 | const file_limit = @backingInt(limit) - reader_buffered.len; | |
| 3356 | 3356 | const out_fd = file.handle; |
| 3357 | 3357 | const in_fd = file_reader.file.handle; |
| 3358 | 3358 | |
| ... | ... | @@ -3441,7 +3441,7 @@ fn fileWriteFilePositional( |
| 3441 | 3441 | ) File.WriteFilePositionalError!usize { |
| 3442 | 3442 | const ev: *Evented = @ptrCast(@alignCast(userdata)); |
| 3443 | 3443 | const reader_buffered = file_reader.interface.buffered(); |
| 3444 | if (reader_buffered.len >= @intFromEnum(limit)) { | |
| 3444 | if (reader_buffered.len >= @backingInt(limit)) { | |
| 3445 | 3445 | const n = try fileWritePositional( |
| 3446 | 3446 | ev, |
| 3447 | 3447 | file, |
| ... | ... | @@ -3866,7 +3866,7 @@ fn fileMemoryMapCreate( |
| 3866 | 3866 | const contents = while (true) { |
| 3867 | 3867 | const casted_offset = std.math.cast(i64, options.offset) orelse return error.Unseekable; |
| 3868 | 3868 | const rc = c.mmap(null, options.len, prot, flags, file.handle, casted_offset); |
| 3869 | const err: c.E = if (rc != c.MAP_FAILED) .SUCCESS else @enumFromInt(c._errno().*); | |
| 3869 | const err: c.E = if (rc != c.MAP_FAILED) .SUCCESS else @fromBackingInt(@intCast(c._errno().*)); | |
| 3870 | 3870 | switch (err) { |
| 3871 | 3871 | .SUCCESS => break @as([*]align(page_align) u8, @ptrCast(@alignCast(rc)))[0..options.len], |
| 3872 | 3872 | .INTR => {}, |
| ... | ... | @@ -4026,7 +4026,7 @@ fn unlockStderr(userdata: ?*anyopaque) void { |
| 4026 | 4026 | fn processCurrentPath(userdata: ?*anyopaque, buffer: []u8) process.CurrentPathError!usize { |
| 4027 | 4027 | const ev: *Evented = @ptrCast(@alignCast(userdata)); |
| 4028 | 4028 | _ = ev; |
| 4029 | const err: c.E = if (c.getcwd(buffer.ptr, buffer.len)) |_| .SUCCESS else @enumFromInt(c._errno().*); | |
| 4029 | const err: c.E = if (c.getcwd(buffer.ptr, buffer.len)) |_| .SUCCESS else @fromBackingInt(@intCast(c._errno().*)); | |
| 4030 | 4030 | switch (err) { |
| 4031 | 4031 | .SUCCESS => return std.mem.findScalar(u8, buffer, 0).?, |
| 4032 | 4032 | .NOENT => return error.CurrentDirUnlinked, |
lib/std/Io/File.zig+6-6| ... | ... | @@ -340,7 +340,7 @@ pub const Permissions = std.Options.FilePermissions orelse if (is_windows) enum( |
| 340 | 340 | const windows = std.os.windows; |
| 341 | 341 | |
| 342 | 342 | pub fn toAttributes(self: @This()) windows.FILE.ATTRIBUTE { |
| 343 | return @bitCast(@intFromEnum(self)); | |
| 343 | return @bitCast(@backingInt(self)); | |
| 344 | 344 | } |
| 345 | 345 | |
| 346 | 346 | pub fn readOnly(self: @This()) bool { |
| ... | ... | @@ -350,10 +350,10 @@ pub const Permissions = std.Options.FilePermissions orelse if (is_windows) enum( |
| 350 | 350 | |
| 351 | 351 | pub fn setReadOnly(self: @This(), read_only: bool) @This() { |
| 352 | 352 | const attributes = toAttributes(self); |
| 353 | return @enumFromInt(if (read_only) | |
| 353 | return @fromBackingInt(@intCast(if (read_only) | |
| 354 | 354 | attributes | windows.FILE_ATTRIBUTE_READONLY |
| 355 | 355 | else |
| 356 | attributes & ~@as(windows.DWORD, windows.FILE_ATTRIBUTE_READONLY)); | |
| 356 | attributes & ~@as(windows.DWORD, windows.FILE_ATTRIBUTE_READONLY))); | |
| 357 | 357 | } |
| 358 | 358 | } else if (std.posix.mode_t != u0) enum(std.posix.mode_t) { |
| 359 | 359 | /// This is the default mode given to POSIX operating systems for creating |
| ... | ... | @@ -375,11 +375,11 @@ pub const Permissions = std.Options.FilePermissions orelse if (is_windows) enum( |
| 375 | 375 | pub const executable_file: @This() = .default_dir; |
| 376 | 376 | |
| 377 | 377 | pub fn toMode(self: @This()) std.posix.mode_t { |
| 378 | return @intFromEnum(self); | |
| 378 | return @backingInt(self); | |
| 379 | 379 | } |
| 380 | 380 | |
| 381 | 381 | pub fn fromMode(mode: std.posix.mode_t) @This() { |
| 382 | return @enumFromInt(mode); | |
| 382 | return @fromBackingInt(@intCast(mode)); | |
| 383 | 383 | } |
| 384 | 384 | |
| 385 | 385 | /// Returns `true` if and only if no class has write permissions. |
| ... | ... | @@ -392,7 +392,7 @@ pub const Permissions = std.Options.FilePermissions orelse if (is_windows) enum( |
| 392 | 392 | pub fn setReadOnly(self: @This(), read_only: bool) @This() { |
| 393 | 393 | const mode = toMode(self); |
| 394 | 394 | const o222 = @as(std.posix.mode_t, 0o222); |
| 395 | return @enumFromInt(if (read_only) mode & ~o222 else mode | o222); | |
| 395 | return @fromBackingInt(@intCast(if (read_only) mode & ~o222 else mode | o222)); | |
| 396 | 396 | } |
| 397 | 397 | } else enum(u0) { |
| 398 | 398 | default_file = 0, |
lib/std/Io/File/Reader.zig+4-4| ... | ... | @@ -311,7 +311,7 @@ fn discard(io_reader: *Io.Reader, limit: Io.Limit) Io.Reader.Error!usize { |
| 311 | 311 | const logical_pos = logicalPos(r); |
| 312 | 312 | const bytes_remaining = size - logical_pos; |
| 313 | 313 | if (bytes_remaining == 0) return error.EndOfStream; |
| 314 | const delta = @min(@intFromEnum(limit), bytes_remaining); | |
| 314 | const delta = @min(@backingInt(limit), bytes_remaining); | |
| 315 | 315 | setLogicalPos(r, logical_pos + delta); |
| 316 | 316 | return delta; |
| 317 | 317 | }, |
| ... | ... | @@ -324,7 +324,7 @@ fn discard(io_reader: *Io.Reader, limit: Io.Limit) Io.Reader.Error!usize { |
| 324 | 324 | if (r.size_err == null and r.seek_err == null) break :fallback; |
| 325 | 325 | |
| 326 | 326 | const buffered_len = r.interface.bufferedLen(); |
| 327 | var remaining = @intFromEnum(limit); | |
| 327 | var remaining = @backingInt(limit); | |
| 328 | 328 | if (remaining <= buffered_len) { |
| 329 | 329 | r.interface.seek += remaining; |
| 330 | 330 | return remaining; |
| ... | ... | @@ -356,10 +356,10 @@ fn discard(io_reader: *Io.Reader, limit: Io.Limit) Io.Reader.Error!usize { |
| 356 | 356 | } else { |
| 357 | 357 | remaining -= n; |
| 358 | 358 | } |
| 359 | return @intFromEnum(limit) - remaining; | |
| 359 | return @backingInt(limit) - remaining; | |
| 360 | 360 | } |
| 361 | 361 | const size = r.getSize() catch return 0; |
| 362 | const n = @min(size - r.pos, std.math.maxInt(i64), @intFromEnum(limit)); | |
| 362 | const n = @min(size - r.pos, std.math.maxInt(i64), @backingInt(limit)); | |
| 363 | 363 | io.vtable.fileSeekBy(io.userdata, file, n) catch |err| { |
| 364 | 364 | r.seek_err = err; |
| 365 | 365 | return 0; |
lib/std/Io/Kqueue.zig+3-3| ... | ... | @@ -332,7 +332,7 @@ fn schedule(k: *Kqueue, thread: *Thread, ready_queue: Fiber.Queue) void { |
| 332 | 332 | .flags = std.c.EV.ADD | std.c.EV.ONESHOT, |
| 333 | 333 | .fflags = std.c.NOTE.TRIGGER, |
| 334 | 334 | .data = 0, |
| 335 | .udata = @intFromEnum(Completion.UserData.wakeup), | |
| 335 | .udata = @backingInt(Completion.UserData.wakeup), | |
| 336 | 336 | }, |
| 337 | 337 | }; |
| 338 | 338 | // If an error occurs it only pessimises scheduling. |
| ... | ... | @@ -439,7 +439,7 @@ fn idle(k: *Kqueue, thread: *Thread) void { |
| 439 | 439 | @panic(@errorName(err)); // TODO |
| 440 | 440 | }; |
| 441 | 441 | var maybe_ready_queue: ?Fiber.Queue = null; |
| 442 | for (events_buffer[0..n]) |event| switch (@as(Completion.UserData, @enumFromInt(event.udata))) { | |
| 442 | for (events_buffer[0..n]) |event| switch (@as(Completion.UserData, @fromBackingInt(@intCast(event.udata)))) { | |
| 443 | 443 | .unused => unreachable, // bad submission queued? |
| 444 | 444 | .wakeup => {}, |
| 445 | 445 | .cleanup => @panic("failed to notify other threads that we are exiting"), |
| ... | ... | @@ -522,7 +522,7 @@ const SwitchMessage = struct { |
| 522 | 522 | .flags = std.c.EV.ADD | std.c.EV.ONESHOT, |
| 523 | 523 | .fflags = std.c.NOTE.TRIGGER, |
| 524 | 524 | .data = 0, |
| 525 | .udata = @intFromEnum(Completion.UserData.exit), | |
| 525 | .udata = @backingInt(Completion.UserData.exit), | |
| 526 | 526 | }, |
| 527 | 527 | }; |
| 528 | 528 | _ = kevent(each_thread.kq_fd, &changes, &.{}, null) catch |err| { |
lib/std/Io/Reader.zig+11-11| ... | ... | @@ -174,7 +174,7 @@ pub fn stream(r: *Reader, w: *Writer, limit: Limit) StreamError!usize { |
| 174 | 174 | return n; |
| 175 | 175 | } |
| 176 | 176 | const n = try r.vtable.stream(r, w, limit); |
| 177 | assert(n <= @intFromEnum(limit)); | |
| 177 | assert(n <= @backingInt(limit)); | |
| 178 | 178 | return n; |
| 179 | 179 | } |
| 180 | 180 | |
| ... | ... | @@ -189,7 +189,7 @@ pub fn discard(r: *Reader, limit: Limit) Error!usize { |
| 189 | 189 | } else .unlimited; |
| 190 | 190 | r.seek = r.end; |
| 191 | 191 | const n = try r.vtable.discard(r, remaining); |
| 192 | assert(n <= @intFromEnum(remaining)); | |
| 192 | assert(n <= @backingInt(remaining)); | |
| 193 | 193 | return buffered_len + n; |
| 194 | 194 | } |
| 195 | 195 | |
| ... | ... | @@ -204,11 +204,11 @@ pub fn defaultDiscard(r: *Reader, limit: Limit) Error!usize { |
| 204 | 204 | }; |
| 205 | 205 | // If `stream` wrote to `r.buffer` without going through the writer, |
| 206 | 206 | // we need to discard as much of the buffered data as possible. |
| 207 | const remaining = @intFromEnum(limit) - n; | |
| 207 | const remaining = @backingInt(limit) - n; | |
| 208 | 208 | const buffered_n_to_discard = @min(remaining, r.end - r.seek); |
| 209 | 209 | n += buffered_n_to_discard; |
| 210 | 210 | r.seek += buffered_n_to_discard; |
| 211 | assert(n <= @intFromEnum(limit)); | |
| 211 | assert(n <= @backingInt(limit)); | |
| 212 | 212 | return n; |
| 213 | 213 | } |
| 214 | 214 | |
| ... | ... | @@ -1010,17 +1010,17 @@ pub fn streamDelimiterLimit( |
| 1010 | 1010 | delimiter: u8, |
| 1011 | 1011 | limit: Limit, |
| 1012 | 1012 | ) StreamDelimiterLimitError!usize { |
| 1013 | var remaining = @intFromEnum(limit); | |
| 1013 | var remaining = @backingInt(limit); | |
| 1014 | 1014 | while (remaining != 0) { |
| 1015 | 1015 | const available = Limit.limited(remaining).slice(r.peekGreedy(1) catch |err| switch (err) { |
| 1016 | 1016 | error.ReadFailed => |e| return e, |
| 1017 | error.EndOfStream => return @intFromEnum(limit) - remaining, | |
| 1017 | error.EndOfStream => return @backingInt(limit) - remaining, | |
| 1018 | 1018 | }); |
| 1019 | 1019 | if (std.mem.findScalar(u8, available, delimiter)) |delimiter_index| { |
| 1020 | 1020 | try w.writeAll(available[0..delimiter_index]); |
| 1021 | 1021 | r.toss(delimiter_index); |
| 1022 | 1022 | remaining -= delimiter_index; |
| 1023 | return @intFromEnum(limit) - remaining; | |
| 1023 | return @backingInt(limit) - remaining; | |
| 1024 | 1024 | } |
| 1025 | 1025 | try w.writeAll(available); |
| 1026 | 1026 | r.toss(available.len); |
| ... | ... | @@ -1081,16 +1081,16 @@ pub const DiscardDelimiterLimitError = error{ |
| 1081 | 1081 | /// Succeeds if stream ends before delimiter found. End of stream can be |
| 1082 | 1082 | /// detected by checking if the delimiter is buffered. |
| 1083 | 1083 | pub fn discardDelimiterLimit(r: *Reader, delimiter: u8, limit: Limit) DiscardDelimiterLimitError!usize { |
| 1084 | var remaining = @intFromEnum(limit); | |
| 1084 | var remaining = @backingInt(limit); | |
| 1085 | 1085 | while (remaining != 0) { |
| 1086 | 1086 | const available = Limit.limited(remaining).slice(r.peekGreedy(1) catch |err| switch (err) { |
| 1087 | 1087 | error.ReadFailed => |e| return e, |
| 1088 | error.EndOfStream => return @intFromEnum(limit) - remaining, | |
| 1088 | error.EndOfStream => return @backingInt(limit) - remaining, | |
| 1089 | 1089 | }); |
| 1090 | 1090 | if (std.mem.findScalar(u8, available, delimiter)) |delimiter_index| { |
| 1091 | 1091 | r.toss(delimiter_index); |
| 1092 | 1092 | remaining -= delimiter_index; |
| 1093 | return @intFromEnum(limit) - remaining; | |
| 1093 | return @backingInt(limit) - remaining; | |
| 1094 | 1094 | } |
| 1095 | 1095 | r.toss(available.len); |
| 1096 | 1096 | remaining -= available.len; |
| ... | ... | @@ -1704,7 +1704,7 @@ test takeEnum { |
| 1704 | 1704 | const E1 = enum(u8) { a, b, c }; |
| 1705 | 1705 | const E2 = enum(u16) { _ }; |
| 1706 | 1706 | try testing.expectEqual(E1.c, try r.takeEnum(E1, .little)); |
| 1707 | try testing.expectEqual(@as(E2, @enumFromInt(0x0001)), try r.takeEnum(E2, .big)); | |
| 1707 | try testing.expectEqual(@as(E2, @fromBackingInt(@intCast(0x0001))), try r.takeEnum(E2, .big)); | |
| 1708 | 1708 | } |
| 1709 | 1709 | |
| 1710 | 1710 | test readSliceShort { |
lib/std/Io/Reader/Limited.zig+2-2| ... | ... | @@ -40,11 +40,11 @@ test stream { |
| 40 | 40 | var fixed: std.Io.Reader = .fixed(&orig_buf); |
| 41 | 41 | |
| 42 | 42 | var limit_buf: [1]u8 = undefined; |
| 43 | var limited: std.Io.Reader.Limited = .init(&fixed, @enumFromInt(4), &limit_buf); | |
| 43 | var limited: std.Io.Reader.Limited = .init(&fixed, @fromBackingInt(@intCast(4)), &limit_buf); | |
| 44 | 44 | |
| 45 | 45 | var result_buf: [10]u8 = undefined; |
| 46 | 46 | var fixed_writer: std.Io.Writer = .fixed(&result_buf); |
| 47 | const streamed = try limited.interface.stream(&fixed_writer, @enumFromInt(7)); | |
| 47 | const streamed = try limited.interface.stream(&fixed_writer, @fromBackingInt(@intCast(7))); | |
| 48 | 48 | |
| 49 | 49 | try std.testing.expect(streamed == 4); |
| 50 | 50 | try std.testing.expectEqualStrings("test", result_buf[0..streamed]); |
lib/std/Io/Threaded.zig+66-66| ... | ... | @@ -581,7 +581,7 @@ const Group = struct { |
| 581 | 581 | var it = t.worker_threads.load(.acquire); // acquire `Thread` values |
| 582 | 582 | while (it) |thread| : (it = thread.next) { |
| 583 | 583 | // This non-mutating RMW exists for ordering reasons: see comment in `Group.Task.start` for reasons. |
| 584 | _ = thread.status.fetchOr(.{ .cancelation = @enumFromInt(0), .awaitable = .null }, .release); | |
| 584 | _ = thread.status.fetchOr(.{ .cancelation = @fromBackingInt(@intCast(0)), .awaitable = .null }, .release); | |
| 585 | 585 | if (thread.cancelAwaitable(.fromGroup(g.ptr))) any_blocked = true; |
| 586 | 586 | } |
| 587 | 587 | return any_blocked; |
| ... | ... | @@ -1019,7 +1019,7 @@ const Thread = struct { |
| 1019 | 1019 | }; |
| 1020 | 1020 | syscall.finish(); |
| 1021 | 1021 | if (status >= 0) return; |
| 1022 | switch (@as(c.E, @enumFromInt(-status))) { | |
| 1022 | switch (@as(c.E, @fromBackingInt(@intCast(-status)))) { | |
| 1023 | 1023 | .INTR => {}, // spurious wake |
| 1024 | 1024 | // Address of the futex was paged out. This is unlikely, but possible in theory, and |
| 1025 | 1025 | // pthread/libdispatch on darwin bother to handle it. In this case we'll return |
| ... | ... | @@ -1030,7 +1030,7 @@ const Thread = struct { |
| 1030 | 1030 | } |
| 1031 | 1031 | }, |
| 1032 | 1032 | .freebsd => { |
| 1033 | const flags = @intFromEnum(std.c.UMTX_OP.WAIT_UINT_PRIVATE); | |
| 1033 | const flags = @backingInt(std.c.UMTX_OP.WAIT_UINT_PRIVATE); | |
| 1034 | 1034 | var tm_size: usize = 0; |
| 1035 | 1035 | var tm: std.c._umtx_time = undefined; |
| 1036 | 1036 | var tm_ptr: ?*const std.c._umtx_time = null; |
| ... | ... | @@ -1147,7 +1147,7 @@ const Thread = struct { |
| 1147 | 1147 | while (true) { |
| 1148 | 1148 | const status = c.__ulock_wake(flags, ptr, 0); |
| 1149 | 1149 | if (status >= 0) return; |
| 1150 | switch (@as(c.E, @enumFromInt(-status))) { | |
| 1150 | switch (@as(c.E, @fromBackingInt(@intCast(-status)))) { | |
| 1151 | 1151 | .INTR, .CANCELED => continue, // spurious wake() |
| 1152 | 1152 | .FAULT => unreachable, // __ulock_wake doesn't generate EFAULT according to darwin pthread_cond_t |
| 1153 | 1153 | .NOENT => return, // nothing was woken up |
| ... | ... | @@ -1159,7 +1159,7 @@ const Thread = struct { |
| 1159 | 1159 | .freebsd => { |
| 1160 | 1160 | const rc = std.c._umtx_op( |
| 1161 | 1161 | @intFromPtr(ptr), |
| 1162 | @intFromEnum(std.c.UMTX_OP.WAKE_PRIVATE), | |
| 1162 | @backingInt(std.c.UMTX_OP.WAKE_PRIVATE), | |
| 1163 | 1163 | @as(c_ulong, @min(max_waiters, std.math.maxInt(c_int))), |
| 1164 | 1164 | 0, // there is no timeout struct |
| 1165 | 1165 | 0, // there is no timeout struct pointer |
| ... | ... | @@ -1283,9 +1283,9 @@ const Thread = struct { |
| 1283 | 1283 | .linux => { |
| 1284 | 1284 | const pid: posix.pid_t = pid: { |
| 1285 | 1285 | const cached_pid = @atomicLoad(Pid, &t.pid, .monotonic); |
| 1286 | if (cached_pid != .unknown) break :pid @intFromEnum(cached_pid); | |
| 1286 | if (cached_pid != .unknown) break :pid @backingInt(cached_pid); | |
| 1287 | 1287 | const pid = std.os.linux.getpid(); |
| 1288 | @atomicStore(Pid, &t.pid, @enumFromInt(pid), .monotonic); | |
| 1288 | @atomicStore(Pid, &t.pid, @fromBackingInt(@intCast(pid)), .monotonic); | |
| 1289 | 1289 | break :pid pid; |
| 1290 | 1290 | }; |
| 1291 | 1291 | return switch (std.os.linux.tgkill(pid, @bitCast(thread.id), .IO)) { |
| ... | ... | @@ -1352,7 +1352,7 @@ const Syscall = struct { |
| 1352 | 1352 | .unblocked => {}, |
| 1353 | 1353 | } |
| 1354 | 1354 | switch (thread.status.fetchOr(.{ |
| 1355 | .cancelation = @enumFromInt(0b011), | |
| 1355 | .cancelation = @fromBackingInt(@intCast(0b011)), | |
| 1356 | 1356 | .awaitable = .null, |
| 1357 | 1357 | }, .monotonic).cancelation) { |
| 1358 | 1358 | .parked => unreachable, |
| ... | ... | @@ -1372,7 +1372,7 @@ const Syscall = struct { |
| 1372 | 1372 | fn checkCancel(s: Syscall) Io.Cancelable!void { |
| 1373 | 1373 | const thread = s.thread orelse return; |
| 1374 | 1374 | switch (thread.status.fetchOr(.{ |
| 1375 | .cancelation = @enumFromInt(0b010), | |
| 1375 | .cancelation = @fromBackingInt(@intCast(0b010)), | |
| 1376 | 1376 | .awaitable = .null, |
| 1377 | 1377 | }, .monotonic).cancelation) { |
| 1378 | 1378 | .none => unreachable, |
| ... | ... | @@ -1389,7 +1389,7 @@ const Syscall = struct { |
| 1389 | 1389 | fn finish(s: Syscall) void { |
| 1390 | 1390 | const thread = s.thread orelse return; |
| 1391 | 1391 | switch (thread.status.fetchXor(.{ |
| 1392 | .cancelation = @enumFromInt(0b011), | |
| 1392 | .cancelation = @fromBackingInt(@intCast(0b011)), | |
| 1393 | 1393 | .awaitable = .null, |
| 1394 | 1394 | }, .monotonic).cancelation) { |
| 1395 | 1395 | .none => unreachable, |
| ... | ... | @@ -1474,7 +1474,7 @@ const AlertableSyscall = struct { |
| 1474 | 1474 | .unblocked => {}, |
| 1475 | 1475 | } |
| 1476 | 1476 | const old_status = thread.status.fetchOr(.{ |
| 1477 | .cancelation = @enumFromInt(0b010), | |
| 1477 | .cancelation = @fromBackingInt(@intCast(0b010)), | |
| 1478 | 1478 | .awaitable = .null, |
| 1479 | 1479 | }, .monotonic); |
| 1480 | 1480 | switch (old_status.cancelation) { |
| ... | ... | @@ -1497,7 +1497,7 @@ const AlertableSyscall = struct { |
| 1497 | 1497 | comptime assert(is_windows); |
| 1498 | 1498 | const thread = s.thread orelse return; |
| 1499 | 1499 | const old_status = thread.status.fetchOr(.{ |
| 1500 | .cancelation = @enumFromInt(0b010), | |
| 1500 | .cancelation = @fromBackingInt(@intCast(0b010)), | |
| 1501 | 1501 | .awaitable = .null, |
| 1502 | 1502 | }, .monotonic); |
| 1503 | 1503 | switch (old_status.cancelation) { |
| ... | ... | @@ -1520,7 +1520,7 @@ const AlertableSyscall = struct { |
| 1520 | 1520 | comptime assert(is_windows); |
| 1521 | 1521 | const thread = s.thread orelse return; |
| 1522 | 1522 | switch (thread.status.fetchXor(.{ |
| 1523 | .cancelation = @enumFromInt(0b010), | |
| 1523 | .cancelation = @fromBackingInt(@intCast(0b010)), | |
| 1524 | 1524 | .awaitable = .null, |
| 1525 | 1525 | }, .monotonic).cancelation) { |
| 1526 | 1526 | .none => unreachable, |
| ... | ... | @@ -2094,7 +2094,7 @@ fn async( |
| 2094 | 2094 | |
| 2095 | 2095 | const busy_count = t.busy_count; |
| 2096 | 2096 | |
| 2097 | if (busy_count >= @intFromEnum(t.async_limit)) { | |
| 2097 | if (busy_count >= @backingInt(t.async_limit)) { | |
| 2098 | 2098 | mutexUnlock(&t.mutex); |
| 2099 | 2099 | future.destroy(gpa); |
| 2100 | 2100 | start(context.ptr, result.ptr); |
| ... | ... | @@ -2147,7 +2147,7 @@ fn concurrent( |
| 2147 | 2147 | |
| 2148 | 2148 | const busy_count = t.busy_count; |
| 2149 | 2149 | |
| 2150 | if (busy_count >= @intFromEnum(t.concurrent_limit)) | |
| 2150 | if (busy_count >= @backingInt(t.concurrent_limit)) | |
| 2151 | 2151 | return error.ConcurrencyUnavailable; |
| 2152 | 2152 | |
| 2153 | 2153 | t.busy_count = busy_count + 1; |
| ... | ... | @@ -2191,7 +2191,7 @@ fn groupAsync( |
| 2191 | 2191 | |
| 2192 | 2192 | const busy_count = t.busy_count; |
| 2193 | 2193 | |
| 2194 | if (busy_count >= @intFromEnum(t.async_limit)) { | |
| 2194 | if (busy_count >= @backingInt(t.async_limit)) { | |
| 2195 | 2195 | mutexUnlock(&t.mutex); |
| 2196 | 2196 | task.destroy(gpa); |
| 2197 | 2197 | return groupAsyncEager(start, context.ptr); |
| ... | ... | @@ -2255,7 +2255,7 @@ fn groupConcurrent( |
| 2255 | 2255 | |
| 2256 | 2256 | const busy_count = t.busy_count; |
| 2257 | 2257 | |
| 2258 | if (busy_count >= @intFromEnum(t.concurrent_limit)) | |
| 2258 | if (busy_count >= @backingInt(t.concurrent_limit)) | |
| 2259 | 2259 | return error.ConcurrencyUnavailable; |
| 2260 | 2260 | |
| 2261 | 2261 | t.busy_count = busy_count + 1; |
| ... | ... | @@ -2382,7 +2382,7 @@ fn recancel(userdata: ?*anyopaque) void { |
| 2382 | 2382 | fn recancelInner() void { |
| 2383 | 2383 | const thread = Thread.current.?; // called `recancel` but was not canceled |
| 2384 | 2384 | switch (thread.status.fetchXor(.{ |
| 2385 | .cancelation = @enumFromInt(0b001), | |
| 2385 | .cancelation = @fromBackingInt(@intCast(0b001)), | |
| 2386 | 2386 | .awaitable = .null, |
| 2387 | 2387 | }, .monotonic).cancelation) { |
| 2388 | 2388 | .canceled => {}, |
| ... | ... | @@ -5347,7 +5347,7 @@ fn dirOpenDirHaiku( |
| 5347 | 5347 | syscall.finish(); |
| 5348 | 5348 | return .{ .handle = rc }; |
| 5349 | 5349 | } |
| 5350 | switch (@as(posix.E, @enumFromInt(rc))) { | |
| 5350 | switch (@as(posix.E, @fromBackingInt(@intCast(rc)))) { | |
| 5351 | 5351 | .INTR => { |
| 5352 | 5352 | try syscall.checkCancel(); |
| 5353 | 5353 | continue; |
| ... | ... | @@ -5826,7 +5826,7 @@ fn dirReadHaiku(userdata: ?*anyopaque, dr: *Dir.Reader, buffer: []Dir.Entry) Dir |
| 5826 | 5826 | const syscall: Syscall = try .start(); |
| 5827 | 5827 | while (true) { |
| 5828 | 5828 | const rc = posix.system._kern_rewind_dir(dr.dir.handle); |
| 5829 | switch (@as(posix.E, @enumFromInt(@min(rc, 0)))) { | |
| 5829 | switch (@as(posix.E, @fromBackingInt(@intCast(@min(rc, 0))))) { | |
| 5830 | 5830 | .SUCCESS => { |
| 5831 | 5831 | syscall.finish(); |
| 5832 | 5832 | break; |
| ... | ... | @@ -5848,7 +5848,7 @@ fn dirReadHaiku(userdata: ?*anyopaque, dr: *Dir.Reader, buffer: []Dir.Entry) Dir |
| 5848 | 5848 | const syscall: Syscall = try .start(); |
| 5849 | 5849 | const n: usize = while (true) { |
| 5850 | 5850 | const rc = posix.system._kern_read_dir(dr.dir.handle, dr.buffer.ptr, dr.buffer.len, @truncate(dr.buffer.len / @sizeOf(posix.system.DirEnt))); |
| 5851 | switch (@as(posix.E, @enumFromInt(@min(rc, 0)))) { | |
| 5851 | switch (@as(posix.E, @fromBackingInt(@intCast(@min(rc, 0))))) { | |
| 5852 | 5852 | .SUCCESS => { |
| 5853 | 5853 | syscall.finish(); |
| 5854 | 5854 | break @intCast(rc); |
| ... | ... | @@ -5891,7 +5891,7 @@ fn dirReadHaiku(userdata: ?*anyopaque, dr: *Dir.Reader, buffer: []Dir.Entry) Dir |
| 5891 | 5891 | const syscall: Syscall = try .start(); |
| 5892 | 5892 | while (true) { |
| 5893 | 5893 | const rc = posix.system._kern_read_stat(dr.dir.handle, name, false, &stat, @sizeOf(std.c.Stat)); |
| 5894 | switch (@as(posix.E, @enumFromInt(@min(rc, 0)))) { | |
| 5894 | switch (@as(posix.E, @fromBackingInt(@intCast(@min(rc, 0))))) { | |
| 5895 | 5895 | .SUCCESS => { |
| 5896 | 5896 | syscall.finish(); |
| 5897 | 5897 | break; |
| ... | ... | @@ -6819,7 +6819,7 @@ fn dirRealPathFilePosix(userdata: ?*anyopaque, dir: Dir, sub_path: []const u8, o |
| 6819 | 6819 | assert(redundant_pointer == out_buffer.ptr); |
| 6820 | 6820 | return std.mem.indexOfScalar(u8, out_buffer, 0) orelse out_buffer.len; |
| 6821 | 6821 | } |
| 6822 | const err: posix.E = @enumFromInt(std.c._errno().*); | |
| 6822 | const err: posix.E = @fromBackingInt(@intCast(std.c._errno().*)); | |
| 6823 | 6823 | if (err == .INTR) { |
| 6824 | 6824 | try syscall.checkCancel(); |
| 6825 | 6825 | continue; |
| ... | ... | @@ -10477,7 +10477,7 @@ fn processExecutablePath(userdata: ?*anyopaque, out_buffer: []u8) process.Execut |
| 10477 | 10477 | if (std.c.realpath(argv0, &resolved_buf)) |p| { |
| 10478 | 10478 | assert(p == &resolved_buf); |
| 10479 | 10479 | break syscall.finish(); |
| 10480 | } else switch (@as(std.c.E, @enumFromInt(std.c._errno().*))) { | |
| 10480 | } else switch (@as(std.c.E, @fromBackingInt(@intCast(std.c._errno().*)))) { | |
| 10481 | 10481 | .INTR => { |
| 10482 | 10482 | try syscall.checkCancel(); |
| 10483 | 10483 | continue; |
| ... | ... | @@ -10520,7 +10520,7 @@ fn processExecutablePath(userdata: ?*anyopaque, out_buffer: []u8) process.Execut |
| 10520 | 10520 | if (std.c.realpath(resolved_path, &resolved_buf)) |p| { |
| 10521 | 10521 | assert(p == &resolved_buf); |
| 10522 | 10522 | break syscall.finish(); |
| 10523 | } else switch (@as(std.c.E, @enumFromInt(std.c._errno().*))) { | |
| 10523 | } else switch (@as(std.c.E, @fromBackingInt(@intCast(std.c._errno().*)))) { | |
| 10524 | 10524 | .INTR => { |
| 10525 | 10525 | try syscall.checkCancel(); |
| 10526 | 10526 | continue; |
| ... | ... | @@ -10979,12 +10979,12 @@ fn fileWriteFileStreaming( |
| 10979 | 10979 | ) File.Writer.WriteFileError!usize { |
| 10980 | 10980 | const t: *Threaded = @ptrCast(@alignCast(userdata)); |
| 10981 | 10981 | const reader_buffered = file_reader.interface.buffered(); |
| 10982 | if (reader_buffered.len >= @intFromEnum(limit)) { | |
| 10982 | if (reader_buffered.len >= @backingInt(limit)) { | |
| 10983 | 10983 | const n = try fileWriteStreaming(t, file, header, &.{limit.slice(reader_buffered)}, 1); |
| 10984 | 10984 | file_reader.interface.toss(n -| header.len); |
| 10985 | 10985 | return n; |
| 10986 | 10986 | } |
| 10987 | const file_limit = @intFromEnum(limit) - reader_buffered.len; | |
| 10987 | const file_limit = @backingInt(limit) - reader_buffered.len; | |
| 10988 | 10988 | const out_fd = file.handle; |
| 10989 | 10989 | const in_fd = file_reader.file.handle; |
| 10990 | 10990 | |
| ... | ... | @@ -11186,7 +11186,7 @@ fn fileWriteFileStreaming( |
| 11186 | 11186 | .positional => o: { |
| 11187 | 11187 | const size = file_reader.getSize() catch return 0; |
| 11188 | 11188 | off = std.math.cast(std.os.linux.off_t, file_reader.pos) orelse return error.ReadFailed; |
| 11189 | break :o .{ &off, @min(@intFromEnum(limit), size - file_reader.pos, max_count) }; | |
| 11189 | break :o .{ &off, @min(@backingInt(limit), size - file_reader.pos, max_count) }; | |
| 11190 | 11190 | }, |
| 11191 | 11191 | .streaming => .{ null, limit.minInt(max_count) }, |
| 11192 | 11192 | .streaming_simple, .positional_simple => break :sf, |
| ... | ... | @@ -11258,7 +11258,7 @@ fn fileWriteFileStreaming( |
| 11258 | 11258 | file_reader.interface.toss(n -| header.len); |
| 11259 | 11259 | return n; |
| 11260 | 11260 | } |
| 11261 | var len: usize = @intFromEnum(limit); | |
| 11261 | var len: usize = @backingInt(limit); | |
| 11262 | 11262 | var off_in: i64 = undefined; |
| 11263 | 11263 | const off_in_ptr: ?*i64 = switch (file_reader.mode) { |
| 11264 | 11264 | .positional_simple, .streaming_simple => return error.Unimplemented, |
| ... | ... | @@ -11318,7 +11318,7 @@ fn fileWriteFileStreaming( |
| 11318 | 11318 | .freebsd => n: { |
| 11319 | 11319 | const syscall: Syscall = try .start(); |
| 11320 | 11320 | while (true) { |
| 11321 | const rc = std.c.copy_file_range(in_fd, off_in_ptr, out_fd, null, @intFromEnum(limit), 0); | |
| 11321 | const rc = std.c.copy_file_range(in_fd, off_in_ptr, out_fd, null, @backingInt(limit), 0); | |
| 11322 | 11322 | switch (std.c.errno(rc)) { |
| 11323 | 11323 | .SUCCESS => { |
| 11324 | 11324 | syscall.finish(); |
| ... | ... | @@ -11392,7 +11392,7 @@ fn fileWriteFilePositional( |
| 11392 | 11392 | ) File.WriteFilePositionalError!usize { |
| 11393 | 11393 | const t: *Threaded = @ptrCast(@alignCast(userdata)); |
| 11394 | 11394 | const reader_buffered = file_reader.interface.buffered(); |
| 11395 | if (reader_buffered.len >= @intFromEnum(limit)) { | |
| 11395 | if (reader_buffered.len >= @backingInt(limit)) { | |
| 11396 | 11396 | const n = try fileWritePositional(t, file, header, &.{limit.slice(reader_buffered)}, 1, offset); |
| 11397 | 11397 | file_reader.interface.toss(n -| header.len); |
| 11398 | 11398 | return n; |
| ... | ... | @@ -11419,7 +11419,7 @@ fn fileWriteFilePositional( |
| 11419 | 11419 | file_reader.interface.toss(n -| header.len); |
| 11420 | 11420 | return n; |
| 11421 | 11421 | } |
| 11422 | var len: usize = @min(@intFromEnum(limit), std.math.maxInt(usize) - offset); | |
| 11422 | var len: usize = @min(@backingInt(limit), std.math.maxInt(usize) - offset); | |
| 11423 | 11423 | var off_in: i64 = undefined; |
| 11424 | 11424 | const off_in_ptr: ?*i64 = switch (file_reader.mode) { |
| 11425 | 11425 | .positional_simple, .streaming_simple => return error.Unimplemented, |
| ... | ... | @@ -11481,7 +11481,7 @@ fn fileWriteFilePositional( |
| 11481 | 11481 | .freebsd => n: { |
| 11482 | 11482 | const syscall: Syscall = try .start(); |
| 11483 | 11483 | while (true) { |
| 11484 | const rc = std.c.copy_file_range(in_fd, off_in_ptr, out_fd, &off_out, @intFromEnum(limit), 0); | |
| 11484 | const rc = std.c.copy_file_range(in_fd, off_in_ptr, out_fd, &off_out, @backingInt(limit), 0); | |
| 11485 | 11485 | switch (std.c.errno(rc)) { |
| 11486 | 11486 | .SUCCESS => { |
| 11487 | 11487 | syscall.finish(); |
| ... | ... | @@ -11751,7 +11751,7 @@ fn sleepPosix(timeout: Io.Timeout) Io.Cancelable!void { |
| 11751 | 11751 | .deadline => true, |
| 11752 | 11752 | } }, &timespec, &timespec); |
| 11753 | 11753 | // POSIX-standard libc clock_nanosleep() returns *positive* errno values directly |
| 11754 | switch (if (builtin.link_libc) @as(posix.E, @enumFromInt(rc)) else posix.errno(rc)) { | |
| 11754 | switch (if (builtin.link_libc) @as(posix.E, @fromBackingInt(@intCast(rc))) else posix.errno(rc)) { | |
| 11755 | 11755 | .INTR => { |
| 11756 | 11756 | try syscall.checkCancel(); |
| 11757 | 11757 | continue; |
| ... | ... | @@ -13525,7 +13525,7 @@ fn netInterfaceNameResolve( |
| 13525 | 13525 | .INVALID_PARAMETER => unreachable, |
| 13526 | 13526 | else => |err| return windows.unexpectedError(err), |
| 13527 | 13527 | } |
| 13528 | return .{ .index = @intFromEnum(index) }; | |
| 13528 | return .{ .index = @backingInt(index) }; | |
| 13529 | 13529 | } |
| 13530 | 13530 | |
| 13531 | 13531 | if (builtin.link_libc) { |
| ... | ... | @@ -13588,7 +13588,7 @@ fn netInterfaceName(userdata: ?*anyopaque, interface: net.Interface) net.Interfa |
| 13588 | 13588 | } |
| 13589 | 13589 | try Thread.checkCancel(); |
| 13590 | 13590 | var luid: windows.NET.LUID = undefined; |
| 13591 | switch (ConvertInterfaceIndexToLuid.?(@enumFromInt(interface.index), &luid)) { | |
| 13591 | switch (ConvertInterfaceIndexToLuid.?(@fromBackingInt(@intCast(interface.index)), &luid)) { | |
| 13592 | 13592 | .SUCCESS => {}, |
| 13593 | 13593 | .FILE_NOT_FOUND => return error.InterfaceNotFound, |
| 13594 | 13594 | .INVALID_PARAMETER => unreachable, |
| ... | ... | @@ -13884,7 +13884,7 @@ fn netLookupFallible( |
| 13884 | 13884 | const syscall: Syscall = try .start(); |
| 13885 | 13885 | while (true) { |
| 13886 | 13886 | switch (posix.system.getaddrinfo(name_c.ptr, port_c.ptr, &hints, &res)) { |
| 13887 | @as(posix.system.EAI, @enumFromInt(0)) => { | |
| 13887 | @as(posix.system.EAI, @fromBackingInt(@intCast(0))) => { | |
| 13888 | 13888 | syscall.finish(); |
| 13889 | 13889 | break; |
| 13890 | 13890 | }, |
| ... | ... | @@ -14029,7 +14029,7 @@ fn processCurrentPath(userdata: ?*anyopaque, buffer: []u8) process.CurrentPathEr |
| 14029 | 14029 | |
| 14030 | 14030 | const err: posix.E = if (builtin.link_libc) err: { |
| 14031 | 14031 | const c_err = if (std.c.getcwd(buffer.ptr, buffer.len)) |_| 0 else std.c._errno().*; |
| 14032 | break :err @enumFromInt(c_err); | |
| 14032 | break :err @fromBackingInt(@intCast(c_err)); | |
| 14033 | 14033 | } else err: { |
| 14034 | 14034 | break :err posix.errno(posix.system.getcwd(buffer.ptr, buffer.len)); |
| 14035 | 14035 | }; |
| ... | ... | @@ -14223,12 +14223,12 @@ pub fn posixSocketModeProtocol(family: posix.sa_family_t, mode: net.Socket.Mode, |
| 14223 | 14223 | .raw => posix.SOCK.RAW, |
| 14224 | 14224 | .rdm => if (@hasDecl(posix.SOCK, "RDM")) posix.SOCK.RDM else return error.OptionUnsupported, |
| 14225 | 14225 | }, |
| 14226 | if (protocol) |p| @intFromEnum(p) else if (is_windows) switch (family) { | |
| 14226 | if (protocol) |p| @backingInt(p) else if (is_windows) switch (family) { | |
| 14227 | 14227 | posix.AF.UNIX => switch (mode) { |
| 14228 | 14228 | .stream => 0, |
| 14229 | 14229 | else => return error.ProtocolUnsupportedByAddressFamily, |
| 14230 | 14230 | }, |
| 14231 | posix.AF.INET, posix.AF.INET6 => @intFromEnum(@as(net.Protocol, switch (mode) { | |
| 14231 | posix.AF.INET, posix.AF.INET6 => @backingInt(@as(net.Protocol, switch (mode) { | |
| 14232 | 14232 | .stream => .tcp, |
| 14233 | 14233 | .dgram => .udp, |
| 14234 | 14234 | else => return error.ProtocolUnsupportedByAddressFamily, |
| ... | ... | @@ -14824,7 +14824,7 @@ fn writeResolutionQuery(q: *[280]u8, op: u4, dname: []const u8, class: u8, ty: H |
| 14824 | 14824 | if (j - i - 1 > 62) unreachable; |
| 14825 | 14825 | q[i - 1] = @intCast(j - i); |
| 14826 | 14826 | } |
| 14827 | q[i + 1] = @intFromEnum(ty); | |
| 14827 | q[i + 1] = @backingInt(ty); | |
| 14828 | 14828 | q[i + 3] = class; |
| 14829 | 14829 | return n; |
| 14830 | 14830 | } |
| ... | ... | @@ -15299,8 +15299,8 @@ fn childKill(userdata: ?*anyopaque, child: *process.Child) void { |
| 15299 | 15299 | fn childKillWindows(t: *Threaded, child: *process.Child, exit_code: windows.UINT) !void { |
| 15300 | 15300 | _ = t; // TODO cancelation |
| 15301 | 15301 | const handle = child.id.?; |
| 15302 | _ = windows.ntdll.RtlReportSilentProcessExit(handle, @enumFromInt(exit_code)); | |
| 15303 | switch (windows.ntdll.NtTerminateProcess(handle, @enumFromInt(exit_code))) { | |
| 15302 | _ = windows.ntdll.RtlReportSilentProcessExit(handle, @fromBackingInt(@intCast(exit_code))); | |
| 15303 | switch (windows.ntdll.NtTerminateProcess(handle, @fromBackingInt(@intCast(exit_code)))) { | |
| 15304 | 15304 | .SUCCESS, .PROCESS_IS_TERMINATING => { |
| 15305 | 15305 | const infinite_timeout: windows.LARGE_INTEGER = std.math.minInt(windows.LARGE_INTEGER); |
| 15306 | 15306 | _ = windows.ntdll.NtWaitForSingleObject(handle, .FALSE, &infinite_timeout); |
| ... | ... | @@ -15344,7 +15344,7 @@ fn childWaitWindows(child: *process.Child) process.Child.WaitError!process.Child |
| 15344 | 15344 | @sizeOf(windows.PROCESS.BASIC_INFORMATION), |
| 15345 | 15345 | null, |
| 15346 | 15346 | )) { |
| 15347 | .SUCCESS => .{ .exited = @as(u8, @truncate(@intFromEnum(info.ExitStatus))) }, | |
| 15347 | .SUCCESS => .{ .exited = @as(u8, @truncate(@backingInt(info.ExitStatus))) }, | |
| 15348 | 15348 | else => .{ .unknown = 0 }, |
| 15349 | 15349 | }; |
| 15350 | 15350 | |
| ... | ... | @@ -15424,11 +15424,11 @@ fn childWaitPosix(child: *process.Child) process.Child.WaitError!process.Child.T |
| 15424 | 15424 | syscall.finish(); |
| 15425 | 15425 | if (ru_ptr) |p| child.resource_usage_statistics.rusage = p.*; |
| 15426 | 15426 | const status: u32 = @bitCast(info.fields.common.second.sigchld.status); |
| 15427 | const code: linux.CLD = @enumFromInt(info.code); | |
| 15427 | const code: linux.CLD = @fromBackingInt(@intCast(info.code)); | |
| 15428 | 15428 | return switch (code) { |
| 15429 | 15429 | .EXITED => .{ .exited = @truncate(status) }, |
| 15430 | .KILLED, .DUMPED => .{ .signal = @enumFromInt(status) }, | |
| 15431 | .TRAPPED, .STOPPED => .{ .stopped = @enumFromInt(status) }, | |
| 15430 | .KILLED, .DUMPED => .{ .signal = @fromBackingInt(@intCast(status)) }, | |
| 15431 | .TRAPPED, .STOPPED => .{ .stopped = @fromBackingInt(@intCast(status)) }, | |
| 15432 | 15432 | _, .CONTINUED => .{ .unknown = status }, |
| 15433 | 15433 | }; |
| 15434 | 15434 | }, |
| ... | ... | @@ -16254,7 +16254,7 @@ fn windowsCreateProcessPathExt( |
| 16254 | 16254 | // fails to spawn, in which case we still want to try the PATHEXT appended versions. |
| 16255 | 16255 | unappended_exists = true; |
| 16256 | 16256 | } else if (windowsCreateProcessSupportsExtension(filename[app_name_len..])) |pathext_ext| { |
| 16257 | pathext_seen[@intFromEnum(pathext_ext)] = true; | |
| 16257 | pathext_seen[@backingInt(pathext_ext)] = true; | |
| 16258 | 16258 | any_pathext_seen = true; |
| 16259 | 16259 | } |
| 16260 | 16260 | } |
| ... | ... | @@ -16327,7 +16327,7 @@ fn windowsCreateProcessPathExt( |
| 16327 | 16327 | var ext_it = std.mem.tokenizeScalar(u16, pathext, ';'); |
| 16328 | 16328 | while (ext_it.next()) |ext| { |
| 16329 | 16329 | const ext_enum = windowsCreateProcessSupportsExtension(ext) orelse continue; |
| 16330 | if (!pathext_seen[@intFromEnum(ext_enum)]) continue; | |
| 16330 | if (!pathext_seen[@backingInt(ext_enum)]) continue; | |
| 16331 | 16331 | |
| 16332 | 16332 | dir_buf.shrinkRetainingCapacity(dir_path_len); |
| 16333 | 16333 | if (dir_path_len != 0) switch (dir_buf.items[dir_buf.items.len - 1]) { |
| ... | ... | @@ -16451,10 +16451,10 @@ fn windowsCreateProcessSupportsExtension(ext: []const u16) ?process.WindowsExten |
| 16451 | 16451 | // Ensures keeping this function in sync with the enum. |
| 16452 | 16452 | const field_names = @typeInfo(process.WindowsExtension).@"enum".field_names; |
| 16453 | 16453 | assert(field_names.len == 4); |
| 16454 | assert(@intFromEnum(process.WindowsExtension.bat) == 0); | |
| 16455 | assert(@intFromEnum(process.WindowsExtension.cmd) == 1); | |
| 16456 | assert(@intFromEnum(process.WindowsExtension.com) == 2); | |
| 16457 | assert(@intFromEnum(process.WindowsExtension.exe) == 3); | |
| 16454 | assert(@backingInt(process.WindowsExtension.bat) == 0); | |
| 16455 | assert(@backingInt(process.WindowsExtension.cmd) == 1); | |
| 16456 | assert(@backingInt(process.WindowsExtension.com) == 2); | |
| 16457 | assert(@backingInt(process.WindowsExtension.exe) == 3); | |
| 16458 | 16458 | } |
| 16459 | 16459 | |
| 16460 | 16460 | if (ext.len != 4) return null; |
| ... | ... | @@ -17509,7 +17509,7 @@ const parking_futex = struct { |
| 17509 | 17509 | } |
| 17510 | 17510 | thread.futex_waiter = &waiter; |
| 17511 | 17511 | const old_status = thread.status.fetchOr( |
| 17512 | .{ .cancelation = @enumFromInt(0b001), .awaitable = .null }, | |
| 17512 | .{ .cancelation = @fromBackingInt(@intCast(0b001)), .awaitable = .null }, | |
| 17513 | 17513 | .release, // release `thread.futex_waiter` |
| 17514 | 17514 | ); |
| 17515 | 17515 | switch (old_status.cancelation) { |
| ... | ... | @@ -17547,7 +17547,7 @@ const parking_futex = struct { |
| 17547 | 17547 | error.Timeout => { |
| 17548 | 17548 | // We're not out of the woods yet: an unpark could race with the timeout. |
| 17549 | 17549 | const old_status = waiter.thread_status.fetchAnd( |
| 17550 | .{ .cancelation = @enumFromInt(0b110), .awaitable = .all_ones }, | |
| 17550 | .{ .cancelation = @fromBackingInt(@intCast(0b110)), .awaitable = .all_ones }, | |
| 17551 | 17551 | .monotonic, |
| 17552 | 17552 | ); |
| 17553 | 17553 | switch (old_status.cancelation) { |
| ... | ... | @@ -17604,7 +17604,7 @@ const parking_futex = struct { |
| 17604 | 17604 | it = waiter.node.next; |
| 17605 | 17605 | if (waiter.address != @intFromPtr(ptr)) continue; |
| 17606 | 17606 | const old_status = waiter.thread_status.fetchAnd( |
| 17607 | .{ .cancelation = @enumFromInt(0b110), .awaitable = .all_ones }, | |
| 17607 | .{ .cancelation = @fromBackingInt(@intCast(0b110)), .awaitable = .all_ones }, | |
| 17608 | 17608 | .monotonic, |
| 17609 | 17609 | ); |
| 17610 | 17610 | switch (old_status.cancelation) { |
| ... | ... | @@ -17669,7 +17669,7 @@ const parking_sleep = struct { |
| 17669 | 17669 | thread.futex_waiter = null; |
| 17670 | 17670 | { |
| 17671 | 17671 | const old_status = thread.status.fetchOr( |
| 17672 | .{ .cancelation = @enumFromInt(0b001), .awaitable = .null }, | |
| 17672 | .{ .cancelation = @fromBackingInt(@intCast(0b001)), .awaitable = .null }, | |
| 17673 | 17673 | .release, // release `thread.futex_waiter` |
| 17674 | 17674 | ); |
| 17675 | 17675 | switch (old_status.cancelation) { |
| ... | ... | @@ -17696,7 +17696,7 @@ const parking_sleep = struct { |
| 17696 | 17696 | error.Timeout => { |
| 17697 | 17697 | // We're not out of the woods yet: an unpark could race with the timeout. |
| 17698 | 17698 | const old_status = thread.status.fetchAnd( |
| 17699 | .{ .cancelation = @enumFromInt(0b110), .awaitable = .all_ones }, | |
| 17699 | .{ .cancelation = @fromBackingInt(@intCast(0b110)), .awaitable = .all_ones }, | |
| 17700 | 17700 | .monotonic, |
| 17701 | 17701 | ); |
| 17702 | 17702 | switch (old_status.cancelation) { |
| ... | ... | @@ -17747,12 +17747,12 @@ const ParkingMutex = struct { |
| 17747 | 17747 | _, |
| 17748 | 17748 | /// Returns the head of the waiter list. Illegal to call if `s == .unlocked`. |
| 17749 | 17749 | fn waiter(s: State) ?*Waiter { |
| 17750 | return @ptrFromInt(@intFromEnum(s)); | |
| 17750 | return @ptrFromInt(@backingInt(s)); | |
| 17751 | 17751 | } |
| 17752 | 17752 | /// Returns a locked state where `w` is contending the lock. |
| 17753 | 17753 | /// If `w` is `null`, returns `.locked_once`. |
| 17754 | 17754 | fn fromWaiter(w: ?*Waiter) State { |
| 17755 | return @enumFromInt(@intFromPtr(w)); | |
| 17755 | return @fromBackingInt(@intCast(@intFromPtr(w))); | |
| 17756 | 17756 | } |
| 17757 | 17757 | }; |
| 17758 | 17758 | const Waiter = struct { |
| ... | ... | @@ -18316,7 +18316,7 @@ fn createFileMap( |
| 18316 | 18316 | if (rc != std.c.MAP_FAILED) { |
| 18317 | 18317 | break @as([*]align(page_align) u8, @ptrCast(@alignCast(rc)))[0..len]; |
| 18318 | 18318 | } |
| 18319 | break :e @enumFromInt(posix.system._errno().*); | |
| 18319 | break :e @fromBackingInt(@intCast(posix.system._errno().*)); | |
| 18320 | 18320 | } else e: { |
| 18321 | 18321 | const err = posix.errno(rc); |
| 18322 | 18322 | if (err == .SUCCESS) { |
| ... | ... | @@ -18409,7 +18409,7 @@ fn fileMemoryMapSetLength( |
| 18409 | 18409 | syscall.finish(); |
| 18410 | 18410 | const err: posix.E = if (builtin.link_libc) e: { |
| 18411 | 18411 | if (rc != std.c.MAP_FAILED) break @as([*]align(page_align) u8, @ptrCast(@alignCast(rc)))[0..new_len]; |
| 18412 | break :e @enumFromInt(posix.system._errno().*); | |
| 18412 | break :e @fromBackingInt(@intCast(posix.system._errno().*)); | |
| 18413 | 18413 | } else e: { |
| 18414 | 18414 | const err = posix.errno(rc); |
| 18415 | 18415 | if (err == .SUCCESS) break @as([*]align(page_align) u8, @ptrFromInt(rc))[0..new_len]; |
| ... | ... | @@ -18733,7 +18733,7 @@ fn deviceIoControl(o: *const Io.Operation.DeviceIoControl) Io.Cancelable!Io.Oper |
| 18733 | 18733 | }, |
| 18734 | 18734 | else => |err| { |
| 18735 | 18735 | syscall.finish(); |
| 18736 | return -@as(i32, @intFromEnum(err)); | |
| 18736 | return -@as(i32, @backingInt(err)); | |
| 18737 | 18737 | }, |
| 18738 | 18738 | } |
| 18739 | 18739 | } |
| ... | ... | @@ -18782,7 +18782,7 @@ fn eventWait(event: *Io.Event) void { |
| 18782 | 18782 | .is_set => return, |
| 18783 | 18783 | }; |
| 18784 | 18784 | while (true) { |
| 18785 | Thread.futexWaitUncancelable(@ptrCast(event), @intFromEnum(Io.Event.waiting), null); | |
| 18785 | Thread.futexWaitUncancelable(@ptrCast(event), @backingInt(Io.Event.waiting), null); | |
| 18786 | 18786 | switch (@atomicLoad(Io.Event, event, .acquire)) { |
| 18787 | 18787 | .unset => unreachable, // `reset` called before pending `wait` returned |
| 18788 | 18788 | .waiting => continue, |
| ... | ... | @@ -18881,10 +18881,10 @@ pub fn mutexLock(m: *Io.Mutex) void { |
| 18881 | 18881 | return; |
| 18882 | 18882 | }; |
| 18883 | 18883 | if (initial_state == .contended) { |
| 18884 | Thread.futexWaitUncancelable(@ptrCast(&m.state.raw), @intFromEnum(Io.Mutex.State.contended), null); | |
| 18884 | Thread.futexWaitUncancelable(@ptrCast(&m.state.raw), @backingInt(Io.Mutex.State.contended), null); | |
| 18885 | 18885 | } |
| 18886 | 18886 | while (m.state.swap(.contended, .acquire) != .unlocked) { |
| 18887 | Thread.futexWaitUncancelable(@ptrCast(&m.state.raw), @intFromEnum(Io.Mutex.State.contended), null); | |
| 18887 | Thread.futexWaitUncancelable(@ptrCast(&m.state.raw), @backingInt(Io.Mutex.State.contended), null); | |
| 18888 | 18888 | } |
| 18889 | 18889 | } |
| 18890 | 18890 |
lib/std/Io/Uring.zig+31-31| ... | ... | @@ -177,11 +177,11 @@ const Fiber = struct { |
| 177 | 177 | _, |
| 178 | 178 | |
| 179 | 179 | fn subWrap(lhs: Awaiting, rhs: Awaiting) Awaiting { |
| 180 | return @enumFromInt(@intFromEnum(lhs) -% @intFromEnum(rhs)); | |
| 180 | return @fromBackingInt(@intCast(@backingInt(lhs) -% @backingInt(rhs))); | |
| 181 | 181 | } |
| 182 | 182 | |
| 183 | 183 | fn fromIoUringFd(fd: fd_t) Awaiting { |
| 184 | const awaiting: Awaiting = @enumFromInt(fd); | |
| 184 | const awaiting: Awaiting = @fromBackingInt(@intCast(fd)); | |
| 185 | 185 | switch (awaiting) { |
| 186 | 186 | .nothing, .group => unreachable, |
| 187 | 187 | _ => return awaiting, |
| ... | ... | @@ -191,7 +191,7 @@ const Fiber = struct { |
| 191 | 191 | fn toIoUringFd(awaiting: Awaiting) fd_t { |
| 192 | 192 | switch (awaiting) { |
| 193 | 193 | .nothing, .group => unreachable, |
| 194 | _ => return @intFromEnum(awaiting), | |
| 194 | _ => return @backingInt(awaiting), | |
| 195 | 195 | } |
| 196 | 196 | } |
| 197 | 197 | }; |
| ... | ... | @@ -217,7 +217,7 @@ const Fiber = struct { |
| 217 | 217 | const unblocked: CancelProtection = .{ .user = .unblocked, .acknowledged = false }; |
| 218 | 218 | |
| 219 | 219 | fn check(cancel_protection: CancelProtection) Io.CancelProtection { |
| 220 | return @enumFromInt(@intFromBool(cancel_protection != unblocked)); | |
| 220 | return @fromBackingInt(@intCast(@intFromBool(cancel_protection != unblocked))); | |
| 221 | 221 | } |
| 222 | 222 | |
| 223 | 223 | fn acknowledge(cancel_protection: *CancelProtection) void { |
| ... | ... | @@ -359,7 +359,7 @@ const Fiber = struct { |
| 359 | 359 | Fiber.CancelStatus, |
| 360 | 360 | &fiber.cancel_status, |
| 361 | 361 | .Or, |
| 362 | .{ .requested = true, .awaiting = @enumFromInt(0) }, | |
| 362 | .{ .requested = true, .awaiting = @fromBackingInt(@intCast(0)) }, | |
| 363 | 363 | .acquire, |
| 364 | 364 | ); |
| 365 | 365 | assert(!cancel_status.requested); |
| ... | ... | @@ -385,7 +385,7 @@ const Fiber = struct { |
| 385 | 385 | .addr = @intFromPtr(fiber), |
| 386 | 386 | .len = 0, |
| 387 | 387 | .rw_flags = 0, |
| 388 | .user_data = @intFromEnum(Completion.Userdata.wakeup), | |
| 388 | .user_data = @backingInt(Completion.Userdata.wakeup), | |
| 389 | 389 | .buf_index = 0, |
| 390 | 390 | .personality = 0, |
| 391 | 391 | .splice_fd_in = 0, |
| ... | ... | @@ -397,10 +397,10 @@ const Fiber = struct { |
| 397 | 397 | .ioprio = 0, |
| 398 | 398 | .fd = awaiting_io_uring_fd, |
| 399 | 399 | .off = @intFromPtr(fiber) | 0b01, |
| 400 | .addr = @intFromEnum(linux.IORING_MSG_RING_COMMAND.DATA), | |
| 400 | .addr = @backingInt(linux.IORING_MSG_RING_COMMAND.DATA), | |
| 401 | 401 | .len = 0, |
| 402 | 402 | .rw_flags = 0, |
| 403 | .user_data = @intFromEnum(Completion.Userdata.cleanup), | |
| 403 | .user_data = @backingInt(Completion.Userdata.cleanup), | |
| 404 | 404 | .buf_index = 0, |
| 405 | 405 | .personality = 0, |
| 406 | 406 | .splice_fd_in = 0, |
| ... | ... | @@ -537,11 +537,11 @@ const CachedFd = struct { |
| 537 | 537 | _, |
| 538 | 538 | |
| 539 | 539 | fn fromFd(fd: fd_t) Once { |
| 540 | return @enumFromInt(@as(u31, @intCast(fd))); | |
| 540 | return @fromBackingInt(@intCast(@as(u31, @intCast(fd)))); | |
| 541 | 541 | } |
| 542 | 542 | |
| 543 | 543 | fn toFd(once: Once) fd_t { |
| 544 | return @as(u31, @intCast(@intFromEnum(once))); | |
| 544 | return @as(u31, @intCast(@backingInt(once))); | |
| 545 | 545 | } |
| 546 | 546 | }; |
| 547 | 547 | |
| ... | ... | @@ -552,8 +552,8 @@ const CachedFd = struct { |
| 552 | 552 | .uninitialized => {}, |
| 553 | 553 | .initializing => unreachable, |
| 554 | 554 | _ => |fd| { |
| 555 | assert(@intFromEnum(fd) >= 0); | |
| 556 | _ = linux.close(@intFromEnum(fd)); | |
| 555 | assert(@backingInt(fd) >= 0); | |
| 556 | _ = linux.close(@backingInt(fd)); | |
| 557 | 557 | cached_fd.* = .init; |
| 558 | 558 | }, |
| 559 | 559 | } |
| ... | ... | @@ -573,7 +573,7 @@ const CachedFd = struct { |
| 573 | 573 | .initializing => try futexWait( |
| 574 | 574 | ev, |
| 575 | 575 | @ptrCast(&cached_fd.once), |
| 576 | @bitCast(@intFromEnum(once)), | |
| 576 | @bitCast(@backingInt(once)), | |
| 577 | 577 | .none, |
| 578 | 578 | ), |
| 579 | 579 | _ => |fd| { |
| ... | ... | @@ -997,11 +997,11 @@ fn schedule(ev: *Evented, thread: *Thread, ready_queue: Fiber.Queue) bool { |
| 997 | 997 | .flags = linux.IOSQE_CQE_SKIP_SUCCESS, |
| 998 | 998 | .ioprio = 0, |
| 999 | 999 | .fd = idle_search_thread.io_uring.fd, |
| 1000 | .off = @intFromEnum(Completion.Userdata.wakeup), | |
| 1001 | .addr = @intFromEnum(linux.IORING_MSG_RING_COMMAND.DATA), | |
| 1000 | .off = @backingInt(Completion.Userdata.wakeup), | |
| 1001 | .addr = @backingInt(linux.IORING_MSG_RING_COMMAND.DATA), | |
| 1002 | 1002 | .len = 0, |
| 1003 | 1003 | .rw_flags = 0, |
| 1004 | .user_data = @intFromEnum(Completion.Userdata.wakeup), | |
| 1004 | .user_data = @backingInt(Completion.Userdata.wakeup), | |
| 1005 | 1005 | .buf_index = 0, |
| 1006 | 1006 | .personality = 0, |
| 1007 | 1007 | .splice_fd_in = 0, |
| ... | ... | @@ -1164,7 +1164,7 @@ fn idle(ev: *Evented, thread: *Thread) void { |
| 1164 | 1164 | if (cqes.len == 0) break; |
| 1165 | 1165 | for (cqes) |cqe| if (cqe.flags & linux.IORING_CQE_F_SKIP == 0) switch (@as( |
| 1166 | 1166 | Completion.Userdata, |
| 1167 | @enumFromInt(cqe.user_data), | |
| 1167 | @fromBackingInt(@intCast(cqe.user_data)), | |
| 1168 | 1168 | )) { |
| 1169 | 1169 | .unused => unreachable, // bad submission queued? |
| 1170 | 1170 | .wakeup => {}, |
| ... | ... | @@ -1204,7 +1204,7 @@ fn idle(ev: *Evented, thread: *Thread) void { |
| 1204 | 1204 | .addr = cqe.user_data & ~@as(usize, 0b11), |
| 1205 | 1205 | .len = 0, |
| 1206 | 1206 | .rw_flags = 0, |
| 1207 | .user_data = @intFromEnum(Completion.Userdata.wakeup), | |
| 1207 | .user_data = @backingInt(Completion.Userdata.wakeup), | |
| 1208 | 1208 | .buf_index = 0, |
| 1209 | 1209 | .personality = 0, |
| 1210 | 1210 | .splice_fd_in = 0, |
| ... | ... | @@ -1337,11 +1337,11 @@ const SwitchMessage = struct { |
| 1337 | 1337 | .flags = linux.IOSQE_CQE_SKIP_SUCCESS, |
| 1338 | 1338 | .ioprio = 0, |
| 1339 | 1339 | .fd = each_thread.io_uring.fd, |
| 1340 | .off = @intFromEnum(Completion.Userdata.exit), | |
| 1341 | .addr = @intFromEnum(linux.IORING_MSG_RING_COMMAND.DATA), | |
| 1340 | .off = @backingInt(Completion.Userdata.exit), | |
| 1341 | .addr = @backingInt(linux.IORING_MSG_RING_COMMAND.DATA), | |
| 1342 | 1342 | .len = 0, |
| 1343 | 1343 | .rw_flags = 0, |
| 1344 | .user_data = @intFromEnum(Completion.Userdata.cleanup), | |
| 1344 | .user_data = @backingInt(Completion.Userdata.cleanup), | |
| 1345 | 1345 | .buf_index = 0, |
| 1346 | 1346 | .personality = 0, |
| 1347 | 1347 | .splice_fd_in = 0, |
| ... | ... | @@ -1986,7 +1986,7 @@ fn futexWait( |
| 1986 | 1986 | else => 0, |
| 1987 | 1987 | .boot => linux.IORING_TIMEOUT_BOOTTIME, |
| 1988 | 1988 | }), |
| 1989 | .user_data = @intFromEnum(Completion.Userdata.wakeup), | |
| 1989 | .user_data = @backingInt(Completion.Userdata.wakeup), | |
| 1990 | 1990 | .buf_index = 0, |
| 1991 | 1991 | .personality = 0, |
| 1992 | 1992 | .splice_fd_in = 0, |
| ... | ... | @@ -2052,7 +2052,7 @@ fn futexWake(userdata: ?*anyopaque, ptr: *const u32, max_waiters: u32) void { |
| 2052 | 2052 | .addr = @intFromPtr(ptr), |
| 2053 | 2053 | .len = 0, |
| 2054 | 2054 | .rw_flags = 0, |
| 2055 | .user_data = @intFromEnum(Completion.Userdata.futex_wake), | |
| 2055 | .user_data = @backingInt(Completion.Userdata.futex_wake), | |
| 2056 | 2056 | .buf_index = 0, |
| 2057 | 2057 | .personality = 0, |
| 2058 | 2058 | .splice_fd_in = 0, |
| ... | ... | @@ -2188,7 +2188,7 @@ fn deviceIoControl( |
| 2188 | 2188 | switch (linux.errno(rc)) { |
| 2189 | 2189 | .SUCCESS => return @bitCast(@as(u32, @truncate(rc))), |
| 2190 | 2190 | .INTR => {}, |
| 2191 | else => |err| return -@as(i32, @intFromEnum(err)), | |
| 2191 | else => |err| return -@as(i32, @backingInt(err)), | |
| 2192 | 2192 | } |
| 2193 | 2193 | } |
| 2194 | 2194 | } |
| ... | ... | @@ -2547,7 +2547,7 @@ fn batchCancel(userdata: ?*anyopaque, batch: *Io.Batch) void { |
| 2547 | 2547 | .addr = @intFromPtr(&pending.userdata) | 0b10, |
| 2548 | 2548 | .len = 0, |
| 2549 | 2549 | .rw_flags = 0, |
| 2550 | .user_data = @intFromEnum(Completion.Userdata.wakeup), | |
| 2550 | .user_data = @backingInt(Completion.Userdata.wakeup), | |
| 2551 | 2551 | .buf_index = 0, |
| 2552 | 2552 | .personality = 0, |
| 2553 | 2553 | .splice_fd_in = 0, |
| ... | ... | @@ -4701,7 +4701,7 @@ fn childWait(userdata: ?*anyopaque, child: *process.Child) process.Child.WaitErr |
| 4701 | 4701 | .fd = pid, |
| 4702 | 4702 | .off = @intFromPtr(&info), |
| 4703 | 4703 | .addr = 0, |
| 4704 | .len = @intFromEnum(linux.P.PID), | |
| 4704 | .len = @backingInt(linux.P.PID), | |
| 4705 | 4705 | .rw_flags = 0, |
| 4706 | 4706 | .user_data = @intFromPtr(maybe_sync.cancel_region.fiber), |
| 4707 | 4707 | .buf_index = 0, |
| ... | ... | @@ -4737,11 +4737,11 @@ fn childWait(userdata: ?*anyopaque, child: *process.Child) process.Child.WaitErr |
| 4737 | 4737 | } |
| 4738 | 4738 | } |
| 4739 | 4739 | const status: u32 = @bitCast(info.fields.common.second.sigchld.status); |
| 4740 | const code: linux.CLD = @enumFromInt(info.code); | |
| 4740 | const code: linux.CLD = @fromBackingInt(@intCast(info.code)); | |
| 4741 | 4741 | return switch (code) { |
| 4742 | 4742 | .EXITED => .{ .exited = @truncate(status) }, |
| 4743 | .KILLED, .DUMPED => .{ .signal = @enumFromInt(status) }, | |
| 4744 | .TRAPPED, .STOPPED => .{ .stopped = @enumFromInt(status) }, | |
| 4743 | .KILLED, .DUMPED => .{ .signal = @fromBackingInt(@intCast(status)) }, | |
| 4744 | .TRAPPED, .STOPPED => .{ .stopped = @fromBackingInt(@intCast(status)) }, | |
| 4745 | 4745 | _, .CONTINUED => .{ .unknown = status }, |
| 4746 | 4746 | }; |
| 4747 | 4747 | }, |
| ... | ... | @@ -4782,7 +4782,7 @@ fn childKill(userdata: ?*anyopaque, child: *process.Child) void { |
| 4782 | 4782 | .fd = pid, |
| 4783 | 4783 | .off = @intFromPtr(&info), |
| 4784 | 4784 | .addr = 0, |
| 4785 | .len = @intFromEnum(linux.P.PID), | |
| 4785 | .len = @backingInt(linux.P.PID), | |
| 4786 | 4786 | .rw_flags = 0, |
| 4787 | 4787 | .user_data = @intFromPtr(maybe_sync.cancel_region.fiber), |
| 4788 | 4788 | .buf_index = 0, |
| ... | ... | @@ -5370,7 +5370,7 @@ fn closeAsync(ev: *Evented, fd: fd_t) void { |
| 5370 | 5370 | .addr = 0, |
| 5371 | 5371 | .len = 0, |
| 5372 | 5372 | .rw_flags = 0, |
| 5373 | .user_data = @intFromEnum(Completion.Userdata.close), | |
| 5373 | .user_data = @backingInt(Completion.Userdata.close), | |
| 5374 | 5374 | .buf_index = 0, |
| 5375 | 5375 | .personality = 0, |
| 5376 | 5376 | .splice_fd_in = 0, |
lib/std/Io/Writer.zig+15-15| ... | ... | @@ -164,7 +164,7 @@ pub fn countSplat(data: []const []const u8, splat: usize) usize { |
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | pub fn countSendFileLowerBound(n: usize, file_reader: *File.Reader, limit: Limit) ?usize { |
| 167 | const total: u64 = @min(@intFromEnum(limit), file_reader.getSize() catch return null); | |
| 167 | const total: u64 = @min(@backingInt(limit), file_reader.getSize() catch return null); | |
| 168 | 168 | return std.math.lossyCast(usize, total + n); |
| 169 | 169 | } |
| 170 | 170 | |
| ... | ... | @@ -220,7 +220,7 @@ pub fn writeSplatHeaderLimit( |
| 220 | 220 | splat: usize, |
| 221 | 221 | limit: Limit, |
| 222 | 222 | ) Error!usize { |
| 223 | var remaining = @intFromEnum(limit); | |
| 223 | var remaining = @backingInt(limit); | |
| 224 | 224 | { |
| 225 | 225 | const copy_len = @min(header.len, w.buffer.len - w.end, remaining); |
| 226 | 226 | if (header.len - copy_len != 0) return writeSplatHeaderLimitFinish(w, header, data, splat, remaining); |
| ... | ... | @@ -230,7 +230,7 @@ pub fn writeSplatHeaderLimit( |
| 230 | 230 | } |
| 231 | 231 | for (data[0 .. data.len - 1], 0..) |buf, i| { |
| 232 | 232 | const copy_len = @min(buf.len, w.buffer.len - w.end, remaining); |
| 233 | if (buf.len - copy_len != 0) return @intFromEnum(limit) - remaining + | |
| 233 | if (buf.len - copy_len != 0) return @backingInt(limit) - remaining + | |
| 234 | 234 | try writeSplatHeaderLimitFinish(w, &.{}, data[i..], splat, remaining); |
| 235 | 235 | @memcpy(w.buffer[w.end..][0..copy_len], buf[0..copy_len]); |
| 236 | 236 | w.end += copy_len; |
| ... | ... | @@ -239,7 +239,7 @@ pub fn writeSplatHeaderLimit( |
| 239 | 239 | const pattern = data[data.len - 1]; |
| 240 | 240 | const splat_n = pattern.len * splat; |
| 241 | 241 | if (splat_n > @min(w.buffer.len - w.end, remaining)) { |
| 242 | const buffered_n = @intFromEnum(limit) - remaining; | |
| 242 | const buffered_n = @backingInt(limit) - remaining; | |
| 243 | 243 | const written = try writeSplatHeaderLimitFinish(w, &.{}, data[data.len - 1 ..][0..1], splat, remaining); |
| 244 | 244 | return buffered_n + written; |
| 245 | 245 | } |
| ... | ... | @@ -250,7 +250,7 @@ pub fn writeSplatHeaderLimit( |
| 250 | 250 | } |
| 251 | 251 | |
| 252 | 252 | remaining -= splat_n; |
| 253 | return @intFromEnum(limit) - remaining; | |
| 253 | return @backingInt(limit) - remaining; | |
| 254 | 254 | } |
| 255 | 255 | |
| 256 | 256 | fn writeSplatHeaderLimitFinish( |
| ... | ... | @@ -998,7 +998,7 @@ pub fn sendFileAll(w: *Writer, file_reader: *File.Reader, limit: Limit) FileAllE |
| 998 | 998 | // Explicitly assert it here as well to ensure the assert is hit even if |
| 999 | 999 | // the fallback path is not taken. |
| 1000 | 1000 | assert(w.buffer.len > 0); |
| 1001 | var remaining = @intFromEnum(limit); | |
| 1001 | var remaining = @backingInt(limit); | |
| 1002 | 1002 | while (remaining > 0) { |
| 1003 | 1003 | const n = sendFile(w, file_reader, .limited(remaining)) catch |err| switch (err) { |
| 1004 | 1004 | error.EndOfStream => break, |
| ... | ... | @@ -1011,7 +1011,7 @@ pub fn sendFileAll(w: *Writer, file_reader: *File.Reader, limit: Limit) FileAllE |
| 1011 | 1011 | }; |
| 1012 | 1012 | remaining -= n; |
| 1013 | 1013 | } |
| 1014 | return @intFromEnum(limit) - remaining; | |
| 1014 | return @backingInt(limit) - remaining; | |
| 1015 | 1015 | } |
| 1016 | 1016 | |
| 1017 | 1017 | /// Equivalent to `sendFileAll` but uses direct `pread` and `read` calls on |
| ... | ... | @@ -1021,14 +1021,14 @@ pub fn sendFileAll(w: *Writer, file_reader: *File.Reader, limit: Limit) FileAllE |
| 1021 | 1021 | /// |
| 1022 | 1022 | /// Asserts nonzero buffer capacity. |
| 1023 | 1023 | pub fn sendFileReadingAll(w: *Writer, file_reader: *File.Reader, limit: Limit) FileAllError!usize { |
| 1024 | var remaining = @intFromEnum(limit); | |
| 1024 | var remaining = @backingInt(limit); | |
| 1025 | 1025 | while (remaining > 0) { |
| 1026 | 1026 | remaining -= sendFileReading(w, file_reader, .limited(remaining)) catch |err| switch (err) { |
| 1027 | 1027 | error.EndOfStream => break, |
| 1028 | 1028 | else => |e| return e, |
| 1029 | 1029 | }; |
| 1030 | 1030 | } |
| 1031 | return @intFromEnum(limit) - remaining; | |
| 1031 | return @backingInt(limit) - remaining; | |
| 1032 | 1032 | } |
| 1033 | 1033 | |
| 1034 | 1034 | pub fn alignBuffer( |
| ... | ... | @@ -1105,7 +1105,7 @@ pub fn printValue( |
| 1105 | 1105 | .float, .comptime_float => return printFloat(w, value, options.toNumber(.decimal, .lower)), |
| 1106 | 1106 | .int, .comptime_int => return printInt(w, value, 10, .lower, options), |
| 1107 | 1107 | .@"struct" => return value.formatNumber(w, options.toNumber(.decimal, .lower)), |
| 1108 | .@"enum" => return printInt(w, @intFromEnum(value), 10, .lower, options), | |
| 1108 | .@"enum" => return printInt(w, @backingInt(value), 10, .lower, options), | |
| 1109 | 1109 | .vector => return printVector(w, fmt, options, value, max_depth), |
| 1110 | 1110 | else => invalidFmtError(fmt, value), |
| 1111 | 1111 | }, |
| ... | ... | @@ -1113,14 +1113,14 @@ pub fn printValue( |
| 1113 | 1113 | 'u' => return w.printUnicodeCodepoint(value), |
| 1114 | 1114 | 'b' => switch (@typeInfo(T)) { |
| 1115 | 1115 | .int, .comptime_int => return printInt(w, value, 2, .lower, options), |
| 1116 | .@"enum" => return printInt(w, @intFromEnum(value), 2, .lower, options), | |
| 1116 | .@"enum" => return printInt(w, @backingInt(value), 2, .lower, options), | |
| 1117 | 1117 | .@"struct" => return value.formatNumber(w, options.toNumber(.binary, .lower)), |
| 1118 | 1118 | .vector => return printVector(w, fmt, options, value, max_depth), |
| 1119 | 1119 | else => invalidFmtError(fmt, value), |
| 1120 | 1120 | }, |
| 1121 | 1121 | 'o' => switch (@typeInfo(T)) { |
| 1122 | 1122 | .int, .comptime_int => return printInt(w, value, 8, .lower, options), |
| 1123 | .@"enum" => return printInt(w, @intFromEnum(value), 8, .lower, options), | |
| 1123 | .@"enum" => return printInt(w, @backingInt(value), 8, .lower, options), | |
| 1124 | 1124 | .@"struct" => return value.formatNumber(w, options.toNumber(.octal, .lower)), |
| 1125 | 1125 | .vector => return printVector(w, fmt, options, value, max_depth), |
| 1126 | 1126 | else => invalidFmtError(fmt, value), |
| ... | ... | @@ -1128,7 +1128,7 @@ pub fn printValue( |
| 1128 | 1128 | 'x' => switch (@typeInfo(T)) { |
| 1129 | 1129 | .float, .comptime_float => return printFloatHexOptions(w, value, options.toNumber(.hex, .lower)), |
| 1130 | 1130 | .int, .comptime_int => return printInt(w, value, 16, .lower, options), |
| 1131 | .@"enum" => return printInt(w, @intFromEnum(value), 16, .lower, options), | |
| 1131 | .@"enum" => return printInt(w, @backingInt(value), 16, .lower, options), | |
| 1132 | 1132 | .@"struct" => return value.formatNumber(w, options.toNumber(.hex, .lower)), |
| 1133 | 1133 | .pointer => |info| switch (info.size) { |
| 1134 | 1134 | .one, .slice => { |
| ... | ... | @@ -1153,7 +1153,7 @@ pub fn printValue( |
| 1153 | 1153 | 'X' => switch (@typeInfo(T)) { |
| 1154 | 1154 | .float, .comptime_float => return printFloatHexOptions(w, value, options.toNumber(.hex, .upper)), |
| 1155 | 1155 | .int, .comptime_int => return printInt(w, value, 16, .upper, options), |
| 1156 | .@"enum" => return printInt(w, @intFromEnum(value), 16, .upper, options), | |
| 1156 | .@"enum" => return printInt(w, @backingInt(value), 16, .upper, options), | |
| 1157 | 1157 | .@"struct" => return value.formatNumber(w, options.toNumber(.hex, .upper)), |
| 1158 | 1158 | .pointer => |info| switch (info.size) { |
| 1159 | 1159 | .one, .slice => { |
| ... | ... | @@ -1472,7 +1472,7 @@ fn printEnumNonexhaustive(w: *Writer, value: anytype) Error!void { |
| 1472 | 1472 | return; |
| 1473 | 1473 | } |
| 1474 | 1474 | try w.writeAll("@enumFromInt("); |
| 1475 | try w.printInt(@intFromEnum(value), 10, .lower, .{}); | |
| 1475 | try w.printInt(@backingInt(value), 10, .lower, .{}); | |
| 1476 | 1476 | try w.writeByte(')'); |
| 1477 | 1477 | } |
| 1478 | 1478 |
lib/std/Io/net/HostName.zig+1-1| ... | ... | @@ -277,7 +277,7 @@ pub const DnsResponse = struct { |
| 277 | 277 | if (i + 10 + len > r.len) return error.InvalidDnsPacket; |
| 278 | 278 | defer dr.bytes_index = i + 10 + len; |
| 279 | 279 | return .{ |
| 280 | .rr = @enumFromInt(r[i + 1]), | |
| 280 | .rr = @fromBackingInt(@intCast(r[i + 1])), | |
| 281 | 281 | .packet = r, |
| 282 | 282 | .data_off = i + 10, |
| 283 | 283 | .data_len = len, |
lib/std/Progress.zig+41-41| ... | ... | @@ -226,7 +226,7 @@ pub const Node = struct { |
| 226 | 226 | fn unwrap(i: @This()) ?Index { |
| 227 | 227 | return switch (i) { |
| 228 | 228 | .unused, .none => return null, |
| 229 | else => @enumFromInt(@intFromEnum(i)), | |
| 229 | else => @fromBackingInt(@intCast(@backingInt(i))), | |
| 230 | 230 | }; |
| 231 | 231 | } |
| 232 | 232 | }; |
| ... | ... | @@ -238,12 +238,12 @@ pub const Node = struct { |
| 238 | 238 | |
| 239 | 239 | pub fn unwrap(i: @This()) ?Index { |
| 240 | 240 | if (i == .none) return null; |
| 241 | return @enumFromInt(@intFromEnum(i)); | |
| 241 | return @fromBackingInt(@intCast(@backingInt(i))); | |
| 242 | 242 | } |
| 243 | 243 | |
| 244 | 244 | fn toParent(i: @This()) Parent { |
| 245 | assert(@intFromEnum(i) != @intFromEnum(Parent.unused)); | |
| 246 | return @enumFromInt(@intFromEnum(i)); | |
| 245 | assert(@backingInt(i) != @backingInt(Parent.unused)); | |
| 246 | return @fromBackingInt(@intCast(@backingInt(i))); | |
| 247 | 247 | } |
| 248 | 248 | }; |
| 249 | 249 | |
| ... | ... | @@ -252,13 +252,13 @@ pub const Node = struct { |
| 252 | 252 | _, |
| 253 | 253 | |
| 254 | 254 | fn toParent(i: @This()) Parent { |
| 255 | assert(@intFromEnum(i) != @intFromEnum(Parent.unused)); | |
| 256 | assert(@intFromEnum(i) != @intFromEnum(Parent.none)); | |
| 257 | return @enumFromInt(@intFromEnum(i)); | |
| 255 | assert(@backingInt(i) != @backingInt(Parent.unused)); | |
| 256 | assert(@backingInt(i) != @backingInt(Parent.none)); | |
| 257 | return @fromBackingInt(@intCast(@backingInt(i))); | |
| 258 | 258 | } |
| 259 | 259 | |
| 260 | 260 | pub fn toOptional(i: @This()) OptionalIndex { |
| 261 | return @enumFromInt(@intFromEnum(i)); | |
| 261 | return @fromBackingInt(@intCast(@backingInt(i))); | |
| 262 | 262 | } |
| 263 | 263 | }; |
| 264 | 264 | |
| ... | ... | @@ -303,7 +303,7 @@ pub const Node = struct { |
| 303 | 303 | return Node.none; |
| 304 | 304 | } |
| 305 | 305 | |
| 306 | return init(@enumFromInt(free_index), parent, name, estimated_total_items); | |
| 306 | return init(@fromBackingInt(@intCast(free_index)), parent, name, estimated_total_items); | |
| 307 | 307 | } |
| 308 | 308 | |
| 309 | 309 | pub fn startFmt(node: Node, estimated_total_items: usize, comptime format: []const u8, args: anytype) Node { |
| ... | ... | @@ -458,19 +458,19 @@ pub const Node = struct { |
| 458 | 458 | } |
| 459 | 459 | |
| 460 | 460 | fn storageByIndex(index: Node.Index) *Node.Storage { |
| 461 | return &global_progress.node_storage[@intFromEnum(index)]; | |
| 461 | return &global_progress.node_storage[@backingInt(index)]; | |
| 462 | 462 | } |
| 463 | 463 | |
| 464 | 464 | fn parentByIndex(index: Node.Index) *Node.Parent { |
| 465 | return &global_progress.node_parents[@intFromEnum(index)]; | |
| 465 | return &global_progress.node_parents[@backingInt(index)]; | |
| 466 | 466 | } |
| 467 | 467 | |
| 468 | 468 | fn freelistNextByIndex(index: Node.Index) *Node.OptionalIndex { |
| 469 | return &global_progress.node_freelist_next[@intFromEnum(index)]; | |
| 469 | return &global_progress.node_freelist_next[@backingInt(index)]; | |
| 470 | 470 | } |
| 471 | 471 | |
| 472 | 472 | fn init(free_index: Index, parent: Parent, name: []const u8, estimated_total_items: usize) Node { |
| 473 | assert(parent == .none or @intFromEnum(parent) < node_storage_buffer_len); | |
| 473 | assert(parent == .none or @backingInt(parent) < node_storage_buffer_len); | |
| 474 | 474 | |
| 475 | 475 | const storage = storageByIndex(free_index); |
| 476 | 476 | @atomicStore(u32, &storage.completed_count, 0, .monotonic); |
| ... | ... | @@ -595,7 +595,7 @@ pub fn start(io: Io, options: Options) Node { |
| 595 | 595 | |
| 596 | 596 | @memset(&global_progress.node_parents, .unused); |
| 597 | 597 | @memset(&global_progress.ipc, .{ .locked = false, .valid = false, .generation = 0 }); |
| 598 | const root_node = Node.init(@enumFromInt(0), .none, options.root_name, options.estimated_total_items); | |
| 598 | const root_node = Node.init(@fromBackingInt(@intCast(0)), .none, options.root_name, options.estimated_total_items); | |
| 599 | 599 | global_progress.node_end_index = 1; |
| 600 | 600 | |
| 601 | 601 | assert(options.draw_buffer.len >= 200); |
| ... | ... | @@ -1063,7 +1063,7 @@ fn serialize(io: Io, serialized_buffer: *Serialized.Buffer) !Serialized { |
| 1063 | 1063 | dest_storage.completed_count = @atomicLoad(u32, &storage_ptr.completed_count, .monotonic); |
| 1064 | 1064 | |
| 1065 | 1065 | serialized_buffer.parents[serialized_len] = parent; |
| 1066 | map_entry.* = @enumFromInt(serialized_len); | |
| 1066 | map_entry.* = @fromBackingInt(@intCast(serialized_len)); | |
| 1067 | 1067 | if (maybe_ipc_start == null and dest_storage.getIpcIndex() != null) maybe_ipc_start = serialized_len; |
| 1068 | 1068 | serialized_len += 1; |
| 1069 | 1069 | } |
| ... | ... | @@ -1073,7 +1073,7 @@ fn serialize(io: Io, serialized_buffer: *Serialized.Buffer) !Serialized { |
| 1073 | 1073 | parent.* = switch (parent.*) { |
| 1074 | 1074 | .unused => unreachable, |
| 1075 | 1075 | .none => .none, |
| 1076 | _ => |p| map[@intFromEnum(p)].toParent(), | |
| 1076 | _ => |p| map[@backingInt(p)].toParent(), | |
| 1077 | 1077 | }; |
| 1078 | 1078 | } |
| 1079 | 1079 | |
| ... | ... | @@ -1173,11 +1173,11 @@ fn serialize(io: Io, serialized_buffer: *Serialized.Buffer) !Serialized { |
| 1173 | 1173 | prev_parents[serialized_len..][0..nodes_len], |
| 1174 | 1174 | ) |*parent, prev_parent| parent.* = switch (prev_parent) { |
| 1175 | 1175 | .none, .unused => .none, |
| 1176 | _ => if (@intFromEnum(prev_parent) == ipc_data.main_index) | |
| 1177 | @enumFromInt(main_index) | |
| 1178 | else if (@intFromEnum(prev_parent) >= start_index and | |
| 1179 | @intFromEnum(prev_parent) < start_index + nodes_len) | |
| 1180 | @enumFromInt(@intFromEnum(prev_parent) - start_index + serialized_len) | |
| 1176 | _ => if (@backingInt(prev_parent) == ipc_data.main_index) | |
| 1177 | @fromBackingInt(@intCast(main_index)) | |
| 1178 | else if (@backingInt(prev_parent) >= start_index and | |
| 1179 | @backingInt(prev_parent) < start_index + nodes_len) | |
| 1180 | @fromBackingInt(@intCast(@backingInt(prev_parent) - start_index + serialized_len)) | |
| 1181 | 1181 | else |
| 1182 | 1182 | .none, |
| 1183 | 1183 | }; |
| ... | ... | @@ -1228,12 +1228,12 @@ fn serialize(io: Io, serialized_buffer: *Serialized.Buffer) !Serialized { |
| 1228 | 1228 | // Fix bad data so the rest of the code does not see `unused`. |
| 1229 | 1229 | .none, .unused => .none, |
| 1230 | 1230 | // Root node is being mounted here. |
| 1231 | @as(Node.Parent, @enumFromInt(0)) => @enumFromInt(main_index), | |
| 1231 | @as(Node.Parent, @fromBackingInt(@intCast(0))) => @fromBackingInt(@intCast(main_index)), | |
| 1232 | 1232 | // Other nodes mounted at the end. |
| 1233 | 1233 | // Don't trust child data; if the data is outside the expected range, |
| 1234 | 1234 | // ignore the data. This also handles the case when data was truncated. |
| 1235 | _ => if (@intFromEnum(prev_parent) <= nodes_len) | |
| 1236 | @enumFromInt(@intFromEnum(prev_parent) - 1 + serialized_len) | |
| 1235 | _ => if (@backingInt(prev_parent) <= nodes_len) | |
| 1236 | @fromBackingInt(@intCast(@backingInt(prev_parent) - 1 + serialized_len)) | |
| 1237 | 1237 | else |
| 1238 | 1238 | .none, |
| 1239 | 1239 | }; |
| ... | ... | @@ -1290,13 +1290,13 @@ fn computeRedraw(io: Io, serialized_buffer: *Serialized.Buffer) !struct { []u8, |
| 1290 | 1290 | @memset(children, .{ .child = .none, .sibling = .none }); |
| 1291 | 1291 | |
| 1292 | 1292 | for (serialized.parents, 0..) |parent, child_index_usize| { |
| 1293 | const child_index: Node.Index = @enumFromInt(child_index_usize); | |
| 1293 | const child_index: Node.Index = @fromBackingInt(@intCast(child_index_usize)); | |
| 1294 | 1294 | assert(parent != .unused); |
| 1295 | 1295 | const parent_index = parent.unwrap() orelse continue; |
| 1296 | const children_node = &children[@intFromEnum(parent_index)]; | |
| 1296 | const children_node = &children[@backingInt(parent_index)]; | |
| 1297 | 1297 | if (children_node.child.unwrap()) |existing_child_index| { |
| 1298 | const existing_child = &children[@intFromEnum(existing_child_index)]; | |
| 1299 | children[@intFromEnum(child_index)].sibling = existing_child.sibling; | |
| 1298 | const existing_child = &children[@backingInt(existing_child_index)]; | |
| 1299 | children[@backingInt(child_index)].sibling = existing_child.sibling; | |
| 1300 | 1300 | existing_child.sibling = child_index.toOptional(); |
| 1301 | 1301 | } else { |
| 1302 | 1302 | children_node.child = child_index.toOptional(); |
| ... | ... | @@ -1325,14 +1325,14 @@ fn computeRedraw(io: Io, serialized_buffer: *Serialized.Buffer) !struct { []u8, |
| 1325 | 1325 | .windows_api => {}, |
| 1326 | 1326 | } |
| 1327 | 1327 | |
| 1328 | const root_node_index: Node.Index = @enumFromInt(0); | |
| 1328 | const root_node_index: Node.Index = @fromBackingInt(@intCast(0)); | |
| 1329 | 1329 | i, const nl_n = computeNode(buf, i, 0, serialized, children, root_node_index); |
| 1330 | 1330 | |
| 1331 | 1331 | if (global_progress.terminal_mode == .ansi_escape_codes) { |
| 1332 | 1332 | { |
| 1333 | 1333 | // Set progress state https://conemu.github.io/en/AnsiEscapeCodes.html#ConEmu_specific_OSC |
| 1334 | 1334 | const root_storage = &serialized.storage[0]; |
| 1335 | const storage = if (root_storage.name[0] != 0 or children[0].child == .none) root_storage else &serialized.storage[@intFromEnum(children[0].child)]; | |
| 1335 | const storage = if (root_storage.name[0] != 0 or children[0].child == .none) root_storage else &serialized.storage[@backingInt(children[0].child)]; | |
| 1336 | 1336 | const estimated_total = storage.estimated_total_count; |
| 1337 | 1337 | const completed_items = storage.completed_count; |
| 1338 | 1338 | const status = @atomicLoad(Status, &global_progress.status, .monotonic); |
| ... | ... | @@ -1395,15 +1395,15 @@ fn computePrefix( |
| 1395 | 1395 | node_index: Node.Index, |
| 1396 | 1396 | ) usize { |
| 1397 | 1397 | var i = start_i; |
| 1398 | const parent_index = serialized.parents[@intFromEnum(node_index)].unwrap() orelse return i; | |
| 1399 | if (serialized.parents[@intFromEnum(parent_index)] == .none) return i; | |
| 1400 | if (@intFromEnum(serialized.parents[@intFromEnum(parent_index)]) == 0 and | |
| 1398 | const parent_index = serialized.parents[@backingInt(node_index)].unwrap() orelse return i; | |
| 1399 | if (serialized.parents[@backingInt(parent_index)] == .none) return i; | |
| 1400 | if (@backingInt(serialized.parents[@backingInt(parent_index)]) == 0 and | |
| 1401 | 1401 | serialized.storage[0].name[0] == 0) |
| 1402 | 1402 | { |
| 1403 | 1403 | return i; |
| 1404 | 1404 | } |
| 1405 | 1405 | i = computePrefix(buf, i, nl_n, serialized, children, parent_index); |
| 1406 | if (children[@intFromEnum(parent_index)].sibling == .none) { | |
| 1406 | if (children[@backingInt(parent_index)].sibling == .none) { | |
| 1407 | 1407 | const prefix = " "; |
| 1408 | 1408 | const upper_bound_len = prefix.len + lineUpperBoundLen(nl_n); |
| 1409 | 1409 | if (i + upper_bound_len > buf.len) return buf.len; |
| ... | ... | @@ -1442,24 +1442,24 @@ fn computeNode( |
| 1442 | 1442 | if (i + lineUpperBoundLen(nl_n) > buf.len) |
| 1443 | 1443 | return .{ start_i, start_nl_n }; |
| 1444 | 1444 | |
| 1445 | const storage = &serialized.storage[@intFromEnum(node_index)]; | |
| 1445 | const storage = &serialized.storage[@backingInt(node_index)]; | |
| 1446 | 1446 | const estimated_total = storage.estimated_total_count; |
| 1447 | 1447 | const completed_items = storage.completed_count; |
| 1448 | 1448 | const name = if (std.mem.findScalar(u8, &storage.name, 0)) |end| storage.name[0..end] else &storage.name; |
| 1449 | const parent = serialized.parents[@intFromEnum(node_index)]; | |
| 1449 | const parent = serialized.parents[@backingInt(node_index)]; | |
| 1450 | 1450 | |
| 1451 | 1451 | if (parent != .none) p: { |
| 1452 | if (@intFromEnum(parent) == 0 and serialized.storage[0].name[0] == 0) { | |
| 1452 | if (@backingInt(parent) == 0 and serialized.storage[0].name[0] == 0) { | |
| 1453 | 1453 | break :p; |
| 1454 | 1454 | } |
| 1455 | if (children[@intFromEnum(node_index)].sibling == .none) { | |
| 1455 | if (children[@backingInt(node_index)].sibling == .none) { | |
| 1456 | 1456 | i = appendTreeSymbol(.langle, buf, i); |
| 1457 | 1457 | } else { |
| 1458 | 1458 | i = appendTreeSymbol(.tee, buf, i); |
| 1459 | 1459 | } |
| 1460 | 1460 | } |
| 1461 | 1461 | |
| 1462 | const is_empty_root = @intFromEnum(node_index) == 0 and serialized.storage[0].name[0] == 0; | |
| 1462 | const is_empty_root = @backingInt(node_index) == 0 and serialized.storage[0].name[0] == 0; | |
| 1463 | 1463 | if (!is_empty_root) { |
| 1464 | 1464 | if (name.len != 0 or estimated_total > 0) { |
| 1465 | 1465 | if (estimated_total > 0) { |
| ... | ... | @@ -1492,13 +1492,13 @@ fn computeNode( |
| 1492 | 1492 | } |
| 1493 | 1493 | |
| 1494 | 1494 | if (global_progress.withinRowLimit(nl_n)) { |
| 1495 | if (children[@intFromEnum(node_index)].child.unwrap()) |child| { | |
| 1495 | if (children[@backingInt(node_index)].child.unwrap()) |child| { | |
| 1496 | 1496 | i, nl_n = computeNode(buf, i, nl_n, serialized, children, child); |
| 1497 | 1497 | } |
| 1498 | 1498 | } |
| 1499 | 1499 | |
| 1500 | 1500 | if (global_progress.withinRowLimit(nl_n)) { |
| 1501 | if (children[@intFromEnum(node_index)].sibling.unwrap()) |sibling| { | |
| 1501 | if (children[@backingInt(node_index)].sibling.unwrap()) |sibling| { | |
| 1502 | 1502 | i, nl_n = computeNode(buf, i, nl_n, serialized, children, sibling); |
| 1503 | 1503 | } |
| 1504 | 1504 | } |
lib/std/Target.zig+14-14| ... | ... | @@ -286,7 +286,7 @@ pub const Os = struct { |
| 286 | 286 | |
| 287 | 287 | /// Returns whether the first version `ver` is newer (greater) than or equal to the second version `ver`. |
| 288 | 288 | pub inline fn isAtLeast(ver: WindowsVersion, min_ver: WindowsVersion) bool { |
| 289 | return @intFromEnum(ver) >= @intFromEnum(min_ver); | |
| 289 | return @backingInt(ver) >= @backingInt(min_ver); | |
| 290 | 290 | } |
| 291 | 291 | |
| 292 | 292 | pub const Range = struct { |
| ... | ... | @@ -294,23 +294,23 @@ pub const Os = struct { |
| 294 | 294 | max: WindowsVersion, |
| 295 | 295 | |
| 296 | 296 | pub inline fn includesVersion(range: Range, ver: WindowsVersion) bool { |
| 297 | return @intFromEnum(ver) >= @intFromEnum(range.min) and | |
| 298 | @intFromEnum(ver) <= @intFromEnum(range.max); | |
| 297 | return @backingInt(ver) >= @backingInt(range.min) and | |
| 298 | @backingInt(ver) <= @backingInt(range.max); | |
| 299 | 299 | } |
| 300 | 300 | |
| 301 | 301 | /// Checks if system is guaranteed to be at least `version` or older than `version`. |
| 302 | 302 | /// Returns `null` if a runtime check is required. |
| 303 | 303 | pub inline fn isAtLeast(range: Range, min_ver: WindowsVersion) ?bool { |
| 304 | if (@intFromEnum(range.min) >= @intFromEnum(min_ver)) return true; | |
| 305 | if (@intFromEnum(range.max) < @intFromEnum(min_ver)) return false; | |
| 304 | if (@backingInt(range.min) >= @backingInt(min_ver)) return true; | |
| 305 | if (@backingInt(range.max) < @backingInt(min_ver)) return false; | |
| 306 | 306 | return null; |
| 307 | 307 | } |
| 308 | 308 | }; |
| 309 | 309 | |
| 310 | 310 | pub fn parse(str: []const u8) !WindowsVersion { |
| 311 | 311 | return std.meta.stringToEnum(WindowsVersion, str) orelse |
| 312 | @enumFromInt(std.fmt.parseInt(u32, str, 0) catch | |
| 313 | return error.InvalidOperatingSystemVersion); | |
| 312 | @fromBackingInt(@intCast(std.fmt.parseInt(u32, str, 0) catch | |
| 313 | return error.InvalidOperatingSystemVersion)); | |
| 314 | 314 | } |
| 315 | 315 | |
| 316 | 316 | /// This function is defined to serialize a Zig source code representation of this |
| ... | ... | @@ -1320,20 +1320,20 @@ pub const Cpu = struct { |
| 1320 | 1320 | pub fn featureSet(features: []const F) Set { |
| 1321 | 1321 | var x = Set.empty; |
| 1322 | 1322 | for (features) |feature| { |
| 1323 | x.addFeature(@intFromEnum(feature)); | |
| 1323 | x.addFeature(@backingInt(feature)); | |
| 1324 | 1324 | } |
| 1325 | 1325 | return x; |
| 1326 | 1326 | } |
| 1327 | 1327 | |
| 1328 | 1328 | /// Returns true if the specified feature is enabled. |
| 1329 | 1329 | pub fn featureSetHas(set: Set, feature: F) bool { |
| 1330 | return set.isEnabled(@intFromEnum(feature)); | |
| 1330 | return set.isEnabled(@backingInt(feature)); | |
| 1331 | 1331 | } |
| 1332 | 1332 | |
| 1333 | 1333 | /// Returns true if any specified feature is enabled. |
| 1334 | 1334 | pub fn featureSetHasAny(set: Set, features: anytype) bool { |
| 1335 | 1335 | inline for (features) |feature| { |
| 1336 | if (set.isEnabled(@intFromEnum(@as(F, feature)))) return true; | |
| 1336 | if (set.isEnabled(@backingInt(@as(F, feature)))) return true; | |
| 1337 | 1337 | } |
| 1338 | 1338 | return false; |
| 1339 | 1339 | } |
| ... | ... | @@ -1341,7 +1341,7 @@ pub const Cpu = struct { |
| 1341 | 1341 | /// Returns true if every specified feature is enabled. |
| 1342 | 1342 | pub fn featureSetHasAll(set: Set, features: anytype) bool { |
| 1343 | 1343 | inline for (features) |feature| { |
| 1344 | if (!set.isEnabled(@intFromEnum(@as(F, feature)))) return false; | |
| 1344 | if (!set.isEnabled(@backingInt(@as(F, feature)))) return false; | |
| 1345 | 1345 | } |
| 1346 | 1346 | return true; |
| 1347 | 1347 | } |
| ... | ... | @@ -2119,14 +2119,14 @@ pub const Cpu = struct { |
| 2119 | 2119 | /// Returns true if `feature` is enabled. |
| 2120 | 2120 | pub fn has(cpu: Cpu, comptime family: Arch.Family, feature: @field(Target, @tagName(family)).Feature) bool { |
| 2121 | 2121 | if (family != cpu.arch.family()) return false; |
| 2122 | return cpu.features.isEnabled(@intFromEnum(feature)); | |
| 2122 | return cpu.features.isEnabled(@backingInt(feature)); | |
| 2123 | 2123 | } |
| 2124 | 2124 | |
| 2125 | 2125 | /// Returns true if any feature in `features` is enabled. |
| 2126 | 2126 | pub fn hasAny(cpu: Cpu, comptime family: Arch.Family, features: []const @field(Target, @tagName(family)).Feature) bool { |
| 2127 | 2127 | if (family != cpu.arch.family()) return false; |
| 2128 | 2128 | for (features) |feature| { |
| 2129 | if (cpu.features.isEnabled(@intFromEnum(feature))) return true; | |
| 2129 | if (cpu.features.isEnabled(@backingInt(feature))) return true; | |
| 2130 | 2130 | } |
| 2131 | 2131 | return false; |
| 2132 | 2132 | } |
| ... | ... | @@ -2135,7 +2135,7 @@ pub const Cpu = struct { |
| 2135 | 2135 | pub fn hasAll(cpu: Cpu, comptime family: Arch.Family, features: []const @field(Target, @tagName(family)).Feature) bool { |
| 2136 | 2136 | if (family != cpu.arch.family()) return false; |
| 2137 | 2137 | for (features) |feature| { |
| 2138 | if (!cpu.features.isEnabled(@intFromEnum(feature))) return false; | |
| 2138 | if (!cpu.features.isEnabled(@backingInt(feature))) return false; | |
| 2139 | 2139 | } |
| 2140 | 2140 | return true; |
| 2141 | 2141 | } |
lib/std/Target/aarch64.zig+277-277| ... | ... | @@ -294,7 +294,7 @@ pub const all_features = blk: { |
| 294 | 294 | const len = @typeInfo(Feature).@"enum".field_names.len; |
| 295 | 295 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); |
| 296 | 296 | var result: [len]CpuFeature = undefined; |
| 297 | result[@intFromEnum(Feature.a320)] = .{ | |
| 297 | result[@backingInt(Feature.a320)] = .{ | |
| 298 | 298 | .llvm_name = "a320", |
| 299 | 299 | .description = "Cortex-A320 ARM processors", |
| 300 | 300 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -306,214 +306,214 @@ pub const all_features = blk: { |
| 306 | 306 | .use_wzr_to_vec_move, |
| 307 | 307 | }), |
| 308 | 308 | }; |
| 309 | result[@intFromEnum(Feature.addr_lsl_slow_14)] = .{ | |
| 309 | result[@backingInt(Feature.addr_lsl_slow_14)] = .{ | |
| 310 | 310 | .llvm_name = "addr-lsl-slow-14", |
| 311 | 311 | .description = "Address operands with shift amount of 1 or 4 are slow", |
| 312 | 312 | .dependencies = featureSet(&[_]Feature{}), |
| 313 | 313 | }; |
| 314 | result[@intFromEnum(Feature.aes)] = .{ | |
| 314 | result[@backingInt(Feature.aes)] = .{ | |
| 315 | 315 | .llvm_name = "aes", |
| 316 | 316 | .description = "Enable AES support", |
| 317 | 317 | .dependencies = featureSet(&[_]Feature{ |
| 318 | 318 | .neon, |
| 319 | 319 | }), |
| 320 | 320 | }; |
| 321 | result[@intFromEnum(Feature.aggressive_fma)] = .{ | |
| 321 | result[@backingInt(Feature.aggressive_fma)] = .{ | |
| 322 | 322 | .llvm_name = "aggressive-fma", |
| 323 | 323 | .description = "Enable Aggressive FMA for floating-point.", |
| 324 | 324 | .dependencies = featureSet(&[_]Feature{}), |
| 325 | 325 | }; |
| 326 | result[@intFromEnum(Feature.aggressive_interleaving)] = .{ | |
| 326 | result[@backingInt(Feature.aggressive_interleaving)] = .{ | |
| 327 | 327 | .llvm_name = "aggressive-interleaving", |
| 328 | 328 | .description = "Make use of aggressive interleaving during vectorization", |
| 329 | 329 | .dependencies = featureSet(&[_]Feature{}), |
| 330 | 330 | }; |
| 331 | result[@intFromEnum(Feature.alternate_sextload_cvt_f32_pattern)] = .{ | |
| 331 | result[@backingInt(Feature.alternate_sextload_cvt_f32_pattern)] = .{ | |
| 332 | 332 | .llvm_name = "alternate-sextload-cvt-f32-pattern", |
| 333 | 333 | .description = "Use alternative pattern for sextload convert to f32", |
| 334 | 334 | .dependencies = featureSet(&[_]Feature{}), |
| 335 | 335 | }; |
| 336 | result[@intFromEnum(Feature.altnzcv)] = .{ | |
| 336 | result[@backingInt(Feature.altnzcv)] = .{ | |
| 337 | 337 | .llvm_name = "altnzcv", |
| 338 | 338 | .description = "Enable alternative NZCV format for floating point comparisons", |
| 339 | 339 | .dependencies = featureSet(&[_]Feature{ |
| 340 | 340 | .flagm, |
| 341 | 341 | }), |
| 342 | 342 | }; |
| 343 | result[@intFromEnum(Feature.alu_lsl_fast)] = .{ | |
| 343 | result[@backingInt(Feature.alu_lsl_fast)] = .{ | |
| 344 | 344 | .llvm_name = "alu-lsl-fast", |
| 345 | 345 | .description = "Add/Sub operations with lsl shift <= 4 are cheap", |
| 346 | 346 | .dependencies = featureSet(&[_]Feature{}), |
| 347 | 347 | }; |
| 348 | result[@intFromEnum(Feature.am)] = .{ | |
| 348 | result[@backingInt(Feature.am)] = .{ | |
| 349 | 349 | .llvm_name = "am", |
| 350 | 350 | .description = "Enable Armv8.4-A Activity Monitors extension", |
| 351 | 351 | .dependencies = featureSet(&[_]Feature{}), |
| 352 | 352 | }; |
| 353 | result[@intFromEnum(Feature.amvs)] = .{ | |
| 353 | result[@backingInt(Feature.amvs)] = .{ | |
| 354 | 354 | .llvm_name = "amvs", |
| 355 | 355 | .description = "Enable Armv8.6-A Activity Monitors Virtualization support", |
| 356 | 356 | .dependencies = featureSet(&[_]Feature{ |
| 357 | 357 | .am, |
| 358 | 358 | }), |
| 359 | 359 | }; |
| 360 | result[@intFromEnum(Feature.arith_bcc_fusion)] = .{ | |
| 360 | result[@backingInt(Feature.arith_bcc_fusion)] = .{ | |
| 361 | 361 | .llvm_name = "arith-bcc-fusion", |
| 362 | 362 | .description = "CPU fuses arithmetic+bcc operations", |
| 363 | 363 | .dependencies = featureSet(&[_]Feature{}), |
| 364 | 364 | }; |
| 365 | result[@intFromEnum(Feature.arith_cbz_fusion)] = .{ | |
| 365 | result[@backingInt(Feature.arith_cbz_fusion)] = .{ | |
| 366 | 366 | .llvm_name = "arith-cbz-fusion", |
| 367 | 367 | .description = "CPU fuses arithmetic + cbz/cbnz operations", |
| 368 | 368 | .dependencies = featureSet(&[_]Feature{}), |
| 369 | 369 | }; |
| 370 | result[@intFromEnum(Feature.ascend_store_address)] = .{ | |
| 370 | result[@backingInt(Feature.ascend_store_address)] = .{ | |
| 371 | 371 | .llvm_name = "ascend-store-address", |
| 372 | 372 | .description = "Schedule vector stores by ascending address", |
| 373 | 373 | .dependencies = featureSet(&[_]Feature{}), |
| 374 | 374 | }; |
| 375 | result[@intFromEnum(Feature.avoid_ldapur)] = .{ | |
| 375 | result[@backingInt(Feature.avoid_ldapur)] = .{ | |
| 376 | 376 | .llvm_name = "avoid-ldapur", |
| 377 | 377 | .description = "Prefer add+ldapr to offset ldapur", |
| 378 | 378 | .dependencies = featureSet(&[_]Feature{}), |
| 379 | 379 | }; |
| 380 | result[@intFromEnum(Feature.balance_fp_ops)] = .{ | |
| 380 | result[@backingInt(Feature.balance_fp_ops)] = .{ | |
| 381 | 381 | .llvm_name = "balance-fp-ops", |
| 382 | 382 | .description = "balance mix of odd and even D-registers for fp multiply(-accumulate) ops", |
| 383 | 383 | .dependencies = featureSet(&[_]Feature{}), |
| 384 | 384 | }; |
| 385 | result[@intFromEnum(Feature.bf16)] = .{ | |
| 385 | result[@backingInt(Feature.bf16)] = .{ | |
| 386 | 386 | .llvm_name = "bf16", |
| 387 | 387 | .description = "Enable BFloat16 Extension", |
| 388 | 388 | .dependencies = featureSet(&[_]Feature{ |
| 389 | 389 | .neon, |
| 390 | 390 | }), |
| 391 | 391 | }; |
| 392 | result[@intFromEnum(Feature.brbe)] = .{ | |
| 392 | result[@backingInt(Feature.brbe)] = .{ | |
| 393 | 393 | .llvm_name = "brbe", |
| 394 | 394 | .description = "Enable Branch Record Buffer Extension", |
| 395 | 395 | .dependencies = featureSet(&[_]Feature{}), |
| 396 | 396 | }; |
| 397 | result[@intFromEnum(Feature.bti)] = .{ | |
| 397 | result[@backingInt(Feature.bti)] = .{ | |
| 398 | 398 | .llvm_name = "bti", |
| 399 | 399 | .description = "Enable Branch Target Identification", |
| 400 | 400 | .dependencies = featureSet(&[_]Feature{}), |
| 401 | 401 | }; |
| 402 | result[@intFromEnum(Feature.btie)] = .{ | |
| 402 | result[@backingInt(Feature.btie)] = .{ | |
| 403 | 403 | .llvm_name = "btie", |
| 404 | 404 | .description = "Enable Enhanced Branch Target Identification extension", |
| 405 | 405 | .dependencies = featureSet(&[_]Feature{}), |
| 406 | 406 | }; |
| 407 | result[@intFromEnum(Feature.call_saved_x10)] = .{ | |
| 407 | result[@backingInt(Feature.call_saved_x10)] = .{ | |
| 408 | 408 | .llvm_name = "call-saved-x10", |
| 409 | 409 | .description = "Make X10 callee saved.", |
| 410 | 410 | .dependencies = featureSet(&[_]Feature{}), |
| 411 | 411 | }; |
| 412 | result[@intFromEnum(Feature.call_saved_x11)] = .{ | |
| 412 | result[@backingInt(Feature.call_saved_x11)] = .{ | |
| 413 | 413 | .llvm_name = "call-saved-x11", |
| 414 | 414 | .description = "Make X11 callee saved.", |
| 415 | 415 | .dependencies = featureSet(&[_]Feature{}), |
| 416 | 416 | }; |
| 417 | result[@intFromEnum(Feature.call_saved_x12)] = .{ | |
| 417 | result[@backingInt(Feature.call_saved_x12)] = .{ | |
| 418 | 418 | .llvm_name = "call-saved-x12", |
| 419 | 419 | .description = "Make X12 callee saved.", |
| 420 | 420 | .dependencies = featureSet(&[_]Feature{}), |
| 421 | 421 | }; |
| 422 | result[@intFromEnum(Feature.call_saved_x13)] = .{ | |
| 422 | result[@backingInt(Feature.call_saved_x13)] = .{ | |
| 423 | 423 | .llvm_name = "call-saved-x13", |
| 424 | 424 | .description = "Make X13 callee saved.", |
| 425 | 425 | .dependencies = featureSet(&[_]Feature{}), |
| 426 | 426 | }; |
| 427 | result[@intFromEnum(Feature.call_saved_x14)] = .{ | |
| 427 | result[@backingInt(Feature.call_saved_x14)] = .{ | |
| 428 | 428 | .llvm_name = "call-saved-x14", |
| 429 | 429 | .description = "Make X14 callee saved.", |
| 430 | 430 | .dependencies = featureSet(&[_]Feature{}), |
| 431 | 431 | }; |
| 432 | result[@intFromEnum(Feature.call_saved_x15)] = .{ | |
| 432 | result[@backingInt(Feature.call_saved_x15)] = .{ | |
| 433 | 433 | .llvm_name = "call-saved-x15", |
| 434 | 434 | .description = "Make X15 callee saved.", |
| 435 | 435 | .dependencies = featureSet(&[_]Feature{}), |
| 436 | 436 | }; |
| 437 | result[@intFromEnum(Feature.call_saved_x18)] = .{ | |
| 437 | result[@backingInt(Feature.call_saved_x18)] = .{ | |
| 438 | 438 | .llvm_name = "call-saved-x18", |
| 439 | 439 | .description = "Make X18 callee saved.", |
| 440 | 440 | .dependencies = featureSet(&[_]Feature{}), |
| 441 | 441 | }; |
| 442 | result[@intFromEnum(Feature.call_saved_x8)] = .{ | |
| 442 | result[@backingInt(Feature.call_saved_x8)] = .{ | |
| 443 | 443 | .llvm_name = "call-saved-x8", |
| 444 | 444 | .description = "Make X8 callee saved.", |
| 445 | 445 | .dependencies = featureSet(&[_]Feature{}), |
| 446 | 446 | }; |
| 447 | result[@intFromEnum(Feature.call_saved_x9)] = .{ | |
| 447 | result[@backingInt(Feature.call_saved_x9)] = .{ | |
| 448 | 448 | .llvm_name = "call-saved-x9", |
| 449 | 449 | .description = "Make X9 callee saved.", |
| 450 | 450 | .dependencies = featureSet(&[_]Feature{}), |
| 451 | 451 | }; |
| 452 | result[@intFromEnum(Feature.ccdp)] = .{ | |
| 452 | result[@backingInt(Feature.ccdp)] = .{ | |
| 453 | 453 | .llvm_name = "ccdp", |
| 454 | 454 | .description = "Enable Armv8.5-A Cache Clean to Point of Deep Persistence", |
| 455 | 455 | .dependencies = featureSet(&[_]Feature{ |
| 456 | 456 | .ccpp, |
| 457 | 457 | }), |
| 458 | 458 | }; |
| 459 | result[@intFromEnum(Feature.ccidx)] = .{ | |
| 459 | result[@backingInt(Feature.ccidx)] = .{ | |
| 460 | 460 | .llvm_name = "ccidx", |
| 461 | 461 | .description = "Enable Armv8.3-A Extend of the CCSIDR number of sets", |
| 462 | 462 | .dependencies = featureSet(&[_]Feature{}), |
| 463 | 463 | }; |
| 464 | result[@intFromEnum(Feature.ccpp)] = .{ | |
| 464 | result[@backingInt(Feature.ccpp)] = .{ | |
| 465 | 465 | .llvm_name = "ccpp", |
| 466 | 466 | .description = "Enable Armv8.2-A data Cache Clean to Point of Persistence", |
| 467 | 467 | .dependencies = featureSet(&[_]Feature{}), |
| 468 | 468 | }; |
| 469 | result[@intFromEnum(Feature.chk)] = .{ | |
| 469 | result[@backingInt(Feature.chk)] = .{ | |
| 470 | 470 | .llvm_name = "chk", |
| 471 | 471 | .description = "Enable Armv8.0-A Check Feature Status Extension", |
| 472 | 472 | .dependencies = featureSet(&[_]Feature{}), |
| 473 | 473 | }; |
| 474 | result[@intFromEnum(Feature.clrbhb)] = .{ | |
| 474 | result[@backingInt(Feature.clrbhb)] = .{ | |
| 475 | 475 | .llvm_name = "clrbhb", |
| 476 | 476 | .description = "Enable Clear BHB instruction", |
| 477 | 477 | .dependencies = featureSet(&[_]Feature{}), |
| 478 | 478 | }; |
| 479 | result[@intFromEnum(Feature.cmh)] = .{ | |
| 479 | result[@backingInt(Feature.cmh)] = .{ | |
| 480 | 480 | .llvm_name = "cmh", |
| 481 | 481 | .description = "Enable Armv9.7-A Contention Management Hints", |
| 482 | 482 | .dependencies = featureSet(&[_]Feature{}), |
| 483 | 483 | }; |
| 484 | result[@intFromEnum(Feature.cmp_bcc_fusion)] = .{ | |
| 484 | result[@backingInt(Feature.cmp_bcc_fusion)] = .{ | |
| 485 | 485 | .llvm_name = "cmp-bcc-fusion", |
| 486 | 486 | .description = "CPU fuses cmp+bcc operations", |
| 487 | 487 | .dependencies = featureSet(&[_]Feature{}), |
| 488 | 488 | }; |
| 489 | result[@intFromEnum(Feature.cmpbr)] = .{ | |
| 489 | result[@backingInt(Feature.cmpbr)] = .{ | |
| 490 | 490 | .llvm_name = "cmpbr", |
| 491 | 491 | .description = "Enable Armv9.6-A base compare and branch instructions", |
| 492 | 492 | .dependencies = featureSet(&[_]Feature{}), |
| 493 | 493 | }; |
| 494 | result[@intFromEnum(Feature.complxnum)] = .{ | |
| 494 | result[@backingInt(Feature.complxnum)] = .{ | |
| 495 | 495 | .llvm_name = "complxnum", |
| 496 | 496 | .description = "Enable Armv8.3-A Floating-point complex number support", |
| 497 | 497 | .dependencies = featureSet(&[_]Feature{ |
| 498 | 498 | .neon, |
| 499 | 499 | }), |
| 500 | 500 | }; |
| 501 | result[@intFromEnum(Feature.contextidr_el2)] = .{ | |
| 501 | result[@backingInt(Feature.contextidr_el2)] = .{ | |
| 502 | 502 | .llvm_name = "CONTEXTIDREL2", |
| 503 | 503 | .description = "Enable RW operand Context ID Register (EL2)", |
| 504 | 504 | .dependencies = featureSet(&[_]Feature{}), |
| 505 | 505 | }; |
| 506 | result[@intFromEnum(Feature.cpa)] = .{ | |
| 506 | result[@backingInt(Feature.cpa)] = .{ | |
| 507 | 507 | .llvm_name = "cpa", |
| 508 | 508 | .description = "Enable Armv9.5-A Checked Pointer Arithmetic", |
| 509 | 509 | .dependencies = featureSet(&[_]Feature{}), |
| 510 | 510 | }; |
| 511 | result[@intFromEnum(Feature.crc)] = .{ | |
| 511 | result[@backingInt(Feature.crc)] = .{ | |
| 512 | 512 | .llvm_name = "crc", |
| 513 | 513 | .description = "Enable Armv8.0-A CRC-32 checksum instructions", |
| 514 | 514 | .dependencies = featureSet(&[_]Feature{}), |
| 515 | 515 | }; |
| 516 | result[@intFromEnum(Feature.crypto)] = .{ | |
| 516 | result[@backingInt(Feature.crypto)] = .{ | |
| 517 | 517 | .llvm_name = "crypto", |
| 518 | 518 | .description = "Enable cryptographic instructions", |
| 519 | 519 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -521,98 +521,98 @@ pub const all_features = blk: { |
| 521 | 521 | .sha2, |
| 522 | 522 | }), |
| 523 | 523 | }; |
| 524 | result[@intFromEnum(Feature.cssc)] = .{ | |
| 524 | result[@backingInt(Feature.cssc)] = .{ | |
| 525 | 525 | .llvm_name = "cssc", |
| 526 | 526 | .description = "Enable Common Short Sequence Compression (CSSC) instructions", |
| 527 | 527 | .dependencies = featureSet(&[_]Feature{}), |
| 528 | 528 | }; |
| 529 | result[@intFromEnum(Feature.d128)] = .{ | |
| 529 | result[@backingInt(Feature.d128)] = .{ | |
| 530 | 530 | .llvm_name = "d128", |
| 531 | 531 | .description = "Enable Armv9.4-A 128-bit Page Table Descriptors, System Registers and instructions", |
| 532 | 532 | .dependencies = featureSet(&[_]Feature{ |
| 533 | 533 | .lse128, |
| 534 | 534 | }), |
| 535 | 535 | }; |
| 536 | result[@intFromEnum(Feature.disable_fast_inc_vl)] = .{ | |
| 536 | result[@backingInt(Feature.disable_fast_inc_vl)] = .{ | |
| 537 | 537 | .llvm_name = "disable-fast-inc-vl", |
| 538 | 538 | .description = "Do not prefer INC/DEC, ALL, { 1, 2, 4 } over ADDVL", |
| 539 | 539 | .dependencies = featureSet(&[_]Feature{}), |
| 540 | 540 | }; |
| 541 | result[@intFromEnum(Feature.disable_latency_sched_heuristic)] = .{ | |
| 541 | result[@backingInt(Feature.disable_latency_sched_heuristic)] = .{ | |
| 542 | 542 | .llvm_name = "disable-latency-sched-heuristic", |
| 543 | 543 | .description = "Disable latency scheduling heuristic", |
| 544 | 544 | .dependencies = featureSet(&[_]Feature{}), |
| 545 | 545 | }; |
| 546 | result[@intFromEnum(Feature.disable_ldp)] = .{ | |
| 546 | result[@backingInt(Feature.disable_ldp)] = .{ | |
| 547 | 547 | .llvm_name = "disable-ldp", |
| 548 | 548 | .description = "Do not emit ldp", |
| 549 | 549 | .dependencies = featureSet(&[_]Feature{}), |
| 550 | 550 | }; |
| 551 | result[@intFromEnum(Feature.disable_maximize_scalable_bandwidth)] = .{ | |
| 551 | result[@backingInt(Feature.disable_maximize_scalable_bandwidth)] = .{ | |
| 552 | 552 | .llvm_name = "disable-maximize-scalable-bandwidth", |
| 553 | 553 | .description = "Determine the maximum scalable vector length for a loop by the largest scalar type rather than the smallest", |
| 554 | 554 | .dependencies = featureSet(&[_]Feature{}), |
| 555 | 555 | }; |
| 556 | result[@intFromEnum(Feature.disable_stp)] = .{ | |
| 556 | result[@backingInt(Feature.disable_stp)] = .{ | |
| 557 | 557 | .llvm_name = "disable-stp", |
| 558 | 558 | .description = "Do not emit stp", |
| 559 | 559 | .dependencies = featureSet(&[_]Feature{}), |
| 560 | 560 | }; |
| 561 | result[@intFromEnum(Feature.disable_unpredicated_ld_st_lower)] = .{ | |
| 561 | result[@backingInt(Feature.disable_unpredicated_ld_st_lower)] = .{ | |
| 562 | 562 | .llvm_name = "disable-unpredicated-ld-st-lower", |
| 563 | 563 | .description = "Disable lowering unpredicated loads/stores as LDR/STR", |
| 564 | 564 | .dependencies = featureSet(&[_]Feature{}), |
| 565 | 565 | }; |
| 566 | result[@intFromEnum(Feature.dit)] = .{ | |
| 566 | result[@backingInt(Feature.dit)] = .{ | |
| 567 | 567 | .llvm_name = "dit", |
| 568 | 568 | .description = "Enable Armv8.4-A Data Independent Timing instructions", |
| 569 | 569 | .dependencies = featureSet(&[_]Feature{}), |
| 570 | 570 | }; |
| 571 | result[@intFromEnum(Feature.dotprod)] = .{ | |
| 571 | result[@backingInt(Feature.dotprod)] = .{ | |
| 572 | 572 | .llvm_name = "dotprod", |
| 573 | 573 | .description = "Enable dot product support", |
| 574 | 574 | .dependencies = featureSet(&[_]Feature{ |
| 575 | 575 | .neon, |
| 576 | 576 | }), |
| 577 | 577 | }; |
| 578 | result[@intFromEnum(Feature.ecv)] = .{ | |
| 578 | result[@backingInt(Feature.ecv)] = .{ | |
| 579 | 579 | .llvm_name = "ecv", |
| 580 | 580 | .description = "Enable enhanced counter virtualization extension", |
| 581 | 581 | .dependencies = featureSet(&[_]Feature{}), |
| 582 | 582 | }; |
| 583 | result[@intFromEnum(Feature.el2vmsa)] = .{ | |
| 583 | result[@backingInt(Feature.el2vmsa)] = .{ | |
| 584 | 584 | .llvm_name = "el2vmsa", |
| 585 | 585 | .description = "Enable Exception Level 2 Virtual Memory System Architecture", |
| 586 | 586 | .dependencies = featureSet(&[_]Feature{}), |
| 587 | 587 | }; |
| 588 | result[@intFromEnum(Feature.el3)] = .{ | |
| 588 | result[@backingInt(Feature.el3)] = .{ | |
| 589 | 589 | .llvm_name = "el3", |
| 590 | 590 | .description = "Enable Exception Level 3", |
| 591 | 591 | .dependencies = featureSet(&[_]Feature{}), |
| 592 | 592 | }; |
| 593 | result[@intFromEnum(Feature.enable_select_opt)] = .{ | |
| 593 | result[@backingInt(Feature.enable_select_opt)] = .{ | |
| 594 | 594 | .llvm_name = "enable-select-opt", |
| 595 | 595 | .description = "Enable the select optimize pass for select loop heuristics", |
| 596 | 596 | .dependencies = featureSet(&[_]Feature{}), |
| 597 | 597 | }; |
| 598 | result[@intFromEnum(Feature.ete)] = .{ | |
| 598 | result[@backingInt(Feature.ete)] = .{ | |
| 599 | 599 | .llvm_name = "ete", |
| 600 | 600 | .description = "Enable Embedded Trace Extension", |
| 601 | 601 | .dependencies = featureSet(&[_]Feature{ |
| 602 | 602 | .trbe, |
| 603 | 603 | }), |
| 604 | 604 | }; |
| 605 | result[@intFromEnum(Feature.execute_only)] = .{ | |
| 605 | result[@backingInt(Feature.execute_only)] = .{ | |
| 606 | 606 | .llvm_name = "execute-only", |
| 607 | 607 | .description = "Enable the generation of execute only code.", |
| 608 | 608 | .dependencies = featureSet(&[_]Feature{}), |
| 609 | 609 | }; |
| 610 | result[@intFromEnum(Feature.exynos_cheap_as_move)] = .{ | |
| 610 | result[@backingInt(Feature.exynos_cheap_as_move)] = .{ | |
| 611 | 611 | .llvm_name = "exynos-cheap-as-move", |
| 612 | 612 | .description = "Use Exynos specific handling of cheap instructions", |
| 613 | 613 | .dependencies = featureSet(&[_]Feature{}), |
| 614 | 614 | }; |
| 615 | result[@intFromEnum(Feature.f16f32dot)] = .{ | |
| 615 | result[@backingInt(Feature.f16f32dot)] = .{ | |
| 616 | 616 | .llvm_name = "f16f32dot", |
| 617 | 617 | .description = "Enable Armv9.7-A Advanced SIMD half-precision dot product accumulate to single-precision", |
| 618 | 618 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -620,7 +620,7 @@ pub const all_features = blk: { |
| 620 | 620 | .neon, |
| 621 | 621 | }), |
| 622 | 622 | }; |
| 623 | result[@intFromEnum(Feature.f16f32mm)] = .{ | |
| 623 | result[@backingInt(Feature.f16f32mm)] = .{ | |
| 624 | 624 | .llvm_name = "f16f32mm", |
| 625 | 625 | .description = "Enable Armv9.7-A Advanced SIMD half-precision matrix multiply-accumulate to single-precision", |
| 626 | 626 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -628,7 +628,7 @@ pub const all_features = blk: { |
| 628 | 628 | .neon, |
| 629 | 629 | }), |
| 630 | 630 | }; |
| 631 | result[@intFromEnum(Feature.f16mm)] = .{ | |
| 631 | result[@backingInt(Feature.f16mm)] = .{ | |
| 632 | 632 | .llvm_name = "f16mm", |
| 633 | 633 | .description = "Enable Armv9.7-A non-widening half-precision matrix multiply-accumulate", |
| 634 | 634 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -636,67 +636,67 @@ pub const all_features = blk: { |
| 636 | 636 | .neon, |
| 637 | 637 | }), |
| 638 | 638 | }; |
| 639 | result[@intFromEnum(Feature.f32mm)] = .{ | |
| 639 | result[@backingInt(Feature.f32mm)] = .{ | |
| 640 | 640 | .llvm_name = "f32mm", |
| 641 | 641 | .description = "Enable Matrix Multiply FP32 Extension", |
| 642 | 642 | .dependencies = featureSet(&[_]Feature{ |
| 643 | 643 | .sve, |
| 644 | 644 | }), |
| 645 | 645 | }; |
| 646 | result[@intFromEnum(Feature.f64mm)] = .{ | |
| 646 | result[@backingInt(Feature.f64mm)] = .{ | |
| 647 | 647 | .llvm_name = "f64mm", |
| 648 | 648 | .description = "Enable Matrix Multiply FP64 Extension", |
| 649 | 649 | .dependencies = featureSet(&[_]Feature{ |
| 650 | 650 | .sve, |
| 651 | 651 | }), |
| 652 | 652 | }; |
| 653 | result[@intFromEnum(Feature.f8f16mm)] = .{ | |
| 653 | result[@backingInt(Feature.f8f16mm)] = .{ | |
| 654 | 654 | .llvm_name = "f8f16mm", |
| 655 | 655 | .description = "Enable Armv9.6-A FP8 to Half-Precision Matrix Multiplication", |
| 656 | 656 | .dependencies = featureSet(&[_]Feature{ |
| 657 | 657 | .fp8, |
| 658 | 658 | }), |
| 659 | 659 | }; |
| 660 | result[@intFromEnum(Feature.f8f32mm)] = .{ | |
| 660 | result[@backingInt(Feature.f8f32mm)] = .{ | |
| 661 | 661 | .llvm_name = "f8f32mm", |
| 662 | 662 | .description = "Enable Armv9.6-A FP8 to Single-Precision Matrix Multiplication", |
| 663 | 663 | .dependencies = featureSet(&[_]Feature{ |
| 664 | 664 | .fp8, |
| 665 | 665 | }), |
| 666 | 666 | }; |
| 667 | result[@intFromEnum(Feature.faminmax)] = .{ | |
| 667 | result[@backingInt(Feature.faminmax)] = .{ | |
| 668 | 668 | .llvm_name = "faminmax", |
| 669 | 669 | .description = "Enable FAMIN and FAMAX instructions", |
| 670 | 670 | .dependencies = featureSet(&[_]Feature{ |
| 671 | 671 | .neon, |
| 672 | 672 | }), |
| 673 | 673 | }; |
| 674 | result[@intFromEnum(Feature.fgt)] = .{ | |
| 674 | result[@backingInt(Feature.fgt)] = .{ | |
| 675 | 675 | .llvm_name = "fgt", |
| 676 | 676 | .description = "Enable fine grained virtualization traps extension", |
| 677 | 677 | .dependencies = featureSet(&[_]Feature{}), |
| 678 | 678 | }; |
| 679 | result[@intFromEnum(Feature.fix_cortex_a53_835769)] = .{ | |
| 679 | result[@backingInt(Feature.fix_cortex_a53_835769)] = .{ | |
| 680 | 680 | .llvm_name = "fix-cortex-a53-835769", |
| 681 | 681 | .description = "Mitigate Cortex-A53 Erratum 835769", |
| 682 | 682 | .dependencies = featureSet(&[_]Feature{}), |
| 683 | 683 | }; |
| 684 | result[@intFromEnum(Feature.flagm)] = .{ | |
| 684 | result[@backingInt(Feature.flagm)] = .{ | |
| 685 | 685 | .llvm_name = "flagm", |
| 686 | 686 | .description = "Enable Armv8.4-A Flag Manipulation instructions", |
| 687 | 687 | .dependencies = featureSet(&[_]Feature{}), |
| 688 | 688 | }; |
| 689 | result[@intFromEnum(Feature.fmv)] = .{ | |
| 689 | result[@backingInt(Feature.fmv)] = .{ | |
| 690 | 690 | .llvm_name = "fmv", |
| 691 | 691 | .description = "Enable Function Multi Versioning support.", |
| 692 | 692 | .dependencies = featureSet(&[_]Feature{}), |
| 693 | 693 | }; |
| 694 | result[@intFromEnum(Feature.force_32bit_jump_tables)] = .{ | |
| 694 | result[@backingInt(Feature.force_32bit_jump_tables)] = .{ | |
| 695 | 695 | .llvm_name = "force-32bit-jump-tables", |
| 696 | 696 | .description = "Force jump table entries to be 32-bits wide except at MinSize", |
| 697 | 697 | .dependencies = featureSet(&[_]Feature{}), |
| 698 | 698 | }; |
| 699 | result[@intFromEnum(Feature.fp16fml)] = .{ | |
| 699 | result[@backingInt(Feature.fp16fml)] = .{ | |
| 700 | 700 | .llvm_name = "fp16fml", |
| 701 | 701 | .description = "Enable FP16 FML instructions", |
| 702 | 702 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -704,59 +704,59 @@ pub const all_features = blk: { |
| 704 | 704 | .neon, |
| 705 | 705 | }), |
| 706 | 706 | }; |
| 707 | result[@intFromEnum(Feature.fp8)] = .{ | |
| 707 | result[@backingInt(Feature.fp8)] = .{ | |
| 708 | 708 | .llvm_name = "fp8", |
| 709 | 709 | .description = "Enable FP8 instructions", |
| 710 | 710 | .dependencies = featureSet(&[_]Feature{ |
| 711 | 711 | .neon, |
| 712 | 712 | }), |
| 713 | 713 | }; |
| 714 | result[@intFromEnum(Feature.fp8dot2)] = .{ | |
| 714 | result[@backingInt(Feature.fp8dot2)] = .{ | |
| 715 | 715 | .llvm_name = "fp8dot2", |
| 716 | 716 | .description = "Enable FP8 2-way dot instructions", |
| 717 | 717 | .dependencies = featureSet(&[_]Feature{ |
| 718 | 718 | .fp8, |
| 719 | 719 | }), |
| 720 | 720 | }; |
| 721 | result[@intFromEnum(Feature.fp8dot4)] = .{ | |
| 721 | result[@backingInt(Feature.fp8dot4)] = .{ | |
| 722 | 722 | .llvm_name = "fp8dot4", |
| 723 | 723 | .description = "Enable FP8 4-way dot instructions", |
| 724 | 724 | .dependencies = featureSet(&[_]Feature{ |
| 725 | 725 | .fp8, |
| 726 | 726 | }), |
| 727 | 727 | }; |
| 728 | result[@intFromEnum(Feature.fp8fma)] = .{ | |
| 728 | result[@backingInt(Feature.fp8fma)] = .{ | |
| 729 | 729 | .llvm_name = "fp8fma", |
| 730 | 730 | .description = "Enable Armv9.5-A FP8 multiply-add instructions", |
| 731 | 731 | .dependencies = featureSet(&[_]Feature{ |
| 732 | 732 | .fp8, |
| 733 | 733 | }), |
| 734 | 734 | }; |
| 735 | result[@intFromEnum(Feature.fp_armv8)] = .{ | |
| 735 | result[@backingInt(Feature.fp_armv8)] = .{ | |
| 736 | 736 | .llvm_name = "fp-armv8", |
| 737 | 737 | .description = "Enable Armv8.0-A Floating Point Extensions", |
| 738 | 738 | .dependencies = featureSet(&[_]Feature{}), |
| 739 | 739 | }; |
| 740 | result[@intFromEnum(Feature.fpac)] = .{ | |
| 740 | result[@backingInt(Feature.fpac)] = .{ | |
| 741 | 741 | .llvm_name = "fpac", |
| 742 | 742 | .description = "Enable Armv8.3-A Pointer Authentication Faulting enhancement", |
| 743 | 743 | .dependencies = featureSet(&[_]Feature{}), |
| 744 | 744 | }; |
| 745 | result[@intFromEnum(Feature.fprcvt)] = .{ | |
| 745 | result[@backingInt(Feature.fprcvt)] = .{ | |
| 746 | 746 | .llvm_name = "fprcvt", |
| 747 | 747 | .description = "Enable Armv9.6-A base convert instructions for SIMD&FP scalar register operands of different input and output sizes", |
| 748 | 748 | .dependencies = featureSet(&[_]Feature{ |
| 749 | 749 | .fp_armv8, |
| 750 | 750 | }), |
| 751 | 751 | }; |
| 752 | result[@intFromEnum(Feature.fptoint)] = .{ | |
| 752 | result[@backingInt(Feature.fptoint)] = .{ | |
| 753 | 753 | .llvm_name = "fptoint", |
| 754 | 754 | .description = "Enable FRInt[32|64][Z|X] instructions that round a floating-point number to an integer (in FP format) forcing it to fit into a 32- or 64-bit int", |
| 755 | 755 | .dependencies = featureSet(&[_]Feature{ |
| 756 | 756 | .fp_armv8, |
| 757 | 757 | }), |
| 758 | 758 | }; |
| 759 | result[@intFromEnum(Feature.fujitsu_monaka)] = .{ | |
| 759 | result[@backingInt(Feature.fujitsu_monaka)] = .{ | |
| 760 | 760 | .llvm_name = "fujitsu-monaka", |
| 761 | 761 | .description = "Fujitsu FUJITSU-MONAKA processors", |
| 762 | 762 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -766,190 +766,190 @@ pub const all_features = blk: { |
| 766 | 766 | .use_postra_scheduler, |
| 767 | 767 | }), |
| 768 | 768 | }; |
| 769 | result[@intFromEnum(Feature.fullfp16)] = .{ | |
| 769 | result[@backingInt(Feature.fullfp16)] = .{ | |
| 770 | 770 | .llvm_name = "fullfp16", |
| 771 | 771 | .description = "Enable half-precision floating-point data processing", |
| 772 | 772 | .dependencies = featureSet(&[_]Feature{ |
| 773 | 773 | .fp_armv8, |
| 774 | 774 | }), |
| 775 | 775 | }; |
| 776 | result[@intFromEnum(Feature.fuse_address)] = .{ | |
| 776 | result[@backingInt(Feature.fuse_address)] = .{ | |
| 777 | 777 | .llvm_name = "fuse-address", |
| 778 | 778 | .description = "CPU fuses address generation and memory operations", |
| 779 | 779 | .dependencies = featureSet(&[_]Feature{}), |
| 780 | 780 | }; |
| 781 | result[@intFromEnum(Feature.fuse_addsub_2reg_const1)] = .{ | |
| 781 | result[@backingInt(Feature.fuse_addsub_2reg_const1)] = .{ | |
| 782 | 782 | .llvm_name = "fuse-addsub-2reg-const1", |
| 783 | 783 | .description = "CPU fuses (a + b + 1) and (a - b - 1)", |
| 784 | 784 | .dependencies = featureSet(&[_]Feature{}), |
| 785 | 785 | }; |
| 786 | result[@intFromEnum(Feature.fuse_adrp_add)] = .{ | |
| 786 | result[@backingInt(Feature.fuse_adrp_add)] = .{ | |
| 787 | 787 | .llvm_name = "fuse-adrp-add", |
| 788 | 788 | .description = "CPU fuses adrp+add operations", |
| 789 | 789 | .dependencies = featureSet(&[_]Feature{}), |
| 790 | 790 | }; |
| 791 | result[@intFromEnum(Feature.fuse_aes)] = .{ | |
| 791 | result[@backingInt(Feature.fuse_aes)] = .{ | |
| 792 | 792 | .llvm_name = "fuse-aes", |
| 793 | 793 | .description = "CPU fuses AES crypto operations", |
| 794 | 794 | .dependencies = featureSet(&[_]Feature{}), |
| 795 | 795 | }; |
| 796 | result[@intFromEnum(Feature.fuse_arith_logic)] = .{ | |
| 796 | result[@backingInt(Feature.fuse_arith_logic)] = .{ | |
| 797 | 797 | .llvm_name = "fuse-arith-logic", |
| 798 | 798 | .description = "CPU fuses arithmetic and logic operations", |
| 799 | 799 | .dependencies = featureSet(&[_]Feature{}), |
| 800 | 800 | }; |
| 801 | result[@intFromEnum(Feature.fuse_crypto_eor)] = .{ | |
| 801 | result[@backingInt(Feature.fuse_crypto_eor)] = .{ | |
| 802 | 802 | .llvm_name = "fuse-crypto-eor", |
| 803 | 803 | .description = "CPU fuses AES/PMULL and EOR operations", |
| 804 | 804 | .dependencies = featureSet(&[_]Feature{}), |
| 805 | 805 | }; |
| 806 | result[@intFromEnum(Feature.fuse_csel)] = .{ | |
| 806 | result[@backingInt(Feature.fuse_csel)] = .{ | |
| 807 | 807 | .llvm_name = "fuse-csel", |
| 808 | 808 | .description = "CPU can fuse CMP and CSEL operations", |
| 809 | 809 | .dependencies = featureSet(&[_]Feature{}), |
| 810 | 810 | }; |
| 811 | result[@intFromEnum(Feature.fuse_cset)] = .{ | |
| 811 | result[@backingInt(Feature.fuse_cset)] = .{ | |
| 812 | 812 | .llvm_name = "fuse-cset", |
| 813 | 813 | .description = "CPU can fuse CMP and CSET operations", |
| 814 | 814 | .dependencies = featureSet(&[_]Feature{}), |
| 815 | 815 | }; |
| 816 | result[@intFromEnum(Feature.fuse_literals)] = .{ | |
| 816 | result[@backingInt(Feature.fuse_literals)] = .{ | |
| 817 | 817 | .llvm_name = "fuse-literals", |
| 818 | 818 | .description = "CPU fuses literal generation operations", |
| 819 | 819 | .dependencies = featureSet(&[_]Feature{}), |
| 820 | 820 | }; |
| 821 | result[@intFromEnum(Feature.gcie)] = .{ | |
| 821 | result[@backingInt(Feature.gcie)] = .{ | |
| 822 | 822 | .llvm_name = "gcie", |
| 823 | 823 | .description = "Enable GICv5 (Generic Interrupt Controller) CPU Interface Extension", |
| 824 | 824 | .dependencies = featureSet(&[_]Feature{}), |
| 825 | 825 | }; |
| 826 | result[@intFromEnum(Feature.gcs)] = .{ | |
| 826 | result[@backingInt(Feature.gcs)] = .{ | |
| 827 | 827 | .llvm_name = "gcs", |
| 828 | 828 | .description = "Enable Armv9.4-A Guarded Call Stack Extension", |
| 829 | 829 | .dependencies = featureSet(&[_]Feature{ |
| 830 | 830 | .chk, |
| 831 | 831 | }), |
| 832 | 832 | }; |
| 833 | result[@intFromEnum(Feature.harden_sls_blr)] = .{ | |
| 833 | result[@backingInt(Feature.harden_sls_blr)] = .{ | |
| 834 | 834 | .llvm_name = "harden-sls-blr", |
| 835 | 835 | .description = "Harden against straight line speculation across BLR instructions", |
| 836 | 836 | .dependencies = featureSet(&[_]Feature{}), |
| 837 | 837 | }; |
| 838 | result[@intFromEnum(Feature.harden_sls_nocomdat)] = .{ | |
| 838 | result[@backingInt(Feature.harden_sls_nocomdat)] = .{ | |
| 839 | 839 | .llvm_name = "harden-sls-nocomdat", |
| 840 | 840 | .description = "Generate thunk code for SLS mitigation in the normal text section", |
| 841 | 841 | .dependencies = featureSet(&[_]Feature{}), |
| 842 | 842 | }; |
| 843 | result[@intFromEnum(Feature.harden_sls_retbr)] = .{ | |
| 843 | result[@backingInt(Feature.harden_sls_retbr)] = .{ | |
| 844 | 844 | .llvm_name = "harden-sls-retbr", |
| 845 | 845 | .description = "Harden against straight line speculation across RET and BR instructions", |
| 846 | 846 | .dependencies = featureSet(&[_]Feature{}), |
| 847 | 847 | }; |
| 848 | result[@intFromEnum(Feature.hbc)] = .{ | |
| 848 | result[@backingInt(Feature.hbc)] = .{ | |
| 849 | 849 | .llvm_name = "hbc", |
| 850 | 850 | .description = "Enable Armv8.8-A Hinted Conditional Branches Extension", |
| 851 | 851 | .dependencies = featureSet(&[_]Feature{}), |
| 852 | 852 | }; |
| 853 | result[@intFromEnum(Feature.hcx)] = .{ | |
| 853 | result[@backingInt(Feature.hcx)] = .{ | |
| 854 | 854 | .llvm_name = "hcx", |
| 855 | 855 | .description = "Enable Armv8.7-A HCRX_EL2 system register", |
| 856 | 856 | .dependencies = featureSet(&[_]Feature{}), |
| 857 | 857 | }; |
| 858 | result[@intFromEnum(Feature.i8mm)] = .{ | |
| 858 | result[@backingInt(Feature.i8mm)] = .{ | |
| 859 | 859 | .llvm_name = "i8mm", |
| 860 | 860 | .description = "Enable Matrix Multiply Int8 Extension", |
| 861 | 861 | .dependencies = featureSet(&[_]Feature{ |
| 862 | 862 | .neon, |
| 863 | 863 | }), |
| 864 | 864 | }; |
| 865 | result[@intFromEnum(Feature.ite)] = .{ | |
| 865 | result[@backingInt(Feature.ite)] = .{ | |
| 866 | 866 | .llvm_name = "ite", |
| 867 | 867 | .description = "Enable Armv9.4-A Instrumentation Extension", |
| 868 | 868 | .dependencies = featureSet(&[_]Feature{ |
| 869 | 869 | .ete, |
| 870 | 870 | }), |
| 871 | 871 | }; |
| 872 | result[@intFromEnum(Feature.jsconv)] = .{ | |
| 872 | result[@backingInt(Feature.jsconv)] = .{ | |
| 873 | 873 | .llvm_name = "jsconv", |
| 874 | 874 | .description = "Enable Armv8.3-A JavaScript FP conversion instructions", |
| 875 | 875 | .dependencies = featureSet(&[_]Feature{ |
| 876 | 876 | .fp_armv8, |
| 877 | 877 | }), |
| 878 | 878 | }; |
| 879 | result[@intFromEnum(Feature.ldp_aligned_only)] = .{ | |
| 879 | result[@backingInt(Feature.ldp_aligned_only)] = .{ | |
| 880 | 880 | .llvm_name = "ldp-aligned-only", |
| 881 | 881 | .description = "In order to emit ldp, first check if the load will be aligned to 2 * element_size", |
| 882 | 882 | .dependencies = featureSet(&[_]Feature{}), |
| 883 | 883 | }; |
| 884 | result[@intFromEnum(Feature.lor)] = .{ | |
| 884 | result[@backingInt(Feature.lor)] = .{ | |
| 885 | 885 | .llvm_name = "lor", |
| 886 | 886 | .description = "Enable Armv8.1-A Limited Ordering Regions extension", |
| 887 | 887 | .dependencies = featureSet(&[_]Feature{}), |
| 888 | 888 | }; |
| 889 | result[@intFromEnum(Feature.ls64)] = .{ | |
| 889 | result[@backingInt(Feature.ls64)] = .{ | |
| 890 | 890 | .llvm_name = "ls64", |
| 891 | 891 | .description = "Enable Armv8.7-A LD64B/ST64B Accelerator Extension", |
| 892 | 892 | .dependencies = featureSet(&[_]Feature{}), |
| 893 | 893 | }; |
| 894 | result[@intFromEnum(Feature.lscp)] = .{ | |
| 894 | result[@backingInt(Feature.lscp)] = .{ | |
| 895 | 895 | .llvm_name = "lscp", |
| 896 | 896 | .description = "Enable Armv9.7-A Load-acquire and store-release pair extension", |
| 897 | 897 | .dependencies = featureSet(&[_]Feature{}), |
| 898 | 898 | }; |
| 899 | result[@intFromEnum(Feature.lse)] = .{ | |
| 899 | result[@backingInt(Feature.lse)] = .{ | |
| 900 | 900 | .llvm_name = "lse", |
| 901 | 901 | .description = "Enable Armv8.1-A Large System Extension (LSE) atomic instructions", |
| 902 | 902 | .dependencies = featureSet(&[_]Feature{}), |
| 903 | 903 | }; |
| 904 | result[@intFromEnum(Feature.lse128)] = .{ | |
| 904 | result[@backingInt(Feature.lse128)] = .{ | |
| 905 | 905 | .llvm_name = "lse128", |
| 906 | 906 | .description = "Enable Armv9.4-A 128-bit Atomic instructions", |
| 907 | 907 | .dependencies = featureSet(&[_]Feature{ |
| 908 | 908 | .lse, |
| 909 | 909 | }), |
| 910 | 910 | }; |
| 911 | result[@intFromEnum(Feature.lse2)] = .{ | |
| 911 | result[@backingInt(Feature.lse2)] = .{ | |
| 912 | 912 | .llvm_name = "lse2", |
| 913 | 913 | .description = "Enable Armv8.4-A Large System Extension 2 (LSE2) atomicity rules", |
| 914 | 914 | .dependencies = featureSet(&[_]Feature{}), |
| 915 | 915 | }; |
| 916 | result[@intFromEnum(Feature.lsfe)] = .{ | |
| 916 | result[@backingInt(Feature.lsfe)] = .{ | |
| 917 | 917 | .llvm_name = "lsfe", |
| 918 | 918 | .description = "Enable Armv9.6-A base Atomic floating-point in-memory instructions", |
| 919 | 919 | .dependencies = featureSet(&[_]Feature{ |
| 920 | 920 | .fp_armv8, |
| 921 | 921 | }), |
| 922 | 922 | }; |
| 923 | result[@intFromEnum(Feature.lsui)] = .{ | |
| 923 | result[@backingInt(Feature.lsui)] = .{ | |
| 924 | 924 | .llvm_name = "lsui", |
| 925 | 925 | .description = "Enable Armv9.6-A unprivileged load/store instructions", |
| 926 | 926 | .dependencies = featureSet(&[_]Feature{}), |
| 927 | 927 | }; |
| 928 | result[@intFromEnum(Feature.lut)] = .{ | |
| 928 | result[@backingInt(Feature.lut)] = .{ | |
| 929 | 929 | .llvm_name = "lut", |
| 930 | 930 | .description = "Enable Lookup Table instructions", |
| 931 | 931 | .dependencies = featureSet(&[_]Feature{ |
| 932 | 932 | .neon, |
| 933 | 933 | }), |
| 934 | 934 | }; |
| 935 | result[@intFromEnum(Feature.max_interleave_factor_4)] = .{ | |
| 935 | result[@backingInt(Feature.max_interleave_factor_4)] = .{ | |
| 936 | 936 | .llvm_name = "max-interleave-factor-4", |
| 937 | 937 | .description = "Set the MaxInterleaveFactor to 4 (from the default 2)", |
| 938 | 938 | .dependencies = featureSet(&[_]Feature{}), |
| 939 | 939 | }; |
| 940 | result[@intFromEnum(Feature.mec)] = .{ | |
| 940 | result[@backingInt(Feature.mec)] = .{ | |
| 941 | 941 | .llvm_name = "mec", |
| 942 | 942 | .description = "Enable Memory Encryption Contexts Extension", |
| 943 | 943 | .dependencies = featureSet(&[_]Feature{ |
| 944 | 944 | .rme, |
| 945 | 945 | }), |
| 946 | 946 | }; |
| 947 | result[@intFromEnum(Feature.mops)] = .{ | |
| 947 | result[@backingInt(Feature.mops)] = .{ | |
| 948 | 948 | .llvm_name = "mops", |
| 949 | 949 | .description = "Enable Armv8.8-A memcpy and memset acceleration instructions", |
| 950 | 950 | .dependencies = featureSet(&[_]Feature{}), |
| 951 | 951 | }; |
| 952 | result[@intFromEnum(Feature.mops_go)] = .{ | |
| 952 | result[@backingInt(Feature.mops_go)] = .{ | |
| 953 | 953 | .llvm_name = "mops-go", |
| 954 | 954 | .description = "Enable memset acceleration granule only", |
| 955 | 955 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -957,71 +957,71 @@ pub const all_features = blk: { |
| 957 | 957 | .mte, |
| 958 | 958 | }), |
| 959 | 959 | }; |
| 960 | result[@intFromEnum(Feature.mpam)] = .{ | |
| 960 | result[@backingInt(Feature.mpam)] = .{ | |
| 961 | 961 | .llvm_name = "mpam", |
| 962 | 962 | .description = "Enable Armv8.4-A Memory system Partitioning and Monitoring extension", |
| 963 | 963 | .dependencies = featureSet(&[_]Feature{}), |
| 964 | 964 | }; |
| 965 | result[@intFromEnum(Feature.mpamv2)] = .{ | |
| 965 | result[@backingInt(Feature.mpamv2)] = .{ | |
| 966 | 966 | .llvm_name = "mpamv2", |
| 967 | 967 | .description = "Enable Armv9.7-A MPAMv2 Lookaside Buffer Invalidate instructions", |
| 968 | 968 | .dependencies = featureSet(&[_]Feature{}), |
| 969 | 969 | }; |
| 970 | result[@intFromEnum(Feature.mte)] = .{ | |
| 970 | result[@backingInt(Feature.mte)] = .{ | |
| 971 | 971 | .llvm_name = "mte", |
| 972 | 972 | .description = "Enable Memory Tagging Extension", |
| 973 | 973 | .dependencies = featureSet(&[_]Feature{}), |
| 974 | 974 | }; |
| 975 | result[@intFromEnum(Feature.mtetc)] = .{ | |
| 975 | result[@backingInt(Feature.mtetc)] = .{ | |
| 976 | 976 | .llvm_name = "mtetc", |
| 977 | 977 | .description = "Enable Virtual Memory Tagging Extension", |
| 978 | 978 | .dependencies = featureSet(&[_]Feature{ |
| 979 | 979 | .mte, |
| 980 | 980 | }), |
| 981 | 981 | }; |
| 982 | result[@intFromEnum(Feature.neon)] = .{ | |
| 982 | result[@backingInt(Feature.neon)] = .{ | |
| 983 | 983 | .llvm_name = "neon", |
| 984 | 984 | .description = "Enable Advanced SIMD instructions", |
| 985 | 985 | .dependencies = featureSet(&[_]Feature{ |
| 986 | 986 | .fp_armv8, |
| 987 | 987 | }), |
| 988 | 988 | }; |
| 989 | result[@intFromEnum(Feature.nmi)] = .{ | |
| 989 | result[@backingInt(Feature.nmi)] = .{ | |
| 990 | 990 | .llvm_name = "nmi", |
| 991 | 991 | .description = "Enable Armv8.8-A Non-maskable Interrupts", |
| 992 | 992 | .dependencies = featureSet(&[_]Feature{}), |
| 993 | 993 | }; |
| 994 | result[@intFromEnum(Feature.no_bti_at_return_twice)] = .{ | |
| 994 | result[@backingInt(Feature.no_bti_at_return_twice)] = .{ | |
| 995 | 995 | .llvm_name = "no-bti-at-return-twice", |
| 996 | 996 | .description = "Don't place a BTI instruction after a return-twice", |
| 997 | 997 | .dependencies = featureSet(&[_]Feature{}), |
| 998 | 998 | }; |
| 999 | result[@intFromEnum(Feature.no_neg_immediates)] = .{ | |
| 999 | result[@backingInt(Feature.no_neg_immediates)] = .{ | |
| 1000 | 1000 | .llvm_name = "no-neg-immediates", |
| 1001 | 1001 | .description = "Convert immediates and instructions to their negated or complemented equivalent when the immediate does not fit in the encoding.", |
| 1002 | 1002 | .dependencies = featureSet(&[_]Feature{}), |
| 1003 | 1003 | }; |
| 1004 | result[@intFromEnum(Feature.no_sve_fp_ld1r)] = .{ | |
| 1004 | result[@backingInt(Feature.no_sve_fp_ld1r)] = .{ | |
| 1005 | 1005 | .llvm_name = "no-sve-fp-ld1r", |
| 1006 | 1006 | .description = "Avoid using LD1RX instructions for FP", |
| 1007 | 1007 | .dependencies = featureSet(&[_]Feature{}), |
| 1008 | 1008 | }; |
| 1009 | result[@intFromEnum(Feature.no_zcz_fpr64)] = .{ | |
| 1009 | result[@backingInt(Feature.no_zcz_fpr64)] = .{ | |
| 1010 | 1010 | .llvm_name = "no-zcz-fpr64", |
| 1011 | 1011 | .description = "Has no zero-cycle zeroing instructions for FPR64 registers", |
| 1012 | 1012 | .dependencies = featureSet(&[_]Feature{}), |
| 1013 | 1013 | }; |
| 1014 | result[@intFromEnum(Feature.nv)] = .{ | |
| 1014 | result[@backingInt(Feature.nv)] = .{ | |
| 1015 | 1015 | .llvm_name = "nv", |
| 1016 | 1016 | .description = "Enable Armv8.4-A Nested Virtualization Enchancement", |
| 1017 | 1017 | .dependencies = featureSet(&[_]Feature{}), |
| 1018 | 1018 | }; |
| 1019 | result[@intFromEnum(Feature.occmo)] = .{ | |
| 1019 | result[@backingInt(Feature.occmo)] = .{ | |
| 1020 | 1020 | .llvm_name = "occmo", |
| 1021 | 1021 | .description = "Enable Armv9.6-A Outer cacheable cache maintenance operations", |
| 1022 | 1022 | .dependencies = featureSet(&[_]Feature{}), |
| 1023 | 1023 | }; |
| 1024 | result[@intFromEnum(Feature.olympus)] = .{ | |
| 1024 | result[@backingInt(Feature.olympus)] = .{ | |
| 1025 | 1025 | .llvm_name = "olympus", |
| 1026 | 1026 | .description = "NVIDIA Olympus processors", |
| 1027 | 1027 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1036,288 +1036,288 @@ pub const all_features = blk: { |
| 1036 | 1036 | .use_postra_scheduler, |
| 1037 | 1037 | }), |
| 1038 | 1038 | }; |
| 1039 | result[@intFromEnum(Feature.outline_atomics)] = .{ | |
| 1039 | result[@backingInt(Feature.outline_atomics)] = .{ | |
| 1040 | 1040 | .llvm_name = "outline-atomics", |
| 1041 | 1041 | .description = "Enable out of line atomics to support LSE instructions", |
| 1042 | 1042 | .dependencies = featureSet(&[_]Feature{}), |
| 1043 | 1043 | }; |
| 1044 | result[@intFromEnum(Feature.pan)] = .{ | |
| 1044 | result[@backingInt(Feature.pan)] = .{ | |
| 1045 | 1045 | .llvm_name = "pan", |
| 1046 | 1046 | .description = "Enable Armv8.1-A Privileged Access-Never extension", |
| 1047 | 1047 | .dependencies = featureSet(&[_]Feature{}), |
| 1048 | 1048 | }; |
| 1049 | result[@intFromEnum(Feature.pan_rwv)] = .{ | |
| 1049 | result[@backingInt(Feature.pan_rwv)] = .{ | |
| 1050 | 1050 | .llvm_name = "pan-rwv", |
| 1051 | 1051 | .description = "Enable Armv8.2-A PAN s1e1R and s1e1W Variants", |
| 1052 | 1052 | .dependencies = featureSet(&[_]Feature{ |
| 1053 | 1053 | .pan, |
| 1054 | 1054 | }), |
| 1055 | 1055 | }; |
| 1056 | result[@intFromEnum(Feature.pauth)] = .{ | |
| 1056 | result[@backingInt(Feature.pauth)] = .{ | |
| 1057 | 1057 | .llvm_name = "pauth", |
| 1058 | 1058 | .description = "Enable Armv8.3-A Pointer Authentication extension", |
| 1059 | 1059 | .dependencies = featureSet(&[_]Feature{}), |
| 1060 | 1060 | }; |
| 1061 | result[@intFromEnum(Feature.pauth_lr)] = .{ | |
| 1061 | result[@backingInt(Feature.pauth_lr)] = .{ | |
| 1062 | 1062 | .llvm_name = "pauth-lr", |
| 1063 | 1063 | .description = "Enable Armv9.5-A PAC enhancements", |
| 1064 | 1064 | .dependencies = featureSet(&[_]Feature{}), |
| 1065 | 1065 | }; |
| 1066 | result[@intFromEnum(Feature.pcdphint)] = .{ | |
| 1066 | result[@backingInt(Feature.pcdphint)] = .{ | |
| 1067 | 1067 | .llvm_name = "pcdphint", |
| 1068 | 1068 | .description = "Enable Armv9.6-A Producer Consumer Data Placement hints", |
| 1069 | 1069 | .dependencies = featureSet(&[_]Feature{}), |
| 1070 | 1070 | }; |
| 1071 | result[@intFromEnum(Feature.perfmon)] = .{ | |
| 1071 | result[@backingInt(Feature.perfmon)] = .{ | |
| 1072 | 1072 | .llvm_name = "perfmon", |
| 1073 | 1073 | .description = "Enable Armv8.0-A PMUv3 Performance Monitors extension", |
| 1074 | 1074 | .dependencies = featureSet(&[_]Feature{}), |
| 1075 | 1075 | }; |
| 1076 | result[@intFromEnum(Feature.poe2)] = .{ | |
| 1076 | result[@backingInt(Feature.poe2)] = .{ | |
| 1077 | 1077 | .llvm_name = "poe2", |
| 1078 | 1078 | .description = "Enable Stage 1 Permission Overlays Extension 2 instructions", |
| 1079 | 1079 | .dependencies = featureSet(&[_]Feature{}), |
| 1080 | 1080 | }; |
| 1081 | result[@intFromEnum(Feature.pops)] = .{ | |
| 1081 | result[@backingInt(Feature.pops)] = .{ | |
| 1082 | 1082 | .llvm_name = "pops", |
| 1083 | 1083 | .description = "Enable Armv9.6-A Point Of Physical Storage (PoPS) DC instructions", |
| 1084 | 1084 | .dependencies = featureSet(&[_]Feature{}), |
| 1085 | 1085 | }; |
| 1086 | result[@intFromEnum(Feature.predictable_select_expensive)] = .{ | |
| 1086 | result[@backingInt(Feature.predictable_select_expensive)] = .{ | |
| 1087 | 1087 | .llvm_name = "predictable-select-expensive", |
| 1088 | 1088 | .description = "Prefer likely predicted branches over selects", |
| 1089 | 1089 | .dependencies = featureSet(&[_]Feature{}), |
| 1090 | 1090 | }; |
| 1091 | result[@intFromEnum(Feature.predres)] = .{ | |
| 1091 | result[@backingInt(Feature.predres)] = .{ | |
| 1092 | 1092 | .llvm_name = "predres", |
| 1093 | 1093 | .description = "Enable Armv8.5-A execution and data prediction invalidation instructions", |
| 1094 | 1094 | .dependencies = featureSet(&[_]Feature{}), |
| 1095 | 1095 | }; |
| 1096 | result[@intFromEnum(Feature.prfm_slc_target)] = .{ | |
| 1096 | result[@backingInt(Feature.prfm_slc_target)] = .{ | |
| 1097 | 1097 | .llvm_name = "prfm-slc-target", |
| 1098 | 1098 | .description = "Enable SLC target for PRFM instruction", |
| 1099 | 1099 | .dependencies = featureSet(&[_]Feature{}), |
| 1100 | 1100 | }; |
| 1101 | result[@intFromEnum(Feature.rand)] = .{ | |
| 1101 | result[@backingInt(Feature.rand)] = .{ | |
| 1102 | 1102 | .llvm_name = "rand", |
| 1103 | 1103 | .description = "Enable Random Number generation instructions", |
| 1104 | 1104 | .dependencies = featureSet(&[_]Feature{}), |
| 1105 | 1105 | }; |
| 1106 | result[@intFromEnum(Feature.ras)] = .{ | |
| 1106 | result[@backingInt(Feature.ras)] = .{ | |
| 1107 | 1107 | .llvm_name = "ras", |
| 1108 | 1108 | .description = "Enable Armv8.0-A Reliability, Availability and Serviceability Extensions", |
| 1109 | 1109 | .dependencies = featureSet(&[_]Feature{}), |
| 1110 | 1110 | }; |
| 1111 | result[@intFromEnum(Feature.rasv2)] = .{ | |
| 1111 | result[@backingInt(Feature.rasv2)] = .{ | |
| 1112 | 1112 | .llvm_name = "rasv2", |
| 1113 | 1113 | .description = "Enable Armv8.9-A Reliability, Availability and Serviceability Extensions", |
| 1114 | 1114 | .dependencies = featureSet(&[_]Feature{ |
| 1115 | 1115 | .ras, |
| 1116 | 1116 | }), |
| 1117 | 1117 | }; |
| 1118 | result[@intFromEnum(Feature.rcpc)] = .{ | |
| 1118 | result[@backingInt(Feature.rcpc)] = .{ | |
| 1119 | 1119 | .llvm_name = "rcpc", |
| 1120 | 1120 | .description = "Enable support for RCPC extension", |
| 1121 | 1121 | .dependencies = featureSet(&[_]Feature{}), |
| 1122 | 1122 | }; |
| 1123 | result[@intFromEnum(Feature.rcpc3)] = .{ | |
| 1123 | result[@backingInt(Feature.rcpc3)] = .{ | |
| 1124 | 1124 | .llvm_name = "rcpc3", |
| 1125 | 1125 | .description = "Enable Armv8.9-A RCPC instructions for A64 and Advanced SIMD and floating-point instruction set", |
| 1126 | 1126 | .dependencies = featureSet(&[_]Feature{ |
| 1127 | 1127 | .rcpc_immo, |
| 1128 | 1128 | }), |
| 1129 | 1129 | }; |
| 1130 | result[@intFromEnum(Feature.rcpc_immo)] = .{ | |
| 1130 | result[@backingInt(Feature.rcpc_immo)] = .{ | |
| 1131 | 1131 | .llvm_name = "rcpc-immo", |
| 1132 | 1132 | .description = "Enable Armv8.4-A RCPC instructions with Immediate Offsets", |
| 1133 | 1133 | .dependencies = featureSet(&[_]Feature{ |
| 1134 | 1134 | .rcpc, |
| 1135 | 1135 | }), |
| 1136 | 1136 | }; |
| 1137 | result[@intFromEnum(Feature.rdm)] = .{ | |
| 1137 | result[@backingInt(Feature.rdm)] = .{ | |
| 1138 | 1138 | .llvm_name = "rdm", |
| 1139 | 1139 | .description = "Enable Armv8.1-A Rounding Double Multiply Add/Subtract instructions", |
| 1140 | 1140 | .dependencies = featureSet(&[_]Feature{ |
| 1141 | 1141 | .neon, |
| 1142 | 1142 | }), |
| 1143 | 1143 | }; |
| 1144 | result[@intFromEnum(Feature.reserve_lr_for_ra)] = .{ | |
| 1144 | result[@backingInt(Feature.reserve_lr_for_ra)] = .{ | |
| 1145 | 1145 | .llvm_name = "reserve-lr-for-ra", |
| 1146 | 1146 | .description = "Reserve LR for call use only", |
| 1147 | 1147 | .dependencies = featureSet(&[_]Feature{}), |
| 1148 | 1148 | }; |
| 1149 | result[@intFromEnum(Feature.reserve_x1)] = .{ | |
| 1149 | result[@backingInt(Feature.reserve_x1)] = .{ | |
| 1150 | 1150 | .llvm_name = "reserve-x1", |
| 1151 | 1151 | .description = "Reserve X1, making it unavailable as a GPR", |
| 1152 | 1152 | .dependencies = featureSet(&[_]Feature{}), |
| 1153 | 1153 | }; |
| 1154 | result[@intFromEnum(Feature.reserve_x10)] = .{ | |
| 1154 | result[@backingInt(Feature.reserve_x10)] = .{ | |
| 1155 | 1155 | .llvm_name = "reserve-x10", |
| 1156 | 1156 | .description = "Reserve X10, making it unavailable as a GPR", |
| 1157 | 1157 | .dependencies = featureSet(&[_]Feature{}), |
| 1158 | 1158 | }; |
| 1159 | result[@intFromEnum(Feature.reserve_x11)] = .{ | |
| 1159 | result[@backingInt(Feature.reserve_x11)] = .{ | |
| 1160 | 1160 | .llvm_name = "reserve-x11", |
| 1161 | 1161 | .description = "Reserve X11, making it unavailable as a GPR", |
| 1162 | 1162 | .dependencies = featureSet(&[_]Feature{}), |
| 1163 | 1163 | }; |
| 1164 | result[@intFromEnum(Feature.reserve_x12)] = .{ | |
| 1164 | result[@backingInt(Feature.reserve_x12)] = .{ | |
| 1165 | 1165 | .llvm_name = "reserve-x12", |
| 1166 | 1166 | .description = "Reserve X12, making it unavailable as a GPR", |
| 1167 | 1167 | .dependencies = featureSet(&[_]Feature{}), |
| 1168 | 1168 | }; |
| 1169 | result[@intFromEnum(Feature.reserve_x13)] = .{ | |
| 1169 | result[@backingInt(Feature.reserve_x13)] = .{ | |
| 1170 | 1170 | .llvm_name = "reserve-x13", |
| 1171 | 1171 | .description = "Reserve X13, making it unavailable as a GPR", |
| 1172 | 1172 | .dependencies = featureSet(&[_]Feature{}), |
| 1173 | 1173 | }; |
| 1174 | result[@intFromEnum(Feature.reserve_x14)] = .{ | |
| 1174 | result[@backingInt(Feature.reserve_x14)] = .{ | |
| 1175 | 1175 | .llvm_name = "reserve-x14", |
| 1176 | 1176 | .description = "Reserve X14, making it unavailable as a GPR", |
| 1177 | 1177 | .dependencies = featureSet(&[_]Feature{}), |
| 1178 | 1178 | }; |
| 1179 | result[@intFromEnum(Feature.reserve_x15)] = .{ | |
| 1179 | result[@backingInt(Feature.reserve_x15)] = .{ | |
| 1180 | 1180 | .llvm_name = "reserve-x15", |
| 1181 | 1181 | .description = "Reserve X15, making it unavailable as a GPR", |
| 1182 | 1182 | .dependencies = featureSet(&[_]Feature{}), |
| 1183 | 1183 | }; |
| 1184 | result[@intFromEnum(Feature.reserve_x18)] = .{ | |
| 1184 | result[@backingInt(Feature.reserve_x18)] = .{ | |
| 1185 | 1185 | .llvm_name = "reserve-x18", |
| 1186 | 1186 | .description = "Reserve X18, making it unavailable as a GPR", |
| 1187 | 1187 | .dependencies = featureSet(&[_]Feature{}), |
| 1188 | 1188 | }; |
| 1189 | result[@intFromEnum(Feature.reserve_x2)] = .{ | |
| 1189 | result[@backingInt(Feature.reserve_x2)] = .{ | |
| 1190 | 1190 | .llvm_name = "reserve-x2", |
| 1191 | 1191 | .description = "Reserve X2, making it unavailable as a GPR", |
| 1192 | 1192 | .dependencies = featureSet(&[_]Feature{}), |
| 1193 | 1193 | }; |
| 1194 | result[@intFromEnum(Feature.reserve_x20)] = .{ | |
| 1194 | result[@backingInt(Feature.reserve_x20)] = .{ | |
| 1195 | 1195 | .llvm_name = "reserve-x20", |
| 1196 | 1196 | .description = "Reserve X20, making it unavailable as a GPR", |
| 1197 | 1197 | .dependencies = featureSet(&[_]Feature{}), |
| 1198 | 1198 | }; |
| 1199 | result[@intFromEnum(Feature.reserve_x21)] = .{ | |
| 1199 | result[@backingInt(Feature.reserve_x21)] = .{ | |
| 1200 | 1200 | .llvm_name = "reserve-x21", |
| 1201 | 1201 | .description = "Reserve X21, making it unavailable as a GPR", |
| 1202 | 1202 | .dependencies = featureSet(&[_]Feature{}), |
| 1203 | 1203 | }; |
| 1204 | result[@intFromEnum(Feature.reserve_x22)] = .{ | |
| 1204 | result[@backingInt(Feature.reserve_x22)] = .{ | |
| 1205 | 1205 | .llvm_name = "reserve-x22", |
| 1206 | 1206 | .description = "Reserve X22, making it unavailable as a GPR", |
| 1207 | 1207 | .dependencies = featureSet(&[_]Feature{}), |
| 1208 | 1208 | }; |
| 1209 | result[@intFromEnum(Feature.reserve_x23)] = .{ | |
| 1209 | result[@backingInt(Feature.reserve_x23)] = .{ | |
| 1210 | 1210 | .llvm_name = "reserve-x23", |
| 1211 | 1211 | .description = "Reserve X23, making it unavailable as a GPR", |
| 1212 | 1212 | .dependencies = featureSet(&[_]Feature{}), |
| 1213 | 1213 | }; |
| 1214 | result[@intFromEnum(Feature.reserve_x24)] = .{ | |
| 1214 | result[@backingInt(Feature.reserve_x24)] = .{ | |
| 1215 | 1215 | .llvm_name = "reserve-x24", |
| 1216 | 1216 | .description = "Reserve X24, making it unavailable as a GPR", |
| 1217 | 1217 | .dependencies = featureSet(&[_]Feature{}), |
| 1218 | 1218 | }; |
| 1219 | result[@intFromEnum(Feature.reserve_x25)] = .{ | |
| 1219 | result[@backingInt(Feature.reserve_x25)] = .{ | |
| 1220 | 1220 | .llvm_name = "reserve-x25", |
| 1221 | 1221 | .description = "Reserve X25, making it unavailable as a GPR", |
| 1222 | 1222 | .dependencies = featureSet(&[_]Feature{}), |
| 1223 | 1223 | }; |
| 1224 | result[@intFromEnum(Feature.reserve_x26)] = .{ | |
| 1224 | result[@backingInt(Feature.reserve_x26)] = .{ | |
| 1225 | 1225 | .llvm_name = "reserve-x26", |
| 1226 | 1226 | .description = "Reserve X26, making it unavailable as a GPR", |
| 1227 | 1227 | .dependencies = featureSet(&[_]Feature{}), |
| 1228 | 1228 | }; |
| 1229 | result[@intFromEnum(Feature.reserve_x27)] = .{ | |
| 1229 | result[@backingInt(Feature.reserve_x27)] = .{ | |
| 1230 | 1230 | .llvm_name = "reserve-x27", |
| 1231 | 1231 | .description = "Reserve X27, making it unavailable as a GPR", |
| 1232 | 1232 | .dependencies = featureSet(&[_]Feature{}), |
| 1233 | 1233 | }; |
| 1234 | result[@intFromEnum(Feature.reserve_x28)] = .{ | |
| 1234 | result[@backingInt(Feature.reserve_x28)] = .{ | |
| 1235 | 1235 | .llvm_name = "reserve-x28", |
| 1236 | 1236 | .description = "Reserve X28, making it unavailable as a GPR", |
| 1237 | 1237 | .dependencies = featureSet(&[_]Feature{}), |
| 1238 | 1238 | }; |
| 1239 | result[@intFromEnum(Feature.reserve_x3)] = .{ | |
| 1239 | result[@backingInt(Feature.reserve_x3)] = .{ | |
| 1240 | 1240 | .llvm_name = "reserve-x3", |
| 1241 | 1241 | .description = "Reserve X3, making it unavailable as a GPR", |
| 1242 | 1242 | .dependencies = featureSet(&[_]Feature{}), |
| 1243 | 1243 | }; |
| 1244 | result[@intFromEnum(Feature.reserve_x4)] = .{ | |
| 1244 | result[@backingInt(Feature.reserve_x4)] = .{ | |
| 1245 | 1245 | .llvm_name = "reserve-x4", |
| 1246 | 1246 | .description = "Reserve X4, making it unavailable as a GPR", |
| 1247 | 1247 | .dependencies = featureSet(&[_]Feature{}), |
| 1248 | 1248 | }; |
| 1249 | result[@intFromEnum(Feature.reserve_x5)] = .{ | |
| 1249 | result[@backingInt(Feature.reserve_x5)] = .{ | |
| 1250 | 1250 | .llvm_name = "reserve-x5", |
| 1251 | 1251 | .description = "Reserve X5, making it unavailable as a GPR", |
| 1252 | 1252 | .dependencies = featureSet(&[_]Feature{}), |
| 1253 | 1253 | }; |
| 1254 | result[@intFromEnum(Feature.reserve_x6)] = .{ | |
| 1254 | result[@backingInt(Feature.reserve_x6)] = .{ | |
| 1255 | 1255 | .llvm_name = "reserve-x6", |
| 1256 | 1256 | .description = "Reserve X6, making it unavailable as a GPR", |
| 1257 | 1257 | .dependencies = featureSet(&[_]Feature{}), |
| 1258 | 1258 | }; |
| 1259 | result[@intFromEnum(Feature.reserve_x7)] = .{ | |
| 1259 | result[@backingInt(Feature.reserve_x7)] = .{ | |
| 1260 | 1260 | .llvm_name = "reserve-x7", |
| 1261 | 1261 | .description = "Reserve X7, making it unavailable as a GPR", |
| 1262 | 1262 | .dependencies = featureSet(&[_]Feature{}), |
| 1263 | 1263 | }; |
| 1264 | result[@intFromEnum(Feature.reserve_x9)] = .{ | |
| 1264 | result[@backingInt(Feature.reserve_x9)] = .{ | |
| 1265 | 1265 | .llvm_name = "reserve-x9", |
| 1266 | 1266 | .description = "Reserve X9, making it unavailable as a GPR", |
| 1267 | 1267 | .dependencies = featureSet(&[_]Feature{}), |
| 1268 | 1268 | }; |
| 1269 | result[@intFromEnum(Feature.rme)] = .{ | |
| 1269 | result[@backingInt(Feature.rme)] = .{ | |
| 1270 | 1270 | .llvm_name = "rme", |
| 1271 | 1271 | .description = "Enable Realm Management Extension", |
| 1272 | 1272 | .dependencies = featureSet(&[_]Feature{}), |
| 1273 | 1273 | }; |
| 1274 | result[@intFromEnum(Feature.sb)] = .{ | |
| 1274 | result[@backingInt(Feature.sb)] = .{ | |
| 1275 | 1275 | .llvm_name = "sb", |
| 1276 | 1276 | .description = "Enable Armv8.5-A Speculation Barrier", |
| 1277 | 1277 | .dependencies = featureSet(&[_]Feature{}), |
| 1278 | 1278 | }; |
| 1279 | result[@intFromEnum(Feature.sel2)] = .{ | |
| 1279 | result[@backingInt(Feature.sel2)] = .{ | |
| 1280 | 1280 | .llvm_name = "sel2", |
| 1281 | 1281 | .description = "Enable Armv8.4-A Secure Exception Level 2 extension", |
| 1282 | 1282 | .dependencies = featureSet(&[_]Feature{}), |
| 1283 | 1283 | }; |
| 1284 | result[@intFromEnum(Feature.sha2)] = .{ | |
| 1284 | result[@backingInt(Feature.sha2)] = .{ | |
| 1285 | 1285 | .llvm_name = "sha2", |
| 1286 | 1286 | .description = "Enable SHA1 and SHA256 support", |
| 1287 | 1287 | .dependencies = featureSet(&[_]Feature{ |
| 1288 | 1288 | .neon, |
| 1289 | 1289 | }), |
| 1290 | 1290 | }; |
| 1291 | result[@intFromEnum(Feature.sha3)] = .{ | |
| 1291 | result[@backingInt(Feature.sha3)] = .{ | |
| 1292 | 1292 | .llvm_name = "sha3", |
| 1293 | 1293 | .description = "Enable SHA512 and SHA3 support", |
| 1294 | 1294 | .dependencies = featureSet(&[_]Feature{ |
| 1295 | 1295 | .sha2, |
| 1296 | 1296 | }), |
| 1297 | 1297 | }; |
| 1298 | result[@intFromEnum(Feature.slow_misaligned_128store)] = .{ | |
| 1298 | result[@backingInt(Feature.slow_misaligned_128store)] = .{ | |
| 1299 | 1299 | .llvm_name = "slow-misaligned-128store", |
| 1300 | 1300 | .description = "Misaligned 128 bit stores are slow", |
| 1301 | 1301 | .dependencies = featureSet(&[_]Feature{}), |
| 1302 | 1302 | }; |
| 1303 | result[@intFromEnum(Feature.slow_paired_128)] = .{ | |
| 1303 | result[@backingInt(Feature.slow_paired_128)] = .{ | |
| 1304 | 1304 | .llvm_name = "slow-paired-128", |
| 1305 | 1305 | .description = "Paired 128 bit loads and stores are slow", |
| 1306 | 1306 | .dependencies = featureSet(&[_]Feature{}), |
| 1307 | 1307 | }; |
| 1308 | result[@intFromEnum(Feature.slow_strqro_store)] = .{ | |
| 1308 | result[@backingInt(Feature.slow_strqro_store)] = .{ | |
| 1309 | 1309 | .llvm_name = "slow-strqro-store", |
| 1310 | 1310 | .description = "STR of Q register with register offset is slow", |
| 1311 | 1311 | .dependencies = featureSet(&[_]Feature{}), |
| 1312 | 1312 | }; |
| 1313 | result[@intFromEnum(Feature.sm4)] = .{ | |
| 1313 | result[@backingInt(Feature.sm4)] = .{ | |
| 1314 | 1314 | .llvm_name = "sm4", |
| 1315 | 1315 | .description = "Enable SM3 and SM4 support", |
| 1316 | 1316 | .dependencies = featureSet(&[_]Feature{ |
| 1317 | 1317 | .neon, |
| 1318 | 1318 | }), |
| 1319 | 1319 | }; |
| 1320 | result[@intFromEnum(Feature.sme)] = .{ | |
| 1320 | result[@backingInt(Feature.sme)] = .{ | |
| 1321 | 1321 | .llvm_name = "sme", |
| 1322 | 1322 | .description = "Enable Scalable Matrix Extension (SME)", |
| 1323 | 1323 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1325,35 +1325,35 @@ pub const all_features = blk: { |
| 1325 | 1325 | .fullfp16, |
| 1326 | 1326 | }), |
| 1327 | 1327 | }; |
| 1328 | result[@intFromEnum(Feature.sme2)] = .{ | |
| 1328 | result[@backingInt(Feature.sme2)] = .{ | |
| 1329 | 1329 | .llvm_name = "sme2", |
| 1330 | 1330 | .description = "Enable Scalable Matrix Extension 2 (SME2) instructions", |
| 1331 | 1331 | .dependencies = featureSet(&[_]Feature{ |
| 1332 | 1332 | .sme, |
| 1333 | 1333 | }), |
| 1334 | 1334 | }; |
| 1335 | result[@intFromEnum(Feature.sme2p1)] = .{ | |
| 1335 | result[@backingInt(Feature.sme2p1)] = .{ | |
| 1336 | 1336 | .llvm_name = "sme2p1", |
| 1337 | 1337 | .description = "Enable Scalable Matrix Extension 2.1 instructions", |
| 1338 | 1338 | .dependencies = featureSet(&[_]Feature{ |
| 1339 | 1339 | .sme2, |
| 1340 | 1340 | }), |
| 1341 | 1341 | }; |
| 1342 | result[@intFromEnum(Feature.sme2p2)] = .{ | |
| 1342 | result[@backingInt(Feature.sme2p2)] = .{ | |
| 1343 | 1343 | .llvm_name = "sme2p2", |
| 1344 | 1344 | .description = "Enable Armv9.6-A Scalable Matrix Extension 2.2 instructions", |
| 1345 | 1345 | .dependencies = featureSet(&[_]Feature{ |
| 1346 | 1346 | .sme2p1, |
| 1347 | 1347 | }), |
| 1348 | 1348 | }; |
| 1349 | result[@intFromEnum(Feature.sme2p3)] = .{ | |
| 1349 | result[@backingInt(Feature.sme2p3)] = .{ | |
| 1350 | 1350 | .llvm_name = "sme2p3", |
| 1351 | 1351 | .description = "Enable Armv9.7-A Scalable Matrix Extension 2.3 instructions", |
| 1352 | 1352 | .dependencies = featureSet(&[_]Feature{ |
| 1353 | 1353 | .sme2p2, |
| 1354 | 1354 | }), |
| 1355 | 1355 | }; |
| 1356 | result[@intFromEnum(Feature.sme_b16b16)] = .{ | |
| 1356 | result[@backingInt(Feature.sme_b16b16)] = .{ | |
| 1357 | 1357 | .llvm_name = "sme-b16b16", |
| 1358 | 1358 | .description = "Enable SME2.1 ZA-targeting non-widening BFloat16 instructions", |
| 1359 | 1359 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1361,21 +1361,21 @@ pub const all_features = blk: { |
| 1361 | 1361 | .sve_b16b16, |
| 1362 | 1362 | }), |
| 1363 | 1363 | }; |
| 1364 | result[@intFromEnum(Feature.sme_f16f16)] = .{ | |
| 1364 | result[@backingInt(Feature.sme_f16f16)] = .{ | |
| 1365 | 1365 | .llvm_name = "sme-f16f16", |
| 1366 | 1366 | .description = "Enable SME non-widening Float16 instructions", |
| 1367 | 1367 | .dependencies = featureSet(&[_]Feature{ |
| 1368 | 1368 | .sme2, |
| 1369 | 1369 | }), |
| 1370 | 1370 | }; |
| 1371 | result[@intFromEnum(Feature.sme_f64f64)] = .{ | |
| 1371 | result[@backingInt(Feature.sme_f64f64)] = .{ | |
| 1372 | 1372 | .llvm_name = "sme-f64f64", |
| 1373 | 1373 | .description = "Enable Scalable Matrix Extension (SME) F64F64 instructions", |
| 1374 | 1374 | .dependencies = featureSet(&[_]Feature{ |
| 1375 | 1375 | .sme, |
| 1376 | 1376 | }), |
| 1377 | 1377 | }; |
| 1378 | result[@intFromEnum(Feature.sme_f8f16)] = .{ | |
| 1378 | result[@backingInt(Feature.sme_f8f16)] = .{ | |
| 1379 | 1379 | .llvm_name = "sme-f8f16", |
| 1380 | 1380 | .description = "Enable Scalable Matrix Extension (SME) F8F16 instructions", |
| 1381 | 1381 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1383,7 +1383,7 @@ pub const all_features = blk: { |
| 1383 | 1383 | .sme2, |
| 1384 | 1384 | }), |
| 1385 | 1385 | }; |
| 1386 | result[@intFromEnum(Feature.sme_f8f32)] = .{ | |
| 1386 | result[@backingInt(Feature.sme_f8f32)] = .{ | |
| 1387 | 1387 | .llvm_name = "sme-f8f32", |
| 1388 | 1388 | .description = "Enable Scalable Matrix Extension (SME) F8F32 instructions", |
| 1389 | 1389 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1391,7 +1391,7 @@ pub const all_features = blk: { |
| 1391 | 1391 | .sme2, |
| 1392 | 1392 | }), |
| 1393 | 1393 | }; |
| 1394 | result[@intFromEnum(Feature.sme_fa64)] = .{ | |
| 1394 | result[@backingInt(Feature.sme_fa64)] = .{ | |
| 1395 | 1395 | .llvm_name = "sme-fa64", |
| 1396 | 1396 | .description = "Enable the full A64 instruction set in streaming SVE mode", |
| 1397 | 1397 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1399,62 +1399,62 @@ pub const all_features = blk: { |
| 1399 | 1399 | .sve2, |
| 1400 | 1400 | }), |
| 1401 | 1401 | }; |
| 1402 | result[@intFromEnum(Feature.sme_i16i64)] = .{ | |
| 1402 | result[@backingInt(Feature.sme_i16i64)] = .{ | |
| 1403 | 1403 | .llvm_name = "sme-i16i64", |
| 1404 | 1404 | .description = "Enable Scalable Matrix Extension (SME) I16I64 instructions", |
| 1405 | 1405 | .dependencies = featureSet(&[_]Feature{ |
| 1406 | 1406 | .sme, |
| 1407 | 1407 | }), |
| 1408 | 1408 | }; |
| 1409 | result[@intFromEnum(Feature.sme_lutv2)] = .{ | |
| 1409 | result[@backingInt(Feature.sme_lutv2)] = .{ | |
| 1410 | 1410 | .llvm_name = "sme-lutv2", |
| 1411 | 1411 | .description = "Enable Scalable Matrix Extension (SME) LUTv2 instructions", |
| 1412 | 1412 | .dependencies = featureSet(&[_]Feature{ |
| 1413 | 1413 | .sme2, |
| 1414 | 1414 | }), |
| 1415 | 1415 | }; |
| 1416 | result[@intFromEnum(Feature.sme_mop4)] = .{ | |
| 1416 | result[@backingInt(Feature.sme_mop4)] = .{ | |
| 1417 | 1417 | .llvm_name = "sme-mop4", |
| 1418 | 1418 | .description = "Enable SME Quarter-tile outer product instructions", |
| 1419 | 1419 | .dependencies = featureSet(&[_]Feature{ |
| 1420 | 1420 | .sme2, |
| 1421 | 1421 | }), |
| 1422 | 1422 | }; |
| 1423 | result[@intFromEnum(Feature.sme_tmop)] = .{ | |
| 1423 | result[@backingInt(Feature.sme_tmop)] = .{ | |
| 1424 | 1424 | .llvm_name = "sme-tmop", |
| 1425 | 1425 | .description = "Enable SME Structured sparsity outer product instructions.", |
| 1426 | 1426 | .dependencies = featureSet(&[_]Feature{ |
| 1427 | 1427 | .sme2, |
| 1428 | 1428 | }), |
| 1429 | 1429 | }; |
| 1430 | result[@intFromEnum(Feature.spe)] = .{ | |
| 1430 | result[@backingInt(Feature.spe)] = .{ | |
| 1431 | 1431 | .llvm_name = "spe", |
| 1432 | 1432 | .description = "Enable Statistical Profiling extension", |
| 1433 | 1433 | .dependencies = featureSet(&[_]Feature{}), |
| 1434 | 1434 | }; |
| 1435 | result[@intFromEnum(Feature.spe_eef)] = .{ | |
| 1435 | result[@backingInt(Feature.spe_eef)] = .{ | |
| 1436 | 1436 | .llvm_name = "spe-eef", |
| 1437 | 1437 | .description = "Enable extra register in the Statistical Profiling Extension", |
| 1438 | 1438 | .dependencies = featureSet(&[_]Feature{}), |
| 1439 | 1439 | }; |
| 1440 | result[@intFromEnum(Feature.specres2)] = .{ | |
| 1440 | result[@backingInt(Feature.specres2)] = .{ | |
| 1441 | 1441 | .llvm_name = "specres2", |
| 1442 | 1442 | .description = "Enable Speculation Restriction Instruction", |
| 1443 | 1443 | .dependencies = featureSet(&[_]Feature{ |
| 1444 | 1444 | .predres, |
| 1445 | 1445 | }), |
| 1446 | 1446 | }; |
| 1447 | result[@intFromEnum(Feature.specrestrict)] = .{ | |
| 1447 | result[@backingInt(Feature.specrestrict)] = .{ | |
| 1448 | 1448 | .llvm_name = "specrestrict", |
| 1449 | 1449 | .description = "Enable architectural speculation restriction", |
| 1450 | 1450 | .dependencies = featureSet(&[_]Feature{}), |
| 1451 | 1451 | }; |
| 1452 | result[@intFromEnum(Feature.ssbs)] = .{ | |
| 1452 | result[@backingInt(Feature.ssbs)] = .{ | |
| 1453 | 1453 | .llvm_name = "ssbs", |
| 1454 | 1454 | .description = "Enable Speculative Store Bypass Safe bit", |
| 1455 | 1455 | .dependencies = featureSet(&[_]Feature{}), |
| 1456 | 1456 | }; |
| 1457 | result[@intFromEnum(Feature.ssve_aes)] = .{ | |
| 1457 | result[@backingInt(Feature.ssve_aes)] = .{ | |
| 1458 | 1458 | .llvm_name = "ssve-aes", |
| 1459 | 1459 | .description = "Enable Armv9.6-A SVE AES support in streaming SVE mode", |
| 1460 | 1460 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1462,7 +1462,7 @@ pub const all_features = blk: { |
| 1462 | 1462 | .sve_aes, |
| 1463 | 1463 | }), |
| 1464 | 1464 | }; |
| 1465 | result[@intFromEnum(Feature.ssve_bitperm)] = .{ | |
| 1465 | result[@backingInt(Feature.ssve_bitperm)] = .{ | |
| 1466 | 1466 | .llvm_name = "ssve-bitperm", |
| 1467 | 1467 | .description = "Enable Armv9.6-A SVE BitPerm support in streaming SVE mode", |
| 1468 | 1468 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1470,14 +1470,14 @@ pub const all_features = blk: { |
| 1470 | 1470 | .sve_bitperm, |
| 1471 | 1471 | }), |
| 1472 | 1472 | }; |
| 1473 | result[@intFromEnum(Feature.ssve_fexpa)] = .{ | |
| 1473 | result[@backingInt(Feature.ssve_fexpa)] = .{ | |
| 1474 | 1474 | .llvm_name = "ssve-fexpa", |
| 1475 | 1475 | .description = "Enable SVE FEXPA instruction in Streaming SVE mode", |
| 1476 | 1476 | .dependencies = featureSet(&[_]Feature{ |
| 1477 | 1477 | .sme2, |
| 1478 | 1478 | }), |
| 1479 | 1479 | }; |
| 1480 | result[@intFromEnum(Feature.ssve_fp8dot2)] = .{ | |
| 1480 | result[@backingInt(Feature.ssve_fp8dot2)] = .{ | |
| 1481 | 1481 | .llvm_name = "ssve-fp8dot2", |
| 1482 | 1482 | .description = "Enable SVE2 FP8 2-way dot product instructions", |
| 1483 | 1483 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1485,7 +1485,7 @@ pub const all_features = blk: { |
| 1485 | 1485 | .sme2, |
| 1486 | 1486 | }), |
| 1487 | 1487 | }; |
| 1488 | result[@intFromEnum(Feature.ssve_fp8dot4)] = .{ | |
| 1488 | result[@backingInt(Feature.ssve_fp8dot4)] = .{ | |
| 1489 | 1489 | .llvm_name = "ssve-fp8dot4", |
| 1490 | 1490 | .description = "Enable SVE2 FP8 4-way dot product instructions", |
| 1491 | 1491 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1493,7 +1493,7 @@ pub const all_features = blk: { |
| 1493 | 1493 | .sme2, |
| 1494 | 1494 | }), |
| 1495 | 1495 | }; |
| 1496 | result[@intFromEnum(Feature.ssve_fp8fma)] = .{ | |
| 1496 | result[@backingInt(Feature.ssve_fp8fma)] = .{ | |
| 1497 | 1497 | .llvm_name = "ssve-fp8fma", |
| 1498 | 1498 | .description = "Enable SVE2 FP8 multiply-add instructions", |
| 1499 | 1499 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1501,36 +1501,36 @@ pub const all_features = blk: { |
| 1501 | 1501 | .sme2, |
| 1502 | 1502 | }), |
| 1503 | 1503 | }; |
| 1504 | result[@intFromEnum(Feature.store_pair_suppress)] = .{ | |
| 1504 | result[@backingInt(Feature.store_pair_suppress)] = .{ | |
| 1505 | 1505 | .llvm_name = "store-pair-suppress", |
| 1506 | 1506 | .description = "Enable Store Pair Suppression heuristics", |
| 1507 | 1507 | .dependencies = featureSet(&[_]Feature{}), |
| 1508 | 1508 | }; |
| 1509 | result[@intFromEnum(Feature.stp_aligned_only)] = .{ | |
| 1509 | result[@backingInt(Feature.stp_aligned_only)] = .{ | |
| 1510 | 1510 | .llvm_name = "stp-aligned-only", |
| 1511 | 1511 | .description = "In order to emit stp, first check if the store will be aligned to 2 * element_size", |
| 1512 | 1512 | .dependencies = featureSet(&[_]Feature{}), |
| 1513 | 1513 | }; |
| 1514 | result[@intFromEnum(Feature.strict_align)] = .{ | |
| 1514 | result[@backingInt(Feature.strict_align)] = .{ | |
| 1515 | 1515 | .llvm_name = "strict-align", |
| 1516 | 1516 | .description = "Disallow all unaligned memory access", |
| 1517 | 1517 | .dependencies = featureSet(&[_]Feature{}), |
| 1518 | 1518 | }; |
| 1519 | result[@intFromEnum(Feature.sve)] = .{ | |
| 1519 | result[@backingInt(Feature.sve)] = .{ | |
| 1520 | 1520 | .llvm_name = "sve", |
| 1521 | 1521 | .description = "Enable Scalable Vector Extension (SVE) instructions", |
| 1522 | 1522 | .dependencies = featureSet(&[_]Feature{ |
| 1523 | 1523 | .fullfp16, |
| 1524 | 1524 | }), |
| 1525 | 1525 | }; |
| 1526 | result[@intFromEnum(Feature.sve2)] = .{ | |
| 1526 | result[@backingInt(Feature.sve2)] = .{ | |
| 1527 | 1527 | .llvm_name = "sve2", |
| 1528 | 1528 | .description = "Enable Scalable Vector Extension 2 (SVE2) instructions", |
| 1529 | 1529 | .dependencies = featureSet(&[_]Feature{ |
| 1530 | 1530 | .sve, |
| 1531 | 1531 | }), |
| 1532 | 1532 | }; |
| 1533 | result[@intFromEnum(Feature.sve2_aes)] = .{ | |
| 1533 | result[@backingInt(Feature.sve2_aes)] = .{ | |
| 1534 | 1534 | .llvm_name = "sve2-aes", |
| 1535 | 1535 | .description = "Shorthand for +sve2+sve-aes", |
| 1536 | 1536 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1538,7 +1538,7 @@ pub const all_features = blk: { |
| 1538 | 1538 | .sve_aes, |
| 1539 | 1539 | }), |
| 1540 | 1540 | }; |
| 1541 | result[@intFromEnum(Feature.sve2_bitperm)] = .{ | |
| 1541 | result[@backingInt(Feature.sve2_bitperm)] = .{ | |
| 1542 | 1542 | .llvm_name = "sve2-bitperm", |
| 1543 | 1543 | .description = "Shorthand for +sve2+sve-bitperm", |
| 1544 | 1544 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1546,7 +1546,7 @@ pub const all_features = blk: { |
| 1546 | 1546 | .sve_bitperm, |
| 1547 | 1547 | }), |
| 1548 | 1548 | }; |
| 1549 | result[@intFromEnum(Feature.sve2_sha3)] = .{ | |
| 1549 | result[@backingInt(Feature.sve2_sha3)] = .{ | |
| 1550 | 1550 | .llvm_name = "sve2-sha3", |
| 1551 | 1551 | .description = "Shorthand for +sve2+sve-sha3", |
| 1552 | 1552 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1554,7 +1554,7 @@ pub const all_features = blk: { |
| 1554 | 1554 | .sve_sha3, |
| 1555 | 1555 | }), |
| 1556 | 1556 | }; |
| 1557 | result[@intFromEnum(Feature.sve2_sm4)] = .{ | |
| 1557 | result[@backingInt(Feature.sve2_sm4)] = .{ | |
| 1558 | 1558 | .llvm_name = "sve2-sm4", |
| 1559 | 1559 | .description = "Shorthand for +sve2+sve-sm4", |
| 1560 | 1560 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1562,173 +1562,173 @@ pub const all_features = blk: { |
| 1562 | 1562 | .sve_sm4, |
| 1563 | 1563 | }), |
| 1564 | 1564 | }; |
| 1565 | result[@intFromEnum(Feature.sve2p1)] = .{ | |
| 1565 | result[@backingInt(Feature.sve2p1)] = .{ | |
| 1566 | 1566 | .llvm_name = "sve2p1", |
| 1567 | 1567 | .description = "Enable Scalable Vector Extension 2.1 instructions", |
| 1568 | 1568 | .dependencies = featureSet(&[_]Feature{ |
| 1569 | 1569 | .sve2, |
| 1570 | 1570 | }), |
| 1571 | 1571 | }; |
| 1572 | result[@intFromEnum(Feature.sve2p2)] = .{ | |
| 1572 | result[@backingInt(Feature.sve2p2)] = .{ | |
| 1573 | 1573 | .llvm_name = "sve2p2", |
| 1574 | 1574 | .description = "Enable Armv9.6-A Scalable Vector Extension 2.2 instructions", |
| 1575 | 1575 | .dependencies = featureSet(&[_]Feature{ |
| 1576 | 1576 | .sve2p1, |
| 1577 | 1577 | }), |
| 1578 | 1578 | }; |
| 1579 | result[@intFromEnum(Feature.sve2p3)] = .{ | |
| 1579 | result[@backingInt(Feature.sve2p3)] = .{ | |
| 1580 | 1580 | .llvm_name = "sve2p3", |
| 1581 | 1581 | .description = "Enable Armv9.7-A Scalable Vector Extension 2.3 instructions", |
| 1582 | 1582 | .dependencies = featureSet(&[_]Feature{ |
| 1583 | 1583 | .sve2p2, |
| 1584 | 1584 | }), |
| 1585 | 1585 | }; |
| 1586 | result[@intFromEnum(Feature.sve_aes)] = .{ | |
| 1586 | result[@backingInt(Feature.sve_aes)] = .{ | |
| 1587 | 1587 | .llvm_name = "sve-aes", |
| 1588 | 1588 | .description = "Enable SVE AES and quadword SVE polynomial multiply instructions", |
| 1589 | 1589 | .dependencies = featureSet(&[_]Feature{ |
| 1590 | 1590 | .aes, |
| 1591 | 1591 | }), |
| 1592 | 1592 | }; |
| 1593 | result[@intFromEnum(Feature.sve_aes2)] = .{ | |
| 1593 | result[@backingInt(Feature.sve_aes2)] = .{ | |
| 1594 | 1594 | .llvm_name = "sve-aes2", |
| 1595 | 1595 | .description = "Enable Armv9.6-A SVE multi-vector AES and multi-vector quadword polynomial multiply instructions", |
| 1596 | 1596 | .dependencies = featureSet(&[_]Feature{}), |
| 1597 | 1597 | }; |
| 1598 | result[@intFromEnum(Feature.sve_b16b16)] = .{ | |
| 1598 | result[@backingInt(Feature.sve_b16b16)] = .{ | |
| 1599 | 1599 | .llvm_name = "sve-b16b16", |
| 1600 | 1600 | .description = "Enable SVE2 non-widening and SME2 Z-targeting non-widening BFloat16 instructions", |
| 1601 | 1601 | .dependencies = featureSet(&[_]Feature{}), |
| 1602 | 1602 | }; |
| 1603 | result[@intFromEnum(Feature.sve_b16mm)] = .{ | |
| 1603 | result[@backingInt(Feature.sve_b16mm)] = .{ | |
| 1604 | 1604 | .llvm_name = "sve-b16mm", |
| 1605 | 1605 | .description = "Enable Armv9.7-A SVE non-widening BFloat16 matrix multiply-accumulate", |
| 1606 | 1606 | .dependencies = featureSet(&[_]Feature{ |
| 1607 | 1607 | .sve, |
| 1608 | 1608 | }), |
| 1609 | 1609 | }; |
| 1610 | result[@intFromEnum(Feature.sve_bfscale)] = .{ | |
| 1610 | result[@backingInt(Feature.sve_bfscale)] = .{ | |
| 1611 | 1611 | .llvm_name = "sve-bfscale", |
| 1612 | 1612 | .description = "Enable Armv9.6-A SVE BFloat16 scaling instructions", |
| 1613 | 1613 | .dependencies = featureSet(&[_]Feature{}), |
| 1614 | 1614 | }; |
| 1615 | result[@intFromEnum(Feature.sve_bitperm)] = .{ | |
| 1615 | result[@backingInt(Feature.sve_bitperm)] = .{ | |
| 1616 | 1616 | .llvm_name = "sve-bitperm", |
| 1617 | 1617 | .description = "Enable bit permutation SVE2 instructions", |
| 1618 | 1618 | .dependencies = featureSet(&[_]Feature{}), |
| 1619 | 1619 | }; |
| 1620 | result[@intFromEnum(Feature.sve_f16f32mm)] = .{ | |
| 1620 | result[@backingInt(Feature.sve_f16f32mm)] = .{ | |
| 1621 | 1621 | .llvm_name = "sve-f16f32mm", |
| 1622 | 1622 | .description = "Enable Armv9.6-A FP16 to FP32 Matrix Multiply instructions", |
| 1623 | 1623 | .dependencies = featureSet(&[_]Feature{ |
| 1624 | 1624 | .sve, |
| 1625 | 1625 | }), |
| 1626 | 1626 | }; |
| 1627 | result[@intFromEnum(Feature.sve_sha3)] = .{ | |
| 1627 | result[@backingInt(Feature.sve_sha3)] = .{ | |
| 1628 | 1628 | .llvm_name = "sve-sha3", |
| 1629 | 1629 | .description = "Enable SVE SHA3 instructions", |
| 1630 | 1630 | .dependencies = featureSet(&[_]Feature{ |
| 1631 | 1631 | .sha3, |
| 1632 | 1632 | }), |
| 1633 | 1633 | }; |
| 1634 | result[@intFromEnum(Feature.sve_sm4)] = .{ | |
| 1634 | result[@backingInt(Feature.sve_sm4)] = .{ | |
| 1635 | 1635 | .llvm_name = "sve-sm4", |
| 1636 | 1636 | .description = "Enable SVE SM4 instructions", |
| 1637 | 1637 | .dependencies = featureSet(&[_]Feature{ |
| 1638 | 1638 | .sm4, |
| 1639 | 1639 | }), |
| 1640 | 1640 | }; |
| 1641 | result[@intFromEnum(Feature.tagged_globals)] = .{ | |
| 1641 | result[@backingInt(Feature.tagged_globals)] = .{ | |
| 1642 | 1642 | .llvm_name = "tagged-globals", |
| 1643 | 1643 | .description = "Use an instruction sequence for taking the address of a global that allows a memory tag in the upper address bits", |
| 1644 | 1644 | .dependencies = featureSet(&[_]Feature{}), |
| 1645 | 1645 | }; |
| 1646 | result[@intFromEnum(Feature.tev)] = .{ | |
| 1646 | result[@backingInt(Feature.tev)] = .{ | |
| 1647 | 1647 | .llvm_name = "tev", |
| 1648 | 1648 | .description = "Enable TIndex Exception-like Vector instructions", |
| 1649 | 1649 | .dependencies = featureSet(&[_]Feature{}), |
| 1650 | 1650 | }; |
| 1651 | result[@intFromEnum(Feature.the)] = .{ | |
| 1651 | result[@backingInt(Feature.the)] = .{ | |
| 1652 | 1652 | .llvm_name = "the", |
| 1653 | 1653 | .description = "Enable Armv8.9-A Translation Hardening Extension", |
| 1654 | 1654 | .dependencies = featureSet(&[_]Feature{}), |
| 1655 | 1655 | }; |
| 1656 | result[@intFromEnum(Feature.tlb_rmi)] = .{ | |
| 1656 | result[@backingInt(Feature.tlb_rmi)] = .{ | |
| 1657 | 1657 | .llvm_name = "tlb-rmi", |
| 1658 | 1658 | .description = "Enable Armv8.4-A TLB Range and Maintenance instructions", |
| 1659 | 1659 | .dependencies = featureSet(&[_]Feature{}), |
| 1660 | 1660 | }; |
| 1661 | result[@intFromEnum(Feature.tlbid)] = .{ | |
| 1661 | result[@backingInt(Feature.tlbid)] = .{ | |
| 1662 | 1662 | .llvm_name = "tlbid", |
| 1663 | 1663 | .description = "Enable Armv9.7-A TLBI Domains extension", |
| 1664 | 1664 | .dependencies = featureSet(&[_]Feature{}), |
| 1665 | 1665 | }; |
| 1666 | result[@intFromEnum(Feature.tlbiw)] = .{ | |
| 1666 | result[@backingInt(Feature.tlbiw)] = .{ | |
| 1667 | 1667 | .llvm_name = "tlbiw", |
| 1668 | 1668 | .description = "Enable Armv9.5-A TLBI VMALL for Dirty State", |
| 1669 | 1669 | .dependencies = featureSet(&[_]Feature{}), |
| 1670 | 1670 | }; |
| 1671 | result[@intFromEnum(Feature.tpidr_el1)] = .{ | |
| 1671 | result[@backingInt(Feature.tpidr_el1)] = .{ | |
| 1672 | 1672 | .llvm_name = "tpidr-el1", |
| 1673 | 1673 | .description = "Permit use of TPIDR_EL1 for the TLS base", |
| 1674 | 1674 | .dependencies = featureSet(&[_]Feature{}), |
| 1675 | 1675 | }; |
| 1676 | result[@intFromEnum(Feature.tpidr_el2)] = .{ | |
| 1676 | result[@backingInt(Feature.tpidr_el2)] = .{ | |
| 1677 | 1677 | .llvm_name = "tpidr-el2", |
| 1678 | 1678 | .description = "Permit use of TPIDR_EL2 for the TLS base", |
| 1679 | 1679 | .dependencies = featureSet(&[_]Feature{}), |
| 1680 | 1680 | }; |
| 1681 | result[@intFromEnum(Feature.tpidr_el3)] = .{ | |
| 1681 | result[@backingInt(Feature.tpidr_el3)] = .{ | |
| 1682 | 1682 | .llvm_name = "tpidr-el3", |
| 1683 | 1683 | .description = "Permit use of TPIDR_EL3 for the TLS base", |
| 1684 | 1684 | .dependencies = featureSet(&[_]Feature{}), |
| 1685 | 1685 | }; |
| 1686 | result[@intFromEnum(Feature.tpidrro_el0)] = .{ | |
| 1686 | result[@backingInt(Feature.tpidrro_el0)] = .{ | |
| 1687 | 1687 | .llvm_name = "tpidrro-el0", |
| 1688 | 1688 | .description = "Permit use of TPIDRRO_EL0 for the TLS base", |
| 1689 | 1689 | .dependencies = featureSet(&[_]Feature{}), |
| 1690 | 1690 | }; |
| 1691 | result[@intFromEnum(Feature.tracev8_4)] = .{ | |
| 1691 | result[@backingInt(Feature.tracev8_4)] = .{ | |
| 1692 | 1692 | .llvm_name = "tracev8.4", |
| 1693 | 1693 | .description = "Enable Armv8.4-A Trace extension", |
| 1694 | 1694 | .dependencies = featureSet(&[_]Feature{}), |
| 1695 | 1695 | }; |
| 1696 | result[@intFromEnum(Feature.trbe)] = .{ | |
| 1696 | result[@backingInt(Feature.trbe)] = .{ | |
| 1697 | 1697 | .llvm_name = "trbe", |
| 1698 | 1698 | .description = "Enable Trace Buffer Extension", |
| 1699 | 1699 | .dependencies = featureSet(&[_]Feature{}), |
| 1700 | 1700 | }; |
| 1701 | result[@intFromEnum(Feature.uaops)] = .{ | |
| 1701 | result[@backingInt(Feature.uaops)] = .{ | |
| 1702 | 1702 | .llvm_name = "uaops", |
| 1703 | 1703 | .description = "Enable Armv8.2-A UAO PState", |
| 1704 | 1704 | .dependencies = featureSet(&[_]Feature{}), |
| 1705 | 1705 | }; |
| 1706 | result[@intFromEnum(Feature.use_experimental_zeroing_pseudos)] = .{ | |
| 1706 | result[@backingInt(Feature.use_experimental_zeroing_pseudos)] = .{ | |
| 1707 | 1707 | .llvm_name = "use-experimental-zeroing-pseudos", |
| 1708 | 1708 | .description = "Hint to the compiler that the MOVPRFX instruction is merged with destructive operations", |
| 1709 | 1709 | .dependencies = featureSet(&[_]Feature{}), |
| 1710 | 1710 | }; |
| 1711 | result[@intFromEnum(Feature.use_fixed_over_scalable_if_equal_cost)] = .{ | |
| 1711 | result[@backingInt(Feature.use_fixed_over_scalable_if_equal_cost)] = .{ | |
| 1712 | 1712 | .llvm_name = "use-fixed-over-scalable-if-equal-cost", |
| 1713 | 1713 | .description = "Prefer fixed width loop vectorization over scalable if the cost-model assigns equal costs", |
| 1714 | 1714 | .dependencies = featureSet(&[_]Feature{}), |
| 1715 | 1715 | }; |
| 1716 | result[@intFromEnum(Feature.use_postra_scheduler)] = .{ | |
| 1716 | result[@backingInt(Feature.use_postra_scheduler)] = .{ | |
| 1717 | 1717 | .llvm_name = "use-postra-scheduler", |
| 1718 | 1718 | .description = "Schedule again after register allocation", |
| 1719 | 1719 | .dependencies = featureSet(&[_]Feature{}), |
| 1720 | 1720 | }; |
| 1721 | result[@intFromEnum(Feature.use_reciprocal_square_root)] = .{ | |
| 1721 | result[@backingInt(Feature.use_reciprocal_square_root)] = .{ | |
| 1722 | 1722 | .llvm_name = "use-reciprocal-square-root", |
| 1723 | 1723 | .description = "Use the reciprocal square root approximation", |
| 1724 | 1724 | .dependencies = featureSet(&[_]Feature{}), |
| 1725 | 1725 | }; |
| 1726 | result[@intFromEnum(Feature.use_wzr_to_vec_move)] = .{ | |
| 1726 | result[@backingInt(Feature.use_wzr_to_vec_move)] = .{ | |
| 1727 | 1727 | .llvm_name = "use-wzr-to-vec-move", |
| 1728 | 1728 | .description = "Move from WZR to insert 0 into vector registers", |
| 1729 | 1729 | .dependencies = featureSet(&[_]Feature{}), |
| 1730 | 1730 | }; |
| 1731 | result[@intFromEnum(Feature.v8_1a)] = .{ | |
| 1731 | result[@backingInt(Feature.v8_1a)] = .{ | |
| 1732 | 1732 | .llvm_name = "v8.1a", |
| 1733 | 1733 | .description = "Support ARM v8.1a architecture", |
| 1734 | 1734 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1741,7 +1741,7 @@ pub const all_features = blk: { |
| 1741 | 1741 | .vh, |
| 1742 | 1742 | }), |
| 1743 | 1743 | }; |
| 1744 | result[@intFromEnum(Feature.v8_2a)] = .{ | |
| 1744 | result[@backingInt(Feature.v8_2a)] = .{ | |
| 1745 | 1745 | .llvm_name = "v8.2a", |
| 1746 | 1746 | .description = "Support ARM v8.2a architecture", |
| 1747 | 1747 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1752,7 +1752,7 @@ pub const all_features = blk: { |
| 1752 | 1752 | .v8_1a, |
| 1753 | 1753 | }), |
| 1754 | 1754 | }; |
| 1755 | result[@intFromEnum(Feature.v8_3a)] = .{ | |
| 1755 | result[@backingInt(Feature.v8_3a)] = .{ | |
| 1756 | 1756 | .llvm_name = "v8.3a", |
| 1757 | 1757 | .description = "Support ARM v8.3a architecture", |
| 1758 | 1758 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1764,7 +1764,7 @@ pub const all_features = blk: { |
| 1764 | 1764 | .v8_2a, |
| 1765 | 1765 | }), |
| 1766 | 1766 | }; |
| 1767 | result[@intFromEnum(Feature.v8_4a)] = .{ | |
| 1767 | result[@backingInt(Feature.v8_4a)] = .{ | |
| 1768 | 1768 | .llvm_name = "v8.4a", |
| 1769 | 1769 | .description = "Support ARM v8.4a architecture", |
| 1770 | 1770 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1782,7 +1782,7 @@ pub const all_features = blk: { |
| 1782 | 1782 | .v8_3a, |
| 1783 | 1783 | }), |
| 1784 | 1784 | }; |
| 1785 | result[@intFromEnum(Feature.v8_5a)] = .{ | |
| 1785 | result[@backingInt(Feature.v8_5a)] = .{ | |
| 1786 | 1786 | .llvm_name = "v8.5a", |
| 1787 | 1787 | .description = "Support ARM v8.5a architecture", |
| 1788 | 1788 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1797,7 +1797,7 @@ pub const all_features = blk: { |
| 1797 | 1797 | .v8_4a, |
| 1798 | 1798 | }), |
| 1799 | 1799 | }; |
| 1800 | result[@intFromEnum(Feature.v8_6a)] = .{ | |
| 1800 | result[@backingInt(Feature.v8_6a)] = .{ | |
| 1801 | 1801 | .llvm_name = "v8.6a", |
| 1802 | 1802 | .description = "Support ARM v8.6a architecture", |
| 1803 | 1803 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1809,7 +1809,7 @@ pub const all_features = blk: { |
| 1809 | 1809 | .v8_5a, |
| 1810 | 1810 | }), |
| 1811 | 1811 | }; |
| 1812 | result[@intFromEnum(Feature.v8_7a)] = .{ | |
| 1812 | result[@backingInt(Feature.v8_7a)] = .{ | |
| 1813 | 1813 | .llvm_name = "v8.7a", |
| 1814 | 1814 | .description = "Support ARM v8.7a architecture", |
| 1815 | 1815 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1820,7 +1820,7 @@ pub const all_features = blk: { |
| 1820 | 1820 | .xs, |
| 1821 | 1821 | }), |
| 1822 | 1822 | }; |
| 1823 | result[@intFromEnum(Feature.v8_8a)] = .{ | |
| 1823 | result[@backingInt(Feature.v8_8a)] = .{ | |
| 1824 | 1824 | .llvm_name = "v8.8a", |
| 1825 | 1825 | .description = "Support ARM v8.8a architecture", |
| 1826 | 1826 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1830,7 +1830,7 @@ pub const all_features = blk: { |
| 1830 | 1830 | .v8_7a, |
| 1831 | 1831 | }), |
| 1832 | 1832 | }; |
| 1833 | result[@intFromEnum(Feature.v8_9a)] = .{ | |
| 1833 | result[@backingInt(Feature.v8_9a)] = .{ | |
| 1834 | 1834 | .llvm_name = "v8.9a", |
| 1835 | 1835 | .description = "Support ARM v8.9a architecture", |
| 1836 | 1836 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1843,7 +1843,7 @@ pub const all_features = blk: { |
| 1843 | 1843 | .v8_8a, |
| 1844 | 1844 | }), |
| 1845 | 1845 | }; |
| 1846 | result[@intFromEnum(Feature.v8a)] = .{ | |
| 1846 | result[@backingInt(Feature.v8a)] = .{ | |
| 1847 | 1847 | .llvm_name = "v8a", |
| 1848 | 1848 | .description = "Support ARM v8a architecture", |
| 1849 | 1849 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1852,7 +1852,7 @@ pub const all_features = blk: { |
| 1852 | 1852 | .neon, |
| 1853 | 1853 | }), |
| 1854 | 1854 | }; |
| 1855 | result[@intFromEnum(Feature.v8r)] = .{ | |
| 1855 | result[@backingInt(Feature.v8r)] = .{ | |
| 1856 | 1856 | .llvm_name = "v8r", |
| 1857 | 1857 | .description = "Support ARM v8r architecture", |
| 1858 | 1858 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1881,7 +1881,7 @@ pub const all_features = blk: { |
| 1881 | 1881 | .uaops, |
| 1882 | 1882 | }), |
| 1883 | 1883 | }; |
| 1884 | result[@intFromEnum(Feature.v9_1a)] = .{ | |
| 1884 | result[@backingInt(Feature.v9_1a)] = .{ | |
| 1885 | 1885 | .llvm_name = "v9.1a", |
| 1886 | 1886 | .description = "Support ARM v9.1a architecture", |
| 1887 | 1887 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1890,7 +1890,7 @@ pub const all_features = blk: { |
| 1890 | 1890 | .v9a, |
| 1891 | 1891 | }), |
| 1892 | 1892 | }; |
| 1893 | result[@intFromEnum(Feature.v9_2a)] = .{ | |
| 1893 | result[@backingInt(Feature.v9_2a)] = .{ | |
| 1894 | 1894 | .llvm_name = "v9.2a", |
| 1895 | 1895 | .description = "Support ARM v9.2a architecture", |
| 1896 | 1896 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1899,7 +1899,7 @@ pub const all_features = blk: { |
| 1899 | 1899 | .v9_1a, |
| 1900 | 1900 | }), |
| 1901 | 1901 | }; |
| 1902 | result[@intFromEnum(Feature.v9_3a)] = .{ | |
| 1902 | result[@backingInt(Feature.v9_3a)] = .{ | |
| 1903 | 1903 | .llvm_name = "v9.3a", |
| 1904 | 1904 | .description = "Support ARM v9.3a architecture", |
| 1905 | 1905 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1907,7 +1907,7 @@ pub const all_features = blk: { |
| 1907 | 1907 | .v9_2a, |
| 1908 | 1908 | }), |
| 1909 | 1909 | }; |
| 1910 | result[@intFromEnum(Feature.v9_4a)] = .{ | |
| 1910 | result[@backingInt(Feature.v9_4a)] = .{ | |
| 1911 | 1911 | .llvm_name = "v9.4a", |
| 1912 | 1912 | .description = "Support ARM v9.4a architecture", |
| 1913 | 1913 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1916,7 +1916,7 @@ pub const all_features = blk: { |
| 1916 | 1916 | .v9_3a, |
| 1917 | 1917 | }), |
| 1918 | 1918 | }; |
| 1919 | result[@intFromEnum(Feature.v9_5a)] = .{ | |
| 1919 | result[@backingInt(Feature.v9_5a)] = .{ | |
| 1920 | 1920 | .llvm_name = "v9.5a", |
| 1921 | 1921 | .description = "Support ARM v9.5a architecture", |
| 1922 | 1922 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1926,7 +1926,7 @@ pub const all_features = blk: { |
| 1926 | 1926 | .v9_4a, |
| 1927 | 1927 | }), |
| 1928 | 1928 | }; |
| 1929 | result[@intFromEnum(Feature.v9_6a)] = .{ | |
| 1929 | result[@backingInt(Feature.v9_6a)] = .{ | |
| 1930 | 1930 | .llvm_name = "v9.6a", |
| 1931 | 1931 | .description = "Support ARM v9.6a architecture", |
| 1932 | 1932 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1936,7 +1936,7 @@ pub const all_features = blk: { |
| 1936 | 1936 | .v9_5a, |
| 1937 | 1937 | }), |
| 1938 | 1938 | }; |
| 1939 | result[@intFromEnum(Feature.v9_7a)] = .{ | |
| 1939 | result[@backingInt(Feature.v9_7a)] = .{ | |
| 1940 | 1940 | .llvm_name = "v9.7a", |
| 1941 | 1941 | .description = "Support ARM v9.7a architecture", |
| 1942 | 1942 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1946,7 +1946,7 @@ pub const all_features = blk: { |
| 1946 | 1946 | .v9_6a, |
| 1947 | 1947 | }), |
| 1948 | 1948 | }; |
| 1949 | result[@intFromEnum(Feature.v9a)] = .{ | |
| 1949 | result[@backingInt(Feature.v9a)] = .{ | |
| 1950 | 1950 | .llvm_name = "v9a", |
| 1951 | 1951 | .description = "Support ARM v9a architecture", |
| 1952 | 1952 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1954,64 +1954,64 @@ pub const all_features = blk: { |
| 1954 | 1954 | .v8_5a, |
| 1955 | 1955 | }), |
| 1956 | 1956 | }; |
| 1957 | result[@intFromEnum(Feature.vh)] = .{ | |
| 1957 | result[@backingInt(Feature.vh)] = .{ | |
| 1958 | 1958 | .llvm_name = "vh", |
| 1959 | 1959 | .description = "Enable Armv8.1-A Virtual Host extension", |
| 1960 | 1960 | .dependencies = featureSet(&[_]Feature{ |
| 1961 | 1961 | .contextidr_el2, |
| 1962 | 1962 | }), |
| 1963 | 1963 | }; |
| 1964 | result[@intFromEnum(Feature.wfxt)] = .{ | |
| 1964 | result[@backingInt(Feature.wfxt)] = .{ | |
| 1965 | 1965 | .llvm_name = "wfxt", |
| 1966 | 1966 | .description = "Enable Armv8.7-A WFET and WFIT instruction", |
| 1967 | 1967 | .dependencies = featureSet(&[_]Feature{}), |
| 1968 | 1968 | }; |
| 1969 | result[@intFromEnum(Feature.xs)] = .{ | |
| 1969 | result[@backingInt(Feature.xs)] = .{ | |
| 1970 | 1970 | .llvm_name = "xs", |
| 1971 | 1971 | .description = "Enable Armv8.7-A limited-TLB-maintenance instruction", |
| 1972 | 1972 | .dependencies = featureSet(&[_]Feature{}), |
| 1973 | 1973 | }; |
| 1974 | result[@intFromEnum(Feature.zcm_fpr128)] = .{ | |
| 1974 | result[@backingInt(Feature.zcm_fpr128)] = .{ | |
| 1975 | 1975 | .llvm_name = "zcm-fpr128", |
| 1976 | 1976 | .description = "Has zero-cycle register moves for FPR128 registers", |
| 1977 | 1977 | .dependencies = featureSet(&[_]Feature{}), |
| 1978 | 1978 | }; |
| 1979 | result[@intFromEnum(Feature.zcm_fpr32)] = .{ | |
| 1979 | result[@backingInt(Feature.zcm_fpr32)] = .{ | |
| 1980 | 1980 | .llvm_name = "zcm-fpr32", |
| 1981 | 1981 | .description = "Has zero-cycle register moves for FPR32 registers", |
| 1982 | 1982 | .dependencies = featureSet(&[_]Feature{}), |
| 1983 | 1983 | }; |
| 1984 | result[@intFromEnum(Feature.zcm_fpr64)] = .{ | |
| 1984 | result[@backingInt(Feature.zcm_fpr64)] = .{ | |
| 1985 | 1985 | .llvm_name = "zcm-fpr64", |
| 1986 | 1986 | .description = "Has zero-cycle register moves for FPR64 registers", |
| 1987 | 1987 | .dependencies = featureSet(&[_]Feature{}), |
| 1988 | 1988 | }; |
| 1989 | result[@intFromEnum(Feature.zcm_gpr32)] = .{ | |
| 1989 | result[@backingInt(Feature.zcm_gpr32)] = .{ | |
| 1990 | 1990 | .llvm_name = "zcm-gpr32", |
| 1991 | 1991 | .description = "Has zero-cycle register moves for GPR32 registers", |
| 1992 | 1992 | .dependencies = featureSet(&[_]Feature{}), |
| 1993 | 1993 | }; |
| 1994 | result[@intFromEnum(Feature.zcm_gpr64)] = .{ | |
| 1994 | result[@backingInt(Feature.zcm_gpr64)] = .{ | |
| 1995 | 1995 | .llvm_name = "zcm-gpr64", |
| 1996 | 1996 | .description = "Has zero-cycle register moves for GPR64 registers", |
| 1997 | 1997 | .dependencies = featureSet(&[_]Feature{}), |
| 1998 | 1998 | }; |
| 1999 | result[@intFromEnum(Feature.zcz_fp_workaround)] = .{ | |
| 1999 | result[@backingInt(Feature.zcz_fp_workaround)] = .{ | |
| 2000 | 2000 | .llvm_name = "zcz-fp-workaround", |
| 2001 | 2001 | .description = "The zero-cycle floating-point zeroing instruction has a bug", |
| 2002 | 2002 | .dependencies = featureSet(&[_]Feature{}), |
| 2003 | 2003 | }; |
| 2004 | result[@intFromEnum(Feature.zcz_fpr128)] = .{ | |
| 2004 | result[@backingInt(Feature.zcz_fpr128)] = .{ | |
| 2005 | 2005 | .llvm_name = "zcz-fpr128", |
| 2006 | 2006 | .description = "Has zero-cycle zeroing instructions for FPR128 registers", |
| 2007 | 2007 | .dependencies = featureSet(&[_]Feature{}), |
| 2008 | 2008 | }; |
| 2009 | result[@intFromEnum(Feature.zcz_gpr32)] = .{ | |
| 2009 | result[@backingInt(Feature.zcz_gpr32)] = .{ | |
| 2010 | 2010 | .llvm_name = "zcz-gpr32", |
| 2011 | 2011 | .description = "Has zero-cycle zeroing instructions for GPR32 registers", |
| 2012 | 2012 | .dependencies = featureSet(&[_]Feature{}), |
| 2013 | 2013 | }; |
| 2014 | result[@intFromEnum(Feature.zcz_gpr64)] = .{ | |
| 2014 | result[@backingInt(Feature.zcz_gpr64)] = .{ | |
| 2015 | 2015 | .llvm_name = "zcz-gpr64", |
| 2016 | 2016 | .description = "Has zero-cycle zeroing instructions for GPR64 registers", |
| 2017 | 2017 | .dependencies = featureSet(&[_]Feature{}), |
lib/std/Target/alpha.zig+4-4| ... | ... | @@ -20,22 +20,22 @@ pub const all_features = blk: { |
| 20 | 20 | const len = @typeInfo(Feature).@"enum".field_names.len; |
| 21 | 21 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); |
| 22 | 22 | var result: [len]CpuFeature = undefined; |
| 23 | result[@intFromEnum(Feature.bwx)] = .{ | |
| 23 | result[@backingInt(Feature.bwx)] = .{ | |
| 24 | 24 | .llvm_name = null, |
| 25 | 25 | .description = "Enable byte/word extensions", |
| 26 | 26 | .dependencies = featureSet(&[_]Feature{}), |
| 27 | 27 | }; |
| 28 | result[@intFromEnum(Feature.cix)] = .{ | |
| 28 | result[@backingInt(Feature.cix)] = .{ | |
| 29 | 29 | .llvm_name = null, |
| 30 | 30 | .description = "Enable counting extensions", |
| 31 | 31 | .dependencies = featureSet(&[_]Feature{}), |
| 32 | 32 | }; |
| 33 | result[@intFromEnum(Feature.fix)] = .{ | |
| 33 | result[@backingInt(Feature.fix)] = .{ | |
| 34 | 34 | .llvm_name = null, |
| 35 | 35 | .description = "Enable floating point move and square root extensions", |
| 36 | 36 | .dependencies = featureSet(&[_]Feature{}), |
| 37 | 37 | }; |
| 38 | result[@intFromEnum(Feature.max)] = .{ | |
| 38 | result[@backingInt(Feature.max)] = .{ | |
| 39 | 39 | .llvm_name = null, |
| 40 | 40 | .description = "Enable motion video extensions", |
| 41 | 41 | .dependencies = featureSet(&[_]Feature{}), |
lib/std/Target/amdgcn.zig+254-254| ... | ... | @@ -271,556 +271,556 @@ pub const all_features = blk: { |
| 271 | 271 | const len = @typeInfo(Feature).@"enum".field_names.len; |
| 272 | 272 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); |
| 273 | 273 | var result: [len]CpuFeature = undefined; |
| 274 | result[@intFromEnum(Feature.@"1024_addressable_vgprs")] = .{ | |
| 274 | result[@backingInt(Feature.@"1024_addressable_vgprs")] = .{ | |
| 275 | 275 | .llvm_name = "1024-addressable-vgprs", |
| 276 | 276 | .description = "Has 1024 addressable VGPRs", |
| 277 | 277 | .dependencies = featureSet(&[_]Feature{}), |
| 278 | 278 | }; |
| 279 | result[@intFromEnum(Feature.@"16_bit_insts")] = .{ | |
| 279 | result[@backingInt(Feature.@"16_bit_insts")] = .{ | |
| 280 | 280 | .llvm_name = "16-bit-insts", |
| 281 | 281 | .description = "Has i16/f16 instructions", |
| 282 | 282 | .dependencies = featureSet(&[_]Feature{}), |
| 283 | 283 | }; |
| 284 | result[@intFromEnum(Feature.@"45_bit_num_records_buffer_resource")] = .{ | |
| 284 | result[@backingInt(Feature.@"45_bit_num_records_buffer_resource")] = .{ | |
| 285 | 285 | .llvm_name = "45-bit-num-records-buffer-resource", |
| 286 | 286 | .description = "The buffer resource (V#) supports 45-bit num_records", |
| 287 | 287 | .dependencies = featureSet(&[_]Feature{}), |
| 288 | 288 | }; |
| 289 | result[@intFromEnum(Feature.@"64_bit_literals")] = .{ | |
| 289 | result[@backingInt(Feature.@"64_bit_literals")] = .{ | |
| 290 | 290 | .llvm_name = "64-bit-literals", |
| 291 | 291 | .description = "Can use 64-bit literals with single DWORD instructions", |
| 292 | 292 | .dependencies = featureSet(&[_]Feature{}), |
| 293 | 293 | }; |
| 294 | result[@intFromEnum(Feature.a16)] = .{ | |
| 294 | result[@backingInt(Feature.a16)] = .{ | |
| 295 | 295 | .llvm_name = "a16", |
| 296 | 296 | .description = "Support A16 for 16-bit coordinates/gradients/lod/clamp/mip image operands", |
| 297 | 297 | .dependencies = featureSet(&[_]Feature{}), |
| 298 | 298 | }; |
| 299 | result[@intFromEnum(Feature.add_min_max_insts)] = .{ | |
| 299 | result[@backingInt(Feature.add_min_max_insts)] = .{ | |
| 300 | 300 | .llvm_name = "add-min-max-insts", |
| 301 | 301 | .description = "Has v_add_{min|max}_{i|u}32 instructions", |
| 302 | 302 | .dependencies = featureSet(&[_]Feature{}), |
| 303 | 303 | }; |
| 304 | result[@intFromEnum(Feature.add_no_carry_insts)] = .{ | |
| 304 | result[@backingInt(Feature.add_no_carry_insts)] = .{ | |
| 305 | 305 | .llvm_name = "add-no-carry-insts", |
| 306 | 306 | .description = "Have VALU add/sub instructions without carry out", |
| 307 | 307 | .dependencies = featureSet(&[_]Feature{}), |
| 308 | 308 | }; |
| 309 | result[@intFromEnum(Feature.add_sub_u64_insts)] = .{ | |
| 309 | result[@backingInt(Feature.add_sub_u64_insts)] = .{ | |
| 310 | 310 | .llvm_name = "add-sub-u64-insts", |
| 311 | 311 | .description = "Has v_add_u64 and v_sub_u64 instructions", |
| 312 | 312 | .dependencies = featureSet(&[_]Feature{}), |
| 313 | 313 | }; |
| 314 | result[@intFromEnum(Feature.addressablelocalmemorysize163840)] = .{ | |
| 314 | result[@backingInt(Feature.addressablelocalmemorysize163840)] = .{ | |
| 315 | 315 | .llvm_name = "addressablelocalmemorysize163840", |
| 316 | 316 | .description = "The size of local memory in bytes", |
| 317 | 317 | .dependencies = featureSet(&[_]Feature{}), |
| 318 | 318 | }; |
| 319 | result[@intFromEnum(Feature.addressablelocalmemorysize32768)] = .{ | |
| 319 | result[@backingInt(Feature.addressablelocalmemorysize32768)] = .{ | |
| 320 | 320 | .llvm_name = "addressablelocalmemorysize32768", |
| 321 | 321 | .description = "The size of local memory in bytes", |
| 322 | 322 | .dependencies = featureSet(&[_]Feature{}), |
| 323 | 323 | }; |
| 324 | result[@intFromEnum(Feature.addressablelocalmemorysize327680)] = .{ | |
| 324 | result[@backingInt(Feature.addressablelocalmemorysize327680)] = .{ | |
| 325 | 325 | .llvm_name = "addressablelocalmemorysize327680", |
| 326 | 326 | .description = "The size of local memory in bytes", |
| 327 | 327 | .dependencies = featureSet(&[_]Feature{}), |
| 328 | 328 | }; |
| 329 | result[@intFromEnum(Feature.addressablelocalmemorysize65536)] = .{ | |
| 329 | result[@backingInt(Feature.addressablelocalmemorysize65536)] = .{ | |
| 330 | 330 | .llvm_name = "addressablelocalmemorysize65536", |
| 331 | 331 | .description = "The size of local memory in bytes", |
| 332 | 332 | .dependencies = featureSet(&[_]Feature{}), |
| 333 | 333 | }; |
| 334 | result[@intFromEnum(Feature.agent_scope_fine_grained_remote_memory_atomics)] = .{ | |
| 334 | result[@backingInt(Feature.agent_scope_fine_grained_remote_memory_atomics)] = .{ | |
| 335 | 335 | .llvm_name = "agent-scope-fine-grained-remote-memory-atomics", |
| 336 | 336 | .description = "Agent (device) scoped atomic operations, excluding those directly supported by PCIe (i.e. integer atomic add, exchange, and compare-and-swap), are functional for allocations in host or peer device memory.", |
| 337 | 337 | .dependencies = featureSet(&[_]Feature{}), |
| 338 | 338 | }; |
| 339 | result[@intFromEnum(Feature.allocate1_5xvgprs)] = .{ | |
| 339 | result[@backingInt(Feature.allocate1_5xvgprs)] = .{ | |
| 340 | 340 | .llvm_name = "allocate1_5xvgprs", |
| 341 | 341 | .description = "Has 50% more physical VGPRs and 50% larger allocation granule", |
| 342 | 342 | .dependencies = featureSet(&[_]Feature{}), |
| 343 | 343 | }; |
| 344 | result[@intFromEnum(Feature.aperture_regs)] = .{ | |
| 344 | result[@backingInt(Feature.aperture_regs)] = .{ | |
| 345 | 345 | .llvm_name = "aperture-regs", |
| 346 | 346 | .description = "Has Memory Aperture Base and Size Registers", |
| 347 | 347 | .dependencies = featureSet(&[_]Feature{}), |
| 348 | 348 | }; |
| 349 | result[@intFromEnum(Feature.architected_flat_scratch)] = .{ | |
| 349 | result[@backingInt(Feature.architected_flat_scratch)] = .{ | |
| 350 | 350 | .llvm_name = "architected-flat-scratch", |
| 351 | 351 | .description = "Flat Scratch register is a readonly SPI initialized architected register", |
| 352 | 352 | .dependencies = featureSet(&[_]Feature{}), |
| 353 | 353 | }; |
| 354 | result[@intFromEnum(Feature.architected_sgprs)] = .{ | |
| 354 | result[@backingInt(Feature.architected_sgprs)] = .{ | |
| 355 | 355 | .llvm_name = "architected-sgprs", |
| 356 | 356 | .description = "Enable the architected SGPRs", |
| 357 | 357 | .dependencies = featureSet(&[_]Feature{}), |
| 358 | 358 | }; |
| 359 | result[@intFromEnum(Feature.ashr_pk_insts)] = .{ | |
| 359 | result[@backingInt(Feature.ashr_pk_insts)] = .{ | |
| 360 | 360 | .llvm_name = "ashr-pk-insts", |
| 361 | 361 | .description = "Has Arithmetic Shift Pack instructions", |
| 362 | 362 | .dependencies = featureSet(&[_]Feature{}), |
| 363 | 363 | }; |
| 364 | result[@intFromEnum(Feature.assembler_permissive_wavesize)] = .{ | |
| 364 | result[@backingInt(Feature.assembler_permissive_wavesize)] = .{ | |
| 365 | 365 | .llvm_name = "assembler-permissive-wavesize", |
| 366 | 366 | .description = "allow parsing wave32 and wave64 variants of instructions", |
| 367 | 367 | .dependencies = featureSet(&[_]Feature{}), |
| 368 | 368 | }; |
| 369 | result[@intFromEnum(Feature.atomic_buffer_global_pk_add_f16_insts)] = .{ | |
| 369 | result[@backingInt(Feature.atomic_buffer_global_pk_add_f16_insts)] = .{ | |
| 370 | 370 | .llvm_name = "atomic-buffer-global-pk-add-f16-insts", |
| 371 | 371 | .description = "Has buffer_atomic_pk_add_f16 and global_atomic_pk_add_f16 instructions that can return original value", |
| 372 | 372 | .dependencies = featureSet(&[_]Feature{ |
| 373 | 373 | .flat_global_insts, |
| 374 | 374 | }), |
| 375 | 375 | }; |
| 376 | result[@intFromEnum(Feature.atomic_buffer_global_pk_add_f16_no_rtn_insts)] = .{ | |
| 376 | result[@backingInt(Feature.atomic_buffer_global_pk_add_f16_no_rtn_insts)] = .{ | |
| 377 | 377 | .llvm_name = "atomic-buffer-global-pk-add-f16-no-rtn-insts", |
| 378 | 378 | .description = "Has buffer_atomic_pk_add_f16 and global_atomic_pk_add_f16 instructions that don't return original value", |
| 379 | 379 | .dependencies = featureSet(&[_]Feature{ |
| 380 | 380 | .flat_global_insts, |
| 381 | 381 | }), |
| 382 | 382 | }; |
| 383 | result[@intFromEnum(Feature.atomic_buffer_pk_add_bf16_inst)] = .{ | |
| 383 | result[@backingInt(Feature.atomic_buffer_pk_add_bf16_inst)] = .{ | |
| 384 | 384 | .llvm_name = "atomic-buffer-pk-add-bf16-inst", |
| 385 | 385 | .description = "Has buffer_atomic_pk_add_bf16 instruction", |
| 386 | 386 | .dependencies = featureSet(&[_]Feature{}), |
| 387 | 387 | }; |
| 388 | result[@intFromEnum(Feature.atomic_csub_no_rtn_insts)] = .{ | |
| 388 | result[@backingInt(Feature.atomic_csub_no_rtn_insts)] = .{ | |
| 389 | 389 | .llvm_name = "atomic-csub-no-rtn-insts", |
| 390 | 390 | .description = "Has buffer_atomic_csub and global_atomic_csub instructions that don't return original value", |
| 391 | 391 | .dependencies = featureSet(&[_]Feature{}), |
| 392 | 392 | }; |
| 393 | result[@intFromEnum(Feature.atomic_ds_pk_add_16_insts)] = .{ | |
| 393 | result[@backingInt(Feature.atomic_ds_pk_add_16_insts)] = .{ | |
| 394 | 394 | .llvm_name = "atomic-ds-pk-add-16-insts", |
| 395 | 395 | .description = "Has ds_pk_add_bf16, ds_pk_add_f16, ds_pk_add_rtn_bf16, ds_pk_add_rtn_f16 instructions", |
| 396 | 396 | .dependencies = featureSet(&[_]Feature{}), |
| 397 | 397 | }; |
| 398 | result[@intFromEnum(Feature.atomic_fadd_no_rtn_insts)] = .{ | |
| 398 | result[@backingInt(Feature.atomic_fadd_no_rtn_insts)] = .{ | |
| 399 | 399 | .llvm_name = "atomic-fadd-no-rtn-insts", |
| 400 | 400 | .description = "Has buffer_atomic_add_f32 and global_atomic_add_f32 instructions that don't return original value", |
| 401 | 401 | .dependencies = featureSet(&[_]Feature{ |
| 402 | 402 | .flat_global_insts, |
| 403 | 403 | }), |
| 404 | 404 | }; |
| 405 | result[@intFromEnum(Feature.atomic_fadd_rtn_insts)] = .{ | |
| 405 | result[@backingInt(Feature.atomic_fadd_rtn_insts)] = .{ | |
| 406 | 406 | .llvm_name = "atomic-fadd-rtn-insts", |
| 407 | 407 | .description = "Has buffer_atomic_add_f32 and global_atomic_add_f32 instructions that return original value", |
| 408 | 408 | .dependencies = featureSet(&[_]Feature{ |
| 409 | 409 | .flat_global_insts, |
| 410 | 410 | }), |
| 411 | 411 | }; |
| 412 | result[@intFromEnum(Feature.atomic_flat_pk_add_16_insts)] = .{ | |
| 412 | result[@backingInt(Feature.atomic_flat_pk_add_16_insts)] = .{ | |
| 413 | 413 | .llvm_name = "atomic-flat-pk-add-16-insts", |
| 414 | 414 | .description = "Has flat_atomic_pk_add_f16 and flat_atomic_pk_add_bf16 instructions", |
| 415 | 415 | .dependencies = featureSet(&[_]Feature{}), |
| 416 | 416 | }; |
| 417 | result[@intFromEnum(Feature.atomic_fmin_fmax_flat_f32)] = .{ | |
| 417 | result[@backingInt(Feature.atomic_fmin_fmax_flat_f32)] = .{ | |
| 418 | 418 | .llvm_name = "atomic-fmin-fmax-flat-f32", |
| 419 | 419 | .description = "Has flat memory instructions for atomicrmw fmin/fmax for float", |
| 420 | 420 | .dependencies = featureSet(&[_]Feature{ |
| 421 | 421 | .flat_address_space, |
| 422 | 422 | }), |
| 423 | 423 | }; |
| 424 | result[@intFromEnum(Feature.atomic_fmin_fmax_flat_f64)] = .{ | |
| 424 | result[@backingInt(Feature.atomic_fmin_fmax_flat_f64)] = .{ | |
| 425 | 425 | .llvm_name = "atomic-fmin-fmax-flat-f64", |
| 426 | 426 | .description = "Has flat memory instructions for atomicrmw fmin/fmax for double", |
| 427 | 427 | .dependencies = featureSet(&[_]Feature{ |
| 428 | 428 | .flat_address_space, |
| 429 | 429 | }), |
| 430 | 430 | }; |
| 431 | result[@intFromEnum(Feature.atomic_fmin_fmax_global_f32)] = .{ | |
| 431 | result[@backingInt(Feature.atomic_fmin_fmax_global_f32)] = .{ | |
| 432 | 432 | .llvm_name = "atomic-fmin-fmax-global-f32", |
| 433 | 433 | .description = "Has global/buffer instructions for atomicrmw fmin/fmax for float", |
| 434 | 434 | .dependencies = featureSet(&[_]Feature{}), |
| 435 | 435 | }; |
| 436 | result[@intFromEnum(Feature.atomic_fmin_fmax_global_f64)] = .{ | |
| 436 | result[@backingInt(Feature.atomic_fmin_fmax_global_f64)] = .{ | |
| 437 | 437 | .llvm_name = "atomic-fmin-fmax-global-f64", |
| 438 | 438 | .description = "Has global/buffer instructions for atomicrmw fmin/fmax for float", |
| 439 | 439 | .dependencies = featureSet(&[_]Feature{}), |
| 440 | 440 | }; |
| 441 | result[@intFromEnum(Feature.atomic_global_pk_add_bf16_inst)] = .{ | |
| 441 | result[@backingInt(Feature.atomic_global_pk_add_bf16_inst)] = .{ | |
| 442 | 442 | .llvm_name = "atomic-global-pk-add-bf16-inst", |
| 443 | 443 | .description = "Has global_atomic_pk_add_bf16 instruction", |
| 444 | 444 | .dependencies = featureSet(&[_]Feature{ |
| 445 | 445 | .flat_global_insts, |
| 446 | 446 | }), |
| 447 | 447 | }; |
| 448 | result[@intFromEnum(Feature.auto_waitcnt_before_barrier)] = .{ | |
| 448 | result[@backingInt(Feature.auto_waitcnt_before_barrier)] = .{ | |
| 449 | 449 | .llvm_name = "auto-waitcnt-before-barrier", |
| 450 | 450 | .description = "Hardware automatically inserts waitcnt before barrier", |
| 451 | 451 | .dependencies = featureSet(&[_]Feature{}), |
| 452 | 452 | }; |
| 453 | result[@intFromEnum(Feature.back_off_barrier)] = .{ | |
| 453 | result[@backingInt(Feature.back_off_barrier)] = .{ | |
| 454 | 454 | .llvm_name = "back-off-barrier", |
| 455 | 455 | .description = "Hardware supports backing off s_barrier if an exception occurs", |
| 456 | 456 | .dependencies = featureSet(&[_]Feature{}), |
| 457 | 457 | }; |
| 458 | result[@intFromEnum(Feature.bf16_cvt_insts)] = .{ | |
| 458 | result[@backingInt(Feature.bf16_cvt_insts)] = .{ | |
| 459 | 459 | .llvm_name = "bf16-cvt-insts", |
| 460 | 460 | .description = "Has bf16 conversion instructions", |
| 461 | 461 | .dependencies = featureSet(&[_]Feature{}), |
| 462 | 462 | }; |
| 463 | result[@intFromEnum(Feature.bf16_pk_insts)] = .{ | |
| 463 | result[@backingInt(Feature.bf16_pk_insts)] = .{ | |
| 464 | 464 | .llvm_name = "bf16-pk-insts", |
| 465 | 465 | .description = "Has bf16 packed instructions (fma, add, mul, max, min)", |
| 466 | 466 | .dependencies = featureSet(&[_]Feature{}), |
| 467 | 467 | }; |
| 468 | result[@intFromEnum(Feature.bf16_trans_insts)] = .{ | |
| 468 | result[@backingInt(Feature.bf16_trans_insts)] = .{ | |
| 469 | 469 | .llvm_name = "bf16-trans-insts", |
| 470 | 470 | .description = "Has bf16 transcendental instructions", |
| 471 | 471 | .dependencies = featureSet(&[_]Feature{}), |
| 472 | 472 | }; |
| 473 | result[@intFromEnum(Feature.bf8_cvt_scale_insts)] = .{ | |
| 473 | result[@backingInt(Feature.bf8_cvt_scale_insts)] = .{ | |
| 474 | 474 | .llvm_name = "bf8-cvt-scale-insts", |
| 475 | 475 | .description = "Has bf8 conversion scale instructions", |
| 476 | 476 | .dependencies = featureSet(&[_]Feature{}), |
| 477 | 477 | }; |
| 478 | result[@intFromEnum(Feature.bitop3_insts)] = .{ | |
| 478 | result[@backingInt(Feature.bitop3_insts)] = .{ | |
| 479 | 479 | .llvm_name = "bitop3-insts", |
| 480 | 480 | .description = "Has v_bitop3_b32/v_bitop3_b16 instructions", |
| 481 | 481 | .dependencies = featureSet(&[_]Feature{}), |
| 482 | 482 | }; |
| 483 | result[@intFromEnum(Feature.block_vgpr_csr)] = .{ | |
| 483 | result[@backingInt(Feature.block_vgpr_csr)] = .{ | |
| 484 | 484 | .llvm_name = "block-vgpr-csr", |
| 485 | 485 | .description = "Use block load/store for VGPR callee saved registers", |
| 486 | 486 | .dependencies = featureSet(&[_]Feature{}), |
| 487 | 487 | }; |
| 488 | result[@intFromEnum(Feature.bvh_dual_bvh_8_insts)] = .{ | |
| 488 | result[@backingInt(Feature.bvh_dual_bvh_8_insts)] = .{ | |
| 489 | 489 | .llvm_name = "bvh-dual-bvh-8-insts", |
| 490 | 490 | .description = "Has image_bvh_dual_intersect_ray and image_bvh8_intersect_ray instructions", |
| 491 | 491 | .dependencies = featureSet(&[_]Feature{}), |
| 492 | 492 | }; |
| 493 | result[@intFromEnum(Feature.ci_insts)] = .{ | |
| 493 | result[@backingInt(Feature.ci_insts)] = .{ | |
| 494 | 494 | .llvm_name = "ci-insts", |
| 495 | 495 | .description = "Additional instructions for CI+", |
| 496 | 496 | .dependencies = featureSet(&[_]Feature{}), |
| 497 | 497 | }; |
| 498 | result[@intFromEnum(Feature.clusters)] = .{ | |
| 498 | result[@backingInt(Feature.clusters)] = .{ | |
| 499 | 499 | .llvm_name = "clusters", |
| 500 | 500 | .description = "Has clusters of workgroups support", |
| 501 | 501 | .dependencies = featureSet(&[_]Feature{}), |
| 502 | 502 | }; |
| 503 | result[@intFromEnum(Feature.cube_insts)] = .{ | |
| 503 | result[@backingInt(Feature.cube_insts)] = .{ | |
| 504 | 504 | .llvm_name = "cube-insts", |
| 505 | 505 | .description = "Has v_cube* instructions", |
| 506 | 506 | .dependencies = featureSet(&[_]Feature{}), |
| 507 | 507 | }; |
| 508 | result[@intFromEnum(Feature.cumode)] = .{ | |
| 508 | result[@backingInt(Feature.cumode)] = .{ | |
| 509 | 509 | .llvm_name = "cumode", |
| 510 | 510 | .description = "Enable CU wavefront execution mode", |
| 511 | 511 | .dependencies = featureSet(&[_]Feature{}), |
| 512 | 512 | }; |
| 513 | result[@intFromEnum(Feature.cvt_fp8_vop1_bug)] = .{ | |
| 513 | result[@backingInt(Feature.cvt_fp8_vop1_bug)] = .{ | |
| 514 | 514 | .llvm_name = "cvt-fp8-vop1-bug", |
| 515 | 515 | .description = "FP8/BF8 VOP1 form of conversion to F32 is unreliable", |
| 516 | 516 | .dependencies = featureSet(&[_]Feature{ |
| 517 | 517 | .fp8_conversion_insts, |
| 518 | 518 | }), |
| 519 | 519 | }; |
| 520 | result[@intFromEnum(Feature.cvt_norm_insts)] = .{ | |
| 520 | result[@backingInt(Feature.cvt_norm_insts)] = .{ | |
| 521 | 521 | .llvm_name = "cvt-norm-insts", |
| 522 | 522 | .description = "Has v_cvt_norm* instructions", |
| 523 | 523 | .dependencies = featureSet(&[_]Feature{}), |
| 524 | 524 | }; |
| 525 | result[@intFromEnum(Feature.cvt_pk_f16_f32_inst)] = .{ | |
| 525 | result[@backingInt(Feature.cvt_pk_f16_f32_inst)] = .{ | |
| 526 | 526 | .llvm_name = "cvt-pk-f16-f32-inst", |
| 527 | 527 | .description = "Has cvt_pk_f16_f32 instruction", |
| 528 | 528 | .dependencies = featureSet(&[_]Feature{}), |
| 529 | 529 | }; |
| 530 | result[@intFromEnum(Feature.cvt_pknorm_vop2_insts)] = .{ | |
| 530 | result[@backingInt(Feature.cvt_pknorm_vop2_insts)] = .{ | |
| 531 | 531 | .llvm_name = "cvt-pknorm-vop2-insts", |
| 532 | 532 | .description = "Has v_cvt_pk_norm_*f32 instructions/Has v_cvt_pk_norm_*_f16 instructions", |
| 533 | 533 | .dependencies = featureSet(&[_]Feature{}), |
| 534 | 534 | }; |
| 535 | result[@intFromEnum(Feature.cvt_pknorm_vop3_insts)] = .{ | |
| 535 | result[@backingInt(Feature.cvt_pknorm_vop3_insts)] = .{ | |
| 536 | 536 | .llvm_name = "cvt-pknorm-vop3-insts", |
| 537 | 537 | .description = "Has v_cvt_pk_norm_*f32 instructions/Has v_cvt_pk_norm_*_f16 instructions", |
| 538 | 538 | .dependencies = featureSet(&[_]Feature{}), |
| 539 | 539 | }; |
| 540 | result[@intFromEnum(Feature.d16_write_vgpr32)] = .{ | |
| 540 | result[@backingInt(Feature.d16_write_vgpr32)] = .{ | |
| 541 | 541 | .llvm_name = "d16-write-vgpr32", |
| 542 | 542 | .description = "D16 instructions potentially have 32-bit data dependencies", |
| 543 | 543 | .dependencies = featureSet(&[_]Feature{}), |
| 544 | 544 | }; |
| 545 | result[@intFromEnum(Feature.default_component_broadcast)] = .{ | |
| 545 | result[@backingInt(Feature.default_component_broadcast)] = .{ | |
| 546 | 546 | .llvm_name = "default-component-broadcast", |
| 547 | 547 | .description = "BUFFER/IMAGE store instructions set unspecified components to x component (GFX12)", |
| 548 | 548 | .dependencies = featureSet(&[_]Feature{}), |
| 549 | 549 | }; |
| 550 | result[@intFromEnum(Feature.default_component_zero)] = .{ | |
| 550 | result[@backingInt(Feature.default_component_zero)] = .{ | |
| 551 | 551 | .llvm_name = "default-component-zero", |
| 552 | 552 | .description = "BUFFER/IMAGE store instructions set unspecified components to zero (before GFX12)", |
| 553 | 553 | .dependencies = featureSet(&[_]Feature{}), |
| 554 | 554 | }; |
| 555 | result[@intFromEnum(Feature.dl_insts)] = .{ | |
| 555 | result[@backingInt(Feature.dl_insts)] = .{ | |
| 556 | 556 | .llvm_name = "dl-insts", |
| 557 | 557 | .description = "Has v_fmac_f32 and v_xnor_b32 instructions", |
| 558 | 558 | .dependencies = featureSet(&[_]Feature{}), |
| 559 | 559 | }; |
| 560 | result[@intFromEnum(Feature.dot10_insts)] = .{ | |
| 560 | result[@backingInt(Feature.dot10_insts)] = .{ | |
| 561 | 561 | .llvm_name = "dot10-insts", |
| 562 | 562 | .description = "Has v_dot2_f32_f16 instruction", |
| 563 | 563 | .dependencies = featureSet(&[_]Feature{}), |
| 564 | 564 | }; |
| 565 | result[@intFromEnum(Feature.dot11_insts)] = .{ | |
| 565 | result[@backingInt(Feature.dot11_insts)] = .{ | |
| 566 | 566 | .llvm_name = "dot11-insts", |
| 567 | 567 | .description = "Has v_dot4_f32_fp8_fp8, v_dot4_f32_fp8_bf8, v_dot4_f32_bf8_fp8, v_dot4_f32_bf8_bf8 instructions", |
| 568 | 568 | .dependencies = featureSet(&[_]Feature{}), |
| 569 | 569 | }; |
| 570 | result[@intFromEnum(Feature.dot12_insts)] = .{ | |
| 570 | result[@backingInt(Feature.dot12_insts)] = .{ | |
| 571 | 571 | .llvm_name = "dot12-insts", |
| 572 | 572 | .description = "Has v_dot2_f32_bf16 instructions", |
| 573 | 573 | .dependencies = featureSet(&[_]Feature{}), |
| 574 | 574 | }; |
| 575 | result[@intFromEnum(Feature.dot13_insts)] = .{ | |
| 575 | result[@backingInt(Feature.dot13_insts)] = .{ | |
| 576 | 576 | .llvm_name = "dot13-insts", |
| 577 | 577 | .description = "Has v_dot2c_f32_bf16 instructions", |
| 578 | 578 | .dependencies = featureSet(&[_]Feature{}), |
| 579 | 579 | }; |
| 580 | result[@intFromEnum(Feature.dot1_insts)] = .{ | |
| 580 | result[@backingInt(Feature.dot1_insts)] = .{ | |
| 581 | 581 | .llvm_name = "dot1-insts", |
| 582 | 582 | .description = "Has v_dot4_i32_i8 and v_dot8_i32_i4 instructions", |
| 583 | 583 | .dependencies = featureSet(&[_]Feature{}), |
| 584 | 584 | }; |
| 585 | result[@intFromEnum(Feature.dot2_insts)] = .{ | |
| 585 | result[@backingInt(Feature.dot2_insts)] = .{ | |
| 586 | 586 | .llvm_name = "dot2-insts", |
| 587 | 587 | .description = "Has v_dot2_i32_i16, v_dot2_u32_u16 instructions", |
| 588 | 588 | .dependencies = featureSet(&[_]Feature{}), |
| 589 | 589 | }; |
| 590 | result[@intFromEnum(Feature.dot3_insts)] = .{ | |
| 590 | result[@backingInt(Feature.dot3_insts)] = .{ | |
| 591 | 591 | .llvm_name = "dot3-insts", |
| 592 | 592 | .description = "Has v_dot8c_i32_i4 instruction", |
| 593 | 593 | .dependencies = featureSet(&[_]Feature{}), |
| 594 | 594 | }; |
| 595 | result[@intFromEnum(Feature.dot4_insts)] = .{ | |
| 595 | result[@backingInt(Feature.dot4_insts)] = .{ | |
| 596 | 596 | .llvm_name = "dot4-insts", |
| 597 | 597 | .description = "Has v_dot2c_i32_i16 instruction", |
| 598 | 598 | .dependencies = featureSet(&[_]Feature{}), |
| 599 | 599 | }; |
| 600 | result[@intFromEnum(Feature.dot5_insts)] = .{ | |
| 600 | result[@backingInt(Feature.dot5_insts)] = .{ | |
| 601 | 601 | .llvm_name = "dot5-insts", |
| 602 | 602 | .description = "Has v_dot2c_f32_f16 instruction", |
| 603 | 603 | .dependencies = featureSet(&[_]Feature{}), |
| 604 | 604 | }; |
| 605 | result[@intFromEnum(Feature.dot6_insts)] = .{ | |
| 605 | result[@backingInt(Feature.dot6_insts)] = .{ | |
| 606 | 606 | .llvm_name = "dot6-insts", |
| 607 | 607 | .description = "Has v_dot4c_i32_i8 instruction", |
| 608 | 608 | .dependencies = featureSet(&[_]Feature{}), |
| 609 | 609 | }; |
| 610 | result[@intFromEnum(Feature.dot7_insts)] = .{ | |
| 610 | result[@backingInt(Feature.dot7_insts)] = .{ | |
| 611 | 611 | .llvm_name = "dot7-insts", |
| 612 | 612 | .description = "Has v_dot4_u32_u8, v_dot8_u32_u4 instructions", |
| 613 | 613 | .dependencies = featureSet(&[_]Feature{}), |
| 614 | 614 | }; |
| 615 | result[@intFromEnum(Feature.dot8_insts)] = .{ | |
| 615 | result[@backingInt(Feature.dot8_insts)] = .{ | |
| 616 | 616 | .llvm_name = "dot8-insts", |
| 617 | 617 | .description = "Has v_dot4_i32_iu8, v_dot8_i32_iu4 instructions", |
| 618 | 618 | .dependencies = featureSet(&[_]Feature{}), |
| 619 | 619 | }; |
| 620 | result[@intFromEnum(Feature.dot9_insts)] = .{ | |
| 620 | result[@backingInt(Feature.dot9_insts)] = .{ | |
| 621 | 621 | .llvm_name = "dot9-insts", |
| 622 | 622 | .description = "Has v_dot2_f16_f16, v_dot2_bf16_bf16 instructions", |
| 623 | 623 | .dependencies = featureSet(&[_]Feature{}), |
| 624 | 624 | }; |
| 625 | result[@intFromEnum(Feature.dpp)] = .{ | |
| 625 | result[@backingInt(Feature.dpp)] = .{ | |
| 626 | 626 | .llvm_name = "dpp", |
| 627 | 627 | .description = "Support DPP (Data Parallel Primitives) extension", |
| 628 | 628 | .dependencies = featureSet(&[_]Feature{}), |
| 629 | 629 | }; |
| 630 | result[@intFromEnum(Feature.dpp8)] = .{ | |
| 630 | result[@backingInt(Feature.dpp8)] = .{ | |
| 631 | 631 | .llvm_name = "dpp8", |
| 632 | 632 | .description = "Support DPP8 (Data Parallel Primitives) extension", |
| 633 | 633 | .dependencies = featureSet(&[_]Feature{}), |
| 634 | 634 | }; |
| 635 | result[@intFromEnum(Feature.dpp_64bit)] = .{ | |
| 635 | result[@backingInt(Feature.dpp_64bit)] = .{ | |
| 636 | 636 | .llvm_name = "dpp-64bit", |
| 637 | 637 | .description = "Support DPP (Data Parallel Primitives) extension in DP ALU", |
| 638 | 638 | .dependencies = featureSet(&[_]Feature{}), |
| 639 | 639 | }; |
| 640 | result[@intFromEnum(Feature.dpp_src1_sgpr)] = .{ | |
| 640 | result[@backingInt(Feature.dpp_src1_sgpr)] = .{ | |
| 641 | 641 | .llvm_name = "dpp-src1-sgpr", |
| 642 | 642 | .description = "Support SGPR for Src1 of DPP instructions", |
| 643 | 643 | .dependencies = featureSet(&[_]Feature{}), |
| 644 | 644 | }; |
| 645 | result[@intFromEnum(Feature.ds128)] = .{ | |
| 645 | result[@backingInt(Feature.ds128)] = .{ | |
| 646 | 646 | .llvm_name = "enable-ds128", |
| 647 | 647 | .description = "Use ds_{read|write}_b128", |
| 648 | 648 | .dependencies = featureSet(&[_]Feature{}), |
| 649 | 649 | }; |
| 650 | result[@intFromEnum(Feature.ds_src2_insts)] = .{ | |
| 650 | result[@backingInt(Feature.ds_src2_insts)] = .{ | |
| 651 | 651 | .llvm_name = "ds-src2-insts", |
| 652 | 652 | .description = "Has ds_*_src2 instructions", |
| 653 | 653 | .dependencies = featureSet(&[_]Feature{}), |
| 654 | 654 | }; |
| 655 | result[@intFromEnum(Feature.emulated_system_scope_atomics)] = .{ | |
| 655 | result[@backingInt(Feature.emulated_system_scope_atomics)] = .{ | |
| 656 | 656 | .llvm_name = "emulated-system-scope-atomics", |
| 657 | 657 | .description = "System scope atomics unsupported by the PCI-e are emulated in HW via CAS loop and functional.", |
| 658 | 658 | .dependencies = featureSet(&[_]Feature{}), |
| 659 | 659 | }; |
| 660 | result[@intFromEnum(Feature.extended_image_insts)] = .{ | |
| 660 | result[@backingInt(Feature.extended_image_insts)] = .{ | |
| 661 | 661 | .llvm_name = "extended-image-insts", |
| 662 | 662 | .description = "Support mips != 0, lod != 0, gather4, and get_lod", |
| 663 | 663 | .dependencies = featureSet(&[_]Feature{}), |
| 664 | 664 | }; |
| 665 | result[@intFromEnum(Feature.f16bf16_to_fp6bf6_cvt_scale_insts)] = .{ | |
| 665 | result[@backingInt(Feature.f16bf16_to_fp6bf6_cvt_scale_insts)] = .{ | |
| 666 | 666 | .llvm_name = "f16bf16-to-fp6bf6-cvt-scale-insts", |
| 667 | 667 | .description = "Has f16bf16 to fp6bf6 conversion scale instructions", |
| 668 | 668 | .dependencies = featureSet(&[_]Feature{}), |
| 669 | 669 | }; |
| 670 | result[@intFromEnum(Feature.f32_to_f16bf16_cvt_sr_insts)] = .{ | |
| 670 | result[@backingInt(Feature.f32_to_f16bf16_cvt_sr_insts)] = .{ | |
| 671 | 671 | .llvm_name = "f32-to-f16bf16-cvt-sr-insts", |
| 672 | 672 | .description = "Has f32 to f16bf16 conversion scale instructions", |
| 673 | 673 | .dependencies = featureSet(&[_]Feature{}), |
| 674 | 674 | }; |
| 675 | result[@intFromEnum(Feature.fast_denormal_f32)] = .{ | |
| 675 | result[@backingInt(Feature.fast_denormal_f32)] = .{ | |
| 676 | 676 | .llvm_name = "fast-denormal-f32", |
| 677 | 677 | .description = "Enabling denormals does not cause f32 instructions to run at f64 rates", |
| 678 | 678 | .dependencies = featureSet(&[_]Feature{}), |
| 679 | 679 | }; |
| 680 | result[@intFromEnum(Feature.fast_fmaf)] = .{ | |
| 680 | result[@backingInt(Feature.fast_fmaf)] = .{ | |
| 681 | 681 | .llvm_name = "fast-fmaf", |
| 682 | 682 | .description = "Assuming f32 fma is at least as fast as mul + add", |
| 683 | 683 | .dependencies = featureSet(&[_]Feature{}), |
| 684 | 684 | }; |
| 685 | result[@intFromEnum(Feature.flat_address_space)] = .{ | |
| 685 | result[@backingInt(Feature.flat_address_space)] = .{ | |
| 686 | 686 | .llvm_name = "flat-address-space", |
| 687 | 687 | .description = "Support flat address space", |
| 688 | 688 | .dependencies = featureSet(&[_]Feature{}), |
| 689 | 689 | }; |
| 690 | result[@intFromEnum(Feature.flat_atomic_fadd_f32_inst)] = .{ | |
| 690 | result[@backingInt(Feature.flat_atomic_fadd_f32_inst)] = .{ | |
| 691 | 691 | .llvm_name = "flat-atomic-fadd-f32-inst", |
| 692 | 692 | .description = "Has flat_atomic_add_f32 instruction", |
| 693 | 693 | .dependencies = featureSet(&[_]Feature{ |
| 694 | 694 | .flat_address_space, |
| 695 | 695 | }), |
| 696 | 696 | }; |
| 697 | result[@intFromEnum(Feature.flat_buffer_global_fadd_f64_inst)] = .{ | |
| 697 | result[@backingInt(Feature.flat_buffer_global_fadd_f64_inst)] = .{ | |
| 698 | 698 | .llvm_name = "flat-buffer-global-fadd-f64-inst", |
| 699 | 699 | .description = "Has flat, buffer, and global instructions for f64 atomic fadd", |
| 700 | 700 | .dependencies = featureSet(&[_]Feature{}), |
| 701 | 701 | }; |
| 702 | result[@intFromEnum(Feature.flat_for_global)] = .{ | |
| 702 | result[@backingInt(Feature.flat_for_global)] = .{ | |
| 703 | 703 | .llvm_name = "flat-for-global", |
| 704 | 704 | .description = "Force to generate flat instruction for global", |
| 705 | 705 | .dependencies = featureSet(&[_]Feature{}), |
| 706 | 706 | }; |
| 707 | result[@intFromEnum(Feature.flat_global_insts)] = .{ | |
| 707 | result[@backingInt(Feature.flat_global_insts)] = .{ | |
| 708 | 708 | .llvm_name = "flat-global-insts", |
| 709 | 709 | .description = "Have global_* flat memory instructions", |
| 710 | 710 | .dependencies = featureSet(&[_]Feature{ |
| 711 | 711 | .flat_address_space, |
| 712 | 712 | }), |
| 713 | 713 | }; |
| 714 | result[@intFromEnum(Feature.flat_gvs_mode)] = .{ | |
| 714 | result[@backingInt(Feature.flat_gvs_mode)] = .{ | |
| 715 | 715 | .llvm_name = "flat-gvs-mode", |
| 716 | 716 | .description = "Have GVS addressing mode with flat_* instructions", |
| 717 | 717 | .dependencies = featureSet(&[_]Feature{ |
| 718 | 718 | .flat_address_space, |
| 719 | 719 | }), |
| 720 | 720 | }; |
| 721 | result[@intFromEnum(Feature.flat_inst_offsets)] = .{ | |
| 721 | result[@backingInt(Feature.flat_inst_offsets)] = .{ | |
| 722 | 722 | .llvm_name = "flat-inst-offsets", |
| 723 | 723 | .description = "Flat instructions have immediate offset addressing mode", |
| 724 | 724 | .dependencies = featureSet(&[_]Feature{}), |
| 725 | 725 | }; |
| 726 | result[@intFromEnum(Feature.flat_scratch)] = .{ | |
| 726 | result[@backingInt(Feature.flat_scratch)] = .{ | |
| 727 | 727 | .llvm_name = "enable-flat-scratch", |
| 728 | 728 | .description = "Use scratch_* flat memory instructions to access scratch", |
| 729 | 729 | .dependencies = featureSet(&[_]Feature{}), |
| 730 | 730 | }; |
| 731 | result[@intFromEnum(Feature.flat_scratch_insts)] = .{ | |
| 731 | result[@backingInt(Feature.flat_scratch_insts)] = .{ | |
| 732 | 732 | .llvm_name = "flat-scratch-insts", |
| 733 | 733 | .description = "Have scratch_* flat memory instructions", |
| 734 | 734 | .dependencies = featureSet(&[_]Feature{ |
| 735 | 735 | .flat_address_space, |
| 736 | 736 | }), |
| 737 | 737 | }; |
| 738 | result[@intFromEnum(Feature.flat_segment_offset_bug)] = .{ | |
| 738 | result[@backingInt(Feature.flat_segment_offset_bug)] = .{ | |
| 739 | 739 | .llvm_name = "flat-segment-offset-bug", |
| 740 | 740 | .description = "GFX10 bug where inst_offset is ignored when flat instructions access global memory", |
| 741 | 741 | .dependencies = featureSet(&[_]Feature{}), |
| 742 | 742 | }; |
| 743 | result[@intFromEnum(Feature.fma_mix_bf16_insts)] = .{ | |
| 743 | result[@backingInt(Feature.fma_mix_bf16_insts)] = .{ | |
| 744 | 744 | .llvm_name = "fma-mix-bf16-insts", |
| 745 | 745 | .description = "Has v_fma_mix_f32_bf16, v_fma_mixlo_bf16, v_fma_mixhi_bf16 instructions", |
| 746 | 746 | .dependencies = featureSet(&[_]Feature{}), |
| 747 | 747 | }; |
| 748 | result[@intFromEnum(Feature.fma_mix_insts)] = .{ | |
| 748 | result[@backingInt(Feature.fma_mix_insts)] = .{ | |
| 749 | 749 | .llvm_name = "fma-mix-insts", |
| 750 | 750 | .description = "Has v_fma_mix_f32, v_fma_mixlo_f16, v_fma_mixhi_f16 instructions", |
| 751 | 751 | .dependencies = featureSet(&[_]Feature{}), |
| 752 | 752 | }; |
| 753 | result[@intFromEnum(Feature.fmacf64_inst)] = .{ | |
| 753 | result[@backingInt(Feature.fmacf64_inst)] = .{ | |
| 754 | 754 | .llvm_name = "fmacf64-inst", |
| 755 | 755 | .description = "Has v_fmac_f64 instruction", |
| 756 | 756 | .dependencies = featureSet(&[_]Feature{}), |
| 757 | 757 | }; |
| 758 | result[@intFromEnum(Feature.fmaf)] = .{ | |
| 758 | result[@backingInt(Feature.fmaf)] = .{ | |
| 759 | 759 | .llvm_name = "fmaf", |
| 760 | 760 | .description = "Enable single precision FMA (not as fast as mul+add, but fused)", |
| 761 | 761 | .dependencies = featureSet(&[_]Feature{}), |
| 762 | 762 | }; |
| 763 | result[@intFromEnum(Feature.fp4_cvt_scale_insts)] = .{ | |
| 763 | result[@backingInt(Feature.fp4_cvt_scale_insts)] = .{ | |
| 764 | 764 | .llvm_name = "fp4-cvt-scale-insts", |
| 765 | 765 | .description = "Has fp4 conversion scale instructions", |
| 766 | 766 | .dependencies = featureSet(&[_]Feature{}), |
| 767 | 767 | }; |
| 768 | result[@intFromEnum(Feature.fp64)] = .{ | |
| 768 | result[@backingInt(Feature.fp64)] = .{ | |
| 769 | 769 | .llvm_name = "fp64", |
| 770 | 770 | .description = "Enable double precision operations", |
| 771 | 771 | .dependencies = featureSet(&[_]Feature{}), |
| 772 | 772 | }; |
| 773 | result[@intFromEnum(Feature.fp6bf6_cvt_scale_insts)] = .{ | |
| 773 | result[@backingInt(Feature.fp6bf6_cvt_scale_insts)] = .{ | |
| 774 | 774 | .llvm_name = "fp6bf6-cvt-scale-insts", |
| 775 | 775 | .description = "Has fp6 and bf6 conversion scale instructions", |
| 776 | 776 | .dependencies = featureSet(&[_]Feature{}), |
| 777 | 777 | }; |
| 778 | result[@intFromEnum(Feature.fp8_conversion_insts)] = .{ | |
| 778 | result[@backingInt(Feature.fp8_conversion_insts)] = .{ | |
| 779 | 779 | .llvm_name = "fp8-conversion-insts", |
| 780 | 780 | .description = "Has fp8 and bf8 conversion instructions", |
| 781 | 781 | .dependencies = featureSet(&[_]Feature{}), |
| 782 | 782 | }; |
| 783 | result[@intFromEnum(Feature.fp8_cvt_scale_insts)] = .{ | |
| 783 | result[@backingInt(Feature.fp8_cvt_scale_insts)] = .{ | |
| 784 | 784 | .llvm_name = "fp8-cvt-scale-insts", |
| 785 | 785 | .description = "Has fp8 conversion scale instructions", |
| 786 | 786 | .dependencies = featureSet(&[_]Feature{}), |
| 787 | 787 | }; |
| 788 | result[@intFromEnum(Feature.fp8_insts)] = .{ | |
| 788 | result[@backingInt(Feature.fp8_insts)] = .{ | |
| 789 | 789 | .llvm_name = "fp8-insts", |
| 790 | 790 | .description = "Has fp8 and bf8 instructions", |
| 791 | 791 | .dependencies = featureSet(&[_]Feature{}), |
| 792 | 792 | }; |
| 793 | result[@intFromEnum(Feature.fp8e5m3_insts)] = .{ | |
| 793 | result[@backingInt(Feature.fp8e5m3_insts)] = .{ | |
| 794 | 794 | .llvm_name = "fp8e5m3-insts", |
| 795 | 795 | .description = "Has fp8 e5m3 format support", |
| 796 | 796 | .dependencies = featureSet(&[_]Feature{}), |
| 797 | 797 | }; |
| 798 | result[@intFromEnum(Feature.full_rate_64_ops)] = .{ | |
| 798 | result[@backingInt(Feature.full_rate_64_ops)] = .{ | |
| 799 | 799 | .llvm_name = "full-rate-64-ops", |
| 800 | 800 | .description = "Most fp64 instructions are full rate", |
| 801 | 801 | .dependencies = featureSet(&[_]Feature{}), |
| 802 | 802 | }; |
| 803 | result[@intFromEnum(Feature.g16)] = .{ | |
| 803 | result[@backingInt(Feature.g16)] = .{ | |
| 804 | 804 | .llvm_name = "g16", |
| 805 | 805 | .description = "Support G16 for 16-bit gradient image operands", |
| 806 | 806 | .dependencies = featureSet(&[_]Feature{}), |
| 807 | 807 | }; |
| 808 | result[@intFromEnum(Feature.gcn3_encoding)] = .{ | |
| 808 | result[@backingInt(Feature.gcn3_encoding)] = .{ | |
| 809 | 809 | .llvm_name = "gcn3-encoding", |
| 810 | 810 | .description = "Encoding format for VI", |
| 811 | 811 | .dependencies = featureSet(&[_]Feature{}), |
| 812 | 812 | }; |
| 813 | result[@intFromEnum(Feature.gds)] = .{ | |
| 813 | result[@backingInt(Feature.gds)] = .{ | |
| 814 | 814 | .llvm_name = "gds", |
| 815 | 815 | .description = "Has Global Data Share", |
| 816 | 816 | .dependencies = featureSet(&[_]Feature{}), |
| 817 | 817 | }; |
| 818 | result[@intFromEnum(Feature.get_wave_id_inst)] = .{ | |
| 818 | result[@backingInt(Feature.get_wave_id_inst)] = .{ | |
| 819 | 819 | .llvm_name = "get-wave-id-inst", |
| 820 | 820 | .description = "Has s_get_waveid_in_workgroup instruction", |
| 821 | 821 | .dependencies = featureSet(&[_]Feature{}), |
| 822 | 822 | }; |
| 823 | result[@intFromEnum(Feature.gfx10)] = .{ | |
| 823 | result[@backingInt(Feature.gfx10)] = .{ | |
| 824 | 824 | .llvm_name = "gfx10", |
| 825 | 825 | .description = "GFX10 GPU generation", |
| 826 | 826 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -883,27 +883,27 @@ pub const all_features = blk: { |
| 883 | 883 | .vscnt, |
| 884 | 884 | }), |
| 885 | 885 | }; |
| 886 | result[@intFromEnum(Feature.gfx10_3_insts)] = .{ | |
| 886 | result[@backingInt(Feature.gfx10_3_insts)] = .{ | |
| 887 | 887 | .llvm_name = "gfx10-3-insts", |
| 888 | 888 | .description = "Additional instructions for GFX10.3", |
| 889 | 889 | .dependencies = featureSet(&[_]Feature{}), |
| 890 | 890 | }; |
| 891 | result[@intFromEnum(Feature.gfx10_a_encoding)] = .{ | |
| 891 | result[@backingInt(Feature.gfx10_a_encoding)] = .{ | |
| 892 | 892 | .llvm_name = "gfx10_a-encoding", |
| 893 | 893 | .description = "Has BVH ray tracing instructions", |
| 894 | 894 | .dependencies = featureSet(&[_]Feature{}), |
| 895 | 895 | }; |
| 896 | result[@intFromEnum(Feature.gfx10_b_encoding)] = .{ | |
| 896 | result[@backingInt(Feature.gfx10_b_encoding)] = .{ | |
| 897 | 897 | .llvm_name = "gfx10_b-encoding", |
| 898 | 898 | .description = "Encoding format GFX10_B", |
| 899 | 899 | .dependencies = featureSet(&[_]Feature{}), |
| 900 | 900 | }; |
| 901 | result[@intFromEnum(Feature.gfx10_insts)] = .{ | |
| 901 | result[@backingInt(Feature.gfx10_insts)] = .{ | |
| 902 | 902 | .llvm_name = "gfx10-insts", |
| 903 | 903 | .description = "Additional instructions for GFX10+", |
| 904 | 904 | .dependencies = featureSet(&[_]Feature{}), |
| 905 | 905 | }; |
| 906 | result[@intFromEnum(Feature.gfx11)] = .{ | |
| 906 | result[@backingInt(Feature.gfx11)] = .{ | |
| 907 | 907 | .llvm_name = "gfx11", |
| 908 | 908 | .description = "GFX11 GPU generation", |
| 909 | 909 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -962,12 +962,12 @@ pub const all_features = blk: { |
| 962 | 962 | .vscnt, |
| 963 | 963 | }), |
| 964 | 964 | }; |
| 965 | result[@intFromEnum(Feature.gfx11_insts)] = .{ | |
| 965 | result[@backingInt(Feature.gfx11_insts)] = .{ | |
| 966 | 966 | .llvm_name = "gfx11-insts", |
| 967 | 967 | .description = "Additional instructions for GFX11+", |
| 968 | 968 | .dependencies = featureSet(&[_]Feature{}), |
| 969 | 969 | }; |
| 970 | result[@intFromEnum(Feature.gfx12)] = .{ | |
| 970 | result[@backingInt(Feature.gfx12)] = .{ | |
| 971 | 971 | .llvm_name = "gfx12", |
| 972 | 972 | .description = "GFX12 GPU generation", |
| 973 | 973 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1019,27 +1019,27 @@ pub const all_features = blk: { |
| 1019 | 1019 | .vscnt, |
| 1020 | 1020 | }), |
| 1021 | 1021 | }; |
| 1022 | result[@intFromEnum(Feature.gfx1250_insts)] = .{ | |
| 1022 | result[@backingInt(Feature.gfx1250_insts)] = .{ | |
| 1023 | 1023 | .llvm_name = "gfx1250-insts", |
| 1024 | 1024 | .description = "Additional instructions for GFX1250+", |
| 1025 | 1025 | .dependencies = featureSet(&[_]Feature{}), |
| 1026 | 1026 | }; |
| 1027 | result[@intFromEnum(Feature.gfx12_insts)] = .{ | |
| 1027 | result[@backingInt(Feature.gfx12_insts)] = .{ | |
| 1028 | 1028 | .llvm_name = "gfx12-insts", |
| 1029 | 1029 | .description = "Additional instructions for GFX12+", |
| 1030 | 1030 | .dependencies = featureSet(&[_]Feature{}), |
| 1031 | 1031 | }; |
| 1032 | result[@intFromEnum(Feature.gfx7_gfx8_gfx9_insts)] = .{ | |
| 1032 | result[@backingInt(Feature.gfx7_gfx8_gfx9_insts)] = .{ | |
| 1033 | 1033 | .llvm_name = "gfx7-gfx8-gfx9-insts", |
| 1034 | 1034 | .description = "Instructions shared in GFX7, GFX8, GFX9", |
| 1035 | 1035 | .dependencies = featureSet(&[_]Feature{}), |
| 1036 | 1036 | }; |
| 1037 | result[@intFromEnum(Feature.gfx8_insts)] = .{ | |
| 1037 | result[@backingInt(Feature.gfx8_insts)] = .{ | |
| 1038 | 1038 | .llvm_name = "gfx8-insts", |
| 1039 | 1039 | .description = "Additional instructions for GFX8+", |
| 1040 | 1040 | .dependencies = featureSet(&[_]Feature{}), |
| 1041 | 1041 | }; |
| 1042 | result[@intFromEnum(Feature.gfx9)] = .{ | |
| 1042 | result[@backingInt(Feature.gfx9)] = .{ | |
| 1043 | 1043 | .llvm_name = "gfx9", |
| 1044 | 1044 | .description = "GFX9 GPU generation", |
| 1045 | 1045 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1092,17 +1092,17 @@ pub const all_features = blk: { |
| 1092 | 1092 | .xnack_support, |
| 1093 | 1093 | }), |
| 1094 | 1094 | }; |
| 1095 | result[@intFromEnum(Feature.gfx90a_insts)] = .{ | |
| 1095 | result[@backingInt(Feature.gfx90a_insts)] = .{ | |
| 1096 | 1096 | .llvm_name = "gfx90a-insts", |
| 1097 | 1097 | .description = "Additional instructions for GFX90A+", |
| 1098 | 1098 | .dependencies = featureSet(&[_]Feature{}), |
| 1099 | 1099 | }; |
| 1100 | result[@intFromEnum(Feature.gfx940_insts)] = .{ | |
| 1100 | result[@backingInt(Feature.gfx940_insts)] = .{ | |
| 1101 | 1101 | .llvm_name = "gfx940-insts", |
| 1102 | 1102 | .description = "Additional instructions for GFX940+", |
| 1103 | 1103 | .dependencies = featureSet(&[_]Feature{}), |
| 1104 | 1104 | }; |
| 1105 | result[@intFromEnum(Feature.gfx950_insts)] = .{ | |
| 1105 | result[@backingInt(Feature.gfx950_insts)] = .{ | |
| 1106 | 1106 | .llvm_name = "gfx950-insts", |
| 1107 | 1107 | .description = "Additional instructions for GFX950+", |
| 1108 | 1108 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1120,437 +1120,437 @@ pub const all_features = blk: { |
| 1120 | 1120 | .permlane32_swap, |
| 1121 | 1121 | }), |
| 1122 | 1122 | }; |
| 1123 | result[@intFromEnum(Feature.gfx9_insts)] = .{ | |
| 1123 | result[@backingInt(Feature.gfx9_insts)] = .{ | |
| 1124 | 1124 | .llvm_name = "gfx9-insts", |
| 1125 | 1125 | .description = "Additional instructions for GFX9+", |
| 1126 | 1126 | .dependencies = featureSet(&[_]Feature{}), |
| 1127 | 1127 | }; |
| 1128 | result[@intFromEnum(Feature.globally_addressable_scratch)] = .{ | |
| 1128 | result[@backingInt(Feature.globally_addressable_scratch)] = .{ | |
| 1129 | 1129 | .llvm_name = "globally-addressable-scratch", |
| 1130 | 1130 | .description = "FLAT instructions can access scratch memory for any thread in any wave", |
| 1131 | 1131 | .dependencies = featureSet(&[_]Feature{}), |
| 1132 | 1132 | }; |
| 1133 | result[@intFromEnum(Feature.gws)] = .{ | |
| 1133 | result[@backingInt(Feature.gws)] = .{ | |
| 1134 | 1134 | .llvm_name = "gws", |
| 1135 | 1135 | .description = "Has Global Wave Sync", |
| 1136 | 1136 | .dependencies = featureSet(&[_]Feature{}), |
| 1137 | 1137 | }; |
| 1138 | result[@intFromEnum(Feature.half_rate_64_ops)] = .{ | |
| 1138 | result[@backingInt(Feature.half_rate_64_ops)] = .{ | |
| 1139 | 1139 | .llvm_name = "half-rate-64-ops", |
| 1140 | 1140 | .description = "Most fp64 instructions are half rate instead of quarter", |
| 1141 | 1141 | .dependencies = featureSet(&[_]Feature{}), |
| 1142 | 1142 | }; |
| 1143 | result[@intFromEnum(Feature.ieee_minimum_maximum_insts)] = .{ | |
| 1143 | result[@backingInt(Feature.ieee_minimum_maximum_insts)] = .{ | |
| 1144 | 1144 | .llvm_name = "ieee-minimum-maximum-insts", |
| 1145 | 1145 | .description = "Has v_minimum/maximum_f16/f32/f64, v_minimummaximum/maximumminimum_f16/f32 and v_pk_minimum/maximum_f16 instructions", |
| 1146 | 1146 | .dependencies = featureSet(&[_]Feature{}), |
| 1147 | 1147 | }; |
| 1148 | result[@intFromEnum(Feature.image_gather4_d16_bug)] = .{ | |
| 1148 | result[@backingInt(Feature.image_gather4_d16_bug)] = .{ | |
| 1149 | 1149 | .llvm_name = "image-gather4-d16-bug", |
| 1150 | 1150 | .description = "Image Gather4 D16 hardware bug", |
| 1151 | 1151 | .dependencies = featureSet(&[_]Feature{}), |
| 1152 | 1152 | }; |
| 1153 | result[@intFromEnum(Feature.image_insts)] = .{ | |
| 1153 | result[@backingInt(Feature.image_insts)] = .{ | |
| 1154 | 1154 | .llvm_name = "image-insts", |
| 1155 | 1155 | .description = "Support image instructions", |
| 1156 | 1156 | .dependencies = featureSet(&[_]Feature{}), |
| 1157 | 1157 | }; |
| 1158 | result[@intFromEnum(Feature.image_store_d16_bug)] = .{ | |
| 1158 | result[@backingInt(Feature.image_store_d16_bug)] = .{ | |
| 1159 | 1159 | .llvm_name = "image-store-d16-bug", |
| 1160 | 1160 | .description = "Image Store D16 hardware bug", |
| 1161 | 1161 | .dependencies = featureSet(&[_]Feature{}), |
| 1162 | 1162 | }; |
| 1163 | result[@intFromEnum(Feature.inst_fwd_prefetch_bug)] = .{ | |
| 1163 | result[@backingInt(Feature.inst_fwd_prefetch_bug)] = .{ | |
| 1164 | 1164 | .llvm_name = "inst-fwd-prefetch-bug", |
| 1165 | 1165 | .description = "S_INST_PREFETCH instruction causes shader to hang", |
| 1166 | 1166 | .dependencies = featureSet(&[_]Feature{}), |
| 1167 | 1167 | }; |
| 1168 | result[@intFromEnum(Feature.int_clamp_insts)] = .{ | |
| 1168 | result[@backingInt(Feature.int_clamp_insts)] = .{ | |
| 1169 | 1169 | .llvm_name = "int-clamp-insts", |
| 1170 | 1170 | .description = "Support clamp for integer destination", |
| 1171 | 1171 | .dependencies = featureSet(&[_]Feature{}), |
| 1172 | 1172 | }; |
| 1173 | result[@intFromEnum(Feature.inv_2pi_inline_imm)] = .{ | |
| 1173 | result[@backingInt(Feature.inv_2pi_inline_imm)] = .{ | |
| 1174 | 1174 | .llvm_name = "inv-2pi-inline-imm", |
| 1175 | 1175 | .description = "Has 1 / (2 * pi) as inline immediate", |
| 1176 | 1176 | .dependencies = featureSet(&[_]Feature{}), |
| 1177 | 1177 | }; |
| 1178 | result[@intFromEnum(Feature.kernarg_preload)] = .{ | |
| 1178 | result[@backingInt(Feature.kernarg_preload)] = .{ | |
| 1179 | 1179 | .llvm_name = "kernarg-preload", |
| 1180 | 1180 | .description = "Hardware supports preloading of kernel arguments in user SGPRs.", |
| 1181 | 1181 | .dependencies = featureSet(&[_]Feature{}), |
| 1182 | 1182 | }; |
| 1183 | result[@intFromEnum(Feature.lds_barrier_arrive_atomic)] = .{ | |
| 1183 | result[@backingInt(Feature.lds_barrier_arrive_atomic)] = .{ | |
| 1184 | 1184 | .llvm_name = "lds-barrier-arrive-atomic", |
| 1185 | 1185 | .description = "Has LDS barrier-arrive atomic instructions", |
| 1186 | 1186 | .dependencies = featureSet(&[_]Feature{}), |
| 1187 | 1187 | }; |
| 1188 | result[@intFromEnum(Feature.lds_branch_vmem_war_hazard)] = .{ | |
| 1188 | result[@backingInt(Feature.lds_branch_vmem_war_hazard)] = .{ | |
| 1189 | 1189 | .llvm_name = "lds-branch-vmem-war-hazard", |
| 1190 | 1190 | .description = "Switching between LDS and VMEM-tex not waiting VM_VSRC=0", |
| 1191 | 1191 | .dependencies = featureSet(&[_]Feature{}), |
| 1192 | 1192 | }; |
| 1193 | result[@intFromEnum(Feature.lds_misaligned_bug)] = .{ | |
| 1193 | result[@backingInt(Feature.lds_misaligned_bug)] = .{ | |
| 1194 | 1194 | .llvm_name = "lds-misaligned-bug", |
| 1195 | 1195 | .description = "Some GFX10 bug with multi-dword LDS and flat access that is not naturally aligned in WGP mode", |
| 1196 | 1196 | .dependencies = featureSet(&[_]Feature{}), |
| 1197 | 1197 | }; |
| 1198 | result[@intFromEnum(Feature.ldsbankcount16)] = .{ | |
| 1198 | result[@backingInt(Feature.ldsbankcount16)] = .{ | |
| 1199 | 1199 | .llvm_name = "ldsbankcount16", |
| 1200 | 1200 | .description = "The number of LDS banks per compute unit.", |
| 1201 | 1201 | .dependencies = featureSet(&[_]Feature{}), |
| 1202 | 1202 | }; |
| 1203 | result[@intFromEnum(Feature.ldsbankcount32)] = .{ | |
| 1203 | result[@backingInt(Feature.ldsbankcount32)] = .{ | |
| 1204 | 1204 | .llvm_name = "ldsbankcount32", |
| 1205 | 1205 | .description = "The number of LDS banks per compute unit.", |
| 1206 | 1206 | .dependencies = featureSet(&[_]Feature{}), |
| 1207 | 1207 | }; |
| 1208 | result[@intFromEnum(Feature.lerp_inst)] = .{ | |
| 1208 | result[@backingInt(Feature.lerp_inst)] = .{ | |
| 1209 | 1209 | .llvm_name = "lerp-inst", |
| 1210 | 1210 | .description = "Has v_lerp_u8 instruction", |
| 1211 | 1211 | .dependencies = featureSet(&[_]Feature{}), |
| 1212 | 1212 | }; |
| 1213 | result[@intFromEnum(Feature.load_store_opt)] = .{ | |
| 1213 | result[@backingInt(Feature.load_store_opt)] = .{ | |
| 1214 | 1214 | .llvm_name = "load-store-opt", |
| 1215 | 1215 | .description = "Enable SI load/store optimizer pass", |
| 1216 | 1216 | .dependencies = featureSet(&[_]Feature{}), |
| 1217 | 1217 | }; |
| 1218 | result[@intFromEnum(Feature.lshl_add_u64_inst)] = .{ | |
| 1218 | result[@backingInt(Feature.lshl_add_u64_inst)] = .{ | |
| 1219 | 1219 | .llvm_name = "lshl-add-u64-inst", |
| 1220 | 1220 | .description = "Has v_lshl_add_u64 instruction", |
| 1221 | 1221 | .dependencies = featureSet(&[_]Feature{}), |
| 1222 | 1222 | }; |
| 1223 | result[@intFromEnum(Feature.mad_intra_fwd_bug)] = .{ | |
| 1223 | result[@backingInt(Feature.mad_intra_fwd_bug)] = .{ | |
| 1224 | 1224 | .llvm_name = "mad-intra-fwd-bug", |
| 1225 | 1225 | .description = "MAD_U64/I64 intra instruction forwarding bug", |
| 1226 | 1226 | .dependencies = featureSet(&[_]Feature{}), |
| 1227 | 1227 | }; |
| 1228 | result[@intFromEnum(Feature.mad_mac_f32_insts)] = .{ | |
| 1228 | result[@backingInt(Feature.mad_mac_f32_insts)] = .{ | |
| 1229 | 1229 | .llvm_name = "mad-mac-f32-insts", |
| 1230 | 1230 | .description = "Has v_mad_f32/v_mac_f32/v_madak_f32/v_madmk_f32 instructions", |
| 1231 | 1231 | .dependencies = featureSet(&[_]Feature{}), |
| 1232 | 1232 | }; |
| 1233 | result[@intFromEnum(Feature.mad_mix_insts)] = .{ | |
| 1233 | result[@backingInt(Feature.mad_mix_insts)] = .{ | |
| 1234 | 1234 | .llvm_name = "mad-mix-insts", |
| 1235 | 1235 | .description = "Has v_mad_mix_f32, v_mad_mixlo_f16, v_mad_mixhi_f16 instructions", |
| 1236 | 1236 | .dependencies = featureSet(&[_]Feature{}), |
| 1237 | 1237 | }; |
| 1238 | result[@intFromEnum(Feature.mad_u32_inst)] = .{ | |
| 1238 | result[@backingInt(Feature.mad_u32_inst)] = .{ | |
| 1239 | 1239 | .llvm_name = "mad-u32-inst", |
| 1240 | 1240 | .description = "Has v_mad_u32 instruction", |
| 1241 | 1241 | .dependencies = featureSet(&[_]Feature{}), |
| 1242 | 1242 | }; |
| 1243 | result[@intFromEnum(Feature.mai_insts)] = .{ | |
| 1243 | result[@backingInt(Feature.mai_insts)] = .{ | |
| 1244 | 1244 | .llvm_name = "mai-insts", |
| 1245 | 1245 | .description = "Has mAI instructions", |
| 1246 | 1246 | .dependencies = featureSet(&[_]Feature{}), |
| 1247 | 1247 | }; |
| 1248 | result[@intFromEnum(Feature.max_hard_clause_length_32)] = .{ | |
| 1248 | result[@backingInt(Feature.max_hard_clause_length_32)] = .{ | |
| 1249 | 1249 | .llvm_name = "max-hard-clause-length-32", |
| 1250 | 1250 | .description = "Maximum number of instructions in an explicit S_CLAUSE is 32", |
| 1251 | 1251 | .dependencies = featureSet(&[_]Feature{}), |
| 1252 | 1252 | }; |
| 1253 | result[@intFromEnum(Feature.max_hard_clause_length_63)] = .{ | |
| 1253 | result[@backingInt(Feature.max_hard_clause_length_63)] = .{ | |
| 1254 | 1254 | .llvm_name = "max-hard-clause-length-63", |
| 1255 | 1255 | .description = "Maximum number of instructions in an explicit S_CLAUSE is 63", |
| 1256 | 1256 | .dependencies = featureSet(&[_]Feature{}), |
| 1257 | 1257 | }; |
| 1258 | result[@intFromEnum(Feature.max_private_element_size_16)] = .{ | |
| 1258 | result[@backingInt(Feature.max_private_element_size_16)] = .{ | |
| 1259 | 1259 | .llvm_name = "max-private-element-size-16", |
| 1260 | 1260 | .description = "Maximum private access size may be 16", |
| 1261 | 1261 | .dependencies = featureSet(&[_]Feature{}), |
| 1262 | 1262 | }; |
| 1263 | result[@intFromEnum(Feature.max_private_element_size_4)] = .{ | |
| 1263 | result[@backingInt(Feature.max_private_element_size_4)] = .{ | |
| 1264 | 1264 | .llvm_name = "max-private-element-size-4", |
| 1265 | 1265 | .description = "Maximum private access size may be 4", |
| 1266 | 1266 | .dependencies = featureSet(&[_]Feature{}), |
| 1267 | 1267 | }; |
| 1268 | result[@intFromEnum(Feature.max_private_element_size_8)] = .{ | |
| 1268 | result[@backingInt(Feature.max_private_element_size_8)] = .{ | |
| 1269 | 1269 | .llvm_name = "max-private-element-size-8", |
| 1270 | 1270 | .description = "Maximum private access size may be 8", |
| 1271 | 1271 | .dependencies = featureSet(&[_]Feature{}), |
| 1272 | 1272 | }; |
| 1273 | result[@intFromEnum(Feature.mcast_load_insts)] = .{ | |
| 1273 | result[@backingInt(Feature.mcast_load_insts)] = .{ | |
| 1274 | 1274 | .llvm_name = "mcast-load-insts", |
| 1275 | 1275 | .description = "Has multicast load instructions", |
| 1276 | 1276 | .dependencies = featureSet(&[_]Feature{}), |
| 1277 | 1277 | }; |
| 1278 | result[@intFromEnum(Feature.memory_atomic_fadd_f32_denormal_support)] = .{ | |
| 1278 | result[@backingInt(Feature.memory_atomic_fadd_f32_denormal_support)] = .{ | |
| 1279 | 1279 | .llvm_name = "memory-atomic-fadd-f32-denormal-support", |
| 1280 | 1280 | .description = "global/flat/buffer atomic fadd for float supports denormal handling", |
| 1281 | 1281 | .dependencies = featureSet(&[_]Feature{}), |
| 1282 | 1282 | }; |
| 1283 | result[@intFromEnum(Feature.mfma_inline_literal_bug)] = .{ | |
| 1283 | result[@backingInt(Feature.mfma_inline_literal_bug)] = .{ | |
| 1284 | 1284 | .llvm_name = "mfma-inline-literal-bug", |
| 1285 | 1285 | .description = "MFMA cannot use inline literal as SrcC", |
| 1286 | 1286 | .dependencies = featureSet(&[_]Feature{}), |
| 1287 | 1287 | }; |
| 1288 | result[@intFromEnum(Feature.mimg_r128)] = .{ | |
| 1288 | result[@backingInt(Feature.mimg_r128)] = .{ | |
| 1289 | 1289 | .llvm_name = "mimg-r128", |
| 1290 | 1290 | .description = "Support 128-bit texture resources", |
| 1291 | 1291 | .dependencies = featureSet(&[_]Feature{}), |
| 1292 | 1292 | }; |
| 1293 | result[@intFromEnum(Feature.min3_max3_pkf16)] = .{ | |
| 1293 | result[@backingInt(Feature.min3_max3_pkf16)] = .{ | |
| 1294 | 1294 | .llvm_name = "min3-max3-pkf16", |
| 1295 | 1295 | .description = "Has v_pk_min3_num_f16 and v_pk_max3_num_f16 instructions", |
| 1296 | 1296 | .dependencies = featureSet(&[_]Feature{}), |
| 1297 | 1297 | }; |
| 1298 | result[@intFromEnum(Feature.minimum3_maximum3_f16)] = .{ | |
| 1298 | result[@backingInt(Feature.minimum3_maximum3_f16)] = .{ | |
| 1299 | 1299 | .llvm_name = "minimum3-maximum3-f16", |
| 1300 | 1300 | .description = "Has v_minimum3_f16 and v_maximum3_f16 instructions", |
| 1301 | 1301 | .dependencies = featureSet(&[_]Feature{}), |
| 1302 | 1302 | }; |
| 1303 | result[@intFromEnum(Feature.minimum3_maximum3_f32)] = .{ | |
| 1303 | result[@backingInt(Feature.minimum3_maximum3_f32)] = .{ | |
| 1304 | 1304 | .llvm_name = "minimum3-maximum3-f32", |
| 1305 | 1305 | .description = "Has v_minimum3_f32 and v_maximum3_f32 instructions", |
| 1306 | 1306 | .dependencies = featureSet(&[_]Feature{}), |
| 1307 | 1307 | }; |
| 1308 | result[@intFromEnum(Feature.minimum3_maximum3_pkf16)] = .{ | |
| 1308 | result[@backingInt(Feature.minimum3_maximum3_pkf16)] = .{ | |
| 1309 | 1309 | .llvm_name = "minimum3-maximum3-pkf16", |
| 1310 | 1310 | .description = "Has v_pk_minimum3_f16 and v_pk_maximum3_f16 instructions", |
| 1311 | 1311 | .dependencies = featureSet(&[_]Feature{}), |
| 1312 | 1312 | }; |
| 1313 | result[@intFromEnum(Feature.movrel)] = .{ | |
| 1313 | result[@backingInt(Feature.movrel)] = .{ | |
| 1314 | 1314 | .llvm_name = "movrel", |
| 1315 | 1315 | .description = "Has v_movrel*_b32 instructions", |
| 1316 | 1316 | .dependencies = featureSet(&[_]Feature{}), |
| 1317 | 1317 | }; |
| 1318 | result[@intFromEnum(Feature.msaa_load_dst_sel_bug)] = .{ | |
| 1318 | result[@backingInt(Feature.msaa_load_dst_sel_bug)] = .{ | |
| 1319 | 1319 | .llvm_name = "msaa-load-dst-sel-bug", |
| 1320 | 1320 | .description = "MSAA loads not honoring dst_sel bug", |
| 1321 | 1321 | .dependencies = featureSet(&[_]Feature{}), |
| 1322 | 1322 | }; |
| 1323 | result[@intFromEnum(Feature.negative_scratch_offset_bug)] = .{ | |
| 1323 | result[@backingInt(Feature.negative_scratch_offset_bug)] = .{ | |
| 1324 | 1324 | .llvm_name = "negative-scratch-offset-bug", |
| 1325 | 1325 | .description = "Negative immediate offsets in scratch instructions with an SGPR offset page fault on GFX9", |
| 1326 | 1326 | .dependencies = featureSet(&[_]Feature{}), |
| 1327 | 1327 | }; |
| 1328 | result[@intFromEnum(Feature.negative_unaligned_scratch_offset_bug)] = .{ | |
| 1328 | result[@backingInt(Feature.negative_unaligned_scratch_offset_bug)] = .{ | |
| 1329 | 1329 | .llvm_name = "negative-unaligned-scratch-offset-bug", |
| 1330 | 1330 | .description = "Scratch instructions with a VGPR offset and a negative immediate offset that is not a multiple of 4 read wrong memory on GFX10", |
| 1331 | 1331 | .dependencies = featureSet(&[_]Feature{}), |
| 1332 | 1332 | }; |
| 1333 | result[@intFromEnum(Feature.no_data_dep_hazard)] = .{ | |
| 1333 | result[@backingInt(Feature.no_data_dep_hazard)] = .{ | |
| 1334 | 1334 | .llvm_name = "no-data-dep-hazard", |
| 1335 | 1335 | .description = "Does not need SW waitstates", |
| 1336 | 1336 | .dependencies = featureSet(&[_]Feature{}), |
| 1337 | 1337 | }; |
| 1338 | result[@intFromEnum(Feature.no_sdst_cmpx)] = .{ | |
| 1338 | result[@backingInt(Feature.no_sdst_cmpx)] = .{ | |
| 1339 | 1339 | .llvm_name = "no-sdst-cmpx", |
| 1340 | 1340 | .description = "V_CMPX does not write VCC/SGPR in addition to EXEC", |
| 1341 | 1341 | .dependencies = featureSet(&[_]Feature{}), |
| 1342 | 1342 | }; |
| 1343 | result[@intFromEnum(Feature.nsa_clause_bug)] = .{ | |
| 1343 | result[@backingInt(Feature.nsa_clause_bug)] = .{ | |
| 1344 | 1344 | .llvm_name = "nsa-clause-bug", |
| 1345 | 1345 | .description = "MIMG-NSA in a hard clause has unpredictable results on GFX10.1", |
| 1346 | 1346 | .dependencies = featureSet(&[_]Feature{}), |
| 1347 | 1347 | }; |
| 1348 | result[@intFromEnum(Feature.nsa_encoding)] = .{ | |
| 1348 | result[@backingInt(Feature.nsa_encoding)] = .{ | |
| 1349 | 1349 | .llvm_name = "nsa-encoding", |
| 1350 | 1350 | .description = "Support NSA encoding for image instructions", |
| 1351 | 1351 | .dependencies = featureSet(&[_]Feature{}), |
| 1352 | 1352 | }; |
| 1353 | result[@intFromEnum(Feature.nsa_to_vmem_bug)] = .{ | |
| 1353 | result[@backingInt(Feature.nsa_to_vmem_bug)] = .{ | |
| 1354 | 1354 | .llvm_name = "nsa-to-vmem-bug", |
| 1355 | 1355 | .description = "MIMG-NSA followed by VMEM fail if EXEC_LO or EXEC_HI equals zero", |
| 1356 | 1356 | .dependencies = featureSet(&[_]Feature{}), |
| 1357 | 1357 | }; |
| 1358 | result[@intFromEnum(Feature.offset_3f_bug)] = .{ | |
| 1358 | result[@backingInt(Feature.offset_3f_bug)] = .{ | |
| 1359 | 1359 | .llvm_name = "offset-3f-bug", |
| 1360 | 1360 | .description = "Branch offset of 3f hardware bug", |
| 1361 | 1361 | .dependencies = featureSet(&[_]Feature{}), |
| 1362 | 1362 | }; |
| 1363 | result[@intFromEnum(Feature.packed_fp32_ops)] = .{ | |
| 1363 | result[@backingInt(Feature.packed_fp32_ops)] = .{ | |
| 1364 | 1364 | .llvm_name = "packed-fp32-ops", |
| 1365 | 1365 | .description = "Support packed fp32 instructions", |
| 1366 | 1366 | .dependencies = featureSet(&[_]Feature{}), |
| 1367 | 1367 | }; |
| 1368 | result[@intFromEnum(Feature.packed_tid)] = .{ | |
| 1368 | result[@backingInt(Feature.packed_tid)] = .{ | |
| 1369 | 1369 | .llvm_name = "packed-tid", |
| 1370 | 1370 | .description = "Workitem IDs are packed into v0 at kernel launch", |
| 1371 | 1371 | .dependencies = featureSet(&[_]Feature{}), |
| 1372 | 1372 | }; |
| 1373 | result[@intFromEnum(Feature.partial_nsa_encoding)] = .{ | |
| 1373 | result[@backingInt(Feature.partial_nsa_encoding)] = .{ | |
| 1374 | 1374 | .llvm_name = "partial-nsa-encoding", |
| 1375 | 1375 | .description = "Support partial NSA encoding for image instructions", |
| 1376 | 1376 | .dependencies = featureSet(&[_]Feature{}), |
| 1377 | 1377 | }; |
| 1378 | result[@intFromEnum(Feature.permlane16_swap)] = .{ | |
| 1378 | result[@backingInt(Feature.permlane16_swap)] = .{ | |
| 1379 | 1379 | .llvm_name = "permlane16-swap", |
| 1380 | 1380 | .description = "Has v_permlane16_swap_b32 instructions", |
| 1381 | 1381 | .dependencies = featureSet(&[_]Feature{}), |
| 1382 | 1382 | }; |
| 1383 | result[@intFromEnum(Feature.permlane32_swap)] = .{ | |
| 1383 | result[@backingInt(Feature.permlane32_swap)] = .{ | |
| 1384 | 1384 | .llvm_name = "permlane32-swap", |
| 1385 | 1385 | .description = "Has v_permlane32_swap_b32 instructions", |
| 1386 | 1386 | .dependencies = featureSet(&[_]Feature{}), |
| 1387 | 1387 | }; |
| 1388 | result[@intFromEnum(Feature.pk_add_min_max_insts)] = .{ | |
| 1388 | result[@backingInt(Feature.pk_add_min_max_insts)] = .{ | |
| 1389 | 1389 | .llvm_name = "pk-add-min-max-insts", |
| 1390 | 1390 | .description = "Has v_pk_add_{min|max}_{i|u}16 instructions", |
| 1391 | 1391 | .dependencies = featureSet(&[_]Feature{}), |
| 1392 | 1392 | }; |
| 1393 | result[@intFromEnum(Feature.pk_fmac_f16_inst)] = .{ | |
| 1393 | result[@backingInt(Feature.pk_fmac_f16_inst)] = .{ | |
| 1394 | 1394 | .llvm_name = "pk-fmac-f16-inst", |
| 1395 | 1395 | .description = "Has v_pk_fmac_f16 instruction", |
| 1396 | 1396 | .dependencies = featureSet(&[_]Feature{}), |
| 1397 | 1397 | }; |
| 1398 | result[@intFromEnum(Feature.point_sample_accel)] = .{ | |
| 1398 | result[@backingInt(Feature.point_sample_accel)] = .{ | |
| 1399 | 1399 | .llvm_name = "point-sample-accel", |
| 1400 | 1400 | .description = "Has point sample acceleration feature", |
| 1401 | 1401 | .dependencies = featureSet(&[_]Feature{}), |
| 1402 | 1402 | }; |
| 1403 | result[@intFromEnum(Feature.precise_memory)] = .{ | |
| 1403 | result[@backingInt(Feature.precise_memory)] = .{ | |
| 1404 | 1404 | .llvm_name = "precise-memory", |
| 1405 | 1405 | .description = "Enable precise memory mode", |
| 1406 | 1406 | .dependencies = featureSet(&[_]Feature{}), |
| 1407 | 1407 | }; |
| 1408 | result[@intFromEnum(Feature.priv_enabled_trap2_nop_bug)] = .{ | |
| 1408 | result[@backingInt(Feature.priv_enabled_trap2_nop_bug)] = .{ | |
| 1409 | 1409 | .llvm_name = "priv-enabled-trap2-nop-bug", |
| 1410 | 1410 | .description = "Hardware that runs with PRIV=1 interpreting 's_trap 2' as a nop bug", |
| 1411 | 1411 | .dependencies = featureSet(&[_]Feature{}), |
| 1412 | 1412 | }; |
| 1413 | result[@intFromEnum(Feature.prng_inst)] = .{ | |
| 1413 | result[@backingInt(Feature.prng_inst)] = .{ | |
| 1414 | 1414 | .llvm_name = "prng-inst", |
| 1415 | 1415 | .description = "Has v_prng_b32 instruction", |
| 1416 | 1416 | .dependencies = featureSet(&[_]Feature{}), |
| 1417 | 1417 | }; |
| 1418 | result[@intFromEnum(Feature.promote_alloca)] = .{ | |
| 1418 | result[@backingInt(Feature.promote_alloca)] = .{ | |
| 1419 | 1419 | .llvm_name = "promote-alloca", |
| 1420 | 1420 | .description = "Enable promote alloca pass", |
| 1421 | 1421 | .dependencies = featureSet(&[_]Feature{}), |
| 1422 | 1422 | }; |
| 1423 | result[@intFromEnum(Feature.prt_strict_null)] = .{ | |
| 1423 | result[@backingInt(Feature.prt_strict_null)] = .{ | |
| 1424 | 1424 | .llvm_name = "enable-prt-strict-null", |
| 1425 | 1425 | .description = "Enable zeroing of result registers for sparse texture fetches", |
| 1426 | 1426 | .dependencies = featureSet(&[_]Feature{}), |
| 1427 | 1427 | }; |
| 1428 | result[@intFromEnum(Feature.pseudo_scalar_trans)] = .{ | |
| 1428 | result[@backingInt(Feature.pseudo_scalar_trans)] = .{ | |
| 1429 | 1429 | .llvm_name = "pseudo-scalar-trans", |
| 1430 | 1430 | .description = "Has Pseudo Scalar Transcendental instructions", |
| 1431 | 1431 | .dependencies = featureSet(&[_]Feature{}), |
| 1432 | 1432 | }; |
| 1433 | result[@intFromEnum(Feature.qsad_insts)] = .{ | |
| 1433 | result[@backingInt(Feature.qsad_insts)] = .{ | |
| 1434 | 1434 | .llvm_name = "qsad-insts", |
| 1435 | 1435 | .description = "Has v_qsad* instructions", |
| 1436 | 1436 | .dependencies = featureSet(&[_]Feature{}), |
| 1437 | 1437 | }; |
| 1438 | result[@intFromEnum(Feature.r128_a16)] = .{ | |
| 1438 | result[@backingInt(Feature.r128_a16)] = .{ | |
| 1439 | 1439 | .llvm_name = "r128-a16", |
| 1440 | 1440 | .description = "Support gfx9-style A16 for 16-bit coordinates/gradients/lod/clamp/mip image operands, where a16 is aliased with r128", |
| 1441 | 1441 | .dependencies = featureSet(&[_]Feature{}), |
| 1442 | 1442 | }; |
| 1443 | result[@intFromEnum(Feature.real_true16)] = .{ | |
| 1443 | result[@backingInt(Feature.real_true16)] = .{ | |
| 1444 | 1444 | .llvm_name = "real-true16", |
| 1445 | 1445 | .description = "Use true 16-bit registers", |
| 1446 | 1446 | .dependencies = featureSet(&[_]Feature{}), |
| 1447 | 1447 | }; |
| 1448 | result[@intFromEnum(Feature.relaxed_buffer_oob_mode)] = .{ | |
| 1448 | result[@backingInt(Feature.relaxed_buffer_oob_mode)] = .{ | |
| 1449 | 1449 | .llvm_name = "relaxed-buffer-oob-mode", |
| 1450 | 1450 | .description = "Disable strict out-of-bounds buffer guarantees. An OOB access may potentially cause an adjacent access to be treated as if it were also OOB", |
| 1451 | 1451 | .dependencies = featureSet(&[_]Feature{}), |
| 1452 | 1452 | }; |
| 1453 | result[@intFromEnum(Feature.required_export_priority)] = .{ | |
| 1453 | result[@backingInt(Feature.required_export_priority)] = .{ | |
| 1454 | 1454 | .llvm_name = "required-export-priority", |
| 1455 | 1455 | .description = "Export priority must be explicitly manipulated on GFX11.5", |
| 1456 | 1456 | .dependencies = featureSet(&[_]Feature{}), |
| 1457 | 1457 | }; |
| 1458 | result[@intFromEnum(Feature.requires_cov6)] = .{ | |
| 1458 | result[@backingInt(Feature.requires_cov6)] = .{ | |
| 1459 | 1459 | .llvm_name = "requires-cov6", |
| 1460 | 1460 | .description = "Target Requires Code Object V6", |
| 1461 | 1461 | .dependencies = featureSet(&[_]Feature{}), |
| 1462 | 1462 | }; |
| 1463 | result[@intFromEnum(Feature.restricted_soffset)] = .{ | |
| 1463 | result[@backingInt(Feature.restricted_soffset)] = .{ | |
| 1464 | 1464 | .llvm_name = "restricted-soffset", |
| 1465 | 1465 | .description = "Has restricted SOffset (immediate not supported).", |
| 1466 | 1466 | .dependencies = featureSet(&[_]Feature{}), |
| 1467 | 1467 | }; |
| 1468 | result[@intFromEnum(Feature.s_memrealtime)] = .{ | |
| 1468 | result[@backingInt(Feature.s_memrealtime)] = .{ | |
| 1469 | 1469 | .llvm_name = "s-memrealtime", |
| 1470 | 1470 | .description = "Has s_memrealtime instruction", |
| 1471 | 1471 | .dependencies = featureSet(&[_]Feature{}), |
| 1472 | 1472 | }; |
| 1473 | result[@intFromEnum(Feature.s_memtime_inst)] = .{ | |
| 1473 | result[@backingInt(Feature.s_memtime_inst)] = .{ | |
| 1474 | 1474 | .llvm_name = "s-memtime-inst", |
| 1475 | 1475 | .description = "Has s_memtime instruction", |
| 1476 | 1476 | .dependencies = featureSet(&[_]Feature{}), |
| 1477 | 1477 | }; |
| 1478 | result[@intFromEnum(Feature.s_wakeup_barrier_inst)] = .{ | |
| 1478 | result[@backingInt(Feature.s_wakeup_barrier_inst)] = .{ | |
| 1479 | 1479 | .llvm_name = "s-wakeup-barrier-inst", |
| 1480 | 1480 | .description = "Has s_wakeup_barrier instruction.", |
| 1481 | 1481 | .dependencies = featureSet(&[_]Feature{}), |
| 1482 | 1482 | }; |
| 1483 | result[@intFromEnum(Feature.sad_insts)] = .{ | |
| 1483 | result[@backingInt(Feature.sad_insts)] = .{ | |
| 1484 | 1484 | .llvm_name = "sad-insts", |
| 1485 | 1485 | .description = "Has v_sad* instructions", |
| 1486 | 1486 | .dependencies = featureSet(&[_]Feature{}), |
| 1487 | 1487 | }; |
| 1488 | result[@intFromEnum(Feature.safe_cu_prefetch)] = .{ | |
| 1488 | result[@backingInt(Feature.safe_cu_prefetch)] = .{ | |
| 1489 | 1489 | .llvm_name = "safe-cu-prefetch", |
| 1490 | 1490 | .description = "VMEM CU scope prefetches do not fail on illegal address", |
| 1491 | 1491 | .dependencies = featureSet(&[_]Feature{}), |
| 1492 | 1492 | }; |
| 1493 | result[@intFromEnum(Feature.safe_smem_prefetch)] = .{ | |
| 1493 | result[@backingInt(Feature.safe_smem_prefetch)] = .{ | |
| 1494 | 1494 | .llvm_name = "safe-smem-prefetch", |
| 1495 | 1495 | .description = "SMEM prefetches do not fail on illegal address", |
| 1496 | 1496 | .dependencies = featureSet(&[_]Feature{}), |
| 1497 | 1497 | }; |
| 1498 | result[@intFromEnum(Feature.salu_float)] = .{ | |
| 1498 | result[@backingInt(Feature.salu_float)] = .{ | |
| 1499 | 1499 | .llvm_name = "salu-float", |
| 1500 | 1500 | .description = "Has SALU floating point instructions", |
| 1501 | 1501 | .dependencies = featureSet(&[_]Feature{}), |
| 1502 | 1502 | }; |
| 1503 | result[@intFromEnum(Feature.scalar_atomics)] = .{ | |
| 1503 | result[@backingInt(Feature.scalar_atomics)] = .{ | |
| 1504 | 1504 | .llvm_name = "scalar-atomics", |
| 1505 | 1505 | .description = "Has atomic scalar memory instructions", |
| 1506 | 1506 | .dependencies = featureSet(&[_]Feature{}), |
| 1507 | 1507 | }; |
| 1508 | result[@intFromEnum(Feature.scalar_dwordx3_loads)] = .{ | |
| 1508 | result[@backingInt(Feature.scalar_dwordx3_loads)] = .{ | |
| 1509 | 1509 | .llvm_name = "scalar-dwordx3-loads", |
| 1510 | 1510 | .description = "Has 96-bit scalar load instructions", |
| 1511 | 1511 | .dependencies = featureSet(&[_]Feature{}), |
| 1512 | 1512 | }; |
| 1513 | result[@intFromEnum(Feature.scalar_flat_scratch_insts)] = .{ | |
| 1513 | result[@backingInt(Feature.scalar_flat_scratch_insts)] = .{ | |
| 1514 | 1514 | .llvm_name = "scalar-flat-scratch-insts", |
| 1515 | 1515 | .description = "Have s_scratch_* flat memory instructions", |
| 1516 | 1516 | .dependencies = featureSet(&[_]Feature{}), |
| 1517 | 1517 | }; |
| 1518 | result[@intFromEnum(Feature.scalar_stores)] = .{ | |
| 1518 | result[@backingInt(Feature.scalar_stores)] = .{ | |
| 1519 | 1519 | .llvm_name = "scalar-stores", |
| 1520 | 1520 | .description = "Has store scalar memory instructions", |
| 1521 | 1521 | .dependencies = featureSet(&[_]Feature{}), |
| 1522 | 1522 | }; |
| 1523 | result[@intFromEnum(Feature.sdwa)] = .{ | |
| 1523 | result[@backingInt(Feature.sdwa)] = .{ | |
| 1524 | 1524 | .llvm_name = "sdwa", |
| 1525 | 1525 | .description = "Support SDWA (Sub-DWORD Addressing) extension", |
| 1526 | 1526 | .dependencies = featureSet(&[_]Feature{}), |
| 1527 | 1527 | }; |
| 1528 | result[@intFromEnum(Feature.sdwa_mav)] = .{ | |
| 1528 | result[@backingInt(Feature.sdwa_mav)] = .{ | |
| 1529 | 1529 | .llvm_name = "sdwa-mav", |
| 1530 | 1530 | .description = "Support v_mac_f32/f16 with SDWA (Sub-DWORD Addressing) extension", |
| 1531 | 1531 | .dependencies = featureSet(&[_]Feature{}), |
| 1532 | 1532 | }; |
| 1533 | result[@intFromEnum(Feature.sdwa_omod)] = .{ | |
| 1533 | result[@backingInt(Feature.sdwa_omod)] = .{ | |
| 1534 | 1534 | .llvm_name = "sdwa-omod", |
| 1535 | 1535 | .description = "Support OMod with SDWA (Sub-DWORD Addressing) extension", |
| 1536 | 1536 | .dependencies = featureSet(&[_]Feature{}), |
| 1537 | 1537 | }; |
| 1538 | result[@intFromEnum(Feature.sdwa_out_mods_vopc)] = .{ | |
| 1538 | result[@backingInt(Feature.sdwa_out_mods_vopc)] = .{ | |
| 1539 | 1539 | .llvm_name = "sdwa-out-mods-vopc", |
| 1540 | 1540 | .description = "Support clamp for VOPC with SDWA (Sub-DWORD Addressing) extension", |
| 1541 | 1541 | .dependencies = featureSet(&[_]Feature{}), |
| 1542 | 1542 | }; |
| 1543 | result[@intFromEnum(Feature.sdwa_scalar)] = .{ | |
| 1543 | result[@backingInt(Feature.sdwa_scalar)] = .{ | |
| 1544 | 1544 | .llvm_name = "sdwa-scalar", |
| 1545 | 1545 | .description = "Support scalar register with SDWA (Sub-DWORD Addressing) extension", |
| 1546 | 1546 | .dependencies = featureSet(&[_]Feature{}), |
| 1547 | 1547 | }; |
| 1548 | result[@intFromEnum(Feature.sdwa_sdst)] = .{ | |
| 1548 | result[@backingInt(Feature.sdwa_sdst)] = .{ | |
| 1549 | 1549 | .llvm_name = "sdwa-sdst", |
| 1550 | 1550 | .description = "Support scalar dst for VOPC with SDWA (Sub-DWORD Addressing) extension", |
| 1551 | 1551 | .dependencies = featureSet(&[_]Feature{}), |
| 1552 | 1552 | }; |
| 1553 | result[@intFromEnum(Feature.sea_islands)] = .{ | |
| 1553 | result[@backingInt(Feature.sea_islands)] = .{ | |
| 1554 | 1554 | .llvm_name = "sea-islands", |
| 1555 | 1555 | .description = "SEA_ISLANDS GPU generation", |
| 1556 | 1556 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1583,42 +1583,42 @@ pub const all_features = blk: { |
| 1583 | 1583 | .wavefrontsize64, |
| 1584 | 1584 | }), |
| 1585 | 1585 | }; |
| 1586 | result[@intFromEnum(Feature.setprio_inc_wg_inst)] = .{ | |
| 1586 | result[@backingInt(Feature.setprio_inc_wg_inst)] = .{ | |
| 1587 | 1587 | .llvm_name = "setprio-inc-wg-inst", |
| 1588 | 1588 | .description = "Has s_setprio_inc_wg instruction.", |
| 1589 | 1589 | .dependencies = featureSet(&[_]Feature{}), |
| 1590 | 1590 | }; |
| 1591 | result[@intFromEnum(Feature.setreg_vgpr_msb_fixup)] = .{ | |
| 1591 | result[@backingInt(Feature.setreg_vgpr_msb_fixup)] = .{ | |
| 1592 | 1592 | .llvm_name = "setreg-vgpr-msb-fixup", |
| 1593 | 1593 | .description = "S_SETREG to MODE clobbers VGPR MSB bits, requires fixup", |
| 1594 | 1594 | .dependencies = featureSet(&[_]Feature{}), |
| 1595 | 1595 | }; |
| 1596 | result[@intFromEnum(Feature.sgpr_init_bug)] = .{ | |
| 1596 | result[@backingInt(Feature.sgpr_init_bug)] = .{ | |
| 1597 | 1597 | .llvm_name = "sgpr-init-bug", |
| 1598 | 1598 | .description = "VI SGPR initialization bug requiring a fixed SGPR allocation size", |
| 1599 | 1599 | .dependencies = featureSet(&[_]Feature{}), |
| 1600 | 1600 | }; |
| 1601 | result[@intFromEnum(Feature.shader_cycles_hi_lo_registers)] = .{ | |
| 1601 | result[@backingInt(Feature.shader_cycles_hi_lo_registers)] = .{ | |
| 1602 | 1602 | .llvm_name = "shader-cycles-hi-lo-registers", |
| 1603 | 1603 | .description = "Has SHADER_CYCLES_HI/LO hardware registers", |
| 1604 | 1604 | .dependencies = featureSet(&[_]Feature{}), |
| 1605 | 1605 | }; |
| 1606 | result[@intFromEnum(Feature.shader_cycles_register)] = .{ | |
| 1606 | result[@backingInt(Feature.shader_cycles_register)] = .{ | |
| 1607 | 1607 | .llvm_name = "shader-cycles-register", |
| 1608 | 1608 | .description = "Has SHADER_CYCLES hardware register", |
| 1609 | 1609 | .dependencies = featureSet(&[_]Feature{}), |
| 1610 | 1610 | }; |
| 1611 | result[@intFromEnum(Feature.si_scheduler)] = .{ | |
| 1611 | result[@backingInt(Feature.si_scheduler)] = .{ | |
| 1612 | 1612 | .llvm_name = "si-scheduler", |
| 1613 | 1613 | .description = "Enable SI Machine Scheduler", |
| 1614 | 1614 | .dependencies = featureSet(&[_]Feature{}), |
| 1615 | 1615 | }; |
| 1616 | result[@intFromEnum(Feature.smem_to_vector_write_hazard)] = .{ | |
| 1616 | result[@backingInt(Feature.smem_to_vector_write_hazard)] = .{ | |
| 1617 | 1617 | .llvm_name = "smem-to-vector-write-hazard", |
| 1618 | 1618 | .description = "s_load_dword followed by v_cmp page faults", |
| 1619 | 1619 | .dependencies = featureSet(&[_]Feature{}), |
| 1620 | 1620 | }; |
| 1621 | result[@intFromEnum(Feature.southern_islands)] = .{ | |
| 1621 | result[@backingInt(Feature.southern_islands)] = .{ | |
| 1622 | 1622 | .llvm_name = "southern-islands", |
| 1623 | 1623 | .description = "SOUTHERN_ISLANDS GPU generation", |
| 1624 | 1624 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1646,132 +1646,132 @@ pub const all_features = blk: { |
| 1646 | 1646 | .wavefrontsize64, |
| 1647 | 1647 | }), |
| 1648 | 1648 | }; |
| 1649 | result[@intFromEnum(Feature.sramecc)] = .{ | |
| 1649 | result[@backingInt(Feature.sramecc)] = .{ | |
| 1650 | 1650 | .llvm_name = "sramecc", |
| 1651 | 1651 | .description = "Enable SRAMECC", |
| 1652 | 1652 | .dependencies = featureSet(&[_]Feature{}), |
| 1653 | 1653 | }; |
| 1654 | result[@intFromEnum(Feature.sramecc_support)] = .{ | |
| 1654 | result[@backingInt(Feature.sramecc_support)] = .{ | |
| 1655 | 1655 | .llvm_name = "sramecc-support", |
| 1656 | 1656 | .description = "Hardware supports SRAMECC", |
| 1657 | 1657 | .dependencies = featureSet(&[_]Feature{}), |
| 1658 | 1658 | }; |
| 1659 | result[@intFromEnum(Feature.tanh_insts)] = .{ | |
| 1659 | result[@backingInt(Feature.tanh_insts)] = .{ | |
| 1660 | 1660 | .llvm_name = "tanh-insts", |
| 1661 | 1661 | .description = "Has v_tanh_f32/f16 instructions", |
| 1662 | 1662 | .dependencies = featureSet(&[_]Feature{}), |
| 1663 | 1663 | }; |
| 1664 | result[@intFromEnum(Feature.tensor_cvt_lut_insts)] = .{ | |
| 1664 | result[@backingInt(Feature.tensor_cvt_lut_insts)] = .{ | |
| 1665 | 1665 | .llvm_name = "tensor-cvt-lut-insts", |
| 1666 | 1666 | .description = "Has v_perm_pk16* instructions", |
| 1667 | 1667 | .dependencies = featureSet(&[_]Feature{}), |
| 1668 | 1668 | }; |
| 1669 | result[@intFromEnum(Feature.tgsplit)] = .{ | |
| 1669 | result[@backingInt(Feature.tgsplit)] = .{ | |
| 1670 | 1670 | .llvm_name = "tgsplit", |
| 1671 | 1671 | .description = "Enable threadgroup split execution", |
| 1672 | 1672 | .dependencies = featureSet(&[_]Feature{}), |
| 1673 | 1673 | }; |
| 1674 | result[@intFromEnum(Feature.transpose_load_f4f6_insts)] = .{ | |
| 1674 | result[@backingInt(Feature.transpose_load_f4f6_insts)] = .{ | |
| 1675 | 1675 | .llvm_name = "transpose-load-f4f6-insts", |
| 1676 | 1676 | .description = "Has ds_load_tr4/tr6 and global_load_tr4/tr6 instructions", |
| 1677 | 1677 | .dependencies = featureSet(&[_]Feature{}), |
| 1678 | 1678 | }; |
| 1679 | result[@intFromEnum(Feature.trap_handler)] = .{ | |
| 1679 | result[@backingInt(Feature.trap_handler)] = .{ | |
| 1680 | 1680 | .llvm_name = "trap-handler", |
| 1681 | 1681 | .description = "Trap handler support", |
| 1682 | 1682 | .dependencies = featureSet(&[_]Feature{}), |
| 1683 | 1683 | }; |
| 1684 | result[@intFromEnum(Feature.trig_reduced_range)] = .{ | |
| 1684 | result[@backingInt(Feature.trig_reduced_range)] = .{ | |
| 1685 | 1685 | .llvm_name = "trig-reduced-range", |
| 1686 | 1686 | .description = "Requires use of fract on arguments to trig instructions", |
| 1687 | 1687 | .dependencies = featureSet(&[_]Feature{}), |
| 1688 | 1688 | }; |
| 1689 | result[@intFromEnum(Feature.true16)] = .{ | |
| 1689 | result[@backingInt(Feature.true16)] = .{ | |
| 1690 | 1690 | .llvm_name = "true16", |
| 1691 | 1691 | .description = "True 16-bit operand instructions", |
| 1692 | 1692 | .dependencies = featureSet(&[_]Feature{}), |
| 1693 | 1693 | }; |
| 1694 | result[@intFromEnum(Feature.unaligned_access_mode)] = .{ | |
| 1694 | result[@backingInt(Feature.unaligned_access_mode)] = .{ | |
| 1695 | 1695 | .llvm_name = "unaligned-access-mode", |
| 1696 | 1696 | .description = "Enable unaligned global, local and region loads and stores if the hardware supports it", |
| 1697 | 1697 | .dependencies = featureSet(&[_]Feature{}), |
| 1698 | 1698 | }; |
| 1699 | result[@intFromEnum(Feature.unaligned_buffer_access)] = .{ | |
| 1699 | result[@backingInt(Feature.unaligned_buffer_access)] = .{ | |
| 1700 | 1700 | .llvm_name = "unaligned-buffer-access", |
| 1701 | 1701 | .description = "Hardware supports unaligned global loads and stores", |
| 1702 | 1702 | .dependencies = featureSet(&[_]Feature{}), |
| 1703 | 1703 | }; |
| 1704 | result[@intFromEnum(Feature.unaligned_ds_access)] = .{ | |
| 1704 | result[@backingInt(Feature.unaligned_ds_access)] = .{ | |
| 1705 | 1705 | .llvm_name = "unaligned-ds-access", |
| 1706 | 1706 | .description = "Hardware supports unaligned local and region loads and stores", |
| 1707 | 1707 | .dependencies = featureSet(&[_]Feature{}), |
| 1708 | 1708 | }; |
| 1709 | result[@intFromEnum(Feature.unaligned_scratch_access)] = .{ | |
| 1709 | result[@backingInt(Feature.unaligned_scratch_access)] = .{ | |
| 1710 | 1710 | .llvm_name = "unaligned-scratch-access", |
| 1711 | 1711 | .description = "Support unaligned scratch loads and stores", |
| 1712 | 1712 | .dependencies = featureSet(&[_]Feature{}), |
| 1713 | 1713 | }; |
| 1714 | result[@intFromEnum(Feature.unpacked_d16_vmem)] = .{ | |
| 1714 | result[@backingInt(Feature.unpacked_d16_vmem)] = .{ | |
| 1715 | 1715 | .llvm_name = "unpacked-d16-vmem", |
| 1716 | 1716 | .description = "Has unpacked d16 vmem instructions", |
| 1717 | 1717 | .dependencies = featureSet(&[_]Feature{}), |
| 1718 | 1718 | }; |
| 1719 | result[@intFromEnum(Feature.unsafe_ds_offset_folding)] = .{ | |
| 1719 | result[@backingInt(Feature.unsafe_ds_offset_folding)] = .{ | |
| 1720 | 1720 | .llvm_name = "unsafe-ds-offset-folding", |
| 1721 | 1721 | .description = "Force using DS instruction immediate offsets on SI", |
| 1722 | 1722 | .dependencies = featureSet(&[_]Feature{}), |
| 1723 | 1723 | }; |
| 1724 | result[@intFromEnum(Feature.user_sgpr_init16_bug)] = .{ | |
| 1724 | result[@backingInt(Feature.user_sgpr_init16_bug)] = .{ | |
| 1725 | 1725 | .llvm_name = "user-sgpr-init16-bug", |
| 1726 | 1726 | .description = "Bug requiring at least 16 user+system SGPRs to be enabled", |
| 1727 | 1727 | .dependencies = featureSet(&[_]Feature{}), |
| 1728 | 1728 | }; |
| 1729 | result[@intFromEnum(Feature.valu_trans_use_hazard)] = .{ | |
| 1729 | result[@backingInt(Feature.valu_trans_use_hazard)] = .{ | |
| 1730 | 1730 | .llvm_name = "valu-trans-use-hazard", |
| 1731 | 1731 | .description = "Hazard when TRANS instructions are closely followed by a use of the result", |
| 1732 | 1732 | .dependencies = featureSet(&[_]Feature{}), |
| 1733 | 1733 | }; |
| 1734 | result[@intFromEnum(Feature.vcmpx_exec_war_hazard)] = .{ | |
| 1734 | result[@backingInt(Feature.vcmpx_exec_war_hazard)] = .{ | |
| 1735 | 1735 | .llvm_name = "vcmpx-exec-war-hazard", |
| 1736 | 1736 | .description = "V_CMPX WAR hazard on EXEC (V_CMPX issue ONLY)", |
| 1737 | 1737 | .dependencies = featureSet(&[_]Feature{}), |
| 1738 | 1738 | }; |
| 1739 | result[@intFromEnum(Feature.vcmpx_permlane_hazard)] = .{ | |
| 1739 | result[@backingInt(Feature.vcmpx_permlane_hazard)] = .{ | |
| 1740 | 1740 | .llvm_name = "vcmpx-permlane-hazard", |
| 1741 | 1741 | .description = "TODO: describe me", |
| 1742 | 1742 | .dependencies = featureSet(&[_]Feature{}), |
| 1743 | 1743 | }; |
| 1744 | result[@intFromEnum(Feature.vgpr_align2)] = .{ | |
| 1744 | result[@backingInt(Feature.vgpr_align2)] = .{ | |
| 1745 | 1745 | .llvm_name = "vgpr-align2", |
| 1746 | 1746 | .description = "VGPR and AGPR tuple operands require even alignment", |
| 1747 | 1747 | .dependencies = featureSet(&[_]Feature{}), |
| 1748 | 1748 | }; |
| 1749 | result[@intFromEnum(Feature.vgpr_index_mode)] = .{ | |
| 1749 | result[@backingInt(Feature.vgpr_index_mode)] = .{ | |
| 1750 | 1750 | .llvm_name = "vgpr-index-mode", |
| 1751 | 1751 | .description = "Has VGPR mode register indexing", |
| 1752 | 1752 | .dependencies = featureSet(&[_]Feature{}), |
| 1753 | 1753 | }; |
| 1754 | result[@intFromEnum(Feature.vmem_pref_insts)] = .{ | |
| 1754 | result[@backingInt(Feature.vmem_pref_insts)] = .{ | |
| 1755 | 1755 | .llvm_name = "vmem-pref-insts", |
| 1756 | 1756 | .description = "Has flat_prefect_b8 and global_prefetch_b8 instructions", |
| 1757 | 1757 | .dependencies = featureSet(&[_]Feature{}), |
| 1758 | 1758 | }; |
| 1759 | result[@intFromEnum(Feature.vmem_to_lds_load_insts)] = .{ | |
| 1759 | result[@backingInt(Feature.vmem_to_lds_load_insts)] = .{ | |
| 1760 | 1760 | .llvm_name = "vmem-to-lds-load-insts", |
| 1761 | 1761 | .description = "The platform has memory to lds instructions (global_load w/lds bit set, buffer_load w/lds bit set or global_load_lds. This does not include scratch_load_lds.", |
| 1762 | 1762 | .dependencies = featureSet(&[_]Feature{}), |
| 1763 | 1763 | }; |
| 1764 | result[@intFromEnum(Feature.vmem_to_scalar_write_hazard)] = .{ | |
| 1764 | result[@backingInt(Feature.vmem_to_scalar_write_hazard)] = .{ | |
| 1765 | 1765 | .llvm_name = "vmem-to-scalar-write-hazard", |
| 1766 | 1766 | .description = "VMEM instruction followed by scalar writing to EXEC mask, M0 or SGPR leads to incorrect execution.", |
| 1767 | 1767 | .dependencies = featureSet(&[_]Feature{}), |
| 1768 | 1768 | }; |
| 1769 | result[@intFromEnum(Feature.vmem_write_vgpr_in_order)] = .{ | |
| 1769 | result[@backingInt(Feature.vmem_write_vgpr_in_order)] = .{ | |
| 1770 | 1770 | .llvm_name = "vmem-write-vgpr-in-order", |
| 1771 | 1771 | .description = "VMEM instructions of the same type write VGPR results in order", |
| 1772 | 1772 | .dependencies = featureSet(&[_]Feature{}), |
| 1773 | 1773 | }; |
| 1774 | result[@intFromEnum(Feature.volcanic_islands)] = .{ | |
| 1774 | result[@backingInt(Feature.volcanic_islands)] = .{ | |
| 1775 | 1775 | .llvm_name = "volcanic-islands", |
| 1776 | 1776 | .description = "VOLCANIC_ISLANDS GPU generation", |
| 1777 | 1777 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1814,62 +1814,62 @@ pub const all_features = blk: { |
| 1814 | 1814 | .wavefrontsize64, |
| 1815 | 1815 | }), |
| 1816 | 1816 | }; |
| 1817 | result[@intFromEnum(Feature.vop3_literal)] = .{ | |
| 1817 | result[@backingInt(Feature.vop3_literal)] = .{ | |
| 1818 | 1818 | .llvm_name = "vop3-literal", |
| 1819 | 1819 | .description = "Can use one literal in VOP3", |
| 1820 | 1820 | .dependencies = featureSet(&[_]Feature{}), |
| 1821 | 1821 | }; |
| 1822 | result[@intFromEnum(Feature.vop3p)] = .{ | |
| 1822 | result[@backingInt(Feature.vop3p)] = .{ | |
| 1823 | 1823 | .llvm_name = "vop3p", |
| 1824 | 1824 | .description = "Has VOP3P packed instructions", |
| 1825 | 1825 | .dependencies = featureSet(&[_]Feature{}), |
| 1826 | 1826 | }; |
| 1827 | result[@intFromEnum(Feature.vopd)] = .{ | |
| 1827 | result[@backingInt(Feature.vopd)] = .{ | |
| 1828 | 1828 | .llvm_name = "vopd", |
| 1829 | 1829 | .description = "Has VOPD dual issue wave32 instructions", |
| 1830 | 1830 | .dependencies = featureSet(&[_]Feature{}), |
| 1831 | 1831 | }; |
| 1832 | result[@intFromEnum(Feature.vscnt)] = .{ | |
| 1832 | result[@backingInt(Feature.vscnt)] = .{ | |
| 1833 | 1833 | .llvm_name = "vscnt", |
| 1834 | 1834 | .description = "Has separate store vscnt counter", |
| 1835 | 1835 | .dependencies = featureSet(&[_]Feature{}), |
| 1836 | 1836 | }; |
| 1837 | result[@intFromEnum(Feature.wait_xcnt)] = .{ | |
| 1837 | result[@backingInt(Feature.wait_xcnt)] = .{ | |
| 1838 | 1838 | .llvm_name = "wait-xcnt", |
| 1839 | 1839 | .description = "Has s_wait_xcnt instruction", |
| 1840 | 1840 | .dependencies = featureSet(&[_]Feature{}), |
| 1841 | 1841 | }; |
| 1842 | result[@intFromEnum(Feature.waits_before_system_scope_stores)] = .{ | |
| 1842 | result[@backingInt(Feature.waits_before_system_scope_stores)] = .{ | |
| 1843 | 1843 | .llvm_name = "waits-before-system-scope-stores", |
| 1844 | 1844 | .description = "Target requires waits for loads and atomics before system scope stores", |
| 1845 | 1845 | .dependencies = featureSet(&[_]Feature{}), |
| 1846 | 1846 | }; |
| 1847 | result[@intFromEnum(Feature.wavefrontsize16)] = .{ | |
| 1847 | result[@backingInt(Feature.wavefrontsize16)] = .{ | |
| 1848 | 1848 | .llvm_name = "wavefrontsize16", |
| 1849 | 1849 | .description = "The number of threads per wavefront", |
| 1850 | 1850 | .dependencies = featureSet(&[_]Feature{}), |
| 1851 | 1851 | }; |
| 1852 | result[@intFromEnum(Feature.wavefrontsize32)] = .{ | |
| 1852 | result[@backingInt(Feature.wavefrontsize32)] = .{ | |
| 1853 | 1853 | .llvm_name = "wavefrontsize32", |
| 1854 | 1854 | .description = "The number of threads per wavefront", |
| 1855 | 1855 | .dependencies = featureSet(&[_]Feature{}), |
| 1856 | 1856 | }; |
| 1857 | result[@intFromEnum(Feature.wavefrontsize64)] = .{ | |
| 1857 | result[@backingInt(Feature.wavefrontsize64)] = .{ | |
| 1858 | 1858 | .llvm_name = "wavefrontsize64", |
| 1859 | 1859 | .description = "The number of threads per wavefront", |
| 1860 | 1860 | .dependencies = featureSet(&[_]Feature{}), |
| 1861 | 1861 | }; |
| 1862 | result[@intFromEnum(Feature.xf32_insts)] = .{ | |
| 1862 | result[@backingInt(Feature.xf32_insts)] = .{ | |
| 1863 | 1863 | .llvm_name = "xf32-insts", |
| 1864 | 1864 | .description = "Has instructions that support xf32 format, such as v_mfma_f32_16x16x8_xf32 and v_mfma_f32_32x32x4_xf32", |
| 1865 | 1865 | .dependencies = featureSet(&[_]Feature{}), |
| 1866 | 1866 | }; |
| 1867 | result[@intFromEnum(Feature.xnack)] = .{ | |
| 1867 | result[@backingInt(Feature.xnack)] = .{ | |
| 1868 | 1868 | .llvm_name = "xnack", |
| 1869 | 1869 | .description = "Enable XNACK support", |
| 1870 | 1870 | .dependencies = featureSet(&[_]Feature{}), |
| 1871 | 1871 | }; |
| 1872 | result[@intFromEnum(Feature.xnack_support)] = .{ | |
| 1872 | result[@backingInt(Feature.xnack_support)] = .{ | |
| 1873 | 1873 | .llvm_name = "xnack-support", |
| 1874 | 1874 | .description = "Hardware supports XNACK", |
| 1875 | 1875 | .dependencies = featureSet(&[_]Feature{}), |
lib/std/Target/arc.zig+1-1| ... | ... | @@ -17,7 +17,7 @@ pub const all_features = blk: { |
| 17 | 17 | const len = @typeInfo(Feature).@"enum".field_names.len; |
| 18 | 18 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); |
| 19 | 19 | var result: [len]CpuFeature = undefined; |
| 20 | result[@intFromEnum(Feature.norm)] = .{ | |
| 20 | result[@backingInt(Feature.norm)] = .{ | |
| 21 | 21 | .llvm_name = "norm", |
| 22 | 22 | .description = "Enable support for norm instruction.", |
| 23 | 23 | .dependencies = featureSet(&[_]Feature{}), |
lib/std/Target/arm.zig+201-201| ... | ... | @@ -218,159 +218,159 @@ pub const all_features = blk: { |
| 218 | 218 | const len = @typeInfo(Feature).@"enum".field_names.len; |
| 219 | 219 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); |
| 220 | 220 | var result: [len]CpuFeature = undefined; |
| 221 | result[@intFromEnum(Feature.@"32bit")] = .{ | |
| 221 | result[@backingInt(Feature.@"32bit")] = .{ | |
| 222 | 222 | .llvm_name = "32bit", |
| 223 | 223 | .description = "Prefer 32-bit Thumb instrs", |
| 224 | 224 | .dependencies = featureSet(&[_]Feature{}), |
| 225 | 225 | }; |
| 226 | result[@intFromEnum(Feature.@"8msecext")] = .{ | |
| 226 | result[@backingInt(Feature.@"8msecext")] = .{ | |
| 227 | 227 | .llvm_name = "8msecext", |
| 228 | 228 | .description = "Enable support for ARMv8-M Security Extensions", |
| 229 | 229 | .dependencies = featureSet(&[_]Feature{}), |
| 230 | 230 | }; |
| 231 | result[@intFromEnum(Feature.aapcs_frame_chain)] = .{ | |
| 231 | result[@backingInt(Feature.aapcs_frame_chain)] = .{ | |
| 232 | 232 | .llvm_name = "aapcs-frame-chain", |
| 233 | 233 | .description = "Create an AAPCS compliant frame chain", |
| 234 | 234 | .dependencies = featureSet(&[_]Feature{}), |
| 235 | 235 | }; |
| 236 | result[@intFromEnum(Feature.aclass)] = .{ | |
| 236 | result[@backingInt(Feature.aclass)] = .{ | |
| 237 | 237 | .llvm_name = "aclass", |
| 238 | 238 | .description = "Is application profile ('A' series)", |
| 239 | 239 | .dependencies = featureSet(&[_]Feature{}), |
| 240 | 240 | }; |
| 241 | result[@intFromEnum(Feature.acquire_release)] = .{ | |
| 241 | result[@backingInt(Feature.acquire_release)] = .{ | |
| 242 | 242 | .llvm_name = "acquire-release", |
| 243 | 243 | .description = "Has v8 acquire/release (lda/ldaex etc) instructions", |
| 244 | 244 | .dependencies = featureSet(&[_]Feature{}), |
| 245 | 245 | }; |
| 246 | result[@intFromEnum(Feature.aes)] = .{ | |
| 246 | result[@backingInt(Feature.aes)] = .{ | |
| 247 | 247 | .llvm_name = "aes", |
| 248 | 248 | .description = "Enable AES support", |
| 249 | 249 | .dependencies = featureSet(&[_]Feature{ |
| 250 | 250 | .neon, |
| 251 | 251 | }), |
| 252 | 252 | }; |
| 253 | result[@intFromEnum(Feature.atomics_32)] = .{ | |
| 253 | result[@backingInt(Feature.atomics_32)] = .{ | |
| 254 | 254 | .llvm_name = "atomics-32", |
| 255 | 255 | .description = "Assume that lock-free 32-bit atomics are available", |
| 256 | 256 | .dependencies = featureSet(&[_]Feature{}), |
| 257 | 257 | }; |
| 258 | result[@intFromEnum(Feature.avoid_movs_shop)] = .{ | |
| 258 | result[@backingInt(Feature.avoid_movs_shop)] = .{ | |
| 259 | 259 | .llvm_name = "avoid-movs-shop", |
| 260 | 260 | .description = "Avoid movs instructions with shifter operand", |
| 261 | 261 | .dependencies = featureSet(&[_]Feature{}), |
| 262 | 262 | }; |
| 263 | result[@intFromEnum(Feature.avoid_muls)] = .{ | |
| 263 | result[@backingInt(Feature.avoid_muls)] = .{ | |
| 264 | 264 | .llvm_name = "avoid-muls", |
| 265 | 265 | .description = "Avoid MULS instructions for M class cores", |
| 266 | 266 | .dependencies = featureSet(&[_]Feature{}), |
| 267 | 267 | }; |
| 268 | result[@intFromEnum(Feature.avoid_partial_cpsr)] = .{ | |
| 268 | result[@backingInt(Feature.avoid_partial_cpsr)] = .{ | |
| 269 | 269 | .llvm_name = "avoid-partial-cpsr", |
| 270 | 270 | .description = "Avoid CPSR partial update for OOO execution", |
| 271 | 271 | .dependencies = featureSet(&[_]Feature{}), |
| 272 | 272 | }; |
| 273 | result[@intFromEnum(Feature.bf16)] = .{ | |
| 273 | result[@backingInt(Feature.bf16)] = .{ | |
| 274 | 274 | .llvm_name = "bf16", |
| 275 | 275 | .description = "Enable support for BFloat16 instructions", |
| 276 | 276 | .dependencies = featureSet(&[_]Feature{ |
| 277 | 277 | .neon, |
| 278 | 278 | }), |
| 279 | 279 | }; |
| 280 | result[@intFromEnum(Feature.big_endian_instructions)] = .{ | |
| 280 | result[@backingInt(Feature.big_endian_instructions)] = .{ | |
| 281 | 281 | .llvm_name = "big-endian-instructions", |
| 282 | 282 | .description = "Expect instructions to be stored big-endian.", |
| 283 | 283 | .dependencies = featureSet(&[_]Feature{}), |
| 284 | 284 | }; |
| 285 | result[@intFromEnum(Feature.branch_align_64)] = .{ | |
| 285 | result[@backingInt(Feature.branch_align_64)] = .{ | |
| 286 | 286 | .llvm_name = "branch-align-64", |
| 287 | 287 | .description = "Prefer 64-bit alignment for branch targets", |
| 288 | 288 | .dependencies = featureSet(&[_]Feature{}), |
| 289 | 289 | }; |
| 290 | result[@intFromEnum(Feature.cde)] = .{ | |
| 290 | result[@backingInt(Feature.cde)] = .{ | |
| 291 | 291 | .llvm_name = "cde", |
| 292 | 292 | .description = "Support CDE instructions", |
| 293 | 293 | .dependencies = featureSet(&[_]Feature{ |
| 294 | 294 | .has_v8m_main, |
| 295 | 295 | }), |
| 296 | 296 | }; |
| 297 | result[@intFromEnum(Feature.cdecp0)] = .{ | |
| 297 | result[@backingInt(Feature.cdecp0)] = .{ | |
| 298 | 298 | .llvm_name = "cdecp0", |
| 299 | 299 | .description = "Coprocessor 0 ISA is CDEv1", |
| 300 | 300 | .dependencies = featureSet(&[_]Feature{ |
| 301 | 301 | .cde, |
| 302 | 302 | }), |
| 303 | 303 | }; |
| 304 | result[@intFromEnum(Feature.cdecp1)] = .{ | |
| 304 | result[@backingInt(Feature.cdecp1)] = .{ | |
| 305 | 305 | .llvm_name = "cdecp1", |
| 306 | 306 | .description = "Coprocessor 1 ISA is CDEv1", |
| 307 | 307 | .dependencies = featureSet(&[_]Feature{ |
| 308 | 308 | .cde, |
| 309 | 309 | }), |
| 310 | 310 | }; |
| 311 | result[@intFromEnum(Feature.cdecp2)] = .{ | |
| 311 | result[@backingInt(Feature.cdecp2)] = .{ | |
| 312 | 312 | .llvm_name = "cdecp2", |
| 313 | 313 | .description = "Coprocessor 2 ISA is CDEv1", |
| 314 | 314 | .dependencies = featureSet(&[_]Feature{ |
| 315 | 315 | .cde, |
| 316 | 316 | }), |
| 317 | 317 | }; |
| 318 | result[@intFromEnum(Feature.cdecp3)] = .{ | |
| 318 | result[@backingInt(Feature.cdecp3)] = .{ | |
| 319 | 319 | .llvm_name = "cdecp3", |
| 320 | 320 | .description = "Coprocessor 3 ISA is CDEv1", |
| 321 | 321 | .dependencies = featureSet(&[_]Feature{ |
| 322 | 322 | .cde, |
| 323 | 323 | }), |
| 324 | 324 | }; |
| 325 | result[@intFromEnum(Feature.cdecp4)] = .{ | |
| 325 | result[@backingInt(Feature.cdecp4)] = .{ | |
| 326 | 326 | .llvm_name = "cdecp4", |
| 327 | 327 | .description = "Coprocessor 4 ISA is CDEv1", |
| 328 | 328 | .dependencies = featureSet(&[_]Feature{ |
| 329 | 329 | .cde, |
| 330 | 330 | }), |
| 331 | 331 | }; |
| 332 | result[@intFromEnum(Feature.cdecp5)] = .{ | |
| 332 | result[@backingInt(Feature.cdecp5)] = .{ | |
| 333 | 333 | .llvm_name = "cdecp5", |
| 334 | 334 | .description = "Coprocessor 5 ISA is CDEv1", |
| 335 | 335 | .dependencies = featureSet(&[_]Feature{ |
| 336 | 336 | .cde, |
| 337 | 337 | }), |
| 338 | 338 | }; |
| 339 | result[@intFromEnum(Feature.cdecp6)] = .{ | |
| 339 | result[@backingInt(Feature.cdecp6)] = .{ | |
| 340 | 340 | .llvm_name = "cdecp6", |
| 341 | 341 | .description = "Coprocessor 6 ISA is CDEv1", |
| 342 | 342 | .dependencies = featureSet(&[_]Feature{ |
| 343 | 343 | .cde, |
| 344 | 344 | }), |
| 345 | 345 | }; |
| 346 | result[@intFromEnum(Feature.cdecp7)] = .{ | |
| 346 | result[@backingInt(Feature.cdecp7)] = .{ | |
| 347 | 347 | .llvm_name = "cdecp7", |
| 348 | 348 | .description = "Coprocessor 7 ISA is CDEv1", |
| 349 | 349 | .dependencies = featureSet(&[_]Feature{ |
| 350 | 350 | .cde, |
| 351 | 351 | }), |
| 352 | 352 | }; |
| 353 | result[@intFromEnum(Feature.cheap_predicable_cpsr)] = .{ | |
| 353 | result[@backingInt(Feature.cheap_predicable_cpsr)] = .{ | |
| 354 | 354 | .llvm_name = "cheap-predicable-cpsr", |
| 355 | 355 | .description = "Disable +1 predication cost for instructions updating CPSR", |
| 356 | 356 | .dependencies = featureSet(&[_]Feature{}), |
| 357 | 357 | }; |
| 358 | result[@intFromEnum(Feature.clrbhb)] = .{ | |
| 358 | result[@backingInt(Feature.clrbhb)] = .{ | |
| 359 | 359 | .llvm_name = "clrbhb", |
| 360 | 360 | .description = "Enable Clear BHB instruction", |
| 361 | 361 | .dependencies = featureSet(&[_]Feature{}), |
| 362 | 362 | }; |
| 363 | result[@intFromEnum(Feature.cortex_a510)] = .{ | |
| 363 | result[@backingInt(Feature.cortex_a510)] = .{ | |
| 364 | 364 | .llvm_name = "cortex-a510", |
| 365 | 365 | .description = "Cortex-A510 ARM processors", |
| 366 | 366 | .dependencies = featureSet(&[_]Feature{}), |
| 367 | 367 | }; |
| 368 | result[@intFromEnum(Feature.crc)] = .{ | |
| 368 | result[@backingInt(Feature.crc)] = .{ | |
| 369 | 369 | .llvm_name = "crc", |
| 370 | 370 | .description = "Enable support for CRC instructions", |
| 371 | 371 | .dependencies = featureSet(&[_]Feature{}), |
| 372 | 372 | }; |
| 373 | result[@intFromEnum(Feature.crypto)] = .{ | |
| 373 | result[@backingInt(Feature.crypto)] = .{ | |
| 374 | 374 | .llvm_name = "crypto", |
| 375 | 375 | .description = "Enable support for Cryptography extensions", |
| 376 | 376 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -378,83 +378,83 @@ pub const all_features = blk: { |
| 378 | 378 | .sha2, |
| 379 | 379 | }), |
| 380 | 380 | }; |
| 381 | result[@intFromEnum(Feature.d32)] = .{ | |
| 381 | result[@backingInt(Feature.d32)] = .{ | |
| 382 | 382 | .llvm_name = "d32", |
| 383 | 383 | .description = "Extend FP to 32 double registers", |
| 384 | 384 | .dependencies = featureSet(&[_]Feature{}), |
| 385 | 385 | }; |
| 386 | result[@intFromEnum(Feature.db)] = .{ | |
| 386 | result[@backingInt(Feature.db)] = .{ | |
| 387 | 387 | .llvm_name = "db", |
| 388 | 388 | .description = "Has data barrier (dmb/dsb) instructions", |
| 389 | 389 | .dependencies = featureSet(&[_]Feature{}), |
| 390 | 390 | }; |
| 391 | result[@intFromEnum(Feature.dfb)] = .{ | |
| 391 | result[@backingInt(Feature.dfb)] = .{ | |
| 392 | 392 | .llvm_name = "dfb", |
| 393 | 393 | .description = "Has full data barrier (dfb) instruction", |
| 394 | 394 | .dependencies = featureSet(&[_]Feature{}), |
| 395 | 395 | }; |
| 396 | result[@intFromEnum(Feature.disable_postra_scheduler)] = .{ | |
| 396 | result[@backingInt(Feature.disable_postra_scheduler)] = .{ | |
| 397 | 397 | .llvm_name = "disable-postra-scheduler", |
| 398 | 398 | .description = "Don't schedule again after register allocation", |
| 399 | 399 | .dependencies = featureSet(&[_]Feature{}), |
| 400 | 400 | }; |
| 401 | result[@intFromEnum(Feature.dont_widen_vmovs)] = .{ | |
| 401 | result[@backingInt(Feature.dont_widen_vmovs)] = .{ | |
| 402 | 402 | .llvm_name = "dont-widen-vmovs", |
| 403 | 403 | .description = "Don't widen VMOVS to VMOVD", |
| 404 | 404 | .dependencies = featureSet(&[_]Feature{}), |
| 405 | 405 | }; |
| 406 | result[@intFromEnum(Feature.dotprod)] = .{ | |
| 406 | result[@backingInt(Feature.dotprod)] = .{ | |
| 407 | 407 | .llvm_name = "dotprod", |
| 408 | 408 | .description = "Enable support for dot product instructions", |
| 409 | 409 | .dependencies = featureSet(&[_]Feature{ |
| 410 | 410 | .neon, |
| 411 | 411 | }), |
| 412 | 412 | }; |
| 413 | result[@intFromEnum(Feature.dsp)] = .{ | |
| 413 | result[@backingInt(Feature.dsp)] = .{ | |
| 414 | 414 | .llvm_name = "dsp", |
| 415 | 415 | .description = "Supports DSP instructions in ARM and/or Thumb2", |
| 416 | 416 | .dependencies = featureSet(&[_]Feature{}), |
| 417 | 417 | }; |
| 418 | result[@intFromEnum(Feature.execute_only)] = .{ | |
| 418 | result[@backingInt(Feature.execute_only)] = .{ | |
| 419 | 419 | .llvm_name = "execute-only", |
| 420 | 420 | .description = "Enable the generation of execute only code.", |
| 421 | 421 | .dependencies = featureSet(&[_]Feature{}), |
| 422 | 422 | }; |
| 423 | result[@intFromEnum(Feature.expand_fp_mlx)] = .{ | |
| 423 | result[@backingInt(Feature.expand_fp_mlx)] = .{ | |
| 424 | 424 | .llvm_name = "expand-fp-mlx", |
| 425 | 425 | .description = "Expand VFP/NEON MLA/MLS instructions", |
| 426 | 426 | .dependencies = featureSet(&[_]Feature{}), |
| 427 | 427 | }; |
| 428 | result[@intFromEnum(Feature.fix_cmse_cve_2021_35465)] = .{ | |
| 428 | result[@backingInt(Feature.fix_cmse_cve_2021_35465)] = .{ | |
| 429 | 429 | .llvm_name = "fix-cmse-cve-2021-35465", |
| 430 | 430 | .description = "Mitigate against the cve-2021-35465 security vulnurability", |
| 431 | 431 | .dependencies = featureSet(&[_]Feature{}), |
| 432 | 432 | }; |
| 433 | result[@intFromEnum(Feature.fix_cortex_a57_aes_1742098)] = .{ | |
| 433 | result[@backingInt(Feature.fix_cortex_a57_aes_1742098)] = .{ | |
| 434 | 434 | .llvm_name = "fix-cortex-a57-aes-1742098", |
| 435 | 435 | .description = "Work around Cortex-A57 Erratum 1742098 / Cortex-A72 Erratum 1655431 (AES)", |
| 436 | 436 | .dependencies = featureSet(&[_]Feature{}), |
| 437 | 437 | }; |
| 438 | result[@intFromEnum(Feature.fp16)] = .{ | |
| 438 | result[@backingInt(Feature.fp16)] = .{ | |
| 439 | 439 | .llvm_name = "fp16", |
| 440 | 440 | .description = "Enable half-precision floating point", |
| 441 | 441 | .dependencies = featureSet(&[_]Feature{}), |
| 442 | 442 | }; |
| 443 | result[@intFromEnum(Feature.fp16fml)] = .{ | |
| 443 | result[@backingInt(Feature.fp16fml)] = .{ | |
| 444 | 444 | .llvm_name = "fp16fml", |
| 445 | 445 | .description = "Enable full half-precision floating point fml instructions", |
| 446 | 446 | .dependencies = featureSet(&[_]Feature{ |
| 447 | 447 | .fullfp16, |
| 448 | 448 | }), |
| 449 | 449 | }; |
| 450 | result[@intFromEnum(Feature.fp64)] = .{ | |
| 450 | result[@backingInt(Feature.fp64)] = .{ | |
| 451 | 451 | .llvm_name = "fp64", |
| 452 | 452 | .description = "Floating point unit supports double precision", |
| 453 | 453 | .dependencies = featureSet(&[_]Feature{ |
| 454 | 454 | .fpregs64, |
| 455 | 455 | }), |
| 456 | 456 | }; |
| 457 | result[@intFromEnum(Feature.fp_armv8)] = .{ | |
| 457 | result[@backingInt(Feature.fp_armv8)] = .{ | |
| 458 | 458 | .llvm_name = "fp-armv8", |
| 459 | 459 | .description = "Enable ARMv8 FP", |
| 460 | 460 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -463,7 +463,7 @@ pub const all_features = blk: { |
| 463 | 463 | .vfp4, |
| 464 | 464 | }), |
| 465 | 465 | }; |
| 466 | result[@intFromEnum(Feature.fp_armv8d16)] = .{ | |
| 466 | result[@backingInt(Feature.fp_armv8d16)] = .{ | |
| 467 | 467 | .llvm_name = "fp-armv8d16", |
| 468 | 468 | .description = "Enable ARMv8 FP with only 16 d-registers", |
| 469 | 469 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -471,14 +471,14 @@ pub const all_features = blk: { |
| 471 | 471 | .vfp4d16, |
| 472 | 472 | }), |
| 473 | 473 | }; |
| 474 | result[@intFromEnum(Feature.fp_armv8d16sp)] = .{ | |
| 474 | result[@backingInt(Feature.fp_armv8d16sp)] = .{ | |
| 475 | 475 | .llvm_name = "fp-armv8d16sp", |
| 476 | 476 | .description = "Enable ARMv8 FP with only 16 d-registers and no double precision", |
| 477 | 477 | .dependencies = featureSet(&[_]Feature{ |
| 478 | 478 | .vfp4d16sp, |
| 479 | 479 | }), |
| 480 | 480 | }; |
| 481 | result[@intFromEnum(Feature.fp_armv8sp)] = .{ | |
| 481 | result[@backingInt(Feature.fp_armv8sp)] = .{ | |
| 482 | 482 | .llvm_name = "fp-armv8sp", |
| 483 | 483 | .description = "Enable ARMv8 FP with no double precision", |
| 484 | 484 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -486,31 +486,31 @@ pub const all_features = blk: { |
| 486 | 486 | .vfp4sp, |
| 487 | 487 | }), |
| 488 | 488 | }; |
| 489 | result[@intFromEnum(Feature.fpao)] = .{ | |
| 489 | result[@backingInt(Feature.fpao)] = .{ | |
| 490 | 490 | .llvm_name = "fpao", |
| 491 | 491 | .description = "Enable fast computation of positive address offsets", |
| 492 | 492 | .dependencies = featureSet(&[_]Feature{}), |
| 493 | 493 | }; |
| 494 | result[@intFromEnum(Feature.fpregs)] = .{ | |
| 494 | result[@backingInt(Feature.fpregs)] = .{ | |
| 495 | 495 | .llvm_name = "fpregs", |
| 496 | 496 | .description = "Enable FP registers", |
| 497 | 497 | .dependencies = featureSet(&[_]Feature{}), |
| 498 | 498 | }; |
| 499 | result[@intFromEnum(Feature.fpregs16)] = .{ | |
| 499 | result[@backingInt(Feature.fpregs16)] = .{ | |
| 500 | 500 | .llvm_name = "fpregs16", |
| 501 | 501 | .description = "Enable 16-bit FP registers", |
| 502 | 502 | .dependencies = featureSet(&[_]Feature{ |
| 503 | 503 | .fpregs, |
| 504 | 504 | }), |
| 505 | 505 | }; |
| 506 | result[@intFromEnum(Feature.fpregs64)] = .{ | |
| 506 | result[@backingInt(Feature.fpregs64)] = .{ | |
| 507 | 507 | .llvm_name = "fpregs64", |
| 508 | 508 | .description = "Enable 64-bit FP registers", |
| 509 | 509 | .dependencies = featureSet(&[_]Feature{ |
| 510 | 510 | .fpregs, |
| 511 | 511 | }), |
| 512 | 512 | }; |
| 513 | result[@intFromEnum(Feature.fullfp16)] = .{ | |
| 513 | result[@backingInt(Feature.fullfp16)] = .{ | |
| 514 | 514 | .llvm_name = "fullfp16", |
| 515 | 515 | .description = "Enable full half-precision floating point", |
| 516 | 516 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -518,72 +518,72 @@ pub const all_features = blk: { |
| 518 | 518 | .fpregs16, |
| 519 | 519 | }), |
| 520 | 520 | }; |
| 521 | result[@intFromEnum(Feature.fuse_aes)] = .{ | |
| 521 | result[@backingInt(Feature.fuse_aes)] = .{ | |
| 522 | 522 | .llvm_name = "fuse-aes", |
| 523 | 523 | .description = "CPU fuses AES crypto operations", |
| 524 | 524 | .dependencies = featureSet(&[_]Feature{}), |
| 525 | 525 | }; |
| 526 | result[@intFromEnum(Feature.fuse_literals)] = .{ | |
| 526 | result[@backingInt(Feature.fuse_literals)] = .{ | |
| 527 | 527 | .llvm_name = "fuse-literals", |
| 528 | 528 | .description = "CPU fuses literal generation operations", |
| 529 | 529 | .dependencies = featureSet(&[_]Feature{}), |
| 530 | 530 | }; |
| 531 | result[@intFromEnum(Feature.harden_sls_blr)] = .{ | |
| 531 | result[@backingInt(Feature.harden_sls_blr)] = .{ | |
| 532 | 532 | .llvm_name = "harden-sls-blr", |
| 533 | 533 | .description = "Harden against straight line speculation across indirect calls", |
| 534 | 534 | .dependencies = featureSet(&[_]Feature{}), |
| 535 | 535 | }; |
| 536 | result[@intFromEnum(Feature.harden_sls_nocomdat)] = .{ | |
| 536 | result[@backingInt(Feature.harden_sls_nocomdat)] = .{ | |
| 537 | 537 | .llvm_name = "harden-sls-nocomdat", |
| 538 | 538 | .description = "Generate thunk code for SLS mitigation in the normal text section", |
| 539 | 539 | .dependencies = featureSet(&[_]Feature{}), |
| 540 | 540 | }; |
| 541 | result[@intFromEnum(Feature.harden_sls_retbr)] = .{ | |
| 541 | result[@backingInt(Feature.harden_sls_retbr)] = .{ | |
| 542 | 542 | .llvm_name = "harden-sls-retbr", |
| 543 | 543 | .description = "Harden against straight line speculation across RETurn and BranchRegister instructions", |
| 544 | 544 | .dependencies = featureSet(&[_]Feature{}), |
| 545 | 545 | }; |
| 546 | result[@intFromEnum(Feature.has_v4t)] = .{ | |
| 546 | result[@backingInt(Feature.has_v4t)] = .{ | |
| 547 | 547 | .llvm_name = "v4t", |
| 548 | 548 | .description = "Support ARM v4T instructions", |
| 549 | 549 | .dependencies = featureSet(&[_]Feature{}), |
| 550 | 550 | }; |
| 551 | result[@intFromEnum(Feature.has_v5t)] = .{ | |
| 551 | result[@backingInt(Feature.has_v5t)] = .{ | |
| 552 | 552 | .llvm_name = "v5t", |
| 553 | 553 | .description = "Support ARM v5T instructions", |
| 554 | 554 | .dependencies = featureSet(&[_]Feature{ |
| 555 | 555 | .has_v4t, |
| 556 | 556 | }), |
| 557 | 557 | }; |
| 558 | result[@intFromEnum(Feature.has_v5te)] = .{ | |
| 558 | result[@backingInt(Feature.has_v5te)] = .{ | |
| 559 | 559 | .llvm_name = "v5te", |
| 560 | 560 | .description = "Support ARM v5TE, v5TEj, and v5TExp instructions", |
| 561 | 561 | .dependencies = featureSet(&[_]Feature{ |
| 562 | 562 | .has_v5t, |
| 563 | 563 | }), |
| 564 | 564 | }; |
| 565 | result[@intFromEnum(Feature.has_v6)] = .{ | |
| 565 | result[@backingInt(Feature.has_v6)] = .{ | |
| 566 | 566 | .llvm_name = "v6", |
| 567 | 567 | .description = "Support ARM v6 instructions", |
| 568 | 568 | .dependencies = featureSet(&[_]Feature{ |
| 569 | 569 | .has_v5te, |
| 570 | 570 | }), |
| 571 | 571 | }; |
| 572 | result[@intFromEnum(Feature.has_v6k)] = .{ | |
| 572 | result[@backingInt(Feature.has_v6k)] = .{ | |
| 573 | 573 | .llvm_name = "v6k", |
| 574 | 574 | .description = "Support ARM v6k instructions", |
| 575 | 575 | .dependencies = featureSet(&[_]Feature{ |
| 576 | 576 | .has_v6, |
| 577 | 577 | }), |
| 578 | 578 | }; |
| 579 | result[@intFromEnum(Feature.has_v6m)] = .{ | |
| 579 | result[@backingInt(Feature.has_v6m)] = .{ | |
| 580 | 580 | .llvm_name = "v6m", |
| 581 | 581 | .description = "Support ARM v6M instructions", |
| 582 | 582 | .dependencies = featureSet(&[_]Feature{ |
| 583 | 583 | .has_v6, |
| 584 | 584 | }), |
| 585 | 585 | }; |
| 586 | result[@intFromEnum(Feature.has_v6t2)] = .{ | |
| 586 | result[@backingInt(Feature.has_v6t2)] = .{ | |
| 587 | 587 | .llvm_name = "v6t2", |
| 588 | 588 | .description = "Support ARM v6t2 instructions", |
| 589 | 589 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -592,7 +592,7 @@ pub const all_features = blk: { |
| 592 | 592 | .thumb2, |
| 593 | 593 | }), |
| 594 | 594 | }; |
| 595 | result[@intFromEnum(Feature.has_v7)] = .{ | |
| 595 | result[@backingInt(Feature.has_v7)] = .{ | |
| 596 | 596 | .llvm_name = "v7", |
| 597 | 597 | .description = "Support ARM v7 instructions", |
| 598 | 598 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -600,12 +600,12 @@ pub const all_features = blk: { |
| 600 | 600 | .has_v7clrex, |
| 601 | 601 | }), |
| 602 | 602 | }; |
| 603 | result[@intFromEnum(Feature.has_v7clrex)] = .{ | |
| 603 | result[@backingInt(Feature.has_v7clrex)] = .{ | |
| 604 | 604 | .llvm_name = "v7clrex", |
| 605 | 605 | .description = "Has v7 clrex instruction", |
| 606 | 606 | .dependencies = featureSet(&[_]Feature{}), |
| 607 | 607 | }; |
| 608 | result[@intFromEnum(Feature.has_v8)] = .{ | |
| 608 | result[@backingInt(Feature.has_v8)] = .{ | |
| 609 | 609 | .llvm_name = "v8", |
| 610 | 610 | .description = "Support ARM v8 instructions", |
| 611 | 611 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -614,35 +614,35 @@ pub const all_features = blk: { |
| 614 | 614 | .perfmon, |
| 615 | 615 | }), |
| 616 | 616 | }; |
| 617 | result[@intFromEnum(Feature.has_v8_1a)] = .{ | |
| 617 | result[@backingInt(Feature.has_v8_1a)] = .{ | |
| 618 | 618 | .llvm_name = "v8.1a", |
| 619 | 619 | .description = "Support ARM v8.1a instructions", |
| 620 | 620 | .dependencies = featureSet(&[_]Feature{ |
| 621 | 621 | .has_v8, |
| 622 | 622 | }), |
| 623 | 623 | }; |
| 624 | result[@intFromEnum(Feature.has_v8_1m_main)] = .{ | |
| 624 | result[@backingInt(Feature.has_v8_1m_main)] = .{ | |
| 625 | 625 | .llvm_name = "v8.1m.main", |
| 626 | 626 | .description = "Support ARM v8-1M Mainline instructions", |
| 627 | 627 | .dependencies = featureSet(&[_]Feature{ |
| 628 | 628 | .has_v8m_main, |
| 629 | 629 | }), |
| 630 | 630 | }; |
| 631 | result[@intFromEnum(Feature.has_v8_2a)] = .{ | |
| 631 | result[@backingInt(Feature.has_v8_2a)] = .{ | |
| 632 | 632 | .llvm_name = "v8.2a", |
| 633 | 633 | .description = "Support ARM v8.2a instructions", |
| 634 | 634 | .dependencies = featureSet(&[_]Feature{ |
| 635 | 635 | .has_v8_1a, |
| 636 | 636 | }), |
| 637 | 637 | }; |
| 638 | result[@intFromEnum(Feature.has_v8_3a)] = .{ | |
| 638 | result[@backingInt(Feature.has_v8_3a)] = .{ | |
| 639 | 639 | .llvm_name = "v8.3a", |
| 640 | 640 | .description = "Support ARM v8.3a instructions", |
| 641 | 641 | .dependencies = featureSet(&[_]Feature{ |
| 642 | 642 | .has_v8_2a, |
| 643 | 643 | }), |
| 644 | 644 | }; |
| 645 | result[@intFromEnum(Feature.has_v8_4a)] = .{ | |
| 645 | result[@backingInt(Feature.has_v8_4a)] = .{ | |
| 646 | 646 | .llvm_name = "v8.4a", |
| 647 | 647 | .description = "Support ARM v8.4a instructions", |
| 648 | 648 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -650,7 +650,7 @@ pub const all_features = blk: { |
| 650 | 650 | .has_v8_3a, |
| 651 | 651 | }), |
| 652 | 652 | }; |
| 653 | result[@intFromEnum(Feature.has_v8_5a)] = .{ | |
| 653 | result[@backingInt(Feature.has_v8_5a)] = .{ | |
| 654 | 654 | .llvm_name = "v8.5a", |
| 655 | 655 | .description = "Support ARM v8.5a instructions", |
| 656 | 656 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -658,7 +658,7 @@ pub const all_features = blk: { |
| 658 | 658 | .sb, |
| 659 | 659 | }), |
| 660 | 660 | }; |
| 661 | result[@intFromEnum(Feature.has_v8_6a)] = .{ | |
| 661 | result[@backingInt(Feature.has_v8_6a)] = .{ | |
| 662 | 662 | .llvm_name = "v8.6a", |
| 663 | 663 | .description = "Support ARM v8.6a instructions", |
| 664 | 664 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -667,21 +667,21 @@ pub const all_features = blk: { |
| 667 | 667 | .i8mm, |
| 668 | 668 | }), |
| 669 | 669 | }; |
| 670 | result[@intFromEnum(Feature.has_v8_7a)] = .{ | |
| 670 | result[@backingInt(Feature.has_v8_7a)] = .{ | |
| 671 | 671 | .llvm_name = "v8.7a", |
| 672 | 672 | .description = "Support ARM v8.7a instructions", |
| 673 | 673 | .dependencies = featureSet(&[_]Feature{ |
| 674 | 674 | .has_v8_6a, |
| 675 | 675 | }), |
| 676 | 676 | }; |
| 677 | result[@intFromEnum(Feature.has_v8_8a)] = .{ | |
| 677 | result[@backingInt(Feature.has_v8_8a)] = .{ | |
| 678 | 678 | .llvm_name = "v8.8a", |
| 679 | 679 | .description = "Support ARM v8.8a instructions", |
| 680 | 680 | .dependencies = featureSet(&[_]Feature{ |
| 681 | 681 | .has_v8_7a, |
| 682 | 682 | }), |
| 683 | 683 | }; |
| 684 | result[@intFromEnum(Feature.has_v8_9a)] = .{ | |
| 684 | result[@backingInt(Feature.has_v8_9a)] = .{ | |
| 685 | 685 | .llvm_name = "v8.9a", |
| 686 | 686 | .description = "Support ARM v8.9a instructions", |
| 687 | 687 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -689,21 +689,21 @@ pub const all_features = blk: { |
| 689 | 689 | .has_v8_8a, |
| 690 | 690 | }), |
| 691 | 691 | }; |
| 692 | result[@intFromEnum(Feature.has_v8m)] = .{ | |
| 692 | result[@backingInt(Feature.has_v8m)] = .{ | |
| 693 | 693 | .llvm_name = "v8m", |
| 694 | 694 | .description = "Support ARM v8M Baseline instructions", |
| 695 | 695 | .dependencies = featureSet(&[_]Feature{ |
| 696 | 696 | .has_v6m, |
| 697 | 697 | }), |
| 698 | 698 | }; |
| 699 | result[@intFromEnum(Feature.has_v8m_main)] = .{ | |
| 699 | result[@backingInt(Feature.has_v8m_main)] = .{ | |
| 700 | 700 | .llvm_name = "v8m.main", |
| 701 | 701 | .description = "Support ARM v8M Mainline instructions", |
| 702 | 702 | .dependencies = featureSet(&[_]Feature{ |
| 703 | 703 | .has_v7, |
| 704 | 704 | }), |
| 705 | 705 | }; |
| 706 | result[@intFromEnum(Feature.has_v9_1a)] = .{ | |
| 706 | result[@backingInt(Feature.has_v9_1a)] = .{ | |
| 707 | 707 | .llvm_name = "v9.1a", |
| 708 | 708 | .description = "Support ARM v9.1a instructions", |
| 709 | 709 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -711,7 +711,7 @@ pub const all_features = blk: { |
| 711 | 711 | .has_v9a, |
| 712 | 712 | }), |
| 713 | 713 | }; |
| 714 | result[@intFromEnum(Feature.has_v9_2a)] = .{ | |
| 714 | result[@backingInt(Feature.has_v9_2a)] = .{ | |
| 715 | 715 | .llvm_name = "v9.2a", |
| 716 | 716 | .description = "Support ARM v9.2a instructions", |
| 717 | 717 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -719,7 +719,7 @@ pub const all_features = blk: { |
| 719 | 719 | .has_v9_1a, |
| 720 | 720 | }), |
| 721 | 721 | }; |
| 722 | result[@intFromEnum(Feature.has_v9_3a)] = .{ | |
| 722 | result[@backingInt(Feature.has_v9_3a)] = .{ | |
| 723 | 723 | .llvm_name = "v9.3a", |
| 724 | 724 | .description = "Support ARM v9.3a instructions", |
| 725 | 725 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -727,7 +727,7 @@ pub const all_features = blk: { |
| 727 | 727 | .has_v9_2a, |
| 728 | 728 | }), |
| 729 | 729 | }; |
| 730 | result[@intFromEnum(Feature.has_v9_4a)] = .{ | |
| 730 | result[@backingInt(Feature.has_v9_4a)] = .{ | |
| 731 | 731 | .llvm_name = "v9.4a", |
| 732 | 732 | .description = "Support ARM v9.4a instructions", |
| 733 | 733 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -735,106 +735,106 @@ pub const all_features = blk: { |
| 735 | 735 | .has_v9_3a, |
| 736 | 736 | }), |
| 737 | 737 | }; |
| 738 | result[@intFromEnum(Feature.has_v9_5a)] = .{ | |
| 738 | result[@backingInt(Feature.has_v9_5a)] = .{ | |
| 739 | 739 | .llvm_name = "v9.5a", |
| 740 | 740 | .description = "Support ARM v9.5a instructions", |
| 741 | 741 | .dependencies = featureSet(&[_]Feature{ |
| 742 | 742 | .has_v9_4a, |
| 743 | 743 | }), |
| 744 | 744 | }; |
| 745 | result[@intFromEnum(Feature.has_v9_6a)] = .{ | |
| 745 | result[@backingInt(Feature.has_v9_6a)] = .{ | |
| 746 | 746 | .llvm_name = "v9.6a", |
| 747 | 747 | .description = "Support ARM v9.6a instructions", |
| 748 | 748 | .dependencies = featureSet(&[_]Feature{ |
| 749 | 749 | .has_v9_5a, |
| 750 | 750 | }), |
| 751 | 751 | }; |
| 752 | result[@intFromEnum(Feature.has_v9_7a)] = .{ | |
| 752 | result[@backingInt(Feature.has_v9_7a)] = .{ | |
| 753 | 753 | .llvm_name = "v9.7a", |
| 754 | 754 | .description = "Support ARM v9.7a instructions", |
| 755 | 755 | .dependencies = featureSet(&[_]Feature{ |
| 756 | 756 | .has_v9_6a, |
| 757 | 757 | }), |
| 758 | 758 | }; |
| 759 | result[@intFromEnum(Feature.has_v9a)] = .{ | |
| 759 | result[@backingInt(Feature.has_v9a)] = .{ | |
| 760 | 760 | .llvm_name = "v9a", |
| 761 | 761 | .description = "Support ARM v9a instructions", |
| 762 | 762 | .dependencies = featureSet(&[_]Feature{ |
| 763 | 763 | .has_v8_5a, |
| 764 | 764 | }), |
| 765 | 765 | }; |
| 766 | result[@intFromEnum(Feature.hwdiv)] = .{ | |
| 766 | result[@backingInt(Feature.hwdiv)] = .{ | |
| 767 | 767 | .llvm_name = "hwdiv", |
| 768 | 768 | .description = "Enable divide instructions in Thumb", |
| 769 | 769 | .dependencies = featureSet(&[_]Feature{}), |
| 770 | 770 | }; |
| 771 | result[@intFromEnum(Feature.hwdiv_arm)] = .{ | |
| 771 | result[@backingInt(Feature.hwdiv_arm)] = .{ | |
| 772 | 772 | .llvm_name = "hwdiv-arm", |
| 773 | 773 | .description = "Enable divide instructions in ARM mode", |
| 774 | 774 | .dependencies = featureSet(&[_]Feature{}), |
| 775 | 775 | }; |
| 776 | result[@intFromEnum(Feature.i8mm)] = .{ | |
| 776 | result[@backingInt(Feature.i8mm)] = .{ | |
| 777 | 777 | .llvm_name = "i8mm", |
| 778 | 778 | .description = "Enable Matrix Multiply Int8 Extension", |
| 779 | 779 | .dependencies = featureSet(&[_]Feature{ |
| 780 | 780 | .neon, |
| 781 | 781 | }), |
| 782 | 782 | }; |
| 783 | result[@intFromEnum(Feature.iwmmxt)] = .{ | |
| 783 | result[@backingInt(Feature.iwmmxt)] = .{ | |
| 784 | 784 | .llvm_name = "iwmmxt", |
| 785 | 785 | .description = "ARMv5te architecture", |
| 786 | 786 | .dependencies = featureSet(&[_]Feature{ |
| 787 | 787 | .v5te, |
| 788 | 788 | }), |
| 789 | 789 | }; |
| 790 | result[@intFromEnum(Feature.iwmmxt2)] = .{ | |
| 790 | result[@backingInt(Feature.iwmmxt2)] = .{ | |
| 791 | 791 | .llvm_name = "iwmmxt2", |
| 792 | 792 | .description = "ARMv5te architecture", |
| 793 | 793 | .dependencies = featureSet(&[_]Feature{ |
| 794 | 794 | .v5te, |
| 795 | 795 | }), |
| 796 | 796 | }; |
| 797 | result[@intFromEnum(Feature.lob)] = .{ | |
| 797 | result[@backingInt(Feature.lob)] = .{ | |
| 798 | 798 | .llvm_name = "lob", |
| 799 | 799 | .description = "Enable Low Overhead Branch extensions", |
| 800 | 800 | .dependencies = featureSet(&[_]Feature{}), |
| 801 | 801 | }; |
| 802 | result[@intFromEnum(Feature.long_calls)] = .{ | |
| 802 | result[@backingInt(Feature.long_calls)] = .{ | |
| 803 | 803 | .llvm_name = "long-calls", |
| 804 | 804 | .description = "Generate calls via indirect call instructions", |
| 805 | 805 | .dependencies = featureSet(&[_]Feature{}), |
| 806 | 806 | }; |
| 807 | result[@intFromEnum(Feature.loop_align)] = .{ | |
| 807 | result[@backingInt(Feature.loop_align)] = .{ | |
| 808 | 808 | .llvm_name = "loop-align", |
| 809 | 809 | .description = "Prefer 32-bit alignment for branch targets", |
| 810 | 810 | .dependencies = featureSet(&[_]Feature{}), |
| 811 | 811 | }; |
| 812 | result[@intFromEnum(Feature.m55)] = .{ | |
| 812 | result[@backingInt(Feature.m55)] = .{ | |
| 813 | 813 | .llvm_name = "m55", |
| 814 | 814 | .description = "Cortex-M55 ARM processors", |
| 815 | 815 | .dependencies = featureSet(&[_]Feature{}), |
| 816 | 816 | }; |
| 817 | result[@intFromEnum(Feature.m85)] = .{ | |
| 817 | result[@backingInt(Feature.m85)] = .{ | |
| 818 | 818 | .llvm_name = "m85", |
| 819 | 819 | .description = "Cortex-M85 ARM processors", |
| 820 | 820 | .dependencies = featureSet(&[_]Feature{}), |
| 821 | 821 | }; |
| 822 | result[@intFromEnum(Feature.mclass)] = .{ | |
| 822 | result[@backingInt(Feature.mclass)] = .{ | |
| 823 | 823 | .llvm_name = "mclass", |
| 824 | 824 | .description = "Is microcontroller profile ('M' series)", |
| 825 | 825 | .dependencies = featureSet(&[_]Feature{}), |
| 826 | 826 | }; |
| 827 | result[@intFromEnum(Feature.mp)] = .{ | |
| 827 | result[@backingInt(Feature.mp)] = .{ | |
| 828 | 828 | .llvm_name = "mp", |
| 829 | 829 | .description = "Supports Multiprocessing extension", |
| 830 | 830 | .dependencies = featureSet(&[_]Feature{}), |
| 831 | 831 | }; |
| 832 | result[@intFromEnum(Feature.muxed_units)] = .{ | |
| 832 | result[@backingInt(Feature.muxed_units)] = .{ | |
| 833 | 833 | .llvm_name = "muxed-units", |
| 834 | 834 | .description = "Has muxed AGU and NEON/FPU", |
| 835 | 835 | .dependencies = featureSet(&[_]Feature{}), |
| 836 | 836 | }; |
| 837 | result[@intFromEnum(Feature.mve)] = .{ | |
| 837 | result[@backingInt(Feature.mve)] = .{ | |
| 838 | 838 | .llvm_name = "mve", |
| 839 | 839 | .description = "Support M-Class Vector Extension with integer ops", |
| 840 | 840 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -844,22 +844,22 @@ pub const all_features = blk: { |
| 844 | 844 | .has_v8_1m_main, |
| 845 | 845 | }), |
| 846 | 846 | }; |
| 847 | result[@intFromEnum(Feature.mve1beat)] = .{ | |
| 847 | result[@backingInt(Feature.mve1beat)] = .{ | |
| 848 | 848 | .llvm_name = "mve1beat", |
| 849 | 849 | .description = "Model MVE instructions as a 1 beat per tick architecture", |
| 850 | 850 | .dependencies = featureSet(&[_]Feature{}), |
| 851 | 851 | }; |
| 852 | result[@intFromEnum(Feature.mve2beat)] = .{ | |
| 852 | result[@backingInt(Feature.mve2beat)] = .{ | |
| 853 | 853 | .llvm_name = "mve2beat", |
| 854 | 854 | .description = "Model MVE instructions as a 2 beats per tick architecture", |
| 855 | 855 | .dependencies = featureSet(&[_]Feature{}), |
| 856 | 856 | }; |
| 857 | result[@intFromEnum(Feature.mve4beat)] = .{ | |
| 857 | result[@backingInt(Feature.mve4beat)] = .{ | |
| 858 | 858 | .llvm_name = "mve4beat", |
| 859 | 859 | .description = "Model MVE instructions as a 4 beats per tick architecture", |
| 860 | 860 | .dependencies = featureSet(&[_]Feature{}), |
| 861 | 861 | }; |
| 862 | result[@intFromEnum(Feature.mve_fp)] = .{ | |
| 862 | result[@backingInt(Feature.mve_fp)] = .{ | |
| 863 | 863 | .llvm_name = "mve.fp", |
| 864 | 864 | .description = "Support M-Class Vector Extension with integer and floating ops", |
| 865 | 865 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -867,238 +867,238 @@ pub const all_features = blk: { |
| 867 | 867 | .mve, |
| 868 | 868 | }), |
| 869 | 869 | }; |
| 870 | result[@intFromEnum(Feature.neon)] = .{ | |
| 870 | result[@backingInt(Feature.neon)] = .{ | |
| 871 | 871 | .llvm_name = "neon", |
| 872 | 872 | .description = "Enable NEON instructions", |
| 873 | 873 | .dependencies = featureSet(&[_]Feature{ |
| 874 | 874 | .vfp3, |
| 875 | 875 | }), |
| 876 | 876 | }; |
| 877 | result[@intFromEnum(Feature.neon_fpmovs)] = .{ | |
| 877 | result[@backingInt(Feature.neon_fpmovs)] = .{ | |
| 878 | 878 | .llvm_name = "neon-fpmovs", |
| 879 | 879 | .description = "Convert VMOVSR, VMOVRS, VMOVS to NEON", |
| 880 | 880 | .dependencies = featureSet(&[_]Feature{}), |
| 881 | 881 | }; |
| 882 | result[@intFromEnum(Feature.neonfp)] = .{ | |
| 882 | result[@backingInt(Feature.neonfp)] = .{ | |
| 883 | 883 | .llvm_name = "neonfp", |
| 884 | 884 | .description = "Use NEON for single precision FP", |
| 885 | 885 | .dependencies = featureSet(&[_]Feature{}), |
| 886 | 886 | }; |
| 887 | result[@intFromEnum(Feature.no_branch_predictor)] = .{ | |
| 887 | result[@backingInt(Feature.no_branch_predictor)] = .{ | |
| 888 | 888 | .llvm_name = "no-branch-predictor", |
| 889 | 889 | .description = "Has no branch predictor", |
| 890 | 890 | .dependencies = featureSet(&[_]Feature{}), |
| 891 | 891 | }; |
| 892 | result[@intFromEnum(Feature.no_bti_at_return_twice)] = .{ | |
| 892 | result[@backingInt(Feature.no_bti_at_return_twice)] = .{ | |
| 893 | 893 | .llvm_name = "no-bti-at-return-twice", |
| 894 | 894 | .description = "Don't place a BTI instruction after a return-twice", |
| 895 | 895 | .dependencies = featureSet(&[_]Feature{}), |
| 896 | 896 | }; |
| 897 | result[@intFromEnum(Feature.no_movt)] = .{ | |
| 897 | result[@backingInt(Feature.no_movt)] = .{ | |
| 898 | 898 | .llvm_name = "no-movt", |
| 899 | 899 | .description = "Don't use movt/movw pairs for 32-bit imms", |
| 900 | 900 | .dependencies = featureSet(&[_]Feature{}), |
| 901 | 901 | }; |
| 902 | result[@intFromEnum(Feature.no_neg_immediates)] = .{ | |
| 902 | result[@backingInt(Feature.no_neg_immediates)] = .{ | |
| 903 | 903 | .llvm_name = "no-neg-immediates", |
| 904 | 904 | .description = "Convert immediates and instructions to their negated or complemented equivalent when the immediate does not fit in the encoding.", |
| 905 | 905 | .dependencies = featureSet(&[_]Feature{}), |
| 906 | 906 | }; |
| 907 | result[@intFromEnum(Feature.noarm)] = .{ | |
| 907 | result[@backingInt(Feature.noarm)] = .{ | |
| 908 | 908 | .llvm_name = "noarm", |
| 909 | 909 | .description = "Does not support ARM mode execution", |
| 910 | 910 | .dependencies = featureSet(&[_]Feature{}), |
| 911 | 911 | }; |
| 912 | result[@intFromEnum(Feature.nonpipelined_vfp)] = .{ | |
| 912 | result[@backingInt(Feature.nonpipelined_vfp)] = .{ | |
| 913 | 913 | .llvm_name = "nonpipelined-vfp", |
| 914 | 914 | .description = "VFP instructions are not pipelined", |
| 915 | 915 | .dependencies = featureSet(&[_]Feature{}), |
| 916 | 916 | }; |
| 917 | result[@intFromEnum(Feature.pacbti)] = .{ | |
| 917 | result[@backingInt(Feature.pacbti)] = .{ | |
| 918 | 918 | .llvm_name = "pacbti", |
| 919 | 919 | .description = "Enable Pointer Authentication and Branch Target Identification", |
| 920 | 920 | .dependencies = featureSet(&[_]Feature{}), |
| 921 | 921 | }; |
| 922 | result[@intFromEnum(Feature.perfmon)] = .{ | |
| 922 | result[@backingInt(Feature.perfmon)] = .{ | |
| 923 | 923 | .llvm_name = "perfmon", |
| 924 | 924 | .description = "Enable support for Performance Monitor extensions", |
| 925 | 925 | .dependencies = featureSet(&[_]Feature{}), |
| 926 | 926 | }; |
| 927 | result[@intFromEnum(Feature.prefer_ishst)] = .{ | |
| 927 | result[@backingInt(Feature.prefer_ishst)] = .{ | |
| 928 | 928 | .llvm_name = "prefer-ishst", |
| 929 | 929 | .description = "Prefer ISHST barriers", |
| 930 | 930 | .dependencies = featureSet(&[_]Feature{}), |
| 931 | 931 | }; |
| 932 | result[@intFromEnum(Feature.prefer_vmovsr)] = .{ | |
| 932 | result[@backingInt(Feature.prefer_vmovsr)] = .{ | |
| 933 | 933 | .llvm_name = "prefer-vmovsr", |
| 934 | 934 | .description = "Prefer VMOVSR", |
| 935 | 935 | .dependencies = featureSet(&[_]Feature{}), |
| 936 | 936 | }; |
| 937 | result[@intFromEnum(Feature.prof_unpr)] = .{ | |
| 937 | result[@backingInt(Feature.prof_unpr)] = .{ | |
| 938 | 938 | .llvm_name = "prof-unpr", |
| 939 | 939 | .description = "Is profitable to unpredicate", |
| 940 | 940 | .dependencies = featureSet(&[_]Feature{}), |
| 941 | 941 | }; |
| 942 | result[@intFromEnum(Feature.ras)] = .{ | |
| 942 | result[@backingInt(Feature.ras)] = .{ | |
| 943 | 943 | .llvm_name = "ras", |
| 944 | 944 | .description = "Enable Reliability, Availability and Serviceability extensions", |
| 945 | 945 | .dependencies = featureSet(&[_]Feature{}), |
| 946 | 946 | }; |
| 947 | result[@intFromEnum(Feature.rclass)] = .{ | |
| 947 | result[@backingInt(Feature.rclass)] = .{ | |
| 948 | 948 | .llvm_name = "rclass", |
| 949 | 949 | .description = "Is realtime profile ('R' series)", |
| 950 | 950 | .dependencies = featureSet(&[_]Feature{}), |
| 951 | 951 | }; |
| 952 | result[@intFromEnum(Feature.read_tp_tpidrprw)] = .{ | |
| 952 | result[@backingInt(Feature.read_tp_tpidrprw)] = .{ | |
| 953 | 953 | .llvm_name = "read-tp-tpidrprw", |
| 954 | 954 | .description = "Reading thread pointer from TPIDRPRW register", |
| 955 | 955 | .dependencies = featureSet(&[_]Feature{}), |
| 956 | 956 | }; |
| 957 | result[@intFromEnum(Feature.read_tp_tpidruro)] = .{ | |
| 957 | result[@backingInt(Feature.read_tp_tpidruro)] = .{ | |
| 958 | 958 | .llvm_name = "read-tp-tpidruro", |
| 959 | 959 | .description = "Reading thread pointer from TPIDRURO register", |
| 960 | 960 | .dependencies = featureSet(&[_]Feature{}), |
| 961 | 961 | }; |
| 962 | result[@intFromEnum(Feature.read_tp_tpidrurw)] = .{ | |
| 962 | result[@backingInt(Feature.read_tp_tpidrurw)] = .{ | |
| 963 | 963 | .llvm_name = "read-tp-tpidrurw", |
| 964 | 964 | .description = "Reading thread pointer from TPIDRURW register", |
| 965 | 965 | .dependencies = featureSet(&[_]Feature{}), |
| 966 | 966 | }; |
| 967 | result[@intFromEnum(Feature.reserve_r9)] = .{ | |
| 967 | result[@backingInt(Feature.reserve_r9)] = .{ | |
| 968 | 968 | .llvm_name = "reserve-r9", |
| 969 | 969 | .description = "Reserve R9, making it unavailable as GPR", |
| 970 | 970 | .dependencies = featureSet(&[_]Feature{}), |
| 971 | 971 | }; |
| 972 | result[@intFromEnum(Feature.ret_addr_stack)] = .{ | |
| 972 | result[@backingInt(Feature.ret_addr_stack)] = .{ | |
| 973 | 973 | .llvm_name = "ret-addr-stack", |
| 974 | 974 | .description = "Has return address stack", |
| 975 | 975 | .dependencies = featureSet(&[_]Feature{}), |
| 976 | 976 | }; |
| 977 | result[@intFromEnum(Feature.sb)] = .{ | |
| 977 | result[@backingInt(Feature.sb)] = .{ | |
| 978 | 978 | .llvm_name = "sb", |
| 979 | 979 | .description = "Enable v8.5a Speculation Barrier", |
| 980 | 980 | .dependencies = featureSet(&[_]Feature{}), |
| 981 | 981 | }; |
| 982 | result[@intFromEnum(Feature.sha2)] = .{ | |
| 982 | result[@backingInt(Feature.sha2)] = .{ | |
| 983 | 983 | .llvm_name = "sha2", |
| 984 | 984 | .description = "Enable SHA1 and SHA256 support", |
| 985 | 985 | .dependencies = featureSet(&[_]Feature{ |
| 986 | 986 | .neon, |
| 987 | 987 | }), |
| 988 | 988 | }; |
| 989 | result[@intFromEnum(Feature.slow_fp_brcc)] = .{ | |
| 989 | result[@backingInt(Feature.slow_fp_brcc)] = .{ | |
| 990 | 990 | .llvm_name = "slow-fp-brcc", |
| 991 | 991 | .description = "FP compare + branch is slow", |
| 992 | 992 | .dependencies = featureSet(&[_]Feature{}), |
| 993 | 993 | }; |
| 994 | result[@intFromEnum(Feature.slow_load_D_subreg)] = .{ | |
| 994 | result[@backingInt(Feature.slow_load_D_subreg)] = .{ | |
| 995 | 995 | .llvm_name = "slow-load-D-subreg", |
| 996 | 996 | .description = "Loading into D subregs is slow", |
| 997 | 997 | .dependencies = featureSet(&[_]Feature{}), |
| 998 | 998 | }; |
| 999 | result[@intFromEnum(Feature.slow_odd_reg)] = .{ | |
| 999 | result[@backingInt(Feature.slow_odd_reg)] = .{ | |
| 1000 | 1000 | .llvm_name = "slow-odd-reg", |
| 1001 | 1001 | .description = "VLDM/VSTM starting with an odd register is slow", |
| 1002 | 1002 | .dependencies = featureSet(&[_]Feature{}), |
| 1003 | 1003 | }; |
| 1004 | result[@intFromEnum(Feature.slow_vdup32)] = .{ | |
| 1004 | result[@backingInt(Feature.slow_vdup32)] = .{ | |
| 1005 | 1005 | .llvm_name = "slow-vdup32", |
| 1006 | 1006 | .description = "Has slow VDUP32 - prefer VMOV", |
| 1007 | 1007 | .dependencies = featureSet(&[_]Feature{}), |
| 1008 | 1008 | }; |
| 1009 | result[@intFromEnum(Feature.slow_vgetlni32)] = .{ | |
| 1009 | result[@backingInt(Feature.slow_vgetlni32)] = .{ | |
| 1010 | 1010 | .llvm_name = "slow-vgetlni32", |
| 1011 | 1011 | .description = "Has slow VGETLNi32 - prefer VMOV", |
| 1012 | 1012 | .dependencies = featureSet(&[_]Feature{}), |
| 1013 | 1013 | }; |
| 1014 | result[@intFromEnum(Feature.slowfpvfmx)] = .{ | |
| 1014 | result[@backingInt(Feature.slowfpvfmx)] = .{ | |
| 1015 | 1015 | .llvm_name = "slowfpvfmx", |
| 1016 | 1016 | .description = "Disable VFP / NEON FMA instructions", |
| 1017 | 1017 | .dependencies = featureSet(&[_]Feature{}), |
| 1018 | 1018 | }; |
| 1019 | result[@intFromEnum(Feature.slowfpvmlx)] = .{ | |
| 1019 | result[@backingInt(Feature.slowfpvmlx)] = .{ | |
| 1020 | 1020 | .llvm_name = "slowfpvmlx", |
| 1021 | 1021 | .description = "Disable VFP / NEON MAC instructions", |
| 1022 | 1022 | .dependencies = featureSet(&[_]Feature{}), |
| 1023 | 1023 | }; |
| 1024 | result[@intFromEnum(Feature.soft_float)] = .{ | |
| 1024 | result[@backingInt(Feature.soft_float)] = .{ | |
| 1025 | 1025 | .llvm_name = "soft-float", |
| 1026 | 1026 | .description = "Use software floating point features.", |
| 1027 | 1027 | .dependencies = featureSet(&[_]Feature{}), |
| 1028 | 1028 | }; |
| 1029 | result[@intFromEnum(Feature.splat_vfp_neon)] = .{ | |
| 1029 | result[@backingInt(Feature.splat_vfp_neon)] = .{ | |
| 1030 | 1030 | .llvm_name = "splat-vfp-neon", |
| 1031 | 1031 | .description = "Splat register from VFP to NEON", |
| 1032 | 1032 | .dependencies = featureSet(&[_]Feature{ |
| 1033 | 1033 | .dont_widen_vmovs, |
| 1034 | 1034 | }), |
| 1035 | 1035 | }; |
| 1036 | result[@intFromEnum(Feature.strict_align)] = .{ | |
| 1036 | result[@backingInt(Feature.strict_align)] = .{ | |
| 1037 | 1037 | .llvm_name = "strict-align", |
| 1038 | 1038 | .description = "Disallow all unaligned memory access", |
| 1039 | 1039 | .dependencies = featureSet(&[_]Feature{}), |
| 1040 | 1040 | }; |
| 1041 | result[@intFromEnum(Feature.thumb2)] = .{ | |
| 1041 | result[@backingInt(Feature.thumb2)] = .{ | |
| 1042 | 1042 | .llvm_name = "thumb2", |
| 1043 | 1043 | .description = "Enable Thumb2 instructions", |
| 1044 | 1044 | .dependencies = featureSet(&[_]Feature{}), |
| 1045 | 1045 | }; |
| 1046 | result[@intFromEnum(Feature.thumb_mode)] = .{ | |
| 1046 | result[@backingInt(Feature.thumb_mode)] = .{ | |
| 1047 | 1047 | .llvm_name = "thumb-mode", |
| 1048 | 1048 | .description = "Thumb mode", |
| 1049 | 1049 | .dependencies = featureSet(&[_]Feature{}), |
| 1050 | 1050 | }; |
| 1051 | result[@intFromEnum(Feature.trustzone)] = .{ | |
| 1051 | result[@backingInt(Feature.trustzone)] = .{ | |
| 1052 | 1052 | .llvm_name = "trustzone", |
| 1053 | 1053 | .description = "Enable support for TrustZone security extensions", |
| 1054 | 1054 | .dependencies = featureSet(&[_]Feature{}), |
| 1055 | 1055 | }; |
| 1056 | result[@intFromEnum(Feature.use_mipipeliner)] = .{ | |
| 1056 | result[@backingInt(Feature.use_mipipeliner)] = .{ | |
| 1057 | 1057 | .llvm_name = "use-mipipeliner", |
| 1058 | 1058 | .description = "Use the MachinePipeliner", |
| 1059 | 1059 | .dependencies = featureSet(&[_]Feature{}), |
| 1060 | 1060 | }; |
| 1061 | result[@intFromEnum(Feature.use_misched)] = .{ | |
| 1061 | result[@backingInt(Feature.use_misched)] = .{ | |
| 1062 | 1062 | .llvm_name = "use-misched", |
| 1063 | 1063 | .description = "Use the MachineScheduler", |
| 1064 | 1064 | .dependencies = featureSet(&[_]Feature{}), |
| 1065 | 1065 | }; |
| 1066 | result[@intFromEnum(Feature.v2)] = .{ | |
| 1066 | result[@backingInt(Feature.v2)] = .{ | |
| 1067 | 1067 | .llvm_name = null, |
| 1068 | 1068 | .description = "ARMv2 architecture", |
| 1069 | 1069 | .dependencies = featureSet(&[_]Feature{ |
| 1070 | 1070 | .strict_align, |
| 1071 | 1071 | }), |
| 1072 | 1072 | }; |
| 1073 | result[@intFromEnum(Feature.v2a)] = .{ | |
| 1073 | result[@backingInt(Feature.v2a)] = .{ | |
| 1074 | 1074 | .llvm_name = null, |
| 1075 | 1075 | .description = "ARMv2a architecture", |
| 1076 | 1076 | .dependencies = featureSet(&[_]Feature{ |
| 1077 | 1077 | .strict_align, |
| 1078 | 1078 | }), |
| 1079 | 1079 | }; |
| 1080 | result[@intFromEnum(Feature.v3)] = .{ | |
| 1080 | result[@backingInt(Feature.v3)] = .{ | |
| 1081 | 1081 | .llvm_name = null, |
| 1082 | 1082 | .description = "ARMv3 architecture", |
| 1083 | 1083 | .dependencies = featureSet(&[_]Feature{ |
| 1084 | 1084 | .strict_align, |
| 1085 | 1085 | }), |
| 1086 | 1086 | }; |
| 1087 | result[@intFromEnum(Feature.v3m)] = .{ | |
| 1087 | result[@backingInt(Feature.v3m)] = .{ | |
| 1088 | 1088 | .llvm_name = null, |
| 1089 | 1089 | .description = "ARMv3m architecture", |
| 1090 | 1090 | .dependencies = featureSet(&[_]Feature{ |
| 1091 | 1091 | .strict_align, |
| 1092 | 1092 | }), |
| 1093 | 1093 | }; |
| 1094 | result[@intFromEnum(Feature.v4)] = .{ | |
| 1094 | result[@backingInt(Feature.v4)] = .{ | |
| 1095 | 1095 | .llvm_name = "armv4", |
| 1096 | 1096 | .description = "ARMv4 architecture", |
| 1097 | 1097 | .dependencies = featureSet(&[_]Feature{ |
| 1098 | 1098 | .strict_align, |
| 1099 | 1099 | }), |
| 1100 | 1100 | }; |
| 1101 | result[@intFromEnum(Feature.v4t)] = .{ | |
| 1101 | result[@backingInt(Feature.v4t)] = .{ | |
| 1102 | 1102 | .llvm_name = "armv4t", |
| 1103 | 1103 | .description = "ARMv4t architecture", |
| 1104 | 1104 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1106,7 +1106,7 @@ pub const all_features = blk: { |
| 1106 | 1106 | .strict_align, |
| 1107 | 1107 | }), |
| 1108 | 1108 | }; |
| 1109 | result[@intFromEnum(Feature.v5t)] = .{ | |
| 1109 | result[@backingInt(Feature.v5t)] = .{ | |
| 1110 | 1110 | .llvm_name = "armv5t", |
| 1111 | 1111 | .description = "ARMv5t architecture", |
| 1112 | 1112 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1114,7 +1114,7 @@ pub const all_features = blk: { |
| 1114 | 1114 | .strict_align, |
| 1115 | 1115 | }), |
| 1116 | 1116 | }; |
| 1117 | result[@intFromEnum(Feature.v5te)] = .{ | |
| 1117 | result[@backingInt(Feature.v5te)] = .{ | |
| 1118 | 1118 | .llvm_name = "armv5te", |
| 1119 | 1119 | .description = "ARMv5te architecture", |
| 1120 | 1120 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1122,7 +1122,7 @@ pub const all_features = blk: { |
| 1122 | 1122 | .strict_align, |
| 1123 | 1123 | }), |
| 1124 | 1124 | }; |
| 1125 | result[@intFromEnum(Feature.v5tej)] = .{ | |
| 1125 | result[@backingInt(Feature.v5tej)] = .{ | |
| 1126 | 1126 | .llvm_name = "armv5tej", |
| 1127 | 1127 | .description = "ARMv5tej architecture", |
| 1128 | 1128 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1130,7 +1130,7 @@ pub const all_features = blk: { |
| 1130 | 1130 | .strict_align, |
| 1131 | 1131 | }), |
| 1132 | 1132 | }; |
| 1133 | result[@intFromEnum(Feature.v6)] = .{ | |
| 1133 | result[@backingInt(Feature.v6)] = .{ | |
| 1134 | 1134 | .llvm_name = "armv6", |
| 1135 | 1135 | .description = "ARMv6 architecture", |
| 1136 | 1136 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1138,21 +1138,21 @@ pub const all_features = blk: { |
| 1138 | 1138 | .has_v6, |
| 1139 | 1139 | }), |
| 1140 | 1140 | }; |
| 1141 | result[@intFromEnum(Feature.v6j)] = .{ | |
| 1141 | result[@backingInt(Feature.v6j)] = .{ | |
| 1142 | 1142 | .llvm_name = "armv6j", |
| 1143 | 1143 | .description = "ARMv7a architecture", |
| 1144 | 1144 | .dependencies = featureSet(&[_]Feature{ |
| 1145 | 1145 | .v6, |
| 1146 | 1146 | }), |
| 1147 | 1147 | }; |
| 1148 | result[@intFromEnum(Feature.v6k)] = .{ | |
| 1148 | result[@backingInt(Feature.v6k)] = .{ | |
| 1149 | 1149 | .llvm_name = "armv6k", |
| 1150 | 1150 | .description = "ARMv6k architecture", |
| 1151 | 1151 | .dependencies = featureSet(&[_]Feature{ |
| 1152 | 1152 | .has_v6k, |
| 1153 | 1153 | }), |
| 1154 | 1154 | }; |
| 1155 | result[@intFromEnum(Feature.v6kz)] = .{ | |
| 1155 | result[@backingInt(Feature.v6kz)] = .{ | |
| 1156 | 1156 | .llvm_name = "armv6kz", |
| 1157 | 1157 | .description = "ARMv6kz architecture", |
| 1158 | 1158 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1160,7 +1160,7 @@ pub const all_features = blk: { |
| 1160 | 1160 | .trustzone, |
| 1161 | 1161 | }), |
| 1162 | 1162 | }; |
| 1163 | result[@intFromEnum(Feature.v6m)] = .{ | |
| 1163 | result[@backingInt(Feature.v6m)] = .{ | |
| 1164 | 1164 | .llvm_name = "armv6-m", |
| 1165 | 1165 | .description = "ARMv6m architecture", |
| 1166 | 1166 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1172,7 +1172,7 @@ pub const all_features = blk: { |
| 1172 | 1172 | .thumb_mode, |
| 1173 | 1173 | }), |
| 1174 | 1174 | }; |
| 1175 | result[@intFromEnum(Feature.v6sm)] = .{ | |
| 1175 | result[@backingInt(Feature.v6sm)] = .{ | |
| 1176 | 1176 | .llvm_name = "armv6s-m", |
| 1177 | 1177 | .description = "ARMv6sm architecture", |
| 1178 | 1178 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1184,7 +1184,7 @@ pub const all_features = blk: { |
| 1184 | 1184 | .thumb_mode, |
| 1185 | 1185 | }), |
| 1186 | 1186 | }; |
| 1187 | result[@intFromEnum(Feature.v6t2)] = .{ | |
| 1187 | result[@backingInt(Feature.v6t2)] = .{ | |
| 1188 | 1188 | .llvm_name = "armv6t2", |
| 1189 | 1189 | .description = "ARMv6t2 architecture", |
| 1190 | 1190 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1192,7 +1192,7 @@ pub const all_features = blk: { |
| 1192 | 1192 | .has_v6t2, |
| 1193 | 1193 | }), |
| 1194 | 1194 | }; |
| 1195 | result[@intFromEnum(Feature.v7a)] = .{ | |
| 1195 | result[@backingInt(Feature.v7a)] = .{ | |
| 1196 | 1196 | .llvm_name = "armv7-a", |
| 1197 | 1197 | .description = "ARMv7a architecture", |
| 1198 | 1198 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1204,7 +1204,7 @@ pub const all_features = blk: { |
| 1204 | 1204 | .perfmon, |
| 1205 | 1205 | }), |
| 1206 | 1206 | }; |
| 1207 | result[@intFromEnum(Feature.v7em)] = .{ | |
| 1207 | result[@backingInt(Feature.v7em)] = .{ | |
| 1208 | 1208 | .llvm_name = "armv7e-m", |
| 1209 | 1209 | .description = "ARMv7em architecture", |
| 1210 | 1210 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1217,7 +1217,7 @@ pub const all_features = blk: { |
| 1217 | 1217 | .thumb_mode, |
| 1218 | 1218 | }), |
| 1219 | 1219 | }; |
| 1220 | result[@intFromEnum(Feature.v7m)] = .{ | |
| 1220 | result[@backingInt(Feature.v7m)] = .{ | |
| 1221 | 1221 | .llvm_name = "armv7-m", |
| 1222 | 1222 | .description = "ARMv7m architecture", |
| 1223 | 1223 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1229,7 +1229,7 @@ pub const all_features = blk: { |
| 1229 | 1229 | .thumb_mode, |
| 1230 | 1230 | }), |
| 1231 | 1231 | }; |
| 1232 | result[@intFromEnum(Feature.v7r)] = .{ | |
| 1232 | result[@backingInt(Feature.v7r)] = .{ | |
| 1233 | 1233 | .llvm_name = "armv7-r", |
| 1234 | 1234 | .description = "ARMv7r architecture", |
| 1235 | 1235 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1241,7 +1241,7 @@ pub const all_features = blk: { |
| 1241 | 1241 | .rclass, |
| 1242 | 1242 | }), |
| 1243 | 1243 | }; |
| 1244 | result[@intFromEnum(Feature.v7ve)] = .{ | |
| 1244 | result[@backingInt(Feature.v7ve)] = .{ | |
| 1245 | 1245 | .llvm_name = "armv7ve", |
| 1246 | 1246 | .description = "ARMv7ve architecture", |
| 1247 | 1247 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1256,7 +1256,7 @@ pub const all_features = blk: { |
| 1256 | 1256 | .virtualization, |
| 1257 | 1257 | }), |
| 1258 | 1258 | }; |
| 1259 | result[@intFromEnum(Feature.v8_1a)] = .{ | |
| 1259 | result[@backingInt(Feature.v8_1a)] = .{ | |
| 1260 | 1260 | .llvm_name = "armv8.1-a", |
| 1261 | 1261 | .description = "ARMv81a architecture", |
| 1262 | 1262 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1272,7 +1272,7 @@ pub const all_features = blk: { |
| 1272 | 1272 | .virtualization, |
| 1273 | 1273 | }), |
| 1274 | 1274 | }; |
| 1275 | result[@intFromEnum(Feature.v8_1m_main)] = .{ | |
| 1275 | result[@backingInt(Feature.v8_1m_main)] = .{ | |
| 1276 | 1276 | .llvm_name = "armv8.1-m.main", |
| 1277 | 1277 | .description = "ARMv81mMainline architecture", |
| 1278 | 1278 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1288,7 +1288,7 @@ pub const all_features = blk: { |
| 1288 | 1288 | .thumb_mode, |
| 1289 | 1289 | }), |
| 1290 | 1290 | }; |
| 1291 | result[@intFromEnum(Feature.v8_2a)] = .{ | |
| 1291 | result[@backingInt(Feature.v8_2a)] = .{ | |
| 1292 | 1292 | .llvm_name = "armv8.2-a", |
| 1293 | 1293 | .description = "ARMv82a architecture", |
| 1294 | 1294 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1305,7 +1305,7 @@ pub const all_features = blk: { |
| 1305 | 1305 | .virtualization, |
| 1306 | 1306 | }), |
| 1307 | 1307 | }; |
| 1308 | result[@intFromEnum(Feature.v8_3a)] = .{ | |
| 1308 | result[@backingInt(Feature.v8_3a)] = .{ | |
| 1309 | 1309 | .llvm_name = "armv8.3-a", |
| 1310 | 1310 | .description = "ARMv83a architecture", |
| 1311 | 1311 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1322,7 +1322,7 @@ pub const all_features = blk: { |
| 1322 | 1322 | .virtualization, |
| 1323 | 1323 | }), |
| 1324 | 1324 | }; |
| 1325 | result[@intFromEnum(Feature.v8_4a)] = .{ | |
| 1325 | result[@backingInt(Feature.v8_4a)] = .{ | |
| 1326 | 1326 | .llvm_name = "armv8.4-a", |
| 1327 | 1327 | .description = "ARMv84a architecture", |
| 1328 | 1328 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1339,7 +1339,7 @@ pub const all_features = blk: { |
| 1339 | 1339 | .virtualization, |
| 1340 | 1340 | }), |
| 1341 | 1341 | }; |
| 1342 | result[@intFromEnum(Feature.v8_5a)] = .{ | |
| 1342 | result[@backingInt(Feature.v8_5a)] = .{ | |
| 1343 | 1343 | .llvm_name = "armv8.5-a", |
| 1344 | 1344 | .description = "ARMv85a architecture", |
| 1345 | 1345 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1356,7 +1356,7 @@ pub const all_features = blk: { |
| 1356 | 1356 | .virtualization, |
| 1357 | 1357 | }), |
| 1358 | 1358 | }; |
| 1359 | result[@intFromEnum(Feature.v8_6a)] = .{ | |
| 1359 | result[@backingInt(Feature.v8_6a)] = .{ | |
| 1360 | 1360 | .llvm_name = "armv8.6-a", |
| 1361 | 1361 | .description = "ARMv86a architecture", |
| 1362 | 1362 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1373,7 +1373,7 @@ pub const all_features = blk: { |
| 1373 | 1373 | .virtualization, |
| 1374 | 1374 | }), |
| 1375 | 1375 | }; |
| 1376 | result[@intFromEnum(Feature.v8_7a)] = .{ | |
| 1376 | result[@backingInt(Feature.v8_7a)] = .{ | |
| 1377 | 1377 | .llvm_name = "armv8.7-a", |
| 1378 | 1378 | .description = "ARMv87a architecture", |
| 1379 | 1379 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1390,7 +1390,7 @@ pub const all_features = blk: { |
| 1390 | 1390 | .virtualization, |
| 1391 | 1391 | }), |
| 1392 | 1392 | }; |
| 1393 | result[@intFromEnum(Feature.v8_8a)] = .{ | |
| 1393 | result[@backingInt(Feature.v8_8a)] = .{ | |
| 1394 | 1394 | .llvm_name = "armv8.8-a", |
| 1395 | 1395 | .description = "ARMv88a architecture", |
| 1396 | 1396 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1407,7 +1407,7 @@ pub const all_features = blk: { |
| 1407 | 1407 | .virtualization, |
| 1408 | 1408 | }), |
| 1409 | 1409 | }; |
| 1410 | result[@intFromEnum(Feature.v8_9a)] = .{ | |
| 1410 | result[@backingInt(Feature.v8_9a)] = .{ | |
| 1411 | 1411 | .llvm_name = "armv8.9-a", |
| 1412 | 1412 | .description = "ARMv89a architecture", |
| 1413 | 1413 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1424,7 +1424,7 @@ pub const all_features = blk: { |
| 1424 | 1424 | .virtualization, |
| 1425 | 1425 | }), |
| 1426 | 1426 | }; |
| 1427 | result[@intFromEnum(Feature.v8a)] = .{ | |
| 1427 | result[@backingInt(Feature.v8a)] = .{ | |
| 1428 | 1428 | .llvm_name = "armv8-a", |
| 1429 | 1429 | .description = "ARMv8a architecture", |
| 1430 | 1430 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1440,7 +1440,7 @@ pub const all_features = blk: { |
| 1440 | 1440 | .virtualization, |
| 1441 | 1441 | }), |
| 1442 | 1442 | }; |
| 1443 | result[@intFromEnum(Feature.v8m)] = .{ | |
| 1443 | result[@backingInt(Feature.v8m)] = .{ | |
| 1444 | 1444 | .llvm_name = "armv8-m.base", |
| 1445 | 1445 | .description = "ARMv8mBaseline architecture", |
| 1446 | 1446 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1456,7 +1456,7 @@ pub const all_features = blk: { |
| 1456 | 1456 | .thumb_mode, |
| 1457 | 1457 | }), |
| 1458 | 1458 | }; |
| 1459 | result[@intFromEnum(Feature.v8m_main)] = .{ | |
| 1459 | result[@backingInt(Feature.v8m_main)] = .{ | |
| 1460 | 1460 | .llvm_name = "armv8-m.main", |
| 1461 | 1461 | .description = "ARMv8mMainline architecture", |
| 1462 | 1462 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1470,7 +1470,7 @@ pub const all_features = blk: { |
| 1470 | 1470 | .thumb_mode, |
| 1471 | 1471 | }), |
| 1472 | 1472 | }; |
| 1473 | result[@intFromEnum(Feature.v8r)] = .{ | |
| 1473 | result[@backingInt(Feature.v8r)] = .{ | |
| 1474 | 1474 | .llvm_name = "armv8-r", |
| 1475 | 1475 | .description = "ARMv8r architecture", |
| 1476 | 1476 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1485,7 +1485,7 @@ pub const all_features = blk: { |
| 1485 | 1485 | .virtualization, |
| 1486 | 1486 | }), |
| 1487 | 1487 | }; |
| 1488 | result[@intFromEnum(Feature.v9_1a)] = .{ | |
| 1488 | result[@backingInt(Feature.v9_1a)] = .{ | |
| 1489 | 1489 | .llvm_name = "armv9.1-a", |
| 1490 | 1490 | .description = "ARMv91a architecture", |
| 1491 | 1491 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1501,7 +1501,7 @@ pub const all_features = blk: { |
| 1501 | 1501 | .virtualization, |
| 1502 | 1502 | }), |
| 1503 | 1503 | }; |
| 1504 | result[@intFromEnum(Feature.v9_2a)] = .{ | |
| 1504 | result[@backingInt(Feature.v9_2a)] = .{ | |
| 1505 | 1505 | .llvm_name = "armv9.2-a", |
| 1506 | 1506 | .description = "ARMv92a architecture", |
| 1507 | 1507 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1517,7 +1517,7 @@ pub const all_features = blk: { |
| 1517 | 1517 | .virtualization, |
| 1518 | 1518 | }), |
| 1519 | 1519 | }; |
| 1520 | result[@intFromEnum(Feature.v9_3a)] = .{ | |
| 1520 | result[@backingInt(Feature.v9_3a)] = .{ | |
| 1521 | 1521 | .llvm_name = "armv9.3-a", |
| 1522 | 1522 | .description = "ARMv93a architecture", |
| 1523 | 1523 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1534,7 +1534,7 @@ pub const all_features = blk: { |
| 1534 | 1534 | .virtualization, |
| 1535 | 1535 | }), |
| 1536 | 1536 | }; |
| 1537 | result[@intFromEnum(Feature.v9_4a)] = .{ | |
| 1537 | result[@backingInt(Feature.v9_4a)] = .{ | |
| 1538 | 1538 | .llvm_name = "armv9.4-a", |
| 1539 | 1539 | .description = "ARMv94a architecture", |
| 1540 | 1540 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1550,7 +1550,7 @@ pub const all_features = blk: { |
| 1550 | 1550 | .virtualization, |
| 1551 | 1551 | }), |
| 1552 | 1552 | }; |
| 1553 | result[@intFromEnum(Feature.v9_5a)] = .{ | |
| 1553 | result[@backingInt(Feature.v9_5a)] = .{ | |
| 1554 | 1554 | .llvm_name = "armv9.5-a", |
| 1555 | 1555 | .description = "ARMv95a architecture", |
| 1556 | 1556 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1566,7 +1566,7 @@ pub const all_features = blk: { |
| 1566 | 1566 | .virtualization, |
| 1567 | 1567 | }), |
| 1568 | 1568 | }; |
| 1569 | result[@intFromEnum(Feature.v9_6a)] = .{ | |
| 1569 | result[@backingInt(Feature.v9_6a)] = .{ | |
| 1570 | 1570 | .llvm_name = "armv9.6-a", |
| 1571 | 1571 | .description = "ARMv96a architecture", |
| 1572 | 1572 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1582,7 +1582,7 @@ pub const all_features = blk: { |
| 1582 | 1582 | .virtualization, |
| 1583 | 1583 | }), |
| 1584 | 1584 | }; |
| 1585 | result[@intFromEnum(Feature.v9_7a)] = .{ | |
| 1585 | result[@backingInt(Feature.v9_7a)] = .{ | |
| 1586 | 1586 | .llvm_name = "armv9.7-a", |
| 1587 | 1587 | .description = "ARMv97a architecture", |
| 1588 | 1588 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1598,7 +1598,7 @@ pub const all_features = blk: { |
| 1598 | 1598 | .virtualization, |
| 1599 | 1599 | }), |
| 1600 | 1600 | }; |
| 1601 | result[@intFromEnum(Feature.v9a)] = .{ | |
| 1601 | result[@backingInt(Feature.v9a)] = .{ | |
| 1602 | 1602 | .llvm_name = "armv9-a", |
| 1603 | 1603 | .description = "ARMv9a architecture", |
| 1604 | 1604 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1614,7 +1614,7 @@ pub const all_features = blk: { |
| 1614 | 1614 | .virtualization, |
| 1615 | 1615 | }), |
| 1616 | 1616 | }; |
| 1617 | result[@intFromEnum(Feature.vfp2)] = .{ | |
| 1617 | result[@backingInt(Feature.vfp2)] = .{ | |
| 1618 | 1618 | .llvm_name = "vfp2", |
| 1619 | 1619 | .description = "Enable VFP2 instructions", |
| 1620 | 1620 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1622,14 +1622,14 @@ pub const all_features = blk: { |
| 1622 | 1622 | .vfp2sp, |
| 1623 | 1623 | }), |
| 1624 | 1624 | }; |
| 1625 | result[@intFromEnum(Feature.vfp2sp)] = .{ | |
| 1625 | result[@backingInt(Feature.vfp2sp)] = .{ | |
| 1626 | 1626 | .llvm_name = "vfp2sp", |
| 1627 | 1627 | .description = "Enable VFP2 instructions with no double precision", |
| 1628 | 1628 | .dependencies = featureSet(&[_]Feature{ |
| 1629 | 1629 | .fpregs, |
| 1630 | 1630 | }), |
| 1631 | 1631 | }; |
| 1632 | result[@intFromEnum(Feature.vfp3)] = .{ | |
| 1632 | result[@backingInt(Feature.vfp3)] = .{ | |
| 1633 | 1633 | .llvm_name = "vfp3", |
| 1634 | 1634 | .description = "Enable VFP3 instructions", |
| 1635 | 1635 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1637,7 +1637,7 @@ pub const all_features = blk: { |
| 1637 | 1637 | .vfp3sp, |
| 1638 | 1638 | }), |
| 1639 | 1639 | }; |
| 1640 | result[@intFromEnum(Feature.vfp3d16)] = .{ | |
| 1640 | result[@backingInt(Feature.vfp3d16)] = .{ | |
| 1641 | 1641 | .llvm_name = "vfp3d16", |
| 1642 | 1642 | .description = "Enable VFP3 instructions with only 16 d-registers", |
| 1643 | 1643 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1645,14 +1645,14 @@ pub const all_features = blk: { |
| 1645 | 1645 | .vfp3d16sp, |
| 1646 | 1646 | }), |
| 1647 | 1647 | }; |
| 1648 | result[@intFromEnum(Feature.vfp3d16sp)] = .{ | |
| 1648 | result[@backingInt(Feature.vfp3d16sp)] = .{ | |
| 1649 | 1649 | .llvm_name = "vfp3d16sp", |
| 1650 | 1650 | .description = "Enable VFP3 instructions with only 16 d-registers and no double precision", |
| 1651 | 1651 | .dependencies = featureSet(&[_]Feature{ |
| 1652 | 1652 | .vfp2sp, |
| 1653 | 1653 | }), |
| 1654 | 1654 | }; |
| 1655 | result[@intFromEnum(Feature.vfp3sp)] = .{ | |
| 1655 | result[@backingInt(Feature.vfp3sp)] = .{ | |
| 1656 | 1656 | .llvm_name = "vfp3sp", |
| 1657 | 1657 | .description = "Enable VFP3 instructions with no double precision", |
| 1658 | 1658 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1660,7 +1660,7 @@ pub const all_features = blk: { |
| 1660 | 1660 | .vfp3d16sp, |
| 1661 | 1661 | }), |
| 1662 | 1662 | }; |
| 1663 | result[@intFromEnum(Feature.vfp4)] = .{ | |
| 1663 | result[@backingInt(Feature.vfp4)] = .{ | |
| 1664 | 1664 | .llvm_name = "vfp4", |
| 1665 | 1665 | .description = "Enable VFP4 instructions", |
| 1666 | 1666 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1669,7 +1669,7 @@ pub const all_features = blk: { |
| 1669 | 1669 | .vfp4sp, |
| 1670 | 1670 | }), |
| 1671 | 1671 | }; |
| 1672 | result[@intFromEnum(Feature.vfp4d16)] = .{ | |
| 1672 | result[@backingInt(Feature.vfp4d16)] = .{ | |
| 1673 | 1673 | .llvm_name = "vfp4d16", |
| 1674 | 1674 | .description = "Enable VFP4 instructions with only 16 d-registers", |
| 1675 | 1675 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1677,7 +1677,7 @@ pub const all_features = blk: { |
| 1677 | 1677 | .vfp4d16sp, |
| 1678 | 1678 | }), |
| 1679 | 1679 | }; |
| 1680 | result[@intFromEnum(Feature.vfp4d16sp)] = .{ | |
| 1680 | result[@backingInt(Feature.vfp4d16sp)] = .{ | |
| 1681 | 1681 | .llvm_name = "vfp4d16sp", |
| 1682 | 1682 | .description = "Enable VFP4 instructions with only 16 d-registers and no double precision", |
| 1683 | 1683 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1685,7 +1685,7 @@ pub const all_features = blk: { |
| 1685 | 1685 | .vfp3d16sp, |
| 1686 | 1686 | }), |
| 1687 | 1687 | }; |
| 1688 | result[@intFromEnum(Feature.vfp4sp)] = .{ | |
| 1688 | result[@backingInt(Feature.vfp4sp)] = .{ | |
| 1689 | 1689 | .llvm_name = "vfp4sp", |
| 1690 | 1690 | .description = "Enable VFP4 instructions with no double precision", |
| 1691 | 1691 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1693,7 +1693,7 @@ pub const all_features = blk: { |
| 1693 | 1693 | .vfp4d16sp, |
| 1694 | 1694 | }), |
| 1695 | 1695 | }; |
| 1696 | result[@intFromEnum(Feature.virtualization)] = .{ | |
| 1696 | result[@backingInt(Feature.virtualization)] = .{ | |
| 1697 | 1697 | .llvm_name = "virtualization", |
| 1698 | 1698 | .description = "Supports Virtualization extension", |
| 1699 | 1699 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1701,34 +1701,34 @@ pub const all_features = blk: { |
| 1701 | 1701 | .hwdiv_arm, |
| 1702 | 1702 | }), |
| 1703 | 1703 | }; |
| 1704 | result[@intFromEnum(Feature.vldn_align)] = .{ | |
| 1704 | result[@backingInt(Feature.vldn_align)] = .{ | |
| 1705 | 1705 | .llvm_name = "vldn-align", |
| 1706 | 1706 | .description = "Check for VLDn unaligned access", |
| 1707 | 1707 | .dependencies = featureSet(&[_]Feature{}), |
| 1708 | 1708 | }; |
| 1709 | result[@intFromEnum(Feature.vmlx_forwarding)] = .{ | |
| 1709 | result[@backingInt(Feature.vmlx_forwarding)] = .{ | |
| 1710 | 1710 | .llvm_name = "vmlx-forwarding", |
| 1711 | 1711 | .description = "Has multiplier accumulator forwarding", |
| 1712 | 1712 | .dependencies = featureSet(&[_]Feature{}), |
| 1713 | 1713 | }; |
| 1714 | result[@intFromEnum(Feature.vmlx_hazards)] = .{ | |
| 1714 | result[@backingInt(Feature.vmlx_hazards)] = .{ | |
| 1715 | 1715 | .llvm_name = "vmlx-hazards", |
| 1716 | 1716 | .description = "Has VMLx hazards", |
| 1717 | 1717 | .dependencies = featureSet(&[_]Feature{}), |
| 1718 | 1718 | }; |
| 1719 | result[@intFromEnum(Feature.wide_stride_vfp)] = .{ | |
| 1719 | result[@backingInt(Feature.wide_stride_vfp)] = .{ | |
| 1720 | 1720 | .llvm_name = "wide-stride-vfp", |
| 1721 | 1721 | .description = "Use a wide stride when allocating VFP registers", |
| 1722 | 1722 | .dependencies = featureSet(&[_]Feature{}), |
| 1723 | 1723 | }; |
| 1724 | result[@intFromEnum(Feature.xscale)] = .{ | |
| 1724 | result[@backingInt(Feature.xscale)] = .{ | |
| 1725 | 1725 | .llvm_name = "xscale", |
| 1726 | 1726 | .description = "ARMv5te architecture", |
| 1727 | 1727 | .dependencies = featureSet(&[_]Feature{ |
| 1728 | 1728 | .v5te, |
| 1729 | 1729 | }), |
| 1730 | 1730 | }; |
| 1731 | result[@intFromEnum(Feature.zcz)] = .{ | |
| 1731 | result[@backingInt(Feature.zcz)] = .{ | |
| 1732 | 1732 | .llvm_name = "zcz", |
| 1733 | 1733 | .description = "Has zero-cycle zeroing instructions", |
| 1734 | 1734 | .dependencies = featureSet(&[_]Feature{}), |
lib/std/Target/avr.zig+39-39| ... | ... | @@ -55,17 +55,17 @@ pub const all_features = blk: { |
| 55 | 55 | const len = @typeInfo(Feature).@"enum".field_names.len; |
| 56 | 56 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); |
| 57 | 57 | var result: [len]CpuFeature = undefined; |
| 58 | result[@intFromEnum(Feature.addsubiw)] = .{ | |
| 58 | result[@backingInt(Feature.addsubiw)] = .{ | |
| 59 | 59 | .llvm_name = "addsubiw", |
| 60 | 60 | .description = "Enable 16-bit register-immediate addition and subtraction instructions", |
| 61 | 61 | .dependencies = featureSet(&[_]Feature{}), |
| 62 | 62 | }; |
| 63 | result[@intFromEnum(Feature.avr0)] = .{ | |
| 63 | result[@backingInt(Feature.avr0)] = .{ | |
| 64 | 64 | .llvm_name = "avr0", |
| 65 | 65 | .description = "The device is a part of the avr0 family", |
| 66 | 66 | .dependencies = featureSet(&[_]Feature{}), |
| 67 | 67 | }; |
| 68 | result[@intFromEnum(Feature.avr1)] = .{ | |
| 68 | result[@backingInt(Feature.avr1)] = .{ | |
| 69 | 69 | .llvm_name = "avr1", |
| 70 | 70 | .description = "The device is a part of the avr1 family", |
| 71 | 71 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -74,7 +74,7 @@ pub const all_features = blk: { |
| 74 | 74 | .memmappedregs, |
| 75 | 75 | }), |
| 76 | 76 | }; |
| 77 | result[@intFromEnum(Feature.avr2)] = .{ | |
| 77 | result[@backingInt(Feature.avr2)] = .{ | |
| 78 | 78 | .llvm_name = "avr2", |
| 79 | 79 | .description = "The device is a part of the avr2 family", |
| 80 | 80 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -84,7 +84,7 @@ pub const all_features = blk: { |
| 84 | 84 | .sram, |
| 85 | 85 | }), |
| 86 | 86 | }; |
| 87 | result[@intFromEnum(Feature.avr25)] = .{ | |
| 87 | result[@backingInt(Feature.avr25)] = .{ | |
| 88 | 88 | .llvm_name = "avr25", |
| 89 | 89 | .description = "The device is a part of the avr25 family", |
| 90 | 90 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -95,7 +95,7 @@ pub const all_features = blk: { |
| 95 | 95 | .spm, |
| 96 | 96 | }), |
| 97 | 97 | }; |
| 98 | result[@intFromEnum(Feature.avr3)] = .{ | |
| 98 | result[@backingInt(Feature.avr3)] = .{ | |
| 99 | 99 | .llvm_name = "avr3", |
| 100 | 100 | .description = "The device is a part of the avr3 family", |
| 101 | 101 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -103,7 +103,7 @@ pub const all_features = blk: { |
| 103 | 103 | .jmpcall, |
| 104 | 104 | }), |
| 105 | 105 | }; |
| 106 | result[@intFromEnum(Feature.avr31)] = .{ | |
| 106 | result[@backingInt(Feature.avr31)] = .{ | |
| 107 | 107 | .llvm_name = "avr31", |
| 108 | 108 | .description = "The device is a part of the avr31 family", |
| 109 | 109 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -111,7 +111,7 @@ pub const all_features = blk: { |
| 111 | 111 | .elpm, |
| 112 | 112 | }), |
| 113 | 113 | }; |
| 114 | result[@intFromEnum(Feature.avr35)] = .{ | |
| 114 | result[@backingInt(Feature.avr35)] = .{ | |
| 115 | 115 | .llvm_name = "avr35", |
| 116 | 116 | .description = "The device is a part of the avr35 family", |
| 117 | 117 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -122,7 +122,7 @@ pub const all_features = blk: { |
| 122 | 122 | .spm, |
| 123 | 123 | }), |
| 124 | 124 | }; |
| 125 | result[@intFromEnum(Feature.avr4)] = .{ | |
| 125 | result[@backingInt(Feature.avr4)] = .{ | |
| 126 | 126 | .llvm_name = "avr4", |
| 127 | 127 | .description = "The device is a part of the avr4 family", |
| 128 | 128 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -134,7 +134,7 @@ pub const all_features = blk: { |
| 134 | 134 | .spm, |
| 135 | 135 | }), |
| 136 | 136 | }; |
| 137 | result[@intFromEnum(Feature.avr5)] = .{ | |
| 137 | result[@backingInt(Feature.avr5)] = .{ | |
| 138 | 138 | .llvm_name = "avr5", |
| 139 | 139 | .description = "The device is a part of the avr5 family", |
| 140 | 140 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -146,7 +146,7 @@ pub const all_features = blk: { |
| 146 | 146 | .spm, |
| 147 | 147 | }), |
| 148 | 148 | }; |
| 149 | result[@intFromEnum(Feature.avr51)] = .{ | |
| 149 | result[@backingInt(Feature.avr51)] = .{ | |
| 150 | 150 | .llvm_name = "avr51", |
| 151 | 151 | .description = "The device is a part of the avr51 family", |
| 152 | 152 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -155,7 +155,7 @@ pub const all_features = blk: { |
| 155 | 155 | .elpmx, |
| 156 | 156 | }), |
| 157 | 157 | }; |
| 158 | result[@intFromEnum(Feature.avr6)] = .{ | |
| 158 | result[@backingInt(Feature.avr6)] = .{ | |
| 159 | 159 | .llvm_name = "avr6", |
| 160 | 160 | .description = "The device is a part of the avr6 family", |
| 161 | 161 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -163,7 +163,7 @@ pub const all_features = blk: { |
| 163 | 163 | .eijmpcall, |
| 164 | 164 | }), |
| 165 | 165 | }; |
| 166 | result[@intFromEnum(Feature.avrtiny)] = .{ | |
| 166 | result[@backingInt(Feature.avrtiny)] = .{ | |
| 167 | 167 | .llvm_name = "avrtiny", |
| 168 | 168 | .description = "The device is a part of the avrtiny family", |
| 169 | 169 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -174,82 +174,82 @@ pub const all_features = blk: { |
| 174 | 174 | .tinyencoding, |
| 175 | 175 | }), |
| 176 | 176 | }; |
| 177 | result[@intFromEnum(Feature.@"break")] = .{ | |
| 177 | result[@backingInt(Feature.@"break")] = .{ | |
| 178 | 178 | .llvm_name = "break", |
| 179 | 179 | .description = "The device supports the `BREAK` debugging instruction", |
| 180 | 180 | .dependencies = featureSet(&[_]Feature{}), |
| 181 | 181 | }; |
| 182 | result[@intFromEnum(Feature.des)] = .{ | |
| 182 | result[@backingInt(Feature.des)] = .{ | |
| 183 | 183 | .llvm_name = "des", |
| 184 | 184 | .description = "The device supports the `DES k` encryption instruction", |
| 185 | 185 | .dependencies = featureSet(&[_]Feature{}), |
| 186 | 186 | }; |
| 187 | result[@intFromEnum(Feature.eijmpcall)] = .{ | |
| 187 | result[@backingInt(Feature.eijmpcall)] = .{ | |
| 188 | 188 | .llvm_name = "eijmpcall", |
| 189 | 189 | .description = "The device supports the `EIJMP`/`EICALL` instructions", |
| 190 | 190 | .dependencies = featureSet(&[_]Feature{}), |
| 191 | 191 | }; |
| 192 | result[@intFromEnum(Feature.elpm)] = .{ | |
| 192 | result[@backingInt(Feature.elpm)] = .{ | |
| 193 | 193 | .llvm_name = "elpm", |
| 194 | 194 | .description = "The device supports the ELPM instruction", |
| 195 | 195 | .dependencies = featureSet(&[_]Feature{}), |
| 196 | 196 | }; |
| 197 | result[@intFromEnum(Feature.elpmx)] = .{ | |
| 197 | result[@backingInt(Feature.elpmx)] = .{ | |
| 198 | 198 | .llvm_name = "elpmx", |
| 199 | 199 | .description = "The device supports the `ELPM Rd, Z[+]` instructions", |
| 200 | 200 | .dependencies = featureSet(&[_]Feature{}), |
| 201 | 201 | }; |
| 202 | result[@intFromEnum(Feature.ijmpcall)] = .{ | |
| 202 | result[@backingInt(Feature.ijmpcall)] = .{ | |
| 203 | 203 | .llvm_name = "ijmpcall", |
| 204 | 204 | .description = "The device supports `IJMP`/`ICALL`instructions", |
| 205 | 205 | .dependencies = featureSet(&[_]Feature{}), |
| 206 | 206 | }; |
| 207 | result[@intFromEnum(Feature.jmpcall)] = .{ | |
| 207 | result[@backingInt(Feature.jmpcall)] = .{ | |
| 208 | 208 | .llvm_name = "jmpcall", |
| 209 | 209 | .description = "The device supports the `JMP` and `CALL` instructions", |
| 210 | 210 | .dependencies = featureSet(&[_]Feature{}), |
| 211 | 211 | }; |
| 212 | result[@intFromEnum(Feature.lowbytefirst)] = .{ | |
| 212 | result[@backingInt(Feature.lowbytefirst)] = .{ | |
| 213 | 213 | .llvm_name = "lowbytefirst", |
| 214 | 214 | .description = "Do the low byte first when writing a 16-bit port or storing a 16-bit word", |
| 215 | 215 | .dependencies = featureSet(&[_]Feature{}), |
| 216 | 216 | }; |
| 217 | result[@intFromEnum(Feature.lpm)] = .{ | |
| 217 | result[@backingInt(Feature.lpm)] = .{ | |
| 218 | 218 | .llvm_name = "lpm", |
| 219 | 219 | .description = "The device supports the `LPM` instruction", |
| 220 | 220 | .dependencies = featureSet(&[_]Feature{}), |
| 221 | 221 | }; |
| 222 | result[@intFromEnum(Feature.lpmx)] = .{ | |
| 222 | result[@backingInt(Feature.lpmx)] = .{ | |
| 223 | 223 | .llvm_name = "lpmx", |
| 224 | 224 | .description = "The device supports the `LPM Rd, Z[+]` instruction", |
| 225 | 225 | .dependencies = featureSet(&[_]Feature{}), |
| 226 | 226 | }; |
| 227 | result[@intFromEnum(Feature.memmappedregs)] = .{ | |
| 227 | result[@backingInt(Feature.memmappedregs)] = .{ | |
| 228 | 228 | .llvm_name = "memmappedregs", |
| 229 | 229 | .description = "The device has CPU registers mapped in data address space", |
| 230 | 230 | .dependencies = featureSet(&[_]Feature{}), |
| 231 | 231 | }; |
| 232 | result[@intFromEnum(Feature.movw)] = .{ | |
| 232 | result[@backingInt(Feature.movw)] = .{ | |
| 233 | 233 | .llvm_name = "movw", |
| 234 | 234 | .description = "The device supports the 16-bit MOVW instruction", |
| 235 | 235 | .dependencies = featureSet(&[_]Feature{}), |
| 236 | 236 | }; |
| 237 | result[@intFromEnum(Feature.mul)] = .{ | |
| 237 | result[@backingInt(Feature.mul)] = .{ | |
| 238 | 238 | .llvm_name = "mul", |
| 239 | 239 | .description = "The device supports the multiplication instructions", |
| 240 | 240 | .dependencies = featureSet(&[_]Feature{}), |
| 241 | 241 | }; |
| 242 | result[@intFromEnum(Feature.rmw)] = .{ | |
| 242 | result[@backingInt(Feature.rmw)] = .{ | |
| 243 | 243 | .llvm_name = "rmw", |
| 244 | 244 | .description = "The device supports the read-write-modify instructions: XCH, LAS, LAC, LAT", |
| 245 | 245 | .dependencies = featureSet(&[_]Feature{}), |
| 246 | 246 | }; |
| 247 | result[@intFromEnum(Feature.smallstack)] = .{ | |
| 247 | result[@backingInt(Feature.smallstack)] = .{ | |
| 248 | 248 | .llvm_name = "smallstack", |
| 249 | 249 | .description = "The device has an 8-bit stack pointer", |
| 250 | 250 | .dependencies = featureSet(&[_]Feature{}), |
| 251 | 251 | }; |
| 252 | result[@intFromEnum(Feature.special)] = .{ | |
| 252 | result[@backingInt(Feature.special)] = .{ | |
| 253 | 253 | .llvm_name = "special", |
| 254 | 254 | .description = "Enable use of the entire instruction set - used for debugging", |
| 255 | 255 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -272,32 +272,32 @@ pub const all_features = blk: { |
| 272 | 272 | .sram, |
| 273 | 273 | }), |
| 274 | 274 | }; |
| 275 | result[@intFromEnum(Feature.spm)] = .{ | |
| 275 | result[@backingInt(Feature.spm)] = .{ | |
| 276 | 276 | .llvm_name = "spm", |
| 277 | 277 | .description = "The device supports the `SPM` instruction", |
| 278 | 278 | .dependencies = featureSet(&[_]Feature{}), |
| 279 | 279 | }; |
| 280 | result[@intFromEnum(Feature.spmx)] = .{ | |
| 280 | result[@backingInt(Feature.spmx)] = .{ | |
| 281 | 281 | .llvm_name = "spmx", |
| 282 | 282 | .description = "The device supports the `SPM Z+` instruction", |
| 283 | 283 | .dependencies = featureSet(&[_]Feature{}), |
| 284 | 284 | }; |
| 285 | result[@intFromEnum(Feature.sram)] = .{ | |
| 285 | result[@backingInt(Feature.sram)] = .{ | |
| 286 | 286 | .llvm_name = "sram", |
| 287 | 287 | .description = "The device has random access memory", |
| 288 | 288 | .dependencies = featureSet(&[_]Feature{}), |
| 289 | 289 | }; |
| 290 | result[@intFromEnum(Feature.tinyencoding)] = .{ | |
| 290 | result[@backingInt(Feature.tinyencoding)] = .{ | |
| 291 | 291 | .llvm_name = "tinyencoding", |
| 292 | 292 | .description = "The device has Tiny core specific instruction encodings", |
| 293 | 293 | .dependencies = featureSet(&[_]Feature{}), |
| 294 | 294 | }; |
| 295 | result[@intFromEnum(Feature.wrappingrjmp)] = .{ | |
| 295 | result[@backingInt(Feature.wrappingrjmp)] = .{ | |
| 296 | 296 | .llvm_name = "wrappingrjmp", |
| 297 | 297 | .description = "The device potentially requires emitting rjmp that wraps across the flash boundary", |
| 298 | 298 | .dependencies = featureSet(&[_]Feature{}), |
| 299 | 299 | }; |
| 300 | result[@intFromEnum(Feature.xmega)] = .{ | |
| 300 | result[@backingInt(Feature.xmega)] = .{ | |
| 301 | 301 | .llvm_name = "xmega", |
| 302 | 302 | .description = "The device is a part of the xmega family", |
| 303 | 303 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -320,7 +320,7 @@ pub const all_features = blk: { |
| 320 | 320 | .sram, |
| 321 | 321 | }), |
| 322 | 322 | }; |
| 323 | result[@intFromEnum(Feature.xmega2)] = .{ | |
| 323 | result[@backingInt(Feature.xmega2)] = .{ | |
| 324 | 324 | .llvm_name = "xmega2", |
| 325 | 325 | .description = "The device is a part of the xmega2 family", |
| 326 | 326 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -339,7 +339,7 @@ pub const all_features = blk: { |
| 339 | 339 | .sram, |
| 340 | 340 | }), |
| 341 | 341 | }; |
| 342 | result[@intFromEnum(Feature.xmega3)] = .{ | |
| 342 | result[@backingInt(Feature.xmega3)] = .{ | |
| 343 | 343 | .llvm_name = "xmega3", |
| 344 | 344 | .description = "The device is a part of the xmega3 family", |
| 345 | 345 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -356,7 +356,7 @@ pub const all_features = blk: { |
| 356 | 356 | .sram, |
| 357 | 357 | }), |
| 358 | 358 | }; |
| 359 | result[@intFromEnum(Feature.xmega4)] = .{ | |
| 359 | result[@backingInt(Feature.xmega4)] = .{ | |
| 360 | 360 | .llvm_name = "xmega4", |
| 361 | 361 | .description = "The device is a part of the xmega4 family", |
| 362 | 362 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -377,7 +377,7 @@ pub const all_features = blk: { |
| 377 | 377 | .sram, |
| 378 | 378 | }), |
| 379 | 379 | }; |
| 380 | result[@intFromEnum(Feature.xmegau)] = .{ | |
| 380 | result[@backingInt(Feature.xmegau)] = .{ | |
| 381 | 381 | .llvm_name = "xmegau", |
| 382 | 382 | .description = "The device is a part of the xmegau family", |
| 383 | 383 | .dependencies = featureSet(&[_]Feature{ |
lib/std/Target/bpf.zig+4-4| ... | ... | @@ -20,22 +20,22 @@ pub const all_features = blk: { |
| 20 | 20 | const len = @typeInfo(Feature).@"enum".field_names.len; |
| 21 | 21 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); |
| 22 | 22 | var result: [len]CpuFeature = undefined; |
| 23 | result[@intFromEnum(Feature.allows_misaligned_mem_access)] = .{ | |
| 23 | result[@backingInt(Feature.allows_misaligned_mem_access)] = .{ | |
| 24 | 24 | .llvm_name = "allows-misaligned-mem-access", |
| 25 | 25 | .description = "Allows misaligned memory access", |
| 26 | 26 | .dependencies = featureSet(&[_]Feature{}), |
| 27 | 27 | }; |
| 28 | result[@intFromEnum(Feature.alu32)] = .{ | |
| 28 | result[@backingInt(Feature.alu32)] = .{ | |
| 29 | 29 | .llvm_name = "alu32", |
| 30 | 30 | .description = "Enable ALU32 instructions", |
| 31 | 31 | .dependencies = featureSet(&[_]Feature{}), |
| 32 | 32 | }; |
| 33 | result[@intFromEnum(Feature.dummy)] = .{ | |
| 33 | result[@backingInt(Feature.dummy)] = .{ | |
| 34 | 34 | .llvm_name = "dummy", |
| 35 | 35 | .description = "unused feature", |
| 36 | 36 | .dependencies = featureSet(&[_]Feature{}), |
| 37 | 37 | }; |
| 38 | result[@intFromEnum(Feature.dwarfris)] = .{ | |
| 38 | result[@backingInt(Feature.dwarfris)] = .{ | |
| 39 | 39 | .llvm_name = "dwarfris", |
| 40 | 40 | .description = "Disable MCAsmInfo DwarfUsesRelocationsAcrossSections", |
| 41 | 41 | .dependencies = featureSet(&[_]Feature{}), |
lib/std/Target/csky.zig+63-63| ... | ... | @@ -79,26 +79,26 @@ pub const all_features = blk: { |
| 79 | 79 | const len = @typeInfo(Feature).@"enum".field_names.len; |
| 80 | 80 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); |
| 81 | 81 | var result: [len]CpuFeature = undefined; |
| 82 | result[@intFromEnum(Feature.@"10e60")] = .{ | |
| 82 | result[@backingInt(Feature.@"10e60")] = .{ | |
| 83 | 83 | .llvm_name = "10e60", |
| 84 | 84 | .description = "Support CSKY 10e60 instructions", |
| 85 | 85 | .dependencies = featureSet(&[_]Feature{ |
| 86 | 86 | .@"7e10", |
| 87 | 87 | }), |
| 88 | 88 | }; |
| 89 | result[@intFromEnum(Feature.@"2e3")] = .{ | |
| 89 | result[@backingInt(Feature.@"2e3")] = .{ | |
| 90 | 90 | .llvm_name = "2e3", |
| 91 | 91 | .description = "Support CSKY 2e3 instructions", |
| 92 | 92 | .dependencies = featureSet(&[_]Feature{ |
| 93 | 93 | .e2, |
| 94 | 94 | }), |
| 95 | 95 | }; |
| 96 | result[@intFromEnum(Feature.@"3e3r1")] = .{ | |
| 96 | result[@backingInt(Feature.@"3e3r1")] = .{ | |
| 97 | 97 | .llvm_name = "3e3r1", |
| 98 | 98 | .description = "Support CSKY 3e3r1 instructions", |
| 99 | 99 | .dependencies = featureSet(&[_]Feature{}), |
| 100 | 100 | }; |
| 101 | result[@intFromEnum(Feature.@"3e3r2")] = .{ | |
| 101 | result[@backingInt(Feature.@"3e3r2")] = .{ | |
| 102 | 102 | .llvm_name = "3e3r2", |
| 103 | 103 | .description = "Support CSKY 3e3r2 instructions", |
| 104 | 104 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -106,311 +106,311 @@ pub const all_features = blk: { |
| 106 | 106 | .doloop, |
| 107 | 107 | }), |
| 108 | 108 | }; |
| 109 | result[@intFromEnum(Feature.@"3e3r3")] = .{ | |
| 109 | result[@backingInt(Feature.@"3e3r3")] = .{ | |
| 110 | 110 | .llvm_name = "3e3r3", |
| 111 | 111 | .description = "Support CSKY 3e3r3 instructions", |
| 112 | 112 | .dependencies = featureSet(&[_]Feature{ |
| 113 | 113 | .doloop, |
| 114 | 114 | }), |
| 115 | 115 | }; |
| 116 | result[@intFromEnum(Feature.@"3e7")] = .{ | |
| 116 | result[@backingInt(Feature.@"3e7")] = .{ | |
| 117 | 117 | .llvm_name = "3e7", |
| 118 | 118 | .description = "Support CSKY 3e7 instructions", |
| 119 | 119 | .dependencies = featureSet(&[_]Feature{ |
| 120 | 120 | .@"2e3", |
| 121 | 121 | }), |
| 122 | 122 | }; |
| 123 | result[@intFromEnum(Feature.@"7e10")] = .{ | |
| 123 | result[@backingInt(Feature.@"7e10")] = .{ | |
| 124 | 124 | .llvm_name = "7e10", |
| 125 | 125 | .description = "Support CSKY 7e10 instructions", |
| 126 | 126 | .dependencies = featureSet(&[_]Feature{ |
| 127 | 127 | .@"3e7", |
| 128 | 128 | }), |
| 129 | 129 | }; |
| 130 | result[@intFromEnum(Feature.btst16)] = .{ | |
| 130 | result[@backingInt(Feature.btst16)] = .{ | |
| 131 | 131 | .llvm_name = "btst16", |
| 132 | 132 | .description = "Use the 16-bit btsti instruction", |
| 133 | 133 | .dependencies = featureSet(&[_]Feature{}), |
| 134 | 134 | }; |
| 135 | result[@intFromEnum(Feature.cache)] = .{ | |
| 135 | result[@backingInt(Feature.cache)] = .{ | |
| 136 | 136 | .llvm_name = "cache", |
| 137 | 137 | .description = "Enable cache", |
| 138 | 138 | .dependencies = featureSet(&[_]Feature{}), |
| 139 | 139 | }; |
| 140 | result[@intFromEnum(Feature.ccrt)] = .{ | |
| 140 | result[@backingInt(Feature.ccrt)] = .{ | |
| 141 | 141 | .llvm_name = "ccrt", |
| 142 | 142 | .description = "Use CSKY compiler runtime", |
| 143 | 143 | .dependencies = featureSet(&[_]Feature{}), |
| 144 | 144 | }; |
| 145 | result[@intFromEnum(Feature.ck801)] = .{ | |
| 145 | result[@backingInt(Feature.ck801)] = .{ | |
| 146 | 146 | .llvm_name = "ck801", |
| 147 | 147 | .description = "CSKY ck801 processors", |
| 148 | 148 | .dependencies = featureSet(&[_]Feature{}), |
| 149 | 149 | }; |
| 150 | result[@intFromEnum(Feature.ck802)] = .{ | |
| 150 | result[@backingInt(Feature.ck802)] = .{ | |
| 151 | 151 | .llvm_name = "ck802", |
| 152 | 152 | .description = "CSKY ck802 processors", |
| 153 | 153 | .dependencies = featureSet(&[_]Feature{}), |
| 154 | 154 | }; |
| 155 | result[@intFromEnum(Feature.ck803)] = .{ | |
| 155 | result[@backingInt(Feature.ck803)] = .{ | |
| 156 | 156 | .llvm_name = "ck803", |
| 157 | 157 | .description = "CSKY ck803 processors", |
| 158 | 158 | .dependencies = featureSet(&[_]Feature{}), |
| 159 | 159 | }; |
| 160 | result[@intFromEnum(Feature.ck803s)] = .{ | |
| 160 | result[@backingInt(Feature.ck803s)] = .{ | |
| 161 | 161 | .llvm_name = "ck803s", |
| 162 | 162 | .description = "CSKY ck803s processors", |
| 163 | 163 | .dependencies = featureSet(&[_]Feature{}), |
| 164 | 164 | }; |
| 165 | result[@intFromEnum(Feature.ck804)] = .{ | |
| 165 | result[@backingInt(Feature.ck804)] = .{ | |
| 166 | 166 | .llvm_name = "ck804", |
| 167 | 167 | .description = "CSKY ck804 processors", |
| 168 | 168 | .dependencies = featureSet(&[_]Feature{}), |
| 169 | 169 | }; |
| 170 | result[@intFromEnum(Feature.ck805)] = .{ | |
| 170 | result[@backingInt(Feature.ck805)] = .{ | |
| 171 | 171 | .llvm_name = "ck805", |
| 172 | 172 | .description = "CSKY ck805 processors", |
| 173 | 173 | .dependencies = featureSet(&[_]Feature{}), |
| 174 | 174 | }; |
| 175 | result[@intFromEnum(Feature.ck807)] = .{ | |
| 175 | result[@backingInt(Feature.ck807)] = .{ | |
| 176 | 176 | .llvm_name = "ck807", |
| 177 | 177 | .description = "CSKY ck807 processors", |
| 178 | 178 | .dependencies = featureSet(&[_]Feature{}), |
| 179 | 179 | }; |
| 180 | result[@intFromEnum(Feature.ck810)] = .{ | |
| 180 | result[@backingInt(Feature.ck810)] = .{ | |
| 181 | 181 | .llvm_name = "ck810", |
| 182 | 182 | .description = "CSKY ck810 processors", |
| 183 | 183 | .dependencies = featureSet(&[_]Feature{}), |
| 184 | 184 | }; |
| 185 | result[@intFromEnum(Feature.ck810v)] = .{ | |
| 185 | result[@backingInt(Feature.ck810v)] = .{ | |
| 186 | 186 | .llvm_name = "ck810v", |
| 187 | 187 | .description = "CSKY ck810v processors", |
| 188 | 188 | .dependencies = featureSet(&[_]Feature{}), |
| 189 | 189 | }; |
| 190 | result[@intFromEnum(Feature.ck860)] = .{ | |
| 190 | result[@backingInt(Feature.ck860)] = .{ | |
| 191 | 191 | .llvm_name = "ck860", |
| 192 | 192 | .description = "CSKY ck860 processors", |
| 193 | 193 | .dependencies = featureSet(&[_]Feature{}), |
| 194 | 194 | }; |
| 195 | result[@intFromEnum(Feature.ck860v)] = .{ | |
| 195 | result[@backingInt(Feature.ck860v)] = .{ | |
| 196 | 196 | .llvm_name = "ck860v", |
| 197 | 197 | .description = "CSKY ck860v processors", |
| 198 | 198 | .dependencies = featureSet(&[_]Feature{}), |
| 199 | 199 | }; |
| 200 | result[@intFromEnum(Feature.constpool)] = .{ | |
| 200 | result[@backingInt(Feature.constpool)] = .{ | |
| 201 | 201 | .llvm_name = "constpool", |
| 202 | 202 | .description = "Dump the constant pool by compiler", |
| 203 | 203 | .dependencies = featureSet(&[_]Feature{}), |
| 204 | 204 | }; |
| 205 | result[@intFromEnum(Feature.doloop)] = .{ | |
| 205 | result[@backingInt(Feature.doloop)] = .{ | |
| 206 | 206 | .llvm_name = "doloop", |
| 207 | 207 | .description = "Enable doloop instructions", |
| 208 | 208 | .dependencies = featureSet(&[_]Feature{}), |
| 209 | 209 | }; |
| 210 | result[@intFromEnum(Feature.dsp1e2)] = .{ | |
| 210 | result[@backingInt(Feature.dsp1e2)] = .{ | |
| 211 | 211 | .llvm_name = "dsp1e2", |
| 212 | 212 | .description = "Support CSKY dsp1e2 instructions", |
| 213 | 213 | .dependencies = featureSet(&[_]Feature{}), |
| 214 | 214 | }; |
| 215 | result[@intFromEnum(Feature.dsp_silan)] = .{ | |
| 215 | result[@backingInt(Feature.dsp_silan)] = .{ | |
| 216 | 216 | .llvm_name = "dsp_silan", |
| 217 | 217 | .description = "Enable DSP Silan instructions", |
| 218 | 218 | .dependencies = featureSet(&[_]Feature{}), |
| 219 | 219 | }; |
| 220 | result[@intFromEnum(Feature.dspe60)] = .{ | |
| 220 | result[@backingInt(Feature.dspe60)] = .{ | |
| 221 | 221 | .llvm_name = "dspe60", |
| 222 | 222 | .description = "Support CSKY dspe60 instructions", |
| 223 | 223 | .dependencies = featureSet(&[_]Feature{}), |
| 224 | 224 | }; |
| 225 | result[@intFromEnum(Feature.dspv2)] = .{ | |
| 225 | result[@backingInt(Feature.dspv2)] = .{ | |
| 226 | 226 | .llvm_name = "dspv2", |
| 227 | 227 | .description = "Enable DSP V2.0 instructions", |
| 228 | 228 | .dependencies = featureSet(&[_]Feature{}), |
| 229 | 229 | }; |
| 230 | result[@intFromEnum(Feature.e1)] = .{ | |
| 230 | result[@backingInt(Feature.e1)] = .{ | |
| 231 | 231 | .llvm_name = "e1", |
| 232 | 232 | .description = "Support CSKY e1 instructions", |
| 233 | 233 | .dependencies = featureSet(&[_]Feature{ |
| 234 | 234 | .elrw, |
| 235 | 235 | }), |
| 236 | 236 | }; |
| 237 | result[@intFromEnum(Feature.e2)] = .{ | |
| 237 | result[@backingInt(Feature.e2)] = .{ | |
| 238 | 238 | .llvm_name = "e2", |
| 239 | 239 | .description = "Support CSKY e2 instructions", |
| 240 | 240 | .dependencies = featureSet(&[_]Feature{ |
| 241 | 241 | .e1, |
| 242 | 242 | }), |
| 243 | 243 | }; |
| 244 | result[@intFromEnum(Feature.edsp)] = .{ | |
| 244 | result[@backingInt(Feature.edsp)] = .{ | |
| 245 | 245 | .llvm_name = "edsp", |
| 246 | 246 | .description = "Enable DSP instructions", |
| 247 | 247 | .dependencies = featureSet(&[_]Feature{}), |
| 248 | 248 | }; |
| 249 | result[@intFromEnum(Feature.elrw)] = .{ | |
| 249 | result[@backingInt(Feature.elrw)] = .{ | |
| 250 | 250 | .llvm_name = "elrw", |
| 251 | 251 | .description = "Use the extend LRW instruction", |
| 252 | 252 | .dependencies = featureSet(&[_]Feature{}), |
| 253 | 253 | }; |
| 254 | result[@intFromEnum(Feature.fdivdu)] = .{ | |
| 254 | result[@backingInt(Feature.fdivdu)] = .{ | |
| 255 | 255 | .llvm_name = "fdivdu", |
| 256 | 256 | .description = "Enable float divide instructions", |
| 257 | 257 | .dependencies = featureSet(&[_]Feature{}), |
| 258 | 258 | }; |
| 259 | result[@intFromEnum(Feature.float1e2)] = .{ | |
| 259 | result[@backingInt(Feature.float1e2)] = .{ | |
| 260 | 260 | .llvm_name = "float1e2", |
| 261 | 261 | .description = "Support CSKY float1e2 instructions", |
| 262 | 262 | .dependencies = featureSet(&[_]Feature{}), |
| 263 | 263 | }; |
| 264 | result[@intFromEnum(Feature.float1e3)] = .{ | |
| 264 | result[@backingInt(Feature.float1e3)] = .{ | |
| 265 | 265 | .llvm_name = "float1e3", |
| 266 | 266 | .description = "Support CSKY float1e3 instructions", |
| 267 | 267 | .dependencies = featureSet(&[_]Feature{}), |
| 268 | 268 | }; |
| 269 | result[@intFromEnum(Feature.float3e4)] = .{ | |
| 269 | result[@backingInt(Feature.float3e4)] = .{ | |
| 270 | 270 | .llvm_name = "float3e4", |
| 271 | 271 | .description = "Support CSKY float3e4 instructions", |
| 272 | 272 | .dependencies = featureSet(&[_]Feature{}), |
| 273 | 273 | }; |
| 274 | result[@intFromEnum(Feature.float7e60)] = .{ | |
| 274 | result[@backingInt(Feature.float7e60)] = .{ | |
| 275 | 275 | .llvm_name = "float7e60", |
| 276 | 276 | .description = "Support CSKY float7e60 instructions", |
| 277 | 277 | .dependencies = featureSet(&[_]Feature{}), |
| 278 | 278 | }; |
| 279 | result[@intFromEnum(Feature.floate1)] = .{ | |
| 279 | result[@backingInt(Feature.floate1)] = .{ | |
| 280 | 280 | .llvm_name = "floate1", |
| 281 | 281 | .description = "Support CSKY floate1 instructions", |
| 282 | 282 | .dependencies = featureSet(&[_]Feature{}), |
| 283 | 283 | }; |
| 284 | result[@intFromEnum(Feature.fpuv2_df)] = .{ | |
| 284 | result[@backingInt(Feature.fpuv2_df)] = .{ | |
| 285 | 285 | .llvm_name = "fpuv2_df", |
| 286 | 286 | .description = "Enable FPUv2 double float instructions", |
| 287 | 287 | .dependencies = featureSet(&[_]Feature{}), |
| 288 | 288 | }; |
| 289 | result[@intFromEnum(Feature.fpuv2_sf)] = .{ | |
| 289 | result[@backingInt(Feature.fpuv2_sf)] = .{ | |
| 290 | 290 | .llvm_name = "fpuv2_sf", |
| 291 | 291 | .description = "Enable FPUv2 single float instructions", |
| 292 | 292 | .dependencies = featureSet(&[_]Feature{}), |
| 293 | 293 | }; |
| 294 | result[@intFromEnum(Feature.fpuv3_df)] = .{ | |
| 294 | result[@backingInt(Feature.fpuv3_df)] = .{ | |
| 295 | 295 | .llvm_name = "fpuv3_df", |
| 296 | 296 | .description = "Enable FPUv3 double float instructions", |
| 297 | 297 | .dependencies = featureSet(&[_]Feature{}), |
| 298 | 298 | }; |
| 299 | result[@intFromEnum(Feature.fpuv3_hf)] = .{ | |
| 299 | result[@backingInt(Feature.fpuv3_hf)] = .{ | |
| 300 | 300 | .llvm_name = "fpuv3_hf", |
| 301 | 301 | .description = "Enable FPUv3 half precision operate instructions", |
| 302 | 302 | .dependencies = featureSet(&[_]Feature{}), |
| 303 | 303 | }; |
| 304 | result[@intFromEnum(Feature.fpuv3_hi)] = .{ | |
| 304 | result[@backingInt(Feature.fpuv3_hi)] = .{ | |
| 305 | 305 | .llvm_name = "fpuv3_hi", |
| 306 | 306 | .description = "Enable FPUv3 half word converting instructions", |
| 307 | 307 | .dependencies = featureSet(&[_]Feature{}), |
| 308 | 308 | }; |
| 309 | result[@intFromEnum(Feature.fpuv3_sf)] = .{ | |
| 309 | result[@backingInt(Feature.fpuv3_sf)] = .{ | |
| 310 | 310 | .llvm_name = "fpuv3_sf", |
| 311 | 311 | .description = "Enable FPUv3 single float instructions", |
| 312 | 312 | .dependencies = featureSet(&[_]Feature{}), |
| 313 | 313 | }; |
| 314 | result[@intFromEnum(Feature.hard_float)] = .{ | |
| 314 | result[@backingInt(Feature.hard_float)] = .{ | |
| 315 | 315 | .llvm_name = "hard-float", |
| 316 | 316 | .description = "Use hard floating point features", |
| 317 | 317 | .dependencies = featureSet(&[_]Feature{}), |
| 318 | 318 | }; |
| 319 | result[@intFromEnum(Feature.hard_float_abi)] = .{ | |
| 319 | result[@backingInt(Feature.hard_float_abi)] = .{ | |
| 320 | 320 | .llvm_name = "hard-float-abi", |
| 321 | 321 | .description = "Use hard floating point ABI to pass args", |
| 322 | 322 | .dependencies = featureSet(&[_]Feature{}), |
| 323 | 323 | }; |
| 324 | result[@intFromEnum(Feature.hard_tp)] = .{ | |
| 324 | result[@backingInt(Feature.hard_tp)] = .{ | |
| 325 | 325 | .llvm_name = "hard-tp", |
| 326 | 326 | .description = "Enable TLS Pointer register", |
| 327 | 327 | .dependencies = featureSet(&[_]Feature{}), |
| 328 | 328 | }; |
| 329 | result[@intFromEnum(Feature.high_registers)] = .{ | |
| 329 | result[@backingInt(Feature.high_registers)] = .{ | |
| 330 | 330 | .llvm_name = "high-registers", |
| 331 | 331 | .description = "Enable r16-r31 registers", |
| 332 | 332 | .dependencies = featureSet(&[_]Feature{}), |
| 333 | 333 | }; |
| 334 | result[@intFromEnum(Feature.hwdiv)] = .{ | |
| 334 | result[@backingInt(Feature.hwdiv)] = .{ | |
| 335 | 335 | .llvm_name = "hwdiv", |
| 336 | 336 | .description = "Enable divide instructions", |
| 337 | 337 | .dependencies = featureSet(&[_]Feature{}), |
| 338 | 338 | }; |
| 339 | result[@intFromEnum(Feature.istack)] = .{ | |
| 339 | result[@backingInt(Feature.istack)] = .{ | |
| 340 | 340 | .llvm_name = "istack", |
| 341 | 341 | .description = "Enable interrupt attribute", |
| 342 | 342 | .dependencies = featureSet(&[_]Feature{}), |
| 343 | 343 | }; |
| 344 | result[@intFromEnum(Feature.java)] = .{ | |
| 344 | result[@backingInt(Feature.java)] = .{ | |
| 345 | 345 | .llvm_name = "java", |
| 346 | 346 | .description = "Enable java instructions", |
| 347 | 347 | .dependencies = featureSet(&[_]Feature{}), |
| 348 | 348 | }; |
| 349 | result[@intFromEnum(Feature.mp)] = .{ | |
| 349 | result[@backingInt(Feature.mp)] = .{ | |
| 350 | 350 | .llvm_name = "mp", |
| 351 | 351 | .description = "Support CSKY mp instructions", |
| 352 | 352 | .dependencies = featureSet(&[_]Feature{ |
| 353 | 353 | .@"2e3", |
| 354 | 354 | }), |
| 355 | 355 | }; |
| 356 | result[@intFromEnum(Feature.mp1e2)] = .{ | |
| 356 | result[@backingInt(Feature.mp1e2)] = .{ | |
| 357 | 357 | .llvm_name = "mp1e2", |
| 358 | 358 | .description = "Support CSKY mp1e2 instructions", |
| 359 | 359 | .dependencies = featureSet(&[_]Feature{ |
| 360 | 360 | .@"3e7", |
| 361 | 361 | }), |
| 362 | 362 | }; |
| 363 | result[@intFromEnum(Feature.multiple_stld)] = .{ | |
| 363 | result[@backingInt(Feature.multiple_stld)] = .{ | |
| 364 | 364 | .llvm_name = "multiple_stld", |
| 365 | 365 | .description = "Enable multiple load/store instructions", |
| 366 | 366 | .dependencies = featureSet(&[_]Feature{}), |
| 367 | 367 | }; |
| 368 | result[@intFromEnum(Feature.nvic)] = .{ | |
| 368 | result[@backingInt(Feature.nvic)] = .{ | |
| 369 | 369 | .llvm_name = "nvic", |
| 370 | 370 | .description = "Enable NVIC", |
| 371 | 371 | .dependencies = featureSet(&[_]Feature{}), |
| 372 | 372 | }; |
| 373 | result[@intFromEnum(Feature.pushpop)] = .{ | |
| 373 | result[@backingInt(Feature.pushpop)] = .{ | |
| 374 | 374 | .llvm_name = "pushpop", |
| 375 | 375 | .description = "Enable push/pop instructions", |
| 376 | 376 | .dependencies = featureSet(&[_]Feature{}), |
| 377 | 377 | }; |
| 378 | result[@intFromEnum(Feature.smart)] = .{ | |
| 378 | result[@backingInt(Feature.smart)] = .{ | |
| 379 | 379 | .llvm_name = "smart", |
| 380 | 380 | .description = "Let CPU work in Smart Mode", |
| 381 | 381 | .dependencies = featureSet(&[_]Feature{}), |
| 382 | 382 | }; |
| 383 | result[@intFromEnum(Feature.soft_tp)] = .{ | |
| 383 | result[@backingInt(Feature.soft_tp)] = .{ | |
| 384 | 384 | .llvm_name = "soft-tp", |
| 385 | 385 | .description = "Disable TLS Pointer register", |
| 386 | 386 | .dependencies = featureSet(&[_]Feature{}), |
| 387 | 387 | }; |
| 388 | result[@intFromEnum(Feature.stack_size)] = .{ | |
| 388 | result[@backingInt(Feature.stack_size)] = .{ | |
| 389 | 389 | .llvm_name = "stack-size", |
| 390 | 390 | .description = "Output stack size information", |
| 391 | 391 | .dependencies = featureSet(&[_]Feature{}), |
| 392 | 392 | }; |
| 393 | result[@intFromEnum(Feature.trust)] = .{ | |
| 393 | result[@backingInt(Feature.trust)] = .{ | |
| 394 | 394 | .llvm_name = "trust", |
| 395 | 395 | .description = "Enable trust instructions", |
| 396 | 396 | .dependencies = featureSet(&[_]Feature{}), |
| 397 | 397 | }; |
| 398 | result[@intFromEnum(Feature.vdsp2e3)] = .{ | |
| 398 | result[@backingInt(Feature.vdsp2e3)] = .{ | |
| 399 | 399 | .llvm_name = "vdsp2e3", |
| 400 | 400 | .description = "Support CSKY vdsp2e3 instructions", |
| 401 | 401 | .dependencies = featureSet(&[_]Feature{}), |
| 402 | 402 | }; |
| 403 | result[@intFromEnum(Feature.vdsp2e60f)] = .{ | |
| 403 | result[@backingInt(Feature.vdsp2e60f)] = .{ | |
| 404 | 404 | .llvm_name = "vdsp2e60f", |
| 405 | 405 | .description = "Support CSKY vdsp2e60f instructions", |
| 406 | 406 | .dependencies = featureSet(&[_]Feature{}), |
| 407 | 407 | }; |
| 408 | result[@intFromEnum(Feature.vdspv1)] = .{ | |
| 408 | result[@backingInt(Feature.vdspv1)] = .{ | |
| 409 | 409 | .llvm_name = "vdspv1", |
| 410 | 410 | .description = "Enable 128bit vdsp-v1 instructions", |
| 411 | 411 | .dependencies = featureSet(&[_]Feature{}), |
| 412 | 412 | }; |
| 413 | result[@intFromEnum(Feature.vdspv2)] = .{ | |
| 413 | result[@backingInt(Feature.vdspv2)] = .{ | |
| 414 | 414 | .llvm_name = "vdspv2", |
| 415 | 415 | .description = "Enable vdsp-v2 instructions", |
| 416 | 416 | .dependencies = featureSet(&[_]Feature{}), |
lib/std/Target/hexagon.zig+47-47| ... | ... | @@ -63,77 +63,77 @@ pub const all_features = blk: { |
| 63 | 63 | const len = @typeInfo(Feature).@"enum".field_names.len; |
| 64 | 64 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); |
| 65 | 65 | var result: [len]CpuFeature = undefined; |
| 66 | result[@intFromEnum(Feature.audio)] = .{ | |
| 66 | result[@backingInt(Feature.audio)] = .{ | |
| 67 | 67 | .llvm_name = "audio", |
| 68 | 68 | .description = "Hexagon Audio extension instructions", |
| 69 | 69 | .dependencies = featureSet(&[_]Feature{}), |
| 70 | 70 | }; |
| 71 | result[@intFromEnum(Feature.cabac)] = .{ | |
| 71 | result[@backingInt(Feature.cabac)] = .{ | |
| 72 | 72 | .llvm_name = "cabac", |
| 73 | 73 | .description = "Emit the CABAC instruction", |
| 74 | 74 | .dependencies = featureSet(&[_]Feature{}), |
| 75 | 75 | }; |
| 76 | result[@intFromEnum(Feature.compound)] = .{ | |
| 76 | result[@backingInt(Feature.compound)] = .{ | |
| 77 | 77 | .llvm_name = "compound", |
| 78 | 78 | .description = "Use compound instructions", |
| 79 | 79 | .dependencies = featureSet(&[_]Feature{}), |
| 80 | 80 | }; |
| 81 | result[@intFromEnum(Feature.duplex)] = .{ | |
| 81 | result[@backingInt(Feature.duplex)] = .{ | |
| 82 | 82 | .llvm_name = "duplex", |
| 83 | 83 | .description = "Enable generation of duplex instruction", |
| 84 | 84 | .dependencies = featureSet(&[_]Feature{}), |
| 85 | 85 | }; |
| 86 | result[@intFromEnum(Feature.hvx)] = .{ | |
| 86 | result[@backingInt(Feature.hvx)] = .{ | |
| 87 | 87 | .llvm_name = "hvx", |
| 88 | 88 | .description = "Hexagon HVX instructions", |
| 89 | 89 | .dependencies = featureSet(&[_]Feature{}), |
| 90 | 90 | }; |
| 91 | result[@intFromEnum(Feature.hvx_ieee_fp)] = .{ | |
| 91 | result[@backingInt(Feature.hvx_ieee_fp)] = .{ | |
| 92 | 92 | .llvm_name = "hvx-ieee-fp", |
| 93 | 93 | .description = "Hexagon HVX IEEE floating point instructions", |
| 94 | 94 | .dependencies = featureSet(&[_]Feature{}), |
| 95 | 95 | }; |
| 96 | result[@intFromEnum(Feature.hvx_length128b)] = .{ | |
| 96 | result[@backingInt(Feature.hvx_length128b)] = .{ | |
| 97 | 97 | .llvm_name = "hvx-length128b", |
| 98 | 98 | .description = "Hexagon HVX 128B instructions", |
| 99 | 99 | .dependencies = featureSet(&[_]Feature{ |
| 100 | 100 | .hvx, |
| 101 | 101 | }), |
| 102 | 102 | }; |
| 103 | result[@intFromEnum(Feature.hvx_length64b)] = .{ | |
| 103 | result[@backingInt(Feature.hvx_length64b)] = .{ | |
| 104 | 104 | .llvm_name = "hvx-length64b", |
| 105 | 105 | .description = "Hexagon HVX 64B instructions", |
| 106 | 106 | .dependencies = featureSet(&[_]Feature{ |
| 107 | 107 | .hvx, |
| 108 | 108 | }), |
| 109 | 109 | }; |
| 110 | result[@intFromEnum(Feature.hvx_qfloat)] = .{ | |
| 110 | result[@backingInt(Feature.hvx_qfloat)] = .{ | |
| 111 | 111 | .llvm_name = "hvx-qfloat", |
| 112 | 112 | .description = "Hexagon HVX QFloating point instructions", |
| 113 | 113 | .dependencies = featureSet(&[_]Feature{}), |
| 114 | 114 | }; |
| 115 | result[@intFromEnum(Feature.hvxv60)] = .{ | |
| 115 | result[@backingInt(Feature.hvxv60)] = .{ | |
| 116 | 116 | .llvm_name = "hvxv60", |
| 117 | 117 | .description = "Hexagon HVX instructions", |
| 118 | 118 | .dependencies = featureSet(&[_]Feature{ |
| 119 | 119 | .hvx, |
| 120 | 120 | }), |
| 121 | 121 | }; |
| 122 | result[@intFromEnum(Feature.hvxv62)] = .{ | |
| 122 | result[@backingInt(Feature.hvxv62)] = .{ | |
| 123 | 123 | .llvm_name = "hvxv62", |
| 124 | 124 | .description = "Hexagon HVX instructions", |
| 125 | 125 | .dependencies = featureSet(&[_]Feature{ |
| 126 | 126 | .hvxv60, |
| 127 | 127 | }), |
| 128 | 128 | }; |
| 129 | result[@intFromEnum(Feature.hvxv65)] = .{ | |
| 129 | result[@backingInt(Feature.hvxv65)] = .{ | |
| 130 | 130 | .llvm_name = "hvxv65", |
| 131 | 131 | .description = "Hexagon HVX instructions", |
| 132 | 132 | .dependencies = featureSet(&[_]Feature{ |
| 133 | 133 | .hvxv62, |
| 134 | 134 | }), |
| 135 | 135 | }; |
| 136 | result[@intFromEnum(Feature.hvxv66)] = .{ | |
| 136 | result[@backingInt(Feature.hvxv66)] = .{ | |
| 137 | 137 | .llvm_name = "hvxv66", |
| 138 | 138 | .description = "Hexagon HVX instructions", |
| 139 | 139 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -141,192 +141,192 @@ pub const all_features = blk: { |
| 141 | 141 | .zreg, |
| 142 | 142 | }), |
| 143 | 143 | }; |
| 144 | result[@intFromEnum(Feature.hvxv67)] = .{ | |
| 144 | result[@backingInt(Feature.hvxv67)] = .{ | |
| 145 | 145 | .llvm_name = "hvxv67", |
| 146 | 146 | .description = "Hexagon HVX instructions", |
| 147 | 147 | .dependencies = featureSet(&[_]Feature{ |
| 148 | 148 | .hvxv66, |
| 149 | 149 | }), |
| 150 | 150 | }; |
| 151 | result[@intFromEnum(Feature.hvxv68)] = .{ | |
| 151 | result[@backingInt(Feature.hvxv68)] = .{ | |
| 152 | 152 | .llvm_name = "hvxv68", |
| 153 | 153 | .description = "Hexagon HVX instructions", |
| 154 | 154 | .dependencies = featureSet(&[_]Feature{ |
| 155 | 155 | .hvxv67, |
| 156 | 156 | }), |
| 157 | 157 | }; |
| 158 | result[@intFromEnum(Feature.hvxv69)] = .{ | |
| 158 | result[@backingInt(Feature.hvxv69)] = .{ | |
| 159 | 159 | .llvm_name = "hvxv69", |
| 160 | 160 | .description = "Hexagon HVX instructions", |
| 161 | 161 | .dependencies = featureSet(&[_]Feature{ |
| 162 | 162 | .hvxv68, |
| 163 | 163 | }), |
| 164 | 164 | }; |
| 165 | result[@intFromEnum(Feature.hvxv71)] = .{ | |
| 165 | result[@backingInt(Feature.hvxv71)] = .{ | |
| 166 | 166 | .llvm_name = "hvxv71", |
| 167 | 167 | .description = "Hexagon HVX instructions", |
| 168 | 168 | .dependencies = featureSet(&[_]Feature{ |
| 169 | 169 | .hvxv69, |
| 170 | 170 | }), |
| 171 | 171 | }; |
| 172 | result[@intFromEnum(Feature.hvxv73)] = .{ | |
| 172 | result[@backingInt(Feature.hvxv73)] = .{ | |
| 173 | 173 | .llvm_name = "hvxv73", |
| 174 | 174 | .description = "Hexagon HVX instructions", |
| 175 | 175 | .dependencies = featureSet(&[_]Feature{ |
| 176 | 176 | .hvxv71, |
| 177 | 177 | }), |
| 178 | 178 | }; |
| 179 | result[@intFromEnum(Feature.hvxv75)] = .{ | |
| 179 | result[@backingInt(Feature.hvxv75)] = .{ | |
| 180 | 180 | .llvm_name = "hvxv75", |
| 181 | 181 | .description = "Hexagon HVX instructions", |
| 182 | 182 | .dependencies = featureSet(&[_]Feature{ |
| 183 | 183 | .hvxv73, |
| 184 | 184 | }), |
| 185 | 185 | }; |
| 186 | result[@intFromEnum(Feature.hvxv79)] = .{ | |
| 186 | result[@backingInt(Feature.hvxv79)] = .{ | |
| 187 | 187 | .llvm_name = "hvxv79", |
| 188 | 188 | .description = "Hexagon HVX instructions", |
| 189 | 189 | .dependencies = featureSet(&[_]Feature{ |
| 190 | 190 | .hvxv75, |
| 191 | 191 | }), |
| 192 | 192 | }; |
| 193 | result[@intFromEnum(Feature.hvxv81)] = .{ | |
| 193 | result[@backingInt(Feature.hvxv81)] = .{ | |
| 194 | 194 | .llvm_name = "hvxv81", |
| 195 | 195 | .description = "Hexagon HVX instructions", |
| 196 | 196 | .dependencies = featureSet(&[_]Feature{ |
| 197 | 197 | .hvxv79, |
| 198 | 198 | }), |
| 199 | 199 | }; |
| 200 | result[@intFromEnum(Feature.long_calls)] = .{ | |
| 200 | result[@backingInt(Feature.long_calls)] = .{ | |
| 201 | 201 | .llvm_name = "long-calls", |
| 202 | 202 | .description = "Use constant-extended calls", |
| 203 | 203 | .dependencies = featureSet(&[_]Feature{}), |
| 204 | 204 | }; |
| 205 | result[@intFromEnum(Feature.mem_noshuf)] = .{ | |
| 205 | result[@backingInt(Feature.mem_noshuf)] = .{ | |
| 206 | 206 | .llvm_name = "mem_noshuf", |
| 207 | 207 | .description = "Supports mem_noshuf feature", |
| 208 | 208 | .dependencies = featureSet(&[_]Feature{}), |
| 209 | 209 | }; |
| 210 | result[@intFromEnum(Feature.memops)] = .{ | |
| 210 | result[@backingInt(Feature.memops)] = .{ | |
| 211 | 211 | .llvm_name = "memops", |
| 212 | 212 | .description = "Use memop instructions", |
| 213 | 213 | .dependencies = featureSet(&[_]Feature{}), |
| 214 | 214 | }; |
| 215 | result[@intFromEnum(Feature.noreturn_stack_elim)] = .{ | |
| 215 | result[@backingInt(Feature.noreturn_stack_elim)] = .{ | |
| 216 | 216 | .llvm_name = "noreturn-stack-elim", |
| 217 | 217 | .description = "Eliminate stack allocation in a noreturn function when possible", |
| 218 | 218 | .dependencies = featureSet(&[_]Feature{}), |
| 219 | 219 | }; |
| 220 | result[@intFromEnum(Feature.nvj)] = .{ | |
| 220 | result[@backingInt(Feature.nvj)] = .{ | |
| 221 | 221 | .llvm_name = "nvj", |
| 222 | 222 | .description = "Support for new-value jumps", |
| 223 | 223 | .dependencies = featureSet(&[_]Feature{ |
| 224 | 224 | .packets, |
| 225 | 225 | }), |
| 226 | 226 | }; |
| 227 | result[@intFromEnum(Feature.nvs)] = .{ | |
| 227 | result[@backingInt(Feature.nvs)] = .{ | |
| 228 | 228 | .llvm_name = "nvs", |
| 229 | 229 | .description = "Support for new-value stores", |
| 230 | 230 | .dependencies = featureSet(&[_]Feature{ |
| 231 | 231 | .packets, |
| 232 | 232 | }), |
| 233 | 233 | }; |
| 234 | result[@intFromEnum(Feature.packets)] = .{ | |
| 234 | result[@backingInt(Feature.packets)] = .{ | |
| 235 | 235 | .llvm_name = "packets", |
| 236 | 236 | .description = "Support for instruction packets", |
| 237 | 237 | .dependencies = featureSet(&[_]Feature{}), |
| 238 | 238 | }; |
| 239 | result[@intFromEnum(Feature.prev65)] = .{ | |
| 239 | result[@backingInt(Feature.prev65)] = .{ | |
| 240 | 240 | .llvm_name = "prev65", |
| 241 | 241 | .description = "Support features deprecated in v65", |
| 242 | 242 | .dependencies = featureSet(&[_]Feature{}), |
| 243 | 243 | }; |
| 244 | result[@intFromEnum(Feature.reserved_r19)] = .{ | |
| 244 | result[@backingInt(Feature.reserved_r19)] = .{ | |
| 245 | 245 | .llvm_name = "reserved-r19", |
| 246 | 246 | .description = "Reserve register R19", |
| 247 | 247 | .dependencies = featureSet(&[_]Feature{}), |
| 248 | 248 | }; |
| 249 | result[@intFromEnum(Feature.small_data)] = .{ | |
| 249 | result[@backingInt(Feature.small_data)] = .{ | |
| 250 | 250 | .llvm_name = "small-data", |
| 251 | 251 | .description = "Allow GP-relative addressing of global variables", |
| 252 | 252 | .dependencies = featureSet(&[_]Feature{}), |
| 253 | 253 | }; |
| 254 | result[@intFromEnum(Feature.tinycore)] = .{ | |
| 254 | result[@backingInt(Feature.tinycore)] = .{ | |
| 255 | 255 | .llvm_name = "tinycore", |
| 256 | 256 | .description = "Hexagon Tiny Core", |
| 257 | 257 | .dependencies = featureSet(&[_]Feature{}), |
| 258 | 258 | }; |
| 259 | result[@intFromEnum(Feature.v5)] = .{ | |
| 259 | result[@backingInt(Feature.v5)] = .{ | |
| 260 | 260 | .llvm_name = "v5", |
| 261 | 261 | .description = "Enable Hexagon V5 architecture", |
| 262 | 262 | .dependencies = featureSet(&[_]Feature{}), |
| 263 | 263 | }; |
| 264 | result[@intFromEnum(Feature.v55)] = .{ | |
| 264 | result[@backingInt(Feature.v55)] = .{ | |
| 265 | 265 | .llvm_name = "v55", |
| 266 | 266 | .description = "Enable Hexagon V55 architecture", |
| 267 | 267 | .dependencies = featureSet(&[_]Feature{}), |
| 268 | 268 | }; |
| 269 | result[@intFromEnum(Feature.v60)] = .{ | |
| 269 | result[@backingInt(Feature.v60)] = .{ | |
| 270 | 270 | .llvm_name = "v60", |
| 271 | 271 | .description = "Enable Hexagon V60 architecture", |
| 272 | 272 | .dependencies = featureSet(&[_]Feature{}), |
| 273 | 273 | }; |
| 274 | result[@intFromEnum(Feature.v62)] = .{ | |
| 274 | result[@backingInt(Feature.v62)] = .{ | |
| 275 | 275 | .llvm_name = "v62", |
| 276 | 276 | .description = "Enable Hexagon V62 architecture", |
| 277 | 277 | .dependencies = featureSet(&[_]Feature{}), |
| 278 | 278 | }; |
| 279 | result[@intFromEnum(Feature.v65)] = .{ | |
| 279 | result[@backingInt(Feature.v65)] = .{ | |
| 280 | 280 | .llvm_name = "v65", |
| 281 | 281 | .description = "Enable Hexagon V65 architecture", |
| 282 | 282 | .dependencies = featureSet(&[_]Feature{}), |
| 283 | 283 | }; |
| 284 | result[@intFromEnum(Feature.v66)] = .{ | |
| 284 | result[@backingInt(Feature.v66)] = .{ | |
| 285 | 285 | .llvm_name = "v66", |
| 286 | 286 | .description = "Enable Hexagon V66 architecture", |
| 287 | 287 | .dependencies = featureSet(&[_]Feature{}), |
| 288 | 288 | }; |
| 289 | result[@intFromEnum(Feature.v67)] = .{ | |
| 289 | result[@backingInt(Feature.v67)] = .{ | |
| 290 | 290 | .llvm_name = "v67", |
| 291 | 291 | .description = "Enable Hexagon V67 architecture", |
| 292 | 292 | .dependencies = featureSet(&[_]Feature{}), |
| 293 | 293 | }; |
| 294 | result[@intFromEnum(Feature.v68)] = .{ | |
| 294 | result[@backingInt(Feature.v68)] = .{ | |
| 295 | 295 | .llvm_name = "v68", |
| 296 | 296 | .description = "Enable Hexagon V68 architecture", |
| 297 | 297 | .dependencies = featureSet(&[_]Feature{}), |
| 298 | 298 | }; |
| 299 | result[@intFromEnum(Feature.v69)] = .{ | |
| 299 | result[@backingInt(Feature.v69)] = .{ | |
| 300 | 300 | .llvm_name = "v69", |
| 301 | 301 | .description = "Enable Hexagon V69 architecture", |
| 302 | 302 | .dependencies = featureSet(&[_]Feature{}), |
| 303 | 303 | }; |
| 304 | result[@intFromEnum(Feature.v71)] = .{ | |
| 304 | result[@backingInt(Feature.v71)] = .{ | |
| 305 | 305 | .llvm_name = "v71", |
| 306 | 306 | .description = "Enable Hexagon V71 architecture", |
| 307 | 307 | .dependencies = featureSet(&[_]Feature{}), |
| 308 | 308 | }; |
| 309 | result[@intFromEnum(Feature.v73)] = .{ | |
| 309 | result[@backingInt(Feature.v73)] = .{ | |
| 310 | 310 | .llvm_name = "v73", |
| 311 | 311 | .description = "Enable Hexagon V73 architecture", |
| 312 | 312 | .dependencies = featureSet(&[_]Feature{}), |
| 313 | 313 | }; |
| 314 | result[@intFromEnum(Feature.v75)] = .{ | |
| 314 | result[@backingInt(Feature.v75)] = .{ | |
| 315 | 315 | .llvm_name = "v75", |
| 316 | 316 | .description = "Enable Hexagon V75 architecture", |
| 317 | 317 | .dependencies = featureSet(&[_]Feature{}), |
| 318 | 318 | }; |
| 319 | result[@intFromEnum(Feature.v79)] = .{ | |
| 319 | result[@backingInt(Feature.v79)] = .{ | |
| 320 | 320 | .llvm_name = "v79", |
| 321 | 321 | .description = "Enable Hexagon V79 architecture", |
| 322 | 322 | .dependencies = featureSet(&[_]Feature{}), |
| 323 | 323 | }; |
| 324 | result[@intFromEnum(Feature.v81)] = .{ | |
| 324 | result[@backingInt(Feature.v81)] = .{ | |
| 325 | 325 | .llvm_name = "v81", |
| 326 | 326 | .description = "Enable Hexagon V81 architecture", |
| 327 | 327 | .dependencies = featureSet(&[_]Feature{}), |
| 328 | 328 | }; |
| 329 | result[@intFromEnum(Feature.zreg)] = .{ | |
| 329 | result[@backingInt(Feature.zreg)] = .{ | |
| 330 | 330 | .llvm_name = "zreg", |
| 331 | 331 | .description = "Hexagon ZReg extension instructions", |
| 332 | 332 | .dependencies = featureSet(&[_]Feature{}), |
lib/std/Target/hppa.zig+5-5| ... | ... | @@ -21,31 +21,31 @@ pub const all_features = blk: { |
| 21 | 21 | const len = @typeInfo(Feature).@"enum".field_names.len; |
| 22 | 22 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); |
| 23 | 23 | var result: [len]CpuFeature = undefined; |
| 24 | result[@intFromEnum(Feature.@"64bit")] = .{ | |
| 24 | result[@backingInt(Feature.@"64bit")] = .{ | |
| 25 | 25 | .llvm_name = null, |
| 26 | 26 | .description = "Enable 64-bit PA-RISC 2.0", |
| 27 | 27 | .dependencies = featureSet(&[_]Feature{ |
| 28 | 28 | .v2_0, |
| 29 | 29 | }), |
| 30 | 30 | }; |
| 31 | result[@intFromEnum(Feature.max_1)] = .{ | |
| 31 | result[@backingInt(Feature.max_1)] = .{ | |
| 32 | 32 | .llvm_name = null, |
| 33 | 33 | .description = "Enable MAX-1 multimedia acceleration extensions", |
| 34 | 34 | .dependencies = featureSet(&[_]Feature{}), |
| 35 | 35 | }; |
| 36 | result[@intFromEnum(Feature.max_2)] = .{ | |
| 36 | result[@backingInt(Feature.max_2)] = .{ | |
| 37 | 37 | .llvm_name = null, |
| 38 | 38 | .description = "Enable MAX-2 multimedia acceleration extensions", |
| 39 | 39 | .dependencies = featureSet(&[_]Feature{ |
| 40 | 40 | .max_1, |
| 41 | 41 | }), |
| 42 | 42 | }; |
| 43 | result[@intFromEnum(Feature.v1_1)] = .{ | |
| 43 | result[@backingInt(Feature.v1_1)] = .{ | |
| 44 | 44 | .llvm_name = null, |
| 45 | 45 | .description = "Enable ISA v1.1", |
| 46 | 46 | .dependencies = featureSet(&[_]Feature{}), |
| 47 | 47 | }; |
| 48 | result[@intFromEnum(Feature.v2_0)] = .{ | |
| 48 | result[@backingInt(Feature.v2_0)] = .{ | |
| 49 | 49 | .llvm_name = null, |
| 50 | 50 | .description = "Enable ISA v2.0", |
| 51 | 51 | .dependencies = featureSet(&[_]Feature{ |
lib/std/Target/kvx.zig+3-3| ... | ... | @@ -19,19 +19,19 @@ pub const all_features = blk: { |
| 19 | 19 | const len = @typeInfo(Feature).@"enum".field_names.len; |
| 20 | 20 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); |
| 21 | 21 | var result: [len]CpuFeature = undefined; |
| 22 | result[@intFromEnum(Feature.v3_1)] = .{ | |
| 22 | result[@backingInt(Feature.v3_1)] = .{ | |
| 23 | 23 | .llvm_name = null, |
| 24 | 24 | .description = "Enable ISA v3.1", |
| 25 | 25 | .dependencies = featureSet(&[_]Feature{}), |
| 26 | 26 | }; |
| 27 | result[@intFromEnum(Feature.v3_2)] = .{ | |
| 27 | result[@backingInt(Feature.v3_2)] = .{ | |
| 28 | 28 | .llvm_name = null, |
| 29 | 29 | .description = "Enable ISA v3.2", |
| 30 | 30 | .dependencies = featureSet(&[_]Feature{ |
| 31 | 31 | .v3_1, |
| 32 | 32 | }), |
| 33 | 33 | }; |
| 34 | result[@intFromEnum(Feature.v4_1)] = .{ | |
| 34 | result[@backingInt(Feature.v4_1)] = .{ | |
| 35 | 35 | .llvm_name = null, |
| 36 | 36 | .description = "Enable ISA v4.1", |
| 37 | 37 | .dependencies = featureSet(&[_]Feature{ |
lib/std/Target/loongarch.zig+21-21| ... | ... | @@ -37,115 +37,115 @@ pub const all_features = blk: { |
| 37 | 37 | const len = @typeInfo(Feature).@"enum".field_names.len; |
| 38 | 38 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); |
| 39 | 39 | var result: [len]CpuFeature = undefined; |
| 40 | result[@intFromEnum(Feature.@"32bit")] = .{ | |
| 40 | result[@backingInt(Feature.@"32bit")] = .{ | |
| 41 | 41 | .llvm_name = "32bit", |
| 42 | 42 | .description = "LA32 Basic Integer and Privilege Instruction Set", |
| 43 | 43 | .dependencies = featureSet(&[_]Feature{}), |
| 44 | 44 | }; |
| 45 | result[@intFromEnum(Feature.@"32s")] = .{ | |
| 45 | result[@backingInt(Feature.@"32s")] = .{ | |
| 46 | 46 | .llvm_name = "32s", |
| 47 | 47 | .description = "LA32 Standard Basic Instruction Extension", |
| 48 | 48 | .dependencies = featureSet(&[_]Feature{}), |
| 49 | 49 | }; |
| 50 | result[@intFromEnum(Feature.@"64bit")] = .{ | |
| 50 | result[@backingInt(Feature.@"64bit")] = .{ | |
| 51 | 51 | .llvm_name = "64bit", |
| 52 | 52 | .description = "LA64 Basic Integer and Privilege Instruction Set", |
| 53 | 53 | .dependencies = featureSet(&[_]Feature{ |
| 54 | 54 | .@"32s", |
| 55 | 55 | }), |
| 56 | 56 | }; |
| 57 | result[@intFromEnum(Feature.d)] = .{ | |
| 57 | result[@backingInt(Feature.d)] = .{ | |
| 58 | 58 | .llvm_name = "d", |
| 59 | 59 | .description = "'D' (Double-Precision Floating-Point)", |
| 60 | 60 | .dependencies = featureSet(&[_]Feature{ |
| 61 | 61 | .f, |
| 62 | 62 | }), |
| 63 | 63 | }; |
| 64 | result[@intFromEnum(Feature.div32)] = .{ | |
| 64 | result[@backingInt(Feature.div32)] = .{ | |
| 65 | 65 | .llvm_name = "div32", |
| 66 | 66 | .description = "Assume div.w[u] and mod.w[u] can handle inputs that are not sign-extended", |
| 67 | 67 | .dependencies = featureSet(&[_]Feature{}), |
| 68 | 68 | }; |
| 69 | result[@intFromEnum(Feature.f)] = .{ | |
| 69 | result[@backingInt(Feature.f)] = .{ | |
| 70 | 70 | .llvm_name = "f", |
| 71 | 71 | .description = "'F' (Single-Precision Floating-Point)", |
| 72 | 72 | .dependencies = featureSet(&[_]Feature{}), |
| 73 | 73 | }; |
| 74 | result[@intFromEnum(Feature.frecipe)] = .{ | |
| 74 | result[@backingInt(Feature.frecipe)] = .{ | |
| 75 | 75 | .llvm_name = "frecipe", |
| 76 | 76 | .description = "Support frecipe.{s/d} and frsqrte.{s/d} instructions", |
| 77 | 77 | .dependencies = featureSet(&[_]Feature{}), |
| 78 | 78 | }; |
| 79 | result[@intFromEnum(Feature.la_global_with_abs)] = .{ | |
| 79 | result[@backingInt(Feature.la_global_with_abs)] = .{ | |
| 80 | 80 | .llvm_name = "la-global-with-abs", |
| 81 | 81 | .description = "Expand la.global as la.abs", |
| 82 | 82 | .dependencies = featureSet(&[_]Feature{}), |
| 83 | 83 | }; |
| 84 | result[@intFromEnum(Feature.la_global_with_pcrel)] = .{ | |
| 84 | result[@backingInt(Feature.la_global_with_pcrel)] = .{ | |
| 85 | 85 | .llvm_name = "la-global-with-pcrel", |
| 86 | 86 | .description = "Expand la.global as la.pcrel", |
| 87 | 87 | .dependencies = featureSet(&[_]Feature{}), |
| 88 | 88 | }; |
| 89 | result[@intFromEnum(Feature.la_local_with_abs)] = .{ | |
| 89 | result[@backingInt(Feature.la_local_with_abs)] = .{ | |
| 90 | 90 | .llvm_name = "la-local-with-abs", |
| 91 | 91 | .description = "Expand la.local as la.abs", |
| 92 | 92 | .dependencies = featureSet(&[_]Feature{}), |
| 93 | 93 | }; |
| 94 | result[@intFromEnum(Feature.lam_bh)] = .{ | |
| 94 | result[@backingInt(Feature.lam_bh)] = .{ | |
| 95 | 95 | .llvm_name = "lam-bh", |
| 96 | 96 | .description = "Support amswap[_db].{b/h} and amadd[_db].{b/h} instructions", |
| 97 | 97 | .dependencies = featureSet(&[_]Feature{}), |
| 98 | 98 | }; |
| 99 | result[@intFromEnum(Feature.lamcas)] = .{ | |
| 99 | result[@backingInt(Feature.lamcas)] = .{ | |
| 100 | 100 | .llvm_name = "lamcas", |
| 101 | 101 | .description = "Support amcas[_db].{b/h/w/d}", |
| 102 | 102 | .dependencies = featureSet(&[_]Feature{}), |
| 103 | 103 | }; |
| 104 | result[@intFromEnum(Feature.lasx)] = .{ | |
| 104 | result[@backingInt(Feature.lasx)] = .{ | |
| 105 | 105 | .llvm_name = "lasx", |
| 106 | 106 | .description = "'LASX' (Loongson Advanced SIMD Extension)", |
| 107 | 107 | .dependencies = featureSet(&[_]Feature{ |
| 108 | 108 | .lsx, |
| 109 | 109 | }), |
| 110 | 110 | }; |
| 111 | result[@intFromEnum(Feature.lbt)] = .{ | |
| 111 | result[@backingInt(Feature.lbt)] = .{ | |
| 112 | 112 | .llvm_name = "lbt", |
| 113 | 113 | .description = "'LBT' (Loongson Binary Translation Extension)", |
| 114 | 114 | .dependencies = featureSet(&[_]Feature{}), |
| 115 | 115 | }; |
| 116 | result[@intFromEnum(Feature.ld_seq_sa)] = .{ | |
| 116 | result[@backingInt(Feature.ld_seq_sa)] = .{ | |
| 117 | 117 | .llvm_name = "ld-seq-sa", |
| 118 | 118 | .description = "Don't use a same-address load-load barrier (dbar 0x700)", |
| 119 | 119 | .dependencies = featureSet(&[_]Feature{}), |
| 120 | 120 | }; |
| 121 | result[@intFromEnum(Feature.lsx)] = .{ | |
| 121 | result[@backingInt(Feature.lsx)] = .{ | |
| 122 | 122 | .llvm_name = "lsx", |
| 123 | 123 | .description = "'LSX' (Loongson SIMD Extension)", |
| 124 | 124 | .dependencies = featureSet(&[_]Feature{ |
| 125 | 125 | .d, |
| 126 | 126 | }), |
| 127 | 127 | }; |
| 128 | result[@intFromEnum(Feature.lvz)] = .{ | |
| 128 | result[@backingInt(Feature.lvz)] = .{ | |
| 129 | 129 | .llvm_name = "lvz", |
| 130 | 130 | .description = "'LVZ' (Loongson Virtualization Extension)", |
| 131 | 131 | .dependencies = featureSet(&[_]Feature{}), |
| 132 | 132 | }; |
| 133 | result[@intFromEnum(Feature.prefer_w_inst)] = .{ | |
| 133 | result[@backingInt(Feature.prefer_w_inst)] = .{ | |
| 134 | 134 | .llvm_name = "prefer-w-inst", |
| 135 | 135 | .description = "Prefer instructions with W suffix", |
| 136 | 136 | .dependencies = featureSet(&[_]Feature{}), |
| 137 | 137 | }; |
| 138 | result[@intFromEnum(Feature.relax)] = .{ | |
| 138 | result[@backingInt(Feature.relax)] = .{ | |
| 139 | 139 | .llvm_name = "relax", |
| 140 | 140 | .description = "Enable Linker relaxation", |
| 141 | 141 | .dependencies = featureSet(&[_]Feature{}), |
| 142 | 142 | }; |
| 143 | result[@intFromEnum(Feature.scq)] = .{ | |
| 143 | result[@backingInt(Feature.scq)] = .{ | |
| 144 | 144 | .llvm_name = "scq", |
| 145 | 145 | .description = "Support sc.q instruction", |
| 146 | 146 | .dependencies = featureSet(&[_]Feature{}), |
| 147 | 147 | }; |
| 148 | result[@intFromEnum(Feature.ual)] = .{ | |
| 148 | result[@backingInt(Feature.ual)] = .{ | |
| 149 | 149 | .llvm_name = "ual", |
| 150 | 150 | .description = "Allow memory accesses to be unaligned", |
| 151 | 151 | .dependencies = featureSet(&[_]Feature{}), |
lib/std/Target/m68k.zig+23-23| ... | ... | @@ -39,33 +39,33 @@ pub const all_features = blk: { |
| 39 | 39 | const len = @typeInfo(Feature).@"enum".field_names.len; |
| 40 | 40 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); |
| 41 | 41 | var result: [len]CpuFeature = undefined; |
| 42 | result[@intFromEnum(Feature.isa_68000)] = .{ | |
| 42 | result[@backingInt(Feature.isa_68000)] = .{ | |
| 43 | 43 | .llvm_name = "isa-68000", |
| 44 | 44 | .description = "Is M68000 ISA supported", |
| 45 | 45 | .dependencies = featureSet(&[_]Feature{}), |
| 46 | 46 | }; |
| 47 | result[@intFromEnum(Feature.isa_68010)] = .{ | |
| 47 | result[@backingInt(Feature.isa_68010)] = .{ | |
| 48 | 48 | .llvm_name = "isa-68010", |
| 49 | 49 | .description = "Is M68010 ISA supported", |
| 50 | 50 | .dependencies = featureSet(&[_]Feature{ |
| 51 | 51 | .isa_68000, |
| 52 | 52 | }), |
| 53 | 53 | }; |
| 54 | result[@intFromEnum(Feature.isa_68020)] = .{ | |
| 54 | result[@backingInt(Feature.isa_68020)] = .{ | |
| 55 | 55 | .llvm_name = "isa-68020", |
| 56 | 56 | .description = "Is M68020 ISA supported", |
| 57 | 57 | .dependencies = featureSet(&[_]Feature{ |
| 58 | 58 | .isa_68010, |
| 59 | 59 | }), |
| 60 | 60 | }; |
| 61 | result[@intFromEnum(Feature.isa_68030)] = .{ | |
| 61 | result[@backingInt(Feature.isa_68030)] = .{ | |
| 62 | 62 | .llvm_name = "isa-68030", |
| 63 | 63 | .description = "Is M68030 ISA supported", |
| 64 | 64 | .dependencies = featureSet(&[_]Feature{ |
| 65 | 65 | .isa_68020, |
| 66 | 66 | }), |
| 67 | 67 | }; |
| 68 | result[@intFromEnum(Feature.isa_68040)] = .{ | |
| 68 | result[@backingInt(Feature.isa_68040)] = .{ | |
| 69 | 69 | .llvm_name = "isa-68040", |
| 70 | 70 | .description = "Is M68040 ISA supported", |
| 71 | 71 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -73,96 +73,96 @@ pub const all_features = blk: { |
| 73 | 73 | .isa_68882, |
| 74 | 74 | }), |
| 75 | 75 | }; |
| 76 | result[@intFromEnum(Feature.isa_68060)] = .{ | |
| 76 | result[@backingInt(Feature.isa_68060)] = .{ | |
| 77 | 77 | .llvm_name = "isa-68060", |
| 78 | 78 | .description = "Is M68060 ISA supported", |
| 79 | 79 | .dependencies = featureSet(&[_]Feature{ |
| 80 | 80 | .isa_68040, |
| 81 | 81 | }), |
| 82 | 82 | }; |
| 83 | result[@intFromEnum(Feature.isa_68881)] = .{ | |
| 83 | result[@backingInt(Feature.isa_68881)] = .{ | |
| 84 | 84 | .llvm_name = "isa-68881", |
| 85 | 85 | .description = "Is M68881 (FPU) ISA supported", |
| 86 | 86 | .dependencies = featureSet(&[_]Feature{}), |
| 87 | 87 | }; |
| 88 | result[@intFromEnum(Feature.isa_68882)] = .{ | |
| 88 | result[@backingInt(Feature.isa_68882)] = .{ | |
| 89 | 89 | .llvm_name = "isa-68882", |
| 90 | 90 | .description = "Is M68882 (FPU) ISA supported", |
| 91 | 91 | .dependencies = featureSet(&[_]Feature{ |
| 92 | 92 | .isa_68881, |
| 93 | 93 | }), |
| 94 | 94 | }; |
| 95 | result[@intFromEnum(Feature.reserve_a0)] = .{ | |
| 95 | result[@backingInt(Feature.reserve_a0)] = .{ | |
| 96 | 96 | .llvm_name = "reserve-a0", |
| 97 | 97 | .description = "Reserve A0 register", |
| 98 | 98 | .dependencies = featureSet(&[_]Feature{}), |
| 99 | 99 | }; |
| 100 | result[@intFromEnum(Feature.reserve_a1)] = .{ | |
| 100 | result[@backingInt(Feature.reserve_a1)] = .{ | |
| 101 | 101 | .llvm_name = "reserve-a1", |
| 102 | 102 | .description = "Reserve A1 register", |
| 103 | 103 | .dependencies = featureSet(&[_]Feature{}), |
| 104 | 104 | }; |
| 105 | result[@intFromEnum(Feature.reserve_a2)] = .{ | |
| 105 | result[@backingInt(Feature.reserve_a2)] = .{ | |
| 106 | 106 | .llvm_name = "reserve-a2", |
| 107 | 107 | .description = "Reserve A2 register", |
| 108 | 108 | .dependencies = featureSet(&[_]Feature{}), |
| 109 | 109 | }; |
| 110 | result[@intFromEnum(Feature.reserve_a3)] = .{ | |
| 110 | result[@backingInt(Feature.reserve_a3)] = .{ | |
| 111 | 111 | .llvm_name = "reserve-a3", |
| 112 | 112 | .description = "Reserve A3 register", |
| 113 | 113 | .dependencies = featureSet(&[_]Feature{}), |
| 114 | 114 | }; |
| 115 | result[@intFromEnum(Feature.reserve_a4)] = .{ | |
| 115 | result[@backingInt(Feature.reserve_a4)] = .{ | |
| 116 | 116 | .llvm_name = "reserve-a4", |
| 117 | 117 | .description = "Reserve A4 register", |
| 118 | 118 | .dependencies = featureSet(&[_]Feature{}), |
| 119 | 119 | }; |
| 120 | result[@intFromEnum(Feature.reserve_a5)] = .{ | |
| 120 | result[@backingInt(Feature.reserve_a5)] = .{ | |
| 121 | 121 | .llvm_name = "reserve-a5", |
| 122 | 122 | .description = "Reserve A5 register", |
| 123 | 123 | .dependencies = featureSet(&[_]Feature{}), |
| 124 | 124 | }; |
| 125 | result[@intFromEnum(Feature.reserve_a6)] = .{ | |
| 125 | result[@backingInt(Feature.reserve_a6)] = .{ | |
| 126 | 126 | .llvm_name = "reserve-a6", |
| 127 | 127 | .description = "Reserve A6 register", |
| 128 | 128 | .dependencies = featureSet(&[_]Feature{}), |
| 129 | 129 | }; |
| 130 | result[@intFromEnum(Feature.reserve_d0)] = .{ | |
| 130 | result[@backingInt(Feature.reserve_d0)] = .{ | |
| 131 | 131 | .llvm_name = "reserve-d0", |
| 132 | 132 | .description = "Reserve D0 register", |
| 133 | 133 | .dependencies = featureSet(&[_]Feature{}), |
| 134 | 134 | }; |
| 135 | result[@intFromEnum(Feature.reserve_d1)] = .{ | |
| 135 | result[@backingInt(Feature.reserve_d1)] = .{ | |
| 136 | 136 | .llvm_name = "reserve-d1", |
| 137 | 137 | .description = "Reserve D1 register", |
| 138 | 138 | .dependencies = featureSet(&[_]Feature{}), |
| 139 | 139 | }; |
| 140 | result[@intFromEnum(Feature.reserve_d2)] = .{ | |
| 140 | result[@backingInt(Feature.reserve_d2)] = .{ | |
| 141 | 141 | .llvm_name = "reserve-d2", |
| 142 | 142 | .description = "Reserve D2 register", |
| 143 | 143 | .dependencies = featureSet(&[_]Feature{}), |
| 144 | 144 | }; |
| 145 | result[@intFromEnum(Feature.reserve_d3)] = .{ | |
| 145 | result[@backingInt(Feature.reserve_d3)] = .{ | |
| 146 | 146 | .llvm_name = "reserve-d3", |
| 147 | 147 | .description = "Reserve D3 register", |
| 148 | 148 | .dependencies = featureSet(&[_]Feature{}), |
| 149 | 149 | }; |
| 150 | result[@intFromEnum(Feature.reserve_d4)] = .{ | |
| 150 | result[@backingInt(Feature.reserve_d4)] = .{ | |
| 151 | 151 | .llvm_name = "reserve-d4", |
| 152 | 152 | .description = "Reserve D4 register", |
| 153 | 153 | .dependencies = featureSet(&[_]Feature{}), |
| 154 | 154 | }; |
| 155 | result[@intFromEnum(Feature.reserve_d5)] = .{ | |
| 155 | result[@backingInt(Feature.reserve_d5)] = .{ | |
| 156 | 156 | .llvm_name = "reserve-d5", |
| 157 | 157 | .description = "Reserve D5 register", |
| 158 | 158 | .dependencies = featureSet(&[_]Feature{}), |
| 159 | 159 | }; |
| 160 | result[@intFromEnum(Feature.reserve_d6)] = .{ | |
| 160 | result[@backingInt(Feature.reserve_d6)] = .{ | |
| 161 | 161 | .llvm_name = "reserve-d6", |
| 162 | 162 | .description = "Reserve D6 register", |
| 163 | 163 | .dependencies = featureSet(&[_]Feature{}), |
| 164 | 164 | }; |
| 165 | result[@intFromEnum(Feature.reserve_d7)] = .{ | |
| 165 | result[@backingInt(Feature.reserve_d7)] = .{ | |
| 166 | 166 | .llvm_name = "reserve-d7", |
| 167 | 167 | .description = "Reserve D7 register", |
| 168 | 168 | .dependencies = featureSet(&[_]Feature{}), |
lib/std/Target/mips.zig+57-57| ... | ... | @@ -73,75 +73,75 @@ pub const all_features = blk: { |
| 73 | 73 | const len = @typeInfo(Feature).@"enum".field_names.len; |
| 74 | 74 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); |
| 75 | 75 | var result: [len]CpuFeature = undefined; |
| 76 | result[@intFromEnum(Feature.abs2008)] = .{ | |
| 76 | result[@backingInt(Feature.abs2008)] = .{ | |
| 77 | 77 | .llvm_name = "abs2008", |
| 78 | 78 | .description = "Disable IEEE 754-2008 abs.fmt mode", |
| 79 | 79 | .dependencies = featureSet(&[_]Feature{}), |
| 80 | 80 | }; |
| 81 | result[@intFromEnum(Feature.cnmips)] = .{ | |
| 81 | result[@backingInt(Feature.cnmips)] = .{ | |
| 82 | 82 | .llvm_name = "cnmips", |
| 83 | 83 | .description = "Octeon cnMIPS Support", |
| 84 | 84 | .dependencies = featureSet(&[_]Feature{ |
| 85 | 85 | .mips64r2, |
| 86 | 86 | }), |
| 87 | 87 | }; |
| 88 | result[@intFromEnum(Feature.cnmipsp)] = .{ | |
| 88 | result[@backingInt(Feature.cnmipsp)] = .{ | |
| 89 | 89 | .llvm_name = "cnmipsp", |
| 90 | 90 | .description = "Octeon+ cnMIPS Support", |
| 91 | 91 | .dependencies = featureSet(&[_]Feature{ |
| 92 | 92 | .cnmips, |
| 93 | 93 | }), |
| 94 | 94 | }; |
| 95 | result[@intFromEnum(Feature.crc)] = .{ | |
| 95 | result[@backingInt(Feature.crc)] = .{ | |
| 96 | 96 | .llvm_name = "crc", |
| 97 | 97 | .description = "Mips R6 CRC ASE", |
| 98 | 98 | .dependencies = featureSet(&[_]Feature{}), |
| 99 | 99 | }; |
| 100 | result[@intFromEnum(Feature.dsp)] = .{ | |
| 100 | result[@backingInt(Feature.dsp)] = .{ | |
| 101 | 101 | .llvm_name = "dsp", |
| 102 | 102 | .description = "Mips DSP ASE", |
| 103 | 103 | .dependencies = featureSet(&[_]Feature{}), |
| 104 | 104 | }; |
| 105 | result[@intFromEnum(Feature.dspr2)] = .{ | |
| 105 | result[@backingInt(Feature.dspr2)] = .{ | |
| 106 | 106 | .llvm_name = "dspr2", |
| 107 | 107 | .description = "Mips DSP-R2 ASE", |
| 108 | 108 | .dependencies = featureSet(&[_]Feature{ |
| 109 | 109 | .dsp, |
| 110 | 110 | }), |
| 111 | 111 | }; |
| 112 | result[@intFromEnum(Feature.dspr3)] = .{ | |
| 112 | result[@backingInt(Feature.dspr3)] = .{ | |
| 113 | 113 | .llvm_name = "dspr3", |
| 114 | 114 | .description = "Mips DSP-R3 ASE", |
| 115 | 115 | .dependencies = featureSet(&[_]Feature{ |
| 116 | 116 | .dspr2, |
| 117 | 117 | }), |
| 118 | 118 | }; |
| 119 | result[@intFromEnum(Feature.eva)] = .{ | |
| 119 | result[@backingInt(Feature.eva)] = .{ | |
| 120 | 120 | .llvm_name = "eva", |
| 121 | 121 | .description = "Mips EVA ASE", |
| 122 | 122 | .dependencies = featureSet(&[_]Feature{}), |
| 123 | 123 | }; |
| 124 | result[@intFromEnum(Feature.fp64)] = .{ | |
| 124 | result[@backingInt(Feature.fp64)] = .{ | |
| 125 | 125 | .llvm_name = "fp64", |
| 126 | 126 | .description = "Support 64-bit FP registers", |
| 127 | 127 | .dependencies = featureSet(&[_]Feature{}), |
| 128 | 128 | }; |
| 129 | result[@intFromEnum(Feature.fpxx)] = .{ | |
| 129 | result[@backingInt(Feature.fpxx)] = .{ | |
| 130 | 130 | .llvm_name = "fpxx", |
| 131 | 131 | .description = "Support for FPXX", |
| 132 | 132 | .dependencies = featureSet(&[_]Feature{}), |
| 133 | 133 | }; |
| 134 | result[@intFromEnum(Feature.ginv)] = .{ | |
| 134 | result[@backingInt(Feature.ginv)] = .{ | |
| 135 | 135 | .llvm_name = "ginv", |
| 136 | 136 | .description = "Mips Global Invalidate ASE", |
| 137 | 137 | .dependencies = featureSet(&[_]Feature{}), |
| 138 | 138 | }; |
| 139 | result[@intFromEnum(Feature.gp64)] = .{ | |
| 139 | result[@backingInt(Feature.gp64)] = .{ | |
| 140 | 140 | .llvm_name = "gp64", |
| 141 | 141 | .description = "General Purpose Registers are 64-bit wide", |
| 142 | 142 | .dependencies = featureSet(&[_]Feature{}), |
| 143 | 143 | }; |
| 144 | result[@intFromEnum(Feature.i6400)] = .{ | |
| 144 | result[@backingInt(Feature.i6400)] = .{ | |
| 145 | 145 | .llvm_name = "i6400", |
| 146 | 146 | .description = "MIPS I6400 Processor", |
| 147 | 147 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -149,7 +149,7 @@ pub const all_features = blk: { |
| 149 | 149 | .msa, |
| 150 | 150 | }), |
| 151 | 151 | }; |
| 152 | result[@intFromEnum(Feature.i6500)] = .{ | |
| 152 | result[@backingInt(Feature.i6500)] = .{ | |
| 153 | 153 | .llvm_name = "i6500", |
| 154 | 154 | .description = "MIPS I6500 Processor", |
| 155 | 155 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -157,34 +157,34 @@ pub const all_features = blk: { |
| 157 | 157 | .msa, |
| 158 | 158 | }), |
| 159 | 159 | }; |
| 160 | result[@intFromEnum(Feature.long_calls)] = .{ | |
| 160 | result[@backingInt(Feature.long_calls)] = .{ | |
| 161 | 161 | .llvm_name = "long-calls", |
| 162 | 162 | .description = "Disable use of the jal instruction", |
| 163 | 163 | .dependencies = featureSet(&[_]Feature{}), |
| 164 | 164 | }; |
| 165 | result[@intFromEnum(Feature.micromips)] = .{ | |
| 165 | result[@backingInt(Feature.micromips)] = .{ | |
| 166 | 166 | .llvm_name = "micromips", |
| 167 | 167 | .description = "microMips mode", |
| 168 | 168 | .dependencies = featureSet(&[_]Feature{}), |
| 169 | 169 | }; |
| 170 | result[@intFromEnum(Feature.mips1)] = .{ | |
| 170 | result[@backingInt(Feature.mips1)] = .{ | |
| 171 | 171 | .llvm_name = "mips1", |
| 172 | 172 | .description = "Mips I ISA Support [highly experimental]", |
| 173 | 173 | .dependencies = featureSet(&[_]Feature{}), |
| 174 | 174 | }; |
| 175 | result[@intFromEnum(Feature.mips16)] = .{ | |
| 175 | result[@backingInt(Feature.mips16)] = .{ | |
| 176 | 176 | .llvm_name = "mips16", |
| 177 | 177 | .description = "Mips16 mode", |
| 178 | 178 | .dependencies = featureSet(&[_]Feature{}), |
| 179 | 179 | }; |
| 180 | result[@intFromEnum(Feature.mips2)] = .{ | |
| 180 | result[@backingInt(Feature.mips2)] = .{ | |
| 181 | 181 | .llvm_name = "mips2", |
| 182 | 182 | .description = "Mips II ISA Support [highly experimental]", |
| 183 | 183 | .dependencies = featureSet(&[_]Feature{ |
| 184 | 184 | .mips1, |
| 185 | 185 | }), |
| 186 | 186 | }; |
| 187 | result[@intFromEnum(Feature.mips3)] = .{ | |
| 187 | result[@backingInt(Feature.mips3)] = .{ | |
| 188 | 188 | .llvm_name = "mips3", |
| 189 | 189 | .description = "MIPS III ISA Support [highly experimental]", |
| 190 | 190 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -195,7 +195,7 @@ pub const all_features = blk: { |
| 195 | 195 | .mips3_32r2, |
| 196 | 196 | }), |
| 197 | 197 | }; |
| 198 | result[@intFromEnum(Feature.mips32)] = .{ | |
| 198 | result[@backingInt(Feature.mips32)] = .{ | |
| 199 | 199 | .llvm_name = "mips32", |
| 200 | 200 | .description = "Mips32 ISA Support", |
| 201 | 201 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -204,7 +204,7 @@ pub const all_features = blk: { |
| 204 | 204 | .mips4_32, |
| 205 | 205 | }), |
| 206 | 206 | }; |
| 207 | result[@intFromEnum(Feature.mips32r2)] = .{ | |
| 207 | result[@backingInt(Feature.mips32r2)] = .{ | |
| 208 | 208 | .llvm_name = "mips32r2", |
| 209 | 209 | .description = "Mips32r2 ISA Support", |
| 210 | 210 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -214,21 +214,21 @@ pub const all_features = blk: { |
| 214 | 214 | .mips5_32r2, |
| 215 | 215 | }), |
| 216 | 216 | }; |
| 217 | result[@intFromEnum(Feature.mips32r3)] = .{ | |
| 217 | result[@backingInt(Feature.mips32r3)] = .{ | |
| 218 | 218 | .llvm_name = "mips32r3", |
| 219 | 219 | .description = "Mips32r3 ISA Support", |
| 220 | 220 | .dependencies = featureSet(&[_]Feature{ |
| 221 | 221 | .mips32r2, |
| 222 | 222 | }), |
| 223 | 223 | }; |
| 224 | result[@intFromEnum(Feature.mips32r5)] = .{ | |
| 224 | result[@backingInt(Feature.mips32r5)] = .{ | |
| 225 | 225 | .llvm_name = "mips32r5", |
| 226 | 226 | .description = "Mips32r5 ISA Support", |
| 227 | 227 | .dependencies = featureSet(&[_]Feature{ |
| 228 | 228 | .mips32r3, |
| 229 | 229 | }), |
| 230 | 230 | }; |
| 231 | result[@intFromEnum(Feature.mips32r6)] = .{ | |
| 231 | result[@backingInt(Feature.mips32r6)] = .{ | |
| 232 | 232 | .llvm_name = "mips32r6", |
| 233 | 233 | .description = "Mips32r6 ISA Support [experimental]", |
| 234 | 234 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -238,22 +238,22 @@ pub const all_features = blk: { |
| 238 | 238 | .nan2008, |
| 239 | 239 | }), |
| 240 | 240 | }; |
| 241 | result[@intFromEnum(Feature.mips3_32)] = .{ | |
| 241 | result[@backingInt(Feature.mips3_32)] = .{ | |
| 242 | 242 | .llvm_name = "mips3_32", |
| 243 | 243 | .description = "Subset of MIPS-III that is also in MIPS32 [highly experimental]", |
| 244 | 244 | .dependencies = featureSet(&[_]Feature{}), |
| 245 | 245 | }; |
| 246 | result[@intFromEnum(Feature.mips3_32r2)] = .{ | |
| 246 | result[@backingInt(Feature.mips3_32r2)] = .{ | |
| 247 | 247 | .llvm_name = "mips3_32r2", |
| 248 | 248 | .description = "Subset of MIPS-III that is also in MIPS32r2 [highly experimental]", |
| 249 | 249 | .dependencies = featureSet(&[_]Feature{}), |
| 250 | 250 | }; |
| 251 | result[@intFromEnum(Feature.mips3d)] = .{ | |
| 251 | result[@backingInt(Feature.mips3d)] = .{ | |
| 252 | 252 | .llvm_name = "mips3d", |
| 253 | 253 | .description = "Mips 3D ASE", |
| 254 | 254 | .dependencies = featureSet(&[_]Feature{}), |
| 255 | 255 | }; |
| 256 | result[@intFromEnum(Feature.mips4)] = .{ | |
| 256 | result[@backingInt(Feature.mips4)] = .{ | |
| 257 | 257 | .llvm_name = "mips4", |
| 258 | 258 | .description = "MIPS IV ISA Support", |
| 259 | 259 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -262,17 +262,17 @@ pub const all_features = blk: { |
| 262 | 262 | .mips4_32r2, |
| 263 | 263 | }), |
| 264 | 264 | }; |
| 265 | result[@intFromEnum(Feature.mips4_32)] = .{ | |
| 265 | result[@backingInt(Feature.mips4_32)] = .{ | |
| 266 | 266 | .llvm_name = "mips4_32", |
| 267 | 267 | .description = "Subset of MIPS-IV that is also in MIPS32 [highly experimental]", |
| 268 | 268 | .dependencies = featureSet(&[_]Feature{}), |
| 269 | 269 | }; |
| 270 | result[@intFromEnum(Feature.mips4_32r2)] = .{ | |
| 270 | result[@backingInt(Feature.mips4_32r2)] = .{ | |
| 271 | 271 | .llvm_name = "mips4_32r2", |
| 272 | 272 | .description = "Subset of MIPS-IV that is also in MIPS32r2 [highly experimental]", |
| 273 | 273 | .dependencies = featureSet(&[_]Feature{}), |
| 274 | 274 | }; |
| 275 | result[@intFromEnum(Feature.mips5)] = .{ | |
| 275 | result[@backingInt(Feature.mips5)] = .{ | |
| 276 | 276 | .llvm_name = "mips5", |
| 277 | 277 | .description = "MIPS V ISA Support [highly experimental]", |
| 278 | 278 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -280,12 +280,12 @@ pub const all_features = blk: { |
| 280 | 280 | .mips5_32r2, |
| 281 | 281 | }), |
| 282 | 282 | }; |
| 283 | result[@intFromEnum(Feature.mips5_32r2)] = .{ | |
| 283 | result[@backingInt(Feature.mips5_32r2)] = .{ | |
| 284 | 284 | .llvm_name = "mips5_32r2", |
| 285 | 285 | .description = "Subset of MIPS-V that is also in MIPS32r2 [highly experimental]", |
| 286 | 286 | .dependencies = featureSet(&[_]Feature{}), |
| 287 | 287 | }; |
| 288 | result[@intFromEnum(Feature.mips64)] = .{ | |
| 288 | result[@backingInt(Feature.mips64)] = .{ | |
| 289 | 289 | .llvm_name = "mips64", |
| 290 | 290 | .description = "Mips64 ISA Support", |
| 291 | 291 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -293,7 +293,7 @@ pub const all_features = blk: { |
| 293 | 293 | .mips5, |
| 294 | 294 | }), |
| 295 | 295 | }; |
| 296 | result[@intFromEnum(Feature.mips64r2)] = .{ | |
| 296 | result[@backingInt(Feature.mips64r2)] = .{ | |
| 297 | 297 | .llvm_name = "mips64r2", |
| 298 | 298 | .description = "Mips64r2 ISA Support", |
| 299 | 299 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -301,7 +301,7 @@ pub const all_features = blk: { |
| 301 | 301 | .mips64, |
| 302 | 302 | }), |
| 303 | 303 | }; |
| 304 | result[@intFromEnum(Feature.mips64r3)] = .{ | |
| 304 | result[@backingInt(Feature.mips64r3)] = .{ | |
| 305 | 305 | .llvm_name = "mips64r3", |
| 306 | 306 | .description = "Mips64r3 ISA Support", |
| 307 | 307 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -309,7 +309,7 @@ pub const all_features = blk: { |
| 309 | 309 | .mips64r2, |
| 310 | 310 | }), |
| 311 | 311 | }; |
| 312 | result[@intFromEnum(Feature.mips64r5)] = .{ | |
| 312 | result[@backingInt(Feature.mips64r5)] = .{ | |
| 313 | 313 | .llvm_name = "mips64r5", |
| 314 | 314 | .description = "Mips64r5 ISA Support", |
| 315 | 315 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -317,7 +317,7 @@ pub const all_features = blk: { |
| 317 | 317 | .mips64r3, |
| 318 | 318 | }), |
| 319 | 319 | }; |
| 320 | result[@intFromEnum(Feature.mips64r6)] = .{ | |
| 320 | result[@backingInt(Feature.mips64r6)] = .{ | |
| 321 | 321 | .llvm_name = "mips64r6", |
| 322 | 322 | .description = "Mips64r6 ISA Support [experimental]", |
| 323 | 323 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -325,99 +325,99 @@ pub const all_features = blk: { |
| 325 | 325 | .mips64r5, |
| 326 | 326 | }), |
| 327 | 327 | }; |
| 328 | result[@intFromEnum(Feature.msa)] = .{ | |
| 328 | result[@backingInt(Feature.msa)] = .{ | |
| 329 | 329 | .llvm_name = "msa", |
| 330 | 330 | .description = "Mips MSA ASE", |
| 331 | 331 | .dependencies = featureSet(&[_]Feature{}), |
| 332 | 332 | }; |
| 333 | result[@intFromEnum(Feature.mt)] = .{ | |
| 333 | result[@backingInt(Feature.mt)] = .{ | |
| 334 | 334 | .llvm_name = "mt", |
| 335 | 335 | .description = "Mips MT ASE", |
| 336 | 336 | .dependencies = featureSet(&[_]Feature{}), |
| 337 | 337 | }; |
| 338 | result[@intFromEnum(Feature.nan2008)] = .{ | |
| 338 | result[@backingInt(Feature.nan2008)] = .{ | |
| 339 | 339 | .llvm_name = "nan2008", |
| 340 | 340 | .description = "IEEE 754-2008 NaN encoding", |
| 341 | 341 | .dependencies = featureSet(&[_]Feature{}), |
| 342 | 342 | }; |
| 343 | result[@intFromEnum(Feature.noabicalls)] = .{ | |
| 343 | result[@backingInt(Feature.noabicalls)] = .{ | |
| 344 | 344 | .llvm_name = "noabicalls", |
| 345 | 345 | .description = "Disable SVR4-style position-independent code", |
| 346 | 346 | .dependencies = featureSet(&[_]Feature{}), |
| 347 | 347 | }; |
| 348 | result[@intFromEnum(Feature.nomadd4)] = .{ | |
| 348 | result[@backingInt(Feature.nomadd4)] = .{ | |
| 349 | 349 | .llvm_name = "nomadd4", |
| 350 | 350 | .description = "Disable 4-operand madd.fmt and related instructions", |
| 351 | 351 | .dependencies = featureSet(&[_]Feature{}), |
| 352 | 352 | }; |
| 353 | result[@intFromEnum(Feature.nooddspreg)] = .{ | |
| 353 | result[@backingInt(Feature.nooddspreg)] = .{ | |
| 354 | 354 | .llvm_name = "nooddspreg", |
| 355 | 355 | .description = "Disable odd numbered single-precision registers", |
| 356 | 356 | .dependencies = featureSet(&[_]Feature{}), |
| 357 | 357 | }; |
| 358 | result[@intFromEnum(Feature.notraps)] = .{ | |
| 358 | result[@backingInt(Feature.notraps)] = .{ | |
| 359 | 359 | .llvm_name = null, |
| 360 | 360 | .description = "Disable trap instructions", |
| 361 | 361 | .dependencies = featureSet(&[_]Feature{}), |
| 362 | 362 | }; |
| 363 | result[@intFromEnum(Feature.p5600)] = .{ | |
| 363 | result[@backingInt(Feature.p5600)] = .{ | |
| 364 | 364 | .llvm_name = "p5600", |
| 365 | 365 | .description = "The P5600 Processor", |
| 366 | 366 | .dependencies = featureSet(&[_]Feature{ |
| 367 | 367 | .mips32r5, |
| 368 | 368 | }), |
| 369 | 369 | }; |
| 370 | result[@intFromEnum(Feature.ptr64)] = .{ | |
| 370 | result[@backingInt(Feature.ptr64)] = .{ | |
| 371 | 371 | .llvm_name = "ptr64", |
| 372 | 372 | .description = "Pointers are 64-bit wide", |
| 373 | 373 | .dependencies = featureSet(&[_]Feature{}), |
| 374 | 374 | }; |
| 375 | result[@intFromEnum(Feature.single_float)] = .{ | |
| 375 | result[@backingInt(Feature.single_float)] = .{ | |
| 376 | 376 | .llvm_name = "single-float", |
| 377 | 377 | .description = "Only supports single precision float", |
| 378 | 378 | .dependencies = featureSet(&[_]Feature{}), |
| 379 | 379 | }; |
| 380 | result[@intFromEnum(Feature.soft_float)] = .{ | |
| 380 | result[@backingInt(Feature.soft_float)] = .{ | |
| 381 | 381 | .llvm_name = "soft-float", |
| 382 | 382 | .description = "Does not support floating point instructions", |
| 383 | 383 | .dependencies = featureSet(&[_]Feature{}), |
| 384 | 384 | }; |
| 385 | result[@intFromEnum(Feature.strict_align)] = .{ | |
| 385 | result[@backingInt(Feature.strict_align)] = .{ | |
| 386 | 386 | .llvm_name = "strict-align", |
| 387 | 387 | .description = "Disable unaligned load store for r6", |
| 388 | 388 | .dependencies = featureSet(&[_]Feature{}), |
| 389 | 389 | }; |
| 390 | result[@intFromEnum(Feature.sym32)] = .{ | |
| 390 | result[@backingInt(Feature.sym32)] = .{ | |
| 391 | 391 | .llvm_name = "sym32", |
| 392 | 392 | .description = "Symbols are 32 bit on Mips64", |
| 393 | 393 | .dependencies = featureSet(&[_]Feature{}), |
| 394 | 394 | }; |
| 395 | result[@intFromEnum(Feature.use_compact_branches)] = .{ | |
| 395 | result[@backingInt(Feature.use_compact_branches)] = .{ | |
| 396 | 396 | .llvm_name = "use-compact-branches", |
| 397 | 397 | .description = "Use compact branch instructions for MIPS32R6/MIPS64R6", |
| 398 | 398 | .dependencies = featureSet(&[_]Feature{}), |
| 399 | 399 | }; |
| 400 | result[@intFromEnum(Feature.use_indirect_jump_hazard)] = .{ | |
| 400 | result[@backingInt(Feature.use_indirect_jump_hazard)] = .{ | |
| 401 | 401 | .llvm_name = "use-indirect-jump-hazard", |
| 402 | 402 | .description = "Use indirect jump guards to prevent certain speculation based attacks", |
| 403 | 403 | .dependencies = featureSet(&[_]Feature{}), |
| 404 | 404 | }; |
| 405 | result[@intFromEnum(Feature.use_tcc_in_div)] = .{ | |
| 405 | result[@backingInt(Feature.use_tcc_in_div)] = .{ | |
| 406 | 406 | .llvm_name = "use-tcc-in-div", |
| 407 | 407 | .description = "Force the assembler to use trapping", |
| 408 | 408 | .dependencies = featureSet(&[_]Feature{}), |
| 409 | 409 | }; |
| 410 | result[@intFromEnum(Feature.vfpu)] = .{ | |
| 410 | result[@backingInt(Feature.vfpu)] = .{ | |
| 411 | 411 | .llvm_name = "vfpu", |
| 412 | 412 | .description = "Enable vector FPU instructions", |
| 413 | 413 | .dependencies = featureSet(&[_]Feature{}), |
| 414 | 414 | }; |
| 415 | result[@intFromEnum(Feature.virt)] = .{ | |
| 415 | result[@backingInt(Feature.virt)] = .{ | |
| 416 | 416 | .llvm_name = "virt", |
| 417 | 417 | .description = "Mips Virtualization ASE", |
| 418 | 418 | .dependencies = featureSet(&[_]Feature{}), |
| 419 | 419 | }; |
| 420 | result[@intFromEnum(Feature.xgot)] = .{ | |
| 420 | result[@backingInt(Feature.xgot)] = .{ | |
| 421 | 421 | .llvm_name = "xgot", |
| 422 | 422 | .description = "Assume 32-bit GOT", |
| 423 | 423 | .dependencies = featureSet(&[_]Feature{}), |
lib/std/Target/msp430.zig+4-4| ... | ... | @@ -20,22 +20,22 @@ pub const all_features = blk: { |
| 20 | 20 | const len = @typeInfo(Feature).@"enum".field_names.len; |
| 21 | 21 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); |
| 22 | 22 | var result: [len]CpuFeature = undefined; |
| 23 | result[@intFromEnum(Feature.ext)] = .{ | |
| 23 | result[@backingInt(Feature.ext)] = .{ | |
| 24 | 24 | .llvm_name = "ext", |
| 25 | 25 | .description = "Enable MSP430-X extensions", |
| 26 | 26 | .dependencies = featureSet(&[_]Feature{}), |
| 27 | 27 | }; |
| 28 | result[@intFromEnum(Feature.hwmult16)] = .{ | |
| 28 | result[@backingInt(Feature.hwmult16)] = .{ | |
| 29 | 29 | .llvm_name = "hwmult16", |
| 30 | 30 | .description = "Enable 16-bit hardware multiplier", |
| 31 | 31 | .dependencies = featureSet(&[_]Feature{}), |
| 32 | 32 | }; |
| 33 | result[@intFromEnum(Feature.hwmult32)] = .{ | |
| 33 | result[@backingInt(Feature.hwmult32)] = .{ | |
| 34 | 34 | .llvm_name = "hwmult32", |
| 35 | 35 | .description = "Enable 32-bit hardware multiplier", |
| 36 | 36 | .dependencies = featureSet(&[_]Feature{}), |
| 37 | 37 | }; |
| 38 | result[@intFromEnum(Feature.hwmultf5)] = .{ | |
| 38 | result[@backingInt(Feature.hwmultf5)] = .{ | |
| 39 | 39 | .llvm_name = "hwmultf5", |
| 40 | 40 | .description = "Enable F5 series hardware multiplier", |
| 41 | 41 | .dependencies = featureSet(&[_]Feature{}), |
lib/std/Target/nvptx.zig+71-71| ... | ... | @@ -87,357 +87,357 @@ pub const all_features = blk: { |
| 87 | 87 | const len = @typeInfo(Feature).@"enum".field_names.len; |
| 88 | 88 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); |
| 89 | 89 | var result: [len]CpuFeature = undefined; |
| 90 | result[@intFromEnum(Feature.ptx32)] = .{ | |
| 90 | result[@backingInt(Feature.ptx32)] = .{ | |
| 91 | 91 | .llvm_name = "ptx32", |
| 92 | 92 | .description = "Use PTX version 32", |
| 93 | 93 | .dependencies = featureSet(&[_]Feature{}), |
| 94 | 94 | }; |
| 95 | result[@intFromEnum(Feature.ptx40)] = .{ | |
| 95 | result[@backingInt(Feature.ptx40)] = .{ | |
| 96 | 96 | .llvm_name = "ptx40", |
| 97 | 97 | .description = "Use PTX version 40", |
| 98 | 98 | .dependencies = featureSet(&[_]Feature{}), |
| 99 | 99 | }; |
| 100 | result[@intFromEnum(Feature.ptx41)] = .{ | |
| 100 | result[@backingInt(Feature.ptx41)] = .{ | |
| 101 | 101 | .llvm_name = "ptx41", |
| 102 | 102 | .description = "Use PTX version 41", |
| 103 | 103 | .dependencies = featureSet(&[_]Feature{}), |
| 104 | 104 | }; |
| 105 | result[@intFromEnum(Feature.ptx42)] = .{ | |
| 105 | result[@backingInt(Feature.ptx42)] = .{ | |
| 106 | 106 | .llvm_name = "ptx42", |
| 107 | 107 | .description = "Use PTX version 42", |
| 108 | 108 | .dependencies = featureSet(&[_]Feature{}), |
| 109 | 109 | }; |
| 110 | result[@intFromEnum(Feature.ptx43)] = .{ | |
| 110 | result[@backingInt(Feature.ptx43)] = .{ | |
| 111 | 111 | .llvm_name = "ptx43", |
| 112 | 112 | .description = "Use PTX version 43", |
| 113 | 113 | .dependencies = featureSet(&[_]Feature{}), |
| 114 | 114 | }; |
| 115 | result[@intFromEnum(Feature.ptx50)] = .{ | |
| 115 | result[@backingInt(Feature.ptx50)] = .{ | |
| 116 | 116 | .llvm_name = "ptx50", |
| 117 | 117 | .description = "Use PTX version 50", |
| 118 | 118 | .dependencies = featureSet(&[_]Feature{}), |
| 119 | 119 | }; |
| 120 | result[@intFromEnum(Feature.ptx60)] = .{ | |
| 120 | result[@backingInt(Feature.ptx60)] = .{ | |
| 121 | 121 | .llvm_name = "ptx60", |
| 122 | 122 | .description = "Use PTX version 60", |
| 123 | 123 | .dependencies = featureSet(&[_]Feature{}), |
| 124 | 124 | }; |
| 125 | result[@intFromEnum(Feature.ptx61)] = .{ | |
| 125 | result[@backingInt(Feature.ptx61)] = .{ | |
| 126 | 126 | .llvm_name = "ptx61", |
| 127 | 127 | .description = "Use PTX version 61", |
| 128 | 128 | .dependencies = featureSet(&[_]Feature{}), |
| 129 | 129 | }; |
| 130 | result[@intFromEnum(Feature.ptx62)] = .{ | |
| 130 | result[@backingInt(Feature.ptx62)] = .{ | |
| 131 | 131 | .llvm_name = "ptx62", |
| 132 | 132 | .description = "Use PTX version 62", |
| 133 | 133 | .dependencies = featureSet(&[_]Feature{}), |
| 134 | 134 | }; |
| 135 | result[@intFromEnum(Feature.ptx63)] = .{ | |
| 135 | result[@backingInt(Feature.ptx63)] = .{ | |
| 136 | 136 | .llvm_name = "ptx63", |
| 137 | 137 | .description = "Use PTX version 63", |
| 138 | 138 | .dependencies = featureSet(&[_]Feature{}), |
| 139 | 139 | }; |
| 140 | result[@intFromEnum(Feature.ptx64)] = .{ | |
| 140 | result[@backingInt(Feature.ptx64)] = .{ | |
| 141 | 141 | .llvm_name = "ptx64", |
| 142 | 142 | .description = "Use PTX version 64", |
| 143 | 143 | .dependencies = featureSet(&[_]Feature{}), |
| 144 | 144 | }; |
| 145 | result[@intFromEnum(Feature.ptx65)] = .{ | |
| 145 | result[@backingInt(Feature.ptx65)] = .{ | |
| 146 | 146 | .llvm_name = "ptx65", |
| 147 | 147 | .description = "Use PTX version 65", |
| 148 | 148 | .dependencies = featureSet(&[_]Feature{}), |
| 149 | 149 | }; |
| 150 | result[@intFromEnum(Feature.ptx70)] = .{ | |
| 150 | result[@backingInt(Feature.ptx70)] = .{ | |
| 151 | 151 | .llvm_name = "ptx70", |
| 152 | 152 | .description = "Use PTX version 70", |
| 153 | 153 | .dependencies = featureSet(&[_]Feature{}), |
| 154 | 154 | }; |
| 155 | result[@intFromEnum(Feature.ptx71)] = .{ | |
| 155 | result[@backingInt(Feature.ptx71)] = .{ | |
| 156 | 156 | .llvm_name = "ptx71", |
| 157 | 157 | .description = "Use PTX version 71", |
| 158 | 158 | .dependencies = featureSet(&[_]Feature{}), |
| 159 | 159 | }; |
| 160 | result[@intFromEnum(Feature.ptx72)] = .{ | |
| 160 | result[@backingInt(Feature.ptx72)] = .{ | |
| 161 | 161 | .llvm_name = "ptx72", |
| 162 | 162 | .description = "Use PTX version 72", |
| 163 | 163 | .dependencies = featureSet(&[_]Feature{}), |
| 164 | 164 | }; |
| 165 | result[@intFromEnum(Feature.ptx73)] = .{ | |
| 165 | result[@backingInt(Feature.ptx73)] = .{ | |
| 166 | 166 | .llvm_name = "ptx73", |
| 167 | 167 | .description = "Use PTX version 73", |
| 168 | 168 | .dependencies = featureSet(&[_]Feature{}), |
| 169 | 169 | }; |
| 170 | result[@intFromEnum(Feature.ptx74)] = .{ | |
| 170 | result[@backingInt(Feature.ptx74)] = .{ | |
| 171 | 171 | .llvm_name = "ptx74", |
| 172 | 172 | .description = "Use PTX version 74", |
| 173 | 173 | .dependencies = featureSet(&[_]Feature{}), |
| 174 | 174 | }; |
| 175 | result[@intFromEnum(Feature.ptx75)] = .{ | |
| 175 | result[@backingInt(Feature.ptx75)] = .{ | |
| 176 | 176 | .llvm_name = "ptx75", |
| 177 | 177 | .description = "Use PTX version 75", |
| 178 | 178 | .dependencies = featureSet(&[_]Feature{}), |
| 179 | 179 | }; |
| 180 | result[@intFromEnum(Feature.ptx76)] = .{ | |
| 180 | result[@backingInt(Feature.ptx76)] = .{ | |
| 181 | 181 | .llvm_name = "ptx76", |
| 182 | 182 | .description = "Use PTX version 76", |
| 183 | 183 | .dependencies = featureSet(&[_]Feature{}), |
| 184 | 184 | }; |
| 185 | result[@intFromEnum(Feature.ptx77)] = .{ | |
| 185 | result[@backingInt(Feature.ptx77)] = .{ | |
| 186 | 186 | .llvm_name = "ptx77", |
| 187 | 187 | .description = "Use PTX version 77", |
| 188 | 188 | .dependencies = featureSet(&[_]Feature{}), |
| 189 | 189 | }; |
| 190 | result[@intFromEnum(Feature.ptx78)] = .{ | |
| 190 | result[@backingInt(Feature.ptx78)] = .{ | |
| 191 | 191 | .llvm_name = "ptx78", |
| 192 | 192 | .description = "Use PTX version 78", |
| 193 | 193 | .dependencies = featureSet(&[_]Feature{}), |
| 194 | 194 | }; |
| 195 | result[@intFromEnum(Feature.ptx80)] = .{ | |
| 195 | result[@backingInt(Feature.ptx80)] = .{ | |
| 196 | 196 | .llvm_name = "ptx80", |
| 197 | 197 | .description = "Use PTX version 80", |
| 198 | 198 | .dependencies = featureSet(&[_]Feature{}), |
| 199 | 199 | }; |
| 200 | result[@intFromEnum(Feature.ptx81)] = .{ | |
| 200 | result[@backingInt(Feature.ptx81)] = .{ | |
| 201 | 201 | .llvm_name = "ptx81", |
| 202 | 202 | .description = "Use PTX version 81", |
| 203 | 203 | .dependencies = featureSet(&[_]Feature{}), |
| 204 | 204 | }; |
| 205 | result[@intFromEnum(Feature.ptx82)] = .{ | |
| 205 | result[@backingInt(Feature.ptx82)] = .{ | |
| 206 | 206 | .llvm_name = "ptx82", |
| 207 | 207 | .description = "Use PTX version 82", |
| 208 | 208 | .dependencies = featureSet(&[_]Feature{}), |
| 209 | 209 | }; |
| 210 | result[@intFromEnum(Feature.ptx83)] = .{ | |
| 210 | result[@backingInt(Feature.ptx83)] = .{ | |
| 211 | 211 | .llvm_name = "ptx83", |
| 212 | 212 | .description = "Use PTX version 83", |
| 213 | 213 | .dependencies = featureSet(&[_]Feature{}), |
| 214 | 214 | }; |
| 215 | result[@intFromEnum(Feature.ptx84)] = .{ | |
| 215 | result[@backingInt(Feature.ptx84)] = .{ | |
| 216 | 216 | .llvm_name = "ptx84", |
| 217 | 217 | .description = "Use PTX version 84", |
| 218 | 218 | .dependencies = featureSet(&[_]Feature{}), |
| 219 | 219 | }; |
| 220 | result[@intFromEnum(Feature.ptx85)] = .{ | |
| 220 | result[@backingInt(Feature.ptx85)] = .{ | |
| 221 | 221 | .llvm_name = "ptx85", |
| 222 | 222 | .description = "Use PTX version 85", |
| 223 | 223 | .dependencies = featureSet(&[_]Feature{}), |
| 224 | 224 | }; |
| 225 | result[@intFromEnum(Feature.ptx86)] = .{ | |
| 225 | result[@backingInt(Feature.ptx86)] = .{ | |
| 226 | 226 | .llvm_name = "ptx86", |
| 227 | 227 | .description = "Use PTX version 86", |
| 228 | 228 | .dependencies = featureSet(&[_]Feature{}), |
| 229 | 229 | }; |
| 230 | result[@intFromEnum(Feature.ptx87)] = .{ | |
| 230 | result[@backingInt(Feature.ptx87)] = .{ | |
| 231 | 231 | .llvm_name = "ptx87", |
| 232 | 232 | .description = "Use PTX version 87", |
| 233 | 233 | .dependencies = featureSet(&[_]Feature{}), |
| 234 | 234 | }; |
| 235 | result[@intFromEnum(Feature.ptx88)] = .{ | |
| 235 | result[@backingInt(Feature.ptx88)] = .{ | |
| 236 | 236 | .llvm_name = "ptx88", |
| 237 | 237 | .description = "Use PTX version 88", |
| 238 | 238 | .dependencies = featureSet(&[_]Feature{}), |
| 239 | 239 | }; |
| 240 | result[@intFromEnum(Feature.ptx90)] = .{ | |
| 240 | result[@backingInt(Feature.ptx90)] = .{ | |
| 241 | 241 | .llvm_name = "ptx90", |
| 242 | 242 | .description = "Use PTX version 90", |
| 243 | 243 | .dependencies = featureSet(&[_]Feature{}), |
| 244 | 244 | }; |
| 245 | result[@intFromEnum(Feature.sm_100)] = .{ | |
| 245 | result[@backingInt(Feature.sm_100)] = .{ | |
| 246 | 246 | .llvm_name = "sm_100", |
| 247 | 247 | .description = "Target SM 100", |
| 248 | 248 | .dependencies = featureSet(&[_]Feature{}), |
| 249 | 249 | }; |
| 250 | result[@intFromEnum(Feature.sm_100a)] = .{ | |
| 250 | result[@backingInt(Feature.sm_100a)] = .{ | |
| 251 | 251 | .llvm_name = "sm_100a", |
| 252 | 252 | .description = "Target SM 100a", |
| 253 | 253 | .dependencies = featureSet(&[_]Feature{}), |
| 254 | 254 | }; |
| 255 | result[@intFromEnum(Feature.sm_100f)] = .{ | |
| 255 | result[@backingInt(Feature.sm_100f)] = .{ | |
| 256 | 256 | .llvm_name = "sm_100f", |
| 257 | 257 | .description = "Target SM 100f", |
| 258 | 258 | .dependencies = featureSet(&[_]Feature{}), |
| 259 | 259 | }; |
| 260 | result[@intFromEnum(Feature.sm_101)] = .{ | |
| 260 | result[@backingInt(Feature.sm_101)] = .{ | |
| 261 | 261 | .llvm_name = "sm_101", |
| 262 | 262 | .description = "Target SM 101", |
| 263 | 263 | .dependencies = featureSet(&[_]Feature{}), |
| 264 | 264 | }; |
| 265 | result[@intFromEnum(Feature.sm_101a)] = .{ | |
| 265 | result[@backingInt(Feature.sm_101a)] = .{ | |
| 266 | 266 | .llvm_name = "sm_101a", |
| 267 | 267 | .description = "Target SM 101a", |
| 268 | 268 | .dependencies = featureSet(&[_]Feature{}), |
| 269 | 269 | }; |
| 270 | result[@intFromEnum(Feature.sm_101f)] = .{ | |
| 270 | result[@backingInt(Feature.sm_101f)] = .{ | |
| 271 | 271 | .llvm_name = "sm_101f", |
| 272 | 272 | .description = "Target SM 101f", |
| 273 | 273 | .dependencies = featureSet(&[_]Feature{}), |
| 274 | 274 | }; |
| 275 | result[@intFromEnum(Feature.sm_103)] = .{ | |
| 275 | result[@backingInt(Feature.sm_103)] = .{ | |
| 276 | 276 | .llvm_name = "sm_103", |
| 277 | 277 | .description = "Target SM 103", |
| 278 | 278 | .dependencies = featureSet(&[_]Feature{}), |
| 279 | 279 | }; |
| 280 | result[@intFromEnum(Feature.sm_103a)] = .{ | |
| 280 | result[@backingInt(Feature.sm_103a)] = .{ | |
| 281 | 281 | .llvm_name = "sm_103a", |
| 282 | 282 | .description = "Target SM 103a", |
| 283 | 283 | .dependencies = featureSet(&[_]Feature{}), |
| 284 | 284 | }; |
| 285 | result[@intFromEnum(Feature.sm_103f)] = .{ | |
| 285 | result[@backingInt(Feature.sm_103f)] = .{ | |
| 286 | 286 | .llvm_name = "sm_103f", |
| 287 | 287 | .description = "Target SM 103f", |
| 288 | 288 | .dependencies = featureSet(&[_]Feature{}), |
| 289 | 289 | }; |
| 290 | result[@intFromEnum(Feature.sm_110)] = .{ | |
| 290 | result[@backingInt(Feature.sm_110)] = .{ | |
| 291 | 291 | .llvm_name = "sm_110", |
| 292 | 292 | .description = "Target SM 110", |
| 293 | 293 | .dependencies = featureSet(&[_]Feature{}), |
| 294 | 294 | }; |
| 295 | result[@intFromEnum(Feature.sm_110a)] = .{ | |
| 295 | result[@backingInt(Feature.sm_110a)] = .{ | |
| 296 | 296 | .llvm_name = "sm_110a", |
| 297 | 297 | .description = "Target SM 110a", |
| 298 | 298 | .dependencies = featureSet(&[_]Feature{}), |
| 299 | 299 | }; |
| 300 | result[@intFromEnum(Feature.sm_110f)] = .{ | |
| 300 | result[@backingInt(Feature.sm_110f)] = .{ | |
| 301 | 301 | .llvm_name = "sm_110f", |
| 302 | 302 | .description = "Target SM 110f", |
| 303 | 303 | .dependencies = featureSet(&[_]Feature{}), |
| 304 | 304 | }; |
| 305 | result[@intFromEnum(Feature.sm_120)] = .{ | |
| 305 | result[@backingInt(Feature.sm_120)] = .{ | |
| 306 | 306 | .llvm_name = "sm_120", |
| 307 | 307 | .description = "Target SM 120", |
| 308 | 308 | .dependencies = featureSet(&[_]Feature{}), |
| 309 | 309 | }; |
| 310 | result[@intFromEnum(Feature.sm_120a)] = .{ | |
| 310 | result[@backingInt(Feature.sm_120a)] = .{ | |
| 311 | 311 | .llvm_name = "sm_120a", |
| 312 | 312 | .description = "Target SM 120a", |
| 313 | 313 | .dependencies = featureSet(&[_]Feature{}), |
| 314 | 314 | }; |
| 315 | result[@intFromEnum(Feature.sm_120f)] = .{ | |
| 315 | result[@backingInt(Feature.sm_120f)] = .{ | |
| 316 | 316 | .llvm_name = "sm_120f", |
| 317 | 317 | .description = "Target SM 120f", |
| 318 | 318 | .dependencies = featureSet(&[_]Feature{}), |
| 319 | 319 | }; |
| 320 | result[@intFromEnum(Feature.sm_121)] = .{ | |
| 320 | result[@backingInt(Feature.sm_121)] = .{ | |
| 321 | 321 | .llvm_name = "sm_121", |
| 322 | 322 | .description = "Target SM 121", |
| 323 | 323 | .dependencies = featureSet(&[_]Feature{}), |
| 324 | 324 | }; |
| 325 | result[@intFromEnum(Feature.sm_121a)] = .{ | |
| 325 | result[@backingInt(Feature.sm_121a)] = .{ | |
| 326 | 326 | .llvm_name = "sm_121a", |
| 327 | 327 | .description = "Target SM 121a", |
| 328 | 328 | .dependencies = featureSet(&[_]Feature{}), |
| 329 | 329 | }; |
| 330 | result[@intFromEnum(Feature.sm_121f)] = .{ | |
| 330 | result[@backingInt(Feature.sm_121f)] = .{ | |
| 331 | 331 | .llvm_name = "sm_121f", |
| 332 | 332 | .description = "Target SM 121f", |
| 333 | 333 | .dependencies = featureSet(&[_]Feature{}), |
| 334 | 334 | }; |
| 335 | result[@intFromEnum(Feature.sm_20)] = .{ | |
| 335 | result[@backingInt(Feature.sm_20)] = .{ | |
| 336 | 336 | .llvm_name = "sm_20", |
| 337 | 337 | .description = "Target SM 20", |
| 338 | 338 | .dependencies = featureSet(&[_]Feature{}), |
| 339 | 339 | }; |
| 340 | result[@intFromEnum(Feature.sm_21)] = .{ | |
| 340 | result[@backingInt(Feature.sm_21)] = .{ | |
| 341 | 341 | .llvm_name = "sm_21", |
| 342 | 342 | .description = "Target SM 21", |
| 343 | 343 | .dependencies = featureSet(&[_]Feature{}), |
| 344 | 344 | }; |
| 345 | result[@intFromEnum(Feature.sm_30)] = .{ | |
| 345 | result[@backingInt(Feature.sm_30)] = .{ | |
| 346 | 346 | .llvm_name = "sm_30", |
| 347 | 347 | .description = "Target SM 30", |
| 348 | 348 | .dependencies = featureSet(&[_]Feature{}), |
| 349 | 349 | }; |
| 350 | result[@intFromEnum(Feature.sm_32)] = .{ | |
| 350 | result[@backingInt(Feature.sm_32)] = .{ | |
| 351 | 351 | .llvm_name = "sm_32", |
| 352 | 352 | .description = "Target SM 32", |
| 353 | 353 | .dependencies = featureSet(&[_]Feature{}), |
| 354 | 354 | }; |
| 355 | result[@intFromEnum(Feature.sm_35)] = .{ | |
| 355 | result[@backingInt(Feature.sm_35)] = .{ | |
| 356 | 356 | .llvm_name = "sm_35", |
| 357 | 357 | .description = "Target SM 35", |
| 358 | 358 | .dependencies = featureSet(&[_]Feature{}), |
| 359 | 359 | }; |
| 360 | result[@intFromEnum(Feature.sm_37)] = .{ | |
| 360 | result[@backingInt(Feature.sm_37)] = .{ | |
| 361 | 361 | .llvm_name = "sm_37", |
| 362 | 362 | .description = "Target SM 37", |
| 363 | 363 | .dependencies = featureSet(&[_]Feature{}), |
| 364 | 364 | }; |
| 365 | result[@intFromEnum(Feature.sm_50)] = .{ | |
| 365 | result[@backingInt(Feature.sm_50)] = .{ | |
| 366 | 366 | .llvm_name = "sm_50", |
| 367 | 367 | .description = "Target SM 50", |
| 368 | 368 | .dependencies = featureSet(&[_]Feature{}), |
| 369 | 369 | }; |
| 370 | result[@intFromEnum(Feature.sm_52)] = .{ | |
| 370 | result[@backingInt(Feature.sm_52)] = .{ | |
| 371 | 371 | .llvm_name = "sm_52", |
| 372 | 372 | .description = "Target SM 52", |
| 373 | 373 | .dependencies = featureSet(&[_]Feature{}), |
| 374 | 374 | }; |
| 375 | result[@intFromEnum(Feature.sm_53)] = .{ | |
| 375 | result[@backingInt(Feature.sm_53)] = .{ | |
| 376 | 376 | .llvm_name = "sm_53", |
| 377 | 377 | .description = "Target SM 53", |
| 378 | 378 | .dependencies = featureSet(&[_]Feature{}), |
| 379 | 379 | }; |
| 380 | result[@intFromEnum(Feature.sm_60)] = .{ | |
| 380 | result[@backingInt(Feature.sm_60)] = .{ | |
| 381 | 381 | .llvm_name = "sm_60", |
| 382 | 382 | .description = "Target SM 60", |
| 383 | 383 | .dependencies = featureSet(&[_]Feature{}), |
| 384 | 384 | }; |
| 385 | result[@intFromEnum(Feature.sm_61)] = .{ | |
| 385 | result[@backingInt(Feature.sm_61)] = .{ | |
| 386 | 386 | .llvm_name = "sm_61", |
| 387 | 387 | .description = "Target SM 61", |
| 388 | 388 | .dependencies = featureSet(&[_]Feature{}), |
| 389 | 389 | }; |
| 390 | result[@intFromEnum(Feature.sm_62)] = .{ | |
| 390 | result[@backingInt(Feature.sm_62)] = .{ | |
| 391 | 391 | .llvm_name = "sm_62", |
| 392 | 392 | .description = "Target SM 62", |
| 393 | 393 | .dependencies = featureSet(&[_]Feature{}), |
| 394 | 394 | }; |
| 395 | result[@intFromEnum(Feature.sm_70)] = .{ | |
| 395 | result[@backingInt(Feature.sm_70)] = .{ | |
| 396 | 396 | .llvm_name = "sm_70", |
| 397 | 397 | .description = "Target SM 70", |
| 398 | 398 | .dependencies = featureSet(&[_]Feature{}), |
| 399 | 399 | }; |
| 400 | result[@intFromEnum(Feature.sm_72)] = .{ | |
| 400 | result[@backingInt(Feature.sm_72)] = .{ | |
| 401 | 401 | .llvm_name = "sm_72", |
| 402 | 402 | .description = "Target SM 72", |
| 403 | 403 | .dependencies = featureSet(&[_]Feature{}), |
| 404 | 404 | }; |
| 405 | result[@intFromEnum(Feature.sm_75)] = .{ | |
| 405 | result[@backingInt(Feature.sm_75)] = .{ | |
| 406 | 406 | .llvm_name = "sm_75", |
| 407 | 407 | .description = "Target SM 75", |
| 408 | 408 | .dependencies = featureSet(&[_]Feature{}), |
| 409 | 409 | }; |
| 410 | result[@intFromEnum(Feature.sm_80)] = .{ | |
| 410 | result[@backingInt(Feature.sm_80)] = .{ | |
| 411 | 411 | .llvm_name = "sm_80", |
| 412 | 412 | .description = "Target SM 80", |
| 413 | 413 | .dependencies = featureSet(&[_]Feature{}), |
| 414 | 414 | }; |
| 415 | result[@intFromEnum(Feature.sm_86)] = .{ | |
| 415 | result[@backingInt(Feature.sm_86)] = .{ | |
| 416 | 416 | .llvm_name = "sm_86", |
| 417 | 417 | .description = "Target SM 86", |
| 418 | 418 | .dependencies = featureSet(&[_]Feature{}), |
| 419 | 419 | }; |
| 420 | result[@intFromEnum(Feature.sm_87)] = .{ | |
| 420 | result[@backingInt(Feature.sm_87)] = .{ | |
| 421 | 421 | .llvm_name = "sm_87", |
| 422 | 422 | .description = "Target SM 87", |
| 423 | 423 | .dependencies = featureSet(&[_]Feature{}), |
| 424 | 424 | }; |
| 425 | result[@intFromEnum(Feature.sm_88)] = .{ | |
| 425 | result[@backingInt(Feature.sm_88)] = .{ | |
| 426 | 426 | .llvm_name = "sm_88", |
| 427 | 427 | .description = "Target SM 88", |
| 428 | 428 | .dependencies = featureSet(&[_]Feature{}), |
| 429 | 429 | }; |
| 430 | result[@intFromEnum(Feature.sm_89)] = .{ | |
| 430 | result[@backingInt(Feature.sm_89)] = .{ | |
| 431 | 431 | .llvm_name = "sm_89", |
| 432 | 432 | .description = "Target SM 89", |
| 433 | 433 | .dependencies = featureSet(&[_]Feature{}), |
| 434 | 434 | }; |
| 435 | result[@intFromEnum(Feature.sm_90)] = .{ | |
| 435 | result[@backingInt(Feature.sm_90)] = .{ | |
| 436 | 436 | .llvm_name = "sm_90", |
| 437 | 437 | .description = "Target SM 90", |
| 438 | 438 | .dependencies = featureSet(&[_]Feature{}), |
| 439 | 439 | }; |
| 440 | result[@intFromEnum(Feature.sm_90a)] = .{ | |
| 440 | result[@backingInt(Feature.sm_90a)] = .{ | |
| 441 | 441 | .llvm_name = "sm_90a", |
| 442 | 442 | .description = "Target SM 90a", |
| 443 | 443 | .dependencies = featureSet(&[_]Feature{}), |
lib/std/Target/powerpc.zig+80-80| ... | ... | @@ -96,331 +96,331 @@ pub const all_features = blk: { |
| 96 | 96 | const len = @typeInfo(Feature).@"enum".field_names.len; |
| 97 | 97 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); |
| 98 | 98 | var result: [len]CpuFeature = undefined; |
| 99 | result[@intFromEnum(Feature.@"64bit")] = .{ | |
| 99 | result[@backingInt(Feature.@"64bit")] = .{ | |
| 100 | 100 | .llvm_name = "64bit", |
| 101 | 101 | .description = "Enable 64-bit mode", |
| 102 | 102 | .dependencies = featureSet(&[_]Feature{ |
| 103 | 103 | .@"64bit_support", |
| 104 | 104 | }), |
| 105 | 105 | }; |
| 106 | result[@intFromEnum(Feature.@"64bit_support")] = .{ | |
| 106 | result[@backingInt(Feature.@"64bit_support")] = .{ | |
| 107 | 107 | .llvm_name = "64bit-support", |
| 108 | 108 | .description = "Supports 64-bit instructions", |
| 109 | 109 | .dependencies = featureSet(&[_]Feature{}), |
| 110 | 110 | }; |
| 111 | result[@intFromEnum(Feature.@"64bitregs")] = .{ | |
| 111 | result[@backingInt(Feature.@"64bitregs")] = .{ | |
| 112 | 112 | .llvm_name = "64bitregs", |
| 113 | 113 | .description = "Enable 64-bit registers usage for ppc32 [beta]", |
| 114 | 114 | .dependencies = featureSet(&[_]Feature{}), |
| 115 | 115 | }; |
| 116 | result[@intFromEnum(Feature.allow_unaligned_fp_access)] = .{ | |
| 116 | result[@backingInt(Feature.allow_unaligned_fp_access)] = .{ | |
| 117 | 117 | .llvm_name = "allow-unaligned-fp-access", |
| 118 | 118 | .description = "CPU does not trap on unaligned FP access", |
| 119 | 119 | .dependencies = featureSet(&[_]Feature{}), |
| 120 | 120 | }; |
| 121 | result[@intFromEnum(Feature.altivec)] = .{ | |
| 121 | result[@backingInt(Feature.altivec)] = .{ | |
| 122 | 122 | .llvm_name = "altivec", |
| 123 | 123 | .description = "Enable Altivec instructions", |
| 124 | 124 | .dependencies = featureSet(&[_]Feature{ |
| 125 | 125 | .fpu, |
| 126 | 126 | }), |
| 127 | 127 | }; |
| 128 | result[@intFromEnum(Feature.booke)] = .{ | |
| 128 | result[@backingInt(Feature.booke)] = .{ | |
| 129 | 129 | .llvm_name = "booke", |
| 130 | 130 | .description = "Enable Book E instructions", |
| 131 | 131 | .dependencies = featureSet(&[_]Feature{ |
| 132 | 132 | .icbt, |
| 133 | 133 | }), |
| 134 | 134 | }; |
| 135 | result[@intFromEnum(Feature.bpermd)] = .{ | |
| 135 | result[@backingInt(Feature.bpermd)] = .{ | |
| 136 | 136 | .llvm_name = "bpermd", |
| 137 | 137 | .description = "Enable the bpermd instruction", |
| 138 | 138 | .dependencies = featureSet(&[_]Feature{}), |
| 139 | 139 | }; |
| 140 | result[@intFromEnum(Feature.cmpb)] = .{ | |
| 140 | result[@backingInt(Feature.cmpb)] = .{ | |
| 141 | 141 | .llvm_name = "cmpb", |
| 142 | 142 | .description = "Enable the cmpb instruction", |
| 143 | 143 | .dependencies = featureSet(&[_]Feature{}), |
| 144 | 144 | }; |
| 145 | result[@intFromEnum(Feature.crbits)] = .{ | |
| 145 | result[@backingInt(Feature.crbits)] = .{ | |
| 146 | 146 | .llvm_name = "crbits", |
| 147 | 147 | .description = "Use condition-register bits individually", |
| 148 | 148 | .dependencies = featureSet(&[_]Feature{}), |
| 149 | 149 | }; |
| 150 | result[@intFromEnum(Feature.crypto)] = .{ | |
| 150 | result[@backingInt(Feature.crypto)] = .{ | |
| 151 | 151 | .llvm_name = "crypto", |
| 152 | 152 | .description = "Enable POWER8 Crypto instructions", |
| 153 | 153 | .dependencies = featureSet(&[_]Feature{ |
| 154 | 154 | .power8_altivec, |
| 155 | 155 | }), |
| 156 | 156 | }; |
| 157 | result[@intFromEnum(Feature.direct_move)] = .{ | |
| 157 | result[@backingInt(Feature.direct_move)] = .{ | |
| 158 | 158 | .llvm_name = "direct-move", |
| 159 | 159 | .description = "Enable Power8 direct move instructions", |
| 160 | 160 | .dependencies = featureSet(&[_]Feature{ |
| 161 | 161 | .vsx, |
| 162 | 162 | }), |
| 163 | 163 | }; |
| 164 | result[@intFromEnum(Feature.e500)] = .{ | |
| 164 | result[@backingInt(Feature.e500)] = .{ | |
| 165 | 165 | .llvm_name = "e500", |
| 166 | 166 | .description = "Enable E500/E500mc instructions", |
| 167 | 167 | .dependencies = featureSet(&[_]Feature{}), |
| 168 | 168 | }; |
| 169 | result[@intFromEnum(Feature.efpu2)] = .{ | |
| 169 | result[@backingInt(Feature.efpu2)] = .{ | |
| 170 | 170 | .llvm_name = "efpu2", |
| 171 | 171 | .description = "Enable Embedded Floating-Point APU 2 instructions", |
| 172 | 172 | .dependencies = featureSet(&[_]Feature{ |
| 173 | 173 | .spe, |
| 174 | 174 | }), |
| 175 | 175 | }; |
| 176 | result[@intFromEnum(Feature.extdiv)] = .{ | |
| 176 | result[@backingInt(Feature.extdiv)] = .{ | |
| 177 | 177 | .llvm_name = "extdiv", |
| 178 | 178 | .description = "Enable extended divide instructions", |
| 179 | 179 | .dependencies = featureSet(&[_]Feature{}), |
| 180 | 180 | }; |
| 181 | result[@intFromEnum(Feature.fast_MFLR)] = .{ | |
| 181 | result[@backingInt(Feature.fast_MFLR)] = .{ | |
| 182 | 182 | .llvm_name = "fast-MFLR", |
| 183 | 183 | .description = "MFLR is a fast instruction", |
| 184 | 184 | .dependencies = featureSet(&[_]Feature{}), |
| 185 | 185 | }; |
| 186 | result[@intFromEnum(Feature.fcpsgn)] = .{ | |
| 186 | result[@backingInt(Feature.fcpsgn)] = .{ | |
| 187 | 187 | .llvm_name = "fcpsgn", |
| 188 | 188 | .description = "Enable the fcpsgn instruction", |
| 189 | 189 | .dependencies = featureSet(&[_]Feature{ |
| 190 | 190 | .fpu, |
| 191 | 191 | }), |
| 192 | 192 | }; |
| 193 | result[@intFromEnum(Feature.float128)] = .{ | |
| 193 | result[@backingInt(Feature.float128)] = .{ | |
| 194 | 194 | .llvm_name = "float128", |
| 195 | 195 | .description = "Enable the __float128 data type for IEEE-754R Binary128.", |
| 196 | 196 | .dependencies = featureSet(&[_]Feature{ |
| 197 | 197 | .vsx, |
| 198 | 198 | }), |
| 199 | 199 | }; |
| 200 | result[@intFromEnum(Feature.fpcvt)] = .{ | |
| 200 | result[@backingInt(Feature.fpcvt)] = .{ | |
| 201 | 201 | .llvm_name = "fpcvt", |
| 202 | 202 | .description = "Enable fc[ft]* (unsigned and single-precision) and lfiwzx instructions", |
| 203 | 203 | .dependencies = featureSet(&[_]Feature{ |
| 204 | 204 | .fpu, |
| 205 | 205 | }), |
| 206 | 206 | }; |
| 207 | result[@intFromEnum(Feature.fprnd)] = .{ | |
| 207 | result[@backingInt(Feature.fprnd)] = .{ | |
| 208 | 208 | .llvm_name = "fprnd", |
| 209 | 209 | .description = "Enable the fri[mnpz] instructions", |
| 210 | 210 | .dependencies = featureSet(&[_]Feature{ |
| 211 | 211 | .fpu, |
| 212 | 212 | }), |
| 213 | 213 | }; |
| 214 | result[@intFromEnum(Feature.fpu)] = .{ | |
| 214 | result[@backingInt(Feature.fpu)] = .{ | |
| 215 | 215 | .llvm_name = "fpu", |
| 216 | 216 | .description = "Enable classic FPU instructions", |
| 217 | 217 | .dependencies = featureSet(&[_]Feature{ |
| 218 | 218 | .hard_float, |
| 219 | 219 | }), |
| 220 | 220 | }; |
| 221 | result[@intFromEnum(Feature.fre)] = .{ | |
| 221 | result[@backingInt(Feature.fre)] = .{ | |
| 222 | 222 | .llvm_name = "fre", |
| 223 | 223 | .description = "Enable the fre instruction", |
| 224 | 224 | .dependencies = featureSet(&[_]Feature{ |
| 225 | 225 | .fpu, |
| 226 | 226 | }), |
| 227 | 227 | }; |
| 228 | result[@intFromEnum(Feature.fres)] = .{ | |
| 228 | result[@backingInt(Feature.fres)] = .{ | |
| 229 | 229 | .llvm_name = "fres", |
| 230 | 230 | .description = "Enable the fres instruction", |
| 231 | 231 | .dependencies = featureSet(&[_]Feature{ |
| 232 | 232 | .fpu, |
| 233 | 233 | }), |
| 234 | 234 | }; |
| 235 | result[@intFromEnum(Feature.frsqrte)] = .{ | |
| 235 | result[@backingInt(Feature.frsqrte)] = .{ | |
| 236 | 236 | .llvm_name = "frsqrte", |
| 237 | 237 | .description = "Enable the frsqrte instruction", |
| 238 | 238 | .dependencies = featureSet(&[_]Feature{ |
| 239 | 239 | .fpu, |
| 240 | 240 | }), |
| 241 | 241 | }; |
| 242 | result[@intFromEnum(Feature.frsqrtes)] = .{ | |
| 242 | result[@backingInt(Feature.frsqrtes)] = .{ | |
| 243 | 243 | .llvm_name = "frsqrtes", |
| 244 | 244 | .description = "Enable the frsqrtes instruction", |
| 245 | 245 | .dependencies = featureSet(&[_]Feature{ |
| 246 | 246 | .fpu, |
| 247 | 247 | }), |
| 248 | 248 | }; |
| 249 | result[@intFromEnum(Feature.fsqrt)] = .{ | |
| 249 | result[@backingInt(Feature.fsqrt)] = .{ | |
| 250 | 250 | .llvm_name = "fsqrt", |
| 251 | 251 | .description = "Enable the fsqrt instruction", |
| 252 | 252 | .dependencies = featureSet(&[_]Feature{ |
| 253 | 253 | .fpu, |
| 254 | 254 | }), |
| 255 | 255 | }; |
| 256 | result[@intFromEnum(Feature.fuse_add_logical)] = .{ | |
| 256 | result[@backingInt(Feature.fuse_add_logical)] = .{ | |
| 257 | 257 | .llvm_name = "fuse-add-logical", |
| 258 | 258 | .description = "Target supports Add with Logical Operations fusion", |
| 259 | 259 | .dependencies = featureSet(&[_]Feature{ |
| 260 | 260 | .fusion, |
| 261 | 261 | }), |
| 262 | 262 | }; |
| 263 | result[@intFromEnum(Feature.fuse_addi_load)] = .{ | |
| 263 | result[@backingInt(Feature.fuse_addi_load)] = .{ | |
| 264 | 264 | .llvm_name = "fuse-addi-load", |
| 265 | 265 | .description = "Power8 Addi-Load fusion", |
| 266 | 266 | .dependencies = featureSet(&[_]Feature{ |
| 267 | 267 | .fusion, |
| 268 | 268 | }), |
| 269 | 269 | }; |
| 270 | result[@intFromEnum(Feature.fuse_addis_load)] = .{ | |
| 270 | result[@backingInt(Feature.fuse_addis_load)] = .{ | |
| 271 | 271 | .llvm_name = "fuse-addis-load", |
| 272 | 272 | .description = "Power8 Addis-Load fusion", |
| 273 | 273 | .dependencies = featureSet(&[_]Feature{ |
| 274 | 274 | .fusion, |
| 275 | 275 | }), |
| 276 | 276 | }; |
| 277 | result[@intFromEnum(Feature.fuse_arith_add)] = .{ | |
| 277 | result[@backingInt(Feature.fuse_arith_add)] = .{ | |
| 278 | 278 | .llvm_name = "fuse-arith-add", |
| 279 | 279 | .description = "Target supports Arithmetic Operations with Add fusion", |
| 280 | 280 | .dependencies = featureSet(&[_]Feature{ |
| 281 | 281 | .fusion, |
| 282 | 282 | }), |
| 283 | 283 | }; |
| 284 | result[@intFromEnum(Feature.fuse_back2back)] = .{ | |
| 284 | result[@backingInt(Feature.fuse_back2back)] = .{ | |
| 285 | 285 | .llvm_name = "fuse-back2back", |
| 286 | 286 | .description = "Target supports general back to back fusion", |
| 287 | 287 | .dependencies = featureSet(&[_]Feature{ |
| 288 | 288 | .fusion, |
| 289 | 289 | }), |
| 290 | 290 | }; |
| 291 | result[@intFromEnum(Feature.fuse_cmp)] = .{ | |
| 291 | result[@backingInt(Feature.fuse_cmp)] = .{ | |
| 292 | 292 | .llvm_name = "fuse-cmp", |
| 293 | 293 | .description = "Target supports Comparison Operations fusion", |
| 294 | 294 | .dependencies = featureSet(&[_]Feature{ |
| 295 | 295 | .fusion, |
| 296 | 296 | }), |
| 297 | 297 | }; |
| 298 | result[@intFromEnum(Feature.fuse_logical)] = .{ | |
| 298 | result[@backingInt(Feature.fuse_logical)] = .{ | |
| 299 | 299 | .llvm_name = "fuse-logical", |
| 300 | 300 | .description = "Target supports Logical Operations fusion", |
| 301 | 301 | .dependencies = featureSet(&[_]Feature{ |
| 302 | 302 | .fusion, |
| 303 | 303 | }), |
| 304 | 304 | }; |
| 305 | result[@intFromEnum(Feature.fuse_logical_add)] = .{ | |
| 305 | result[@backingInt(Feature.fuse_logical_add)] = .{ | |
| 306 | 306 | .llvm_name = "fuse-logical-add", |
| 307 | 307 | .description = "Target supports Logical with Add Operations fusion", |
| 308 | 308 | .dependencies = featureSet(&[_]Feature{ |
| 309 | 309 | .fusion, |
| 310 | 310 | }), |
| 311 | 311 | }; |
| 312 | result[@intFromEnum(Feature.fuse_sha3)] = .{ | |
| 312 | result[@backingInt(Feature.fuse_sha3)] = .{ | |
| 313 | 313 | .llvm_name = "fuse-sha3", |
| 314 | 314 | .description = "Target supports SHA3 assist fusion", |
| 315 | 315 | .dependencies = featureSet(&[_]Feature{ |
| 316 | 316 | .fusion, |
| 317 | 317 | }), |
| 318 | 318 | }; |
| 319 | result[@intFromEnum(Feature.fuse_store)] = .{ | |
| 319 | result[@backingInt(Feature.fuse_store)] = .{ | |
| 320 | 320 | .llvm_name = "fuse-store", |
| 321 | 321 | .description = "Target supports store clustering", |
| 322 | 322 | .dependencies = featureSet(&[_]Feature{ |
| 323 | 323 | .fusion, |
| 324 | 324 | }), |
| 325 | 325 | }; |
| 326 | result[@intFromEnum(Feature.fuse_wideimm)] = .{ | |
| 326 | result[@backingInt(Feature.fuse_wideimm)] = .{ | |
| 327 | 327 | .llvm_name = "fuse-wideimm", |
| 328 | 328 | .description = "Target supports Wide-Immediate fusion", |
| 329 | 329 | .dependencies = featureSet(&[_]Feature{ |
| 330 | 330 | .fusion, |
| 331 | 331 | }), |
| 332 | 332 | }; |
| 333 | result[@intFromEnum(Feature.fuse_zeromove)] = .{ | |
| 333 | result[@backingInt(Feature.fuse_zeromove)] = .{ | |
| 334 | 334 | .llvm_name = "fuse-zeromove", |
| 335 | 335 | .description = "Target supports move to SPR with branch fusion", |
| 336 | 336 | .dependencies = featureSet(&[_]Feature{ |
| 337 | 337 | .fusion, |
| 338 | 338 | }), |
| 339 | 339 | }; |
| 340 | result[@intFromEnum(Feature.fusion)] = .{ | |
| 340 | result[@backingInt(Feature.fusion)] = .{ | |
| 341 | 341 | .llvm_name = "fusion", |
| 342 | 342 | .description = "Target supports instruction fusion", |
| 343 | 343 | .dependencies = featureSet(&[_]Feature{}), |
| 344 | 344 | }; |
| 345 | result[@intFromEnum(Feature.hard_float)] = .{ | |
| 345 | result[@backingInt(Feature.hard_float)] = .{ | |
| 346 | 346 | .llvm_name = "hard-float", |
| 347 | 347 | .description = "Enable floating-point instructions", |
| 348 | 348 | .dependencies = featureSet(&[_]Feature{}), |
| 349 | 349 | }; |
| 350 | result[@intFromEnum(Feature.htm)] = .{ | |
| 350 | result[@backingInt(Feature.htm)] = .{ | |
| 351 | 351 | .llvm_name = "htm", |
| 352 | 352 | .description = "Enable Hardware Transactional Memory instructions", |
| 353 | 353 | .dependencies = featureSet(&[_]Feature{}), |
| 354 | 354 | }; |
| 355 | result[@intFromEnum(Feature.icbt)] = .{ | |
| 355 | result[@backingInt(Feature.icbt)] = .{ | |
| 356 | 356 | .llvm_name = "icbt", |
| 357 | 357 | .description = "Enable icbt instruction", |
| 358 | 358 | .dependencies = featureSet(&[_]Feature{}), |
| 359 | 359 | }; |
| 360 | result[@intFromEnum(Feature.invariant_function_descriptors)] = .{ | |
| 360 | result[@backingInt(Feature.invariant_function_descriptors)] = .{ | |
| 361 | 361 | .llvm_name = "invariant-function-descriptors", |
| 362 | 362 | .description = "Assume function descriptors are invariant", |
| 363 | 363 | .dependencies = featureSet(&[_]Feature{}), |
| 364 | 364 | }; |
| 365 | result[@intFromEnum(Feature.isa_future_instructions)] = .{ | |
| 365 | result[@backingInt(Feature.isa_future_instructions)] = .{ | |
| 366 | 366 | .llvm_name = "isa-future-instructions", |
| 367 | 367 | .description = "Enable instructions for Future ISA.", |
| 368 | 368 | .dependencies = featureSet(&[_]Feature{ |
| 369 | 369 | .isa_v31_instructions, |
| 370 | 370 | }), |
| 371 | 371 | }; |
| 372 | result[@intFromEnum(Feature.isa_v206_instructions)] = .{ | |
| 372 | result[@backingInt(Feature.isa_v206_instructions)] = .{ | |
| 373 | 373 | .llvm_name = "isa-v206-instructions", |
| 374 | 374 | .description = "Enable instructions in ISA 2.06.", |
| 375 | 375 | .dependencies = featureSet(&[_]Feature{}), |
| 376 | 376 | }; |
| 377 | result[@intFromEnum(Feature.isa_v207_instructions)] = .{ | |
| 377 | result[@backingInt(Feature.isa_v207_instructions)] = .{ | |
| 378 | 378 | .llvm_name = "isa-v207-instructions", |
| 379 | 379 | .description = "Enable instructions in ISA 2.07.", |
| 380 | 380 | .dependencies = featureSet(&[_]Feature{}), |
| 381 | 381 | }; |
| 382 | result[@intFromEnum(Feature.isa_v30_instructions)] = .{ | |
| 382 | result[@backingInt(Feature.isa_v30_instructions)] = .{ | |
| 383 | 383 | .llvm_name = "isa-v30-instructions", |
| 384 | 384 | .description = "Enable instructions in ISA 3.0.", |
| 385 | 385 | .dependencies = featureSet(&[_]Feature{ |
| 386 | 386 | .isa_v207_instructions, |
| 387 | 387 | }), |
| 388 | 388 | }; |
| 389 | result[@intFromEnum(Feature.isa_v31_instructions)] = .{ | |
| 389 | result[@backingInt(Feature.isa_v31_instructions)] = .{ | |
| 390 | 390 | .llvm_name = "isa-v31-instructions", |
| 391 | 391 | .description = "Enable instructions in ISA 3.1.", |
| 392 | 392 | .dependencies = featureSet(&[_]Feature{ |
| 393 | 393 | .isa_v30_instructions, |
| 394 | 394 | }), |
| 395 | 395 | }; |
| 396 | result[@intFromEnum(Feature.isel)] = .{ | |
| 396 | result[@backingInt(Feature.isel)] = .{ | |
| 397 | 397 | .llvm_name = "isel", |
| 398 | 398 | .description = "Enable the isel instruction", |
| 399 | 399 | .dependencies = featureSet(&[_]Feature{}), |
| 400 | 400 | }; |
| 401 | result[@intFromEnum(Feature.ldbrx)] = .{ | |
| 401 | result[@backingInt(Feature.ldbrx)] = .{ | |
| 402 | 402 | .llvm_name = "ldbrx", |
| 403 | 403 | .description = "Enable the ldbrx instruction", |
| 404 | 404 | .dependencies = featureSet(&[_]Feature{}), |
| 405 | 405 | }; |
| 406 | result[@intFromEnum(Feature.lfiwax)] = .{ | |
| 406 | result[@backingInt(Feature.lfiwax)] = .{ | |
| 407 | 407 | .llvm_name = "lfiwax", |
| 408 | 408 | .description = "Enable the lfiwax instruction", |
| 409 | 409 | .dependencies = featureSet(&[_]Feature{ |
| 410 | 410 | .fpu, |
| 411 | 411 | }), |
| 412 | 412 | }; |
| 413 | result[@intFromEnum(Feature.longcall)] = .{ | |
| 413 | result[@backingInt(Feature.longcall)] = .{ | |
| 414 | 414 | .llvm_name = "longcall", |
| 415 | 415 | .description = "Always use indirect calls", |
| 416 | 416 | .dependencies = featureSet(&[_]Feature{}), |
| 417 | 417 | }; |
| 418 | result[@intFromEnum(Feature.mfocrf)] = .{ | |
| 418 | result[@backingInt(Feature.mfocrf)] = .{ | |
| 419 | 419 | .llvm_name = "mfocrf", |
| 420 | 420 | .description = "Enable the MFOCRF instruction", |
| 421 | 421 | .dependencies = featureSet(&[_]Feature{}), |
| 422 | 422 | }; |
| 423 | result[@intFromEnum(Feature.mma)] = .{ | |
| 423 | result[@backingInt(Feature.mma)] = .{ | |
| 424 | 424 | .llvm_name = "mma", |
| 425 | 425 | .description = "Enable MMA instructions", |
| 426 | 426 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -429,38 +429,38 @@ pub const all_features = blk: { |
| 429 | 429 | .power9_altivec, |
| 430 | 430 | }), |
| 431 | 431 | }; |
| 432 | result[@intFromEnum(Feature.msync)] = .{ | |
| 432 | result[@backingInt(Feature.msync)] = .{ | |
| 433 | 433 | .llvm_name = "msync", |
| 434 | 434 | .description = "Has only the msync instruction instead of sync", |
| 435 | 435 | .dependencies = featureSet(&[_]Feature{ |
| 436 | 436 | .booke, |
| 437 | 437 | }), |
| 438 | 438 | }; |
| 439 | result[@intFromEnum(Feature.paired_vector_memops)] = .{ | |
| 439 | result[@backingInt(Feature.paired_vector_memops)] = .{ | |
| 440 | 440 | .llvm_name = "paired-vector-memops", |
| 441 | 441 | .description = "32Byte load and store instructions", |
| 442 | 442 | .dependencies = featureSet(&[_]Feature{ |
| 443 | 443 | .isa_v30_instructions, |
| 444 | 444 | }), |
| 445 | 445 | }; |
| 446 | result[@intFromEnum(Feature.partword_atomics)] = .{ | |
| 446 | result[@backingInt(Feature.partword_atomics)] = .{ | |
| 447 | 447 | .llvm_name = "partword-atomics", |
| 448 | 448 | .description = "Enable l[bh]arx and st[bh]cx.", |
| 449 | 449 | .dependencies = featureSet(&[_]Feature{}), |
| 450 | 450 | }; |
| 451 | result[@intFromEnum(Feature.pcrelative_memops)] = .{ | |
| 451 | result[@backingInt(Feature.pcrelative_memops)] = .{ | |
| 452 | 452 | .llvm_name = "pcrelative-memops", |
| 453 | 453 | .description = "Enable PC relative Memory Ops", |
| 454 | 454 | .dependencies = featureSet(&[_]Feature{ |
| 455 | 455 | .prefix_instrs, |
| 456 | 456 | }), |
| 457 | 457 | }; |
| 458 | result[@intFromEnum(Feature.popcntd)] = .{ | |
| 458 | result[@backingInt(Feature.popcntd)] = .{ | |
| 459 | 459 | .llvm_name = "popcntd", |
| 460 | 460 | .description = "Enable the popcnt[dw] instructions", |
| 461 | 461 | .dependencies = featureSet(&[_]Feature{}), |
| 462 | 462 | }; |
| 463 | result[@intFromEnum(Feature.power10_vector)] = .{ | |
| 463 | result[@backingInt(Feature.power10_vector)] = .{ | |
| 464 | 464 | .llvm_name = "power10-vector", |
| 465 | 465 | .description = "Enable POWER10 vector instructions", |
| 466 | 466 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -468,14 +468,14 @@ pub const all_features = blk: { |
| 468 | 468 | .power9_vector, |
| 469 | 469 | }), |
| 470 | 470 | }; |
| 471 | result[@intFromEnum(Feature.power8_altivec)] = .{ | |
| 471 | result[@backingInt(Feature.power8_altivec)] = .{ | |
| 472 | 472 | .llvm_name = "power8-altivec", |
| 473 | 473 | .description = "Enable POWER8 Altivec instructions", |
| 474 | 474 | .dependencies = featureSet(&[_]Feature{ |
| 475 | 475 | .altivec, |
| 476 | 476 | }), |
| 477 | 477 | }; |
| 478 | result[@intFromEnum(Feature.power8_vector)] = .{ | |
| 478 | result[@backingInt(Feature.power8_vector)] = .{ | |
| 479 | 479 | .llvm_name = "power8-vector", |
| 480 | 480 | .description = "Enable POWER8 vector instructions", |
| 481 | 481 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -483,7 +483,7 @@ pub const all_features = blk: { |
| 483 | 483 | .vsx, |
| 484 | 484 | }), |
| 485 | 485 | }; |
| 486 | result[@intFromEnum(Feature.power9_altivec)] = .{ | |
| 486 | result[@backingInt(Feature.power9_altivec)] = .{ | |
| 487 | 487 | .llvm_name = "power9-altivec", |
| 488 | 488 | .description = "Enable POWER9 Altivec instructions", |
| 489 | 489 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -491,7 +491,7 @@ pub const all_features = blk: { |
| 491 | 491 | .power8_altivec, |
| 492 | 492 | }), |
| 493 | 493 | }; |
| 494 | result[@intFromEnum(Feature.power9_vector)] = .{ | |
| 494 | result[@backingInt(Feature.power9_vector)] = .{ | |
| 495 | 495 | .llvm_name = "power9-vector", |
| 496 | 496 | .description = "Enable POWER9 vector instructions", |
| 497 | 497 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -499,93 +499,93 @@ pub const all_features = blk: { |
| 499 | 499 | .power9_altivec, |
| 500 | 500 | }), |
| 501 | 501 | }; |
| 502 | result[@intFromEnum(Feature.ppc4xx)] = .{ | |
| 502 | result[@backingInt(Feature.ppc4xx)] = .{ | |
| 503 | 503 | .llvm_name = "ppc4xx", |
| 504 | 504 | .description = "Enable PPC 4xx instructions", |
| 505 | 505 | .dependencies = featureSet(&[_]Feature{}), |
| 506 | 506 | }; |
| 507 | result[@intFromEnum(Feature.ppc6xx)] = .{ | |
| 507 | result[@backingInt(Feature.ppc6xx)] = .{ | |
| 508 | 508 | .llvm_name = "ppc6xx", |
| 509 | 509 | .description = "Enable PPC 6xx instructions", |
| 510 | 510 | .dependencies = featureSet(&[_]Feature{}), |
| 511 | 511 | }; |
| 512 | result[@intFromEnum(Feature.ppc_postra_sched)] = .{ | |
| 512 | result[@backingInt(Feature.ppc_postra_sched)] = .{ | |
| 513 | 513 | .llvm_name = "ppc-postra-sched", |
| 514 | 514 | .description = "Use PowerPC post-RA scheduling strategy", |
| 515 | 515 | .dependencies = featureSet(&[_]Feature{}), |
| 516 | 516 | }; |
| 517 | result[@intFromEnum(Feature.ppc_prera_sched)] = .{ | |
| 517 | result[@backingInt(Feature.ppc_prera_sched)] = .{ | |
| 518 | 518 | .llvm_name = "ppc-prera-sched", |
| 519 | 519 | .description = "Use PowerPC pre-RA scheduling strategy", |
| 520 | 520 | .dependencies = featureSet(&[_]Feature{}), |
| 521 | 521 | }; |
| 522 | result[@intFromEnum(Feature.predictable_select_expensive)] = .{ | |
| 522 | result[@backingInt(Feature.predictable_select_expensive)] = .{ | |
| 523 | 523 | .llvm_name = "predictable-select-expensive", |
| 524 | 524 | .description = "Prefer likely predicted branches over selects", |
| 525 | 525 | .dependencies = featureSet(&[_]Feature{}), |
| 526 | 526 | }; |
| 527 | result[@intFromEnum(Feature.prefix_instrs)] = .{ | |
| 527 | result[@backingInt(Feature.prefix_instrs)] = .{ | |
| 528 | 528 | .llvm_name = "prefix-instrs", |
| 529 | 529 | .description = "Enable prefixed instructions", |
| 530 | 530 | .dependencies = featureSet(&[_]Feature{ |
| 531 | 531 | .isa_v31_instructions, |
| 532 | 532 | }), |
| 533 | 533 | }; |
| 534 | result[@intFromEnum(Feature.privileged)] = .{ | |
| 534 | result[@backingInt(Feature.privileged)] = .{ | |
| 535 | 535 | .llvm_name = "privileged", |
| 536 | 536 | .description = "Add privileged instructions", |
| 537 | 537 | .dependencies = featureSet(&[_]Feature{}), |
| 538 | 538 | }; |
| 539 | result[@intFromEnum(Feature.quadword_atomics)] = .{ | |
| 539 | result[@backingInt(Feature.quadword_atomics)] = .{ | |
| 540 | 540 | .llvm_name = "quadword-atomics", |
| 541 | 541 | .description = "Enable lqarx and stqcx.", |
| 542 | 542 | .dependencies = featureSet(&[_]Feature{}), |
| 543 | 543 | }; |
| 544 | result[@intFromEnum(Feature.recipprec)] = .{ | |
| 544 | result[@backingInt(Feature.recipprec)] = .{ | |
| 545 | 545 | .llvm_name = "recipprec", |
| 546 | 546 | .description = "Assume higher precision reciprocal estimates", |
| 547 | 547 | .dependencies = featureSet(&[_]Feature{}), |
| 548 | 548 | }; |
| 549 | result[@intFromEnum(Feature.rop_protect)] = .{ | |
| 549 | result[@backingInt(Feature.rop_protect)] = .{ | |
| 550 | 550 | .llvm_name = "rop-protect", |
| 551 | 551 | .description = "Add ROP protect", |
| 552 | 552 | .dependencies = featureSet(&[_]Feature{}), |
| 553 | 553 | }; |
| 554 | result[@intFromEnum(Feature.secure_plt)] = .{ | |
| 554 | result[@backingInt(Feature.secure_plt)] = .{ | |
| 555 | 555 | .llvm_name = "secure-plt", |
| 556 | 556 | .description = "Enable secure plt mode", |
| 557 | 557 | .dependencies = featureSet(&[_]Feature{}), |
| 558 | 558 | }; |
| 559 | result[@intFromEnum(Feature.slow_popcntd)] = .{ | |
| 559 | result[@backingInt(Feature.slow_popcntd)] = .{ | |
| 560 | 560 | .llvm_name = "slow-popcntd", |
| 561 | 561 | .description = "Has slow popcnt[dw] instructions", |
| 562 | 562 | .dependencies = featureSet(&[_]Feature{}), |
| 563 | 563 | }; |
| 564 | result[@intFromEnum(Feature.spe)] = .{ | |
| 564 | result[@backingInt(Feature.spe)] = .{ | |
| 565 | 565 | .llvm_name = "spe", |
| 566 | 566 | .description = "Enable SPE instructions", |
| 567 | 567 | .dependencies = featureSet(&[_]Feature{ |
| 568 | 568 | .hard_float, |
| 569 | 569 | }), |
| 570 | 570 | }; |
| 571 | result[@intFromEnum(Feature.stfiwx)] = .{ | |
| 571 | result[@backingInt(Feature.stfiwx)] = .{ | |
| 572 | 572 | .llvm_name = "stfiwx", |
| 573 | 573 | .description = "Enable the stfiwx instruction", |
| 574 | 574 | .dependencies = featureSet(&[_]Feature{ |
| 575 | 575 | .fpu, |
| 576 | 576 | }), |
| 577 | 577 | }; |
| 578 | result[@intFromEnum(Feature.two_const_nr)] = .{ | |
| 578 | result[@backingInt(Feature.two_const_nr)] = .{ | |
| 579 | 579 | .llvm_name = "two-const-nr", |
| 580 | 580 | .description = "Requires two constant Newton-Raphson computation", |
| 581 | 581 | .dependencies = featureSet(&[_]Feature{}), |
| 582 | 582 | }; |
| 583 | result[@intFromEnum(Feature.vectors_use_two_units)] = .{ | |
| 583 | result[@backingInt(Feature.vectors_use_two_units)] = .{ | |
| 584 | 584 | .llvm_name = "vectors-use-two-units", |
| 585 | 585 | .description = "Vectors use two units", |
| 586 | 586 | .dependencies = featureSet(&[_]Feature{}), |
| 587 | 587 | }; |
| 588 | result[@intFromEnum(Feature.vsx)] = .{ | |
| 588 | result[@backingInt(Feature.vsx)] = .{ | |
| 589 | 589 | .llvm_name = "vsx", |
| 590 | 590 | .description = "Enable VSX instructions", |
| 591 | 591 | .dependencies = featureSet(&[_]Feature{ |
lib/std/Target/propeller.zig+1-1| ... | ... | @@ -17,7 +17,7 @@ pub const all_features = blk: { |
| 17 | 17 | const len = @typeInfo(Feature).@"enum".field_names.len; |
| 18 | 18 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); |
| 19 | 19 | var result: [len]CpuFeature = undefined; |
| 20 | result[@intFromEnum(Feature.p2)] = .{ | |
| 20 | result[@backingInt(Feature.p2)] = .{ | |
| 21 | 21 | .llvm_name = null, |
| 22 | 22 | .description = "Enable Propeller 2", |
| 23 | 23 | .dependencies = featureSet(&[_]Feature{}), |
lib/std/Target/riscv.zig+347-347| ... | ... | @@ -364,17 +364,17 @@ pub const all_features = blk: { |
| 364 | 364 | const len = @typeInfo(Feature).@"enum".field_names.len; |
| 365 | 365 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); |
| 366 | 366 | var result: [len]CpuFeature = undefined; |
| 367 | result[@intFromEnum(Feature.@"32bit")] = .{ | |
| 367 | result[@backingInt(Feature.@"32bit")] = .{ | |
| 368 | 368 | .llvm_name = "32bit", |
| 369 | 369 | .description = "Implements RV32", |
| 370 | 370 | .dependencies = featureSet(&[_]Feature{}), |
| 371 | 371 | }; |
| 372 | result[@intFromEnum(Feature.@"64bit")] = .{ | |
| 372 | result[@backingInt(Feature.@"64bit")] = .{ | |
| 373 | 373 | .llvm_name = "64bit", |
| 374 | 374 | .description = "Implements RV64", |
| 375 | 375 | .dependencies = featureSet(&[_]Feature{}), |
| 376 | 376 | }; |
| 377 | result[@intFromEnum(Feature.a)] = .{ | |
| 377 | result[@backingInt(Feature.a)] = .{ | |
| 378 | 378 | .llvm_name = "a", |
| 379 | 379 | .description = "'A' (Atomic Instructions)", |
| 380 | 380 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -382,32 +382,32 @@ pub const all_features = blk: { |
| 382 | 382 | .zalrsc, |
| 383 | 383 | }), |
| 384 | 384 | }; |
| 385 | result[@intFromEnum(Feature.add_load_fusion)] = .{ | |
| 385 | result[@backingInt(Feature.add_load_fusion)] = .{ | |
| 386 | 386 | .llvm_name = "add-load-fusion", |
| 387 | 387 | .description = "Enable ADD(.UW) + load macrofusion", |
| 388 | 388 | .dependencies = featureSet(&[_]Feature{}), |
| 389 | 389 | }; |
| 390 | result[@intFromEnum(Feature.addi_load_fusion)] = .{ | |
| 390 | result[@backingInt(Feature.addi_load_fusion)] = .{ | |
| 391 | 391 | .llvm_name = "addi-load-fusion", |
| 392 | 392 | .description = "Enable ADDI + load macrofusion", |
| 393 | 393 | .dependencies = featureSet(&[_]Feature{}), |
| 394 | 394 | }; |
| 395 | result[@intFromEnum(Feature.andes45)] = .{ | |
| 395 | result[@backingInt(Feature.andes45)] = .{ | |
| 396 | 396 | .llvm_name = "andes45", |
| 397 | 397 | .description = "Andes 45-Series processors", |
| 398 | 398 | .dependencies = featureSet(&[_]Feature{}), |
| 399 | 399 | }; |
| 400 | result[@intFromEnum(Feature.auipc_addi_fusion)] = .{ | |
| 400 | result[@backingInt(Feature.auipc_addi_fusion)] = .{ | |
| 401 | 401 | .llvm_name = "auipc-addi-fusion", |
| 402 | 402 | .description = "Enable AUIPC+ADDI macrofusion", |
| 403 | 403 | .dependencies = featureSet(&[_]Feature{}), |
| 404 | 404 | }; |
| 405 | result[@intFromEnum(Feature.auipc_load_fusion)] = .{ | |
| 405 | result[@backingInt(Feature.auipc_load_fusion)] = .{ | |
| 406 | 406 | .llvm_name = "auipc-load-fusion", |
| 407 | 407 | .description = "Enable AUIPC + load macrofusion", |
| 408 | 408 | .dependencies = featureSet(&[_]Feature{}), |
| 409 | 409 | }; |
| 410 | result[@intFromEnum(Feature.b)] = .{ | |
| 410 | result[@backingInt(Feature.b)] = .{ | |
| 411 | 411 | .llvm_name = "b", |
| 412 | 412 | .description = "'B' (the collection of the Zba, Zbb, Zbs extensions)", |
| 413 | 413 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -416,86 +416,86 @@ pub const all_features = blk: { |
| 416 | 416 | .zbs, |
| 417 | 417 | }), |
| 418 | 418 | }; |
| 419 | result[@intFromEnum(Feature.bfext_fusion)] = .{ | |
| 419 | result[@backingInt(Feature.bfext_fusion)] = .{ | |
| 420 | 420 | .llvm_name = "bfext-fusion", |
| 421 | 421 | .description = "Enable SLLI+SRLI (bitfield extract) macrofusion", |
| 422 | 422 | .dependencies = featureSet(&[_]Feature{}), |
| 423 | 423 | }; |
| 424 | result[@intFromEnum(Feature.c)] = .{ | |
| 424 | result[@backingInt(Feature.c)] = .{ | |
| 425 | 425 | .llvm_name = "c", |
| 426 | 426 | .description = "'C' (Compressed Instructions)", |
| 427 | 427 | .dependencies = featureSet(&[_]Feature{ |
| 428 | 428 | .zca, |
| 429 | 429 | }), |
| 430 | 430 | }; |
| 431 | result[@intFromEnum(Feature.conditional_cmv_fusion)] = .{ | |
| 431 | result[@backingInt(Feature.conditional_cmv_fusion)] = .{ | |
| 432 | 432 | .llvm_name = "conditional-cmv-fusion", |
| 433 | 433 | .description = "Enable branch+c.mv fusion", |
| 434 | 434 | .dependencies = featureSet(&[_]Feature{}), |
| 435 | 435 | }; |
| 436 | result[@intFromEnum(Feature.d)] = .{ | |
| 436 | result[@backingInt(Feature.d)] = .{ | |
| 437 | 437 | .llvm_name = "d", |
| 438 | 438 | .description = "'D' (Double-Precision Floating-Point)", |
| 439 | 439 | .dependencies = featureSet(&[_]Feature{ |
| 440 | 440 | .f, |
| 441 | 441 | }), |
| 442 | 442 | }; |
| 443 | result[@intFromEnum(Feature.disable_latency_sched_heuristic)] = .{ | |
| 443 | result[@backingInt(Feature.disable_latency_sched_heuristic)] = .{ | |
| 444 | 444 | .llvm_name = "disable-latency-sched-heuristic", |
| 445 | 445 | .description = "Disable latency scheduling heuristic", |
| 446 | 446 | .dependencies = featureSet(&[_]Feature{}), |
| 447 | 447 | }; |
| 448 | result[@intFromEnum(Feature.disable_misched_load_clustering)] = .{ | |
| 448 | result[@backingInt(Feature.disable_misched_load_clustering)] = .{ | |
| 449 | 449 | .llvm_name = "disable-misched-load-clustering", |
| 450 | 450 | .description = "Disable load clustering in the machine scheduler", |
| 451 | 451 | .dependencies = featureSet(&[_]Feature{}), |
| 452 | 452 | }; |
| 453 | result[@intFromEnum(Feature.disable_misched_store_clustering)] = .{ | |
| 453 | result[@backingInt(Feature.disable_misched_store_clustering)] = .{ | |
| 454 | 454 | .llvm_name = "disable-misched-store-clustering", |
| 455 | 455 | .description = "Disable store clustering in the machine scheduler", |
| 456 | 456 | .dependencies = featureSet(&[_]Feature{}), |
| 457 | 457 | }; |
| 458 | result[@intFromEnum(Feature.disable_postmisched_load_clustering)] = .{ | |
| 458 | result[@backingInt(Feature.disable_postmisched_load_clustering)] = .{ | |
| 459 | 459 | .llvm_name = "disable-postmisched-load-clustering", |
| 460 | 460 | .description = "Disable PostRA load clustering in the machine scheduler", |
| 461 | 461 | .dependencies = featureSet(&[_]Feature{}), |
| 462 | 462 | }; |
| 463 | result[@intFromEnum(Feature.disable_postmisched_store_clustering)] = .{ | |
| 463 | result[@backingInt(Feature.disable_postmisched_store_clustering)] = .{ | |
| 464 | 464 | .llvm_name = "disable-postmisched-store-clustering", |
| 465 | 465 | .description = "Disable PostRA store clustering in the machine scheduler", |
| 466 | 466 | .dependencies = featureSet(&[_]Feature{}), |
| 467 | 467 | }; |
| 468 | result[@intFromEnum(Feature.dlen_factor_2)] = .{ | |
| 468 | result[@backingInt(Feature.dlen_factor_2)] = .{ | |
| 469 | 469 | .llvm_name = "dlen-factor-2", |
| 470 | 470 | .description = "Vector unit DLEN(data path width) is half of VLEN", |
| 471 | 471 | .dependencies = featureSet(&[_]Feature{}), |
| 472 | 472 | }; |
| 473 | result[@intFromEnum(Feature.e)] = .{ | |
| 473 | result[@backingInt(Feature.e)] = .{ | |
| 474 | 474 | .llvm_name = "e", |
| 475 | 475 | .description = "'E' (Embedded Instruction Set with 16 GPRs)", |
| 476 | 476 | .dependencies = featureSet(&[_]Feature{}), |
| 477 | 477 | }; |
| 478 | result[@intFromEnum(Feature.enable_vsetvli_sched_heuristic)] = .{ | |
| 478 | result[@backingInt(Feature.enable_vsetvli_sched_heuristic)] = .{ | |
| 479 | 479 | .llvm_name = "enable-vsetvli-sched-heuristic", |
| 480 | 480 | .description = "Enable vsetvli-based scheduling heuristic", |
| 481 | 481 | .dependencies = featureSet(&[_]Feature{}), |
| 482 | 482 | }; |
| 483 | result[@intFromEnum(Feature.exact_asm)] = .{ | |
| 483 | result[@backingInt(Feature.exact_asm)] = .{ | |
| 484 | 484 | .llvm_name = "exact-asm", |
| 485 | 485 | .description = "Enable Exact Assembly (Disables Compression and Relaxation)", |
| 486 | 486 | .dependencies = featureSet(&[_]Feature{}), |
| 487 | 487 | }; |
| 488 | result[@intFromEnum(Feature.experimental)] = .{ | |
| 488 | result[@backingInt(Feature.experimental)] = .{ | |
| 489 | 489 | .llvm_name = "experimental", |
| 490 | 490 | .description = "Experimental intrinsics", |
| 491 | 491 | .dependencies = featureSet(&[_]Feature{}), |
| 492 | 492 | }; |
| 493 | result[@intFromEnum(Feature.experimental_p)] = .{ | |
| 493 | result[@backingInt(Feature.experimental_p)] = .{ | |
| 494 | 494 | .llvm_name = "experimental-p", |
| 495 | 495 | .description = "'P' ('Base P' (Packed SIMD))", |
| 496 | 496 | .dependencies = featureSet(&[_]Feature{}), |
| 497 | 497 | }; |
| 498 | result[@intFromEnum(Feature.experimental_rvm23u32)] = .{ | |
| 498 | result[@backingInt(Feature.experimental_rvm23u32)] = .{ | |
| 499 | 499 | .llvm_name = "experimental-rvm23u32", |
| 500 | 500 | .description = "RISC-V experimental-rvm23u32 profile", |
| 501 | 501 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -512,49 +512,49 @@ pub const all_features = blk: { |
| 512 | 512 | .zimop, |
| 513 | 513 | }), |
| 514 | 514 | }; |
| 515 | result[@intFromEnum(Feature.experimental_smpmpmt)] = .{ | |
| 515 | result[@backingInt(Feature.experimental_smpmpmt)] = .{ | |
| 516 | 516 | .llvm_name = "experimental-smpmpmt", |
| 517 | 517 | .description = "'Smpmpmt' (PMP-based Memory Types Extension)", |
| 518 | 518 | .dependencies = featureSet(&[_]Feature{}), |
| 519 | 519 | }; |
| 520 | result[@intFromEnum(Feature.experimental_svukte)] = .{ | |
| 520 | result[@backingInt(Feature.experimental_svukte)] = .{ | |
| 521 | 521 | .llvm_name = "experimental-svukte", |
| 522 | 522 | .description = "'Svukte' (Address-Independent Latency of User-Mode Faults to Supervisor Addresses)", |
| 523 | 523 | .dependencies = featureSet(&[_]Feature{}), |
| 524 | 524 | }; |
| 525 | result[@intFromEnum(Feature.experimental_xrivosvisni)] = .{ | |
| 525 | result[@backingInt(Feature.experimental_xrivosvisni)] = .{ | |
| 526 | 526 | .llvm_name = "experimental-xrivosvisni", |
| 527 | 527 | .description = "'XRivosVisni' (Rivos Vector Integer Small New)", |
| 528 | 528 | .dependencies = featureSet(&[_]Feature{}), |
| 529 | 529 | }; |
| 530 | result[@intFromEnum(Feature.experimental_xrivosvizip)] = .{ | |
| 530 | result[@backingInt(Feature.experimental_xrivosvizip)] = .{ | |
| 531 | 531 | .llvm_name = "experimental-xrivosvizip", |
| 532 | 532 | .description = "'XRivosVizip' (Rivos Vector Register Zips)", |
| 533 | 533 | .dependencies = featureSet(&[_]Feature{}), |
| 534 | 534 | }; |
| 535 | result[@intFromEnum(Feature.experimental_xsfmclic)] = .{ | |
| 535 | result[@backingInt(Feature.experimental_xsfmclic)] = .{ | |
| 536 | 536 | .llvm_name = "experimental-xsfmclic", |
| 537 | 537 | .description = "'XSfmclic' (SiFive CLIC Machine-mode CSRs)", |
| 538 | 538 | .dependencies = featureSet(&[_]Feature{}), |
| 539 | 539 | }; |
| 540 | result[@intFromEnum(Feature.experimental_xsfsclic)] = .{ | |
| 540 | result[@backingInt(Feature.experimental_xsfsclic)] = .{ | |
| 541 | 541 | .llvm_name = "experimental-xsfsclic", |
| 542 | 542 | .description = "'XSfsclic' (SiFive CLIC Supervisor-mode CSRs)", |
| 543 | 543 | .dependencies = featureSet(&[_]Feature{}), |
| 544 | 544 | }; |
| 545 | result[@intFromEnum(Feature.experimental_zibi)] = .{ | |
| 545 | result[@backingInt(Feature.experimental_zibi)] = .{ | |
| 546 | 546 | .llvm_name = "experimental-zibi", |
| 547 | 547 | .description = "'Zibi' (Branch with Immediate)", |
| 548 | 548 | .dependencies = featureSet(&[_]Feature{}), |
| 549 | 549 | }; |
| 550 | result[@intFromEnum(Feature.experimental_zicfilp)] = .{ | |
| 550 | result[@backingInt(Feature.experimental_zicfilp)] = .{ | |
| 551 | 551 | .llvm_name = "experimental-zicfilp", |
| 552 | 552 | .description = "'Zicfilp' (Landing pad)", |
| 553 | 553 | .dependencies = featureSet(&[_]Feature{ |
| 554 | 554 | .zicsr, |
| 555 | 555 | }), |
| 556 | 556 | }; |
| 557 | result[@intFromEnum(Feature.experimental_zicfiss)] = .{ | |
| 557 | result[@backingInt(Feature.experimental_zicfiss)] = .{ | |
| 558 | 558 | .llvm_name = "experimental-zicfiss", |
| 559 | 559 | .description = "'Zicfiss' (Shadow stack)", |
| 560 | 560 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -562,14 +562,14 @@ pub const all_features = blk: { |
| 562 | 562 | .zimop, |
| 563 | 563 | }), |
| 564 | 564 | }; |
| 565 | result[@intFromEnum(Feature.experimental_zvbc32e)] = .{ | |
| 565 | result[@backingInt(Feature.experimental_zvbc32e)] = .{ | |
| 566 | 566 | .llvm_name = "experimental-zvbc32e", |
| 567 | 567 | .description = "'Zvbc32e' (Vector Carryless Multiplication with 32-bits elements)", |
| 568 | 568 | .dependencies = featureSet(&[_]Feature{ |
| 569 | 569 | .zve32x, |
| 570 | 570 | }), |
| 571 | 571 | }; |
| 572 | result[@intFromEnum(Feature.experimental_zvfbfa)] = .{ | |
| 572 | result[@backingInt(Feature.experimental_zvfbfa)] = .{ | |
| 573 | 573 | .llvm_name = "experimental-zvfbfa", |
| 574 | 574 | .description = "'Zvfbfa' (Additional BF16 vector compute support)", |
| 575 | 575 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -577,324 +577,324 @@ pub const all_features = blk: { |
| 577 | 577 | .zve32f, |
| 578 | 578 | }), |
| 579 | 579 | }; |
| 580 | result[@intFromEnum(Feature.experimental_zvfofp8min)] = .{ | |
| 580 | result[@backingInt(Feature.experimental_zvfofp8min)] = .{ | |
| 581 | 581 | .llvm_name = "experimental-zvfofp8min", |
| 582 | 582 | .description = "'Zvfofp8min' (Vector OFP8 Converts)", |
| 583 | 583 | .dependencies = featureSet(&[_]Feature{ |
| 584 | 584 | .zve32f, |
| 585 | 585 | }), |
| 586 | 586 | }; |
| 587 | result[@intFromEnum(Feature.experimental_zvkgs)] = .{ | |
| 587 | result[@backingInt(Feature.experimental_zvkgs)] = .{ | |
| 588 | 588 | .llvm_name = "experimental-zvkgs", |
| 589 | 589 | .description = "'Zvkgs' (Vector-Scalar GCM instructions for Cryptography)", |
| 590 | 590 | .dependencies = featureSet(&[_]Feature{ |
| 591 | 591 | .zvkg, |
| 592 | 592 | }), |
| 593 | 593 | }; |
| 594 | result[@intFromEnum(Feature.experimental_zvqdotq)] = .{ | |
| 594 | result[@backingInt(Feature.experimental_zvqdotq)] = .{ | |
| 595 | 595 | .llvm_name = "experimental-zvqdotq", |
| 596 | 596 | .description = "'Zvqdotq' (Vector quad widening 4D Dot Product)", |
| 597 | 597 | .dependencies = featureSet(&[_]Feature{ |
| 598 | 598 | .zve32x, |
| 599 | 599 | }), |
| 600 | 600 | }; |
| 601 | result[@intFromEnum(Feature.f)] = .{ | |
| 601 | result[@backingInt(Feature.f)] = .{ | |
| 602 | 602 | .llvm_name = "f", |
| 603 | 603 | .description = "'F' (Single-Precision Floating-Point)", |
| 604 | 604 | .dependencies = featureSet(&[_]Feature{ |
| 605 | 605 | .zicsr, |
| 606 | 606 | }), |
| 607 | 607 | }; |
| 608 | result[@intFromEnum(Feature.forced_atomics)] = .{ | |
| 608 | result[@backingInt(Feature.forced_atomics)] = .{ | |
| 609 | 609 | .llvm_name = "forced-atomics", |
| 610 | 610 | .description = "Assume that lock-free native-width atomics are available", |
| 611 | 611 | .dependencies = featureSet(&[_]Feature{}), |
| 612 | 612 | }; |
| 613 | result[@intFromEnum(Feature.h)] = .{ | |
| 613 | result[@backingInt(Feature.h)] = .{ | |
| 614 | 614 | .llvm_name = "h", |
| 615 | 615 | .description = "'H' (Hypervisor)", |
| 616 | 616 | .dependencies = featureSet(&[_]Feature{}), |
| 617 | 617 | }; |
| 618 | result[@intFromEnum(Feature.i)] = .{ | |
| 618 | result[@backingInt(Feature.i)] = .{ | |
| 619 | 619 | .llvm_name = "i", |
| 620 | 620 | .description = "'I' (Base Integer Instruction Set)", |
| 621 | 621 | .dependencies = featureSet(&[_]Feature{}), |
| 622 | 622 | }; |
| 623 | result[@intFromEnum(Feature.ld_add_fusion)] = .{ | |
| 623 | result[@backingInt(Feature.ld_add_fusion)] = .{ | |
| 624 | 624 | .llvm_name = "ld-add-fusion", |
| 625 | 625 | .description = "Enable LD+ADD macrofusion", |
| 626 | 626 | .dependencies = featureSet(&[_]Feature{}), |
| 627 | 627 | }; |
| 628 | result[@intFromEnum(Feature.log_vrgather)] = .{ | |
| 628 | result[@backingInt(Feature.log_vrgather)] = .{ | |
| 629 | 629 | .llvm_name = "log-vrgather", |
| 630 | 630 | .description = "Has vrgather.vv with LMUL*log2(LMUL) latency", |
| 631 | 631 | .dependencies = featureSet(&[_]Feature{}), |
| 632 | 632 | }; |
| 633 | result[@intFromEnum(Feature.lui_addi_fusion)] = .{ | |
| 633 | result[@backingInt(Feature.lui_addi_fusion)] = .{ | |
| 634 | 634 | .llvm_name = "lui-addi-fusion", |
| 635 | 635 | .description = "Enable LUI+ADDI macro fusion", |
| 636 | 636 | .dependencies = featureSet(&[_]Feature{}), |
| 637 | 637 | }; |
| 638 | result[@intFromEnum(Feature.lui_load_fusion)] = .{ | |
| 638 | result[@backingInt(Feature.lui_load_fusion)] = .{ | |
| 639 | 639 | .llvm_name = "lui-load-fusion", |
| 640 | 640 | .description = "Enable LUI + load macrofusion", |
| 641 | 641 | .dependencies = featureSet(&[_]Feature{}), |
| 642 | 642 | }; |
| 643 | result[@intFromEnum(Feature.m)] = .{ | |
| 643 | result[@backingInt(Feature.m)] = .{ | |
| 644 | 644 | .llvm_name = "m", |
| 645 | 645 | .description = "'M' (Integer Multiplication and Division)", |
| 646 | 646 | .dependencies = featureSet(&[_]Feature{ |
| 647 | 647 | .zmmul, |
| 648 | 648 | }), |
| 649 | 649 | }; |
| 650 | result[@intFromEnum(Feature.mips_p8700)] = .{ | |
| 650 | result[@backingInt(Feature.mips_p8700)] = .{ | |
| 651 | 651 | .llvm_name = "mips-p8700", |
| 652 | 652 | .description = "MIPS p8700 processor", |
| 653 | 653 | .dependencies = featureSet(&[_]Feature{}), |
| 654 | 654 | }; |
| 655 | result[@intFromEnum(Feature.no_default_unroll)] = .{ | |
| 655 | result[@backingInt(Feature.no_default_unroll)] = .{ | |
| 656 | 656 | .llvm_name = "no-default-unroll", |
| 657 | 657 | .description = "Disable default unroll preference.", |
| 658 | 658 | .dependencies = featureSet(&[_]Feature{}), |
| 659 | 659 | }; |
| 660 | result[@intFromEnum(Feature.no_sink_splat_operands)] = .{ | |
| 660 | result[@backingInt(Feature.no_sink_splat_operands)] = .{ | |
| 661 | 661 | .llvm_name = "no-sink-splat-operands", |
| 662 | 662 | .description = "Disable sink splat operands to enable .vx, .vf,.wx, and .wf instructions", |
| 663 | 663 | .dependencies = featureSet(&[_]Feature{}), |
| 664 | 664 | }; |
| 665 | result[@intFromEnum(Feature.no_trailing_seq_cst_fence)] = .{ | |
| 665 | result[@backingInt(Feature.no_trailing_seq_cst_fence)] = .{ | |
| 666 | 666 | .llvm_name = "no-trailing-seq-cst-fence", |
| 667 | 667 | .description = "Disable trailing fence for seq-cst store.", |
| 668 | 668 | .dependencies = featureSet(&[_]Feature{}), |
| 669 | 669 | }; |
| 670 | result[@intFromEnum(Feature.optimized_nf2_segment_load_store)] = .{ | |
| 670 | result[@backingInt(Feature.optimized_nf2_segment_load_store)] = .{ | |
| 671 | 671 | .llvm_name = "optimized-nf2-segment-load-store", |
| 672 | 672 | .description = "vlseg2eN.v and vsseg2eN.v are implemented as a wide memory op and shuffle", |
| 673 | 673 | .dependencies = featureSet(&[_]Feature{}), |
| 674 | 674 | }; |
| 675 | result[@intFromEnum(Feature.optimized_nf3_segment_load_store)] = .{ | |
| 675 | result[@backingInt(Feature.optimized_nf3_segment_load_store)] = .{ | |
| 676 | 676 | .llvm_name = "optimized-nf3-segment-load-store", |
| 677 | 677 | .description = "vlseg3eN.v and vsseg3eN.v are implemented as a wide memory op and shuffle", |
| 678 | 678 | .dependencies = featureSet(&[_]Feature{}), |
| 679 | 679 | }; |
| 680 | result[@intFromEnum(Feature.optimized_nf4_segment_load_store)] = .{ | |
| 680 | result[@backingInt(Feature.optimized_nf4_segment_load_store)] = .{ | |
| 681 | 681 | .llvm_name = "optimized-nf4-segment-load-store", |
| 682 | 682 | .description = "vlseg4eN.v and vsseg4eN.v are implemented as a wide memory op and shuffle", |
| 683 | 683 | .dependencies = featureSet(&[_]Feature{}), |
| 684 | 684 | }; |
| 685 | result[@intFromEnum(Feature.optimized_nf5_segment_load_store)] = .{ | |
| 685 | result[@backingInt(Feature.optimized_nf5_segment_load_store)] = .{ | |
| 686 | 686 | .llvm_name = "optimized-nf5-segment-load-store", |
| 687 | 687 | .description = "vlseg5eN.v and vsseg5eN.v are implemented as a wide memory op and shuffle", |
| 688 | 688 | .dependencies = featureSet(&[_]Feature{}), |
| 689 | 689 | }; |
| 690 | result[@intFromEnum(Feature.optimized_nf6_segment_load_store)] = .{ | |
| 690 | result[@backingInt(Feature.optimized_nf6_segment_load_store)] = .{ | |
| 691 | 691 | .llvm_name = "optimized-nf6-segment-load-store", |
| 692 | 692 | .description = "vlseg6eN.v and vsseg6eN.v are implemented as a wide memory op and shuffle", |
| 693 | 693 | .dependencies = featureSet(&[_]Feature{}), |
| 694 | 694 | }; |
| 695 | result[@intFromEnum(Feature.optimized_nf7_segment_load_store)] = .{ | |
| 695 | result[@backingInt(Feature.optimized_nf7_segment_load_store)] = .{ | |
| 696 | 696 | .llvm_name = "optimized-nf7-segment-load-store", |
| 697 | 697 | .description = "vlseg7eN.v and vsseg7eN.v are implemented as a wide memory op and shuffle", |
| 698 | 698 | .dependencies = featureSet(&[_]Feature{}), |
| 699 | 699 | }; |
| 700 | result[@intFromEnum(Feature.optimized_nf8_segment_load_store)] = .{ | |
| 700 | result[@backingInt(Feature.optimized_nf8_segment_load_store)] = .{ | |
| 701 | 701 | .llvm_name = "optimized-nf8-segment-load-store", |
| 702 | 702 | .description = "vlseg8eN.v and vsseg8eN.v are implemented as a wide memory op and shuffle", |
| 703 | 703 | .dependencies = featureSet(&[_]Feature{}), |
| 704 | 704 | }; |
| 705 | result[@intFromEnum(Feature.optimized_zero_stride_load)] = .{ | |
| 705 | result[@backingInt(Feature.optimized_zero_stride_load)] = .{ | |
| 706 | 706 | .llvm_name = "optimized-zero-stride-load", |
| 707 | 707 | .description = "Optimized (perform fewer memory operations)zero-stride vector load", |
| 708 | 708 | .dependencies = featureSet(&[_]Feature{}), |
| 709 | 709 | }; |
| 710 | result[@intFromEnum(Feature.permissive_zalrsc)] = .{ | |
| 710 | result[@backingInt(Feature.permissive_zalrsc)] = .{ | |
| 711 | 711 | .llvm_name = "permissive-zalrsc", |
| 712 | 712 | .description = "Implementation permits non-base instructions between LR/SC pairs", |
| 713 | 713 | .dependencies = featureSet(&[_]Feature{}), |
| 714 | 714 | }; |
| 715 | result[@intFromEnum(Feature.predictable_select_expensive)] = .{ | |
| 715 | result[@backingInt(Feature.predictable_select_expensive)] = .{ | |
| 716 | 716 | .llvm_name = "predictable-select-expensive", |
| 717 | 717 | .description = "Prefer likely predicted branches over selects", |
| 718 | 718 | .dependencies = featureSet(&[_]Feature{}), |
| 719 | 719 | }; |
| 720 | result[@intFromEnum(Feature.prefer_vsetvli_over_read_vlenb)] = .{ | |
| 720 | result[@backingInt(Feature.prefer_vsetvli_over_read_vlenb)] = .{ | |
| 721 | 721 | .llvm_name = "prefer-vsetvli-over-read-vlenb", |
| 722 | 722 | .description = "Prefer vsetvli over read vlenb CSR to calculate VLEN", |
| 723 | 723 | .dependencies = featureSet(&[_]Feature{}), |
| 724 | 724 | }; |
| 725 | result[@intFromEnum(Feature.prefer_w_inst)] = .{ | |
| 725 | result[@backingInt(Feature.prefer_w_inst)] = .{ | |
| 726 | 726 | .llvm_name = "prefer-w-inst", |
| 727 | 727 | .description = "Prefer instructions with W suffix", |
| 728 | 728 | .dependencies = featureSet(&[_]Feature{}), |
| 729 | 729 | }; |
| 730 | result[@intFromEnum(Feature.q)] = .{ | |
| 730 | result[@backingInt(Feature.q)] = .{ | |
| 731 | 731 | .llvm_name = "q", |
| 732 | 732 | .description = "'Q' (Quad-Precision Floating-Point)", |
| 733 | 733 | .dependencies = featureSet(&[_]Feature{ |
| 734 | 734 | .d, |
| 735 | 735 | }), |
| 736 | 736 | }; |
| 737 | result[@intFromEnum(Feature.relax)] = .{ | |
| 737 | result[@backingInt(Feature.relax)] = .{ | |
| 738 | 738 | .llvm_name = "relax", |
| 739 | 739 | .description = "Enable Linker relaxation.", |
| 740 | 740 | .dependencies = featureSet(&[_]Feature{}), |
| 741 | 741 | }; |
| 742 | result[@intFromEnum(Feature.reserve_x1)] = .{ | |
| 742 | result[@backingInt(Feature.reserve_x1)] = .{ | |
| 743 | 743 | .llvm_name = "reserve-x1", |
| 744 | 744 | .description = "Reserve X1", |
| 745 | 745 | .dependencies = featureSet(&[_]Feature{}), |
| 746 | 746 | }; |
| 747 | result[@intFromEnum(Feature.reserve_x10)] = .{ | |
| 747 | result[@backingInt(Feature.reserve_x10)] = .{ | |
| 748 | 748 | .llvm_name = "reserve-x10", |
| 749 | 749 | .description = "Reserve X10", |
| 750 | 750 | .dependencies = featureSet(&[_]Feature{}), |
| 751 | 751 | }; |
| 752 | result[@intFromEnum(Feature.reserve_x11)] = .{ | |
| 752 | result[@backingInt(Feature.reserve_x11)] = .{ | |
| 753 | 753 | .llvm_name = "reserve-x11", |
| 754 | 754 | .description = "Reserve X11", |
| 755 | 755 | .dependencies = featureSet(&[_]Feature{}), |
| 756 | 756 | }; |
| 757 | result[@intFromEnum(Feature.reserve_x12)] = .{ | |
| 757 | result[@backingInt(Feature.reserve_x12)] = .{ | |
| 758 | 758 | .llvm_name = "reserve-x12", |
| 759 | 759 | .description = "Reserve X12", |
| 760 | 760 | .dependencies = featureSet(&[_]Feature{}), |
| 761 | 761 | }; |
| 762 | result[@intFromEnum(Feature.reserve_x13)] = .{ | |
| 762 | result[@backingInt(Feature.reserve_x13)] = .{ | |
| 763 | 763 | .llvm_name = "reserve-x13", |
| 764 | 764 | .description = "Reserve X13", |
| 765 | 765 | .dependencies = featureSet(&[_]Feature{}), |
| 766 | 766 | }; |
| 767 | result[@intFromEnum(Feature.reserve_x14)] = .{ | |
| 767 | result[@backingInt(Feature.reserve_x14)] = .{ | |
| 768 | 768 | .llvm_name = "reserve-x14", |
| 769 | 769 | .description = "Reserve X14", |
| 770 | 770 | .dependencies = featureSet(&[_]Feature{}), |
| 771 | 771 | }; |
| 772 | result[@intFromEnum(Feature.reserve_x15)] = .{ | |
| 772 | result[@backingInt(Feature.reserve_x15)] = .{ | |
| 773 | 773 | .llvm_name = "reserve-x15", |
| 774 | 774 | .description = "Reserve X15", |
| 775 | 775 | .dependencies = featureSet(&[_]Feature{}), |
| 776 | 776 | }; |
| 777 | result[@intFromEnum(Feature.reserve_x16)] = .{ | |
| 777 | result[@backingInt(Feature.reserve_x16)] = .{ | |
| 778 | 778 | .llvm_name = "reserve-x16", |
| 779 | 779 | .description = "Reserve X16", |
| 780 | 780 | .dependencies = featureSet(&[_]Feature{}), |
| 781 | 781 | }; |
| 782 | result[@intFromEnum(Feature.reserve_x17)] = .{ | |
| 782 | result[@backingInt(Feature.reserve_x17)] = .{ | |
| 783 | 783 | .llvm_name = "reserve-x17", |
| 784 | 784 | .description = "Reserve X17", |
| 785 | 785 | .dependencies = featureSet(&[_]Feature{}), |
| 786 | 786 | }; |
| 787 | result[@intFromEnum(Feature.reserve_x18)] = .{ | |
| 787 | result[@backingInt(Feature.reserve_x18)] = .{ | |
| 788 | 788 | .llvm_name = "reserve-x18", |
| 789 | 789 | .description = "Reserve X18", |
| 790 | 790 | .dependencies = featureSet(&[_]Feature{}), |
| 791 | 791 | }; |
| 792 | result[@intFromEnum(Feature.reserve_x19)] = .{ | |
| 792 | result[@backingInt(Feature.reserve_x19)] = .{ | |
| 793 | 793 | .llvm_name = "reserve-x19", |
| 794 | 794 | .description = "Reserve X19", |
| 795 | 795 | .dependencies = featureSet(&[_]Feature{}), |
| 796 | 796 | }; |
| 797 | result[@intFromEnum(Feature.reserve_x2)] = .{ | |
| 797 | result[@backingInt(Feature.reserve_x2)] = .{ | |
| 798 | 798 | .llvm_name = "reserve-x2", |
| 799 | 799 | .description = "Reserve X2", |
| 800 | 800 | .dependencies = featureSet(&[_]Feature{}), |
| 801 | 801 | }; |
| 802 | result[@intFromEnum(Feature.reserve_x20)] = .{ | |
| 802 | result[@backingInt(Feature.reserve_x20)] = .{ | |
| 803 | 803 | .llvm_name = "reserve-x20", |
| 804 | 804 | .description = "Reserve X20", |
| 805 | 805 | .dependencies = featureSet(&[_]Feature{}), |
| 806 | 806 | }; |
| 807 | result[@intFromEnum(Feature.reserve_x21)] = .{ | |
| 807 | result[@backingInt(Feature.reserve_x21)] = .{ | |
| 808 | 808 | .llvm_name = "reserve-x21", |
| 809 | 809 | .description = "Reserve X21", |
| 810 | 810 | .dependencies = featureSet(&[_]Feature{}), |
| 811 | 811 | }; |
| 812 | result[@intFromEnum(Feature.reserve_x22)] = .{ | |
| 812 | result[@backingInt(Feature.reserve_x22)] = .{ | |
| 813 | 813 | .llvm_name = "reserve-x22", |
| 814 | 814 | .description = "Reserve X22", |
| 815 | 815 | .dependencies = featureSet(&[_]Feature{}), |
| 816 | 816 | }; |
| 817 | result[@intFromEnum(Feature.reserve_x23)] = .{ | |
| 817 | result[@backingInt(Feature.reserve_x23)] = .{ | |
| 818 | 818 | .llvm_name = "reserve-x23", |
| 819 | 819 | .description = "Reserve X23", |
| 820 | 820 | .dependencies = featureSet(&[_]Feature{}), |
| 821 | 821 | }; |
| 822 | result[@intFromEnum(Feature.reserve_x24)] = .{ | |
| 822 | result[@backingInt(Feature.reserve_x24)] = .{ | |
| 823 | 823 | .llvm_name = "reserve-x24", |
| 824 | 824 | .description = "Reserve X24", |
| 825 | 825 | .dependencies = featureSet(&[_]Feature{}), |
| 826 | 826 | }; |
| 827 | result[@intFromEnum(Feature.reserve_x25)] = .{ | |
| 827 | result[@backingInt(Feature.reserve_x25)] = .{ | |
| 828 | 828 | .llvm_name = "reserve-x25", |
| 829 | 829 | .description = "Reserve X25", |
| 830 | 830 | .dependencies = featureSet(&[_]Feature{}), |
| 831 | 831 | }; |
| 832 | result[@intFromEnum(Feature.reserve_x26)] = .{ | |
| 832 | result[@backingInt(Feature.reserve_x26)] = .{ | |
| 833 | 833 | .llvm_name = "reserve-x26", |
| 834 | 834 | .description = "Reserve X26", |
| 835 | 835 | .dependencies = featureSet(&[_]Feature{}), |
| 836 | 836 | }; |
| 837 | result[@intFromEnum(Feature.reserve_x27)] = .{ | |
| 837 | result[@backingInt(Feature.reserve_x27)] = .{ | |
| 838 | 838 | .llvm_name = "reserve-x27", |
| 839 | 839 | .description = "Reserve X27", |
| 840 | 840 | .dependencies = featureSet(&[_]Feature{}), |
| 841 | 841 | }; |
| 842 | result[@intFromEnum(Feature.reserve_x28)] = .{ | |
| 842 | result[@backingInt(Feature.reserve_x28)] = .{ | |
| 843 | 843 | .llvm_name = "reserve-x28", |
| 844 | 844 | .description = "Reserve X28", |
| 845 | 845 | .dependencies = featureSet(&[_]Feature{}), |
| 846 | 846 | }; |
| 847 | result[@intFromEnum(Feature.reserve_x29)] = .{ | |
| 847 | result[@backingInt(Feature.reserve_x29)] = .{ | |
| 848 | 848 | .llvm_name = "reserve-x29", |
| 849 | 849 | .description = "Reserve X29", |
| 850 | 850 | .dependencies = featureSet(&[_]Feature{}), |
| 851 | 851 | }; |
| 852 | result[@intFromEnum(Feature.reserve_x3)] = .{ | |
| 852 | result[@backingInt(Feature.reserve_x3)] = .{ | |
| 853 | 853 | .llvm_name = "reserve-x3", |
| 854 | 854 | .description = "Reserve X3", |
| 855 | 855 | .dependencies = featureSet(&[_]Feature{}), |
| 856 | 856 | }; |
| 857 | result[@intFromEnum(Feature.reserve_x30)] = .{ | |
| 857 | result[@backingInt(Feature.reserve_x30)] = .{ | |
| 858 | 858 | .llvm_name = "reserve-x30", |
| 859 | 859 | .description = "Reserve X30", |
| 860 | 860 | .dependencies = featureSet(&[_]Feature{}), |
| 861 | 861 | }; |
| 862 | result[@intFromEnum(Feature.reserve_x31)] = .{ | |
| 862 | result[@backingInt(Feature.reserve_x31)] = .{ | |
| 863 | 863 | .llvm_name = "reserve-x31", |
| 864 | 864 | .description = "Reserve X31", |
| 865 | 865 | .dependencies = featureSet(&[_]Feature{}), |
| 866 | 866 | }; |
| 867 | result[@intFromEnum(Feature.reserve_x4)] = .{ | |
| 867 | result[@backingInt(Feature.reserve_x4)] = .{ | |
| 868 | 868 | .llvm_name = "reserve-x4", |
| 869 | 869 | .description = "Reserve X4", |
| 870 | 870 | .dependencies = featureSet(&[_]Feature{}), |
| 871 | 871 | }; |
| 872 | result[@intFromEnum(Feature.reserve_x5)] = .{ | |
| 872 | result[@backingInt(Feature.reserve_x5)] = .{ | |
| 873 | 873 | .llvm_name = "reserve-x5", |
| 874 | 874 | .description = "Reserve X5", |
| 875 | 875 | .dependencies = featureSet(&[_]Feature{}), |
| 876 | 876 | }; |
| 877 | result[@intFromEnum(Feature.reserve_x6)] = .{ | |
| 877 | result[@backingInt(Feature.reserve_x6)] = .{ | |
| 878 | 878 | .llvm_name = "reserve-x6", |
| 879 | 879 | .description = "Reserve X6", |
| 880 | 880 | .dependencies = featureSet(&[_]Feature{}), |
| 881 | 881 | }; |
| 882 | result[@intFromEnum(Feature.reserve_x7)] = .{ | |
| 882 | result[@backingInt(Feature.reserve_x7)] = .{ | |
| 883 | 883 | .llvm_name = "reserve-x7", |
| 884 | 884 | .description = "Reserve X7", |
| 885 | 885 | .dependencies = featureSet(&[_]Feature{}), |
| 886 | 886 | }; |
| 887 | result[@intFromEnum(Feature.reserve_x8)] = .{ | |
| 887 | result[@backingInt(Feature.reserve_x8)] = .{ | |
| 888 | 888 | .llvm_name = "reserve-x8", |
| 889 | 889 | .description = "Reserve X8", |
| 890 | 890 | .dependencies = featureSet(&[_]Feature{}), |
| 891 | 891 | }; |
| 892 | result[@intFromEnum(Feature.reserve_x9)] = .{ | |
| 892 | result[@backingInt(Feature.reserve_x9)] = .{ | |
| 893 | 893 | .llvm_name = "reserve-x9", |
| 894 | 894 | .description = "Reserve X9", |
| 895 | 895 | .dependencies = featureSet(&[_]Feature{}), |
| 896 | 896 | }; |
| 897 | result[@intFromEnum(Feature.rva20s64)] = .{ | |
| 897 | result[@backingInt(Feature.rva20s64)] = .{ | |
| 898 | 898 | .llvm_name = "rva20s64", |
| 899 | 899 | .description = "RISC-V rva20s64 profile", |
| 900 | 900 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -918,7 +918,7 @@ pub const all_features = blk: { |
| 918 | 918 | .zifencei, |
| 919 | 919 | }), |
| 920 | 920 | }; |
| 921 | result[@intFromEnum(Feature.rva20u64)] = .{ | |
| 921 | result[@backingInt(Feature.rva20u64)] = .{ | |
| 922 | 922 | .llvm_name = "rva20u64", |
| 923 | 923 | .description = "RISC-V rva20u64 profile", |
| 924 | 924 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -936,7 +936,7 @@ pub const all_features = blk: { |
| 936 | 936 | .zicntr, |
| 937 | 937 | }), |
| 938 | 938 | }; |
| 939 | result[@intFromEnum(Feature.rva22s64)] = .{ | |
| 939 | result[@backingInt(Feature.rva22s64)] = .{ | |
| 940 | 940 | .llvm_name = "rva22s64", |
| 941 | 941 | .description = "RISC-V rva22s64 profile", |
| 942 | 942 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -972,7 +972,7 @@ pub const all_features = blk: { |
| 972 | 972 | .zkt, |
| 973 | 973 | }), |
| 974 | 974 | }; |
| 975 | result[@intFromEnum(Feature.rva22u64)] = .{ | |
| 975 | result[@backingInt(Feature.rva22u64)] = .{ | |
| 976 | 976 | .llvm_name = "rva22u64", |
| 977 | 977 | .description = "RISC-V rva22u64 profile", |
| 978 | 978 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -999,7 +999,7 @@ pub const all_features = blk: { |
| 999 | 999 | .zkt, |
| 1000 | 1000 | }), |
| 1001 | 1001 | }; |
| 1002 | result[@intFromEnum(Feature.rva23s64)] = .{ | |
| 1002 | result[@backingInt(Feature.rva23s64)] = .{ | |
| 1003 | 1003 | .llvm_name = "rva23s64", |
| 1004 | 1004 | .description = "RISC-V rva23s64 profile", |
| 1005 | 1005 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1052,7 +1052,7 @@ pub const all_features = blk: { |
| 1052 | 1052 | .zvkt, |
| 1053 | 1053 | }), |
| 1054 | 1054 | }; |
| 1055 | result[@intFromEnum(Feature.rva23u64)] = .{ | |
| 1055 | result[@backingInt(Feature.rva23u64)] = .{ | |
| 1056 | 1056 | .llvm_name = "rva23u64", |
| 1057 | 1057 | .description = "RISC-V rva23u64 profile", |
| 1058 | 1058 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1090,7 +1090,7 @@ pub const all_features = blk: { |
| 1090 | 1090 | .zvkt, |
| 1091 | 1091 | }), |
| 1092 | 1092 | }; |
| 1093 | result[@intFromEnum(Feature.rvb23s64)] = .{ | |
| 1093 | result[@backingInt(Feature.rvb23s64)] = .{ | |
| 1094 | 1094 | .llvm_name = "rvb23s64", |
| 1095 | 1095 | .description = "RISC-V rvb23s64 profile", |
| 1096 | 1096 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1136,7 +1136,7 @@ pub const all_features = blk: { |
| 1136 | 1136 | .zkt, |
| 1137 | 1137 | }), |
| 1138 | 1138 | }; |
| 1139 | result[@intFromEnum(Feature.rvb23u64)] = .{ | |
| 1139 | result[@backingInt(Feature.rvb23u64)] = .{ | |
| 1140 | 1140 | .llvm_name = "rvb23u64", |
| 1141 | 1141 | .description = "RISC-V rvb23u64 profile", |
| 1142 | 1142 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1169,7 +1169,7 @@ pub const all_features = blk: { |
| 1169 | 1169 | .zkt, |
| 1170 | 1170 | }), |
| 1171 | 1171 | }; |
| 1172 | result[@intFromEnum(Feature.rvi20u32)] = .{ | |
| 1172 | result[@backingInt(Feature.rvi20u32)] = .{ | |
| 1173 | 1173 | .llvm_name = "rvi20u32", |
| 1174 | 1174 | .description = "RISC-V rvi20u32 profile", |
| 1175 | 1175 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1177,7 +1177,7 @@ pub const all_features = blk: { |
| 1177 | 1177 | .i, |
| 1178 | 1178 | }), |
| 1179 | 1179 | }; |
| 1180 | result[@intFromEnum(Feature.rvi20u64)] = .{ | |
| 1180 | result[@backingInt(Feature.rvi20u64)] = .{ | |
| 1181 | 1181 | .llvm_name = "rvi20u64", |
| 1182 | 1182 | .description = "RISC-V rvi20u64 profile", |
| 1183 | 1183 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1185,22 +1185,22 @@ pub const all_features = blk: { |
| 1185 | 1185 | .i, |
| 1186 | 1186 | }), |
| 1187 | 1187 | }; |
| 1188 | result[@intFromEnum(Feature.save_restore)] = .{ | |
| 1188 | result[@backingInt(Feature.save_restore)] = .{ | |
| 1189 | 1189 | .llvm_name = "save-restore", |
| 1190 | 1190 | .description = "Enable save/restore.", |
| 1191 | 1191 | .dependencies = featureSet(&[_]Feature{}), |
| 1192 | 1192 | }; |
| 1193 | result[@intFromEnum(Feature.sdext)] = .{ | |
| 1193 | result[@backingInt(Feature.sdext)] = .{ | |
| 1194 | 1194 | .llvm_name = "sdext", |
| 1195 | 1195 | .description = "'Sdext' (External debugger)", |
| 1196 | 1196 | .dependencies = featureSet(&[_]Feature{}), |
| 1197 | 1197 | }; |
| 1198 | result[@intFromEnum(Feature.sdtrig)] = .{ | |
| 1198 | result[@backingInt(Feature.sdtrig)] = .{ | |
| 1199 | 1199 | .llvm_name = "sdtrig", |
| 1200 | 1200 | .description = "'Sdtrig' (Debugger triggers)", |
| 1201 | 1201 | .dependencies = featureSet(&[_]Feature{}), |
| 1202 | 1202 | }; |
| 1203 | result[@intFromEnum(Feature.sha)] = .{ | |
| 1203 | result[@backingInt(Feature.sha)] = .{ | |
| 1204 | 1204 | .llvm_name = "sha", |
| 1205 | 1205 | .description = "'Sha' (Augmented Hypervisor)", |
| 1206 | 1206 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1214,291 +1214,291 @@ pub const all_features = blk: { |
| 1214 | 1214 | .ssstateen, |
| 1215 | 1215 | }), |
| 1216 | 1216 | }; |
| 1217 | result[@intFromEnum(Feature.shcounterenw)] = .{ | |
| 1217 | result[@backingInt(Feature.shcounterenw)] = .{ | |
| 1218 | 1218 | .llvm_name = "shcounterenw", |
| 1219 | 1219 | .description = "'Shcounterenw' (Support writeable hcounteren enable bit for any hpmcounter that is not read-only zero)", |
| 1220 | 1220 | .dependencies = featureSet(&[_]Feature{}), |
| 1221 | 1221 | }; |
| 1222 | result[@intFromEnum(Feature.shgatpa)] = .{ | |
| 1222 | result[@backingInt(Feature.shgatpa)] = .{ | |
| 1223 | 1223 | .llvm_name = "shgatpa", |
| 1224 | 1224 | .description = "'Shgatpa' (SvNNx4 mode supported for all modes supported by satp, as well as Bare)", |
| 1225 | 1225 | .dependencies = featureSet(&[_]Feature{}), |
| 1226 | 1226 | }; |
| 1227 | result[@intFromEnum(Feature.shifted_zextw_fusion)] = .{ | |
| 1227 | result[@backingInt(Feature.shifted_zextw_fusion)] = .{ | |
| 1228 | 1228 | .llvm_name = "shifted-zextw-fusion", |
| 1229 | 1229 | .description = "Enable SLLI+SRLI to be fused when computing (shifted) word zero extension", |
| 1230 | 1230 | .dependencies = featureSet(&[_]Feature{}), |
| 1231 | 1231 | }; |
| 1232 | result[@intFromEnum(Feature.shlcofideleg)] = .{ | |
| 1232 | result[@backingInt(Feature.shlcofideleg)] = .{ | |
| 1233 | 1233 | .llvm_name = "shlcofideleg", |
| 1234 | 1234 | .description = "'Shlcofideleg' (Delegating LCOFI Interrupts to VS-mode)", |
| 1235 | 1235 | .dependencies = featureSet(&[_]Feature{}), |
| 1236 | 1236 | }; |
| 1237 | result[@intFromEnum(Feature.short_forward_branch_ialu)] = .{ | |
| 1237 | result[@backingInt(Feature.short_forward_branch_ialu)] = .{ | |
| 1238 | 1238 | .llvm_name = "short-forward-branch-ialu", |
| 1239 | 1239 | .description = "Enable short forward branch optimization for RVI base instructions", |
| 1240 | 1240 | .dependencies = featureSet(&[_]Feature{}), |
| 1241 | 1241 | }; |
| 1242 | result[@intFromEnum(Feature.short_forward_branch_iload)] = .{ | |
| 1242 | result[@backingInt(Feature.short_forward_branch_iload)] = .{ | |
| 1243 | 1243 | .llvm_name = "short-forward-branch-iload", |
| 1244 | 1244 | .description = "Enable short forward branch optimization for load instructions", |
| 1245 | 1245 | .dependencies = featureSet(&[_]Feature{ |
| 1246 | 1246 | .short_forward_branch_ialu, |
| 1247 | 1247 | }), |
| 1248 | 1248 | }; |
| 1249 | result[@intFromEnum(Feature.short_forward_branch_iminmax)] = .{ | |
| 1249 | result[@backingInt(Feature.short_forward_branch_iminmax)] = .{ | |
| 1250 | 1250 | .llvm_name = "short-forward-branch-iminmax", |
| 1251 | 1251 | .description = "Enable short forward branch optimization for MIN,MAX instructions in Zbb", |
| 1252 | 1252 | .dependencies = featureSet(&[_]Feature{ |
| 1253 | 1253 | .short_forward_branch_ialu, |
| 1254 | 1254 | }), |
| 1255 | 1255 | }; |
| 1256 | result[@intFromEnum(Feature.short_forward_branch_imul)] = .{ | |
| 1256 | result[@backingInt(Feature.short_forward_branch_imul)] = .{ | |
| 1257 | 1257 | .llvm_name = "short-forward-branch-imul", |
| 1258 | 1258 | .description = "Enable short forward branch optimization for MUL instruction", |
| 1259 | 1259 | .dependencies = featureSet(&[_]Feature{ |
| 1260 | 1260 | .short_forward_branch_ialu, |
| 1261 | 1261 | }), |
| 1262 | 1262 | }; |
| 1263 | result[@intFromEnum(Feature.shtvala)] = .{ | |
| 1263 | result[@backingInt(Feature.shtvala)] = .{ | |
| 1264 | 1264 | .llvm_name = "shtvala", |
| 1265 | 1265 | .description = "'Shtvala' (htval provides all needed values)", |
| 1266 | 1266 | .dependencies = featureSet(&[_]Feature{}), |
| 1267 | 1267 | }; |
| 1268 | result[@intFromEnum(Feature.shvsatpa)] = .{ | |
| 1268 | result[@backingInt(Feature.shvsatpa)] = .{ | |
| 1269 | 1269 | .llvm_name = "shvsatpa", |
| 1270 | 1270 | .description = "'Shvsatpa' (vsatp supports all modes supported by satp)", |
| 1271 | 1271 | .dependencies = featureSet(&[_]Feature{}), |
| 1272 | 1272 | }; |
| 1273 | result[@intFromEnum(Feature.shvstvala)] = .{ | |
| 1273 | result[@backingInt(Feature.shvstvala)] = .{ | |
| 1274 | 1274 | .llvm_name = "shvstvala", |
| 1275 | 1275 | .description = "'Shvstvala' (vstval provides all needed values)", |
| 1276 | 1276 | .dependencies = featureSet(&[_]Feature{}), |
| 1277 | 1277 | }; |
| 1278 | result[@intFromEnum(Feature.shvstvecd)] = .{ | |
| 1278 | result[@backingInt(Feature.shvstvecd)] = .{ | |
| 1279 | 1279 | .llvm_name = "shvstvecd", |
| 1280 | 1280 | .description = "'Shvstvecd' (vstvec supports Direct mode)", |
| 1281 | 1281 | .dependencies = featureSet(&[_]Feature{}), |
| 1282 | 1282 | }; |
| 1283 | result[@intFromEnum(Feature.shxadd_load_fusion)] = .{ | |
| 1283 | result[@backingInt(Feature.shxadd_load_fusion)] = .{ | |
| 1284 | 1284 | .llvm_name = "shxadd-load-fusion", |
| 1285 | 1285 | .description = "Enable SH(1|2|3)ADD(.UW) + load macrofusion", |
| 1286 | 1286 | .dependencies = featureSet(&[_]Feature{}), |
| 1287 | 1287 | }; |
| 1288 | result[@intFromEnum(Feature.single_element_vec_fp64)] = .{ | |
| 1288 | result[@backingInt(Feature.single_element_vec_fp64)] = .{ | |
| 1289 | 1289 | .llvm_name = "single-element-vec-fp64", |
| 1290 | 1290 | .description = "Certain vector FP64 operations produce a single result element per cycle", |
| 1291 | 1291 | .dependencies = featureSet(&[_]Feature{}), |
| 1292 | 1292 | }; |
| 1293 | result[@intFromEnum(Feature.smaia)] = .{ | |
| 1293 | result[@backingInt(Feature.smaia)] = .{ | |
| 1294 | 1294 | .llvm_name = "smaia", |
| 1295 | 1295 | .description = "'Smaia' (Advanced Interrupt Architecture Machine Level)", |
| 1296 | 1296 | .dependencies = featureSet(&[_]Feature{}), |
| 1297 | 1297 | }; |
| 1298 | result[@intFromEnum(Feature.smcdeleg)] = .{ | |
| 1298 | result[@backingInt(Feature.smcdeleg)] = .{ | |
| 1299 | 1299 | .llvm_name = "smcdeleg", |
| 1300 | 1300 | .description = "'Smcdeleg' (Counter Delegation Machine Level)", |
| 1301 | 1301 | .dependencies = featureSet(&[_]Feature{}), |
| 1302 | 1302 | }; |
| 1303 | result[@intFromEnum(Feature.smcntrpmf)] = .{ | |
| 1303 | result[@backingInt(Feature.smcntrpmf)] = .{ | |
| 1304 | 1304 | .llvm_name = "smcntrpmf", |
| 1305 | 1305 | .description = "'Smcntrpmf' (Cycle and Instret Privilege Mode Filtering)", |
| 1306 | 1306 | .dependencies = featureSet(&[_]Feature{}), |
| 1307 | 1307 | }; |
| 1308 | result[@intFromEnum(Feature.smcsrind)] = .{ | |
| 1308 | result[@backingInt(Feature.smcsrind)] = .{ | |
| 1309 | 1309 | .llvm_name = "smcsrind", |
| 1310 | 1310 | .description = "'Smcsrind' (Indirect CSR Access Machine Level)", |
| 1311 | 1311 | .dependencies = featureSet(&[_]Feature{}), |
| 1312 | 1312 | }; |
| 1313 | result[@intFromEnum(Feature.smctr)] = .{ | |
| 1313 | result[@backingInt(Feature.smctr)] = .{ | |
| 1314 | 1314 | .llvm_name = "smctr", |
| 1315 | 1315 | .description = "'Smctr' (Control Transfer Records Machine Level)", |
| 1316 | 1316 | .dependencies = featureSet(&[_]Feature{ |
| 1317 | 1317 | .sscsrind, |
| 1318 | 1318 | }), |
| 1319 | 1319 | }; |
| 1320 | result[@intFromEnum(Feature.smdbltrp)] = .{ | |
| 1320 | result[@backingInt(Feature.smdbltrp)] = .{ | |
| 1321 | 1321 | .llvm_name = "smdbltrp", |
| 1322 | 1322 | .description = "'Smdbltrp' (Double Trap Machine Level)", |
| 1323 | 1323 | .dependencies = featureSet(&[_]Feature{ |
| 1324 | 1324 | .zicsr, |
| 1325 | 1325 | }), |
| 1326 | 1326 | }; |
| 1327 | result[@intFromEnum(Feature.smepmp)] = .{ | |
| 1327 | result[@backingInt(Feature.smepmp)] = .{ | |
| 1328 | 1328 | .llvm_name = "smepmp", |
| 1329 | 1329 | .description = "'Smepmp' (Enhanced Physical Memory Protection)", |
| 1330 | 1330 | .dependencies = featureSet(&[_]Feature{}), |
| 1331 | 1331 | }; |
| 1332 | result[@intFromEnum(Feature.smmpm)] = .{ | |
| 1332 | result[@backingInt(Feature.smmpm)] = .{ | |
| 1333 | 1333 | .llvm_name = "smmpm", |
| 1334 | 1334 | .description = "'Smmpm' (Machine-level Pointer Masking for M-mode)", |
| 1335 | 1335 | .dependencies = featureSet(&[_]Feature{}), |
| 1336 | 1336 | }; |
| 1337 | result[@intFromEnum(Feature.smnpm)] = .{ | |
| 1337 | result[@backingInt(Feature.smnpm)] = .{ | |
| 1338 | 1338 | .llvm_name = "smnpm", |
| 1339 | 1339 | .description = "'Smnpm' (Machine-level Pointer Masking for next lower privilege mode)", |
| 1340 | 1340 | .dependencies = featureSet(&[_]Feature{}), |
| 1341 | 1341 | }; |
| 1342 | result[@intFromEnum(Feature.smrnmi)] = .{ | |
| 1342 | result[@backingInt(Feature.smrnmi)] = .{ | |
| 1343 | 1343 | .llvm_name = "smrnmi", |
| 1344 | 1344 | .description = "'Smrnmi' (Resumable Non-Maskable Interrupts)", |
| 1345 | 1345 | .dependencies = featureSet(&[_]Feature{}), |
| 1346 | 1346 | }; |
| 1347 | result[@intFromEnum(Feature.smstateen)] = .{ | |
| 1347 | result[@backingInt(Feature.smstateen)] = .{ | |
| 1348 | 1348 | .llvm_name = "smstateen", |
| 1349 | 1349 | .description = "'Smstateen' (Machine-mode view of the state-enable extension)", |
| 1350 | 1350 | .dependencies = featureSet(&[_]Feature{}), |
| 1351 | 1351 | }; |
| 1352 | result[@intFromEnum(Feature.ssaia)] = .{ | |
| 1352 | result[@backingInt(Feature.ssaia)] = .{ | |
| 1353 | 1353 | .llvm_name = "ssaia", |
| 1354 | 1354 | .description = "'Ssaia' (Advanced Interrupt Architecture Supervisor Level)", |
| 1355 | 1355 | .dependencies = featureSet(&[_]Feature{}), |
| 1356 | 1356 | }; |
| 1357 | result[@intFromEnum(Feature.ssccfg)] = .{ | |
| 1357 | result[@backingInt(Feature.ssccfg)] = .{ | |
| 1358 | 1358 | .llvm_name = "ssccfg", |
| 1359 | 1359 | .description = "'Ssccfg' (Counter Configuration Supervisor Level)", |
| 1360 | 1360 | .dependencies = featureSet(&[_]Feature{}), |
| 1361 | 1361 | }; |
| 1362 | result[@intFromEnum(Feature.ssccptr)] = .{ | |
| 1362 | result[@backingInt(Feature.ssccptr)] = .{ | |
| 1363 | 1363 | .llvm_name = "ssccptr", |
| 1364 | 1364 | .description = "'Ssccptr' (Main memory supports page table reads)", |
| 1365 | 1365 | .dependencies = featureSet(&[_]Feature{}), |
| 1366 | 1366 | }; |
| 1367 | result[@intFromEnum(Feature.sscofpmf)] = .{ | |
| 1367 | result[@backingInt(Feature.sscofpmf)] = .{ | |
| 1368 | 1368 | .llvm_name = "sscofpmf", |
| 1369 | 1369 | .description = "'Sscofpmf' (Count Overflow and Mode-Based Filtering)", |
| 1370 | 1370 | .dependencies = featureSet(&[_]Feature{}), |
| 1371 | 1371 | }; |
| 1372 | result[@intFromEnum(Feature.sscounterenw)] = .{ | |
| 1372 | result[@backingInt(Feature.sscounterenw)] = .{ | |
| 1373 | 1373 | .llvm_name = "sscounterenw", |
| 1374 | 1374 | .description = "'Sscounterenw' (Support writeable scounteren enable bit for any hpmcounter that is not read-only zero)", |
| 1375 | 1375 | .dependencies = featureSet(&[_]Feature{}), |
| 1376 | 1376 | }; |
| 1377 | result[@intFromEnum(Feature.sscsrind)] = .{ | |
| 1377 | result[@backingInt(Feature.sscsrind)] = .{ | |
| 1378 | 1378 | .llvm_name = "sscsrind", |
| 1379 | 1379 | .description = "'Sscsrind' (Indirect CSR Access Supervisor Level)", |
| 1380 | 1380 | .dependencies = featureSet(&[_]Feature{}), |
| 1381 | 1381 | }; |
| 1382 | result[@intFromEnum(Feature.ssctr)] = .{ | |
| 1382 | result[@backingInt(Feature.ssctr)] = .{ | |
| 1383 | 1383 | .llvm_name = "ssctr", |
| 1384 | 1384 | .description = "'Ssctr' (Control Transfer Records Supervisor Level)", |
| 1385 | 1385 | .dependencies = featureSet(&[_]Feature{ |
| 1386 | 1386 | .sscsrind, |
| 1387 | 1387 | }), |
| 1388 | 1388 | }; |
| 1389 | result[@intFromEnum(Feature.ssdbltrp)] = .{ | |
| 1389 | result[@backingInt(Feature.ssdbltrp)] = .{ | |
| 1390 | 1390 | .llvm_name = "ssdbltrp", |
| 1391 | 1391 | .description = "'Ssdbltrp' (Double Trap Supervisor Level)", |
| 1392 | 1392 | .dependencies = featureSet(&[_]Feature{ |
| 1393 | 1393 | .zicsr, |
| 1394 | 1394 | }), |
| 1395 | 1395 | }; |
| 1396 | result[@intFromEnum(Feature.ssnpm)] = .{ | |
| 1396 | result[@backingInt(Feature.ssnpm)] = .{ | |
| 1397 | 1397 | .llvm_name = "ssnpm", |
| 1398 | 1398 | .description = "'Ssnpm' (Supervisor-level Pointer Masking for next lower privilege mode)", |
| 1399 | 1399 | .dependencies = featureSet(&[_]Feature{}), |
| 1400 | 1400 | }; |
| 1401 | result[@intFromEnum(Feature.sspm)] = .{ | |
| 1401 | result[@backingInt(Feature.sspm)] = .{ | |
| 1402 | 1402 | .llvm_name = "sspm", |
| 1403 | 1403 | .description = "'Sspm' (Indicates Supervisor-mode Pointer Masking)", |
| 1404 | 1404 | .dependencies = featureSet(&[_]Feature{}), |
| 1405 | 1405 | }; |
| 1406 | result[@intFromEnum(Feature.ssqosid)] = .{ | |
| 1406 | result[@backingInt(Feature.ssqosid)] = .{ | |
| 1407 | 1407 | .llvm_name = "ssqosid", |
| 1408 | 1408 | .description = "'Ssqosid' (Quality-of-Service (QoS) Identifiers)", |
| 1409 | 1409 | .dependencies = featureSet(&[_]Feature{}), |
| 1410 | 1410 | }; |
| 1411 | result[@intFromEnum(Feature.ssstateen)] = .{ | |
| 1411 | result[@backingInt(Feature.ssstateen)] = .{ | |
| 1412 | 1412 | .llvm_name = "ssstateen", |
| 1413 | 1413 | .description = "'Ssstateen' (Supervisor-mode view of the state-enable extension)", |
| 1414 | 1414 | .dependencies = featureSet(&[_]Feature{}), |
| 1415 | 1415 | }; |
| 1416 | result[@intFromEnum(Feature.ssstrict)] = .{ | |
| 1416 | result[@backingInt(Feature.ssstrict)] = .{ | |
| 1417 | 1417 | .llvm_name = "ssstrict", |
| 1418 | 1418 | .description = "'Ssstrict' (No non-conforming extensions are present)", |
| 1419 | 1419 | .dependencies = featureSet(&[_]Feature{}), |
| 1420 | 1420 | }; |
| 1421 | result[@intFromEnum(Feature.sstc)] = .{ | |
| 1421 | result[@backingInt(Feature.sstc)] = .{ | |
| 1422 | 1422 | .llvm_name = "sstc", |
| 1423 | 1423 | .description = "'Sstc' (Supervisor-mode timer interrupts)", |
| 1424 | 1424 | .dependencies = featureSet(&[_]Feature{}), |
| 1425 | 1425 | }; |
| 1426 | result[@intFromEnum(Feature.sstvala)] = .{ | |
| 1426 | result[@backingInt(Feature.sstvala)] = .{ | |
| 1427 | 1427 | .llvm_name = "sstvala", |
| 1428 | 1428 | .description = "'Sstvala' (stval provides all needed values)", |
| 1429 | 1429 | .dependencies = featureSet(&[_]Feature{}), |
| 1430 | 1430 | }; |
| 1431 | result[@intFromEnum(Feature.sstvecd)] = .{ | |
| 1431 | result[@backingInt(Feature.sstvecd)] = .{ | |
| 1432 | 1432 | .llvm_name = "sstvecd", |
| 1433 | 1433 | .description = "'Sstvecd' (stvec supports Direct mode)", |
| 1434 | 1434 | .dependencies = featureSet(&[_]Feature{}), |
| 1435 | 1435 | }; |
| 1436 | result[@intFromEnum(Feature.ssu64xl)] = .{ | |
| 1436 | result[@backingInt(Feature.ssu64xl)] = .{ | |
| 1437 | 1437 | .llvm_name = "ssu64xl", |
| 1438 | 1438 | .description = "'Ssu64xl' (UXLEN=64 supported)", |
| 1439 | 1439 | .dependencies = featureSet(&[_]Feature{}), |
| 1440 | 1440 | }; |
| 1441 | result[@intFromEnum(Feature.supm)] = .{ | |
| 1441 | result[@backingInt(Feature.supm)] = .{ | |
| 1442 | 1442 | .llvm_name = "supm", |
| 1443 | 1443 | .description = "'Supm' (Indicates User-mode Pointer Masking)", |
| 1444 | 1444 | .dependencies = featureSet(&[_]Feature{}), |
| 1445 | 1445 | }; |
| 1446 | result[@intFromEnum(Feature.svade)] = .{ | |
| 1446 | result[@backingInt(Feature.svade)] = .{ | |
| 1447 | 1447 | .llvm_name = "svade", |
| 1448 | 1448 | .description = "'Svade' (Raise exceptions on improper A/D bits)", |
| 1449 | 1449 | .dependencies = featureSet(&[_]Feature{}), |
| 1450 | 1450 | }; |
| 1451 | result[@intFromEnum(Feature.svadu)] = .{ | |
| 1451 | result[@backingInt(Feature.svadu)] = .{ | |
| 1452 | 1452 | .llvm_name = "svadu", |
| 1453 | 1453 | .description = "'Svadu' (Hardware A/D updates)", |
| 1454 | 1454 | .dependencies = featureSet(&[_]Feature{}), |
| 1455 | 1455 | }; |
| 1456 | result[@intFromEnum(Feature.svbare)] = .{ | |
| 1456 | result[@backingInt(Feature.svbare)] = .{ | |
| 1457 | 1457 | .llvm_name = "svbare", |
| 1458 | 1458 | .description = "'Svbare' (satp mode Bare supported)", |
| 1459 | 1459 | .dependencies = featureSet(&[_]Feature{}), |
| 1460 | 1460 | }; |
| 1461 | result[@intFromEnum(Feature.svinval)] = .{ | |
| 1461 | result[@backingInt(Feature.svinval)] = .{ | |
| 1462 | 1462 | .llvm_name = "svinval", |
| 1463 | 1463 | .description = "'Svinval' (Fine-Grained Address-Translation Cache Invalidation)", |
| 1464 | 1464 | .dependencies = featureSet(&[_]Feature{}), |
| 1465 | 1465 | }; |
| 1466 | result[@intFromEnum(Feature.svnapot)] = .{ | |
| 1466 | result[@backingInt(Feature.svnapot)] = .{ | |
| 1467 | 1467 | .llvm_name = "svnapot", |
| 1468 | 1468 | .description = "'Svnapot' (NAPOT Translation Contiguity)", |
| 1469 | 1469 | .dependencies = featureSet(&[_]Feature{}), |
| 1470 | 1470 | }; |
| 1471 | result[@intFromEnum(Feature.svpbmt)] = .{ | |
| 1471 | result[@backingInt(Feature.svpbmt)] = .{ | |
| 1472 | 1472 | .llvm_name = "svpbmt", |
| 1473 | 1473 | .description = "'Svpbmt' (Page-Based Memory Types)", |
| 1474 | 1474 | .dependencies = featureSet(&[_]Feature{}), |
| 1475 | 1475 | }; |
| 1476 | result[@intFromEnum(Feature.svvptc)] = .{ | |
| 1476 | result[@backingInt(Feature.svvptc)] = .{ | |
| 1477 | 1477 | .llvm_name = "svvptc", |
| 1478 | 1478 | .description = "'Svvptc' (Obviating Memory-Management Instructions after Marking PTEs Valid)", |
| 1479 | 1479 | .dependencies = featureSet(&[_]Feature{}), |
| 1480 | 1480 | }; |
| 1481 | result[@intFromEnum(Feature.tagged_globals)] = .{ | |
| 1481 | result[@backingInt(Feature.tagged_globals)] = .{ | |
| 1482 | 1482 | .llvm_name = "tagged-globals", |
| 1483 | 1483 | .description = "Use an instruction sequence for taking the address of a global that allows a memory tag in the upper address bits", |
| 1484 | 1484 | .dependencies = featureSet(&[_]Feature{}), |
| 1485 | 1485 | }; |
| 1486 | result[@intFromEnum(Feature.unaligned_scalar_mem)] = .{ | |
| 1486 | result[@backingInt(Feature.unaligned_scalar_mem)] = .{ | |
| 1487 | 1487 | .llvm_name = "unaligned-scalar-mem", |
| 1488 | 1488 | .description = "Has reasonably performant unaligned scalar loads and stores", |
| 1489 | 1489 | .dependencies = featureSet(&[_]Feature{}), |
| 1490 | 1490 | }; |
| 1491 | result[@intFromEnum(Feature.unaligned_vector_mem)] = .{ | |
| 1491 | result[@backingInt(Feature.unaligned_vector_mem)] = .{ | |
| 1492 | 1492 | .llvm_name = "unaligned-vector-mem", |
| 1493 | 1493 | .description = "Has reasonably performant unaligned vector loads and stores", |
| 1494 | 1494 | .dependencies = featureSet(&[_]Feature{}), |
| 1495 | 1495 | }; |
| 1496 | result[@intFromEnum(Feature.use_postra_scheduler)] = .{ | |
| 1496 | result[@backingInt(Feature.use_postra_scheduler)] = .{ | |
| 1497 | 1497 | .llvm_name = "use-postra-scheduler", |
| 1498 | 1498 | .description = "Schedule again after register allocation", |
| 1499 | 1499 | .dependencies = featureSet(&[_]Feature{}), |
| 1500 | 1500 | }; |
| 1501 | result[@intFromEnum(Feature.v)] = .{ | |
| 1501 | result[@backingInt(Feature.v)] = .{ | |
| 1502 | 1502 | .llvm_name = "v", |
| 1503 | 1503 | .description = "'V' (Vector Extension for Application Processors)", |
| 1504 | 1504 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1506,131 +1506,131 @@ pub const all_features = blk: { |
| 1506 | 1506 | .zvl128b, |
| 1507 | 1507 | }), |
| 1508 | 1508 | }; |
| 1509 | result[@intFromEnum(Feature.ventana_veyron)] = .{ | |
| 1509 | result[@backingInt(Feature.ventana_veyron)] = .{ | |
| 1510 | 1510 | .llvm_name = "ventana-veyron", |
| 1511 | 1511 | .description = "Ventana Veyron-Series processors", |
| 1512 | 1512 | .dependencies = featureSet(&[_]Feature{}), |
| 1513 | 1513 | }; |
| 1514 | result[@intFromEnum(Feature.vl_dependent_latency)] = .{ | |
| 1514 | result[@backingInt(Feature.vl_dependent_latency)] = .{ | |
| 1515 | 1515 | .llvm_name = "vl-dependent-latency", |
| 1516 | 1516 | .description = "Latency of vector instructions is dependent on the dynamic value of vl", |
| 1517 | 1517 | .dependencies = featureSet(&[_]Feature{}), |
| 1518 | 1518 | }; |
| 1519 | result[@intFromEnum(Feature.vxrm_pipeline_flush)] = .{ | |
| 1519 | result[@backingInt(Feature.vxrm_pipeline_flush)] = .{ | |
| 1520 | 1520 | .llvm_name = "vxrm-pipeline-flush", |
| 1521 | 1521 | .description = "VXRM writes causes pipeline flush", |
| 1522 | 1522 | .dependencies = featureSet(&[_]Feature{}), |
| 1523 | 1523 | }; |
| 1524 | result[@intFromEnum(Feature.xandesbfhcvt)] = .{ | |
| 1524 | result[@backingInt(Feature.xandesbfhcvt)] = .{ | |
| 1525 | 1525 | .llvm_name = "xandesbfhcvt", |
| 1526 | 1526 | .description = "'XAndesBFHCvt' (Andes Scalar BFLOAT16 Conversion Extension)", |
| 1527 | 1527 | .dependencies = featureSet(&[_]Feature{ |
| 1528 | 1528 | .f, |
| 1529 | 1529 | }), |
| 1530 | 1530 | }; |
| 1531 | result[@intFromEnum(Feature.xandesperf)] = .{ | |
| 1531 | result[@backingInt(Feature.xandesperf)] = .{ | |
| 1532 | 1532 | .llvm_name = "xandesperf", |
| 1533 | 1533 | .description = "'XAndesPerf' (Andes Performance Extension)", |
| 1534 | 1534 | .dependencies = featureSet(&[_]Feature{}), |
| 1535 | 1535 | }; |
| 1536 | result[@intFromEnum(Feature.xandesvbfhcvt)] = .{ | |
| 1536 | result[@backingInt(Feature.xandesvbfhcvt)] = .{ | |
| 1537 | 1537 | .llvm_name = "xandesvbfhcvt", |
| 1538 | 1538 | .description = "'XAndesVBFHCvt' (Andes Vector BFLOAT16 Conversion Extension)", |
| 1539 | 1539 | .dependencies = featureSet(&[_]Feature{ |
| 1540 | 1540 | .zve32f, |
| 1541 | 1541 | }), |
| 1542 | 1542 | }; |
| 1543 | result[@intFromEnum(Feature.xandesvdot)] = .{ | |
| 1543 | result[@backingInt(Feature.xandesvdot)] = .{ | |
| 1544 | 1544 | .llvm_name = "xandesvdot", |
| 1545 | 1545 | .description = "'XAndesVDot' (Andes Vector Dot Product Extension)", |
| 1546 | 1546 | .dependencies = featureSet(&[_]Feature{ |
| 1547 | 1547 | .zve32x, |
| 1548 | 1548 | }), |
| 1549 | 1549 | }; |
| 1550 | result[@intFromEnum(Feature.xandesvpackfph)] = .{ | |
| 1550 | result[@backingInt(Feature.xandesvpackfph)] = .{ | |
| 1551 | 1551 | .llvm_name = "xandesvpackfph", |
| 1552 | 1552 | .description = "'XAndesVPackFPH' (Andes Vector Packed FP16 Extension)", |
| 1553 | 1553 | .dependencies = featureSet(&[_]Feature{ |
| 1554 | 1554 | .f, |
| 1555 | 1555 | }), |
| 1556 | 1556 | }; |
| 1557 | result[@intFromEnum(Feature.xandesvsinth)] = .{ | |
| 1557 | result[@backingInt(Feature.xandesvsinth)] = .{ | |
| 1558 | 1558 | .llvm_name = "xandesvsinth", |
| 1559 | 1559 | .description = "'XAndesVSIntH' (Andes Vector Small INT Handling Extension)", |
| 1560 | 1560 | .dependencies = featureSet(&[_]Feature{ |
| 1561 | 1561 | .zve32x, |
| 1562 | 1562 | }), |
| 1563 | 1563 | }; |
| 1564 | result[@intFromEnum(Feature.xandesvsintload)] = .{ | |
| 1564 | result[@backingInt(Feature.xandesvsintload)] = .{ | |
| 1565 | 1565 | .llvm_name = "xandesvsintload", |
| 1566 | 1566 | .description = "'XAndesVSIntLoad' (Andes Vector INT4 Load Extension)", |
| 1567 | 1567 | .dependencies = featureSet(&[_]Feature{ |
| 1568 | 1568 | .zve32x, |
| 1569 | 1569 | }), |
| 1570 | 1570 | }; |
| 1571 | result[@intFromEnum(Feature.xcvalu)] = .{ | |
| 1571 | result[@backingInt(Feature.xcvalu)] = .{ | |
| 1572 | 1572 | .llvm_name = "xcvalu", |
| 1573 | 1573 | .description = "'XCValu' (CORE-V ALU Operations)", |
| 1574 | 1574 | .dependencies = featureSet(&[_]Feature{}), |
| 1575 | 1575 | }; |
| 1576 | result[@intFromEnum(Feature.xcvbi)] = .{ | |
| 1576 | result[@backingInt(Feature.xcvbi)] = .{ | |
| 1577 | 1577 | .llvm_name = "xcvbi", |
| 1578 | 1578 | .description = "'XCVbi' (CORE-V Immediate Branching)", |
| 1579 | 1579 | .dependencies = featureSet(&[_]Feature{}), |
| 1580 | 1580 | }; |
| 1581 | result[@intFromEnum(Feature.xcvbitmanip)] = .{ | |
| 1581 | result[@backingInt(Feature.xcvbitmanip)] = .{ | |
| 1582 | 1582 | .llvm_name = "xcvbitmanip", |
| 1583 | 1583 | .description = "'XCVbitmanip' (CORE-V Bit Manipulation)", |
| 1584 | 1584 | .dependencies = featureSet(&[_]Feature{}), |
| 1585 | 1585 | }; |
| 1586 | result[@intFromEnum(Feature.xcvelw)] = .{ | |
| 1586 | result[@backingInt(Feature.xcvelw)] = .{ | |
| 1587 | 1587 | .llvm_name = "xcvelw", |
| 1588 | 1588 | .description = "'XCVelw' (CORE-V Event Load Word)", |
| 1589 | 1589 | .dependencies = featureSet(&[_]Feature{}), |
| 1590 | 1590 | }; |
| 1591 | result[@intFromEnum(Feature.xcvmac)] = .{ | |
| 1591 | result[@backingInt(Feature.xcvmac)] = .{ | |
| 1592 | 1592 | .llvm_name = "xcvmac", |
| 1593 | 1593 | .description = "'XCVmac' (CORE-V Multiply-Accumulate)", |
| 1594 | 1594 | .dependencies = featureSet(&[_]Feature{}), |
| 1595 | 1595 | }; |
| 1596 | result[@intFromEnum(Feature.xcvmem)] = .{ | |
| 1596 | result[@backingInt(Feature.xcvmem)] = .{ | |
| 1597 | 1597 | .llvm_name = "xcvmem", |
| 1598 | 1598 | .description = "'XCVmem' (CORE-V Post-incrementing Load & Store)", |
| 1599 | 1599 | .dependencies = featureSet(&[_]Feature{}), |
| 1600 | 1600 | }; |
| 1601 | result[@intFromEnum(Feature.xcvsimd)] = .{ | |
| 1601 | result[@backingInt(Feature.xcvsimd)] = .{ | |
| 1602 | 1602 | .llvm_name = "xcvsimd", |
| 1603 | 1603 | .description = "'XCVsimd' (CORE-V SIMD ALU)", |
| 1604 | 1604 | .dependencies = featureSet(&[_]Feature{}), |
| 1605 | 1605 | }; |
| 1606 | result[@intFromEnum(Feature.xmipscbop)] = .{ | |
| 1606 | result[@backingInt(Feature.xmipscbop)] = .{ | |
| 1607 | 1607 | .llvm_name = "xmipscbop", |
| 1608 | 1608 | .description = "'XMIPSCBOP' (MIPS Software Prefetch)", |
| 1609 | 1609 | .dependencies = featureSet(&[_]Feature{}), |
| 1610 | 1610 | }; |
| 1611 | result[@intFromEnum(Feature.xmipscmov)] = .{ | |
| 1611 | result[@backingInt(Feature.xmipscmov)] = .{ | |
| 1612 | 1612 | .llvm_name = "xmipscmov", |
| 1613 | 1613 | .description = "'XMIPSCMov' (MIPS conditional move instruction (mips.ccmov))", |
| 1614 | 1614 | .dependencies = featureSet(&[_]Feature{}), |
| 1615 | 1615 | }; |
| 1616 | result[@intFromEnum(Feature.xmipsexectl)] = .{ | |
| 1616 | result[@backingInt(Feature.xmipsexectl)] = .{ | |
| 1617 | 1617 | .llvm_name = "xmipsexectl", |
| 1618 | 1618 | .description = "'XMIPSEXECTL' (MIPS execution control)", |
| 1619 | 1619 | .dependencies = featureSet(&[_]Feature{}), |
| 1620 | 1620 | }; |
| 1621 | result[@intFromEnum(Feature.xmipslsp)] = .{ | |
| 1621 | result[@backingInt(Feature.xmipslsp)] = .{ | |
| 1622 | 1622 | .llvm_name = "xmipslsp", |
| 1623 | 1623 | .description = "'XMIPSLSP' (MIPS optimization for hardware load-store bonding)", |
| 1624 | 1624 | .dependencies = featureSet(&[_]Feature{}), |
| 1625 | 1625 | }; |
| 1626 | result[@intFromEnum(Feature.xqccmp)] = .{ | |
| 1626 | result[@backingInt(Feature.xqccmp)] = .{ | |
| 1627 | 1627 | .llvm_name = "xqccmp", |
| 1628 | 1628 | .description = "'Xqccmp' (Qualcomm 16-bit Push/Pop and Double Moves)", |
| 1629 | 1629 | .dependencies = featureSet(&[_]Feature{ |
| 1630 | 1630 | .zca, |
| 1631 | 1631 | }), |
| 1632 | 1632 | }; |
| 1633 | result[@intFromEnum(Feature.xqci)] = .{ | |
| 1633 | result[@backingInt(Feature.xqci)] = .{ | |
| 1634 | 1634 | .llvm_name = "xqci", |
| 1635 | 1635 | .description = "'Xqci' (Qualcomm uC Extension)", |
| 1636 | 1636 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1654,124 +1654,124 @@ pub const all_features = blk: { |
| 1654 | 1654 | .xqcisync, |
| 1655 | 1655 | }), |
| 1656 | 1656 | }; |
| 1657 | result[@intFromEnum(Feature.xqcia)] = .{ | |
| 1657 | result[@backingInt(Feature.xqcia)] = .{ | |
| 1658 | 1658 | .llvm_name = "xqcia", |
| 1659 | 1659 | .description = "'Xqcia' (Qualcomm uC Arithmetic Extension)", |
| 1660 | 1660 | .dependencies = featureSet(&[_]Feature{}), |
| 1661 | 1661 | }; |
| 1662 | result[@intFromEnum(Feature.xqciac)] = .{ | |
| 1662 | result[@backingInt(Feature.xqciac)] = .{ | |
| 1663 | 1663 | .llvm_name = "xqciac", |
| 1664 | 1664 | .description = "'Xqciac' (Qualcomm uC Load-Store Address Calculation Extension)", |
| 1665 | 1665 | .dependencies = featureSet(&[_]Feature{ |
| 1666 | 1666 | .zca, |
| 1667 | 1667 | }), |
| 1668 | 1668 | }; |
| 1669 | result[@intFromEnum(Feature.xqcibi)] = .{ | |
| 1669 | result[@backingInt(Feature.xqcibi)] = .{ | |
| 1670 | 1670 | .llvm_name = "xqcibi", |
| 1671 | 1671 | .description = "'Xqcibi' (Qualcomm uC Branch Immediate Extension)", |
| 1672 | 1672 | .dependencies = featureSet(&[_]Feature{ |
| 1673 | 1673 | .zca, |
| 1674 | 1674 | }), |
| 1675 | 1675 | }; |
| 1676 | result[@intFromEnum(Feature.xqcibm)] = .{ | |
| 1676 | result[@backingInt(Feature.xqcibm)] = .{ | |
| 1677 | 1677 | .llvm_name = "xqcibm", |
| 1678 | 1678 | .description = "'Xqcibm' (Qualcomm uC Bit Manipulation Extension)", |
| 1679 | 1679 | .dependencies = featureSet(&[_]Feature{ |
| 1680 | 1680 | .zca, |
| 1681 | 1681 | }), |
| 1682 | 1682 | }; |
| 1683 | result[@intFromEnum(Feature.xqcicli)] = .{ | |
| 1683 | result[@backingInt(Feature.xqcicli)] = .{ | |
| 1684 | 1684 | .llvm_name = "xqcicli", |
| 1685 | 1685 | .description = "'Xqcicli' (Qualcomm uC Conditional Load Immediate Extension)", |
| 1686 | 1686 | .dependencies = featureSet(&[_]Feature{}), |
| 1687 | 1687 | }; |
| 1688 | result[@intFromEnum(Feature.xqcicm)] = .{ | |
| 1688 | result[@backingInt(Feature.xqcicm)] = .{ | |
| 1689 | 1689 | .llvm_name = "xqcicm", |
| 1690 | 1690 | .description = "'Xqcicm' (Qualcomm uC Conditional Move Extension)", |
| 1691 | 1691 | .dependencies = featureSet(&[_]Feature{ |
| 1692 | 1692 | .zca, |
| 1693 | 1693 | }), |
| 1694 | 1694 | }; |
| 1695 | result[@intFromEnum(Feature.xqcics)] = .{ | |
| 1695 | result[@backingInt(Feature.xqcics)] = .{ | |
| 1696 | 1696 | .llvm_name = "xqcics", |
| 1697 | 1697 | .description = "'Xqcics' (Qualcomm uC Conditional Select Extension)", |
| 1698 | 1698 | .dependencies = featureSet(&[_]Feature{}), |
| 1699 | 1699 | }; |
| 1700 | result[@intFromEnum(Feature.xqcicsr)] = .{ | |
| 1700 | result[@backingInt(Feature.xqcicsr)] = .{ | |
| 1701 | 1701 | .llvm_name = "xqcicsr", |
| 1702 | 1702 | .description = "'Xqcicsr' (Qualcomm uC CSR Extension)", |
| 1703 | 1703 | .dependencies = featureSet(&[_]Feature{}), |
| 1704 | 1704 | }; |
| 1705 | result[@intFromEnum(Feature.xqciint)] = .{ | |
| 1705 | result[@backingInt(Feature.xqciint)] = .{ | |
| 1706 | 1706 | .llvm_name = "xqciint", |
| 1707 | 1707 | .description = "'Xqciint' (Qualcomm uC Interrupts Extension)", |
| 1708 | 1708 | .dependencies = featureSet(&[_]Feature{ |
| 1709 | 1709 | .zca, |
| 1710 | 1710 | }), |
| 1711 | 1711 | }; |
| 1712 | result[@intFromEnum(Feature.xqciio)] = .{ | |
| 1712 | result[@backingInt(Feature.xqciio)] = .{ | |
| 1713 | 1713 | .llvm_name = "xqciio", |
| 1714 | 1714 | .description = "'Xqciio' (Qualcomm uC External Input Output Extension)", |
| 1715 | 1715 | .dependencies = featureSet(&[_]Feature{}), |
| 1716 | 1716 | }; |
| 1717 | result[@intFromEnum(Feature.xqcilb)] = .{ | |
| 1717 | result[@backingInt(Feature.xqcilb)] = .{ | |
| 1718 | 1718 | .llvm_name = "xqcilb", |
| 1719 | 1719 | .description = "'Xqcilb' (Qualcomm uC Long Branch Extension)", |
| 1720 | 1720 | .dependencies = featureSet(&[_]Feature{ |
| 1721 | 1721 | .zca, |
| 1722 | 1722 | }), |
| 1723 | 1723 | }; |
| 1724 | result[@intFromEnum(Feature.xqcili)] = .{ | |
| 1724 | result[@backingInt(Feature.xqcili)] = .{ | |
| 1725 | 1725 | .llvm_name = "xqcili", |
| 1726 | 1726 | .description = "'Xqcili' (Qualcomm uC Load Large Immediate Extension)", |
| 1727 | 1727 | .dependencies = featureSet(&[_]Feature{ |
| 1728 | 1728 | .zca, |
| 1729 | 1729 | }), |
| 1730 | 1730 | }; |
| 1731 | result[@intFromEnum(Feature.xqcilia)] = .{ | |
| 1731 | result[@backingInt(Feature.xqcilia)] = .{ | |
| 1732 | 1732 | .llvm_name = "xqcilia", |
| 1733 | 1733 | .description = "'Xqcilia' (Qualcomm uC Large Immediate Arithmetic Extension)", |
| 1734 | 1734 | .dependencies = featureSet(&[_]Feature{ |
| 1735 | 1735 | .zca, |
| 1736 | 1736 | }), |
| 1737 | 1737 | }; |
| 1738 | result[@intFromEnum(Feature.xqcilo)] = .{ | |
| 1738 | result[@backingInt(Feature.xqcilo)] = .{ | |
| 1739 | 1739 | .llvm_name = "xqcilo", |
| 1740 | 1740 | .description = "'Xqcilo' (Qualcomm uC Large Offset Load Store Extension)", |
| 1741 | 1741 | .dependencies = featureSet(&[_]Feature{ |
| 1742 | 1742 | .zca, |
| 1743 | 1743 | }), |
| 1744 | 1744 | }; |
| 1745 | result[@intFromEnum(Feature.xqcilsm)] = .{ | |
| 1745 | result[@backingInt(Feature.xqcilsm)] = .{ | |
| 1746 | 1746 | .llvm_name = "xqcilsm", |
| 1747 | 1747 | .description = "'Xqcilsm' (Qualcomm uC Load Store Multiple Extension)", |
| 1748 | 1748 | .dependencies = featureSet(&[_]Feature{}), |
| 1749 | 1749 | }; |
| 1750 | result[@intFromEnum(Feature.xqcisim)] = .{ | |
| 1750 | result[@backingInt(Feature.xqcisim)] = .{ | |
| 1751 | 1751 | .llvm_name = "xqcisim", |
| 1752 | 1752 | .description = "'Xqcisim' (Qualcomm uC Simulation Hint Extension)", |
| 1753 | 1753 | .dependencies = featureSet(&[_]Feature{ |
| 1754 | 1754 | .zca, |
| 1755 | 1755 | }), |
| 1756 | 1756 | }; |
| 1757 | result[@intFromEnum(Feature.xqcisls)] = .{ | |
| 1757 | result[@backingInt(Feature.xqcisls)] = .{ | |
| 1758 | 1758 | .llvm_name = "xqcisls", |
| 1759 | 1759 | .description = "'Xqcisls' (Qualcomm uC Scaled Load Store Extension)", |
| 1760 | 1760 | .dependencies = featureSet(&[_]Feature{}), |
| 1761 | 1761 | }; |
| 1762 | result[@intFromEnum(Feature.xqcisync)] = .{ | |
| 1762 | result[@backingInt(Feature.xqcisync)] = .{ | |
| 1763 | 1763 | .llvm_name = "xqcisync", |
| 1764 | 1764 | .description = "'Xqcisync' (Qualcomm uC Sync Delay Extension)", |
| 1765 | 1765 | .dependencies = featureSet(&[_]Feature{ |
| 1766 | 1766 | .zca, |
| 1767 | 1767 | }), |
| 1768 | 1768 | }; |
| 1769 | result[@intFromEnum(Feature.xsfcease)] = .{ | |
| 1769 | result[@backingInt(Feature.xsfcease)] = .{ | |
| 1770 | 1770 | .llvm_name = "xsfcease", |
| 1771 | 1771 | .description = "'XSfcease' (SiFive sf.cease Instruction)", |
| 1772 | 1772 | .dependencies = featureSet(&[_]Feature{}), |
| 1773 | 1773 | }; |
| 1774 | result[@intFromEnum(Feature.xsfmm128t)] = .{ | |
| 1774 | result[@backingInt(Feature.xsfmm128t)] = .{ | |
| 1775 | 1775 | .llvm_name = "xsfmm128t", |
| 1776 | 1776 | .description = "'XSfmm128t' (TE=128 configuration)", |
| 1777 | 1777 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1779,7 +1779,7 @@ pub const all_features = blk: { |
| 1779 | 1779 | .zvl512b, |
| 1780 | 1780 | }), |
| 1781 | 1781 | }; |
| 1782 | result[@intFromEnum(Feature.xsfmm16t)] = .{ | |
| 1782 | result[@backingInt(Feature.xsfmm16t)] = .{ | |
| 1783 | 1783 | .llvm_name = "xsfmm16t", |
| 1784 | 1784 | .description = "'XSfmm16t' (TE=16 configuration)", |
| 1785 | 1785 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1787,7 +1787,7 @@ pub const all_features = blk: { |
| 1787 | 1787 | .zvl64b, |
| 1788 | 1788 | }), |
| 1789 | 1789 | }; |
| 1790 | result[@intFromEnum(Feature.xsfmm32a16f)] = .{ | |
| 1790 | result[@backingInt(Feature.xsfmm32a16f)] = .{ | |
| 1791 | 1791 | .llvm_name = "xsfmm32a16f", |
| 1792 | 1792 | .description = "'XSfmm32a16f' (TEW=32-bit accumulation, operands - float: 16b, widen=2 (IEEE, BF))", |
| 1793 | 1793 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1795,7 +1795,7 @@ pub const all_features = blk: { |
| 1795 | 1795 | .zve32f, |
| 1796 | 1796 | }), |
| 1797 | 1797 | }; |
| 1798 | result[@intFromEnum(Feature.xsfmm32a32f)] = .{ | |
| 1798 | result[@backingInt(Feature.xsfmm32a32f)] = .{ | |
| 1799 | 1799 | .llvm_name = "xsfmm32a32f", |
| 1800 | 1800 | .description = "'XSfmm32a32f' (TEW=32-bit accumulation, operands - float: 32b)", |
| 1801 | 1801 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1803,7 +1803,7 @@ pub const all_features = blk: { |
| 1803 | 1803 | .zve32f, |
| 1804 | 1804 | }), |
| 1805 | 1805 | }; |
| 1806 | result[@intFromEnum(Feature.xsfmm32a8f)] = .{ | |
| 1806 | result[@backingInt(Feature.xsfmm32a8f)] = .{ | |
| 1807 | 1807 | .llvm_name = "xsfmm32a8f", |
| 1808 | 1808 | .description = "'XSfmm32a8f' (TEW=32-bit accumulation, operands - float: fp8)", |
| 1809 | 1809 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1811,14 +1811,14 @@ pub const all_features = blk: { |
| 1811 | 1811 | .zve32f, |
| 1812 | 1812 | }), |
| 1813 | 1813 | }; |
| 1814 | result[@intFromEnum(Feature.xsfmm32a8i)] = .{ | |
| 1814 | result[@backingInt(Feature.xsfmm32a8i)] = .{ | |
| 1815 | 1815 | .llvm_name = "xsfmm32a8i", |
| 1816 | 1816 | .description = "'XSfmm32a8i' (TEW=32-bit accumulation, operands - int: 8b)", |
| 1817 | 1817 | .dependencies = featureSet(&[_]Feature{ |
| 1818 | 1818 | .xsfmmbase, |
| 1819 | 1819 | }), |
| 1820 | 1820 | }; |
| 1821 | result[@intFromEnum(Feature.xsfmm32t)] = .{ | |
| 1821 | result[@backingInt(Feature.xsfmm32t)] = .{ | |
| 1822 | 1822 | .llvm_name = "xsfmm32t", |
| 1823 | 1823 | .description = "'XSfmm32t' (TE=32 configuration)", |
| 1824 | 1824 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1826,7 +1826,7 @@ pub const all_features = blk: { |
| 1826 | 1826 | .zvl128b, |
| 1827 | 1827 | }), |
| 1828 | 1828 | }; |
| 1829 | result[@intFromEnum(Feature.xsfmm64a64f)] = .{ | |
| 1829 | result[@backingInt(Feature.xsfmm64a64f)] = .{ | |
| 1830 | 1830 | .llvm_name = "xsfmm64a64f", |
| 1831 | 1831 | .description = "'XSfmm64a64f' (TEW=64-bit accumulation, operands - float: fp64)", |
| 1832 | 1832 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1834,7 +1834,7 @@ pub const all_features = blk: { |
| 1834 | 1834 | .zve64d, |
| 1835 | 1835 | }), |
| 1836 | 1836 | }; |
| 1837 | result[@intFromEnum(Feature.xsfmm64t)] = .{ | |
| 1837 | result[@backingInt(Feature.xsfmm64t)] = .{ | |
| 1838 | 1838 | .llvm_name = "xsfmm64t", |
| 1839 | 1839 | .description = "'XSfmm64t' (TE=64 configuration)", |
| 1840 | 1840 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1842,47 +1842,47 @@ pub const all_features = blk: { |
| 1842 | 1842 | .zvl256b, |
| 1843 | 1843 | }), |
| 1844 | 1844 | }; |
| 1845 | result[@intFromEnum(Feature.xsfmmbase)] = .{ | |
| 1845 | result[@backingInt(Feature.xsfmmbase)] = .{ | |
| 1846 | 1846 | .llvm_name = "xsfmmbase", |
| 1847 | 1847 | .description = "'XSfmmbase' (All non arithmetic instructions for all TEWs and sf.vtzero)", |
| 1848 | 1848 | .dependencies = featureSet(&[_]Feature{ |
| 1849 | 1849 | .zve32x, |
| 1850 | 1850 | }), |
| 1851 | 1851 | }; |
| 1852 | result[@intFromEnum(Feature.xsfvcp)] = .{ | |
| 1852 | result[@backingInt(Feature.xsfvcp)] = .{ | |
| 1853 | 1853 | .llvm_name = "xsfvcp", |
| 1854 | 1854 | .description = "'XSfvcp' (SiFive Custom Vector Coprocessor Interface Instructions)", |
| 1855 | 1855 | .dependencies = featureSet(&[_]Feature{ |
| 1856 | 1856 | .zve32x, |
| 1857 | 1857 | }), |
| 1858 | 1858 | }; |
| 1859 | result[@intFromEnum(Feature.xsfvfbfexp16e)] = .{ | |
| 1859 | result[@backingInt(Feature.xsfvfbfexp16e)] = .{ | |
| 1860 | 1860 | .llvm_name = "xsfvfbfexp16e", |
| 1861 | 1861 | .description = "'XSfvfbfexp16e' (SiFive Vector Floating-Point Exponential Function Instruction, BFloat16)", |
| 1862 | 1862 | .dependencies = featureSet(&[_]Feature{}), |
| 1863 | 1863 | }; |
| 1864 | result[@intFromEnum(Feature.xsfvfexp16e)] = .{ | |
| 1864 | result[@backingInt(Feature.xsfvfexp16e)] = .{ | |
| 1865 | 1865 | .llvm_name = "xsfvfexp16e", |
| 1866 | 1866 | .description = "'XSfvfexp16e' (SiFive Vector Floating-Point Exponential Function Instruction, Half Precision)", |
| 1867 | 1867 | .dependencies = featureSet(&[_]Feature{ |
| 1868 | 1868 | .zvfh, |
| 1869 | 1869 | }), |
| 1870 | 1870 | }; |
| 1871 | result[@intFromEnum(Feature.xsfvfexp32e)] = .{ | |
| 1871 | result[@backingInt(Feature.xsfvfexp32e)] = .{ | |
| 1872 | 1872 | .llvm_name = "xsfvfexp32e", |
| 1873 | 1873 | .description = "'XSfvfexp32e' (SiFive Vector Floating-Point Exponential Function Instruction, Single Precision)", |
| 1874 | 1874 | .dependencies = featureSet(&[_]Feature{ |
| 1875 | 1875 | .zve32f, |
| 1876 | 1876 | }), |
| 1877 | 1877 | }; |
| 1878 | result[@intFromEnum(Feature.xsfvfexpa)] = .{ | |
| 1878 | result[@backingInt(Feature.xsfvfexpa)] = .{ | |
| 1879 | 1879 | .llvm_name = "xsfvfexpa", |
| 1880 | 1880 | .description = "'XSfvfexpa' (SiFive Vector Floating-Point Exponential Approximation Instruction)", |
| 1881 | 1881 | .dependencies = featureSet(&[_]Feature{ |
| 1882 | 1882 | .zve32f, |
| 1883 | 1883 | }), |
| 1884 | 1884 | }; |
| 1885 | result[@intFromEnum(Feature.xsfvfexpa64e)] = .{ | |
| 1885 | result[@backingInt(Feature.xsfvfexpa64e)] = .{ | |
| 1886 | 1886 | .llvm_name = "xsfvfexpa64e", |
| 1887 | 1887 | .description = "'XSfvfexpa64e' (SiFive Vector Floating-Point Exponential Approximation Instruction with Double-Precision)", |
| 1888 | 1888 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1890,14 +1890,14 @@ pub const all_features = blk: { |
| 1890 | 1890 | .zve64d, |
| 1891 | 1891 | }), |
| 1892 | 1892 | }; |
| 1893 | result[@intFromEnum(Feature.xsfvfnrclipxfqf)] = .{ | |
| 1893 | result[@backingInt(Feature.xsfvfnrclipxfqf)] = .{ | |
| 1894 | 1894 | .llvm_name = "xsfvfnrclipxfqf", |
| 1895 | 1895 | .description = "'XSfvfnrclipxfqf' (SiFive FP32-to-int8 Ranged Clip Instructions)", |
| 1896 | 1896 | .dependencies = featureSet(&[_]Feature{ |
| 1897 | 1897 | .zve32f, |
| 1898 | 1898 | }), |
| 1899 | 1899 | }; |
| 1900 | result[@intFromEnum(Feature.xsfvfwmaccqqq)] = .{ | |
| 1900 | result[@backingInt(Feature.xsfvfwmaccqqq)] = .{ | |
| 1901 | 1901 | .llvm_name = "xsfvfwmaccqqq", |
| 1902 | 1902 | .description = "'XSfvfwmaccqqq' (SiFive Matrix Multiply Accumulate Instruction (4-by-4))", |
| 1903 | 1903 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1905,7 +1905,7 @@ pub const all_features = blk: { |
| 1905 | 1905 | .zvl128b, |
| 1906 | 1906 | }), |
| 1907 | 1907 | }; |
| 1908 | result[@intFromEnum(Feature.xsfvqmaccdod)] = .{ | |
| 1908 | result[@backingInt(Feature.xsfvqmaccdod)] = .{ | |
| 1909 | 1909 | .llvm_name = "xsfvqmaccdod", |
| 1910 | 1910 | .description = "'XSfvqmaccdod' (SiFive Int8 Matrix Multiplication Instructions (2-by-8 and 8-by-2))", |
| 1911 | 1911 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1913,7 +1913,7 @@ pub const all_features = blk: { |
| 1913 | 1913 | .zvl128b, |
| 1914 | 1914 | }), |
| 1915 | 1915 | }; |
| 1916 | result[@intFromEnum(Feature.xsfvqmaccqoq)] = .{ | |
| 1916 | result[@backingInt(Feature.xsfvqmaccqoq)] = .{ | |
| 1917 | 1917 | .llvm_name = "xsfvqmaccqoq", |
| 1918 | 1918 | .description = "'XSfvqmaccqoq' (SiFive Int8 Matrix Multiplication Instructions (4-by-8 and 8-by-4))", |
| 1919 | 1919 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1921,189 +1921,189 @@ pub const all_features = blk: { |
| 1921 | 1921 | .zvl256b, |
| 1922 | 1922 | }), |
| 1923 | 1923 | }; |
| 1924 | result[@intFromEnum(Feature.xsifivecdiscarddlone)] = .{ | |
| 1924 | result[@backingInt(Feature.xsifivecdiscarddlone)] = .{ | |
| 1925 | 1925 | .llvm_name = "xsifivecdiscarddlone", |
| 1926 | 1926 | .description = "'XSiFivecdiscarddlone' (SiFive sf.cdiscard.d.l1 Instruction)", |
| 1927 | 1927 | .dependencies = featureSet(&[_]Feature{}), |
| 1928 | 1928 | }; |
| 1929 | result[@intFromEnum(Feature.xsifivecflushdlone)] = .{ | |
| 1929 | result[@backingInt(Feature.xsifivecflushdlone)] = .{ | |
| 1930 | 1930 | .llvm_name = "xsifivecflushdlone", |
| 1931 | 1931 | .description = "'XSiFivecflushdlone' (SiFive sf.cflush.d.l1 Instruction)", |
| 1932 | 1932 | .dependencies = featureSet(&[_]Feature{}), |
| 1933 | 1933 | }; |
| 1934 | result[@intFromEnum(Feature.xsmtvdot)] = .{ | |
| 1934 | result[@backingInt(Feature.xsmtvdot)] = .{ | |
| 1935 | 1935 | .llvm_name = "xsmtvdot", |
| 1936 | 1936 | .description = "'XSMTVDot' (SpacemiT Vector Dot Product Extension)", |
| 1937 | 1937 | .dependencies = featureSet(&[_]Feature{ |
| 1938 | 1938 | .zve32f, |
| 1939 | 1939 | }), |
| 1940 | 1940 | }; |
| 1941 | result[@intFromEnum(Feature.xtheadba)] = .{ | |
| 1941 | result[@backingInt(Feature.xtheadba)] = .{ | |
| 1942 | 1942 | .llvm_name = "xtheadba", |
| 1943 | 1943 | .description = "'XTHeadBa' (T-Head address calculation instructions)", |
| 1944 | 1944 | .dependencies = featureSet(&[_]Feature{}), |
| 1945 | 1945 | }; |
| 1946 | result[@intFromEnum(Feature.xtheadbb)] = .{ | |
| 1946 | result[@backingInt(Feature.xtheadbb)] = .{ | |
| 1947 | 1947 | .llvm_name = "xtheadbb", |
| 1948 | 1948 | .description = "'XTHeadBb' (T-Head basic bit-manipulation instructions)", |
| 1949 | 1949 | .dependencies = featureSet(&[_]Feature{}), |
| 1950 | 1950 | }; |
| 1951 | result[@intFromEnum(Feature.xtheadbs)] = .{ | |
| 1951 | result[@backingInt(Feature.xtheadbs)] = .{ | |
| 1952 | 1952 | .llvm_name = "xtheadbs", |
| 1953 | 1953 | .description = "'XTHeadBs' (T-Head single-bit instructions)", |
| 1954 | 1954 | .dependencies = featureSet(&[_]Feature{}), |
| 1955 | 1955 | }; |
| 1956 | result[@intFromEnum(Feature.xtheadcmo)] = .{ | |
| 1956 | result[@backingInt(Feature.xtheadcmo)] = .{ | |
| 1957 | 1957 | .llvm_name = "xtheadcmo", |
| 1958 | 1958 | .description = "'XTHeadCmo' (T-Head cache management instructions)", |
| 1959 | 1959 | .dependencies = featureSet(&[_]Feature{}), |
| 1960 | 1960 | }; |
| 1961 | result[@intFromEnum(Feature.xtheadcondmov)] = .{ | |
| 1961 | result[@backingInt(Feature.xtheadcondmov)] = .{ | |
| 1962 | 1962 | .llvm_name = "xtheadcondmov", |
| 1963 | 1963 | .description = "'XTHeadCondMov' (T-Head conditional move instructions)", |
| 1964 | 1964 | .dependencies = featureSet(&[_]Feature{}), |
| 1965 | 1965 | }; |
| 1966 | result[@intFromEnum(Feature.xtheadfmemidx)] = .{ | |
| 1966 | result[@backingInt(Feature.xtheadfmemidx)] = .{ | |
| 1967 | 1967 | .llvm_name = "xtheadfmemidx", |
| 1968 | 1968 | .description = "'XTHeadFMemIdx' (T-Head FP Indexed Memory Operations)", |
| 1969 | 1969 | .dependencies = featureSet(&[_]Feature{}), |
| 1970 | 1970 | }; |
| 1971 | result[@intFromEnum(Feature.xtheadmac)] = .{ | |
| 1971 | result[@backingInt(Feature.xtheadmac)] = .{ | |
| 1972 | 1972 | .llvm_name = "xtheadmac", |
| 1973 | 1973 | .description = "'XTHeadMac' (T-Head Multiply-Accumulate Instructions)", |
| 1974 | 1974 | .dependencies = featureSet(&[_]Feature{}), |
| 1975 | 1975 | }; |
| 1976 | result[@intFromEnum(Feature.xtheadmemidx)] = .{ | |
| 1976 | result[@backingInt(Feature.xtheadmemidx)] = .{ | |
| 1977 | 1977 | .llvm_name = "xtheadmemidx", |
| 1978 | 1978 | .description = "'XTHeadMemIdx' (T-Head Indexed Memory Operations)", |
| 1979 | 1979 | .dependencies = featureSet(&[_]Feature{}), |
| 1980 | 1980 | }; |
| 1981 | result[@intFromEnum(Feature.xtheadmempair)] = .{ | |
| 1981 | result[@backingInt(Feature.xtheadmempair)] = .{ | |
| 1982 | 1982 | .llvm_name = "xtheadmempair", |
| 1983 | 1983 | .description = "'XTHeadMemPair' (T-Head two-GPR Memory Operations)", |
| 1984 | 1984 | .dependencies = featureSet(&[_]Feature{}), |
| 1985 | 1985 | }; |
| 1986 | result[@intFromEnum(Feature.xtheadsync)] = .{ | |
| 1986 | result[@backingInt(Feature.xtheadsync)] = .{ | |
| 1987 | 1987 | .llvm_name = "xtheadsync", |
| 1988 | 1988 | .description = "'XTHeadSync' (T-Head multicore synchronization instructions)", |
| 1989 | 1989 | .dependencies = featureSet(&[_]Feature{}), |
| 1990 | 1990 | }; |
| 1991 | result[@intFromEnum(Feature.xtheadvdot)] = .{ | |
| 1991 | result[@backingInt(Feature.xtheadvdot)] = .{ | |
| 1992 | 1992 | .llvm_name = "xtheadvdot", |
| 1993 | 1993 | .description = "'XTHeadVdot' (T-Head Vector Extensions for Dot)", |
| 1994 | 1994 | .dependencies = featureSet(&[_]Feature{ |
| 1995 | 1995 | .v, |
| 1996 | 1996 | }), |
| 1997 | 1997 | }; |
| 1998 | result[@intFromEnum(Feature.xventanacondops)] = .{ | |
| 1998 | result[@backingInt(Feature.xventanacondops)] = .{ | |
| 1999 | 1999 | .llvm_name = "xventanacondops", |
| 2000 | 2000 | .description = "'XVentanaCondOps' (Ventana Conditional Ops)", |
| 2001 | 2001 | .dependencies = featureSet(&[_]Feature{}), |
| 2002 | 2002 | }; |
| 2003 | result[@intFromEnum(Feature.xwchc)] = .{ | |
| 2003 | result[@backingInt(Feature.xwchc)] = .{ | |
| 2004 | 2004 | .llvm_name = "xwchc", |
| 2005 | 2005 | .description = "'Xwchc' (WCH/QingKe additional compressed opcodes)", |
| 2006 | 2006 | .dependencies = featureSet(&[_]Feature{ |
| 2007 | 2007 | .zca, |
| 2008 | 2008 | }), |
| 2009 | 2009 | }; |
| 2010 | result[@intFromEnum(Feature.za128rs)] = .{ | |
| 2010 | result[@backingInt(Feature.za128rs)] = .{ | |
| 2011 | 2011 | .llvm_name = "za128rs", |
| 2012 | 2012 | .description = "'Za128rs' (Reservation Set Size of at Most 128 Bytes)", |
| 2013 | 2013 | .dependencies = featureSet(&[_]Feature{}), |
| 2014 | 2014 | }; |
| 2015 | result[@intFromEnum(Feature.za64rs)] = .{ | |
| 2015 | result[@backingInt(Feature.za64rs)] = .{ | |
| 2016 | 2016 | .llvm_name = "za64rs", |
| 2017 | 2017 | .description = "'Za64rs' (Reservation Set Size of at Most 64 Bytes)", |
| 2018 | 2018 | .dependencies = featureSet(&[_]Feature{}), |
| 2019 | 2019 | }; |
| 2020 | result[@intFromEnum(Feature.zaamo)] = .{ | |
| 2020 | result[@backingInt(Feature.zaamo)] = .{ | |
| 2021 | 2021 | .llvm_name = "zaamo", |
| 2022 | 2022 | .description = "'Zaamo' (Atomic Memory Operations)", |
| 2023 | 2023 | .dependencies = featureSet(&[_]Feature{}), |
| 2024 | 2024 | }; |
| 2025 | result[@intFromEnum(Feature.zabha)] = .{ | |
| 2025 | result[@backingInt(Feature.zabha)] = .{ | |
| 2026 | 2026 | .llvm_name = "zabha", |
| 2027 | 2027 | .description = "'Zabha' (Byte and Halfword Atomic Memory Operations)", |
| 2028 | 2028 | .dependencies = featureSet(&[_]Feature{ |
| 2029 | 2029 | .zaamo, |
| 2030 | 2030 | }), |
| 2031 | 2031 | }; |
| 2032 | result[@intFromEnum(Feature.zacas)] = .{ | |
| 2032 | result[@backingInt(Feature.zacas)] = .{ | |
| 2033 | 2033 | .llvm_name = "zacas", |
| 2034 | 2034 | .description = "'Zacas' (Atomic Compare-And-Swap Instructions)", |
| 2035 | 2035 | .dependencies = featureSet(&[_]Feature{ |
| 2036 | 2036 | .zaamo, |
| 2037 | 2037 | }), |
| 2038 | 2038 | }; |
| 2039 | result[@intFromEnum(Feature.zalasr)] = .{ | |
| 2039 | result[@backingInt(Feature.zalasr)] = .{ | |
| 2040 | 2040 | .llvm_name = "zalasr", |
| 2041 | 2041 | .description = "'Zalasr' (Load-Acquire and Store-Release Instructions)", |
| 2042 | 2042 | .dependencies = featureSet(&[_]Feature{}), |
| 2043 | 2043 | }; |
| 2044 | result[@intFromEnum(Feature.zalrsc)] = .{ | |
| 2044 | result[@backingInt(Feature.zalrsc)] = .{ | |
| 2045 | 2045 | .llvm_name = "zalrsc", |
| 2046 | 2046 | .description = "'Zalrsc' (Load-Reserved/Store-Conditional)", |
| 2047 | 2047 | .dependencies = featureSet(&[_]Feature{}), |
| 2048 | 2048 | }; |
| 2049 | result[@intFromEnum(Feature.zama16b)] = .{ | |
| 2049 | result[@backingInt(Feature.zama16b)] = .{ | |
| 2050 | 2050 | .llvm_name = "zama16b", |
| 2051 | 2051 | .description = "'Zama16b' (Atomic 16-byte misaligned loads, stores and AMOs)", |
| 2052 | 2052 | .dependencies = featureSet(&[_]Feature{}), |
| 2053 | 2053 | }; |
| 2054 | result[@intFromEnum(Feature.zawrs)] = .{ | |
| 2054 | result[@backingInt(Feature.zawrs)] = .{ | |
| 2055 | 2055 | .llvm_name = "zawrs", |
| 2056 | 2056 | .description = "'Zawrs' (Wait on Reservation Set)", |
| 2057 | 2057 | .dependencies = featureSet(&[_]Feature{}), |
| 2058 | 2058 | }; |
| 2059 | result[@intFromEnum(Feature.zba)] = .{ | |
| 2059 | result[@backingInt(Feature.zba)] = .{ | |
| 2060 | 2060 | .llvm_name = "zba", |
| 2061 | 2061 | .description = "'Zba' (Address Generation Instructions)", |
| 2062 | 2062 | .dependencies = featureSet(&[_]Feature{}), |
| 2063 | 2063 | }; |
| 2064 | result[@intFromEnum(Feature.zbb)] = .{ | |
| 2064 | result[@backingInt(Feature.zbb)] = .{ | |
| 2065 | 2065 | .llvm_name = "zbb", |
| 2066 | 2066 | .description = "'Zbb' (Basic Bit-Manipulation)", |
| 2067 | 2067 | .dependencies = featureSet(&[_]Feature{}), |
| 2068 | 2068 | }; |
| 2069 | result[@intFromEnum(Feature.zbc)] = .{ | |
| 2069 | result[@backingInt(Feature.zbc)] = .{ | |
| 2070 | 2070 | .llvm_name = "zbc", |
| 2071 | 2071 | .description = "'Zbc' (Carry-Less Multiplication)", |
| 2072 | 2072 | .dependencies = featureSet(&[_]Feature{}), |
| 2073 | 2073 | }; |
| 2074 | result[@intFromEnum(Feature.zbkb)] = .{ | |
| 2074 | result[@backingInt(Feature.zbkb)] = .{ | |
| 2075 | 2075 | .llvm_name = "zbkb", |
| 2076 | 2076 | .description = "'Zbkb' (Bitmanip instructions for Cryptography)", |
| 2077 | 2077 | .dependencies = featureSet(&[_]Feature{}), |
| 2078 | 2078 | }; |
| 2079 | result[@intFromEnum(Feature.zbkc)] = .{ | |
| 2079 | result[@backingInt(Feature.zbkc)] = .{ | |
| 2080 | 2080 | .llvm_name = "zbkc", |
| 2081 | 2081 | .description = "'Zbkc' (Carry-less multiply instructions for Cryptography)", |
| 2082 | 2082 | .dependencies = featureSet(&[_]Feature{}), |
| 2083 | 2083 | }; |
| 2084 | result[@intFromEnum(Feature.zbkx)] = .{ | |
| 2084 | result[@backingInt(Feature.zbkx)] = .{ | |
| 2085 | 2085 | .llvm_name = "zbkx", |
| 2086 | 2086 | .description = "'Zbkx' (Crossbar permutation instructions)", |
| 2087 | 2087 | .dependencies = featureSet(&[_]Feature{}), |
| 2088 | 2088 | }; |
| 2089 | result[@intFromEnum(Feature.zbs)] = .{ | |
| 2089 | result[@backingInt(Feature.zbs)] = .{ | |
| 2090 | 2090 | .llvm_name = "zbs", |
| 2091 | 2091 | .description = "'Zbs' (Single-Bit Instructions)", |
| 2092 | 2092 | .dependencies = featureSet(&[_]Feature{}), |
| 2093 | 2093 | }; |
| 2094 | result[@intFromEnum(Feature.zca)] = .{ | |
| 2094 | result[@backingInt(Feature.zca)] = .{ | |
| 2095 | 2095 | .llvm_name = "zca", |
| 2096 | 2096 | .description = "'Zca' (part of the C extension, excluding compressed floating point loads/stores)", |
| 2097 | 2097 | .dependencies = featureSet(&[_]Feature{}), |
| 2098 | 2098 | }; |
| 2099 | result[@intFromEnum(Feature.zcb)] = .{ | |
| 2099 | result[@backingInt(Feature.zcb)] = .{ | |
| 2100 | 2100 | .llvm_name = "zcb", |
| 2101 | 2101 | .description = "'Zcb' (Compressed basic bit manipulation instructions)", |
| 2102 | 2102 | .dependencies = featureSet(&[_]Feature{ |
| 2103 | 2103 | .zca, |
| 2104 | 2104 | }), |
| 2105 | 2105 | }; |
| 2106 | result[@intFromEnum(Feature.zcd)] = .{ | |
| 2106 | result[@backingInt(Feature.zcd)] = .{ | |
| 2107 | 2107 | .llvm_name = "zcd", |
| 2108 | 2108 | .description = "'Zcd' (Compressed Double-Precision Floating-Point Instructions)", |
| 2109 | 2109 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -2111,7 +2111,7 @@ pub const all_features = blk: { |
| 2111 | 2111 | .zca, |
| 2112 | 2112 | }), |
| 2113 | 2113 | }; |
| 2114 | result[@intFromEnum(Feature.zce)] = .{ | |
| 2114 | result[@backingInt(Feature.zce)] = .{ | |
| 2115 | 2115 | .llvm_name = "zce", |
| 2116 | 2116 | .description = "'Zce' (Compressed extensions for microcontrollers)", |
| 2117 | 2117 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -2120,7 +2120,7 @@ pub const all_features = blk: { |
| 2120 | 2120 | .zcmt, |
| 2121 | 2121 | }), |
| 2122 | 2122 | }; |
| 2123 | result[@intFromEnum(Feature.zcf)] = .{ | |
| 2123 | result[@backingInt(Feature.zcf)] = .{ | |
| 2124 | 2124 | .llvm_name = "zcf", |
| 2125 | 2125 | .description = "'Zcf' (Compressed Single-Precision Floating-Point Instructions)", |
| 2126 | 2126 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -2128,7 +2128,7 @@ pub const all_features = blk: { |
| 2128 | 2128 | .zca, |
| 2129 | 2129 | }), |
| 2130 | 2130 | }; |
| 2131 | result[@intFromEnum(Feature.zclsd)] = .{ | |
| 2131 | result[@backingInt(Feature.zclsd)] = .{ | |
| 2132 | 2132 | .llvm_name = "zclsd", |
| 2133 | 2133 | .description = "'Zclsd' (Compressed Load/Store Pair Instructions)", |
| 2134 | 2134 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -2136,21 +2136,21 @@ pub const all_features = blk: { |
| 2136 | 2136 | .zilsd, |
| 2137 | 2137 | }), |
| 2138 | 2138 | }; |
| 2139 | result[@intFromEnum(Feature.zcmop)] = .{ | |
| 2139 | result[@backingInt(Feature.zcmop)] = .{ | |
| 2140 | 2140 | .llvm_name = "zcmop", |
| 2141 | 2141 | .description = "'Zcmop' (Compressed May-Be-Operations)", |
| 2142 | 2142 | .dependencies = featureSet(&[_]Feature{ |
| 2143 | 2143 | .zca, |
| 2144 | 2144 | }), |
| 2145 | 2145 | }; |
| 2146 | result[@intFromEnum(Feature.zcmp)] = .{ | |
| 2146 | result[@backingInt(Feature.zcmp)] = .{ | |
| 2147 | 2147 | .llvm_name = "zcmp", |
| 2148 | 2148 | .description = "'Zcmp' (sequenced instructions for code-size reduction)", |
| 2149 | 2149 | .dependencies = featureSet(&[_]Feature{ |
| 2150 | 2150 | .zca, |
| 2151 | 2151 | }), |
| 2152 | 2152 | }; |
| 2153 | result[@intFromEnum(Feature.zcmt)] = .{ | |
| 2153 | result[@backingInt(Feature.zcmt)] = .{ | |
| 2154 | 2154 | .llvm_name = "zcmt", |
| 2155 | 2155 | .description = "'Zcmt' (table jump instructions for code-size reduction)", |
| 2156 | 2156 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -2158,172 +2158,172 @@ pub const all_features = blk: { |
| 2158 | 2158 | .zicsr, |
| 2159 | 2159 | }), |
| 2160 | 2160 | }; |
| 2161 | result[@intFromEnum(Feature.zdinx)] = .{ | |
| 2161 | result[@backingInt(Feature.zdinx)] = .{ | |
| 2162 | 2162 | .llvm_name = "zdinx", |
| 2163 | 2163 | .description = "'Zdinx' (Double in Integer)", |
| 2164 | 2164 | .dependencies = featureSet(&[_]Feature{ |
| 2165 | 2165 | .zfinx, |
| 2166 | 2166 | }), |
| 2167 | 2167 | }; |
| 2168 | result[@intFromEnum(Feature.zexth_fusion)] = .{ | |
| 2168 | result[@backingInt(Feature.zexth_fusion)] = .{ | |
| 2169 | 2169 | .llvm_name = "zexth-fusion", |
| 2170 | 2170 | .description = "Enable SLLI+SRLI to be fused to zero extension of halfword", |
| 2171 | 2171 | .dependencies = featureSet(&[_]Feature{}), |
| 2172 | 2172 | }; |
| 2173 | result[@intFromEnum(Feature.zextw_fusion)] = .{ | |
| 2173 | result[@backingInt(Feature.zextw_fusion)] = .{ | |
| 2174 | 2174 | .llvm_name = "zextw-fusion", |
| 2175 | 2175 | .description = "Enable SLLI+SRLI to be fused to zero extension of word", |
| 2176 | 2176 | .dependencies = featureSet(&[_]Feature{}), |
| 2177 | 2177 | }; |
| 2178 | result[@intFromEnum(Feature.zfa)] = .{ | |
| 2178 | result[@backingInt(Feature.zfa)] = .{ | |
| 2179 | 2179 | .llvm_name = "zfa", |
| 2180 | 2180 | .description = "'Zfa' (Additional Floating-Point)", |
| 2181 | 2181 | .dependencies = featureSet(&[_]Feature{ |
| 2182 | 2182 | .f, |
| 2183 | 2183 | }), |
| 2184 | 2184 | }; |
| 2185 | result[@intFromEnum(Feature.zfbfmin)] = .{ | |
| 2185 | result[@backingInt(Feature.zfbfmin)] = .{ | |
| 2186 | 2186 | .llvm_name = "zfbfmin", |
| 2187 | 2187 | .description = "'Zfbfmin' (Scalar BF16 Converts)", |
| 2188 | 2188 | .dependencies = featureSet(&[_]Feature{ |
| 2189 | 2189 | .f, |
| 2190 | 2190 | }), |
| 2191 | 2191 | }; |
| 2192 | result[@intFromEnum(Feature.zfh)] = .{ | |
| 2192 | result[@backingInt(Feature.zfh)] = .{ | |
| 2193 | 2193 | .llvm_name = "zfh", |
| 2194 | 2194 | .description = "'Zfh' (Half-Precision Floating-Point)", |
| 2195 | 2195 | .dependencies = featureSet(&[_]Feature{ |
| 2196 | 2196 | .zfhmin, |
| 2197 | 2197 | }), |
| 2198 | 2198 | }; |
| 2199 | result[@intFromEnum(Feature.zfhmin)] = .{ | |
| 2199 | result[@backingInt(Feature.zfhmin)] = .{ | |
| 2200 | 2200 | .llvm_name = "zfhmin", |
| 2201 | 2201 | .description = "'Zfhmin' (Half-Precision Floating-Point Minimal)", |
| 2202 | 2202 | .dependencies = featureSet(&[_]Feature{ |
| 2203 | 2203 | .f, |
| 2204 | 2204 | }), |
| 2205 | 2205 | }; |
| 2206 | result[@intFromEnum(Feature.zfinx)] = .{ | |
| 2206 | result[@backingInt(Feature.zfinx)] = .{ | |
| 2207 | 2207 | .llvm_name = "zfinx", |
| 2208 | 2208 | .description = "'Zfinx' (Float in Integer)", |
| 2209 | 2209 | .dependencies = featureSet(&[_]Feature{ |
| 2210 | 2210 | .zicsr, |
| 2211 | 2211 | }), |
| 2212 | 2212 | }; |
| 2213 | result[@intFromEnum(Feature.zhinx)] = .{ | |
| 2213 | result[@backingInt(Feature.zhinx)] = .{ | |
| 2214 | 2214 | .llvm_name = "zhinx", |
| 2215 | 2215 | .description = "'Zhinx' (Half Float in Integer)", |
| 2216 | 2216 | .dependencies = featureSet(&[_]Feature{ |
| 2217 | 2217 | .zhinxmin, |
| 2218 | 2218 | }), |
| 2219 | 2219 | }; |
| 2220 | result[@intFromEnum(Feature.zhinxmin)] = .{ | |
| 2220 | result[@backingInt(Feature.zhinxmin)] = .{ | |
| 2221 | 2221 | .llvm_name = "zhinxmin", |
| 2222 | 2222 | .description = "'Zhinxmin' (Half Float in Integer Minimal)", |
| 2223 | 2223 | .dependencies = featureSet(&[_]Feature{ |
| 2224 | 2224 | .zfinx, |
| 2225 | 2225 | }), |
| 2226 | 2226 | }; |
| 2227 | result[@intFromEnum(Feature.zic64b)] = .{ | |
| 2227 | result[@backingInt(Feature.zic64b)] = .{ | |
| 2228 | 2228 | .llvm_name = "zic64b", |
| 2229 | 2229 | .description = "'Zic64b' (Cache Block Size Is 64 Bytes)", |
| 2230 | 2230 | .dependencies = featureSet(&[_]Feature{}), |
| 2231 | 2231 | }; |
| 2232 | result[@intFromEnum(Feature.zicbom)] = .{ | |
| 2232 | result[@backingInt(Feature.zicbom)] = .{ | |
| 2233 | 2233 | .llvm_name = "zicbom", |
| 2234 | 2234 | .description = "'Zicbom' (Cache-Block Management Instructions)", |
| 2235 | 2235 | .dependencies = featureSet(&[_]Feature{}), |
| 2236 | 2236 | }; |
| 2237 | result[@intFromEnum(Feature.zicbop)] = .{ | |
| 2237 | result[@backingInt(Feature.zicbop)] = .{ | |
| 2238 | 2238 | .llvm_name = "zicbop", |
| 2239 | 2239 | .description = "'Zicbop' (Cache-Block Prefetch Instructions)", |
| 2240 | 2240 | .dependencies = featureSet(&[_]Feature{}), |
| 2241 | 2241 | }; |
| 2242 | result[@intFromEnum(Feature.zicboz)] = .{ | |
| 2242 | result[@backingInt(Feature.zicboz)] = .{ | |
| 2243 | 2243 | .llvm_name = "zicboz", |
| 2244 | 2244 | .description = "'Zicboz' (Cache-Block Zero Instructions)", |
| 2245 | 2245 | .dependencies = featureSet(&[_]Feature{}), |
| 2246 | 2246 | }; |
| 2247 | result[@intFromEnum(Feature.ziccamoa)] = .{ | |
| 2247 | result[@backingInt(Feature.ziccamoa)] = .{ | |
| 2248 | 2248 | .llvm_name = "ziccamoa", |
| 2249 | 2249 | .description = "'Ziccamoa' (Main Memory Supports All Atomics in A)", |
| 2250 | 2250 | .dependencies = featureSet(&[_]Feature{}), |
| 2251 | 2251 | }; |
| 2252 | result[@intFromEnum(Feature.ziccamoc)] = .{ | |
| 2252 | result[@backingInt(Feature.ziccamoc)] = .{ | |
| 2253 | 2253 | .llvm_name = "ziccamoc", |
| 2254 | 2254 | .description = "'Ziccamoc' (Main Memory Supports Atomics in Zacas)", |
| 2255 | 2255 | .dependencies = featureSet(&[_]Feature{}), |
| 2256 | 2256 | }; |
| 2257 | result[@intFromEnum(Feature.ziccif)] = .{ | |
| 2257 | result[@backingInt(Feature.ziccif)] = .{ | |
| 2258 | 2258 | .llvm_name = "ziccif", |
| 2259 | 2259 | .description = "'Ziccif' (Main Memory Supports Instruction Fetch with Atomicity Requirement)", |
| 2260 | 2260 | .dependencies = featureSet(&[_]Feature{}), |
| 2261 | 2261 | }; |
| 2262 | result[@intFromEnum(Feature.zicclsm)] = .{ | |
| 2262 | result[@backingInt(Feature.zicclsm)] = .{ | |
| 2263 | 2263 | .llvm_name = "zicclsm", |
| 2264 | 2264 | .description = "'Zicclsm' (Main Memory Supports Misaligned Loads/Stores)", |
| 2265 | 2265 | .dependencies = featureSet(&[_]Feature{}), |
| 2266 | 2266 | }; |
| 2267 | result[@intFromEnum(Feature.ziccrse)] = .{ | |
| 2267 | result[@backingInt(Feature.ziccrse)] = .{ | |
| 2268 | 2268 | .llvm_name = "ziccrse", |
| 2269 | 2269 | .description = "'Ziccrse' (Main Memory Supports Forward Progress on LR/SC Sequences)", |
| 2270 | 2270 | .dependencies = featureSet(&[_]Feature{}), |
| 2271 | 2271 | }; |
| 2272 | result[@intFromEnum(Feature.zicntr)] = .{ | |
| 2272 | result[@backingInt(Feature.zicntr)] = .{ | |
| 2273 | 2273 | .llvm_name = "zicntr", |
| 2274 | 2274 | .description = "'Zicntr' (Base Counters and Timers)", |
| 2275 | 2275 | .dependencies = featureSet(&[_]Feature{ |
| 2276 | 2276 | .zicsr, |
| 2277 | 2277 | }), |
| 2278 | 2278 | }; |
| 2279 | result[@intFromEnum(Feature.zicond)] = .{ | |
| 2279 | result[@backingInt(Feature.zicond)] = .{ | |
| 2280 | 2280 | .llvm_name = "zicond", |
| 2281 | 2281 | .description = "'Zicond' (Integer Conditional Operations)", |
| 2282 | 2282 | .dependencies = featureSet(&[_]Feature{}), |
| 2283 | 2283 | }; |
| 2284 | result[@intFromEnum(Feature.zicsr)] = .{ | |
| 2284 | result[@backingInt(Feature.zicsr)] = .{ | |
| 2285 | 2285 | .llvm_name = "zicsr", |
| 2286 | 2286 | .description = "'Zicsr' (CSRs)", |
| 2287 | 2287 | .dependencies = featureSet(&[_]Feature{}), |
| 2288 | 2288 | }; |
| 2289 | result[@intFromEnum(Feature.zifencei)] = .{ | |
| 2289 | result[@backingInt(Feature.zifencei)] = .{ | |
| 2290 | 2290 | .llvm_name = "zifencei", |
| 2291 | 2291 | .description = "'Zifencei' (fence.i)", |
| 2292 | 2292 | .dependencies = featureSet(&[_]Feature{}), |
| 2293 | 2293 | }; |
| 2294 | result[@intFromEnum(Feature.zihintntl)] = .{ | |
| 2294 | result[@backingInt(Feature.zihintntl)] = .{ | |
| 2295 | 2295 | .llvm_name = "zihintntl", |
| 2296 | 2296 | .description = "'Zihintntl' (Non-Temporal Locality Hints)", |
| 2297 | 2297 | .dependencies = featureSet(&[_]Feature{}), |
| 2298 | 2298 | }; |
| 2299 | result[@intFromEnum(Feature.zihintpause)] = .{ | |
| 2299 | result[@backingInt(Feature.zihintpause)] = .{ | |
| 2300 | 2300 | .llvm_name = "zihintpause", |
| 2301 | 2301 | .description = "'Zihintpause' (Pause Hint)", |
| 2302 | 2302 | .dependencies = featureSet(&[_]Feature{}), |
| 2303 | 2303 | }; |
| 2304 | result[@intFromEnum(Feature.zihpm)] = .{ | |
| 2304 | result[@backingInt(Feature.zihpm)] = .{ | |
| 2305 | 2305 | .llvm_name = "zihpm", |
| 2306 | 2306 | .description = "'Zihpm' (Hardware Performance Counters)", |
| 2307 | 2307 | .dependencies = featureSet(&[_]Feature{ |
| 2308 | 2308 | .zicsr, |
| 2309 | 2309 | }), |
| 2310 | 2310 | }; |
| 2311 | result[@intFromEnum(Feature.zilsd)] = .{ | |
| 2311 | result[@backingInt(Feature.zilsd)] = .{ | |
| 2312 | 2312 | .llvm_name = "zilsd", |
| 2313 | 2313 | .description = "'Zilsd' (Load/Store Pair Instructions)", |
| 2314 | 2314 | .dependencies = featureSet(&[_]Feature{}), |
| 2315 | 2315 | }; |
| 2316 | result[@intFromEnum(Feature.zilsd_4byte_align)] = .{ | |
| 2316 | result[@backingInt(Feature.zilsd_4byte_align)] = .{ | |
| 2317 | 2317 | .llvm_name = "zilsd-4byte-align", |
| 2318 | 2318 | .description = "Allow 4-byte alignment for Zilsd LD/SD instructions", |
| 2319 | 2319 | .dependencies = featureSet(&[_]Feature{}), |
| 2320 | 2320 | }; |
| 2321 | result[@intFromEnum(Feature.zimop)] = .{ | |
| 2321 | result[@backingInt(Feature.zimop)] = .{ | |
| 2322 | 2322 | .llvm_name = "zimop", |
| 2323 | 2323 | .description = "'Zimop' (May-Be-Operations)", |
| 2324 | 2324 | .dependencies = featureSet(&[_]Feature{}), |
| 2325 | 2325 | }; |
| 2326 | result[@intFromEnum(Feature.zk)] = .{ | |
| 2326 | result[@backingInt(Feature.zk)] = .{ | |
| 2327 | 2327 | .llvm_name = "zk", |
| 2328 | 2328 | .description = "'Zk' (Standard scalar cryptography extension)", |
| 2329 | 2329 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -2332,7 +2332,7 @@ pub const all_features = blk: { |
| 2332 | 2332 | .zkt, |
| 2333 | 2333 | }), |
| 2334 | 2334 | }; |
| 2335 | result[@intFromEnum(Feature.zkn)] = .{ | |
| 2335 | result[@backingInt(Feature.zkn)] = .{ | |
| 2336 | 2336 | .llvm_name = "zkn", |
| 2337 | 2337 | .description = "'Zkn' (NIST Algorithm Suite)", |
| 2338 | 2338 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -2344,27 +2344,27 @@ pub const all_features = blk: { |
| 2344 | 2344 | .zknh, |
| 2345 | 2345 | }), |
| 2346 | 2346 | }; |
| 2347 | result[@intFromEnum(Feature.zknd)] = .{ | |
| 2347 | result[@backingInt(Feature.zknd)] = .{ | |
| 2348 | 2348 | .llvm_name = "zknd", |
| 2349 | 2349 | .description = "'Zknd' (NIST Suite: AES Decryption)", |
| 2350 | 2350 | .dependencies = featureSet(&[_]Feature{}), |
| 2351 | 2351 | }; |
| 2352 | result[@intFromEnum(Feature.zkne)] = .{ | |
| 2352 | result[@backingInt(Feature.zkne)] = .{ | |
| 2353 | 2353 | .llvm_name = "zkne", |
| 2354 | 2354 | .description = "'Zkne' (NIST Suite: AES Encryption)", |
| 2355 | 2355 | .dependencies = featureSet(&[_]Feature{}), |
| 2356 | 2356 | }; |
| 2357 | result[@intFromEnum(Feature.zknh)] = .{ | |
| 2357 | result[@backingInt(Feature.zknh)] = .{ | |
| 2358 | 2358 | .llvm_name = "zknh", |
| 2359 | 2359 | .description = "'Zknh' (NIST Suite: Hash Function Instructions)", |
| 2360 | 2360 | .dependencies = featureSet(&[_]Feature{}), |
| 2361 | 2361 | }; |
| 2362 | result[@intFromEnum(Feature.zkr)] = .{ | |
| 2362 | result[@backingInt(Feature.zkr)] = .{ | |
| 2363 | 2363 | .llvm_name = "zkr", |
| 2364 | 2364 | .description = "'Zkr' (Entropy Source Extension)", |
| 2365 | 2365 | .dependencies = featureSet(&[_]Feature{}), |
| 2366 | 2366 | }; |
| 2367 | result[@intFromEnum(Feature.zks)] = .{ | |
| 2367 | result[@backingInt(Feature.zks)] = .{ | |
| 2368 | 2368 | .llvm_name = "zks", |
| 2369 | 2369 | .description = "'Zks' (ShangMi Algorithm Suite)", |
| 2370 | 2370 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -2375,46 +2375,46 @@ pub const all_features = blk: { |
| 2375 | 2375 | .zksh, |
| 2376 | 2376 | }), |
| 2377 | 2377 | }; |
| 2378 | result[@intFromEnum(Feature.zksed)] = .{ | |
| 2378 | result[@backingInt(Feature.zksed)] = .{ | |
| 2379 | 2379 | .llvm_name = "zksed", |
| 2380 | 2380 | .description = "'Zksed' (ShangMi Suite: SM4 Block Cipher Instructions)", |
| 2381 | 2381 | .dependencies = featureSet(&[_]Feature{}), |
| 2382 | 2382 | }; |
| 2383 | result[@intFromEnum(Feature.zksh)] = .{ | |
| 2383 | result[@backingInt(Feature.zksh)] = .{ | |
| 2384 | 2384 | .llvm_name = "zksh", |
| 2385 | 2385 | .description = "'Zksh' (ShangMi Suite: SM3 Hash Function Instructions)", |
| 2386 | 2386 | .dependencies = featureSet(&[_]Feature{}), |
| 2387 | 2387 | }; |
| 2388 | result[@intFromEnum(Feature.zkt)] = .{ | |
| 2388 | result[@backingInt(Feature.zkt)] = .{ | |
| 2389 | 2389 | .llvm_name = "zkt", |
| 2390 | 2390 | .description = "'Zkt' (Data Independent Execution Latency)", |
| 2391 | 2391 | .dependencies = featureSet(&[_]Feature{}), |
| 2392 | 2392 | }; |
| 2393 | result[@intFromEnum(Feature.zmmul)] = .{ | |
| 2393 | result[@backingInt(Feature.zmmul)] = .{ | |
| 2394 | 2394 | .llvm_name = "zmmul", |
| 2395 | 2395 | .description = "'Zmmul' (Integer Multiplication)", |
| 2396 | 2396 | .dependencies = featureSet(&[_]Feature{}), |
| 2397 | 2397 | }; |
| 2398 | result[@intFromEnum(Feature.ztso)] = .{ | |
| 2398 | result[@backingInt(Feature.ztso)] = .{ | |
| 2399 | 2399 | .llvm_name = "ztso", |
| 2400 | 2400 | .description = "'Ztso' (Memory Model - Total Store Order)", |
| 2401 | 2401 | .dependencies = featureSet(&[_]Feature{}), |
| 2402 | 2402 | }; |
| 2403 | result[@intFromEnum(Feature.zvbb)] = .{ | |
| 2403 | result[@backingInt(Feature.zvbb)] = .{ | |
| 2404 | 2404 | .llvm_name = "zvbb", |
| 2405 | 2405 | .description = "'Zvbb' (Vector basic bit-manipulation instructions)", |
| 2406 | 2406 | .dependencies = featureSet(&[_]Feature{ |
| 2407 | 2407 | .zvkb, |
| 2408 | 2408 | }), |
| 2409 | 2409 | }; |
| 2410 | result[@intFromEnum(Feature.zvbc)] = .{ | |
| 2410 | result[@backingInt(Feature.zvbc)] = .{ | |
| 2411 | 2411 | .llvm_name = "zvbc", |
| 2412 | 2412 | .description = "'Zvbc' (Vector Carryless Multiplication)", |
| 2413 | 2413 | .dependencies = featureSet(&[_]Feature{ |
| 2414 | 2414 | .zve64x, |
| 2415 | 2415 | }), |
| 2416 | 2416 | }; |
| 2417 | result[@intFromEnum(Feature.zve32f)] = .{ | |
| 2417 | result[@backingInt(Feature.zve32f)] = .{ | |
| 2418 | 2418 | .llvm_name = "zve32f", |
| 2419 | 2419 | .description = "'Zve32f' (Vector Extensions for Embedded Processors with maximal 32 EEW and F extension)", |
| 2420 | 2420 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -2422,7 +2422,7 @@ pub const all_features = blk: { |
| 2422 | 2422 | .zve32x, |
| 2423 | 2423 | }), |
| 2424 | 2424 | }; |
| 2425 | result[@intFromEnum(Feature.zve32x)] = .{ | |
| 2425 | result[@backingInt(Feature.zve32x)] = .{ | |
| 2426 | 2426 | .llvm_name = "zve32x", |
| 2427 | 2427 | .description = "'Zve32x' (Vector Extensions for Embedded Processors with maximal 32 EEW)", |
| 2428 | 2428 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -2430,7 +2430,7 @@ pub const all_features = blk: { |
| 2430 | 2430 | .zvl32b, |
| 2431 | 2431 | }), |
| 2432 | 2432 | }; |
| 2433 | result[@intFromEnum(Feature.zve64d)] = .{ | |
| 2433 | result[@backingInt(Feature.zve64d)] = .{ | |
| 2434 | 2434 | .llvm_name = "zve64d", |
| 2435 | 2435 | .description = "'Zve64d' (Vector Extensions for Embedded Processors with maximal 64 EEW, F and D extension)", |
| 2436 | 2436 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -2438,7 +2438,7 @@ pub const all_features = blk: { |
| 2438 | 2438 | .zve64f, |
| 2439 | 2439 | }), |
| 2440 | 2440 | }; |
| 2441 | result[@intFromEnum(Feature.zve64f)] = .{ | |
| 2441 | result[@backingInt(Feature.zve64f)] = .{ | |
| 2442 | 2442 | .llvm_name = "zve64f", |
| 2443 | 2443 | .description = "'Zve64f' (Vector Extensions for Embedded Processors with maximal 64 EEW and F extension)", |
| 2444 | 2444 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -2446,7 +2446,7 @@ pub const all_features = blk: { |
| 2446 | 2446 | .zve64x, |
| 2447 | 2447 | }), |
| 2448 | 2448 | }; |
| 2449 | result[@intFromEnum(Feature.zve64x)] = .{ | |
| 2449 | result[@backingInt(Feature.zve64x)] = .{ | |
| 2450 | 2450 | .llvm_name = "zve64x", |
| 2451 | 2451 | .description = "'Zve64x' (Vector Extensions for Embedded Processors with maximal 64 EEW)", |
| 2452 | 2452 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -2454,14 +2454,14 @@ pub const all_features = blk: { |
| 2454 | 2454 | .zvl64b, |
| 2455 | 2455 | }), |
| 2456 | 2456 | }; |
| 2457 | result[@intFromEnum(Feature.zvfbfmin)] = .{ | |
| 2457 | result[@backingInt(Feature.zvfbfmin)] = .{ | |
| 2458 | 2458 | .llvm_name = "zvfbfmin", |
| 2459 | 2459 | .description = "'Zvfbfmin' (Vector BF16 Converts)", |
| 2460 | 2460 | .dependencies = featureSet(&[_]Feature{ |
| 2461 | 2461 | .zve32f, |
| 2462 | 2462 | }), |
| 2463 | 2463 | }; |
| 2464 | result[@intFromEnum(Feature.zvfbfwma)] = .{ | |
| 2464 | result[@backingInt(Feature.zvfbfwma)] = .{ | |
| 2465 | 2465 | .llvm_name = "zvfbfwma", |
| 2466 | 2466 | .description = "'Zvfbfwma' (Vector BF16 widening mul-add)", |
| 2467 | 2467 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -2469,7 +2469,7 @@ pub const all_features = blk: { |
| 2469 | 2469 | .zvfbfmin, |
| 2470 | 2470 | }), |
| 2471 | 2471 | }; |
| 2472 | result[@intFromEnum(Feature.zvfh)] = .{ | |
| 2472 | result[@backingInt(Feature.zvfh)] = .{ | |
| 2473 | 2473 | .llvm_name = "zvfh", |
| 2474 | 2474 | .description = "'Zvfh' (Vector Half-Precision Floating-Point)", |
| 2475 | 2475 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -2477,28 +2477,28 @@ pub const all_features = blk: { |
| 2477 | 2477 | .zvfhmin, |
| 2478 | 2478 | }), |
| 2479 | 2479 | }; |
| 2480 | result[@intFromEnum(Feature.zvfhmin)] = .{ | |
| 2480 | result[@backingInt(Feature.zvfhmin)] = .{ | |
| 2481 | 2481 | .llvm_name = "zvfhmin", |
| 2482 | 2482 | .description = "'Zvfhmin' (Vector Half-Precision Floating-Point Minimal)", |
| 2483 | 2483 | .dependencies = featureSet(&[_]Feature{ |
| 2484 | 2484 | .zve32f, |
| 2485 | 2485 | }), |
| 2486 | 2486 | }; |
| 2487 | result[@intFromEnum(Feature.zvkb)] = .{ | |
| 2487 | result[@backingInt(Feature.zvkb)] = .{ | |
| 2488 | 2488 | .llvm_name = "zvkb", |
| 2489 | 2489 | .description = "'Zvkb' (Vector Bit-manipulation used in Cryptography)", |
| 2490 | 2490 | .dependencies = featureSet(&[_]Feature{ |
| 2491 | 2491 | .zve32x, |
| 2492 | 2492 | }), |
| 2493 | 2493 | }; |
| 2494 | result[@intFromEnum(Feature.zvkg)] = .{ | |
| 2494 | result[@backingInt(Feature.zvkg)] = .{ | |
| 2495 | 2495 | .llvm_name = "zvkg", |
| 2496 | 2496 | .description = "'Zvkg' (Vector GCM instructions for Cryptography)", |
| 2497 | 2497 | .dependencies = featureSet(&[_]Feature{ |
| 2498 | 2498 | .zve32x, |
| 2499 | 2499 | }), |
| 2500 | 2500 | }; |
| 2501 | result[@intFromEnum(Feature.zvkn)] = .{ | |
| 2501 | result[@backingInt(Feature.zvkn)] = .{ | |
| 2502 | 2502 | .llvm_name = "zvkn", |
| 2503 | 2503 | .description = "'Zvkn' (shorthand for 'Zvkned', 'Zvknhb', 'Zvkb', and 'Zvkt')", |
| 2504 | 2504 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -2508,7 +2508,7 @@ pub const all_features = blk: { |
| 2508 | 2508 | .zvkt, |
| 2509 | 2509 | }), |
| 2510 | 2510 | }; |
| 2511 | result[@intFromEnum(Feature.zvknc)] = .{ | |
| 2511 | result[@backingInt(Feature.zvknc)] = .{ | |
| 2512 | 2512 | .llvm_name = "zvknc", |
| 2513 | 2513 | .description = "'Zvknc' (shorthand for 'Zvknc' and 'Zvbc')", |
| 2514 | 2514 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -2516,14 +2516,14 @@ pub const all_features = blk: { |
| 2516 | 2516 | .zvkn, |
| 2517 | 2517 | }), |
| 2518 | 2518 | }; |
| 2519 | result[@intFromEnum(Feature.zvkned)] = .{ | |
| 2519 | result[@backingInt(Feature.zvkned)] = .{ | |
| 2520 | 2520 | .llvm_name = "zvkned", |
| 2521 | 2521 | .description = "'Zvkned' (Vector AES Encryption & Decryption (Single Round))", |
| 2522 | 2522 | .dependencies = featureSet(&[_]Feature{ |
| 2523 | 2523 | .zve32x, |
| 2524 | 2524 | }), |
| 2525 | 2525 | }; |
| 2526 | result[@intFromEnum(Feature.zvkng)] = .{ | |
| 2526 | result[@backingInt(Feature.zvkng)] = .{ | |
| 2527 | 2527 | .llvm_name = "zvkng", |
| 2528 | 2528 | .description = "'Zvkng' (shorthand for 'Zvkn' and 'Zvkg')", |
| 2529 | 2529 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -2531,21 +2531,21 @@ pub const all_features = blk: { |
| 2531 | 2531 | .zvkn, |
| 2532 | 2532 | }), |
| 2533 | 2533 | }; |
| 2534 | result[@intFromEnum(Feature.zvknha)] = .{ | |
| 2534 | result[@backingInt(Feature.zvknha)] = .{ | |
| 2535 | 2535 | .llvm_name = "zvknha", |
| 2536 | 2536 | .description = "'Zvknha' (Vector SHA-2 (SHA-256 only))", |
| 2537 | 2537 | .dependencies = featureSet(&[_]Feature{ |
| 2538 | 2538 | .zve32x, |
| 2539 | 2539 | }), |
| 2540 | 2540 | }; |
| 2541 | result[@intFromEnum(Feature.zvknhb)] = .{ | |
| 2541 | result[@backingInt(Feature.zvknhb)] = .{ | |
| 2542 | 2542 | .llvm_name = "zvknhb", |
| 2543 | 2543 | .description = "'Zvknhb' (Vector SHA-2 (SHA-256 and SHA-512))", |
| 2544 | 2544 | .dependencies = featureSet(&[_]Feature{ |
| 2545 | 2545 | .zve64x, |
| 2546 | 2546 | }), |
| 2547 | 2547 | }; |
| 2548 | result[@intFromEnum(Feature.zvks)] = .{ | |
| 2548 | result[@backingInt(Feature.zvks)] = .{ | |
| 2549 | 2549 | .llvm_name = "zvks", |
| 2550 | 2550 | .description = "'Zvks' (shorthand for 'Zvksed', 'Zvksh', 'Zvkb', and 'Zvkt')", |
| 2551 | 2551 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -2555,7 +2555,7 @@ pub const all_features = blk: { |
| 2555 | 2555 | .zvkt, |
| 2556 | 2556 | }), |
| 2557 | 2557 | }; |
| 2558 | result[@intFromEnum(Feature.zvksc)] = .{ | |
| 2558 | result[@backingInt(Feature.zvksc)] = .{ | |
| 2559 | 2559 | .llvm_name = "zvksc", |
| 2560 | 2560 | .description = "'Zvksc' (shorthand for 'Zvks' and 'Zvbc')", |
| 2561 | 2561 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -2563,14 +2563,14 @@ pub const all_features = blk: { |
| 2563 | 2563 | .zvks, |
| 2564 | 2564 | }), |
| 2565 | 2565 | }; |
| 2566 | result[@intFromEnum(Feature.zvksed)] = .{ | |
| 2566 | result[@backingInt(Feature.zvksed)] = .{ | |
| 2567 | 2567 | .llvm_name = "zvksed", |
| 2568 | 2568 | .description = "'Zvksed' (SM4 Block Cipher Instructions)", |
| 2569 | 2569 | .dependencies = featureSet(&[_]Feature{ |
| 2570 | 2570 | .zve32x, |
| 2571 | 2571 | }), |
| 2572 | 2572 | }; |
| 2573 | result[@intFromEnum(Feature.zvksg)] = .{ | |
| 2573 | result[@backingInt(Feature.zvksg)] = .{ | |
| 2574 | 2574 | .llvm_name = "zvksg", |
| 2575 | 2575 | .description = "'Zvksg' (shorthand for 'Zvks' and 'Zvkg')", |
| 2576 | 2576 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -2578,94 +2578,94 @@ pub const all_features = blk: { |
| 2578 | 2578 | .zvks, |
| 2579 | 2579 | }), |
| 2580 | 2580 | }; |
| 2581 | result[@intFromEnum(Feature.zvksh)] = .{ | |
| 2581 | result[@backingInt(Feature.zvksh)] = .{ | |
| 2582 | 2582 | .llvm_name = "zvksh", |
| 2583 | 2583 | .description = "'Zvksh' (SM3 Hash Function Instructions)", |
| 2584 | 2584 | .dependencies = featureSet(&[_]Feature{ |
| 2585 | 2585 | .zve32x, |
| 2586 | 2586 | }), |
| 2587 | 2587 | }; |
| 2588 | result[@intFromEnum(Feature.zvkt)] = .{ | |
| 2588 | result[@backingInt(Feature.zvkt)] = .{ | |
| 2589 | 2589 | .llvm_name = "zvkt", |
| 2590 | 2590 | .description = "'Zvkt' (Vector Data-Independent Execution Latency)", |
| 2591 | 2591 | .dependencies = featureSet(&[_]Feature{}), |
| 2592 | 2592 | }; |
| 2593 | result[@intFromEnum(Feature.zvl1024b)] = .{ | |
| 2593 | result[@backingInt(Feature.zvl1024b)] = .{ | |
| 2594 | 2594 | .llvm_name = "zvl1024b", |
| 2595 | 2595 | .description = "'Zvl1024b' (Minimum Vector Length 1024)", |
| 2596 | 2596 | .dependencies = featureSet(&[_]Feature{ |
| 2597 | 2597 | .zvl512b, |
| 2598 | 2598 | }), |
| 2599 | 2599 | }; |
| 2600 | result[@intFromEnum(Feature.zvl128b)] = .{ | |
| 2600 | result[@backingInt(Feature.zvl128b)] = .{ | |
| 2601 | 2601 | .llvm_name = "zvl128b", |
| 2602 | 2602 | .description = "'Zvl128b' (Minimum Vector Length 128)", |
| 2603 | 2603 | .dependencies = featureSet(&[_]Feature{ |
| 2604 | 2604 | .zvl64b, |
| 2605 | 2605 | }), |
| 2606 | 2606 | }; |
| 2607 | result[@intFromEnum(Feature.zvl16384b)] = .{ | |
| 2607 | result[@backingInt(Feature.zvl16384b)] = .{ | |
| 2608 | 2608 | .llvm_name = "zvl16384b", |
| 2609 | 2609 | .description = "'Zvl16384b' (Minimum Vector Length 16384)", |
| 2610 | 2610 | .dependencies = featureSet(&[_]Feature{ |
| 2611 | 2611 | .zvl8192b, |
| 2612 | 2612 | }), |
| 2613 | 2613 | }; |
| 2614 | result[@intFromEnum(Feature.zvl2048b)] = .{ | |
| 2614 | result[@backingInt(Feature.zvl2048b)] = .{ | |
| 2615 | 2615 | .llvm_name = "zvl2048b", |
| 2616 | 2616 | .description = "'Zvl2048b' (Minimum Vector Length 2048)", |
| 2617 | 2617 | .dependencies = featureSet(&[_]Feature{ |
| 2618 | 2618 | .zvl1024b, |
| 2619 | 2619 | }), |
| 2620 | 2620 | }; |
| 2621 | result[@intFromEnum(Feature.zvl256b)] = .{ | |
| 2621 | result[@backingInt(Feature.zvl256b)] = .{ | |
| 2622 | 2622 | .llvm_name = "zvl256b", |
| 2623 | 2623 | .description = "'Zvl256b' (Minimum Vector Length 256)", |
| 2624 | 2624 | .dependencies = featureSet(&[_]Feature{ |
| 2625 | 2625 | .zvl128b, |
| 2626 | 2626 | }), |
| 2627 | 2627 | }; |
| 2628 | result[@intFromEnum(Feature.zvl32768b)] = .{ | |
| 2628 | result[@backingInt(Feature.zvl32768b)] = .{ | |
| 2629 | 2629 | .llvm_name = "zvl32768b", |
| 2630 | 2630 | .description = "'Zvl32768b' (Minimum Vector Length 32768)", |
| 2631 | 2631 | .dependencies = featureSet(&[_]Feature{ |
| 2632 | 2632 | .zvl16384b, |
| 2633 | 2633 | }), |
| 2634 | 2634 | }; |
| 2635 | result[@intFromEnum(Feature.zvl32b)] = .{ | |
| 2635 | result[@backingInt(Feature.zvl32b)] = .{ | |
| 2636 | 2636 | .llvm_name = "zvl32b", |
| 2637 | 2637 | .description = "'Zvl32b' (Minimum Vector Length 32)", |
| 2638 | 2638 | .dependencies = featureSet(&[_]Feature{}), |
| 2639 | 2639 | }; |
| 2640 | result[@intFromEnum(Feature.zvl4096b)] = .{ | |
| 2640 | result[@backingInt(Feature.zvl4096b)] = .{ | |
| 2641 | 2641 | .llvm_name = "zvl4096b", |
| 2642 | 2642 | .description = "'Zvl4096b' (Minimum Vector Length 4096)", |
| 2643 | 2643 | .dependencies = featureSet(&[_]Feature{ |
| 2644 | 2644 | .zvl2048b, |
| 2645 | 2645 | }), |
| 2646 | 2646 | }; |
| 2647 | result[@intFromEnum(Feature.zvl512b)] = .{ | |
| 2647 | result[@backingInt(Feature.zvl512b)] = .{ | |
| 2648 | 2648 | .llvm_name = "zvl512b", |
| 2649 | 2649 | .description = "'Zvl512b' (Minimum Vector Length 512)", |
| 2650 | 2650 | .dependencies = featureSet(&[_]Feature{ |
| 2651 | 2651 | .zvl256b, |
| 2652 | 2652 | }), |
| 2653 | 2653 | }; |
| 2654 | result[@intFromEnum(Feature.zvl64b)] = .{ | |
| 2654 | result[@backingInt(Feature.zvl64b)] = .{ | |
| 2655 | 2655 | .llvm_name = "zvl64b", |
| 2656 | 2656 | .description = "'Zvl64b' (Minimum Vector Length 64)", |
| 2657 | 2657 | .dependencies = featureSet(&[_]Feature{ |
| 2658 | 2658 | .zvl32b, |
| 2659 | 2659 | }), |
| 2660 | 2660 | }; |
| 2661 | result[@intFromEnum(Feature.zvl65536b)] = .{ | |
| 2661 | result[@backingInt(Feature.zvl65536b)] = .{ | |
| 2662 | 2662 | .llvm_name = "zvl65536b", |
| 2663 | 2663 | .description = "'Zvl65536b' (Minimum Vector Length 65536)", |
| 2664 | 2664 | .dependencies = featureSet(&[_]Feature{ |
| 2665 | 2665 | .zvl32768b, |
| 2666 | 2666 | }), |
| 2667 | 2667 | }; |
| 2668 | result[@intFromEnum(Feature.zvl8192b)] = .{ | |
| 2668 | result[@backingInt(Feature.zvl8192b)] = .{ | |
| 2669 | 2669 | .llvm_name = "zvl8192b", |
| 2670 | 2670 | .description = "'Zvl8192b' (Minimum Vector Length 8192)", |
| 2671 | 2671 | .dependencies = featureSet(&[_]Feature{ |
lib/std/Target/s390x.zig+49-49| ... | ... | @@ -65,247 +65,247 @@ pub const all_features = blk: { |
| 65 | 65 | const len = @typeInfo(Feature).@"enum".field_names.len; |
| 66 | 66 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); |
| 67 | 67 | var result: [len]CpuFeature = undefined; |
| 68 | result[@intFromEnum(Feature.backchain)] = .{ | |
| 68 | result[@backingInt(Feature.backchain)] = .{ | |
| 69 | 69 | .llvm_name = "backchain", |
| 70 | 70 | .description = "Store the address of the caller's frame into the callee's stack frame", |
| 71 | 71 | .dependencies = featureSet(&[_]Feature{}), |
| 72 | 72 | }; |
| 73 | result[@intFromEnum(Feature.bear_enhancement)] = .{ | |
| 73 | result[@backingInt(Feature.bear_enhancement)] = .{ | |
| 74 | 74 | .llvm_name = "bear-enhancement", |
| 75 | 75 | .description = "Assume that the BEAR-enhancement facility is installed", |
| 76 | 76 | .dependencies = featureSet(&[_]Feature{}), |
| 77 | 77 | }; |
| 78 | result[@intFromEnum(Feature.concurrent_functions)] = .{ | |
| 78 | result[@backingInt(Feature.concurrent_functions)] = .{ | |
| 79 | 79 | .llvm_name = "concurrent-functions", |
| 80 | 80 | .description = "Assume that the concurrent-functions facility is installed", |
| 81 | 81 | .dependencies = featureSet(&[_]Feature{}), |
| 82 | 82 | }; |
| 83 | result[@intFromEnum(Feature.deflate_conversion)] = .{ | |
| 83 | result[@backingInt(Feature.deflate_conversion)] = .{ | |
| 84 | 84 | .llvm_name = "deflate-conversion", |
| 85 | 85 | .description = "Assume that the deflate-conversion facility is installed", |
| 86 | 86 | .dependencies = featureSet(&[_]Feature{}), |
| 87 | 87 | }; |
| 88 | result[@intFromEnum(Feature.dfp_packed_conversion)] = .{ | |
| 88 | result[@backingInt(Feature.dfp_packed_conversion)] = .{ | |
| 89 | 89 | .llvm_name = "dfp-packed-conversion", |
| 90 | 90 | .description = "Assume that the DFP packed-conversion facility is installed", |
| 91 | 91 | .dependencies = featureSet(&[_]Feature{}), |
| 92 | 92 | }; |
| 93 | result[@intFromEnum(Feature.dfp_zoned_conversion)] = .{ | |
| 93 | result[@backingInt(Feature.dfp_zoned_conversion)] = .{ | |
| 94 | 94 | .llvm_name = "dfp-zoned-conversion", |
| 95 | 95 | .description = "Assume that the DFP zoned-conversion facility is installed", |
| 96 | 96 | .dependencies = featureSet(&[_]Feature{}), |
| 97 | 97 | }; |
| 98 | result[@intFromEnum(Feature.distinct_ops)] = .{ | |
| 98 | result[@backingInt(Feature.distinct_ops)] = .{ | |
| 99 | 99 | .llvm_name = "distinct-ops", |
| 100 | 100 | .description = "Assume that the distinct-operands facility is installed", |
| 101 | 101 | .dependencies = featureSet(&[_]Feature{}), |
| 102 | 102 | }; |
| 103 | result[@intFromEnum(Feature.enhanced_dat_2)] = .{ | |
| 103 | result[@backingInt(Feature.enhanced_dat_2)] = .{ | |
| 104 | 104 | .llvm_name = "enhanced-dat-2", |
| 105 | 105 | .description = "Assume that the enhanced-DAT facility 2 is installed", |
| 106 | 106 | .dependencies = featureSet(&[_]Feature{}), |
| 107 | 107 | }; |
| 108 | result[@intFromEnum(Feature.enhanced_sort)] = .{ | |
| 108 | result[@backingInt(Feature.enhanced_sort)] = .{ | |
| 109 | 109 | .llvm_name = "enhanced-sort", |
| 110 | 110 | .description = "Assume that the enhanced-sort facility is installed", |
| 111 | 111 | .dependencies = featureSet(&[_]Feature{}), |
| 112 | 112 | }; |
| 113 | result[@intFromEnum(Feature.execution_hint)] = .{ | |
| 113 | result[@backingInt(Feature.execution_hint)] = .{ | |
| 114 | 114 | .llvm_name = "execution-hint", |
| 115 | 115 | .description = "Assume that the execution-hint facility is installed", |
| 116 | 116 | .dependencies = featureSet(&[_]Feature{}), |
| 117 | 117 | }; |
| 118 | result[@intFromEnum(Feature.fast_serialization)] = .{ | |
| 118 | result[@backingInt(Feature.fast_serialization)] = .{ | |
| 119 | 119 | .llvm_name = "fast-serialization", |
| 120 | 120 | .description = "Assume that the fast-serialization facility is installed", |
| 121 | 121 | .dependencies = featureSet(&[_]Feature{}), |
| 122 | 122 | }; |
| 123 | result[@intFromEnum(Feature.fp_extension)] = .{ | |
| 123 | result[@backingInt(Feature.fp_extension)] = .{ | |
| 124 | 124 | .llvm_name = "fp-extension", |
| 125 | 125 | .description = "Assume that the floating-point extension facility is installed", |
| 126 | 126 | .dependencies = featureSet(&[_]Feature{}), |
| 127 | 127 | }; |
| 128 | result[@intFromEnum(Feature.guarded_storage)] = .{ | |
| 128 | result[@backingInt(Feature.guarded_storage)] = .{ | |
| 129 | 129 | .llvm_name = "guarded-storage", |
| 130 | 130 | .description = "Assume that the guarded-storage facility is installed", |
| 131 | 131 | .dependencies = featureSet(&[_]Feature{}), |
| 132 | 132 | }; |
| 133 | result[@intFromEnum(Feature.high_word)] = .{ | |
| 133 | result[@backingInt(Feature.high_word)] = .{ | |
| 134 | 134 | .llvm_name = "high-word", |
| 135 | 135 | .description = "Assume that the high-word facility is installed", |
| 136 | 136 | .dependencies = featureSet(&[_]Feature{}), |
| 137 | 137 | }; |
| 138 | result[@intFromEnum(Feature.insert_reference_bits_multiple)] = .{ | |
| 138 | result[@backingInt(Feature.insert_reference_bits_multiple)] = .{ | |
| 139 | 139 | .llvm_name = "insert-reference-bits-multiple", |
| 140 | 140 | .description = "Assume that the insert-reference-bits-multiple facility is installed", |
| 141 | 141 | .dependencies = featureSet(&[_]Feature{}), |
| 142 | 142 | }; |
| 143 | result[@intFromEnum(Feature.interlocked_access1)] = .{ | |
| 143 | result[@backingInt(Feature.interlocked_access1)] = .{ | |
| 144 | 144 | .llvm_name = "interlocked-access1", |
| 145 | 145 | .description = "Assume that interlocked-access facility 1 is installed", |
| 146 | 146 | .dependencies = featureSet(&[_]Feature{}), |
| 147 | 147 | }; |
| 148 | result[@intFromEnum(Feature.load_and_trap)] = .{ | |
| 148 | result[@backingInt(Feature.load_and_trap)] = .{ | |
| 149 | 149 | .llvm_name = "load-and-trap", |
| 150 | 150 | .description = "Assume that the load-and-trap facility is installed", |
| 151 | 151 | .dependencies = featureSet(&[_]Feature{}), |
| 152 | 152 | }; |
| 153 | result[@intFromEnum(Feature.load_and_zero_rightmost_byte)] = .{ | |
| 153 | result[@backingInt(Feature.load_and_zero_rightmost_byte)] = .{ | |
| 154 | 154 | .llvm_name = "load-and-zero-rightmost-byte", |
| 155 | 155 | .description = "Assume that the load-and-zero-rightmost-byte facility is installed", |
| 156 | 156 | .dependencies = featureSet(&[_]Feature{}), |
| 157 | 157 | }; |
| 158 | result[@intFromEnum(Feature.load_store_on_cond)] = .{ | |
| 158 | result[@backingInt(Feature.load_store_on_cond)] = .{ | |
| 159 | 159 | .llvm_name = "load-store-on-cond", |
| 160 | 160 | .description = "Assume that the load/store-on-condition facility is installed", |
| 161 | 161 | .dependencies = featureSet(&[_]Feature{}), |
| 162 | 162 | }; |
| 163 | result[@intFromEnum(Feature.load_store_on_cond_2)] = .{ | |
| 163 | result[@backingInt(Feature.load_store_on_cond_2)] = .{ | |
| 164 | 164 | .llvm_name = "load-store-on-cond-2", |
| 165 | 165 | .description = "Assume that the load/store-on-condition facility 2 is installed", |
| 166 | 166 | .dependencies = featureSet(&[_]Feature{}), |
| 167 | 167 | }; |
| 168 | result[@intFromEnum(Feature.message_security_assist_extension12)] = .{ | |
| 168 | result[@backingInt(Feature.message_security_assist_extension12)] = .{ | |
| 169 | 169 | .llvm_name = "message-security-assist-extension12", |
| 170 | 170 | .description = "Assume that the message-security-assist extension facility 12 is installed", |
| 171 | 171 | .dependencies = featureSet(&[_]Feature{}), |
| 172 | 172 | }; |
| 173 | result[@intFromEnum(Feature.message_security_assist_extension3)] = .{ | |
| 173 | result[@backingInt(Feature.message_security_assist_extension3)] = .{ | |
| 174 | 174 | .llvm_name = "message-security-assist-extension3", |
| 175 | 175 | .description = "Assume that the message-security-assist extension facility 3 is installed", |
| 176 | 176 | .dependencies = featureSet(&[_]Feature{}), |
| 177 | 177 | }; |
| 178 | result[@intFromEnum(Feature.message_security_assist_extension4)] = .{ | |
| 178 | result[@backingInt(Feature.message_security_assist_extension4)] = .{ | |
| 179 | 179 | .llvm_name = "message-security-assist-extension4", |
| 180 | 180 | .description = "Assume that the message-security-assist extension facility 4 is installed", |
| 181 | 181 | .dependencies = featureSet(&[_]Feature{}), |
| 182 | 182 | }; |
| 183 | result[@intFromEnum(Feature.message_security_assist_extension5)] = .{ | |
| 183 | result[@backingInt(Feature.message_security_assist_extension5)] = .{ | |
| 184 | 184 | .llvm_name = "message-security-assist-extension5", |
| 185 | 185 | .description = "Assume that the message-security-assist extension facility 5 is installed", |
| 186 | 186 | .dependencies = featureSet(&[_]Feature{}), |
| 187 | 187 | }; |
| 188 | result[@intFromEnum(Feature.message_security_assist_extension7)] = .{ | |
| 188 | result[@backingInt(Feature.message_security_assist_extension7)] = .{ | |
| 189 | 189 | .llvm_name = "message-security-assist-extension7", |
| 190 | 190 | .description = "Assume that the message-security-assist extension facility 7 is installed", |
| 191 | 191 | .dependencies = featureSet(&[_]Feature{}), |
| 192 | 192 | }; |
| 193 | result[@intFromEnum(Feature.message_security_assist_extension8)] = .{ | |
| 193 | result[@backingInt(Feature.message_security_assist_extension8)] = .{ | |
| 194 | 194 | .llvm_name = "message-security-assist-extension8", |
| 195 | 195 | .description = "Assume that the message-security-assist extension facility 8 is installed", |
| 196 | 196 | .dependencies = featureSet(&[_]Feature{}), |
| 197 | 197 | }; |
| 198 | result[@intFromEnum(Feature.message_security_assist_extension9)] = .{ | |
| 198 | result[@backingInt(Feature.message_security_assist_extension9)] = .{ | |
| 199 | 199 | .llvm_name = "message-security-assist-extension9", |
| 200 | 200 | .description = "Assume that the message-security-assist extension facility 9 is installed", |
| 201 | 201 | .dependencies = featureSet(&[_]Feature{}), |
| 202 | 202 | }; |
| 203 | result[@intFromEnum(Feature.miscellaneous_extensions)] = .{ | |
| 203 | result[@backingInt(Feature.miscellaneous_extensions)] = .{ | |
| 204 | 204 | .llvm_name = "miscellaneous-extensions", |
| 205 | 205 | .description = "Assume that the miscellaneous-extensions facility is installed", |
| 206 | 206 | .dependencies = featureSet(&[_]Feature{}), |
| 207 | 207 | }; |
| 208 | result[@intFromEnum(Feature.miscellaneous_extensions_2)] = .{ | |
| 208 | result[@backingInt(Feature.miscellaneous_extensions_2)] = .{ | |
| 209 | 209 | .llvm_name = "miscellaneous-extensions-2", |
| 210 | 210 | .description = "Assume that the miscellaneous-extensions facility 2 is installed", |
| 211 | 211 | .dependencies = featureSet(&[_]Feature{}), |
| 212 | 212 | }; |
| 213 | result[@intFromEnum(Feature.miscellaneous_extensions_3)] = .{ | |
| 213 | result[@backingInt(Feature.miscellaneous_extensions_3)] = .{ | |
| 214 | 214 | .llvm_name = "miscellaneous-extensions-3", |
| 215 | 215 | .description = "Assume that the miscellaneous-extensions facility 3 is installed", |
| 216 | 216 | .dependencies = featureSet(&[_]Feature{}), |
| 217 | 217 | }; |
| 218 | result[@intFromEnum(Feature.miscellaneous_extensions_4)] = .{ | |
| 218 | result[@backingInt(Feature.miscellaneous_extensions_4)] = .{ | |
| 219 | 219 | .llvm_name = "miscellaneous-extensions-4", |
| 220 | 220 | .description = "Assume that the miscellaneous-extensions facility 4 is installed", |
| 221 | 221 | .dependencies = featureSet(&[_]Feature{}), |
| 222 | 222 | }; |
| 223 | result[@intFromEnum(Feature.nnp_assist)] = .{ | |
| 223 | result[@backingInt(Feature.nnp_assist)] = .{ | |
| 224 | 224 | .llvm_name = "nnp-assist", |
| 225 | 225 | .description = "Assume that the NNP-assist facility is installed", |
| 226 | 226 | .dependencies = featureSet(&[_]Feature{}), |
| 227 | 227 | }; |
| 228 | result[@intFromEnum(Feature.population_count)] = .{ | |
| 228 | result[@backingInt(Feature.population_count)] = .{ | |
| 229 | 229 | .llvm_name = "population-count", |
| 230 | 230 | .description = "Assume that the population-count facility is installed", |
| 231 | 231 | .dependencies = featureSet(&[_]Feature{}), |
| 232 | 232 | }; |
| 233 | result[@intFromEnum(Feature.processor_activity_instrumentation)] = .{ | |
| 233 | result[@backingInt(Feature.processor_activity_instrumentation)] = .{ | |
| 234 | 234 | .llvm_name = "processor-activity-instrumentation", |
| 235 | 235 | .description = "Assume that the processor-activity-instrumentation facility is installed", |
| 236 | 236 | .dependencies = featureSet(&[_]Feature{}), |
| 237 | 237 | }; |
| 238 | result[@intFromEnum(Feature.processor_assist)] = .{ | |
| 238 | result[@backingInt(Feature.processor_assist)] = .{ | |
| 239 | 239 | .llvm_name = "processor-assist", |
| 240 | 240 | .description = "Assume that the processor-assist facility is installed", |
| 241 | 241 | .dependencies = featureSet(&[_]Feature{}), |
| 242 | 242 | }; |
| 243 | result[@intFromEnum(Feature.reset_dat_protection)] = .{ | |
| 243 | result[@backingInt(Feature.reset_dat_protection)] = .{ | |
| 244 | 244 | .llvm_name = "reset-dat-protection", |
| 245 | 245 | .description = "Assume that the reset-DAT-protection facility is installed", |
| 246 | 246 | .dependencies = featureSet(&[_]Feature{}), |
| 247 | 247 | }; |
| 248 | result[@intFromEnum(Feature.reset_reference_bits_multiple)] = .{ | |
| 248 | result[@backingInt(Feature.reset_reference_bits_multiple)] = .{ | |
| 249 | 249 | .llvm_name = "reset-reference-bits-multiple", |
| 250 | 250 | .description = "Assume that the reset-reference-bits-multiple facility is installed", |
| 251 | 251 | .dependencies = featureSet(&[_]Feature{}), |
| 252 | 252 | }; |
| 253 | result[@intFromEnum(Feature.soft_float)] = .{ | |
| 253 | result[@backingInt(Feature.soft_float)] = .{ | |
| 254 | 254 | .llvm_name = "soft-float", |
| 255 | 255 | .description = "Use software emulation for floating point", |
| 256 | 256 | .dependencies = featureSet(&[_]Feature{}), |
| 257 | 257 | }; |
| 258 | result[@intFromEnum(Feature.test_pending_external_interruption)] = .{ | |
| 258 | result[@backingInt(Feature.test_pending_external_interruption)] = .{ | |
| 259 | 259 | .llvm_name = "test-pending-external-interruption", |
| 260 | 260 | .description = "Assume that the test-pending-external-interruption facility is installed", |
| 261 | 261 | .dependencies = featureSet(&[_]Feature{}), |
| 262 | 262 | }; |
| 263 | result[@intFromEnum(Feature.transactional_execution)] = .{ | |
| 263 | result[@backingInt(Feature.transactional_execution)] = .{ | |
| 264 | 264 | .llvm_name = "transactional-execution", |
| 265 | 265 | .description = "Assume that the transactional-execution facility is installed", |
| 266 | 266 | .dependencies = featureSet(&[_]Feature{}), |
| 267 | 267 | }; |
| 268 | result[@intFromEnum(Feature.unaligned_symbols)] = .{ | |
| 268 | result[@backingInt(Feature.unaligned_symbols)] = .{ | |
| 269 | 269 | .llvm_name = "unaligned-symbols", |
| 270 | 270 | .description = "Don't apply the ABI minimum alignment to external symbols.", |
| 271 | 271 | .dependencies = featureSet(&[_]Feature{}), |
| 272 | 272 | }; |
| 273 | result[@intFromEnum(Feature.vector)] = .{ | |
| 273 | result[@backingInt(Feature.vector)] = .{ | |
| 274 | 274 | .llvm_name = "vector", |
| 275 | 275 | .description = "Assume that the vectory facility is installed", |
| 276 | 276 | .dependencies = featureSet(&[_]Feature{}), |
| 277 | 277 | }; |
| 278 | result[@intFromEnum(Feature.vector_enhancements_1)] = .{ | |
| 278 | result[@backingInt(Feature.vector_enhancements_1)] = .{ | |
| 279 | 279 | .llvm_name = "vector-enhancements-1", |
| 280 | 280 | .description = "Assume that the vector enhancements facility 1 is installed", |
| 281 | 281 | .dependencies = featureSet(&[_]Feature{}), |
| 282 | 282 | }; |
| 283 | result[@intFromEnum(Feature.vector_enhancements_2)] = .{ | |
| 283 | result[@backingInt(Feature.vector_enhancements_2)] = .{ | |
| 284 | 284 | .llvm_name = "vector-enhancements-2", |
| 285 | 285 | .description = "Assume that the vector enhancements facility 2 is installed", |
| 286 | 286 | .dependencies = featureSet(&[_]Feature{}), |
| 287 | 287 | }; |
| 288 | result[@intFromEnum(Feature.vector_enhancements_3)] = .{ | |
| 288 | result[@backingInt(Feature.vector_enhancements_3)] = .{ | |
| 289 | 289 | .llvm_name = "vector-enhancements-3", |
| 290 | 290 | .description = "Assume that the vector enhancements facility 3 is installed", |
| 291 | 291 | .dependencies = featureSet(&[_]Feature{}), |
| 292 | 292 | }; |
| 293 | result[@intFromEnum(Feature.vector_packed_decimal)] = .{ | |
| 293 | result[@backingInt(Feature.vector_packed_decimal)] = .{ | |
| 294 | 294 | .llvm_name = "vector-packed-decimal", |
| 295 | 295 | .description = "Assume that the vector packed decimal facility is installed", |
| 296 | 296 | .dependencies = featureSet(&[_]Feature{}), |
| 297 | 297 | }; |
| 298 | result[@intFromEnum(Feature.vector_packed_decimal_enhancement)] = .{ | |
| 298 | result[@backingInt(Feature.vector_packed_decimal_enhancement)] = .{ | |
| 299 | 299 | .llvm_name = "vector-packed-decimal-enhancement", |
| 300 | 300 | .description = "Assume that the vector packed decimal enhancement facility is installed", |
| 301 | 301 | .dependencies = featureSet(&[_]Feature{}), |
| 302 | 302 | }; |
| 303 | result[@intFromEnum(Feature.vector_packed_decimal_enhancement_2)] = .{ | |
| 303 | result[@backingInt(Feature.vector_packed_decimal_enhancement_2)] = .{ | |
| 304 | 304 | .llvm_name = "vector-packed-decimal-enhancement-2", |
| 305 | 305 | .description = "Assume that the vector packed decimal enhancement facility 2 is installed", |
| 306 | 306 | .dependencies = featureSet(&[_]Feature{}), |
| 307 | 307 | }; |
| 308 | result[@intFromEnum(Feature.vector_packed_decimal_enhancement_3)] = .{ | |
| 308 | result[@backingInt(Feature.vector_packed_decimal_enhancement_3)] = .{ | |
| 309 | 309 | .llvm_name = "vector-packed-decimal-enhancement-3", |
| 310 | 310 | .description = "Assume that the vector packed decimal enhancement facility 3 is installed", |
| 311 | 311 | .dependencies = featureSet(&[_]Feature{}), |
lib/std/Target/sparc.zig+59-59| ... | ... | @@ -75,111 +75,111 @@ pub const all_features = blk: { |
| 75 | 75 | const len = @typeInfo(Feature).@"enum".field_names.len; |
| 76 | 76 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); |
| 77 | 77 | var result: [len]CpuFeature = undefined; |
| 78 | result[@intFromEnum(Feature.@"64bit")] = .{ | |
| 78 | result[@backingInt(Feature.@"64bit")] = .{ | |
| 79 | 79 | .llvm_name = "64bit", |
| 80 | 80 | .description = "Enable 64-bit mode", |
| 81 | 81 | .dependencies = featureSet(&[_]Feature{ |
| 82 | 82 | .v9, |
| 83 | 83 | }), |
| 84 | 84 | }; |
| 85 | result[@intFromEnum(Feature.crypto)] = .{ | |
| 85 | result[@backingInt(Feature.crypto)] = .{ | |
| 86 | 86 | .llvm_name = "crypto", |
| 87 | 87 | .description = "Enable cryptographic extensions", |
| 88 | 88 | .dependencies = featureSet(&[_]Feature{ |
| 89 | 89 | .osa2011, |
| 90 | 90 | }), |
| 91 | 91 | }; |
| 92 | result[@intFromEnum(Feature.deprecated_v8)] = .{ | |
| 92 | result[@backingInt(Feature.deprecated_v8)] = .{ | |
| 93 | 93 | .llvm_name = "deprecated-v8", |
| 94 | 94 | .description = "Enable deprecated V8 instructions in V9 mode", |
| 95 | 95 | .dependencies = featureSet(&[_]Feature{}), |
| 96 | 96 | }; |
| 97 | result[@intFromEnum(Feature.detectroundchange)] = .{ | |
| 97 | result[@backingInt(Feature.detectroundchange)] = .{ | |
| 98 | 98 | .llvm_name = "detectroundchange", |
| 99 | 99 | .description = "LEON3 erratum detection: Detects any rounding mode change request: use only the round-to-nearest rounding mode", |
| 100 | 100 | .dependencies = featureSet(&[_]Feature{}), |
| 101 | 101 | }; |
| 102 | result[@intFromEnum(Feature.fix_tn0009)] = .{ | |
| 102 | result[@backingInt(Feature.fix_tn0009)] = .{ | |
| 103 | 103 | .llvm_name = "fix-tn0009", |
| 104 | 104 | .description = "Enable workaround for errata described in GRLIB-TN-0009", |
| 105 | 105 | .dependencies = featureSet(&[_]Feature{}), |
| 106 | 106 | }; |
| 107 | result[@intFromEnum(Feature.fix_tn0010)] = .{ | |
| 107 | result[@backingInt(Feature.fix_tn0010)] = .{ | |
| 108 | 108 | .llvm_name = "fix-tn0010", |
| 109 | 109 | .description = "Enable workaround for errata described in GRLIB-TN-0010", |
| 110 | 110 | .dependencies = featureSet(&[_]Feature{}), |
| 111 | 111 | }; |
| 112 | result[@intFromEnum(Feature.fix_tn0011)] = .{ | |
| 112 | result[@backingInt(Feature.fix_tn0011)] = .{ | |
| 113 | 113 | .llvm_name = "fix-tn0011", |
| 114 | 114 | .description = "Enable workaround for errata described in GRLIB-TN-0011", |
| 115 | 115 | .dependencies = featureSet(&[_]Feature{}), |
| 116 | 116 | }; |
| 117 | result[@intFromEnum(Feature.fix_tn0012)] = .{ | |
| 117 | result[@backingInt(Feature.fix_tn0012)] = .{ | |
| 118 | 118 | .llvm_name = "fix-tn0012", |
| 119 | 119 | .description = "Enable workaround for errata described in GRLIB-TN-0012", |
| 120 | 120 | .dependencies = featureSet(&[_]Feature{}), |
| 121 | 121 | }; |
| 122 | result[@intFromEnum(Feature.fix_tn0013)] = .{ | |
| 122 | result[@backingInt(Feature.fix_tn0013)] = .{ | |
| 123 | 123 | .llvm_name = "fix-tn0013", |
| 124 | 124 | .description = "Enable workaround for errata described in GRLIB-TN-0013", |
| 125 | 125 | .dependencies = featureSet(&[_]Feature{}), |
| 126 | 126 | }; |
| 127 | result[@intFromEnum(Feature.fixallfdivsqrt)] = .{ | |
| 127 | result[@backingInt(Feature.fixallfdivsqrt)] = .{ | |
| 128 | 128 | .llvm_name = "fixallfdivsqrt", |
| 129 | 129 | .description = "LEON erratum fix: Fix FDIVS/FDIVD/FSQRTS/FSQRTD instructions with NOPs and floating-point store", |
| 130 | 130 | .dependencies = featureSet(&[_]Feature{}), |
| 131 | 131 | }; |
| 132 | result[@intFromEnum(Feature.hard_quad_float)] = .{ | |
| 132 | result[@backingInt(Feature.hard_quad_float)] = .{ | |
| 133 | 133 | .llvm_name = "hard-quad-float", |
| 134 | 134 | .description = "Enable quad-word floating point instructions", |
| 135 | 135 | .dependencies = featureSet(&[_]Feature{}), |
| 136 | 136 | }; |
| 137 | result[@intFromEnum(Feature.hasleoncasa)] = .{ | |
| 137 | result[@backingInt(Feature.hasleoncasa)] = .{ | |
| 138 | 138 | .llvm_name = "hasleoncasa", |
| 139 | 139 | .description = "Enable CASA instruction for LEON3 and LEON4 processors", |
| 140 | 140 | .dependencies = featureSet(&[_]Feature{}), |
| 141 | 141 | }; |
| 142 | result[@intFromEnum(Feature.hasumacsmac)] = .{ | |
| 142 | result[@backingInt(Feature.hasumacsmac)] = .{ | |
| 143 | 143 | .llvm_name = "hasumacsmac", |
| 144 | 144 | .description = "Enable UMAC and SMAC for LEON3 and LEON4 processors", |
| 145 | 145 | .dependencies = featureSet(&[_]Feature{}), |
| 146 | 146 | }; |
| 147 | result[@intFromEnum(Feature.insertnopload)] = .{ | |
| 147 | result[@backingInt(Feature.insertnopload)] = .{ | |
| 148 | 148 | .llvm_name = "insertnopload", |
| 149 | 149 | .description = "LEON3 erratum fix: Insert a NOP instruction after every single-cycle load instruction when the next instruction is another load/store instruction", |
| 150 | 150 | .dependencies = featureSet(&[_]Feature{}), |
| 151 | 151 | }; |
| 152 | result[@intFromEnum(Feature.leon)] = .{ | |
| 152 | result[@backingInt(Feature.leon)] = .{ | |
| 153 | 153 | .llvm_name = "leon", |
| 154 | 154 | .description = "Enable LEON extensions", |
| 155 | 155 | .dependencies = featureSet(&[_]Feature{}), |
| 156 | 156 | }; |
| 157 | result[@intFromEnum(Feature.leoncyclecounter)] = .{ | |
| 157 | result[@backingInt(Feature.leoncyclecounter)] = .{ | |
| 158 | 158 | .llvm_name = "leoncyclecounter", |
| 159 | 159 | .description = "Use the Leon cycle counter register", |
| 160 | 160 | .dependencies = featureSet(&[_]Feature{}), |
| 161 | 161 | }; |
| 162 | result[@intFromEnum(Feature.leonpwrpsr)] = .{ | |
| 162 | result[@backingInt(Feature.leonpwrpsr)] = .{ | |
| 163 | 163 | .llvm_name = "leonpwrpsr", |
| 164 | 164 | .description = "Enable the PWRPSR instruction", |
| 165 | 165 | .dependencies = featureSet(&[_]Feature{}), |
| 166 | 166 | }; |
| 167 | result[@intFromEnum(Feature.no_fmuls)] = .{ | |
| 167 | result[@backingInt(Feature.no_fmuls)] = .{ | |
| 168 | 168 | .llvm_name = "no-fmuls", |
| 169 | 169 | .description = "Disable the fmuls instruction.", |
| 170 | 170 | .dependencies = featureSet(&[_]Feature{}), |
| 171 | 171 | }; |
| 172 | result[@intFromEnum(Feature.no_fsmuld)] = .{ | |
| 172 | result[@backingInt(Feature.no_fsmuld)] = .{ | |
| 173 | 173 | .llvm_name = "no-fsmuld", |
| 174 | 174 | .description = "Disable the fsmuld instruction.", |
| 175 | 175 | .dependencies = featureSet(&[_]Feature{}), |
| 176 | 176 | }; |
| 177 | result[@intFromEnum(Feature.no_predictor)] = .{ | |
| 177 | result[@backingInt(Feature.no_predictor)] = .{ | |
| 178 | 178 | .llvm_name = "no-predictor", |
| 179 | 179 | .description = "Processor has no branch predictor, branches stall execution", |
| 180 | 180 | .dependencies = featureSet(&[_]Feature{}), |
| 181 | 181 | }; |
| 182 | result[@intFromEnum(Feature.osa2011)] = .{ | |
| 182 | result[@backingInt(Feature.osa2011)] = .{ | |
| 183 | 183 | .llvm_name = "osa2011", |
| 184 | 184 | .description = "Enable Oracle SPARC Architecture 2011 extensions", |
| 185 | 185 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -188,164 +188,164 @@ pub const all_features = blk: { |
| 188 | 188 | .vis3, |
| 189 | 189 | }), |
| 190 | 190 | }; |
| 191 | result[@intFromEnum(Feature.popc)] = .{ | |
| 191 | result[@backingInt(Feature.popc)] = .{ | |
| 192 | 192 | .llvm_name = "popc", |
| 193 | 193 | .description = "Use the popc (population count) instruction", |
| 194 | 194 | .dependencies = featureSet(&[_]Feature{}), |
| 195 | 195 | }; |
| 196 | result[@intFromEnum(Feature.reserve_g1)] = .{ | |
| 196 | result[@backingInt(Feature.reserve_g1)] = .{ | |
| 197 | 197 | .llvm_name = "reserve-g1", |
| 198 | 198 | .description = "Reserve G1, making it unavailable as a GPR", |
| 199 | 199 | .dependencies = featureSet(&[_]Feature{}), |
| 200 | 200 | }; |
| 201 | result[@intFromEnum(Feature.reserve_g2)] = .{ | |
| 201 | result[@backingInt(Feature.reserve_g2)] = .{ | |
| 202 | 202 | .llvm_name = "reserve-g2", |
| 203 | 203 | .description = "Reserve G2, making it unavailable as a GPR", |
| 204 | 204 | .dependencies = featureSet(&[_]Feature{}), |
| 205 | 205 | }; |
| 206 | result[@intFromEnum(Feature.reserve_g3)] = .{ | |
| 206 | result[@backingInt(Feature.reserve_g3)] = .{ | |
| 207 | 207 | .llvm_name = "reserve-g3", |
| 208 | 208 | .description = "Reserve G3, making it unavailable as a GPR", |
| 209 | 209 | .dependencies = featureSet(&[_]Feature{}), |
| 210 | 210 | }; |
| 211 | result[@intFromEnum(Feature.reserve_g4)] = .{ | |
| 211 | result[@backingInt(Feature.reserve_g4)] = .{ | |
| 212 | 212 | .llvm_name = "reserve-g4", |
| 213 | 213 | .description = "Reserve G4, making it unavailable as a GPR", |
| 214 | 214 | .dependencies = featureSet(&[_]Feature{}), |
| 215 | 215 | }; |
| 216 | result[@intFromEnum(Feature.reserve_g5)] = .{ | |
| 216 | result[@backingInt(Feature.reserve_g5)] = .{ | |
| 217 | 217 | .llvm_name = "reserve-g5", |
| 218 | 218 | .description = "Reserve G5, making it unavailable as a GPR", |
| 219 | 219 | .dependencies = featureSet(&[_]Feature{}), |
| 220 | 220 | }; |
| 221 | result[@intFromEnum(Feature.reserve_g6)] = .{ | |
| 221 | result[@backingInt(Feature.reserve_g6)] = .{ | |
| 222 | 222 | .llvm_name = "reserve-g6", |
| 223 | 223 | .description = "Reserve G6, making it unavailable as a GPR", |
| 224 | 224 | .dependencies = featureSet(&[_]Feature{}), |
| 225 | 225 | }; |
| 226 | result[@intFromEnum(Feature.reserve_g7)] = .{ | |
| 226 | result[@backingInt(Feature.reserve_g7)] = .{ | |
| 227 | 227 | .llvm_name = "reserve-g7", |
| 228 | 228 | .description = "Reserve G7, making it unavailable as a GPR", |
| 229 | 229 | .dependencies = featureSet(&[_]Feature{}), |
| 230 | 230 | }; |
| 231 | result[@intFromEnum(Feature.reserve_i0)] = .{ | |
| 231 | result[@backingInt(Feature.reserve_i0)] = .{ | |
| 232 | 232 | .llvm_name = "reserve-i0", |
| 233 | 233 | .description = "Reserve I0, making it unavailable as a GPR", |
| 234 | 234 | .dependencies = featureSet(&[_]Feature{}), |
| 235 | 235 | }; |
| 236 | result[@intFromEnum(Feature.reserve_i1)] = .{ | |
| 236 | result[@backingInt(Feature.reserve_i1)] = .{ | |
| 237 | 237 | .llvm_name = "reserve-i1", |
| 238 | 238 | .description = "Reserve I1, making it unavailable as a GPR", |
| 239 | 239 | .dependencies = featureSet(&[_]Feature{}), |
| 240 | 240 | }; |
| 241 | result[@intFromEnum(Feature.reserve_i2)] = .{ | |
| 241 | result[@backingInt(Feature.reserve_i2)] = .{ | |
| 242 | 242 | .llvm_name = "reserve-i2", |
| 243 | 243 | .description = "Reserve I2, making it unavailable as a GPR", |
| 244 | 244 | .dependencies = featureSet(&[_]Feature{}), |
| 245 | 245 | }; |
| 246 | result[@intFromEnum(Feature.reserve_i3)] = .{ | |
| 246 | result[@backingInt(Feature.reserve_i3)] = .{ | |
| 247 | 247 | .llvm_name = "reserve-i3", |
| 248 | 248 | .description = "Reserve I3, making it unavailable as a GPR", |
| 249 | 249 | .dependencies = featureSet(&[_]Feature{}), |
| 250 | 250 | }; |
| 251 | result[@intFromEnum(Feature.reserve_i4)] = .{ | |
| 251 | result[@backingInt(Feature.reserve_i4)] = .{ | |
| 252 | 252 | .llvm_name = "reserve-i4", |
| 253 | 253 | .description = "Reserve I4, making it unavailable as a GPR", |
| 254 | 254 | .dependencies = featureSet(&[_]Feature{}), |
| 255 | 255 | }; |
| 256 | result[@intFromEnum(Feature.reserve_i5)] = .{ | |
| 256 | result[@backingInt(Feature.reserve_i5)] = .{ | |
| 257 | 257 | .llvm_name = "reserve-i5", |
| 258 | 258 | .description = "Reserve I5, making it unavailable as a GPR", |
| 259 | 259 | .dependencies = featureSet(&[_]Feature{}), |
| 260 | 260 | }; |
| 261 | result[@intFromEnum(Feature.reserve_l0)] = .{ | |
| 261 | result[@backingInt(Feature.reserve_l0)] = .{ | |
| 262 | 262 | .llvm_name = "reserve-l0", |
| 263 | 263 | .description = "Reserve L0, making it unavailable as a GPR", |
| 264 | 264 | .dependencies = featureSet(&[_]Feature{}), |
| 265 | 265 | }; |
| 266 | result[@intFromEnum(Feature.reserve_l1)] = .{ | |
| 266 | result[@backingInt(Feature.reserve_l1)] = .{ | |
| 267 | 267 | .llvm_name = "reserve-l1", |
| 268 | 268 | .description = "Reserve L1, making it unavailable as a GPR", |
| 269 | 269 | .dependencies = featureSet(&[_]Feature{}), |
| 270 | 270 | }; |
| 271 | result[@intFromEnum(Feature.reserve_l2)] = .{ | |
| 271 | result[@backingInt(Feature.reserve_l2)] = .{ | |
| 272 | 272 | .llvm_name = "reserve-l2", |
| 273 | 273 | .description = "Reserve L2, making it unavailable as a GPR", |
| 274 | 274 | .dependencies = featureSet(&[_]Feature{}), |
| 275 | 275 | }; |
| 276 | result[@intFromEnum(Feature.reserve_l3)] = .{ | |
| 276 | result[@backingInt(Feature.reserve_l3)] = .{ | |
| 277 | 277 | .llvm_name = "reserve-l3", |
| 278 | 278 | .description = "Reserve L3, making it unavailable as a GPR", |
| 279 | 279 | .dependencies = featureSet(&[_]Feature{}), |
| 280 | 280 | }; |
| 281 | result[@intFromEnum(Feature.reserve_l4)] = .{ | |
| 281 | result[@backingInt(Feature.reserve_l4)] = .{ | |
| 282 | 282 | .llvm_name = "reserve-l4", |
| 283 | 283 | .description = "Reserve L4, making it unavailable as a GPR", |
| 284 | 284 | .dependencies = featureSet(&[_]Feature{}), |
| 285 | 285 | }; |
| 286 | result[@intFromEnum(Feature.reserve_l5)] = .{ | |
| 286 | result[@backingInt(Feature.reserve_l5)] = .{ | |
| 287 | 287 | .llvm_name = "reserve-l5", |
| 288 | 288 | .description = "Reserve L5, making it unavailable as a GPR", |
| 289 | 289 | .dependencies = featureSet(&[_]Feature{}), |
| 290 | 290 | }; |
| 291 | result[@intFromEnum(Feature.reserve_l6)] = .{ | |
| 291 | result[@backingInt(Feature.reserve_l6)] = .{ | |
| 292 | 292 | .llvm_name = "reserve-l6", |
| 293 | 293 | .description = "Reserve L6, making it unavailable as a GPR", |
| 294 | 294 | .dependencies = featureSet(&[_]Feature{}), |
| 295 | 295 | }; |
| 296 | result[@intFromEnum(Feature.reserve_l7)] = .{ | |
| 296 | result[@backingInt(Feature.reserve_l7)] = .{ | |
| 297 | 297 | .llvm_name = "reserve-l7", |
| 298 | 298 | .description = "Reserve L7, making it unavailable as a GPR", |
| 299 | 299 | .dependencies = featureSet(&[_]Feature{}), |
| 300 | 300 | }; |
| 301 | result[@intFromEnum(Feature.reserve_o0)] = .{ | |
| 301 | result[@backingInt(Feature.reserve_o0)] = .{ | |
| 302 | 302 | .llvm_name = "reserve-o0", |
| 303 | 303 | .description = "Reserve O0, making it unavailable as a GPR", |
| 304 | 304 | .dependencies = featureSet(&[_]Feature{}), |
| 305 | 305 | }; |
| 306 | result[@intFromEnum(Feature.reserve_o1)] = .{ | |
| 306 | result[@backingInt(Feature.reserve_o1)] = .{ | |
| 307 | 307 | .llvm_name = "reserve-o1", |
| 308 | 308 | .description = "Reserve O1, making it unavailable as a GPR", |
| 309 | 309 | .dependencies = featureSet(&[_]Feature{}), |
| 310 | 310 | }; |
| 311 | result[@intFromEnum(Feature.reserve_o2)] = .{ | |
| 311 | result[@backingInt(Feature.reserve_o2)] = .{ | |
| 312 | 312 | .llvm_name = "reserve-o2", |
| 313 | 313 | .description = "Reserve O2, making it unavailable as a GPR", |
| 314 | 314 | .dependencies = featureSet(&[_]Feature{}), |
| 315 | 315 | }; |
| 316 | result[@intFromEnum(Feature.reserve_o3)] = .{ | |
| 316 | result[@backingInt(Feature.reserve_o3)] = .{ | |
| 317 | 317 | .llvm_name = "reserve-o3", |
| 318 | 318 | .description = "Reserve O3, making it unavailable as a GPR", |
| 319 | 319 | .dependencies = featureSet(&[_]Feature{}), |
| 320 | 320 | }; |
| 321 | result[@intFromEnum(Feature.reserve_o4)] = .{ | |
| 321 | result[@backingInt(Feature.reserve_o4)] = .{ | |
| 322 | 322 | .llvm_name = "reserve-o4", |
| 323 | 323 | .description = "Reserve O4, making it unavailable as a GPR", |
| 324 | 324 | .dependencies = featureSet(&[_]Feature{}), |
| 325 | 325 | }; |
| 326 | result[@intFromEnum(Feature.reserve_o5)] = .{ | |
| 326 | result[@backingInt(Feature.reserve_o5)] = .{ | |
| 327 | 327 | .llvm_name = "reserve-o5", |
| 328 | 328 | .description = "Reserve O5, making it unavailable as a GPR", |
| 329 | 329 | .dependencies = featureSet(&[_]Feature{}), |
| 330 | 330 | }; |
| 331 | result[@intFromEnum(Feature.slow_rdpc)] = .{ | |
| 331 | result[@backingInt(Feature.slow_rdpc)] = .{ | |
| 332 | 332 | .llvm_name = "slow-rdpc", |
| 333 | 333 | .description = "rd %pc, %XX is slow", |
| 334 | 334 | .dependencies = featureSet(&[_]Feature{ |
| 335 | 335 | .v9, |
| 336 | 336 | }), |
| 337 | 337 | }; |
| 338 | result[@intFromEnum(Feature.soft_float)] = .{ | |
| 338 | result[@backingInt(Feature.soft_float)] = .{ | |
| 339 | 339 | .llvm_name = "soft-float", |
| 340 | 340 | .description = "Use software emulation for floating point", |
| 341 | 341 | .dependencies = featureSet(&[_]Feature{}), |
| 342 | 342 | }; |
| 343 | result[@intFromEnum(Feature.soft_mul_div)] = .{ | |
| 343 | result[@backingInt(Feature.soft_mul_div)] = .{ | |
| 344 | 344 | .llvm_name = "soft-mul-div", |
| 345 | 345 | .description = "Use software emulation for integer multiply and divide", |
| 346 | 346 | .dependencies = featureSet(&[_]Feature{}), |
| 347 | 347 | }; |
| 348 | result[@intFromEnum(Feature.ua2005)] = .{ | |
| 348 | result[@backingInt(Feature.ua2005)] = .{ | |
| 349 | 349 | .llvm_name = "ua2005", |
| 350 | 350 | .description = "Enable UltraSPARC Architecture 2005 extensions", |
| 351 | 351 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -353,7 +353,7 @@ pub const all_features = blk: { |
| 353 | 353 | .vis2, |
| 354 | 354 | }), |
| 355 | 355 | }; |
| 356 | result[@intFromEnum(Feature.ua2007)] = .{ | |
| 356 | result[@backingInt(Feature.ua2007)] = .{ | |
| 357 | 357 | .llvm_name = "ua2007", |
| 358 | 358 | .description = "Enable UltraSPARC Architecture 2007 extensions", |
| 359 | 359 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -361,31 +361,31 @@ pub const all_features = blk: { |
| 361 | 361 | .vis2, |
| 362 | 362 | }), |
| 363 | 363 | }; |
| 364 | result[@intFromEnum(Feature.v8plus)] = .{ | |
| 364 | result[@backingInt(Feature.v8plus)] = .{ | |
| 365 | 365 | .llvm_name = "v8plus", |
| 366 | 366 | .description = "Enable V8+ mode, allowing use of 64-bit V9 instructions in 32-bit code", |
| 367 | 367 | .dependencies = featureSet(&[_]Feature{}), |
| 368 | 368 | }; |
| 369 | result[@intFromEnum(Feature.v9)] = .{ | |
| 369 | result[@backingInt(Feature.v9)] = .{ | |
| 370 | 370 | .llvm_name = "v9", |
| 371 | 371 | .description = "Enable SPARC-V9 instructions", |
| 372 | 372 | .dependencies = featureSet(&[_]Feature{}), |
| 373 | 373 | }; |
| 374 | result[@intFromEnum(Feature.vis)] = .{ | |
| 374 | result[@backingInt(Feature.vis)] = .{ | |
| 375 | 375 | .llvm_name = "vis", |
| 376 | 376 | .description = "Enable UltraSPARC Visual Instruction Set extensions", |
| 377 | 377 | .dependencies = featureSet(&[_]Feature{ |
| 378 | 378 | .v9, |
| 379 | 379 | }), |
| 380 | 380 | }; |
| 381 | result[@intFromEnum(Feature.vis2)] = .{ | |
| 381 | result[@backingInt(Feature.vis2)] = .{ | |
| 382 | 382 | .llvm_name = "vis2", |
| 383 | 383 | .description = "Enable Visual Instruction Set extensions II", |
| 384 | 384 | .dependencies = featureSet(&[_]Feature{ |
| 385 | 385 | .v9, |
| 386 | 386 | }), |
| 387 | 387 | }; |
| 388 | result[@intFromEnum(Feature.vis3)] = .{ | |
| 388 | result[@backingInt(Feature.vis3)] = .{ | |
| 389 | 389 | .llvm_name = "vis3", |
| 390 | 390 | .description = "Enable Visual Instruction Set extensions III", |
| 391 | 391 | .dependencies = featureSet(&[_]Feature{ |
lib/std/Target/spirv.zig+228-228| ... | ... | @@ -245,7 +245,7 @@ pub const all_features = blk: { |
| 245 | 245 | const len = @typeInfo(Feature).@"enum".field_names.len; |
| 246 | 246 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); |
| 247 | 247 | var result: [len]CpuFeature = undefined; |
| 248 | result[@intFromEnum(Feature.abort_khr)] = .{ | |
| 248 | result[@backingInt(Feature.abort_khr)] = .{ | |
| 249 | 249 | .llvm_name = null, |
| 250 | 250 | .description = "Enable abort_khr capability", |
| 251 | 251 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -253,7 +253,7 @@ pub const all_features = blk: { |
| 253 | 253 | .v1_0, |
| 254 | 254 | }), |
| 255 | 255 | }; |
| 256 | result[@intFromEnum(Feature.arithmetic_fence_ext)] = .{ | |
| 256 | result[@backingInt(Feature.arithmetic_fence_ext)] = .{ | |
| 257 | 257 | .llvm_name = null, |
| 258 | 258 | .description = "Enable arithmetic_fence_ext capability", |
| 259 | 259 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -261,7 +261,7 @@ pub const all_features = blk: { |
| 261 | 261 | .v1_0, |
| 262 | 262 | }), |
| 263 | 263 | }; |
| 264 | result[@intFromEnum(Feature.atomic_float16add_ext)] = .{ | |
| 264 | result[@backingInt(Feature.atomic_float16add_ext)] = .{ | |
| 265 | 265 | .llvm_name = null, |
| 266 | 266 | .description = "Enable atomic_float16add_ext capability", |
| 267 | 267 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -269,7 +269,7 @@ pub const all_features = blk: { |
| 269 | 269 | .v1_0, |
| 270 | 270 | }), |
| 271 | 271 | }; |
| 272 | result[@intFromEnum(Feature.atomic_float16min_max_ext)] = .{ | |
| 272 | result[@backingInt(Feature.atomic_float16min_max_ext)] = .{ | |
| 273 | 273 | .llvm_name = null, |
| 274 | 274 | .description = "Enable atomic_float16min_max_ext capability", |
| 275 | 275 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -277,7 +277,7 @@ pub const all_features = blk: { |
| 277 | 277 | .v1_0, |
| 278 | 278 | }), |
| 279 | 279 | }; |
| 280 | result[@intFromEnum(Feature.atomic_float32add_ext)] = .{ | |
| 280 | result[@backingInt(Feature.atomic_float32add_ext)] = .{ | |
| 281 | 281 | .llvm_name = null, |
| 282 | 282 | .description = "Enable atomic_float32add_ext capability", |
| 283 | 283 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -285,7 +285,7 @@ pub const all_features = blk: { |
| 285 | 285 | .v1_0, |
| 286 | 286 | }), |
| 287 | 287 | }; |
| 288 | result[@intFromEnum(Feature.atomic_float32min_max_ext)] = .{ | |
| 288 | result[@backingInt(Feature.atomic_float32min_max_ext)] = .{ | |
| 289 | 289 | .llvm_name = null, |
| 290 | 290 | .description = "Enable atomic_float32min_max_ext capability", |
| 291 | 291 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -293,7 +293,7 @@ pub const all_features = blk: { |
| 293 | 293 | .v1_0, |
| 294 | 294 | }), |
| 295 | 295 | }; |
| 296 | result[@intFromEnum(Feature.atomic_float64add_ext)] = .{ | |
| 296 | result[@backingInt(Feature.atomic_float64add_ext)] = .{ | |
| 297 | 297 | .llvm_name = null, |
| 298 | 298 | .description = "Enable atomic_float64add_ext capability", |
| 299 | 299 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -301,7 +301,7 @@ pub const all_features = blk: { |
| 301 | 301 | .v1_0, |
| 302 | 302 | }), |
| 303 | 303 | }; |
| 304 | result[@intFromEnum(Feature.atomic_float64min_max_ext)] = .{ | |
| 304 | result[@backingInt(Feature.atomic_float64min_max_ext)] = .{ | |
| 305 | 305 | .llvm_name = null, |
| 306 | 306 | .description = "Enable atomic_float64min_max_ext capability", |
| 307 | 307 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -309,14 +309,14 @@ pub const all_features = blk: { |
| 309 | 309 | .v1_0, |
| 310 | 310 | }), |
| 311 | 311 | }; |
| 312 | result[@intFromEnum(Feature.atomic_storage)] = .{ | |
| 312 | result[@backingInt(Feature.atomic_storage)] = .{ | |
| 313 | 313 | .llvm_name = null, |
| 314 | 314 | .description = "Enable atomic_storage capability", |
| 315 | 315 | .dependencies = featureSet(&[_]Feature{ |
| 316 | 316 | .v1_0, |
| 317 | 317 | }), |
| 318 | 318 | }; |
| 319 | result[@intFromEnum(Feature.atomic_storage_ops)] = .{ | |
| 319 | result[@backingInt(Feature.atomic_storage_ops)] = .{ | |
| 320 | 320 | .llvm_name = null, |
| 321 | 321 | .description = "Enable atomic_storage_ops capability", |
| 322 | 322 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -324,7 +324,7 @@ pub const all_features = blk: { |
| 324 | 324 | .v1_0, |
| 325 | 325 | }), |
| 326 | 326 | }; |
| 327 | result[@intFromEnum(Feature.b_float16cooperative_matrix_khr)] = .{ | |
| 327 | result[@backingInt(Feature.b_float16cooperative_matrix_khr)] = .{ | |
| 328 | 328 | .llvm_name = null, |
| 329 | 329 | .description = "Enable b_float16cooperative_matrix_khr capability", |
| 330 | 330 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -332,7 +332,7 @@ pub const all_features = blk: { |
| 332 | 332 | .v1_0, |
| 333 | 333 | }), |
| 334 | 334 | }; |
| 335 | result[@intFromEnum(Feature.b_float16dot_product_khr)] = .{ | |
| 335 | result[@backingInt(Feature.b_float16dot_product_khr)] = .{ | |
| 336 | 336 | .llvm_name = null, |
| 337 | 337 | .description = "Enable b_float16dot_product_khr capability", |
| 338 | 338 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -340,7 +340,7 @@ pub const all_features = blk: { |
| 340 | 340 | .v1_0, |
| 341 | 341 | }), |
| 342 | 342 | }; |
| 343 | result[@intFromEnum(Feature.b_float16type_khr)] = .{ | |
| 343 | result[@backingInt(Feature.b_float16type_khr)] = .{ | |
| 344 | 344 | .llvm_name = null, |
| 345 | 345 | .description = "Enable b_float16type_khr capability", |
| 346 | 346 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -348,7 +348,7 @@ pub const all_features = blk: { |
| 348 | 348 | .v1_0, |
| 349 | 349 | }), |
| 350 | 350 | }; |
| 351 | result[@intFromEnum(Feature.bit_instructions)] = .{ | |
| 351 | result[@backingInt(Feature.bit_instructions)] = .{ | |
| 352 | 352 | .llvm_name = null, |
| 353 | 353 | .description = "Enable bit_instructions capability", |
| 354 | 354 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -356,14 +356,14 @@ pub const all_features = blk: { |
| 356 | 356 | .v1_0, |
| 357 | 357 | }), |
| 358 | 358 | }; |
| 359 | result[@intFromEnum(Feature.clip_distance)] = .{ | |
| 359 | result[@backingInt(Feature.clip_distance)] = .{ | |
| 360 | 360 | .llvm_name = null, |
| 361 | 361 | .description = "Enable clip_distance capability", |
| 362 | 362 | .dependencies = featureSet(&[_]Feature{ |
| 363 | 363 | .v1_0, |
| 364 | 364 | }), |
| 365 | 365 | }; |
| 366 | result[@intFromEnum(Feature.compute_derivative_group_linear_khr)] = .{ | |
| 366 | result[@backingInt(Feature.compute_derivative_group_linear_khr)] = .{ | |
| 367 | 367 | .llvm_name = null, |
| 368 | 368 | .description = "Enable compute_derivative_group_linear_khr capability", |
| 369 | 369 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -371,7 +371,7 @@ pub const all_features = blk: { |
| 371 | 371 | .v1_0, |
| 372 | 372 | }), |
| 373 | 373 | }; |
| 374 | result[@intFromEnum(Feature.compute_derivative_group_quads_khr)] = .{ | |
| 374 | result[@backingInt(Feature.compute_derivative_group_quads_khr)] = .{ | |
| 375 | 375 | .llvm_name = null, |
| 376 | 376 | .description = "Enable compute_derivative_group_quads_khr capability", |
| 377 | 377 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -379,7 +379,7 @@ pub const all_features = blk: { |
| 379 | 379 | .v1_0, |
| 380 | 380 | }), |
| 381 | 381 | }; |
| 382 | result[@intFromEnum(Feature.constant_data_khr)] = .{ | |
| 382 | result[@backingInt(Feature.constant_data_khr)] = .{ | |
| 383 | 383 | .llvm_name = null, |
| 384 | 384 | .description = "Enable constant_data_khr capability", |
| 385 | 385 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -387,7 +387,7 @@ pub const all_features = blk: { |
| 387 | 387 | .v1_0, |
| 388 | 388 | }), |
| 389 | 389 | }; |
| 390 | result[@intFromEnum(Feature.cooperative_matrix_khr)] = .{ | |
| 390 | result[@backingInt(Feature.cooperative_matrix_khr)] = .{ | |
| 391 | 391 | .llvm_name = null, |
| 392 | 392 | .description = "Enable cooperative_matrix_khr capability", |
| 393 | 393 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -395,14 +395,14 @@ pub const all_features = blk: { |
| 395 | 395 | .v1_0, |
| 396 | 396 | }), |
| 397 | 397 | }; |
| 398 | result[@intFromEnum(Feature.cull_distance)] = .{ | |
| 398 | result[@backingInt(Feature.cull_distance)] = .{ | |
| 399 | 399 | .llvm_name = null, |
| 400 | 400 | .description = "Enable cull_distance capability", |
| 401 | 401 | .dependencies = featureSet(&[_]Feature{ |
| 402 | 402 | .v1_0, |
| 403 | 403 | }), |
| 404 | 404 | }; |
| 405 | result[@intFromEnum(Feature.demote_to_helper_invocation)] = .{ | |
| 405 | result[@backingInt(Feature.demote_to_helper_invocation)] = .{ | |
| 406 | 406 | .llvm_name = null, |
| 407 | 407 | .description = "Enable demote_to_helper_invocation capability", |
| 408 | 408 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -410,7 +410,7 @@ pub const all_features = blk: { |
| 410 | 410 | .v1_6, |
| 411 | 411 | }), |
| 412 | 412 | }; |
| 413 | result[@intFromEnum(Feature.denorm_flush_to_zero)] = .{ | |
| 413 | result[@backingInt(Feature.denorm_flush_to_zero)] = .{ | |
| 414 | 414 | .llvm_name = null, |
| 415 | 415 | .description = "Enable denorm_flush_to_zero capability", |
| 416 | 416 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -418,7 +418,7 @@ pub const all_features = blk: { |
| 418 | 418 | .v1_4, |
| 419 | 419 | }), |
| 420 | 420 | }; |
| 421 | result[@intFromEnum(Feature.denorm_preserve)] = .{ | |
| 421 | result[@backingInt(Feature.denorm_preserve)] = .{ | |
| 422 | 422 | .llvm_name = null, |
| 423 | 423 | .description = "Enable denorm_preserve capability", |
| 424 | 424 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -426,14 +426,14 @@ pub const all_features = blk: { |
| 426 | 426 | .v1_4, |
| 427 | 427 | }), |
| 428 | 428 | }; |
| 429 | result[@intFromEnum(Feature.derivative_control)] = .{ | |
| 429 | result[@backingInt(Feature.derivative_control)] = .{ | |
| 430 | 430 | .llvm_name = null, |
| 431 | 431 | .description = "Enable derivative_control capability", |
| 432 | 432 | .dependencies = featureSet(&[_]Feature{ |
| 433 | 433 | .v1_0, |
| 434 | 434 | }), |
| 435 | 435 | }; |
| 436 | result[@intFromEnum(Feature.descriptor_heap_ext)] = .{ | |
| 436 | result[@backingInt(Feature.descriptor_heap_ext)] = .{ | |
| 437 | 437 | .llvm_name = null, |
| 438 | 438 | .description = "Enable descriptor_heap_ext capability", |
| 439 | 439 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -441,14 +441,14 @@ pub const all_features = blk: { |
| 441 | 441 | .v1_0, |
| 442 | 442 | }), |
| 443 | 443 | }; |
| 444 | result[@intFromEnum(Feature.device_enqueue)] = .{ | |
| 444 | result[@backingInt(Feature.device_enqueue)] = .{ | |
| 445 | 445 | .llvm_name = null, |
| 446 | 446 | .description = "Enable device_enqueue capability", |
| 447 | 447 | .dependencies = featureSet(&[_]Feature{ |
| 448 | 448 | .v1_0, |
| 449 | 449 | }), |
| 450 | 450 | }; |
| 451 | result[@intFromEnum(Feature.device_group)] = .{ | |
| 451 | result[@backingInt(Feature.device_group)] = .{ | |
| 452 | 452 | .llvm_name = null, |
| 453 | 453 | .description = "Enable device_group capability", |
| 454 | 454 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -456,7 +456,7 @@ pub const all_features = blk: { |
| 456 | 456 | .v1_3, |
| 457 | 457 | }), |
| 458 | 458 | }; |
| 459 | result[@intFromEnum(Feature.dot_product)] = .{ | |
| 459 | result[@backingInt(Feature.dot_product)] = .{ | |
| 460 | 460 | .llvm_name = null, |
| 461 | 461 | .description = "Enable dot_product capability", |
| 462 | 462 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -464,7 +464,7 @@ pub const all_features = blk: { |
| 464 | 464 | .v1_6, |
| 465 | 465 | }), |
| 466 | 466 | }; |
| 467 | result[@intFromEnum(Feature.dot_product_input4x8bit)] = .{ | |
| 467 | result[@backingInt(Feature.dot_product_input4x8bit)] = .{ | |
| 468 | 468 | .llvm_name = null, |
| 469 | 469 | .description = "Enable dot_product_input4x8bit capability", |
| 470 | 470 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -472,7 +472,7 @@ pub const all_features = blk: { |
| 472 | 472 | .v1_6, |
| 473 | 473 | }), |
| 474 | 474 | }; |
| 475 | result[@intFromEnum(Feature.dot_product_input4x8bit_packed)] = .{ | |
| 475 | result[@backingInt(Feature.dot_product_input4x8bit_packed)] = .{ | |
| 476 | 476 | .llvm_name = null, |
| 477 | 477 | .description = "Enable dot_product_input4x8bit_packed capability", |
| 478 | 478 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -480,7 +480,7 @@ pub const all_features = blk: { |
| 480 | 480 | .v1_6, |
| 481 | 481 | }), |
| 482 | 482 | }; |
| 483 | result[@intFromEnum(Feature.dot_product_input_all)] = .{ | |
| 483 | result[@backingInt(Feature.dot_product_input_all)] = .{ | |
| 484 | 484 | .llvm_name = null, |
| 485 | 485 | .description = "Enable dot_product_input_all capability", |
| 486 | 486 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -488,7 +488,7 @@ pub const all_features = blk: { |
| 488 | 488 | .v1_6, |
| 489 | 489 | }), |
| 490 | 490 | }; |
| 491 | result[@intFromEnum(Feature.draw_parameters)] = .{ | |
| 491 | result[@backingInt(Feature.draw_parameters)] = .{ | |
| 492 | 492 | .llvm_name = null, |
| 493 | 493 | .description = "Enable draw_parameters capability", |
| 494 | 494 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -496,7 +496,7 @@ pub const all_features = blk: { |
| 496 | 496 | .v1_3, |
| 497 | 497 | }), |
| 498 | 498 | }; |
| 499 | result[@intFromEnum(Feature.expect_assume_khr)] = .{ | |
| 499 | result[@backingInt(Feature.expect_assume_khr)] = .{ | |
| 500 | 500 | .llvm_name = null, |
| 501 | 501 | .description = "Enable expect_assume_khr capability", |
| 502 | 502 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -504,28 +504,28 @@ pub const all_features = blk: { |
| 504 | 504 | .v1_0, |
| 505 | 505 | }), |
| 506 | 506 | }; |
| 507 | result[@intFromEnum(Feature.float16)] = .{ | |
| 507 | result[@backingInt(Feature.float16)] = .{ | |
| 508 | 508 | .llvm_name = null, |
| 509 | 509 | .description = "Enable float16 capability", |
| 510 | 510 | .dependencies = featureSet(&[_]Feature{ |
| 511 | 511 | .v1_0, |
| 512 | 512 | }), |
| 513 | 513 | }; |
| 514 | result[@intFromEnum(Feature.float16buffer)] = .{ | |
| 514 | result[@backingInt(Feature.float16buffer)] = .{ | |
| 515 | 515 | .llvm_name = null, |
| 516 | 516 | .description = "Enable float16buffer capability", |
| 517 | 517 | .dependencies = featureSet(&[_]Feature{ |
| 518 | 518 | .v1_0, |
| 519 | 519 | }), |
| 520 | 520 | }; |
| 521 | result[@intFromEnum(Feature.float64)] = .{ | |
| 521 | result[@backingInt(Feature.float64)] = .{ | |
| 522 | 522 | .llvm_name = null, |
| 523 | 523 | .description = "Enable float64 capability", |
| 524 | 524 | .dependencies = featureSet(&[_]Feature{ |
| 525 | 525 | .v1_0, |
| 526 | 526 | }), |
| 527 | 527 | }; |
| 528 | result[@intFromEnum(Feature.float8cooperative_matrix_ext)] = .{ | |
| 528 | result[@backingInt(Feature.float8cooperative_matrix_ext)] = .{ | |
| 529 | 529 | .llvm_name = null, |
| 530 | 530 | .description = "Enable float8cooperative_matrix_ext capability", |
| 531 | 531 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -533,7 +533,7 @@ pub const all_features = blk: { |
| 533 | 533 | .v1_0, |
| 534 | 534 | }), |
| 535 | 535 | }; |
| 536 | result[@intFromEnum(Feature.float8ext)] = .{ | |
| 536 | result[@backingInt(Feature.float8ext)] = .{ | |
| 537 | 537 | .llvm_name = null, |
| 538 | 538 | .description = "Enable float8ext capability", |
| 539 | 539 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -541,7 +541,7 @@ pub const all_features = blk: { |
| 541 | 541 | .v1_0, |
| 542 | 542 | }), |
| 543 | 543 | }; |
| 544 | result[@intFromEnum(Feature.float_controls2)] = .{ | |
| 544 | result[@backingInt(Feature.float_controls2)] = .{ | |
| 545 | 545 | .llvm_name = null, |
| 546 | 546 | .description = "Enable float_controls2 capability", |
| 547 | 547 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -549,7 +549,7 @@ pub const all_features = blk: { |
| 549 | 549 | .v1_0, |
| 550 | 550 | }), |
| 551 | 551 | }; |
| 552 | result[@intFromEnum(Feature.fmakhr)] = .{ | |
| 552 | result[@backingInt(Feature.fmakhr)] = .{ | |
| 553 | 553 | .llvm_name = null, |
| 554 | 554 | .description = "Enable fmakhr capability", |
| 555 | 555 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -557,7 +557,7 @@ pub const all_features = blk: { |
| 557 | 557 | .v1_0, |
| 558 | 558 | }), |
| 559 | 559 | }; |
| 560 | result[@intFromEnum(Feature.fragment_barycentric_khr)] = .{ | |
| 560 | result[@backingInt(Feature.fragment_barycentric_khr)] = .{ | |
| 561 | 561 | .llvm_name = null, |
| 562 | 562 | .description = "Enable fragment_barycentric_khr capability", |
| 563 | 563 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -565,7 +565,7 @@ pub const all_features = blk: { |
| 565 | 565 | .v1_0, |
| 566 | 566 | }), |
| 567 | 567 | }; |
| 568 | result[@intFromEnum(Feature.fragment_density_ext)] = .{ | |
| 568 | result[@backingInt(Feature.fragment_density_ext)] = .{ | |
| 569 | 569 | .llvm_name = null, |
| 570 | 570 | .description = "Enable fragment_density_ext capability", |
| 571 | 571 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -573,7 +573,7 @@ pub const all_features = blk: { |
| 573 | 573 | .v1_0, |
| 574 | 574 | }), |
| 575 | 575 | }; |
| 576 | result[@intFromEnum(Feature.fragment_fully_covered_ext)] = .{ | |
| 576 | result[@backingInt(Feature.fragment_fully_covered_ext)] = .{ | |
| 577 | 577 | .llvm_name = null, |
| 578 | 578 | .description = "Enable fragment_fully_covered_ext capability", |
| 579 | 579 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -581,7 +581,7 @@ pub const all_features = blk: { |
| 581 | 581 | .v1_0, |
| 582 | 582 | }), |
| 583 | 583 | }; |
| 584 | result[@intFromEnum(Feature.fragment_shader_pixel_interlock_ext)] = .{ | |
| 584 | result[@backingInt(Feature.fragment_shader_pixel_interlock_ext)] = .{ | |
| 585 | 585 | .llvm_name = null, |
| 586 | 586 | .description = "Enable fragment_shader_pixel_interlock_ext capability", |
| 587 | 587 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -589,7 +589,7 @@ pub const all_features = blk: { |
| 589 | 589 | .v1_0, |
| 590 | 590 | }), |
| 591 | 591 | }; |
| 592 | result[@intFromEnum(Feature.fragment_shader_sample_interlock_ext)] = .{ | |
| 592 | result[@backingInt(Feature.fragment_shader_sample_interlock_ext)] = .{ | |
| 593 | 593 | .llvm_name = null, |
| 594 | 594 | .description = "Enable fragment_shader_sample_interlock_ext capability", |
| 595 | 595 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -597,7 +597,7 @@ pub const all_features = blk: { |
| 597 | 597 | .v1_0, |
| 598 | 598 | }), |
| 599 | 599 | }; |
| 600 | result[@intFromEnum(Feature.fragment_shader_shading_rate_interlock_ext)] = .{ | |
| 600 | result[@backingInt(Feature.fragment_shader_shading_rate_interlock_ext)] = .{ | |
| 601 | 601 | .llvm_name = null, |
| 602 | 602 | .description = "Enable fragment_shader_shading_rate_interlock_ext capability", |
| 603 | 603 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -605,7 +605,7 @@ pub const all_features = blk: { |
| 605 | 605 | .v1_0, |
| 606 | 606 | }), |
| 607 | 607 | }; |
| 608 | result[@intFromEnum(Feature.fragment_shading_rate_khr)] = .{ | |
| 608 | result[@backingInt(Feature.fragment_shading_rate_khr)] = .{ | |
| 609 | 609 | .llvm_name = null, |
| 610 | 610 | .description = "Enable fragment_shading_rate_khr capability", |
| 611 | 611 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -613,63 +613,63 @@ pub const all_features = blk: { |
| 613 | 613 | .v1_0, |
| 614 | 614 | }), |
| 615 | 615 | }; |
| 616 | result[@intFromEnum(Feature.generic_pointer)] = .{ | |
| 616 | result[@backingInt(Feature.generic_pointer)] = .{ | |
| 617 | 617 | .llvm_name = null, |
| 618 | 618 | .description = "Enable generic_pointer capability", |
| 619 | 619 | .dependencies = featureSet(&[_]Feature{ |
| 620 | 620 | .v1_0, |
| 621 | 621 | }), |
| 622 | 622 | }; |
| 623 | result[@intFromEnum(Feature.geometry)] = .{ | |
| 623 | result[@backingInt(Feature.geometry)] = .{ | |
| 624 | 624 | .llvm_name = null, |
| 625 | 625 | .description = "Enable geometry capability", |
| 626 | 626 | .dependencies = featureSet(&[_]Feature{ |
| 627 | 627 | .v1_0, |
| 628 | 628 | }), |
| 629 | 629 | }; |
| 630 | result[@intFromEnum(Feature.geometry_point_size)] = .{ | |
| 630 | result[@backingInt(Feature.geometry_point_size)] = .{ | |
| 631 | 631 | .llvm_name = null, |
| 632 | 632 | .description = "Enable geometry_point_size capability", |
| 633 | 633 | .dependencies = featureSet(&[_]Feature{ |
| 634 | 634 | .v1_0, |
| 635 | 635 | }), |
| 636 | 636 | }; |
| 637 | result[@intFromEnum(Feature.geometry_streams)] = .{ | |
| 637 | result[@backingInt(Feature.geometry_streams)] = .{ | |
| 638 | 638 | .llvm_name = null, |
| 639 | 639 | .description = "Enable geometry_streams capability", |
| 640 | 640 | .dependencies = featureSet(&[_]Feature{ |
| 641 | 641 | .v1_0, |
| 642 | 642 | }), |
| 643 | 643 | }; |
| 644 | result[@intFromEnum(Feature.group_non_uniform)] = .{ | |
| 644 | result[@backingInt(Feature.group_non_uniform)] = .{ | |
| 645 | 645 | .llvm_name = null, |
| 646 | 646 | .description = "Enable group_non_uniform capability", |
| 647 | 647 | .dependencies = featureSet(&[_]Feature{ |
| 648 | 648 | .v1_3, |
| 649 | 649 | }), |
| 650 | 650 | }; |
| 651 | result[@intFromEnum(Feature.group_non_uniform_arithmetic)] = .{ | |
| 651 | result[@backingInt(Feature.group_non_uniform_arithmetic)] = .{ | |
| 652 | 652 | .llvm_name = null, |
| 653 | 653 | .description = "Enable group_non_uniform_arithmetic capability", |
| 654 | 654 | .dependencies = featureSet(&[_]Feature{ |
| 655 | 655 | .v1_3, |
| 656 | 656 | }), |
| 657 | 657 | }; |
| 658 | result[@intFromEnum(Feature.group_non_uniform_ballot)] = .{ | |
| 658 | result[@backingInt(Feature.group_non_uniform_ballot)] = .{ | |
| 659 | 659 | .llvm_name = null, |
| 660 | 660 | .description = "Enable group_non_uniform_ballot capability", |
| 661 | 661 | .dependencies = featureSet(&[_]Feature{ |
| 662 | 662 | .v1_3, |
| 663 | 663 | }), |
| 664 | 664 | }; |
| 665 | result[@intFromEnum(Feature.group_non_uniform_clustered)] = .{ | |
| 665 | result[@backingInt(Feature.group_non_uniform_clustered)] = .{ | |
| 666 | 666 | .llvm_name = null, |
| 667 | 667 | .description = "Enable group_non_uniform_clustered capability", |
| 668 | 668 | .dependencies = featureSet(&[_]Feature{ |
| 669 | 669 | .v1_3, |
| 670 | 670 | }), |
| 671 | 671 | }; |
| 672 | result[@intFromEnum(Feature.group_non_uniform_partitioned_ext)] = .{ | |
| 672 | result[@backingInt(Feature.group_non_uniform_partitioned_ext)] = .{ | |
| 673 | 673 | .llvm_name = null, |
| 674 | 674 | .description = "Enable group_non_uniform_partitioned_ext capability", |
| 675 | 675 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -677,14 +677,14 @@ pub const all_features = blk: { |
| 677 | 677 | .v1_0, |
| 678 | 678 | }), |
| 679 | 679 | }; |
| 680 | result[@intFromEnum(Feature.group_non_uniform_quad)] = .{ | |
| 680 | result[@backingInt(Feature.group_non_uniform_quad)] = .{ | |
| 681 | 681 | .llvm_name = null, |
| 682 | 682 | .description = "Enable group_non_uniform_quad capability", |
| 683 | 683 | .dependencies = featureSet(&[_]Feature{ |
| 684 | 684 | .v1_3, |
| 685 | 685 | }), |
| 686 | 686 | }; |
| 687 | result[@intFromEnum(Feature.group_non_uniform_rotate_khr)] = .{ | |
| 687 | result[@backingInt(Feature.group_non_uniform_rotate_khr)] = .{ | |
| 688 | 688 | .llvm_name = null, |
| 689 | 689 | .description = "Enable group_non_uniform_rotate_khr capability", |
| 690 | 690 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -692,28 +692,28 @@ pub const all_features = blk: { |
| 692 | 692 | .v1_0, |
| 693 | 693 | }), |
| 694 | 694 | }; |
| 695 | result[@intFromEnum(Feature.group_non_uniform_shuffle)] = .{ | |
| 695 | result[@backingInt(Feature.group_non_uniform_shuffle)] = .{ | |
| 696 | 696 | .llvm_name = null, |
| 697 | 697 | .description = "Enable group_non_uniform_shuffle capability", |
| 698 | 698 | .dependencies = featureSet(&[_]Feature{ |
| 699 | 699 | .v1_3, |
| 700 | 700 | }), |
| 701 | 701 | }; |
| 702 | result[@intFromEnum(Feature.group_non_uniform_shuffle_relative)] = .{ | |
| 702 | result[@backingInt(Feature.group_non_uniform_shuffle_relative)] = .{ | |
| 703 | 703 | .llvm_name = null, |
| 704 | 704 | .description = "Enable group_non_uniform_shuffle_relative capability", |
| 705 | 705 | .dependencies = featureSet(&[_]Feature{ |
| 706 | 706 | .v1_3, |
| 707 | 707 | }), |
| 708 | 708 | }; |
| 709 | result[@intFromEnum(Feature.group_non_uniform_vote)] = .{ | |
| 709 | result[@backingInt(Feature.group_non_uniform_vote)] = .{ | |
| 710 | 710 | .llvm_name = null, |
| 711 | 711 | .description = "Enable group_non_uniform_vote capability", |
| 712 | 712 | .dependencies = featureSet(&[_]Feature{ |
| 713 | 713 | .v1_3, |
| 714 | 714 | }), |
| 715 | 715 | }; |
| 716 | result[@intFromEnum(Feature.group_uniform_arithmetic_khr)] = .{ | |
| 716 | result[@backingInt(Feature.group_uniform_arithmetic_khr)] = .{ | |
| 717 | 717 | .llvm_name = null, |
| 718 | 718 | .description = "Enable group_uniform_arithmetic_khr capability", |
| 719 | 719 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -721,84 +721,84 @@ pub const all_features = blk: { |
| 721 | 721 | .v1_0, |
| 722 | 722 | }), |
| 723 | 723 | }; |
| 724 | result[@intFromEnum(Feature.groups)] = .{ | |
| 724 | result[@backingInt(Feature.groups)] = .{ | |
| 725 | 725 | .llvm_name = null, |
| 726 | 726 | .description = "Enable groups capability", |
| 727 | 727 | .dependencies = featureSet(&[_]Feature{ |
| 728 | 728 | .v1_0, |
| 729 | 729 | }), |
| 730 | 730 | }; |
| 731 | result[@intFromEnum(Feature.image_basic)] = .{ | |
| 731 | result[@backingInt(Feature.image_basic)] = .{ | |
| 732 | 732 | .llvm_name = null, |
| 733 | 733 | .description = "Enable image_basic capability", |
| 734 | 734 | .dependencies = featureSet(&[_]Feature{ |
| 735 | 735 | .v1_0, |
| 736 | 736 | }), |
| 737 | 737 | }; |
| 738 | result[@intFromEnum(Feature.image_buffer)] = .{ | |
| 738 | result[@backingInt(Feature.image_buffer)] = .{ | |
| 739 | 739 | .llvm_name = null, |
| 740 | 740 | .description = "Enable image_buffer capability", |
| 741 | 741 | .dependencies = featureSet(&[_]Feature{ |
| 742 | 742 | .v1_0, |
| 743 | 743 | }), |
| 744 | 744 | }; |
| 745 | result[@intFromEnum(Feature.image_cube_array)] = .{ | |
| 745 | result[@backingInt(Feature.image_cube_array)] = .{ | |
| 746 | 746 | .llvm_name = null, |
| 747 | 747 | .description = "Enable image_cube_array capability", |
| 748 | 748 | .dependencies = featureSet(&[_]Feature{ |
| 749 | 749 | .v1_0, |
| 750 | 750 | }), |
| 751 | 751 | }; |
| 752 | result[@intFromEnum(Feature.image_gather_extended)] = .{ | |
| 752 | result[@backingInt(Feature.image_gather_extended)] = .{ | |
| 753 | 753 | .llvm_name = null, |
| 754 | 754 | .description = "Enable image_gather_extended capability", |
| 755 | 755 | .dependencies = featureSet(&[_]Feature{ |
| 756 | 756 | .v1_0, |
| 757 | 757 | }), |
| 758 | 758 | }; |
| 759 | result[@intFromEnum(Feature.image_mipmap)] = .{ | |
| 759 | result[@backingInt(Feature.image_mipmap)] = .{ | |
| 760 | 760 | .llvm_name = null, |
| 761 | 761 | .description = "Enable image_mipmap capability", |
| 762 | 762 | .dependencies = featureSet(&[_]Feature{ |
| 763 | 763 | .v1_0, |
| 764 | 764 | }), |
| 765 | 765 | }; |
| 766 | result[@intFromEnum(Feature.image_ms_array)] = .{ | |
| 766 | result[@backingInt(Feature.image_ms_array)] = .{ | |
| 767 | 767 | .llvm_name = null, |
| 768 | 768 | .description = "Enable image_ms_array capability", |
| 769 | 769 | .dependencies = featureSet(&[_]Feature{ |
| 770 | 770 | .v1_0, |
| 771 | 771 | }), |
| 772 | 772 | }; |
| 773 | result[@intFromEnum(Feature.image_query)] = .{ | |
| 773 | result[@backingInt(Feature.image_query)] = .{ | |
| 774 | 774 | .llvm_name = null, |
| 775 | 775 | .description = "Enable image_query capability", |
| 776 | 776 | .dependencies = featureSet(&[_]Feature{ |
| 777 | 777 | .v1_0, |
| 778 | 778 | }), |
| 779 | 779 | }; |
| 780 | result[@intFromEnum(Feature.image_read_write)] = .{ | |
| 780 | result[@backingInt(Feature.image_read_write)] = .{ | |
| 781 | 781 | .llvm_name = null, |
| 782 | 782 | .description = "Enable image_read_write capability", |
| 783 | 783 | .dependencies = featureSet(&[_]Feature{ |
| 784 | 784 | .v1_0, |
| 785 | 785 | }), |
| 786 | 786 | }; |
| 787 | result[@intFromEnum(Feature.image_rect)] = .{ | |
| 787 | result[@backingInt(Feature.image_rect)] = .{ | |
| 788 | 788 | .llvm_name = null, |
| 789 | 789 | .description = "Enable image_rect capability", |
| 790 | 790 | .dependencies = featureSet(&[_]Feature{ |
| 791 | 791 | .v1_0, |
| 792 | 792 | }), |
| 793 | 793 | }; |
| 794 | result[@intFromEnum(Feature.input_attachment)] = .{ | |
| 794 | result[@backingInt(Feature.input_attachment)] = .{ | |
| 795 | 795 | .llvm_name = null, |
| 796 | 796 | .description = "Enable input_attachment capability", |
| 797 | 797 | .dependencies = featureSet(&[_]Feature{ |
| 798 | 798 | .v1_0, |
| 799 | 799 | }), |
| 800 | 800 | }; |
| 801 | result[@intFromEnum(Feature.input_attachment_array_dynamic_indexing)] = .{ | |
| 801 | result[@backingInt(Feature.input_attachment_array_dynamic_indexing)] = .{ | |
| 802 | 802 | .llvm_name = null, |
| 803 | 803 | .description = "Enable input_attachment_array_dynamic_indexing capability", |
| 804 | 804 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -806,7 +806,7 @@ pub const all_features = blk: { |
| 806 | 806 | .v1_5, |
| 807 | 807 | }), |
| 808 | 808 | }; |
| 809 | result[@intFromEnum(Feature.input_attachment_array_non_uniform_indexing)] = .{ | |
| 809 | result[@backingInt(Feature.input_attachment_array_non_uniform_indexing)] = .{ | |
| 810 | 810 | .llvm_name = null, |
| 811 | 811 | .description = "Enable input_attachment_array_non_uniform_indexing capability", |
| 812 | 812 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -814,28 +814,28 @@ pub const all_features = blk: { |
| 814 | 814 | .v1_5, |
| 815 | 815 | }), |
| 816 | 816 | }; |
| 817 | result[@intFromEnum(Feature.int16)] = .{ | |
| 817 | result[@backingInt(Feature.int16)] = .{ | |
| 818 | 818 | .llvm_name = null, |
| 819 | 819 | .description = "Enable int16 capability", |
| 820 | 820 | .dependencies = featureSet(&[_]Feature{ |
| 821 | 821 | .v1_0, |
| 822 | 822 | }), |
| 823 | 823 | }; |
| 824 | result[@intFromEnum(Feature.int64)] = .{ | |
| 824 | result[@backingInt(Feature.int64)] = .{ | |
| 825 | 825 | .llvm_name = null, |
| 826 | 826 | .description = "Enable int64 capability", |
| 827 | 827 | .dependencies = featureSet(&[_]Feature{ |
| 828 | 828 | .v1_0, |
| 829 | 829 | }), |
| 830 | 830 | }; |
| 831 | result[@intFromEnum(Feature.int64atomics)] = .{ | |
| 831 | result[@backingInt(Feature.int64atomics)] = .{ | |
| 832 | 832 | .llvm_name = null, |
| 833 | 833 | .description = "Enable int64atomics capability", |
| 834 | 834 | .dependencies = featureSet(&[_]Feature{ |
| 835 | 835 | .v1_0, |
| 836 | 836 | }), |
| 837 | 837 | }; |
| 838 | result[@intFromEnum(Feature.int64image_ext)] = .{ | |
| 838 | result[@backingInt(Feature.int64image_ext)] = .{ | |
| 839 | 839 | .llvm_name = null, |
| 840 | 840 | .description = "Enable int64image_ext capability", |
| 841 | 841 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -843,28 +843,28 @@ pub const all_features = blk: { |
| 843 | 843 | .v1_0, |
| 844 | 844 | }), |
| 845 | 845 | }; |
| 846 | result[@intFromEnum(Feature.int8)] = .{ | |
| 846 | result[@backingInt(Feature.int8)] = .{ | |
| 847 | 847 | .llvm_name = null, |
| 848 | 848 | .description = "Enable int8 capability", |
| 849 | 849 | .dependencies = featureSet(&[_]Feature{ |
| 850 | 850 | .v1_0, |
| 851 | 851 | }), |
| 852 | 852 | }; |
| 853 | result[@intFromEnum(Feature.interpolation_function)] = .{ | |
| 853 | result[@backingInt(Feature.interpolation_function)] = .{ | |
| 854 | 854 | .llvm_name = null, |
| 855 | 855 | .description = "Enable interpolation_function capability", |
| 856 | 856 | .dependencies = featureSet(&[_]Feature{ |
| 857 | 857 | .v1_0, |
| 858 | 858 | }), |
| 859 | 859 | }; |
| 860 | result[@intFromEnum(Feature.literal_sampler)] = .{ | |
| 860 | result[@backingInt(Feature.literal_sampler)] = .{ | |
| 861 | 861 | .llvm_name = null, |
| 862 | 862 | .description = "Enable literal_sampler capability", |
| 863 | 863 | .dependencies = featureSet(&[_]Feature{ |
| 864 | 864 | .v1_0, |
| 865 | 865 | }), |
| 866 | 866 | }; |
| 867 | result[@intFromEnum(Feature.long_vector_ext)] = .{ | |
| 867 | result[@backingInt(Feature.long_vector_ext)] = .{ | |
| 868 | 868 | .llvm_name = null, |
| 869 | 869 | .description = "Enable long_vector_ext capability", |
| 870 | 870 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -872,14 +872,14 @@ pub const all_features = blk: { |
| 872 | 872 | .v1_0, |
| 873 | 873 | }), |
| 874 | 874 | }; |
| 875 | result[@intFromEnum(Feature.matrix)] = .{ | |
| 875 | result[@backingInt(Feature.matrix)] = .{ | |
| 876 | 876 | .llvm_name = null, |
| 877 | 877 | .description = "Enable matrix capability", |
| 878 | 878 | .dependencies = featureSet(&[_]Feature{ |
| 879 | 879 | .v1_0, |
| 880 | 880 | }), |
| 881 | 881 | }; |
| 882 | result[@intFromEnum(Feature.mesh_shading_ext)] = .{ | |
| 882 | result[@backingInt(Feature.mesh_shading_ext)] = .{ | |
| 883 | 883 | .llvm_name = null, |
| 884 | 884 | .description = "Enable mesh_shading_ext capability", |
| 885 | 885 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -887,14 +887,14 @@ pub const all_features = blk: { |
| 887 | 887 | .v1_0, |
| 888 | 888 | }), |
| 889 | 889 | }; |
| 890 | result[@intFromEnum(Feature.min_lod)] = .{ | |
| 890 | result[@backingInt(Feature.min_lod)] = .{ | |
| 891 | 891 | .llvm_name = null, |
| 892 | 892 | .description = "Enable min_lod capability", |
| 893 | 893 | .dependencies = featureSet(&[_]Feature{ |
| 894 | 894 | .v1_0, |
| 895 | 895 | }), |
| 896 | 896 | }; |
| 897 | result[@intFromEnum(Feature.multi_view)] = .{ | |
| 897 | result[@backingInt(Feature.multi_view)] = .{ | |
| 898 | 898 | .llvm_name = null, |
| 899 | 899 | .description = "Enable multi_view capability", |
| 900 | 900 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -902,21 +902,21 @@ pub const all_features = blk: { |
| 902 | 902 | .v1_3, |
| 903 | 903 | }), |
| 904 | 904 | }; |
| 905 | result[@intFromEnum(Feature.multi_viewport)] = .{ | |
| 905 | result[@backingInt(Feature.multi_viewport)] = .{ | |
| 906 | 906 | .llvm_name = null, |
| 907 | 907 | .description = "Enable multi_viewport capability", |
| 908 | 908 | .dependencies = featureSet(&[_]Feature{ |
| 909 | 909 | .v1_0, |
| 910 | 910 | }), |
| 911 | 911 | }; |
| 912 | result[@intFromEnum(Feature.named_barrier)] = .{ | |
| 912 | result[@backingInt(Feature.named_barrier)] = .{ | |
| 913 | 913 | .llvm_name = null, |
| 914 | 914 | .description = "Enable named_barrier capability", |
| 915 | 915 | .dependencies = featureSet(&[_]Feature{ |
| 916 | 916 | .v1_1, |
| 917 | 917 | }), |
| 918 | 918 | }; |
| 919 | result[@intFromEnum(Feature.opt_none_ext)] = .{ | |
| 919 | result[@backingInt(Feature.opt_none_ext)] = .{ | |
| 920 | 920 | .llvm_name = null, |
| 921 | 921 | .description = "Enable opt_none_ext capability", |
| 922 | 922 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -924,21 +924,21 @@ pub const all_features = blk: { |
| 924 | 924 | .v1_0, |
| 925 | 925 | }), |
| 926 | 926 | }; |
| 927 | result[@intFromEnum(Feature.pipe_storage)] = .{ | |
| 927 | result[@backingInt(Feature.pipe_storage)] = .{ | |
| 928 | 928 | .llvm_name = null, |
| 929 | 929 | .description = "Enable pipe_storage capability", |
| 930 | 930 | .dependencies = featureSet(&[_]Feature{ |
| 931 | 931 | .v1_1, |
| 932 | 932 | }), |
| 933 | 933 | }; |
| 934 | result[@intFromEnum(Feature.pipes)] = .{ | |
| 934 | result[@backingInt(Feature.pipes)] = .{ | |
| 935 | 935 | .llvm_name = null, |
| 936 | 936 | .description = "Enable pipes capability", |
| 937 | 937 | .dependencies = featureSet(&[_]Feature{ |
| 938 | 938 | .v1_0, |
| 939 | 939 | }), |
| 940 | 940 | }; |
| 941 | result[@intFromEnum(Feature.poison_freeze_khr)] = .{ | |
| 941 | result[@backingInt(Feature.poison_freeze_khr)] = .{ | |
| 942 | 942 | .llvm_name = null, |
| 943 | 943 | .description = "Enable poison_freeze_khr capability", |
| 944 | 944 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -946,7 +946,7 @@ pub const all_features = blk: { |
| 946 | 946 | .v1_0, |
| 947 | 947 | }), |
| 948 | 948 | }; |
| 949 | result[@intFromEnum(Feature.quad_control_khr)] = .{ | |
| 949 | result[@backingInt(Feature.quad_control_khr)] = .{ | |
| 950 | 950 | .llvm_name = null, |
| 951 | 951 | .description = "Enable quad_control_khr capability", |
| 952 | 952 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -954,7 +954,7 @@ pub const all_features = blk: { |
| 954 | 954 | .v1_0, |
| 955 | 955 | }), |
| 956 | 956 | }; |
| 957 | result[@intFromEnum(Feature.ray_cull_mask_khr)] = .{ | |
| 957 | result[@backingInt(Feature.ray_cull_mask_khr)] = .{ | |
| 958 | 958 | .llvm_name = null, |
| 959 | 959 | .description = "Enable ray_cull_mask_khr capability", |
| 960 | 960 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -962,7 +962,7 @@ pub const all_features = blk: { |
| 962 | 962 | .v1_0, |
| 963 | 963 | }), |
| 964 | 964 | }; |
| 965 | result[@intFromEnum(Feature.ray_query_khr)] = .{ | |
| 965 | result[@backingInt(Feature.ray_query_khr)] = .{ | |
| 966 | 966 | .llvm_name = null, |
| 967 | 967 | .description = "Enable ray_query_khr capability", |
| 968 | 968 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -970,7 +970,7 @@ pub const all_features = blk: { |
| 970 | 970 | .v1_0, |
| 971 | 971 | }), |
| 972 | 972 | }; |
| 973 | result[@intFromEnum(Feature.ray_query_position_fetch_khr)] = .{ | |
| 973 | result[@backingInt(Feature.ray_query_position_fetch_khr)] = .{ | |
| 974 | 974 | .llvm_name = null, |
| 975 | 975 | .description = "Enable ray_query_position_fetch_khr capability", |
| 976 | 976 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -978,7 +978,7 @@ pub const all_features = blk: { |
| 978 | 978 | .v1_0, |
| 979 | 979 | }), |
| 980 | 980 | }; |
| 981 | result[@intFromEnum(Feature.ray_query_provisional_khr)] = .{ | |
| 981 | result[@backingInt(Feature.ray_query_provisional_khr)] = .{ | |
| 982 | 982 | .llvm_name = null, |
| 983 | 983 | .description = "Enable ray_query_provisional_khr capability", |
| 984 | 984 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -986,7 +986,7 @@ pub const all_features = blk: { |
| 986 | 986 | .v1_0, |
| 987 | 987 | }), |
| 988 | 988 | }; |
| 989 | result[@intFromEnum(Feature.ray_tracing_khr)] = .{ | |
| 989 | result[@backingInt(Feature.ray_tracing_khr)] = .{ | |
| 990 | 990 | .llvm_name = null, |
| 991 | 991 | .description = "Enable ray_tracing_khr capability", |
| 992 | 992 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -994,7 +994,7 @@ pub const all_features = blk: { |
| 994 | 994 | .v1_0, |
| 995 | 995 | }), |
| 996 | 996 | }; |
| 997 | result[@intFromEnum(Feature.ray_tracing_opacity_micromap_ext)] = .{ | |
| 997 | result[@backingInt(Feature.ray_tracing_opacity_micromap_ext)] = .{ | |
| 998 | 998 | .llvm_name = null, |
| 999 | 999 | .description = "Enable ray_tracing_opacity_micromap_ext capability", |
| 1000 | 1000 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1002,7 +1002,7 @@ pub const all_features = blk: { |
| 1002 | 1002 | .v1_0, |
| 1003 | 1003 | }), |
| 1004 | 1004 | }; |
| 1005 | result[@intFromEnum(Feature.ray_tracing_position_fetch_khr)] = .{ | |
| 1005 | result[@backingInt(Feature.ray_tracing_position_fetch_khr)] = .{ | |
| 1006 | 1006 | .llvm_name = null, |
| 1007 | 1007 | .description = "Enable ray_tracing_position_fetch_khr capability", |
| 1008 | 1008 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1010,7 +1010,7 @@ pub const all_features = blk: { |
| 1010 | 1010 | .v1_0, |
| 1011 | 1011 | }), |
| 1012 | 1012 | }; |
| 1013 | result[@intFromEnum(Feature.ray_tracing_provisional_khr)] = .{ | |
| 1013 | result[@backingInt(Feature.ray_tracing_provisional_khr)] = .{ | |
| 1014 | 1014 | .llvm_name = null, |
| 1015 | 1015 | .description = "Enable ray_tracing_provisional_khr capability", |
| 1016 | 1016 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1018,7 +1018,7 @@ pub const all_features = blk: { |
| 1018 | 1018 | .v1_0, |
| 1019 | 1019 | }), |
| 1020 | 1020 | }; |
| 1021 | result[@intFromEnum(Feature.ray_traversal_primitive_culling_khr)] = .{ | |
| 1021 | result[@backingInt(Feature.ray_traversal_primitive_culling_khr)] = .{ | |
| 1022 | 1022 | .llvm_name = null, |
| 1023 | 1023 | .description = "Enable ray_traversal_primitive_culling_khr capability", |
| 1024 | 1024 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1027,7 +1027,7 @@ pub const all_features = blk: { |
| 1027 | 1027 | .v1_0, |
| 1028 | 1028 | }), |
| 1029 | 1029 | }; |
| 1030 | result[@intFromEnum(Feature.replicated_composites_ext)] = .{ | |
| 1030 | result[@backingInt(Feature.replicated_composites_ext)] = .{ | |
| 1031 | 1031 | .llvm_name = null, |
| 1032 | 1032 | .description = "Enable replicated_composites_ext capability", |
| 1033 | 1033 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1035,7 +1035,7 @@ pub const all_features = blk: { |
| 1035 | 1035 | .v1_0, |
| 1036 | 1036 | }), |
| 1037 | 1037 | }; |
| 1038 | result[@intFromEnum(Feature.runtime_descriptor_array)] = .{ | |
| 1038 | result[@backingInt(Feature.runtime_descriptor_array)] = .{ | |
| 1039 | 1039 | .llvm_name = null, |
| 1040 | 1040 | .description = "Enable runtime_descriptor_array capability", |
| 1041 | 1041 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1043,7 +1043,7 @@ pub const all_features = blk: { |
| 1043 | 1043 | .v1_5, |
| 1044 | 1044 | }), |
| 1045 | 1045 | }; |
| 1046 | result[@intFromEnum(Feature.sample_mask_post_depth_coverage)] = .{ | |
| 1046 | result[@backingInt(Feature.sample_mask_post_depth_coverage)] = .{ | |
| 1047 | 1047 | .llvm_name = null, |
| 1048 | 1048 | .description = "Enable sample_mask_post_depth_coverage capability", |
| 1049 | 1049 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1051,35 +1051,35 @@ pub const all_features = blk: { |
| 1051 | 1051 | .v1_0, |
| 1052 | 1052 | }), |
| 1053 | 1053 | }; |
| 1054 | result[@intFromEnum(Feature.sample_rate_shading)] = .{ | |
| 1054 | result[@backingInt(Feature.sample_rate_shading)] = .{ | |
| 1055 | 1055 | .llvm_name = null, |
| 1056 | 1056 | .description = "Enable sample_rate_shading capability", |
| 1057 | 1057 | .dependencies = featureSet(&[_]Feature{ |
| 1058 | 1058 | .v1_0, |
| 1059 | 1059 | }), |
| 1060 | 1060 | }; |
| 1061 | result[@intFromEnum(Feature.sampled_buffer)] = .{ | |
| 1061 | result[@backingInt(Feature.sampled_buffer)] = .{ | |
| 1062 | 1062 | .llvm_name = null, |
| 1063 | 1063 | .description = "Enable sampled_buffer capability", |
| 1064 | 1064 | .dependencies = featureSet(&[_]Feature{ |
| 1065 | 1065 | .v1_0, |
| 1066 | 1066 | }), |
| 1067 | 1067 | }; |
| 1068 | result[@intFromEnum(Feature.sampled_cube_array)] = .{ | |
| 1068 | result[@backingInt(Feature.sampled_cube_array)] = .{ | |
| 1069 | 1069 | .llvm_name = null, |
| 1070 | 1070 | .description = "Enable sampled_cube_array capability", |
| 1071 | 1071 | .dependencies = featureSet(&[_]Feature{ |
| 1072 | 1072 | .v1_0, |
| 1073 | 1073 | }), |
| 1074 | 1074 | }; |
| 1075 | result[@intFromEnum(Feature.sampled_image_array_dynamic_indexing)] = .{ | |
| 1075 | result[@backingInt(Feature.sampled_image_array_dynamic_indexing)] = .{ | |
| 1076 | 1076 | .llvm_name = null, |
| 1077 | 1077 | .description = "Enable sampled_image_array_dynamic_indexing capability", |
| 1078 | 1078 | .dependencies = featureSet(&[_]Feature{ |
| 1079 | 1079 | .v1_0, |
| 1080 | 1080 | }), |
| 1081 | 1081 | }; |
| 1082 | result[@intFromEnum(Feature.sampled_image_array_non_uniform_indexing)] = .{ | |
| 1082 | result[@backingInt(Feature.sampled_image_array_non_uniform_indexing)] = .{ | |
| 1083 | 1083 | .llvm_name = null, |
| 1084 | 1084 | .description = "Enable sampled_image_array_non_uniform_indexing capability", |
| 1085 | 1085 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1087,14 +1087,14 @@ pub const all_features = blk: { |
| 1087 | 1087 | .v1_5, |
| 1088 | 1088 | }), |
| 1089 | 1089 | }; |
| 1090 | result[@intFromEnum(Feature.sampled_rect)] = .{ | |
| 1090 | result[@backingInt(Feature.sampled_rect)] = .{ | |
| 1091 | 1091 | .llvm_name = null, |
| 1092 | 1092 | .description = "Enable sampled_rect capability", |
| 1093 | 1093 | .dependencies = featureSet(&[_]Feature{ |
| 1094 | 1094 | .v1_0, |
| 1095 | 1095 | }), |
| 1096 | 1096 | }; |
| 1097 | result[@intFromEnum(Feature.shader64bit_indexing_ext)] = .{ | |
| 1097 | result[@backingInt(Feature.shader64bit_indexing_ext)] = .{ | |
| 1098 | 1098 | .llvm_name = null, |
| 1099 | 1099 | .description = "Enable shader64bit_indexing_ext capability", |
| 1100 | 1100 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1102,7 +1102,7 @@ pub const all_features = blk: { |
| 1102 | 1102 | .v1_0, |
| 1103 | 1103 | }), |
| 1104 | 1104 | }; |
| 1105 | result[@intFromEnum(Feature.shader_clock_khr)] = .{ | |
| 1105 | result[@backingInt(Feature.shader_clock_khr)] = .{ | |
| 1106 | 1106 | .llvm_name = null, |
| 1107 | 1107 | .description = "Enable shader_clock_khr capability", |
| 1108 | 1108 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1110,7 +1110,7 @@ pub const all_features = blk: { |
| 1110 | 1110 | .v1_0, |
| 1111 | 1111 | }), |
| 1112 | 1112 | }; |
| 1113 | result[@intFromEnum(Feature.shader_invocation_reorder_ext)] = .{ | |
| 1113 | result[@backingInt(Feature.shader_invocation_reorder_ext)] = .{ | |
| 1114 | 1114 | .llvm_name = null, |
| 1115 | 1115 | .description = "Enable shader_invocation_reorder_ext capability", |
| 1116 | 1116 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1118,14 +1118,14 @@ pub const all_features = blk: { |
| 1118 | 1118 | .v1_0, |
| 1119 | 1119 | }), |
| 1120 | 1120 | }; |
| 1121 | result[@intFromEnum(Feature.shader_layer)] = .{ | |
| 1121 | result[@backingInt(Feature.shader_layer)] = .{ | |
| 1122 | 1122 | .llvm_name = null, |
| 1123 | 1123 | .description = "Enable shader_layer capability", |
| 1124 | 1124 | .dependencies = featureSet(&[_]Feature{ |
| 1125 | 1125 | .v1_5, |
| 1126 | 1126 | }), |
| 1127 | 1127 | }; |
| 1128 | result[@intFromEnum(Feature.shader_non_uniform)] = .{ | |
| 1128 | result[@backingInt(Feature.shader_non_uniform)] = .{ | |
| 1129 | 1129 | .llvm_name = null, |
| 1130 | 1130 | .description = "Enable shader_non_uniform capability", |
| 1131 | 1131 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1133,14 +1133,14 @@ pub const all_features = blk: { |
| 1133 | 1133 | .v1_5, |
| 1134 | 1134 | }), |
| 1135 | 1135 | }; |
| 1136 | result[@intFromEnum(Feature.shader_viewport_index)] = .{ | |
| 1136 | result[@backingInt(Feature.shader_viewport_index)] = .{ | |
| 1137 | 1137 | .llvm_name = null, |
| 1138 | 1138 | .description = "Enable shader_viewport_index capability", |
| 1139 | 1139 | .dependencies = featureSet(&[_]Feature{ |
| 1140 | 1140 | .v1_5, |
| 1141 | 1141 | }), |
| 1142 | 1142 | }; |
| 1143 | result[@intFromEnum(Feature.shader_viewport_index_layer_ext)] = .{ | |
| 1143 | result[@backingInt(Feature.shader_viewport_index_layer_ext)] = .{ | |
| 1144 | 1144 | .llvm_name = null, |
| 1145 | 1145 | .description = "Enable shader_viewport_index_layer_ext capability", |
| 1146 | 1146 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1148,7 +1148,7 @@ pub const all_features = blk: { |
| 1148 | 1148 | .v1_0, |
| 1149 | 1149 | }), |
| 1150 | 1150 | }; |
| 1151 | result[@intFromEnum(Feature.signed_zero_inf_nan_preserve)] = .{ | |
| 1151 | result[@backingInt(Feature.signed_zero_inf_nan_preserve)] = .{ | |
| 1152 | 1152 | .llvm_name = null, |
| 1153 | 1153 | .description = "Enable signed_zero_inf_nan_preserve capability", |
| 1154 | 1154 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1156,309 +1156,309 @@ pub const all_features = blk: { |
| 1156 | 1156 | .v1_4, |
| 1157 | 1157 | }), |
| 1158 | 1158 | }; |
| 1159 | result[@intFromEnum(Feature.sparse_residency)] = .{ | |
| 1159 | result[@backingInt(Feature.sparse_residency)] = .{ | |
| 1160 | 1160 | .llvm_name = null, |
| 1161 | 1161 | .description = "Enable sparse_residency capability", |
| 1162 | 1162 | .dependencies = featureSet(&[_]Feature{ |
| 1163 | 1163 | .v1_0, |
| 1164 | 1164 | }), |
| 1165 | 1165 | }; |
| 1166 | result[@intFromEnum(Feature.SPV_EXT_arithmetic_fence)] = .{ | |
| 1166 | result[@backingInt(Feature.SPV_EXT_arithmetic_fence)] = .{ | |
| 1167 | 1167 | .llvm_name = null, |
| 1168 | 1168 | .description = "Enable SPV_EXT_arithmetic_fence extension", |
| 1169 | 1169 | .dependencies = featureSet(&[_]Feature{}), |
| 1170 | 1170 | }; |
| 1171 | result[@intFromEnum(Feature.SPV_EXT_demote_to_helper_invocation)] = .{ | |
| 1171 | result[@backingInt(Feature.SPV_EXT_demote_to_helper_invocation)] = .{ | |
| 1172 | 1172 | .llvm_name = null, |
| 1173 | 1173 | .description = "Enable SPV_EXT_demote_to_helper_invocation extension", |
| 1174 | 1174 | .dependencies = featureSet(&[_]Feature{}), |
| 1175 | 1175 | }; |
| 1176 | result[@intFromEnum(Feature.SPV_EXT_descriptor_heap)] = .{ | |
| 1176 | result[@backingInt(Feature.SPV_EXT_descriptor_heap)] = .{ | |
| 1177 | 1177 | .llvm_name = null, |
| 1178 | 1178 | .description = "Enable SPV_EXT_descriptor_heap extension", |
| 1179 | 1179 | .dependencies = featureSet(&[_]Feature{}), |
| 1180 | 1180 | }; |
| 1181 | result[@intFromEnum(Feature.SPV_EXT_descriptor_indexing)] = .{ | |
| 1181 | result[@backingInt(Feature.SPV_EXT_descriptor_indexing)] = .{ | |
| 1182 | 1182 | .llvm_name = null, |
| 1183 | 1183 | .description = "Enable SPV_EXT_descriptor_indexing extension", |
| 1184 | 1184 | .dependencies = featureSet(&[_]Feature{}), |
| 1185 | 1185 | }; |
| 1186 | result[@intFromEnum(Feature.SPV_EXT_float8)] = .{ | |
| 1186 | result[@backingInt(Feature.SPV_EXT_float8)] = .{ | |
| 1187 | 1187 | .llvm_name = null, |
| 1188 | 1188 | .description = "Enable SPV_EXT_float8 extension", |
| 1189 | 1189 | .dependencies = featureSet(&[_]Feature{}), |
| 1190 | 1190 | }; |
| 1191 | result[@intFromEnum(Feature.SPV_EXT_fragment_fully_covered)] = .{ | |
| 1191 | result[@backingInt(Feature.SPV_EXT_fragment_fully_covered)] = .{ | |
| 1192 | 1192 | .llvm_name = null, |
| 1193 | 1193 | .description = "Enable SPV_EXT_fragment_fully_covered extension", |
| 1194 | 1194 | .dependencies = featureSet(&[_]Feature{}), |
| 1195 | 1195 | }; |
| 1196 | result[@intFromEnum(Feature.SPV_EXT_fragment_invocation_density)] = .{ | |
| 1196 | result[@backingInt(Feature.SPV_EXT_fragment_invocation_density)] = .{ | |
| 1197 | 1197 | .llvm_name = null, |
| 1198 | 1198 | .description = "Enable SPV_EXT_fragment_invocation_density extension", |
| 1199 | 1199 | .dependencies = featureSet(&[_]Feature{}), |
| 1200 | 1200 | }; |
| 1201 | result[@intFromEnum(Feature.SPV_EXT_fragment_shader_interlock)] = .{ | |
| 1201 | result[@backingInt(Feature.SPV_EXT_fragment_shader_interlock)] = .{ | |
| 1202 | 1202 | .llvm_name = null, |
| 1203 | 1203 | .description = "Enable SPV_EXT_fragment_shader_interlock extension", |
| 1204 | 1204 | .dependencies = featureSet(&[_]Feature{}), |
| 1205 | 1205 | }; |
| 1206 | result[@intFromEnum(Feature.SPV_EXT_long_vector)] = .{ | |
| 1206 | result[@backingInt(Feature.SPV_EXT_long_vector)] = .{ | |
| 1207 | 1207 | .llvm_name = null, |
| 1208 | 1208 | .description = "Enable SPV_EXT_long_vector extension", |
| 1209 | 1209 | .dependencies = featureSet(&[_]Feature{}), |
| 1210 | 1210 | }; |
| 1211 | result[@intFromEnum(Feature.SPV_EXT_mesh_shader)] = .{ | |
| 1211 | result[@backingInt(Feature.SPV_EXT_mesh_shader)] = .{ | |
| 1212 | 1212 | .llvm_name = null, |
| 1213 | 1213 | .description = "Enable SPV_EXT_mesh_shader extension", |
| 1214 | 1214 | .dependencies = featureSet(&[_]Feature{}), |
| 1215 | 1215 | }; |
| 1216 | result[@intFromEnum(Feature.SPV_EXT_opacity_micromap)] = .{ | |
| 1216 | result[@backingInt(Feature.SPV_EXT_opacity_micromap)] = .{ | |
| 1217 | 1217 | .llvm_name = null, |
| 1218 | 1218 | .description = "Enable SPV_EXT_opacity_micromap extension", |
| 1219 | 1219 | .dependencies = featureSet(&[_]Feature{}), |
| 1220 | 1220 | }; |
| 1221 | result[@intFromEnum(Feature.SPV_EXT_optnone)] = .{ | |
| 1221 | result[@backingInt(Feature.SPV_EXT_optnone)] = .{ | |
| 1222 | 1222 | .llvm_name = null, |
| 1223 | 1223 | .description = "Enable SPV_EXT_optnone extension", |
| 1224 | 1224 | .dependencies = featureSet(&[_]Feature{}), |
| 1225 | 1225 | }; |
| 1226 | result[@intFromEnum(Feature.SPV_EXT_physical_storage_buffer)] = .{ | |
| 1226 | result[@backingInt(Feature.SPV_EXT_physical_storage_buffer)] = .{ | |
| 1227 | 1227 | .llvm_name = null, |
| 1228 | 1228 | .description = "Enable SPV_EXT_physical_storage_buffer extension", |
| 1229 | 1229 | .dependencies = featureSet(&[_]Feature{}), |
| 1230 | 1230 | }; |
| 1231 | result[@intFromEnum(Feature.SPV_EXT_replicated_composites)] = .{ | |
| 1231 | result[@backingInt(Feature.SPV_EXT_replicated_composites)] = .{ | |
| 1232 | 1232 | .llvm_name = null, |
| 1233 | 1233 | .description = "Enable SPV_EXT_replicated_composites extension", |
| 1234 | 1234 | .dependencies = featureSet(&[_]Feature{}), |
| 1235 | 1235 | }; |
| 1236 | result[@intFromEnum(Feature.SPV_EXT_shader_64bit_indexing)] = .{ | |
| 1236 | result[@backingInt(Feature.SPV_EXT_shader_64bit_indexing)] = .{ | |
| 1237 | 1237 | .llvm_name = null, |
| 1238 | 1238 | .description = "Enable SPV_EXT_shader_64bit_indexing extension", |
| 1239 | 1239 | .dependencies = featureSet(&[_]Feature{}), |
| 1240 | 1240 | }; |
| 1241 | result[@intFromEnum(Feature.SPV_EXT_shader_atomic_float16_add)] = .{ | |
| 1241 | result[@backingInt(Feature.SPV_EXT_shader_atomic_float16_add)] = .{ | |
| 1242 | 1242 | .llvm_name = null, |
| 1243 | 1243 | .description = "Enable SPV_EXT_shader_atomic_float16_add extension", |
| 1244 | 1244 | .dependencies = featureSet(&[_]Feature{}), |
| 1245 | 1245 | }; |
| 1246 | result[@intFromEnum(Feature.SPV_EXT_shader_atomic_float_add)] = .{ | |
| 1246 | result[@backingInt(Feature.SPV_EXT_shader_atomic_float_add)] = .{ | |
| 1247 | 1247 | .llvm_name = null, |
| 1248 | 1248 | .description = "Enable SPV_EXT_shader_atomic_float_add extension", |
| 1249 | 1249 | .dependencies = featureSet(&[_]Feature{}), |
| 1250 | 1250 | }; |
| 1251 | result[@intFromEnum(Feature.SPV_EXT_shader_atomic_float_min_max)] = .{ | |
| 1251 | result[@backingInt(Feature.SPV_EXT_shader_atomic_float_min_max)] = .{ | |
| 1252 | 1252 | .llvm_name = null, |
| 1253 | 1253 | .description = "Enable SPV_EXT_shader_atomic_float_min_max extension", |
| 1254 | 1254 | .dependencies = featureSet(&[_]Feature{}), |
| 1255 | 1255 | }; |
| 1256 | result[@intFromEnum(Feature.SPV_EXT_shader_image_int64)] = .{ | |
| 1256 | result[@backingInt(Feature.SPV_EXT_shader_image_int64)] = .{ | |
| 1257 | 1257 | .llvm_name = null, |
| 1258 | 1258 | .description = "Enable SPV_EXT_shader_image_int64 extension", |
| 1259 | 1259 | .dependencies = featureSet(&[_]Feature{}), |
| 1260 | 1260 | }; |
| 1261 | result[@intFromEnum(Feature.SPV_EXT_shader_invocation_reorder)] = .{ | |
| 1261 | result[@backingInt(Feature.SPV_EXT_shader_invocation_reorder)] = .{ | |
| 1262 | 1262 | .llvm_name = null, |
| 1263 | 1263 | .description = "Enable SPV_EXT_shader_invocation_reorder extension", |
| 1264 | 1264 | .dependencies = featureSet(&[_]Feature{}), |
| 1265 | 1265 | }; |
| 1266 | result[@intFromEnum(Feature.SPV_EXT_shader_stencil_export)] = .{ | |
| 1266 | result[@backingInt(Feature.SPV_EXT_shader_stencil_export)] = .{ | |
| 1267 | 1267 | .llvm_name = null, |
| 1268 | 1268 | .description = "Enable SPV_EXT_shader_stencil_export extension", |
| 1269 | 1269 | .dependencies = featureSet(&[_]Feature{}), |
| 1270 | 1270 | }; |
| 1271 | result[@intFromEnum(Feature.SPV_EXT_shader_subgroup_partitioned)] = .{ | |
| 1271 | result[@backingInt(Feature.SPV_EXT_shader_subgroup_partitioned)] = .{ | |
| 1272 | 1272 | .llvm_name = null, |
| 1273 | 1273 | .description = "Enable SPV_EXT_shader_subgroup_partitioned extension", |
| 1274 | 1274 | .dependencies = featureSet(&[_]Feature{}), |
| 1275 | 1275 | }; |
| 1276 | result[@intFromEnum(Feature.SPV_EXT_shader_tile_image)] = .{ | |
| 1276 | result[@backingInt(Feature.SPV_EXT_shader_tile_image)] = .{ | |
| 1277 | 1277 | .llvm_name = null, |
| 1278 | 1278 | .description = "Enable SPV_EXT_shader_tile_image extension", |
| 1279 | 1279 | .dependencies = featureSet(&[_]Feature{}), |
| 1280 | 1280 | }; |
| 1281 | result[@intFromEnum(Feature.SPV_EXT_shader_viewport_index_layer)] = .{ | |
| 1281 | result[@backingInt(Feature.SPV_EXT_shader_viewport_index_layer)] = .{ | |
| 1282 | 1282 | .llvm_name = null, |
| 1283 | 1283 | .description = "Enable SPV_EXT_shader_viewport_index_layer extension", |
| 1284 | 1284 | .dependencies = featureSet(&[_]Feature{}), |
| 1285 | 1285 | }; |
| 1286 | result[@intFromEnum(Feature.SPV_KHR_16bit_storage)] = .{ | |
| 1286 | result[@backingInt(Feature.SPV_KHR_16bit_storage)] = .{ | |
| 1287 | 1287 | .llvm_name = null, |
| 1288 | 1288 | .description = "Enable SPV_KHR_16bit_storage extension", |
| 1289 | 1289 | .dependencies = featureSet(&[_]Feature{}), |
| 1290 | 1290 | }; |
| 1291 | result[@intFromEnum(Feature.SPV_KHR_8bit_storage)] = .{ | |
| 1291 | result[@backingInt(Feature.SPV_KHR_8bit_storage)] = .{ | |
| 1292 | 1292 | .llvm_name = null, |
| 1293 | 1293 | .description = "Enable SPV_KHR_8bit_storage extension", |
| 1294 | 1294 | .dependencies = featureSet(&[_]Feature{}), |
| 1295 | 1295 | }; |
| 1296 | result[@intFromEnum(Feature.SPV_KHR_abort)] = .{ | |
| 1296 | result[@backingInt(Feature.SPV_KHR_abort)] = .{ | |
| 1297 | 1297 | .llvm_name = null, |
| 1298 | 1298 | .description = "Enable SPV_KHR_abort extension", |
| 1299 | 1299 | .dependencies = featureSet(&[_]Feature{}), |
| 1300 | 1300 | }; |
| 1301 | result[@intFromEnum(Feature.SPV_KHR_bfloat16)] = .{ | |
| 1301 | result[@backingInt(Feature.SPV_KHR_bfloat16)] = .{ | |
| 1302 | 1302 | .llvm_name = null, |
| 1303 | 1303 | .description = "Enable SPV_KHR_bfloat16 extension", |
| 1304 | 1304 | .dependencies = featureSet(&[_]Feature{}), |
| 1305 | 1305 | }; |
| 1306 | result[@intFromEnum(Feature.SPV_KHR_bit_instructions)] = .{ | |
| 1306 | result[@backingInt(Feature.SPV_KHR_bit_instructions)] = .{ | |
| 1307 | 1307 | .llvm_name = null, |
| 1308 | 1308 | .description = "Enable SPV_KHR_bit_instructions extension", |
| 1309 | 1309 | .dependencies = featureSet(&[_]Feature{}), |
| 1310 | 1310 | }; |
| 1311 | result[@intFromEnum(Feature.SPV_KHR_compute_shader_derivatives)] = .{ | |
| 1311 | result[@backingInt(Feature.SPV_KHR_compute_shader_derivatives)] = .{ | |
| 1312 | 1312 | .llvm_name = null, |
| 1313 | 1313 | .description = "Enable SPV_KHR_compute_shader_derivatives extension", |
| 1314 | 1314 | .dependencies = featureSet(&[_]Feature{}), |
| 1315 | 1315 | }; |
| 1316 | result[@intFromEnum(Feature.SPV_KHR_constant_data)] = .{ | |
| 1316 | result[@backingInt(Feature.SPV_KHR_constant_data)] = .{ | |
| 1317 | 1317 | .llvm_name = null, |
| 1318 | 1318 | .description = "Enable SPV_KHR_constant_data extension", |
| 1319 | 1319 | .dependencies = featureSet(&[_]Feature{}), |
| 1320 | 1320 | }; |
| 1321 | result[@intFromEnum(Feature.SPV_KHR_cooperative_matrix)] = .{ | |
| 1321 | result[@backingInt(Feature.SPV_KHR_cooperative_matrix)] = .{ | |
| 1322 | 1322 | .llvm_name = null, |
| 1323 | 1323 | .description = "Enable SPV_KHR_cooperative_matrix extension", |
| 1324 | 1324 | .dependencies = featureSet(&[_]Feature{}), |
| 1325 | 1325 | }; |
| 1326 | result[@intFromEnum(Feature.SPV_KHR_device_group)] = .{ | |
| 1326 | result[@backingInt(Feature.SPV_KHR_device_group)] = .{ | |
| 1327 | 1327 | .llvm_name = null, |
| 1328 | 1328 | .description = "Enable SPV_KHR_device_group extension", |
| 1329 | 1329 | .dependencies = featureSet(&[_]Feature{}), |
| 1330 | 1330 | }; |
| 1331 | result[@intFromEnum(Feature.SPV_KHR_expect_assume)] = .{ | |
| 1331 | result[@backingInt(Feature.SPV_KHR_expect_assume)] = .{ | |
| 1332 | 1332 | .llvm_name = null, |
| 1333 | 1333 | .description = "Enable SPV_KHR_expect_assume extension", |
| 1334 | 1334 | .dependencies = featureSet(&[_]Feature{}), |
| 1335 | 1335 | }; |
| 1336 | result[@intFromEnum(Feature.SPV_KHR_float_controls)] = .{ | |
| 1336 | result[@backingInt(Feature.SPV_KHR_float_controls)] = .{ | |
| 1337 | 1337 | .llvm_name = null, |
| 1338 | 1338 | .description = "Enable SPV_KHR_float_controls extension", |
| 1339 | 1339 | .dependencies = featureSet(&[_]Feature{}), |
| 1340 | 1340 | }; |
| 1341 | result[@intFromEnum(Feature.SPV_KHR_float_controls2)] = .{ | |
| 1341 | result[@backingInt(Feature.SPV_KHR_float_controls2)] = .{ | |
| 1342 | 1342 | .llvm_name = null, |
| 1343 | 1343 | .description = "Enable SPV_KHR_float_controls2 extension", |
| 1344 | 1344 | .dependencies = featureSet(&[_]Feature{}), |
| 1345 | 1345 | }; |
| 1346 | result[@intFromEnum(Feature.SPV_KHR_fma)] = .{ | |
| 1346 | result[@backingInt(Feature.SPV_KHR_fma)] = .{ | |
| 1347 | 1347 | .llvm_name = null, |
| 1348 | 1348 | .description = "Enable SPV_KHR_fma extension", |
| 1349 | 1349 | .dependencies = featureSet(&[_]Feature{}), |
| 1350 | 1350 | }; |
| 1351 | result[@intFromEnum(Feature.SPV_KHR_fragment_shader_barycentric)] = .{ | |
| 1351 | result[@backingInt(Feature.SPV_KHR_fragment_shader_barycentric)] = .{ | |
| 1352 | 1352 | .llvm_name = null, |
| 1353 | 1353 | .description = "Enable SPV_KHR_fragment_shader_barycentric extension", |
| 1354 | 1354 | .dependencies = featureSet(&[_]Feature{}), |
| 1355 | 1355 | }; |
| 1356 | result[@intFromEnum(Feature.SPV_KHR_fragment_shading_rate)] = .{ | |
| 1356 | result[@backingInt(Feature.SPV_KHR_fragment_shading_rate)] = .{ | |
| 1357 | 1357 | .llvm_name = null, |
| 1358 | 1358 | .description = "Enable SPV_KHR_fragment_shading_rate extension", |
| 1359 | 1359 | .dependencies = featureSet(&[_]Feature{}), |
| 1360 | 1360 | }; |
| 1361 | result[@intFromEnum(Feature.SPV_KHR_integer_dot_product)] = .{ | |
| 1361 | result[@backingInt(Feature.SPV_KHR_integer_dot_product)] = .{ | |
| 1362 | 1362 | .llvm_name = null, |
| 1363 | 1363 | .description = "Enable SPV_KHR_integer_dot_product extension", |
| 1364 | 1364 | .dependencies = featureSet(&[_]Feature{}), |
| 1365 | 1365 | }; |
| 1366 | result[@intFromEnum(Feature.SPV_KHR_multiview)] = .{ | |
| 1366 | result[@backingInt(Feature.SPV_KHR_multiview)] = .{ | |
| 1367 | 1367 | .llvm_name = null, |
| 1368 | 1368 | .description = "Enable SPV_KHR_multiview extension", |
| 1369 | 1369 | .dependencies = featureSet(&[_]Feature{}), |
| 1370 | 1370 | }; |
| 1371 | result[@intFromEnum(Feature.SPV_KHR_poison_freeze)] = .{ | |
| 1371 | result[@backingInt(Feature.SPV_KHR_poison_freeze)] = .{ | |
| 1372 | 1372 | .llvm_name = null, |
| 1373 | 1373 | .description = "Enable SPV_KHR_poison_freeze extension", |
| 1374 | 1374 | .dependencies = featureSet(&[_]Feature{}), |
| 1375 | 1375 | }; |
| 1376 | result[@intFromEnum(Feature.SPV_KHR_post_depth_coverage)] = .{ | |
| 1376 | result[@backingInt(Feature.SPV_KHR_post_depth_coverage)] = .{ | |
| 1377 | 1377 | .llvm_name = null, |
| 1378 | 1378 | .description = "Enable SPV_KHR_post_depth_coverage extension", |
| 1379 | 1379 | .dependencies = featureSet(&[_]Feature{}), |
| 1380 | 1380 | }; |
| 1381 | result[@intFromEnum(Feature.SPV_KHR_quad_control)] = .{ | |
| 1381 | result[@backingInt(Feature.SPV_KHR_quad_control)] = .{ | |
| 1382 | 1382 | .llvm_name = null, |
| 1383 | 1383 | .description = "Enable SPV_KHR_quad_control extension", |
| 1384 | 1384 | .dependencies = featureSet(&[_]Feature{}), |
| 1385 | 1385 | }; |
| 1386 | result[@intFromEnum(Feature.SPV_KHR_ray_cull_mask)] = .{ | |
| 1386 | result[@backingInt(Feature.SPV_KHR_ray_cull_mask)] = .{ | |
| 1387 | 1387 | .llvm_name = null, |
| 1388 | 1388 | .description = "Enable SPV_KHR_ray_cull_mask extension", |
| 1389 | 1389 | .dependencies = featureSet(&[_]Feature{}), |
| 1390 | 1390 | }; |
| 1391 | result[@intFromEnum(Feature.SPV_KHR_ray_query)] = .{ | |
| 1391 | result[@backingInt(Feature.SPV_KHR_ray_query)] = .{ | |
| 1392 | 1392 | .llvm_name = null, |
| 1393 | 1393 | .description = "Enable SPV_KHR_ray_query extension", |
| 1394 | 1394 | .dependencies = featureSet(&[_]Feature{}), |
| 1395 | 1395 | }; |
| 1396 | result[@intFromEnum(Feature.SPV_KHR_ray_tracing)] = .{ | |
| 1396 | result[@backingInt(Feature.SPV_KHR_ray_tracing)] = .{ | |
| 1397 | 1397 | .llvm_name = null, |
| 1398 | 1398 | .description = "Enable SPV_KHR_ray_tracing extension", |
| 1399 | 1399 | .dependencies = featureSet(&[_]Feature{}), |
| 1400 | 1400 | }; |
| 1401 | result[@intFromEnum(Feature.SPV_KHR_ray_tracing_position_fetch)] = .{ | |
| 1401 | result[@backingInt(Feature.SPV_KHR_ray_tracing_position_fetch)] = .{ | |
| 1402 | 1402 | .llvm_name = null, |
| 1403 | 1403 | .description = "Enable SPV_KHR_ray_tracing_position_fetch extension", |
| 1404 | 1404 | .dependencies = featureSet(&[_]Feature{}), |
| 1405 | 1405 | }; |
| 1406 | result[@intFromEnum(Feature.SPV_KHR_shader_atomic_counter_ops)] = .{ | |
| 1406 | result[@backingInt(Feature.SPV_KHR_shader_atomic_counter_ops)] = .{ | |
| 1407 | 1407 | .llvm_name = null, |
| 1408 | 1408 | .description = "Enable SPV_KHR_shader_atomic_counter_ops extension", |
| 1409 | 1409 | .dependencies = featureSet(&[_]Feature{}), |
| 1410 | 1410 | }; |
| 1411 | result[@intFromEnum(Feature.SPV_KHR_shader_ballot)] = .{ | |
| 1411 | result[@backingInt(Feature.SPV_KHR_shader_ballot)] = .{ | |
| 1412 | 1412 | .llvm_name = null, |
| 1413 | 1413 | .description = "Enable SPV_KHR_shader_ballot extension", |
| 1414 | 1414 | .dependencies = featureSet(&[_]Feature{}), |
| 1415 | 1415 | }; |
| 1416 | result[@intFromEnum(Feature.SPV_KHR_shader_clock)] = .{ | |
| 1416 | result[@backingInt(Feature.SPV_KHR_shader_clock)] = .{ | |
| 1417 | 1417 | .llvm_name = null, |
| 1418 | 1418 | .description = "Enable SPV_KHR_shader_clock extension", |
| 1419 | 1419 | .dependencies = featureSet(&[_]Feature{}), |
| 1420 | 1420 | }; |
| 1421 | result[@intFromEnum(Feature.SPV_KHR_shader_draw_parameters)] = .{ | |
| 1421 | result[@backingInt(Feature.SPV_KHR_shader_draw_parameters)] = .{ | |
| 1422 | 1422 | .llvm_name = null, |
| 1423 | 1423 | .description = "Enable SPV_KHR_shader_draw_parameters extension", |
| 1424 | 1424 | .dependencies = featureSet(&[_]Feature{}), |
| 1425 | 1425 | }; |
| 1426 | result[@intFromEnum(Feature.SPV_KHR_subgroup_rotate)] = .{ | |
| 1426 | result[@backingInt(Feature.SPV_KHR_subgroup_rotate)] = .{ | |
| 1427 | 1427 | .llvm_name = null, |
| 1428 | 1428 | .description = "Enable SPV_KHR_subgroup_rotate extension", |
| 1429 | 1429 | .dependencies = featureSet(&[_]Feature{}), |
| 1430 | 1430 | }; |
| 1431 | result[@intFromEnum(Feature.SPV_KHR_subgroup_vote)] = .{ | |
| 1431 | result[@backingInt(Feature.SPV_KHR_subgroup_vote)] = .{ | |
| 1432 | 1432 | .llvm_name = null, |
| 1433 | 1433 | .description = "Enable SPV_KHR_subgroup_vote extension", |
| 1434 | 1434 | .dependencies = featureSet(&[_]Feature{}), |
| 1435 | 1435 | }; |
| 1436 | result[@intFromEnum(Feature.SPV_KHR_uniform_group_instructions)] = .{ | |
| 1436 | result[@backingInt(Feature.SPV_KHR_uniform_group_instructions)] = .{ | |
| 1437 | 1437 | .llvm_name = null, |
| 1438 | 1438 | .description = "Enable SPV_KHR_uniform_group_instructions extension", |
| 1439 | 1439 | .dependencies = featureSet(&[_]Feature{}), |
| 1440 | 1440 | }; |
| 1441 | result[@intFromEnum(Feature.SPV_KHR_untyped_pointers)] = .{ | |
| 1441 | result[@backingInt(Feature.SPV_KHR_untyped_pointers)] = .{ | |
| 1442 | 1442 | .llvm_name = null, |
| 1443 | 1443 | .description = "Enable SPV_KHR_untyped_pointers extension", |
| 1444 | 1444 | .dependencies = featureSet(&[_]Feature{}), |
| 1445 | 1445 | }; |
| 1446 | result[@intFromEnum(Feature.SPV_KHR_variable_pointers)] = .{ | |
| 1446 | result[@backingInt(Feature.SPV_KHR_variable_pointers)] = .{ | |
| 1447 | 1447 | .llvm_name = null, |
| 1448 | 1448 | .description = "Enable SPV_KHR_variable_pointers extension", |
| 1449 | 1449 | .dependencies = featureSet(&[_]Feature{}), |
| 1450 | 1450 | }; |
| 1451 | result[@intFromEnum(Feature.SPV_KHR_vulkan_memory_model)] = .{ | |
| 1451 | result[@backingInt(Feature.SPV_KHR_vulkan_memory_model)] = .{ | |
| 1452 | 1452 | .llvm_name = null, |
| 1453 | 1453 | .description = "Enable SPV_KHR_vulkan_memory_model extension", |
| 1454 | 1454 | .dependencies = featureSet(&[_]Feature{}), |
| 1455 | 1455 | }; |
| 1456 | result[@intFromEnum(Feature.SPV_KHR_workgroup_memory_explicit_layout)] = .{ | |
| 1456 | result[@backingInt(Feature.SPV_KHR_workgroup_memory_explicit_layout)] = .{ | |
| 1457 | 1457 | .llvm_name = null, |
| 1458 | 1458 | .description = "Enable SPV_KHR_workgroup_memory_explicit_layout extension", |
| 1459 | 1459 | .dependencies = featureSet(&[_]Feature{}), |
| 1460 | 1460 | }; |
| 1461 | result[@intFromEnum(Feature.stencil_export_ext)] = .{ | |
| 1461 | result[@backingInt(Feature.stencil_export_ext)] = .{ | |
| 1462 | 1462 | .llvm_name = null, |
| 1463 | 1463 | .description = "Enable stencil_export_ext capability", |
| 1464 | 1464 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1466,7 +1466,7 @@ pub const all_features = blk: { |
| 1466 | 1466 | .v1_0, |
| 1467 | 1467 | }), |
| 1468 | 1468 | }; |
| 1469 | result[@intFromEnum(Feature.storage_buffer16bit_access)] = .{ | |
| 1469 | result[@backingInt(Feature.storage_buffer16bit_access)] = .{ | |
| 1470 | 1470 | .llvm_name = null, |
| 1471 | 1471 | .description = "Enable storage_buffer16bit_access capability", |
| 1472 | 1472 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1474,7 +1474,7 @@ pub const all_features = blk: { |
| 1474 | 1474 | .v1_3, |
| 1475 | 1475 | }), |
| 1476 | 1476 | }; |
| 1477 | result[@intFromEnum(Feature.storage_buffer8bit_access)] = .{ | |
| 1477 | result[@backingInt(Feature.storage_buffer8bit_access)] = .{ | |
| 1478 | 1478 | .llvm_name = null, |
| 1479 | 1479 | .description = "Enable storage_buffer8bit_access capability", |
| 1480 | 1480 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1482,14 +1482,14 @@ pub const all_features = blk: { |
| 1482 | 1482 | .v1_5, |
| 1483 | 1483 | }), |
| 1484 | 1484 | }; |
| 1485 | result[@intFromEnum(Feature.storage_buffer_array_dynamic_indexing)] = .{ | |
| 1485 | result[@backingInt(Feature.storage_buffer_array_dynamic_indexing)] = .{ | |
| 1486 | 1486 | .llvm_name = null, |
| 1487 | 1487 | .description = "Enable storage_buffer_array_dynamic_indexing capability", |
| 1488 | 1488 | .dependencies = featureSet(&[_]Feature{ |
| 1489 | 1489 | .v1_0, |
| 1490 | 1490 | }), |
| 1491 | 1491 | }; |
| 1492 | result[@intFromEnum(Feature.storage_buffer_array_non_uniform_indexing)] = .{ | |
| 1492 | result[@backingInt(Feature.storage_buffer_array_non_uniform_indexing)] = .{ | |
| 1493 | 1493 | .llvm_name = null, |
| 1494 | 1494 | .description = "Enable storage_buffer_array_non_uniform_indexing capability", |
| 1495 | 1495 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1497,14 +1497,14 @@ pub const all_features = blk: { |
| 1497 | 1497 | .v1_5, |
| 1498 | 1498 | }), |
| 1499 | 1499 | }; |
| 1500 | result[@intFromEnum(Feature.storage_image_array_dynamic_indexing)] = .{ | |
| 1500 | result[@backingInt(Feature.storage_image_array_dynamic_indexing)] = .{ | |
| 1501 | 1501 | .llvm_name = null, |
| 1502 | 1502 | .description = "Enable storage_image_array_dynamic_indexing capability", |
| 1503 | 1503 | .dependencies = featureSet(&[_]Feature{ |
| 1504 | 1504 | .v1_0, |
| 1505 | 1505 | }), |
| 1506 | 1506 | }; |
| 1507 | result[@intFromEnum(Feature.storage_image_array_non_uniform_indexing)] = .{ | |
| 1507 | result[@backingInt(Feature.storage_image_array_non_uniform_indexing)] = .{ | |
| 1508 | 1508 | .llvm_name = null, |
| 1509 | 1509 | .description = "Enable storage_image_array_non_uniform_indexing capability", |
| 1510 | 1510 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1512,35 +1512,35 @@ pub const all_features = blk: { |
| 1512 | 1512 | .v1_5, |
| 1513 | 1513 | }), |
| 1514 | 1514 | }; |
| 1515 | result[@intFromEnum(Feature.storage_image_extended_formats)] = .{ | |
| 1515 | result[@backingInt(Feature.storage_image_extended_formats)] = .{ | |
| 1516 | 1516 | .llvm_name = null, |
| 1517 | 1517 | .description = "Enable storage_image_extended_formats capability", |
| 1518 | 1518 | .dependencies = featureSet(&[_]Feature{ |
| 1519 | 1519 | .v1_0, |
| 1520 | 1520 | }), |
| 1521 | 1521 | }; |
| 1522 | result[@intFromEnum(Feature.storage_image_multisample)] = .{ | |
| 1522 | result[@backingInt(Feature.storage_image_multisample)] = .{ | |
| 1523 | 1523 | .llvm_name = null, |
| 1524 | 1524 | .description = "Enable storage_image_multisample capability", |
| 1525 | 1525 | .dependencies = featureSet(&[_]Feature{ |
| 1526 | 1526 | .v1_0, |
| 1527 | 1527 | }), |
| 1528 | 1528 | }; |
| 1529 | result[@intFromEnum(Feature.storage_image_read_without_format)] = .{ | |
| 1529 | result[@backingInt(Feature.storage_image_read_without_format)] = .{ | |
| 1530 | 1530 | .llvm_name = null, |
| 1531 | 1531 | .description = "Enable storage_image_read_without_format capability", |
| 1532 | 1532 | .dependencies = featureSet(&[_]Feature{ |
| 1533 | 1533 | .v1_0, |
| 1534 | 1534 | }), |
| 1535 | 1535 | }; |
| 1536 | result[@intFromEnum(Feature.storage_image_write_without_format)] = .{ | |
| 1536 | result[@backingInt(Feature.storage_image_write_without_format)] = .{ | |
| 1537 | 1537 | .llvm_name = null, |
| 1538 | 1538 | .description = "Enable storage_image_write_without_format capability", |
| 1539 | 1539 | .dependencies = featureSet(&[_]Feature{ |
| 1540 | 1540 | .v1_0, |
| 1541 | 1541 | }), |
| 1542 | 1542 | }; |
| 1543 | result[@intFromEnum(Feature.storage_input_output16)] = .{ | |
| 1543 | result[@backingInt(Feature.storage_input_output16)] = .{ | |
| 1544 | 1544 | .llvm_name = null, |
| 1545 | 1545 | .description = "Enable storage_input_output16 capability", |
| 1546 | 1546 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1548,7 +1548,7 @@ pub const all_features = blk: { |
| 1548 | 1548 | .v1_3, |
| 1549 | 1549 | }), |
| 1550 | 1550 | }; |
| 1551 | result[@intFromEnum(Feature.storage_push_constant16)] = .{ | |
| 1551 | result[@backingInt(Feature.storage_push_constant16)] = .{ | |
| 1552 | 1552 | .llvm_name = null, |
| 1553 | 1553 | .description = "Enable storage_push_constant16 capability", |
| 1554 | 1554 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1556,7 +1556,7 @@ pub const all_features = blk: { |
| 1556 | 1556 | .v1_3, |
| 1557 | 1557 | }), |
| 1558 | 1558 | }; |
| 1559 | result[@intFromEnum(Feature.storage_push_constant8)] = .{ | |
| 1559 | result[@backingInt(Feature.storage_push_constant8)] = .{ | |
| 1560 | 1560 | .llvm_name = null, |
| 1561 | 1561 | .description = "Enable storage_push_constant8 capability", |
| 1562 | 1562 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1564,7 +1564,7 @@ pub const all_features = blk: { |
| 1564 | 1564 | .v1_5, |
| 1565 | 1565 | }), |
| 1566 | 1566 | }; |
| 1567 | result[@intFromEnum(Feature.storage_texel_buffer_array_dynamic_indexing)] = .{ | |
| 1567 | result[@backingInt(Feature.storage_texel_buffer_array_dynamic_indexing)] = .{ | |
| 1568 | 1568 | .llvm_name = null, |
| 1569 | 1569 | .description = "Enable storage_texel_buffer_array_dynamic_indexing capability", |
| 1570 | 1570 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1572,7 +1572,7 @@ pub const all_features = blk: { |
| 1572 | 1572 | .v1_5, |
| 1573 | 1573 | }), |
| 1574 | 1574 | }; |
| 1575 | result[@intFromEnum(Feature.storage_texel_buffer_array_non_uniform_indexing)] = .{ | |
| 1575 | result[@backingInt(Feature.storage_texel_buffer_array_non_uniform_indexing)] = .{ | |
| 1576 | 1576 | .llvm_name = null, |
| 1577 | 1577 | .description = "Enable storage_texel_buffer_array_non_uniform_indexing capability", |
| 1578 | 1578 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1580,7 +1580,7 @@ pub const all_features = blk: { |
| 1580 | 1580 | .v1_5, |
| 1581 | 1581 | }), |
| 1582 | 1582 | }; |
| 1583 | result[@intFromEnum(Feature.subgroup_ballot_khr)] = .{ | |
| 1583 | result[@backingInt(Feature.subgroup_ballot_khr)] = .{ | |
| 1584 | 1584 | .llvm_name = null, |
| 1585 | 1585 | .description = "Enable subgroup_ballot_khr capability", |
| 1586 | 1586 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1588,14 +1588,14 @@ pub const all_features = blk: { |
| 1588 | 1588 | .v1_0, |
| 1589 | 1589 | }), |
| 1590 | 1590 | }; |
| 1591 | result[@intFromEnum(Feature.subgroup_dispatch)] = .{ | |
| 1591 | result[@backingInt(Feature.subgroup_dispatch)] = .{ | |
| 1592 | 1592 | .llvm_name = null, |
| 1593 | 1593 | .description = "Enable subgroup_dispatch capability", |
| 1594 | 1594 | .dependencies = featureSet(&[_]Feature{ |
| 1595 | 1595 | .v1_1, |
| 1596 | 1596 | }), |
| 1597 | 1597 | }; |
| 1598 | result[@intFromEnum(Feature.subgroup_vote_khr)] = .{ | |
| 1598 | result[@backingInt(Feature.subgroup_vote_khr)] = .{ | |
| 1599 | 1599 | .llvm_name = null, |
| 1600 | 1600 | .description = "Enable subgroup_vote_khr capability", |
| 1601 | 1601 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1603,21 +1603,21 @@ pub const all_features = blk: { |
| 1603 | 1603 | .v1_0, |
| 1604 | 1604 | }), |
| 1605 | 1605 | }; |
| 1606 | result[@intFromEnum(Feature.tessellation)] = .{ | |
| 1606 | result[@backingInt(Feature.tessellation)] = .{ | |
| 1607 | 1607 | .llvm_name = null, |
| 1608 | 1608 | .description = "Enable tessellation capability", |
| 1609 | 1609 | .dependencies = featureSet(&[_]Feature{ |
| 1610 | 1610 | .v1_0, |
| 1611 | 1611 | }), |
| 1612 | 1612 | }; |
| 1613 | result[@intFromEnum(Feature.tessellation_point_size)] = .{ | |
| 1613 | result[@backingInt(Feature.tessellation_point_size)] = .{ | |
| 1614 | 1614 | .llvm_name = null, |
| 1615 | 1615 | .description = "Enable tessellation_point_size capability", |
| 1616 | 1616 | .dependencies = featureSet(&[_]Feature{ |
| 1617 | 1617 | .v1_0, |
| 1618 | 1618 | }), |
| 1619 | 1619 | }; |
| 1620 | result[@intFromEnum(Feature.tile_image_color_read_access_ext)] = .{ | |
| 1620 | result[@backingInt(Feature.tile_image_color_read_access_ext)] = .{ | |
| 1621 | 1621 | .llvm_name = null, |
| 1622 | 1622 | .description = "Enable tile_image_color_read_access_ext capability", |
| 1623 | 1623 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1625,7 +1625,7 @@ pub const all_features = blk: { |
| 1625 | 1625 | .v1_0, |
| 1626 | 1626 | }), |
| 1627 | 1627 | }; |
| 1628 | result[@intFromEnum(Feature.tile_image_depth_read_access_ext)] = .{ | |
| 1628 | result[@backingInt(Feature.tile_image_depth_read_access_ext)] = .{ | |
| 1629 | 1629 | .llvm_name = null, |
| 1630 | 1630 | .description = "Enable tile_image_depth_read_access_ext capability", |
| 1631 | 1631 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1633,7 +1633,7 @@ pub const all_features = blk: { |
| 1633 | 1633 | .v1_0, |
| 1634 | 1634 | }), |
| 1635 | 1635 | }; |
| 1636 | result[@intFromEnum(Feature.tile_image_stencil_read_access_ext)] = .{ | |
| 1636 | result[@backingInt(Feature.tile_image_stencil_read_access_ext)] = .{ | |
| 1637 | 1637 | .llvm_name = null, |
| 1638 | 1638 | .description = "Enable tile_image_stencil_read_access_ext capability", |
| 1639 | 1639 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1641,14 +1641,14 @@ pub const all_features = blk: { |
| 1641 | 1641 | .v1_0, |
| 1642 | 1642 | }), |
| 1643 | 1643 | }; |
| 1644 | result[@intFromEnum(Feature.transform_feedback)] = .{ | |
| 1644 | result[@backingInt(Feature.transform_feedback)] = .{ | |
| 1645 | 1645 | .llvm_name = null, |
| 1646 | 1646 | .description = "Enable transform_feedback capability", |
| 1647 | 1647 | .dependencies = featureSet(&[_]Feature{ |
| 1648 | 1648 | .v1_0, |
| 1649 | 1649 | }), |
| 1650 | 1650 | }; |
| 1651 | result[@intFromEnum(Feature.uniform_and_storage_buffer16bit_access)] = .{ | |
| 1651 | result[@backingInt(Feature.uniform_and_storage_buffer16bit_access)] = .{ | |
| 1652 | 1652 | .llvm_name = null, |
| 1653 | 1653 | .description = "Enable uniform_and_storage_buffer16bit_access capability", |
| 1654 | 1654 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1656,7 +1656,7 @@ pub const all_features = blk: { |
| 1656 | 1656 | .v1_3, |
| 1657 | 1657 | }), |
| 1658 | 1658 | }; |
| 1659 | result[@intFromEnum(Feature.uniform_and_storage_buffer8bit_access)] = .{ | |
| 1659 | result[@backingInt(Feature.uniform_and_storage_buffer8bit_access)] = .{ | |
| 1660 | 1660 | .llvm_name = null, |
| 1661 | 1661 | .description = "Enable uniform_and_storage_buffer8bit_access capability", |
| 1662 | 1662 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1664,14 +1664,14 @@ pub const all_features = blk: { |
| 1664 | 1664 | .v1_5, |
| 1665 | 1665 | }), |
| 1666 | 1666 | }; |
| 1667 | result[@intFromEnum(Feature.uniform_buffer_array_dynamic_indexing)] = .{ | |
| 1667 | result[@backingInt(Feature.uniform_buffer_array_dynamic_indexing)] = .{ | |
| 1668 | 1668 | .llvm_name = null, |
| 1669 | 1669 | .description = "Enable uniform_buffer_array_dynamic_indexing capability", |
| 1670 | 1670 | .dependencies = featureSet(&[_]Feature{ |
| 1671 | 1671 | .v1_0, |
| 1672 | 1672 | }), |
| 1673 | 1673 | }; |
| 1674 | result[@intFromEnum(Feature.uniform_buffer_array_non_uniform_indexing)] = .{ | |
| 1674 | result[@backingInt(Feature.uniform_buffer_array_non_uniform_indexing)] = .{ | |
| 1675 | 1675 | .llvm_name = null, |
| 1676 | 1676 | .description = "Enable uniform_buffer_array_non_uniform_indexing capability", |
| 1677 | 1677 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1679,14 +1679,14 @@ pub const all_features = blk: { |
| 1679 | 1679 | .v1_5, |
| 1680 | 1680 | }), |
| 1681 | 1681 | }; |
| 1682 | result[@intFromEnum(Feature.uniform_decoration)] = .{ | |
| 1682 | result[@backingInt(Feature.uniform_decoration)] = .{ | |
| 1683 | 1683 | .llvm_name = null, |
| 1684 | 1684 | .description = "Enable uniform_decoration capability", |
| 1685 | 1685 | .dependencies = featureSet(&[_]Feature{ |
| 1686 | 1686 | .v1_6, |
| 1687 | 1687 | }), |
| 1688 | 1688 | }; |
| 1689 | result[@intFromEnum(Feature.uniform_texel_buffer_array_dynamic_indexing)] = .{ | |
| 1689 | result[@backingInt(Feature.uniform_texel_buffer_array_dynamic_indexing)] = .{ | |
| 1690 | 1690 | .llvm_name = null, |
| 1691 | 1691 | .description = "Enable uniform_texel_buffer_array_dynamic_indexing capability", |
| 1692 | 1692 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1694,7 +1694,7 @@ pub const all_features = blk: { |
| 1694 | 1694 | .v1_5, |
| 1695 | 1695 | }), |
| 1696 | 1696 | }; |
| 1697 | result[@intFromEnum(Feature.uniform_texel_buffer_array_non_uniform_indexing)] = .{ | |
| 1697 | result[@backingInt(Feature.uniform_texel_buffer_array_non_uniform_indexing)] = .{ | |
| 1698 | 1698 | .llvm_name = null, |
| 1699 | 1699 | .description = "Enable uniform_texel_buffer_array_non_uniform_indexing capability", |
| 1700 | 1700 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1702,7 +1702,7 @@ pub const all_features = blk: { |
| 1702 | 1702 | .v1_5, |
| 1703 | 1703 | }), |
| 1704 | 1704 | }; |
| 1705 | result[@intFromEnum(Feature.untyped_pointers_khr)] = .{ | |
| 1705 | result[@backingInt(Feature.untyped_pointers_khr)] = .{ | |
| 1706 | 1706 | .llvm_name = null, |
| 1707 | 1707 | .description = "Enable untyped_pointers_khr capability", |
| 1708 | 1708 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1710,54 +1710,54 @@ pub const all_features = blk: { |
| 1710 | 1710 | .v1_0, |
| 1711 | 1711 | }), |
| 1712 | 1712 | }; |
| 1713 | result[@intFromEnum(Feature.v1_0)] = .{ | |
| 1713 | result[@backingInt(Feature.v1_0)] = .{ | |
| 1714 | 1714 | .llvm_name = null, |
| 1715 | 1715 | .description = "Enable v1_0 extension", |
| 1716 | 1716 | .dependencies = featureSet(&[_]Feature{}), |
| 1717 | 1717 | }; |
| 1718 | result[@intFromEnum(Feature.v1_1)] = .{ | |
| 1718 | result[@backingInt(Feature.v1_1)] = .{ | |
| 1719 | 1719 | .llvm_name = null, |
| 1720 | 1720 | .description = "Enable v1_1 extension", |
| 1721 | 1721 | .dependencies = featureSet(&[_]Feature{ |
| 1722 | 1722 | .v1_0, |
| 1723 | 1723 | }), |
| 1724 | 1724 | }; |
| 1725 | result[@intFromEnum(Feature.v1_2)] = .{ | |
| 1725 | result[@backingInt(Feature.v1_2)] = .{ | |
| 1726 | 1726 | .llvm_name = null, |
| 1727 | 1727 | .description = "Enable v1_2 extension", |
| 1728 | 1728 | .dependencies = featureSet(&[_]Feature{ |
| 1729 | 1729 | .v1_1, |
| 1730 | 1730 | }), |
| 1731 | 1731 | }; |
| 1732 | result[@intFromEnum(Feature.v1_3)] = .{ | |
| 1732 | result[@backingInt(Feature.v1_3)] = .{ | |
| 1733 | 1733 | .llvm_name = null, |
| 1734 | 1734 | .description = "Enable v1_3 extension", |
| 1735 | 1735 | .dependencies = featureSet(&[_]Feature{ |
| 1736 | 1736 | .v1_2, |
| 1737 | 1737 | }), |
| 1738 | 1738 | }; |
| 1739 | result[@intFromEnum(Feature.v1_4)] = .{ | |
| 1739 | result[@backingInt(Feature.v1_4)] = .{ | |
| 1740 | 1740 | .llvm_name = null, |
| 1741 | 1741 | .description = "Enable v1_4 extension", |
| 1742 | 1742 | .dependencies = featureSet(&[_]Feature{ |
| 1743 | 1743 | .v1_3, |
| 1744 | 1744 | }), |
| 1745 | 1745 | }; |
| 1746 | result[@intFromEnum(Feature.v1_5)] = .{ | |
| 1746 | result[@backingInt(Feature.v1_5)] = .{ | |
| 1747 | 1747 | .llvm_name = null, |
| 1748 | 1748 | .description = "Enable v1_5 extension", |
| 1749 | 1749 | .dependencies = featureSet(&[_]Feature{ |
| 1750 | 1750 | .v1_4, |
| 1751 | 1751 | }), |
| 1752 | 1752 | }; |
| 1753 | result[@intFromEnum(Feature.v1_6)] = .{ | |
| 1753 | result[@backingInt(Feature.v1_6)] = .{ | |
| 1754 | 1754 | .llvm_name = null, |
| 1755 | 1755 | .description = "Enable v1_6 extension", |
| 1756 | 1756 | .dependencies = featureSet(&[_]Feature{ |
| 1757 | 1757 | .v1_5, |
| 1758 | 1758 | }), |
| 1759 | 1759 | }; |
| 1760 | result[@intFromEnum(Feature.variable_pointers)] = .{ | |
| 1760 | result[@backingInt(Feature.variable_pointers)] = .{ | |
| 1761 | 1761 | .llvm_name = null, |
| 1762 | 1762 | .description = "Enable variable_pointers capability", |
| 1763 | 1763 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1765,7 +1765,7 @@ pub const all_features = blk: { |
| 1765 | 1765 | .v1_3, |
| 1766 | 1766 | }), |
| 1767 | 1767 | }; |
| 1768 | result[@intFromEnum(Feature.variable_pointers_storage_buffer)] = .{ | |
| 1768 | result[@backingInt(Feature.variable_pointers_storage_buffer)] = .{ | |
| 1769 | 1769 | .llvm_name = null, |
| 1770 | 1770 | .description = "Enable variable_pointers_storage_buffer capability", |
| 1771 | 1771 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1773,14 +1773,14 @@ pub const all_features = blk: { |
| 1773 | 1773 | .v1_3, |
| 1774 | 1774 | }), |
| 1775 | 1775 | }; |
| 1776 | result[@intFromEnum(Feature.vector16)] = .{ | |
| 1776 | result[@backingInt(Feature.vector16)] = .{ | |
| 1777 | 1777 | .llvm_name = null, |
| 1778 | 1778 | .description = "Enable vector16 capability", |
| 1779 | 1779 | .dependencies = featureSet(&[_]Feature{ |
| 1780 | 1780 | .v1_0, |
| 1781 | 1781 | }), |
| 1782 | 1782 | }; |
| 1783 | result[@intFromEnum(Feature.vulkan_memory_model)] = .{ | |
| 1783 | result[@backingInt(Feature.vulkan_memory_model)] = .{ | |
| 1784 | 1784 | .llvm_name = null, |
| 1785 | 1785 | .description = "Enable vulkan_memory_model capability", |
| 1786 | 1786 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1788,7 +1788,7 @@ pub const all_features = blk: { |
| 1788 | 1788 | .v1_5, |
| 1789 | 1789 | }), |
| 1790 | 1790 | }; |
| 1791 | result[@intFromEnum(Feature.vulkan_memory_model_device_scope)] = .{ | |
| 1791 | result[@backingInt(Feature.vulkan_memory_model_device_scope)] = .{ | |
| 1792 | 1792 | .llvm_name = null, |
| 1793 | 1793 | .description = "Enable vulkan_memory_model_device_scope capability", |
| 1794 | 1794 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1796,7 +1796,7 @@ pub const all_features = blk: { |
| 1796 | 1796 | .v1_5, |
| 1797 | 1797 | }), |
| 1798 | 1798 | }; |
| 1799 | result[@intFromEnum(Feature.workgroup_memory_explicit_layout16bit_access_khr)] = .{ | |
| 1799 | result[@backingInt(Feature.workgroup_memory_explicit_layout16bit_access_khr)] = .{ | |
| 1800 | 1800 | .llvm_name = null, |
| 1801 | 1801 | .description = "Enable workgroup_memory_explicit_layout16bit_access_khr capability", |
| 1802 | 1802 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1804,7 +1804,7 @@ pub const all_features = blk: { |
| 1804 | 1804 | .v1_0, |
| 1805 | 1805 | }), |
| 1806 | 1806 | }; |
| 1807 | result[@intFromEnum(Feature.workgroup_memory_explicit_layout8bit_access_khr)] = .{ | |
| 1807 | result[@backingInt(Feature.workgroup_memory_explicit_layout8bit_access_khr)] = .{ | |
| 1808 | 1808 | .llvm_name = null, |
| 1809 | 1809 | .description = "Enable workgroup_memory_explicit_layout8bit_access_khr capability", |
| 1810 | 1810 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1812,7 +1812,7 @@ pub const all_features = blk: { |
| 1812 | 1812 | .v1_0, |
| 1813 | 1813 | }), |
| 1814 | 1814 | }; |
| 1815 | result[@intFromEnum(Feature.workgroup_memory_explicit_layout_khr)] = .{ | |
| 1815 | result[@backingInt(Feature.workgroup_memory_explicit_layout_khr)] = .{ | |
| 1816 | 1816 | .llvm_name = null, |
| 1817 | 1817 | .description = "Enable workgroup_memory_explicit_layout_khr capability", |
| 1818 | 1818 | .dependencies = featureSet(&[_]Feature{ |
lib/std/Target/ve.zig+1-1| ... | ... | @@ -17,7 +17,7 @@ pub const all_features = blk: { |
| 17 | 17 | const len = @typeInfo(Feature).@"enum".field_names.len; |
| 18 | 18 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); |
| 19 | 19 | var result: [len]CpuFeature = undefined; |
| 20 | result[@intFromEnum(Feature.vpu)] = .{ | |
| 20 | result[@backingInt(Feature.vpu)] = .{ | |
| 21 | 21 | .llvm_name = "vpu", |
| 22 | 22 | .description = "Enable the VPU", |
| 23 | 23 | .dependencies = featureSet(&[_]Feature{}), |
lib/std/Target/wasm.zig+19-19| ... | ... | @@ -35,103 +35,103 @@ pub const all_features = blk: { |
| 35 | 35 | const len = @typeInfo(Feature).@"enum".field_names.len; |
| 36 | 36 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); |
| 37 | 37 | var result: [len]CpuFeature = undefined; |
| 38 | result[@intFromEnum(Feature.atomics)] = .{ | |
| 38 | result[@backingInt(Feature.atomics)] = .{ | |
| 39 | 39 | .llvm_name = "atomics", |
| 40 | 40 | .description = "Enable Atomics", |
| 41 | 41 | .dependencies = featureSet(&[_]Feature{}), |
| 42 | 42 | }; |
| 43 | result[@intFromEnum(Feature.bulk_memory)] = .{ | |
| 43 | result[@backingInt(Feature.bulk_memory)] = .{ | |
| 44 | 44 | .llvm_name = "bulk-memory", |
| 45 | 45 | .description = "Enable bulk memory operations", |
| 46 | 46 | .dependencies = featureSet(&[_]Feature{ |
| 47 | 47 | .bulk_memory_opt, |
| 48 | 48 | }), |
| 49 | 49 | }; |
| 50 | result[@intFromEnum(Feature.bulk_memory_opt)] = .{ | |
| 50 | result[@backingInt(Feature.bulk_memory_opt)] = .{ | |
| 51 | 51 | .llvm_name = "bulk-memory-opt", |
| 52 | 52 | .description = "Enable bulk memory optimization operations", |
| 53 | 53 | .dependencies = featureSet(&[_]Feature{}), |
| 54 | 54 | }; |
| 55 | result[@intFromEnum(Feature.call_indirect_overlong)] = .{ | |
| 55 | result[@backingInt(Feature.call_indirect_overlong)] = .{ | |
| 56 | 56 | .llvm_name = "call-indirect-overlong", |
| 57 | 57 | .description = "Enable overlong encoding for call_indirect immediates", |
| 58 | 58 | .dependencies = featureSet(&[_]Feature{}), |
| 59 | 59 | }; |
| 60 | result[@intFromEnum(Feature.exception_handling)] = .{ | |
| 60 | result[@backingInt(Feature.exception_handling)] = .{ | |
| 61 | 61 | .llvm_name = "exception-handling", |
| 62 | 62 | .description = "Enable Wasm exception handling", |
| 63 | 63 | .dependencies = featureSet(&[_]Feature{}), |
| 64 | 64 | }; |
| 65 | result[@intFromEnum(Feature.extended_const)] = .{ | |
| 65 | result[@backingInt(Feature.extended_const)] = .{ | |
| 66 | 66 | .llvm_name = "extended-const", |
| 67 | 67 | .description = "Enable extended const expressions", |
| 68 | 68 | .dependencies = featureSet(&[_]Feature{}), |
| 69 | 69 | }; |
| 70 | result[@intFromEnum(Feature.fp16)] = .{ | |
| 70 | result[@backingInt(Feature.fp16)] = .{ | |
| 71 | 71 | .llvm_name = "fp16", |
| 72 | 72 | .description = "Enable FP16 instructions", |
| 73 | 73 | .dependencies = featureSet(&[_]Feature{}), |
| 74 | 74 | }; |
| 75 | result[@intFromEnum(Feature.gc)] = .{ | |
| 75 | result[@backingInt(Feature.gc)] = .{ | |
| 76 | 76 | .llvm_name = "gc", |
| 77 | 77 | .description = "Enable wasm gc", |
| 78 | 78 | .dependencies = featureSet(&[_]Feature{}), |
| 79 | 79 | }; |
| 80 | result[@intFromEnum(Feature.multimemory)] = .{ | |
| 80 | result[@backingInt(Feature.multimemory)] = .{ | |
| 81 | 81 | .llvm_name = "multimemory", |
| 82 | 82 | .description = "Enable multiple memories", |
| 83 | 83 | .dependencies = featureSet(&[_]Feature{}), |
| 84 | 84 | }; |
| 85 | result[@intFromEnum(Feature.multivalue)] = .{ | |
| 85 | result[@backingInt(Feature.multivalue)] = .{ | |
| 86 | 86 | .llvm_name = "multivalue", |
| 87 | 87 | .description = "Enable multivalue blocks, instructions, and functions", |
| 88 | 88 | .dependencies = featureSet(&[_]Feature{}), |
| 89 | 89 | }; |
| 90 | result[@intFromEnum(Feature.mutable_globals)] = .{ | |
| 90 | result[@backingInt(Feature.mutable_globals)] = .{ | |
| 91 | 91 | .llvm_name = "mutable-globals", |
| 92 | 92 | .description = "Enable mutable globals", |
| 93 | 93 | .dependencies = featureSet(&[_]Feature{}), |
| 94 | 94 | }; |
| 95 | result[@intFromEnum(Feature.nontrapping_bulk_memory_len0)] = .{ | |
| 95 | result[@backingInt(Feature.nontrapping_bulk_memory_len0)] = .{ | |
| 96 | 96 | .llvm_name = null, |
| 97 | 97 | .description = "Bulk memory operations with a zero length do not trap", |
| 98 | 98 | .dependencies = featureSet(&[_]Feature{ |
| 99 | 99 | .bulk_memory_opt, |
| 100 | 100 | }), |
| 101 | 101 | }; |
| 102 | result[@intFromEnum(Feature.nontrapping_fptoint)] = .{ | |
| 102 | result[@backingInt(Feature.nontrapping_fptoint)] = .{ | |
| 103 | 103 | .llvm_name = "nontrapping-fptoint", |
| 104 | 104 | .description = "Enable non-trapping float-to-int conversion operators", |
| 105 | 105 | .dependencies = featureSet(&[_]Feature{}), |
| 106 | 106 | }; |
| 107 | result[@intFromEnum(Feature.reference_types)] = .{ | |
| 107 | result[@backingInt(Feature.reference_types)] = .{ | |
| 108 | 108 | .llvm_name = "reference-types", |
| 109 | 109 | .description = "Enable reference types", |
| 110 | 110 | .dependencies = featureSet(&[_]Feature{ |
| 111 | 111 | .call_indirect_overlong, |
| 112 | 112 | }), |
| 113 | 113 | }; |
| 114 | result[@intFromEnum(Feature.relaxed_simd)] = .{ | |
| 114 | result[@backingInt(Feature.relaxed_simd)] = .{ | |
| 115 | 115 | .llvm_name = "relaxed-simd", |
| 116 | 116 | .description = "Enable relaxed-simd instructions", |
| 117 | 117 | .dependencies = featureSet(&[_]Feature{}), |
| 118 | 118 | }; |
| 119 | result[@intFromEnum(Feature.sign_ext)] = .{ | |
| 119 | result[@backingInt(Feature.sign_ext)] = .{ | |
| 120 | 120 | .llvm_name = "sign-ext", |
| 121 | 121 | .description = "Enable sign extension operators", |
| 122 | 122 | .dependencies = featureSet(&[_]Feature{}), |
| 123 | 123 | }; |
| 124 | result[@intFromEnum(Feature.simd128)] = .{ | |
| 124 | result[@backingInt(Feature.simd128)] = .{ | |
| 125 | 125 | .llvm_name = "simd128", |
| 126 | 126 | .description = "Enable 128-bit SIMD", |
| 127 | 127 | .dependencies = featureSet(&[_]Feature{}), |
| 128 | 128 | }; |
| 129 | result[@intFromEnum(Feature.tail_call)] = .{ | |
| 129 | result[@backingInt(Feature.tail_call)] = .{ | |
| 130 | 130 | .llvm_name = "tail-call", |
| 131 | 131 | .description = "Enable tail call instructions", |
| 132 | 132 | .dependencies = featureSet(&[_]Feature{}), |
| 133 | 133 | }; |
| 134 | result[@intFromEnum(Feature.wide_arithmetic)] = .{ | |
| 134 | result[@backingInt(Feature.wide_arithmetic)] = .{ | |
| 135 | 135 | .llvm_name = "wide-arithmetic", |
| 136 | 136 | .description = "Enable wide-arithmetic instructions", |
| 137 | 137 | .dependencies = featureSet(&[_]Feature{}), |
lib/std/Target/x86.zig+202-202| ... | ... | @@ -218,121 +218,121 @@ pub const all_features = blk: { |
| 218 | 218 | const len = @typeInfo(Feature).@"enum".field_names.len; |
| 219 | 219 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); |
| 220 | 220 | var result: [len]CpuFeature = undefined; |
| 221 | result[@intFromEnum(Feature.@"16bit_mode")] = .{ | |
| 221 | result[@backingInt(Feature.@"16bit_mode")] = .{ | |
| 222 | 222 | .llvm_name = "16bit-mode", |
| 223 | 223 | .description = "16-bit mode (i8086)", |
| 224 | 224 | .dependencies = featureSet(&[_]Feature{}), |
| 225 | 225 | }; |
| 226 | result[@intFromEnum(Feature.@"32bit_mode")] = .{ | |
| 226 | result[@backingInt(Feature.@"32bit_mode")] = .{ | |
| 227 | 227 | .llvm_name = "32bit-mode", |
| 228 | 228 | .description = "32-bit mode (80386)", |
| 229 | 229 | .dependencies = featureSet(&[_]Feature{}), |
| 230 | 230 | }; |
| 231 | result[@intFromEnum(Feature.@"3dnow")] = .{ | |
| 231 | result[@backingInt(Feature.@"3dnow")] = .{ | |
| 232 | 232 | .llvm_name = null, |
| 233 | 233 | .description = "Enable 3DNow! instructions", |
| 234 | 234 | .dependencies = featureSet(&[_]Feature{ |
| 235 | 235 | .mmx, |
| 236 | 236 | }), |
| 237 | 237 | }; |
| 238 | result[@intFromEnum(Feature.@"3dnowa")] = .{ | |
| 238 | result[@backingInt(Feature.@"3dnowa")] = .{ | |
| 239 | 239 | .llvm_name = null, |
| 240 | 240 | .description = "Enable 3DNow! Athlon instructions", |
| 241 | 241 | .dependencies = featureSet(&[_]Feature{ |
| 242 | 242 | .@"3dnow", |
| 243 | 243 | }), |
| 244 | 244 | }; |
| 245 | result[@intFromEnum(Feature.@"64bit")] = .{ | |
| 245 | result[@backingInt(Feature.@"64bit")] = .{ | |
| 246 | 246 | .llvm_name = "64bit", |
| 247 | 247 | .description = "Support 64-bit instructions", |
| 248 | 248 | .dependencies = featureSet(&[_]Feature{}), |
| 249 | 249 | }; |
| 250 | result[@intFromEnum(Feature.adx)] = .{ | |
| 250 | result[@backingInt(Feature.adx)] = .{ | |
| 251 | 251 | .llvm_name = "adx", |
| 252 | 252 | .description = "Support ADX instructions", |
| 253 | 253 | .dependencies = featureSet(&[_]Feature{}), |
| 254 | 254 | }; |
| 255 | result[@intFromEnum(Feature.aes)] = .{ | |
| 255 | result[@backingInt(Feature.aes)] = .{ | |
| 256 | 256 | .llvm_name = "aes", |
| 257 | 257 | .description = "Enable AES instructions", |
| 258 | 258 | .dependencies = featureSet(&[_]Feature{ |
| 259 | 259 | .sse2, |
| 260 | 260 | }), |
| 261 | 261 | }; |
| 262 | result[@intFromEnum(Feature.allow_light_256_bit)] = .{ | |
| 262 | result[@backingInt(Feature.allow_light_256_bit)] = .{ | |
| 263 | 263 | .llvm_name = "allow-light-256-bit", |
| 264 | 264 | .description = "Enable generation of 256-bit load/stores even if we prefer 128-bit", |
| 265 | 265 | .dependencies = featureSet(&[_]Feature{}), |
| 266 | 266 | }; |
| 267 | result[@intFromEnum(Feature.amx_avx512)] = .{ | |
| 267 | result[@backingInt(Feature.amx_avx512)] = .{ | |
| 268 | 268 | .llvm_name = "amx-avx512", |
| 269 | 269 | .description = "Support AMX-AVX512 instructions", |
| 270 | 270 | .dependencies = featureSet(&[_]Feature{ |
| 271 | 271 | .amx_tile, |
| 272 | 272 | }), |
| 273 | 273 | }; |
| 274 | result[@intFromEnum(Feature.amx_bf16)] = .{ | |
| 274 | result[@backingInt(Feature.amx_bf16)] = .{ | |
| 275 | 275 | .llvm_name = "amx-bf16", |
| 276 | 276 | .description = "Support AMX-BF16 instructions", |
| 277 | 277 | .dependencies = featureSet(&[_]Feature{ |
| 278 | 278 | .amx_tile, |
| 279 | 279 | }), |
| 280 | 280 | }; |
| 281 | result[@intFromEnum(Feature.amx_complex)] = .{ | |
| 281 | result[@backingInt(Feature.amx_complex)] = .{ | |
| 282 | 282 | .llvm_name = "amx-complex", |
| 283 | 283 | .description = "Support AMX-COMPLEX instructions", |
| 284 | 284 | .dependencies = featureSet(&[_]Feature{ |
| 285 | 285 | .amx_tile, |
| 286 | 286 | }), |
| 287 | 287 | }; |
| 288 | result[@intFromEnum(Feature.amx_fp16)] = .{ | |
| 288 | result[@backingInt(Feature.amx_fp16)] = .{ | |
| 289 | 289 | .llvm_name = "amx-fp16", |
| 290 | 290 | .description = "Support AMX amx-fp16 instructions", |
| 291 | 291 | .dependencies = featureSet(&[_]Feature{ |
| 292 | 292 | .amx_tile, |
| 293 | 293 | }), |
| 294 | 294 | }; |
| 295 | result[@intFromEnum(Feature.amx_fp8)] = .{ | |
| 295 | result[@backingInt(Feature.amx_fp8)] = .{ | |
| 296 | 296 | .llvm_name = "amx-fp8", |
| 297 | 297 | .description = "Support AMX-FP8 instructions", |
| 298 | 298 | .dependencies = featureSet(&[_]Feature{ |
| 299 | 299 | .amx_tile, |
| 300 | 300 | }), |
| 301 | 301 | }; |
| 302 | result[@intFromEnum(Feature.amx_int8)] = .{ | |
| 302 | result[@backingInt(Feature.amx_int8)] = .{ | |
| 303 | 303 | .llvm_name = "amx-int8", |
| 304 | 304 | .description = "Support AMX-INT8 instructions", |
| 305 | 305 | .dependencies = featureSet(&[_]Feature{ |
| 306 | 306 | .amx_tile, |
| 307 | 307 | }), |
| 308 | 308 | }; |
| 309 | result[@intFromEnum(Feature.amx_movrs)] = .{ | |
| 309 | result[@backingInt(Feature.amx_movrs)] = .{ | |
| 310 | 310 | .llvm_name = "amx-movrs", |
| 311 | 311 | .description = "Support AMX-MOVRS instructions", |
| 312 | 312 | .dependencies = featureSet(&[_]Feature{ |
| 313 | 313 | .amx_tile, |
| 314 | 314 | }), |
| 315 | 315 | }; |
| 316 | result[@intFromEnum(Feature.amx_tf32)] = .{ | |
| 316 | result[@backingInt(Feature.amx_tf32)] = .{ | |
| 317 | 317 | .llvm_name = "amx-tf32", |
| 318 | 318 | .description = "Support AMX-TF32 instructions", |
| 319 | 319 | .dependencies = featureSet(&[_]Feature{ |
| 320 | 320 | .amx_tile, |
| 321 | 321 | }), |
| 322 | 322 | }; |
| 323 | result[@intFromEnum(Feature.amx_tile)] = .{ | |
| 323 | result[@backingInt(Feature.amx_tile)] = .{ | |
| 324 | 324 | .llvm_name = "amx-tile", |
| 325 | 325 | .description = "Support AMX-TILE instructions", |
| 326 | 326 | .dependencies = featureSet(&[_]Feature{}), |
| 327 | 327 | }; |
| 328 | result[@intFromEnum(Feature.avx)] = .{ | |
| 328 | result[@backingInt(Feature.avx)] = .{ | |
| 329 | 329 | .llvm_name = "avx", |
| 330 | 330 | .description = "Enable AVX instructions", |
| 331 | 331 | .dependencies = featureSet(&[_]Feature{ |
| 332 | 332 | .sse4_2, |
| 333 | 333 | }), |
| 334 | 334 | }; |
| 335 | result[@intFromEnum(Feature.avx10_1)] = .{ | |
| 335 | result[@backingInt(Feature.avx10_1)] = .{ | |
| 336 | 336 | .llvm_name = "avx10.1", |
| 337 | 337 | .description = "Support AVX10.1 instruction", |
| 338 | 338 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -349,63 +349,63 @@ pub const all_features = blk: { |
| 349 | 349 | .avx512vpopcntdq, |
| 350 | 350 | }), |
| 351 | 351 | }; |
| 352 | result[@intFromEnum(Feature.avx10_2)] = .{ | |
| 352 | result[@backingInt(Feature.avx10_2)] = .{ | |
| 353 | 353 | .llvm_name = "avx10.2", |
| 354 | 354 | .description = "Support AVX10.2 instruction", |
| 355 | 355 | .dependencies = featureSet(&[_]Feature{ |
| 356 | 356 | .avx10_1, |
| 357 | 357 | }), |
| 358 | 358 | }; |
| 359 | result[@intFromEnum(Feature.avx2)] = .{ | |
| 359 | result[@backingInt(Feature.avx2)] = .{ | |
| 360 | 360 | .llvm_name = "avx2", |
| 361 | 361 | .description = "Enable AVX2 instructions", |
| 362 | 362 | .dependencies = featureSet(&[_]Feature{ |
| 363 | 363 | .avx, |
| 364 | 364 | }), |
| 365 | 365 | }; |
| 366 | result[@intFromEnum(Feature.avx512bf16)] = .{ | |
| 366 | result[@backingInt(Feature.avx512bf16)] = .{ | |
| 367 | 367 | .llvm_name = "avx512bf16", |
| 368 | 368 | .description = "Support bfloat16 floating point", |
| 369 | 369 | .dependencies = featureSet(&[_]Feature{ |
| 370 | 370 | .avx512bw, |
| 371 | 371 | }), |
| 372 | 372 | }; |
| 373 | result[@intFromEnum(Feature.avx512bitalg)] = .{ | |
| 373 | result[@backingInt(Feature.avx512bitalg)] = .{ | |
| 374 | 374 | .llvm_name = "avx512bitalg", |
| 375 | 375 | .description = "Enable AVX-512 Bit Algorithms", |
| 376 | 376 | .dependencies = featureSet(&[_]Feature{ |
| 377 | 377 | .avx512bw, |
| 378 | 378 | }), |
| 379 | 379 | }; |
| 380 | result[@intFromEnum(Feature.avx512bw)] = .{ | |
| 380 | result[@backingInt(Feature.avx512bw)] = .{ | |
| 381 | 381 | .llvm_name = "avx512bw", |
| 382 | 382 | .description = "Enable AVX-512 Byte and Word Instructions", |
| 383 | 383 | .dependencies = featureSet(&[_]Feature{ |
| 384 | 384 | .avx512f, |
| 385 | 385 | }), |
| 386 | 386 | }; |
| 387 | result[@intFromEnum(Feature.avx512cd)] = .{ | |
| 387 | result[@backingInt(Feature.avx512cd)] = .{ | |
| 388 | 388 | .llvm_name = "avx512cd", |
| 389 | 389 | .description = "Enable AVX-512 Conflict Detection Instructions", |
| 390 | 390 | .dependencies = featureSet(&[_]Feature{ |
| 391 | 391 | .avx512f, |
| 392 | 392 | }), |
| 393 | 393 | }; |
| 394 | result[@intFromEnum(Feature.avx512dq)] = .{ | |
| 394 | result[@backingInt(Feature.avx512dq)] = .{ | |
| 395 | 395 | .llvm_name = "avx512dq", |
| 396 | 396 | .description = "Enable AVX-512 Doubleword and Quadword Instructions", |
| 397 | 397 | .dependencies = featureSet(&[_]Feature{ |
| 398 | 398 | .avx512f, |
| 399 | 399 | }), |
| 400 | 400 | }; |
| 401 | result[@intFromEnum(Feature.avx512er)] = .{ | |
| 401 | result[@backingInt(Feature.avx512er)] = .{ | |
| 402 | 402 | .llvm_name = null, |
| 403 | 403 | .description = "Enable AVX-512 Exponential and Reciprocal Instructions", |
| 404 | 404 | .dependencies = featureSet(&[_]Feature{ |
| 405 | 405 | .avx512f, |
| 406 | 406 | }), |
| 407 | 407 | }; |
| 408 | result[@intFromEnum(Feature.avx512f)] = .{ | |
| 408 | result[@backingInt(Feature.avx512f)] = .{ | |
| 409 | 409 | .llvm_name = "avx512f", |
| 410 | 410 | .description = "Enable AVX-512 instructions", |
| 411 | 411 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -414,341 +414,341 @@ pub const all_features = blk: { |
| 414 | 414 | .fma, |
| 415 | 415 | }), |
| 416 | 416 | }; |
| 417 | result[@intFromEnum(Feature.avx512fp16)] = .{ | |
| 417 | result[@backingInt(Feature.avx512fp16)] = .{ | |
| 418 | 418 | .llvm_name = "avx512fp16", |
| 419 | 419 | .description = "Support 16-bit floating point", |
| 420 | 420 | .dependencies = featureSet(&[_]Feature{ |
| 421 | 421 | .avx512bw, |
| 422 | 422 | }), |
| 423 | 423 | }; |
| 424 | result[@intFromEnum(Feature.avx512ifma)] = .{ | |
| 424 | result[@backingInt(Feature.avx512ifma)] = .{ | |
| 425 | 425 | .llvm_name = "avx512ifma", |
| 426 | 426 | .description = "Enable AVX-512 Integer Fused Multiple-Add", |
| 427 | 427 | .dependencies = featureSet(&[_]Feature{ |
| 428 | 428 | .avx512f, |
| 429 | 429 | }), |
| 430 | 430 | }; |
| 431 | result[@intFromEnum(Feature.avx512pf)] = .{ | |
| 431 | result[@backingInt(Feature.avx512pf)] = .{ | |
| 432 | 432 | .llvm_name = null, |
| 433 | 433 | .description = "Enable AVX-512 PreFetch Instructions", |
| 434 | 434 | .dependencies = featureSet(&[_]Feature{ |
| 435 | 435 | .avx512f, |
| 436 | 436 | }), |
| 437 | 437 | }; |
| 438 | result[@intFromEnum(Feature.avx512vbmi)] = .{ | |
| 438 | result[@backingInt(Feature.avx512vbmi)] = .{ | |
| 439 | 439 | .llvm_name = "avx512vbmi", |
| 440 | 440 | .description = "Enable AVX-512 Vector Byte Manipulation Instructions", |
| 441 | 441 | .dependencies = featureSet(&[_]Feature{ |
| 442 | 442 | .avx512bw, |
| 443 | 443 | }), |
| 444 | 444 | }; |
| 445 | result[@intFromEnum(Feature.avx512vbmi2)] = .{ | |
| 445 | result[@backingInt(Feature.avx512vbmi2)] = .{ | |
| 446 | 446 | .llvm_name = "avx512vbmi2", |
| 447 | 447 | .description = "Enable AVX-512 further Vector Byte Manipulation Instructions", |
| 448 | 448 | .dependencies = featureSet(&[_]Feature{ |
| 449 | 449 | .avx512bw, |
| 450 | 450 | }), |
| 451 | 451 | }; |
| 452 | result[@intFromEnum(Feature.avx512vl)] = .{ | |
| 452 | result[@backingInt(Feature.avx512vl)] = .{ | |
| 453 | 453 | .llvm_name = "avx512vl", |
| 454 | 454 | .description = "Enable AVX-512 Vector Length eXtensions", |
| 455 | 455 | .dependencies = featureSet(&[_]Feature{ |
| 456 | 456 | .avx512f, |
| 457 | 457 | }), |
| 458 | 458 | }; |
| 459 | result[@intFromEnum(Feature.avx512vnni)] = .{ | |
| 459 | result[@backingInt(Feature.avx512vnni)] = .{ | |
| 460 | 460 | .llvm_name = "avx512vnni", |
| 461 | 461 | .description = "Enable AVX-512 Vector Neural Network Instructions", |
| 462 | 462 | .dependencies = featureSet(&[_]Feature{ |
| 463 | 463 | .avx512f, |
| 464 | 464 | }), |
| 465 | 465 | }; |
| 466 | result[@intFromEnum(Feature.avx512vp2intersect)] = .{ | |
| 466 | result[@backingInt(Feature.avx512vp2intersect)] = .{ | |
| 467 | 467 | .llvm_name = "avx512vp2intersect", |
| 468 | 468 | .description = "Enable AVX-512 vp2intersect", |
| 469 | 469 | .dependencies = featureSet(&[_]Feature{ |
| 470 | 470 | .avx512f, |
| 471 | 471 | }), |
| 472 | 472 | }; |
| 473 | result[@intFromEnum(Feature.avx512vpopcntdq)] = .{ | |
| 473 | result[@backingInt(Feature.avx512vpopcntdq)] = .{ | |
| 474 | 474 | .llvm_name = "avx512vpopcntdq", |
| 475 | 475 | .description = "Enable AVX-512 Population Count Instructions", |
| 476 | 476 | .dependencies = featureSet(&[_]Feature{ |
| 477 | 477 | .avx512f, |
| 478 | 478 | }), |
| 479 | 479 | }; |
| 480 | result[@intFromEnum(Feature.avxifma)] = .{ | |
| 480 | result[@backingInt(Feature.avxifma)] = .{ | |
| 481 | 481 | .llvm_name = "avxifma", |
| 482 | 482 | .description = "Enable AVX-IFMA", |
| 483 | 483 | .dependencies = featureSet(&[_]Feature{ |
| 484 | 484 | .avx2, |
| 485 | 485 | }), |
| 486 | 486 | }; |
| 487 | result[@intFromEnum(Feature.avxneconvert)] = .{ | |
| 487 | result[@backingInt(Feature.avxneconvert)] = .{ | |
| 488 | 488 | .llvm_name = "avxneconvert", |
| 489 | 489 | .description = "Support AVX-NE-CONVERT instructions", |
| 490 | 490 | .dependencies = featureSet(&[_]Feature{ |
| 491 | 491 | .avx2, |
| 492 | 492 | }), |
| 493 | 493 | }; |
| 494 | result[@intFromEnum(Feature.avxvnni)] = .{ | |
| 494 | result[@backingInt(Feature.avxvnni)] = .{ | |
| 495 | 495 | .llvm_name = "avxvnni", |
| 496 | 496 | .description = "Support AVX_VNNI encoding", |
| 497 | 497 | .dependencies = featureSet(&[_]Feature{ |
| 498 | 498 | .avx2, |
| 499 | 499 | }), |
| 500 | 500 | }; |
| 501 | result[@intFromEnum(Feature.avxvnniint16)] = .{ | |
| 501 | result[@backingInt(Feature.avxvnniint16)] = .{ | |
| 502 | 502 | .llvm_name = "avxvnniint16", |
| 503 | 503 | .description = "Enable AVX-VNNI-INT16", |
| 504 | 504 | .dependencies = featureSet(&[_]Feature{ |
| 505 | 505 | .avx2, |
| 506 | 506 | }), |
| 507 | 507 | }; |
| 508 | result[@intFromEnum(Feature.avxvnniint8)] = .{ | |
| 508 | result[@backingInt(Feature.avxvnniint8)] = .{ | |
| 509 | 509 | .llvm_name = "avxvnniint8", |
| 510 | 510 | .description = "Enable AVX-VNNI-INT8", |
| 511 | 511 | .dependencies = featureSet(&[_]Feature{ |
| 512 | 512 | .avx2, |
| 513 | 513 | }), |
| 514 | 514 | }; |
| 515 | result[@intFromEnum(Feature.bmi)] = .{ | |
| 515 | result[@backingInt(Feature.bmi)] = .{ | |
| 516 | 516 | .llvm_name = "bmi", |
| 517 | 517 | .description = "Support BMI instructions", |
| 518 | 518 | .dependencies = featureSet(&[_]Feature{}), |
| 519 | 519 | }; |
| 520 | result[@intFromEnum(Feature.bmi2)] = .{ | |
| 520 | result[@backingInt(Feature.bmi2)] = .{ | |
| 521 | 521 | .llvm_name = "bmi2", |
| 522 | 522 | .description = "Support BMI2 instructions", |
| 523 | 523 | .dependencies = featureSet(&[_]Feature{}), |
| 524 | 524 | }; |
| 525 | result[@intFromEnum(Feature.branch_hint)] = .{ | |
| 525 | result[@backingInt(Feature.branch_hint)] = .{ | |
| 526 | 526 | .llvm_name = "branch-hint", |
| 527 | 527 | .description = "Target has branch hint feature", |
| 528 | 528 | .dependencies = featureSet(&[_]Feature{}), |
| 529 | 529 | }; |
| 530 | result[@intFromEnum(Feature.branchfusion)] = .{ | |
| 530 | result[@backingInt(Feature.branchfusion)] = .{ | |
| 531 | 531 | .llvm_name = "branchfusion", |
| 532 | 532 | .description = "CMP/TEST can be fused with conditional branches", |
| 533 | 533 | .dependencies = featureSet(&[_]Feature{}), |
| 534 | 534 | }; |
| 535 | result[@intFromEnum(Feature.bsf_bsr_0_clobbers_result)] = .{ | |
| 535 | result[@backingInt(Feature.bsf_bsr_0_clobbers_result)] = .{ | |
| 536 | 536 | .llvm_name = null, |
| 537 | 537 | .description = "BSF/BSR may clobber the lower 32-bits of the result register when the source is zero", |
| 538 | 538 | .dependencies = featureSet(&[_]Feature{}), |
| 539 | 539 | }; |
| 540 | result[@intFromEnum(Feature.ccmp)] = .{ | |
| 540 | result[@backingInt(Feature.ccmp)] = .{ | |
| 541 | 541 | .llvm_name = "ccmp", |
| 542 | 542 | .description = "Support conditional cmp & test instructions", |
| 543 | 543 | .dependencies = featureSet(&[_]Feature{}), |
| 544 | 544 | }; |
| 545 | result[@intFromEnum(Feature.cf)] = .{ | |
| 545 | result[@backingInt(Feature.cf)] = .{ | |
| 546 | 546 | .llvm_name = "cf", |
| 547 | 547 | .description = "Support conditional faulting", |
| 548 | 548 | .dependencies = featureSet(&[_]Feature{}), |
| 549 | 549 | }; |
| 550 | result[@intFromEnum(Feature.cldemote)] = .{ | |
| 550 | result[@backingInt(Feature.cldemote)] = .{ | |
| 551 | 551 | .llvm_name = "cldemote", |
| 552 | 552 | .description = "Enable Cache Line Demote", |
| 553 | 553 | .dependencies = featureSet(&[_]Feature{}), |
| 554 | 554 | }; |
| 555 | result[@intFromEnum(Feature.clflushopt)] = .{ | |
| 555 | result[@backingInt(Feature.clflushopt)] = .{ | |
| 556 | 556 | .llvm_name = "clflushopt", |
| 557 | 557 | .description = "Flush A Cache Line Optimized", |
| 558 | 558 | .dependencies = featureSet(&[_]Feature{}), |
| 559 | 559 | }; |
| 560 | result[@intFromEnum(Feature.clwb)] = .{ | |
| 560 | result[@backingInt(Feature.clwb)] = .{ | |
| 561 | 561 | .llvm_name = "clwb", |
| 562 | 562 | .description = "Cache Line Write Back", |
| 563 | 563 | .dependencies = featureSet(&[_]Feature{}), |
| 564 | 564 | }; |
| 565 | result[@intFromEnum(Feature.clzero)] = .{ | |
| 565 | result[@backingInt(Feature.clzero)] = .{ | |
| 566 | 566 | .llvm_name = "clzero", |
| 567 | 567 | .description = "Enable Cache Line Zero", |
| 568 | 568 | .dependencies = featureSet(&[_]Feature{}), |
| 569 | 569 | }; |
| 570 | result[@intFromEnum(Feature.cmov)] = .{ | |
| 570 | result[@backingInt(Feature.cmov)] = .{ | |
| 571 | 571 | .llvm_name = "cmov", |
| 572 | 572 | .description = "Enable conditional move instructions", |
| 573 | 573 | .dependencies = featureSet(&[_]Feature{}), |
| 574 | 574 | }; |
| 575 | result[@intFromEnum(Feature.cmpccxadd)] = .{ | |
| 575 | result[@backingInt(Feature.cmpccxadd)] = .{ | |
| 576 | 576 | .llvm_name = "cmpccxadd", |
| 577 | 577 | .description = "Support CMPCCXADD instructions", |
| 578 | 578 | .dependencies = featureSet(&[_]Feature{}), |
| 579 | 579 | }; |
| 580 | result[@intFromEnum(Feature.crc32)] = .{ | |
| 580 | result[@backingInt(Feature.crc32)] = .{ | |
| 581 | 581 | .llvm_name = "crc32", |
| 582 | 582 | .description = "Enable SSE 4.2 CRC32 instruction (used when SSE4.2 is supported but function is GPR only)", |
| 583 | 583 | .dependencies = featureSet(&[_]Feature{}), |
| 584 | 584 | }; |
| 585 | result[@intFromEnum(Feature.cx16)] = .{ | |
| 585 | result[@backingInt(Feature.cx16)] = .{ | |
| 586 | 586 | .llvm_name = "cx16", |
| 587 | 587 | .description = "64-bit with cmpxchg16b (this is true for most x86-64 chips, but not the first AMD chips)", |
| 588 | 588 | .dependencies = featureSet(&[_]Feature{ |
| 589 | 589 | .cx8, |
| 590 | 590 | }), |
| 591 | 591 | }; |
| 592 | result[@intFromEnum(Feature.cx8)] = .{ | |
| 592 | result[@backingInt(Feature.cx8)] = .{ | |
| 593 | 593 | .llvm_name = "cx8", |
| 594 | 594 | .description = "Support CMPXCHG8B instructions", |
| 595 | 595 | .dependencies = featureSet(&[_]Feature{}), |
| 596 | 596 | }; |
| 597 | result[@intFromEnum(Feature.egpr)] = .{ | |
| 597 | result[@backingInt(Feature.egpr)] = .{ | |
| 598 | 598 | .llvm_name = "egpr", |
| 599 | 599 | .description = "Support extended general purpose register", |
| 600 | 600 | .dependencies = featureSet(&[_]Feature{}), |
| 601 | 601 | }; |
| 602 | result[@intFromEnum(Feature.enqcmd)] = .{ | |
| 602 | result[@backingInt(Feature.enqcmd)] = .{ | |
| 603 | 603 | .llvm_name = "enqcmd", |
| 604 | 604 | .description = "Has ENQCMD instructions", |
| 605 | 605 | .dependencies = featureSet(&[_]Feature{}), |
| 606 | 606 | }; |
| 607 | result[@intFromEnum(Feature.ermsb)] = .{ | |
| 607 | result[@backingInt(Feature.ermsb)] = .{ | |
| 608 | 608 | .llvm_name = "ermsb", |
| 609 | 609 | .description = "REP MOVS/STOS are fast", |
| 610 | 610 | .dependencies = featureSet(&[_]Feature{}), |
| 611 | 611 | }; |
| 612 | result[@intFromEnum(Feature.f16c)] = .{ | |
| 612 | result[@backingInt(Feature.f16c)] = .{ | |
| 613 | 613 | .llvm_name = "f16c", |
| 614 | 614 | .description = "Support 16-bit floating point conversion instructions", |
| 615 | 615 | .dependencies = featureSet(&[_]Feature{ |
| 616 | 616 | .avx, |
| 617 | 617 | }), |
| 618 | 618 | }; |
| 619 | result[@intFromEnum(Feature.false_deps_getmant)] = .{ | |
| 619 | result[@backingInt(Feature.false_deps_getmant)] = .{ | |
| 620 | 620 | .llvm_name = "false-deps-getmant", |
| 621 | 621 | .description = "VGETMANTSS/SD/SH and VGETMANDPS/PD(memory version) has a false dependency on dest register", |
| 622 | 622 | .dependencies = featureSet(&[_]Feature{}), |
| 623 | 623 | }; |
| 624 | result[@intFromEnum(Feature.false_deps_lzcnt_tzcnt)] = .{ | |
| 624 | result[@backingInt(Feature.false_deps_lzcnt_tzcnt)] = .{ | |
| 625 | 625 | .llvm_name = "false-deps-lzcnt-tzcnt", |
| 626 | 626 | .description = "LZCNT/TZCNT have a false dependency on dest register", |
| 627 | 627 | .dependencies = featureSet(&[_]Feature{}), |
| 628 | 628 | }; |
| 629 | result[@intFromEnum(Feature.false_deps_mulc)] = .{ | |
| 629 | result[@backingInt(Feature.false_deps_mulc)] = .{ | |
| 630 | 630 | .llvm_name = "false-deps-mulc", |
| 631 | 631 | .description = "VF[C]MULCPH/SH has a false dependency on dest register", |
| 632 | 632 | .dependencies = featureSet(&[_]Feature{}), |
| 633 | 633 | }; |
| 634 | result[@intFromEnum(Feature.false_deps_mullq)] = .{ | |
| 634 | result[@backingInt(Feature.false_deps_mullq)] = .{ | |
| 635 | 635 | .llvm_name = "false-deps-mullq", |
| 636 | 636 | .description = "VPMULLQ has a false dependency on dest register", |
| 637 | 637 | .dependencies = featureSet(&[_]Feature{}), |
| 638 | 638 | }; |
| 639 | result[@intFromEnum(Feature.false_deps_perm)] = .{ | |
| 639 | result[@backingInt(Feature.false_deps_perm)] = .{ | |
| 640 | 640 | .llvm_name = "false-deps-perm", |
| 641 | 641 | .description = "VPERMD/Q/PS/PD has a false dependency on dest register", |
| 642 | 642 | .dependencies = featureSet(&[_]Feature{}), |
| 643 | 643 | }; |
| 644 | result[@intFromEnum(Feature.false_deps_popcnt)] = .{ | |
| 644 | result[@backingInt(Feature.false_deps_popcnt)] = .{ | |
| 645 | 645 | .llvm_name = "false-deps-popcnt", |
| 646 | 646 | .description = "POPCNT has a false dependency on dest register", |
| 647 | 647 | .dependencies = featureSet(&[_]Feature{}), |
| 648 | 648 | }; |
| 649 | result[@intFromEnum(Feature.false_deps_range)] = .{ | |
| 649 | result[@backingInt(Feature.false_deps_range)] = .{ | |
| 650 | 650 | .llvm_name = "false-deps-range", |
| 651 | 651 | .description = "VRANGEPD/PS/SD/SS has a false dependency on dest register", |
| 652 | 652 | .dependencies = featureSet(&[_]Feature{}), |
| 653 | 653 | }; |
| 654 | result[@intFromEnum(Feature.fast_11bytenop)] = .{ | |
| 654 | result[@backingInt(Feature.fast_11bytenop)] = .{ | |
| 655 | 655 | .llvm_name = "fast-11bytenop", |
| 656 | 656 | .description = "Target can quickly decode up to 11 byte NOPs", |
| 657 | 657 | .dependencies = featureSet(&[_]Feature{}), |
| 658 | 658 | }; |
| 659 | result[@intFromEnum(Feature.fast_15bytenop)] = .{ | |
| 659 | result[@backingInt(Feature.fast_15bytenop)] = .{ | |
| 660 | 660 | .llvm_name = "fast-15bytenop", |
| 661 | 661 | .description = "Target can quickly decode up to 15 byte NOPs", |
| 662 | 662 | .dependencies = featureSet(&[_]Feature{}), |
| 663 | 663 | }; |
| 664 | result[@intFromEnum(Feature.fast_7bytenop)] = .{ | |
| 664 | result[@backingInt(Feature.fast_7bytenop)] = .{ | |
| 665 | 665 | .llvm_name = "fast-7bytenop", |
| 666 | 666 | .description = "Target can quickly decode up to 7 byte NOPs", |
| 667 | 667 | .dependencies = featureSet(&[_]Feature{}), |
| 668 | 668 | }; |
| 669 | result[@intFromEnum(Feature.fast_bextr)] = .{ | |
| 669 | result[@backingInt(Feature.fast_bextr)] = .{ | |
| 670 | 670 | .llvm_name = "fast-bextr", |
| 671 | 671 | .description = "Indicates that the BEXTR instruction is implemented as a single uop with good throughput", |
| 672 | 672 | .dependencies = featureSet(&[_]Feature{}), |
| 673 | 673 | }; |
| 674 | result[@intFromEnum(Feature.fast_dpwssd)] = .{ | |
| 674 | result[@backingInt(Feature.fast_dpwssd)] = .{ | |
| 675 | 675 | .llvm_name = "fast-dpwssd", |
| 676 | 676 | .description = "Prefer vpdpwssd instruction over vpmaddwd+vpaddd instruction sequence", |
| 677 | 677 | .dependencies = featureSet(&[_]Feature{}), |
| 678 | 678 | }; |
| 679 | result[@intFromEnum(Feature.fast_gather)] = .{ | |
| 679 | result[@backingInt(Feature.fast_gather)] = .{ | |
| 680 | 680 | .llvm_name = "fast-gather", |
| 681 | 681 | .description = "Indicates if gather is reasonably fast (this is true for Skylake client and all AVX-512 CPUs)", |
| 682 | 682 | .dependencies = featureSet(&[_]Feature{}), |
| 683 | 683 | }; |
| 684 | result[@intFromEnum(Feature.fast_hops)] = .{ | |
| 684 | result[@backingInt(Feature.fast_hops)] = .{ | |
| 685 | 685 | .llvm_name = "fast-hops", |
| 686 | 686 | .description = "Prefer horizontal vector math instructions (haddp, phsub, etc.) over normal vector instructions with shuffles", |
| 687 | 687 | .dependencies = featureSet(&[_]Feature{}), |
| 688 | 688 | }; |
| 689 | result[@intFromEnum(Feature.fast_imm16)] = .{ | |
| 689 | result[@backingInt(Feature.fast_imm16)] = .{ | |
| 690 | 690 | .llvm_name = "fast-imm16", |
| 691 | 691 | .description = "Prefer a i16 instruction with i16 immediate over extension to i32", |
| 692 | 692 | .dependencies = featureSet(&[_]Feature{}), |
| 693 | 693 | }; |
| 694 | result[@intFromEnum(Feature.fast_lzcnt)] = .{ | |
| 694 | result[@backingInt(Feature.fast_lzcnt)] = .{ | |
| 695 | 695 | .llvm_name = "fast-lzcnt", |
| 696 | 696 | .description = "LZCNT instructions are as fast as most simple integer ops", |
| 697 | 697 | .dependencies = featureSet(&[_]Feature{}), |
| 698 | 698 | }; |
| 699 | result[@intFromEnum(Feature.fast_movbe)] = .{ | |
| 699 | result[@backingInt(Feature.fast_movbe)] = .{ | |
| 700 | 700 | .llvm_name = "fast-movbe", |
| 701 | 701 | .description = "Prefer a movbe over a single-use load + bswap / single-use bswap + store", |
| 702 | 702 | .dependencies = featureSet(&[_]Feature{}), |
| 703 | 703 | }; |
| 704 | result[@intFromEnum(Feature.fast_scalar_fsqrt)] = .{ | |
| 704 | result[@backingInt(Feature.fast_scalar_fsqrt)] = .{ | |
| 705 | 705 | .llvm_name = "fast-scalar-fsqrt", |
| 706 | 706 | .description = "Scalar SQRT is fast (disable Newton-Raphson)", |
| 707 | 707 | .dependencies = featureSet(&[_]Feature{}), |
| 708 | 708 | }; |
| 709 | result[@intFromEnum(Feature.fast_scalar_shift_masks)] = .{ | |
| 709 | result[@backingInt(Feature.fast_scalar_shift_masks)] = .{ | |
| 710 | 710 | .llvm_name = "fast-scalar-shift-masks", |
| 711 | 711 | .description = "Prefer a left/right scalar logical shift pair over a shift+and pair", |
| 712 | 712 | .dependencies = featureSet(&[_]Feature{}), |
| 713 | 713 | }; |
| 714 | result[@intFromEnum(Feature.fast_shld_rotate)] = .{ | |
| 714 | result[@backingInt(Feature.fast_shld_rotate)] = .{ | |
| 715 | 715 | .llvm_name = "fast-shld-rotate", |
| 716 | 716 | .description = "SHLD can be used as a faster rotate", |
| 717 | 717 | .dependencies = featureSet(&[_]Feature{}), |
| 718 | 718 | }; |
| 719 | result[@intFromEnum(Feature.fast_variable_crosslane_shuffle)] = .{ | |
| 719 | result[@backingInt(Feature.fast_variable_crosslane_shuffle)] = .{ | |
| 720 | 720 | .llvm_name = "fast-variable-crosslane-shuffle", |
| 721 | 721 | .description = "Cross-lane shuffles with variable masks are fast", |
| 722 | 722 | .dependencies = featureSet(&[_]Feature{}), |
| 723 | 723 | }; |
| 724 | result[@intFromEnum(Feature.fast_variable_perlane_shuffle)] = .{ | |
| 724 | result[@backingInt(Feature.fast_variable_perlane_shuffle)] = .{ | |
| 725 | 725 | .llvm_name = "fast-variable-perlane-shuffle", |
| 726 | 726 | .description = "Per-lane shuffles with variable masks are fast", |
| 727 | 727 | .dependencies = featureSet(&[_]Feature{}), |
| 728 | 728 | }; |
| 729 | result[@intFromEnum(Feature.fast_vector_fsqrt)] = .{ | |
| 729 | result[@backingInt(Feature.fast_vector_fsqrt)] = .{ | |
| 730 | 730 | .llvm_name = "fast-vector-fsqrt", |
| 731 | 731 | .description = "Vector SQRT is fast (disable Newton-Raphson)", |
| 732 | 732 | .dependencies = featureSet(&[_]Feature{}), |
| 733 | 733 | }; |
| 734 | result[@intFromEnum(Feature.fast_vector_shift_masks)] = .{ | |
| 734 | result[@backingInt(Feature.fast_vector_shift_masks)] = .{ | |
| 735 | 735 | .llvm_name = "fast-vector-shift-masks", |
| 736 | 736 | .description = "Prefer a left/right vector logical shift pair over a shift+and pair", |
| 737 | 737 | .dependencies = featureSet(&[_]Feature{}), |
| 738 | 738 | }; |
| 739 | result[@intFromEnum(Feature.faster_shift_than_shuffle)] = .{ | |
| 739 | result[@backingInt(Feature.faster_shift_than_shuffle)] = .{ | |
| 740 | 740 | .llvm_name = "faster-shift-than-shuffle", |
| 741 | 741 | .description = "Shifts are faster (or as fast) as shuffle", |
| 742 | 742 | .dependencies = featureSet(&[_]Feature{}), |
| 743 | 743 | }; |
| 744 | result[@intFromEnum(Feature.fma)] = .{ | |
| 744 | result[@backingInt(Feature.fma)] = .{ | |
| 745 | 745 | .llvm_name = "fma", |
| 746 | 746 | .description = "Enable three-operand fused multiple-add", |
| 747 | 747 | .dependencies = featureSet(&[_]Feature{ |
| 748 | 748 | .avx, |
| 749 | 749 | }), |
| 750 | 750 | }; |
| 751 | result[@intFromEnum(Feature.fma4)] = .{ | |
| 751 | result[@backingInt(Feature.fma4)] = .{ | |
| 752 | 752 | .llvm_name = "fma4", |
| 753 | 753 | .description = "Enable four-operand fused multiple-add", |
| 754 | 754 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -756,288 +756,288 @@ pub const all_features = blk: { |
| 756 | 756 | .sse4a, |
| 757 | 757 | }), |
| 758 | 758 | }; |
| 759 | result[@intFromEnum(Feature.fsgsbase)] = .{ | |
| 759 | result[@backingInt(Feature.fsgsbase)] = .{ | |
| 760 | 760 | .llvm_name = "fsgsbase", |
| 761 | 761 | .description = "Support FS/GS Base instructions", |
| 762 | 762 | .dependencies = featureSet(&[_]Feature{}), |
| 763 | 763 | }; |
| 764 | result[@intFromEnum(Feature.fsrm)] = .{ | |
| 764 | result[@backingInt(Feature.fsrm)] = .{ | |
| 765 | 765 | .llvm_name = "fsrm", |
| 766 | 766 | .description = "REP MOVSB of short lengths is faster", |
| 767 | 767 | .dependencies = featureSet(&[_]Feature{}), |
| 768 | 768 | }; |
| 769 | result[@intFromEnum(Feature.fxsr)] = .{ | |
| 769 | result[@backingInt(Feature.fxsr)] = .{ | |
| 770 | 770 | .llvm_name = "fxsr", |
| 771 | 771 | .description = "Support fxsave/fxrestore instructions", |
| 772 | 772 | .dependencies = featureSet(&[_]Feature{}), |
| 773 | 773 | }; |
| 774 | result[@intFromEnum(Feature.gfni)] = .{ | |
| 774 | result[@backingInt(Feature.gfni)] = .{ | |
| 775 | 775 | .llvm_name = "gfni", |
| 776 | 776 | .description = "Enable Galois Field Arithmetic Instructions", |
| 777 | 777 | .dependencies = featureSet(&[_]Feature{ |
| 778 | 778 | .sse2, |
| 779 | 779 | }), |
| 780 | 780 | }; |
| 781 | result[@intFromEnum(Feature.harden_sls_ijmp)] = .{ | |
| 781 | result[@backingInt(Feature.harden_sls_ijmp)] = .{ | |
| 782 | 782 | .llvm_name = "harden-sls-ijmp", |
| 783 | 783 | .description = "Harden against straight line speculation across indirect JMP instructions.", |
| 784 | 784 | .dependencies = featureSet(&[_]Feature{}), |
| 785 | 785 | }; |
| 786 | result[@intFromEnum(Feature.harden_sls_ret)] = .{ | |
| 786 | result[@backingInt(Feature.harden_sls_ret)] = .{ | |
| 787 | 787 | .llvm_name = "harden-sls-ret", |
| 788 | 788 | .description = "Harden against straight line speculation across RET instructions.", |
| 789 | 789 | .dependencies = featureSet(&[_]Feature{}), |
| 790 | 790 | }; |
| 791 | result[@intFromEnum(Feature.hreset)] = .{ | |
| 791 | result[@backingInt(Feature.hreset)] = .{ | |
| 792 | 792 | .llvm_name = "hreset", |
| 793 | 793 | .description = "Has hreset instruction", |
| 794 | 794 | .dependencies = featureSet(&[_]Feature{}), |
| 795 | 795 | }; |
| 796 | result[@intFromEnum(Feature.idivl_to_divb)] = .{ | |
| 796 | result[@backingInt(Feature.idivl_to_divb)] = .{ | |
| 797 | 797 | .llvm_name = "idivl-to-divb", |
| 798 | 798 | .description = "Use 8-bit divide for positive values less than 256", |
| 799 | 799 | .dependencies = featureSet(&[_]Feature{}), |
| 800 | 800 | }; |
| 801 | result[@intFromEnum(Feature.idivq_to_divl)] = .{ | |
| 801 | result[@backingInt(Feature.idivq_to_divl)] = .{ | |
| 802 | 802 | .llvm_name = "idivq-to-divl", |
| 803 | 803 | .description = "Use 32-bit divide for positive values less than 2^32", |
| 804 | 804 | .dependencies = featureSet(&[_]Feature{}), |
| 805 | 805 | }; |
| 806 | result[@intFromEnum(Feature.inline_asm_use_gpr32)] = .{ | |
| 806 | result[@backingInt(Feature.inline_asm_use_gpr32)] = .{ | |
| 807 | 807 | .llvm_name = "inline-asm-use-gpr32", |
| 808 | 808 | .description = "Enable use of GPR32 in inline assembly for APX", |
| 809 | 809 | .dependencies = featureSet(&[_]Feature{}), |
| 810 | 810 | }; |
| 811 | result[@intFromEnum(Feature.invpcid)] = .{ | |
| 811 | result[@backingInt(Feature.invpcid)] = .{ | |
| 812 | 812 | .llvm_name = "invpcid", |
| 813 | 813 | .description = "Invalidate Process-Context Identifier", |
| 814 | 814 | .dependencies = featureSet(&[_]Feature{}), |
| 815 | 815 | }; |
| 816 | result[@intFromEnum(Feature.kl)] = .{ | |
| 816 | result[@backingInt(Feature.kl)] = .{ | |
| 817 | 817 | .llvm_name = "kl", |
| 818 | 818 | .description = "Support Key Locker kl Instructions", |
| 819 | 819 | .dependencies = featureSet(&[_]Feature{ |
| 820 | 820 | .sse2, |
| 821 | 821 | }), |
| 822 | 822 | }; |
| 823 | result[@intFromEnum(Feature.lea_sp)] = .{ | |
| 823 | result[@backingInt(Feature.lea_sp)] = .{ | |
| 824 | 824 | .llvm_name = "lea-sp", |
| 825 | 825 | .description = "Use LEA for adjusting the stack pointer (this is an optimization for Intel Atom processors)", |
| 826 | 826 | .dependencies = featureSet(&[_]Feature{}), |
| 827 | 827 | }; |
| 828 | result[@intFromEnum(Feature.lea_uses_ag)] = .{ | |
| 828 | result[@backingInt(Feature.lea_uses_ag)] = .{ | |
| 829 | 829 | .llvm_name = "lea-uses-ag", |
| 830 | 830 | .description = "LEA instruction needs inputs at AG stage", |
| 831 | 831 | .dependencies = featureSet(&[_]Feature{}), |
| 832 | 832 | }; |
| 833 | result[@intFromEnum(Feature.lvi_cfi)] = .{ | |
| 833 | result[@backingInt(Feature.lvi_cfi)] = .{ | |
| 834 | 834 | .llvm_name = "lvi-cfi", |
| 835 | 835 | .description = "Prevent indirect calls/branches from using a memory operand, and precede all indirect calls/branches from a register with an LFENCE instruction to serialize control flow. Also decompose RET instructions into a POP+LFENCE+JMP sequence.", |
| 836 | 836 | .dependencies = featureSet(&[_]Feature{}), |
| 837 | 837 | }; |
| 838 | result[@intFromEnum(Feature.lvi_load_hardening)] = .{ | |
| 838 | result[@backingInt(Feature.lvi_load_hardening)] = .{ | |
| 839 | 839 | .llvm_name = "lvi-load-hardening", |
| 840 | 840 | .description = "Insert LFENCE instructions to prevent data speculatively injected into loads from being used maliciously.", |
| 841 | 841 | .dependencies = featureSet(&[_]Feature{}), |
| 842 | 842 | }; |
| 843 | result[@intFromEnum(Feature.lwp)] = .{ | |
| 843 | result[@backingInt(Feature.lwp)] = .{ | |
| 844 | 844 | .llvm_name = "lwp", |
| 845 | 845 | .description = "Enable LWP instructions", |
| 846 | 846 | .dependencies = featureSet(&[_]Feature{}), |
| 847 | 847 | }; |
| 848 | result[@intFromEnum(Feature.lzcnt)] = .{ | |
| 848 | result[@backingInt(Feature.lzcnt)] = .{ | |
| 849 | 849 | .llvm_name = "lzcnt", |
| 850 | 850 | .description = "Support LZCNT instruction", |
| 851 | 851 | .dependencies = featureSet(&[_]Feature{}), |
| 852 | 852 | }; |
| 853 | result[@intFromEnum(Feature.macrofusion)] = .{ | |
| 853 | result[@backingInt(Feature.macrofusion)] = .{ | |
| 854 | 854 | .llvm_name = "macrofusion", |
| 855 | 855 | .description = "Various instructions can be fused with conditional branches", |
| 856 | 856 | .dependencies = featureSet(&[_]Feature{}), |
| 857 | 857 | }; |
| 858 | result[@intFromEnum(Feature.mmx)] = .{ | |
| 858 | result[@backingInt(Feature.mmx)] = .{ | |
| 859 | 859 | .llvm_name = "mmx", |
| 860 | 860 | .description = "Enable MMX instructions", |
| 861 | 861 | .dependencies = featureSet(&[_]Feature{}), |
| 862 | 862 | }; |
| 863 | result[@intFromEnum(Feature.movbe)] = .{ | |
| 863 | result[@backingInt(Feature.movbe)] = .{ | |
| 864 | 864 | .llvm_name = "movbe", |
| 865 | 865 | .description = "Support MOVBE instruction", |
| 866 | 866 | .dependencies = featureSet(&[_]Feature{}), |
| 867 | 867 | }; |
| 868 | result[@intFromEnum(Feature.movdir64b)] = .{ | |
| 868 | result[@backingInt(Feature.movdir64b)] = .{ | |
| 869 | 869 | .llvm_name = "movdir64b", |
| 870 | 870 | .description = "Support movdir64b instruction (direct store 64 bytes)", |
| 871 | 871 | .dependencies = featureSet(&[_]Feature{}), |
| 872 | 872 | }; |
| 873 | result[@intFromEnum(Feature.movdiri)] = .{ | |
| 873 | result[@backingInt(Feature.movdiri)] = .{ | |
| 874 | 874 | .llvm_name = "movdiri", |
| 875 | 875 | .description = "Support movdiri instruction (direct store integer)", |
| 876 | 876 | .dependencies = featureSet(&[_]Feature{}), |
| 877 | 877 | }; |
| 878 | result[@intFromEnum(Feature.movrs)] = .{ | |
| 878 | result[@backingInt(Feature.movrs)] = .{ | |
| 879 | 879 | .llvm_name = "movrs", |
| 880 | 880 | .description = "Enable MOVRS", |
| 881 | 881 | .dependencies = featureSet(&[_]Feature{}), |
| 882 | 882 | }; |
| 883 | result[@intFromEnum(Feature.mwaitx)] = .{ | |
| 883 | result[@backingInt(Feature.mwaitx)] = .{ | |
| 884 | 884 | .llvm_name = "mwaitx", |
| 885 | 885 | .description = "Enable MONITORX/MWAITX timer functionality", |
| 886 | 886 | .dependencies = featureSet(&[_]Feature{}), |
| 887 | 887 | }; |
| 888 | result[@intFromEnum(Feature.ndd)] = .{ | |
| 888 | result[@backingInt(Feature.ndd)] = .{ | |
| 889 | 889 | .llvm_name = "ndd", |
| 890 | 890 | .description = "Support non-destructive destination", |
| 891 | 891 | .dependencies = featureSet(&[_]Feature{}), |
| 892 | 892 | }; |
| 893 | result[@intFromEnum(Feature.nf)] = .{ | |
| 893 | result[@backingInt(Feature.nf)] = .{ | |
| 894 | 894 | .llvm_name = "nf", |
| 895 | 895 | .description = "Support status flags update suppression", |
| 896 | 896 | .dependencies = featureSet(&[_]Feature{}), |
| 897 | 897 | }; |
| 898 | result[@intFromEnum(Feature.no_bypass_delay)] = .{ | |
| 898 | result[@backingInt(Feature.no_bypass_delay)] = .{ | |
| 899 | 899 | .llvm_name = "no-bypass-delay", |
| 900 | 900 | .description = "Has no bypass delay when using the 'wrong' domain", |
| 901 | 901 | .dependencies = featureSet(&[_]Feature{}), |
| 902 | 902 | }; |
| 903 | result[@intFromEnum(Feature.no_bypass_delay_blend)] = .{ | |
| 903 | result[@backingInt(Feature.no_bypass_delay_blend)] = .{ | |
| 904 | 904 | .llvm_name = "no-bypass-delay-blend", |
| 905 | 905 | .description = "Has no bypass delay when using the 'wrong' blend type", |
| 906 | 906 | .dependencies = featureSet(&[_]Feature{}), |
| 907 | 907 | }; |
| 908 | result[@intFromEnum(Feature.no_bypass_delay_mov)] = .{ | |
| 908 | result[@backingInt(Feature.no_bypass_delay_mov)] = .{ | |
| 909 | 909 | .llvm_name = "no-bypass-delay-mov", |
| 910 | 910 | .description = "Has no bypass delay when using the 'wrong' mov type", |
| 911 | 911 | .dependencies = featureSet(&[_]Feature{}), |
| 912 | 912 | }; |
| 913 | result[@intFromEnum(Feature.no_bypass_delay_shuffle)] = .{ | |
| 913 | result[@backingInt(Feature.no_bypass_delay_shuffle)] = .{ | |
| 914 | 914 | .llvm_name = "no-bypass-delay-shuffle", |
| 915 | 915 | .description = "Has no bypass delay when using the 'wrong' shuffle type", |
| 916 | 916 | .dependencies = featureSet(&[_]Feature{}), |
| 917 | 917 | }; |
| 918 | result[@intFromEnum(Feature.nopl)] = .{ | |
| 918 | result[@backingInt(Feature.nopl)] = .{ | |
| 919 | 919 | .llvm_name = "nopl", |
| 920 | 920 | .description = "Enable NOPL instruction (generally pentium pro+)", |
| 921 | 921 | .dependencies = featureSet(&[_]Feature{}), |
| 922 | 922 | }; |
| 923 | result[@intFromEnum(Feature.pad_short_functions)] = .{ | |
| 923 | result[@backingInt(Feature.pad_short_functions)] = .{ | |
| 924 | 924 | .llvm_name = "pad-short-functions", |
| 925 | 925 | .description = "Pad short functions (to prevent a stall when returning too early)", |
| 926 | 926 | .dependencies = featureSet(&[_]Feature{}), |
| 927 | 927 | }; |
| 928 | result[@intFromEnum(Feature.pclmul)] = .{ | |
| 928 | result[@backingInt(Feature.pclmul)] = .{ | |
| 929 | 929 | .llvm_name = "pclmul", |
| 930 | 930 | .description = "Enable packed carry-less multiplication instructions", |
| 931 | 931 | .dependencies = featureSet(&[_]Feature{ |
| 932 | 932 | .sse2, |
| 933 | 933 | }), |
| 934 | 934 | }; |
| 935 | result[@intFromEnum(Feature.pconfig)] = .{ | |
| 935 | result[@backingInt(Feature.pconfig)] = .{ | |
| 936 | 936 | .llvm_name = "pconfig", |
| 937 | 937 | .description = "platform configuration instruction", |
| 938 | 938 | .dependencies = featureSet(&[_]Feature{}), |
| 939 | 939 | }; |
| 940 | result[@intFromEnum(Feature.pku)] = .{ | |
| 940 | result[@backingInt(Feature.pku)] = .{ | |
| 941 | 941 | .llvm_name = "pku", |
| 942 | 942 | .description = "Enable protection keys", |
| 943 | 943 | .dependencies = featureSet(&[_]Feature{}), |
| 944 | 944 | }; |
| 945 | result[@intFromEnum(Feature.popcnt)] = .{ | |
| 945 | result[@backingInt(Feature.popcnt)] = .{ | |
| 946 | 946 | .llvm_name = "popcnt", |
| 947 | 947 | .description = "Support POPCNT instruction", |
| 948 | 948 | .dependencies = featureSet(&[_]Feature{}), |
| 949 | 949 | }; |
| 950 | result[@intFromEnum(Feature.ppx)] = .{ | |
| 950 | result[@backingInt(Feature.ppx)] = .{ | |
| 951 | 951 | .llvm_name = "ppx", |
| 952 | 952 | .description = "Support Push-Pop Acceleration", |
| 953 | 953 | .dependencies = featureSet(&[_]Feature{}), |
| 954 | 954 | }; |
| 955 | result[@intFromEnum(Feature.prefer_128_bit)] = .{ | |
| 955 | result[@backingInt(Feature.prefer_128_bit)] = .{ | |
| 956 | 956 | .llvm_name = "prefer-128-bit", |
| 957 | 957 | .description = "Prefer 128-bit AVX instructions", |
| 958 | 958 | .dependencies = featureSet(&[_]Feature{}), |
| 959 | 959 | }; |
| 960 | result[@intFromEnum(Feature.prefer_256_bit)] = .{ | |
| 960 | result[@backingInt(Feature.prefer_256_bit)] = .{ | |
| 961 | 961 | .llvm_name = "prefer-256-bit", |
| 962 | 962 | .description = "Prefer 256-bit AVX instructions", |
| 963 | 963 | .dependencies = featureSet(&[_]Feature{}), |
| 964 | 964 | }; |
| 965 | result[@intFromEnum(Feature.prefer_legacy_setcc)] = .{ | |
| 965 | result[@backingInt(Feature.prefer_legacy_setcc)] = .{ | |
| 966 | 966 | .llvm_name = "prefer-legacy-setcc", |
| 967 | 967 | .description = "Prefer to emit legacy SetCC.", |
| 968 | 968 | .dependencies = featureSet(&[_]Feature{}), |
| 969 | 969 | }; |
| 970 | result[@intFromEnum(Feature.prefer_mask_registers)] = .{ | |
| 970 | result[@backingInt(Feature.prefer_mask_registers)] = .{ | |
| 971 | 971 | .llvm_name = "prefer-mask-registers", |
| 972 | 972 | .description = "Prefer AVX512 mask registers over PTEST/MOVMSK", |
| 973 | 973 | .dependencies = featureSet(&[_]Feature{}), |
| 974 | 974 | }; |
| 975 | result[@intFromEnum(Feature.prefer_movmsk_over_vtest)] = .{ | |
| 975 | result[@backingInt(Feature.prefer_movmsk_over_vtest)] = .{ | |
| 976 | 976 | .llvm_name = "prefer-movmsk-over-vtest", |
| 977 | 977 | .description = "Prefer movmsk over vtest instruction", |
| 978 | 978 | .dependencies = featureSet(&[_]Feature{}), |
| 979 | 979 | }; |
| 980 | result[@intFromEnum(Feature.prefer_no_gather)] = .{ | |
| 980 | result[@backingInt(Feature.prefer_no_gather)] = .{ | |
| 981 | 981 | .llvm_name = "prefer-no-gather", |
| 982 | 982 | .description = "Prefer no gather instructions", |
| 983 | 983 | .dependencies = featureSet(&[_]Feature{}), |
| 984 | 984 | }; |
| 985 | result[@intFromEnum(Feature.prefer_no_scatter)] = .{ | |
| 985 | result[@backingInt(Feature.prefer_no_scatter)] = .{ | |
| 986 | 986 | .llvm_name = "prefer-no-scatter", |
| 987 | 987 | .description = "Prefer no scatter instructions", |
| 988 | 988 | .dependencies = featureSet(&[_]Feature{}), |
| 989 | 989 | }; |
| 990 | result[@intFromEnum(Feature.prefetchi)] = .{ | |
| 990 | result[@backingInt(Feature.prefetchi)] = .{ | |
| 991 | 991 | .llvm_name = "prefetchi", |
| 992 | 992 | .description = "Prefetch instruction with T0 or T1 Hint", |
| 993 | 993 | .dependencies = featureSet(&[_]Feature{}), |
| 994 | 994 | }; |
| 995 | result[@intFromEnum(Feature.prefetchwt1)] = .{ | |
| 995 | result[@backingInt(Feature.prefetchwt1)] = .{ | |
| 996 | 996 | .llvm_name = null, |
| 997 | 997 | .description = "Prefetch with Intent to Write and T1 Hint", |
| 998 | 998 | .dependencies = featureSet(&[_]Feature{}), |
| 999 | 999 | }; |
| 1000 | result[@intFromEnum(Feature.prfchw)] = .{ | |
| 1000 | result[@backingInt(Feature.prfchw)] = .{ | |
| 1001 | 1001 | .llvm_name = "prfchw", |
| 1002 | 1002 | .description = "Support PRFCHW instructions", |
| 1003 | 1003 | .dependencies = featureSet(&[_]Feature{}), |
| 1004 | 1004 | }; |
| 1005 | result[@intFromEnum(Feature.ptwrite)] = .{ | |
| 1005 | result[@backingInt(Feature.ptwrite)] = .{ | |
| 1006 | 1006 | .llvm_name = "ptwrite", |
| 1007 | 1007 | .description = "Support ptwrite instruction", |
| 1008 | 1008 | .dependencies = featureSet(&[_]Feature{}), |
| 1009 | 1009 | }; |
| 1010 | result[@intFromEnum(Feature.push2pop2)] = .{ | |
| 1010 | result[@backingInt(Feature.push2pop2)] = .{ | |
| 1011 | 1011 | .llvm_name = "push2pop2", |
| 1012 | 1012 | .description = "Support PUSH2/POP2 instructions", |
| 1013 | 1013 | .dependencies = featureSet(&[_]Feature{}), |
| 1014 | 1014 | }; |
| 1015 | result[@intFromEnum(Feature.raoint)] = .{ | |
| 1015 | result[@backingInt(Feature.raoint)] = .{ | |
| 1016 | 1016 | .llvm_name = "raoint", |
| 1017 | 1017 | .description = "Support RAO-INT instructions", |
| 1018 | 1018 | .dependencies = featureSet(&[_]Feature{}), |
| 1019 | 1019 | }; |
| 1020 | result[@intFromEnum(Feature.rdpid)] = .{ | |
| 1020 | result[@backingInt(Feature.rdpid)] = .{ | |
| 1021 | 1021 | .llvm_name = "rdpid", |
| 1022 | 1022 | .description = "Support RDPID instructions", |
| 1023 | 1023 | .dependencies = featureSet(&[_]Feature{}), |
| 1024 | 1024 | }; |
| 1025 | result[@intFromEnum(Feature.rdpru)] = .{ | |
| 1025 | result[@backingInt(Feature.rdpru)] = .{ | |
| 1026 | 1026 | .llvm_name = "rdpru", |
| 1027 | 1027 | .description = "Support RDPRU instructions", |
| 1028 | 1028 | .dependencies = featureSet(&[_]Feature{}), |
| 1029 | 1029 | }; |
| 1030 | result[@intFromEnum(Feature.rdrnd)] = .{ | |
| 1030 | result[@backingInt(Feature.rdrnd)] = .{ | |
| 1031 | 1031 | .llvm_name = "rdrnd", |
| 1032 | 1032 | .description = "Support RDRAND instruction", |
| 1033 | 1033 | .dependencies = featureSet(&[_]Feature{}), |
| 1034 | 1034 | }; |
| 1035 | result[@intFromEnum(Feature.rdseed)] = .{ | |
| 1035 | result[@backingInt(Feature.rdseed)] = .{ | |
| 1036 | 1036 | .llvm_name = "rdseed", |
| 1037 | 1037 | .description = "Support RDSEED instruction", |
| 1038 | 1038 | .dependencies = featureSet(&[_]Feature{}), |
| 1039 | 1039 | }; |
| 1040 | result[@intFromEnum(Feature.retpoline)] = .{ | |
| 1040 | result[@backingInt(Feature.retpoline)] = .{ | |
| 1041 | 1041 | .llvm_name = "retpoline", |
| 1042 | 1042 | .description = "Remove speculation of indirect branches from the generated code, either by avoiding them entirely or lowering them with a speculation blocking construct", |
| 1043 | 1043 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1045,180 +1045,180 @@ pub const all_features = blk: { |
| 1045 | 1045 | .retpoline_indirect_calls, |
| 1046 | 1046 | }), |
| 1047 | 1047 | }; |
| 1048 | result[@intFromEnum(Feature.retpoline_external_thunk)] = .{ | |
| 1048 | result[@backingInt(Feature.retpoline_external_thunk)] = .{ | |
| 1049 | 1049 | .llvm_name = "retpoline-external-thunk", |
| 1050 | 1050 | .description = "When lowering an indirect call or branch using a `retpoline`, rely on the specified user provided thunk rather than emitting one ourselves. Only has effect when combined with some other retpoline feature", |
| 1051 | 1051 | .dependencies = featureSet(&[_]Feature{ |
| 1052 | 1052 | .retpoline_indirect_calls, |
| 1053 | 1053 | }), |
| 1054 | 1054 | }; |
| 1055 | result[@intFromEnum(Feature.retpoline_indirect_branches)] = .{ | |
| 1055 | result[@backingInt(Feature.retpoline_indirect_branches)] = .{ | |
| 1056 | 1056 | .llvm_name = "retpoline-indirect-branches", |
| 1057 | 1057 | .description = "Remove speculation of indirect branches from the generated code", |
| 1058 | 1058 | .dependencies = featureSet(&[_]Feature{}), |
| 1059 | 1059 | }; |
| 1060 | result[@intFromEnum(Feature.retpoline_indirect_calls)] = .{ | |
| 1060 | result[@backingInt(Feature.retpoline_indirect_calls)] = .{ | |
| 1061 | 1061 | .llvm_name = "retpoline-indirect-calls", |
| 1062 | 1062 | .description = "Remove speculation of indirect calls from the generated code", |
| 1063 | 1063 | .dependencies = featureSet(&[_]Feature{}), |
| 1064 | 1064 | }; |
| 1065 | result[@intFromEnum(Feature.rtm)] = .{ | |
| 1065 | result[@backingInt(Feature.rtm)] = .{ | |
| 1066 | 1066 | .llvm_name = "rtm", |
| 1067 | 1067 | .description = "Support RTM instructions", |
| 1068 | 1068 | .dependencies = featureSet(&[_]Feature{}), |
| 1069 | 1069 | }; |
| 1070 | result[@intFromEnum(Feature.sahf)] = .{ | |
| 1070 | result[@backingInt(Feature.sahf)] = .{ | |
| 1071 | 1071 | .llvm_name = "sahf", |
| 1072 | 1072 | .description = "Support LAHF and SAHF instructions in 64-bit mode", |
| 1073 | 1073 | .dependencies = featureSet(&[_]Feature{}), |
| 1074 | 1074 | }; |
| 1075 | result[@intFromEnum(Feature.sbb_dep_breaking)] = .{ | |
| 1075 | result[@backingInt(Feature.sbb_dep_breaking)] = .{ | |
| 1076 | 1076 | .llvm_name = "sbb-dep-breaking", |
| 1077 | 1077 | .description = "SBB with same register has no source dependency", |
| 1078 | 1078 | .dependencies = featureSet(&[_]Feature{}), |
| 1079 | 1079 | }; |
| 1080 | result[@intFromEnum(Feature.serialize)] = .{ | |
| 1080 | result[@backingInt(Feature.serialize)] = .{ | |
| 1081 | 1081 | .llvm_name = "serialize", |
| 1082 | 1082 | .description = "Has serialize instruction", |
| 1083 | 1083 | .dependencies = featureSet(&[_]Feature{}), |
| 1084 | 1084 | }; |
| 1085 | result[@intFromEnum(Feature.seses)] = .{ | |
| 1085 | result[@backingInt(Feature.seses)] = .{ | |
| 1086 | 1086 | .llvm_name = "seses", |
| 1087 | 1087 | .description = "Prevent speculative execution side channel timing attacks by inserting a speculation barrier before memory reads, memory writes, and conditional branches. Implies LVI Control Flow integrity.", |
| 1088 | 1088 | .dependencies = featureSet(&[_]Feature{ |
| 1089 | 1089 | .lvi_cfi, |
| 1090 | 1090 | }), |
| 1091 | 1091 | }; |
| 1092 | result[@intFromEnum(Feature.sgx)] = .{ | |
| 1092 | result[@backingInt(Feature.sgx)] = .{ | |
| 1093 | 1093 | .llvm_name = "sgx", |
| 1094 | 1094 | .description = "Enable Software Guard Extensions", |
| 1095 | 1095 | .dependencies = featureSet(&[_]Feature{}), |
| 1096 | 1096 | }; |
| 1097 | result[@intFromEnum(Feature.sha)] = .{ | |
| 1097 | result[@backingInt(Feature.sha)] = .{ | |
| 1098 | 1098 | .llvm_name = "sha", |
| 1099 | 1099 | .description = "Enable SHA instructions", |
| 1100 | 1100 | .dependencies = featureSet(&[_]Feature{ |
| 1101 | 1101 | .sse2, |
| 1102 | 1102 | }), |
| 1103 | 1103 | }; |
| 1104 | result[@intFromEnum(Feature.sha512)] = .{ | |
| 1104 | result[@backingInt(Feature.sha512)] = .{ | |
| 1105 | 1105 | .llvm_name = "sha512", |
| 1106 | 1106 | .description = "Support SHA512 instructions", |
| 1107 | 1107 | .dependencies = featureSet(&[_]Feature{ |
| 1108 | 1108 | .avx2, |
| 1109 | 1109 | }), |
| 1110 | 1110 | }; |
| 1111 | result[@intFromEnum(Feature.shstk)] = .{ | |
| 1111 | result[@backingInt(Feature.shstk)] = .{ | |
| 1112 | 1112 | .llvm_name = "shstk", |
| 1113 | 1113 | .description = "Support CET Shadow-Stack instructions", |
| 1114 | 1114 | .dependencies = featureSet(&[_]Feature{}), |
| 1115 | 1115 | }; |
| 1116 | result[@intFromEnum(Feature.slow_3ops_lea)] = .{ | |
| 1116 | result[@backingInt(Feature.slow_3ops_lea)] = .{ | |
| 1117 | 1117 | .llvm_name = "slow-3ops-lea", |
| 1118 | 1118 | .description = "LEA instruction with 3 ops or certain registers is slow", |
| 1119 | 1119 | .dependencies = featureSet(&[_]Feature{}), |
| 1120 | 1120 | }; |
| 1121 | result[@intFromEnum(Feature.slow_incdec)] = .{ | |
| 1121 | result[@backingInt(Feature.slow_incdec)] = .{ | |
| 1122 | 1122 | .llvm_name = "slow-incdec", |
| 1123 | 1123 | .description = "INC and DEC instructions are slower than ADD and SUB", |
| 1124 | 1124 | .dependencies = featureSet(&[_]Feature{}), |
| 1125 | 1125 | }; |
| 1126 | result[@intFromEnum(Feature.slow_lea)] = .{ | |
| 1126 | result[@backingInt(Feature.slow_lea)] = .{ | |
| 1127 | 1127 | .llvm_name = "slow-lea", |
| 1128 | 1128 | .description = "LEA instruction with certain arguments is slow", |
| 1129 | 1129 | .dependencies = featureSet(&[_]Feature{}), |
| 1130 | 1130 | }; |
| 1131 | result[@intFromEnum(Feature.slow_pmaddwd)] = .{ | |
| 1131 | result[@backingInt(Feature.slow_pmaddwd)] = .{ | |
| 1132 | 1132 | .llvm_name = "slow-pmaddwd", |
| 1133 | 1133 | .description = "PMADDWD is slower than PMULLD", |
| 1134 | 1134 | .dependencies = featureSet(&[_]Feature{}), |
| 1135 | 1135 | }; |
| 1136 | result[@intFromEnum(Feature.slow_pmulld)] = .{ | |
| 1136 | result[@backingInt(Feature.slow_pmulld)] = .{ | |
| 1137 | 1137 | .llvm_name = "slow-pmulld", |
| 1138 | 1138 | .description = "PMULLD instruction is slow (compared to PMULLW/PMULHW and PMULUDQ)", |
| 1139 | 1139 | .dependencies = featureSet(&[_]Feature{}), |
| 1140 | 1140 | }; |
| 1141 | result[@intFromEnum(Feature.slow_pmullq)] = .{ | |
| 1141 | result[@backingInt(Feature.slow_pmullq)] = .{ | |
| 1142 | 1142 | .llvm_name = "slow-pmullq", |
| 1143 | 1143 | .description = "PMULLQ instruction is slow", |
| 1144 | 1144 | .dependencies = featureSet(&[_]Feature{}), |
| 1145 | 1145 | }; |
| 1146 | result[@intFromEnum(Feature.slow_shld)] = .{ | |
| 1146 | result[@backingInt(Feature.slow_shld)] = .{ | |
| 1147 | 1147 | .llvm_name = "slow-shld", |
| 1148 | 1148 | .description = "SHLD instruction is slow", |
| 1149 | 1149 | .dependencies = featureSet(&[_]Feature{}), |
| 1150 | 1150 | }; |
| 1151 | result[@intFromEnum(Feature.slow_two_mem_ops)] = .{ | |
| 1151 | result[@backingInt(Feature.slow_two_mem_ops)] = .{ | |
| 1152 | 1152 | .llvm_name = "slow-two-mem-ops", |
| 1153 | 1153 | .description = "Two memory operand instructions are slow", |
| 1154 | 1154 | .dependencies = featureSet(&[_]Feature{}), |
| 1155 | 1155 | }; |
| 1156 | result[@intFromEnum(Feature.slow_unaligned_mem_16)] = .{ | |
| 1156 | result[@backingInt(Feature.slow_unaligned_mem_16)] = .{ | |
| 1157 | 1157 | .llvm_name = "slow-unaligned-mem-16", |
| 1158 | 1158 | .description = "Slow unaligned 16-byte memory access", |
| 1159 | 1159 | .dependencies = featureSet(&[_]Feature{}), |
| 1160 | 1160 | }; |
| 1161 | result[@intFromEnum(Feature.slow_unaligned_mem_32)] = .{ | |
| 1161 | result[@backingInt(Feature.slow_unaligned_mem_32)] = .{ | |
| 1162 | 1162 | .llvm_name = "slow-unaligned-mem-32", |
| 1163 | 1163 | .description = "Slow unaligned 32-byte memory access", |
| 1164 | 1164 | .dependencies = featureSet(&[_]Feature{}), |
| 1165 | 1165 | }; |
| 1166 | result[@intFromEnum(Feature.sm3)] = .{ | |
| 1166 | result[@backingInt(Feature.sm3)] = .{ | |
| 1167 | 1167 | .llvm_name = "sm3", |
| 1168 | 1168 | .description = "Support SM3 instructions", |
| 1169 | 1169 | .dependencies = featureSet(&[_]Feature{ |
| 1170 | 1170 | .avx, |
| 1171 | 1171 | }), |
| 1172 | 1172 | }; |
| 1173 | result[@intFromEnum(Feature.sm4)] = .{ | |
| 1173 | result[@backingInt(Feature.sm4)] = .{ | |
| 1174 | 1174 | .llvm_name = "sm4", |
| 1175 | 1175 | .description = "Support SM4 instructions", |
| 1176 | 1176 | .dependencies = featureSet(&[_]Feature{ |
| 1177 | 1177 | .avx2, |
| 1178 | 1178 | }), |
| 1179 | 1179 | }; |
| 1180 | result[@intFromEnum(Feature.smap)] = .{ | |
| 1180 | result[@backingInt(Feature.smap)] = .{ | |
| 1181 | 1181 | .llvm_name = null, |
| 1182 | 1182 | .description = "Enable Supervisor Mode Access Prevention", |
| 1183 | 1183 | .dependencies = featureSet(&[_]Feature{}), |
| 1184 | 1184 | }; |
| 1185 | result[@intFromEnum(Feature.smep)] = .{ | |
| 1185 | result[@backingInt(Feature.smep)] = .{ | |
| 1186 | 1186 | .llvm_name = null, |
| 1187 | 1187 | .description = "Enable Supervisor Mode Execution Prevention", |
| 1188 | 1188 | .dependencies = featureSet(&[_]Feature{}), |
| 1189 | 1189 | }; |
| 1190 | result[@intFromEnum(Feature.soft_float)] = .{ | |
| 1190 | result[@backingInt(Feature.soft_float)] = .{ | |
| 1191 | 1191 | .llvm_name = "soft-float", |
| 1192 | 1192 | .description = "Use software floating point features", |
| 1193 | 1193 | .dependencies = featureSet(&[_]Feature{}), |
| 1194 | 1194 | }; |
| 1195 | result[@intFromEnum(Feature.sse)] = .{ | |
| 1195 | result[@backingInt(Feature.sse)] = .{ | |
| 1196 | 1196 | .llvm_name = "sse", |
| 1197 | 1197 | .description = "Enable SSE instructions", |
| 1198 | 1198 | .dependencies = featureSet(&[_]Feature{}), |
| 1199 | 1199 | }; |
| 1200 | result[@intFromEnum(Feature.sse2)] = .{ | |
| 1200 | result[@backingInt(Feature.sse2)] = .{ | |
| 1201 | 1201 | .llvm_name = "sse2", |
| 1202 | 1202 | .description = "Enable SSE2 instructions", |
| 1203 | 1203 | .dependencies = featureSet(&[_]Feature{ |
| 1204 | 1204 | .sse, |
| 1205 | 1205 | }), |
| 1206 | 1206 | }; |
| 1207 | result[@intFromEnum(Feature.sse3)] = .{ | |
| 1207 | result[@backingInt(Feature.sse3)] = .{ | |
| 1208 | 1208 | .llvm_name = "sse3", |
| 1209 | 1209 | .description = "Enable SSE3 instructions", |
| 1210 | 1210 | .dependencies = featureSet(&[_]Feature{ |
| 1211 | 1211 | .sse2, |
| 1212 | 1212 | }), |
| 1213 | 1213 | }; |
| 1214 | result[@intFromEnum(Feature.sse4_1)] = .{ | |
| 1214 | result[@backingInt(Feature.sse4_1)] = .{ | |
| 1215 | 1215 | .llvm_name = "sse4.1", |
| 1216 | 1216 | .description = "Enable SSE 4.1 instructions", |
| 1217 | 1217 | .dependencies = featureSet(&[_]Feature{ |
| 1218 | 1218 | .ssse3, |
| 1219 | 1219 | }), |
| 1220 | 1220 | }; |
| 1221 | result[@intFromEnum(Feature.sse4_2)] = .{ | |
| 1221 | result[@backingInt(Feature.sse4_2)] = .{ | |
| 1222 | 1222 | .llvm_name = "sse4.2", |
| 1223 | 1223 | .description = "Enable SSE 4.2 instructions", |
| 1224 | 1224 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1226,66 +1226,66 @@ pub const all_features = blk: { |
| 1226 | 1226 | .sse4_1, |
| 1227 | 1227 | }), |
| 1228 | 1228 | }; |
| 1229 | result[@intFromEnum(Feature.sse4a)] = .{ | |
| 1229 | result[@backingInt(Feature.sse4a)] = .{ | |
| 1230 | 1230 | .llvm_name = "sse4a", |
| 1231 | 1231 | .description = "Support SSE 4a instructions", |
| 1232 | 1232 | .dependencies = featureSet(&[_]Feature{ |
| 1233 | 1233 | .sse3, |
| 1234 | 1234 | }), |
| 1235 | 1235 | }; |
| 1236 | result[@intFromEnum(Feature.sse_unaligned_mem)] = .{ | |
| 1236 | result[@backingInt(Feature.sse_unaligned_mem)] = .{ | |
| 1237 | 1237 | .llvm_name = "sse-unaligned-mem", |
| 1238 | 1238 | .description = "Allow unaligned memory operands with SSE instructions (this may require setting a configuration bit in the processor)", |
| 1239 | 1239 | .dependencies = featureSet(&[_]Feature{}), |
| 1240 | 1240 | }; |
| 1241 | result[@intFromEnum(Feature.ssse3)] = .{ | |
| 1241 | result[@backingInt(Feature.ssse3)] = .{ | |
| 1242 | 1242 | .llvm_name = "ssse3", |
| 1243 | 1243 | .description = "Enable SSSE3 instructions", |
| 1244 | 1244 | .dependencies = featureSet(&[_]Feature{ |
| 1245 | 1245 | .sse3, |
| 1246 | 1246 | }), |
| 1247 | 1247 | }; |
| 1248 | result[@intFromEnum(Feature.tagged_globals)] = .{ | |
| 1248 | result[@backingInt(Feature.tagged_globals)] = .{ | |
| 1249 | 1249 | .llvm_name = "tagged-globals", |
| 1250 | 1250 | .description = "Use an instruction sequence for taking the address of a global that allows a memory tag in the upper address bits.", |
| 1251 | 1251 | .dependencies = featureSet(&[_]Feature{}), |
| 1252 | 1252 | }; |
| 1253 | result[@intFromEnum(Feature.tbm)] = .{ | |
| 1253 | result[@backingInt(Feature.tbm)] = .{ | |
| 1254 | 1254 | .llvm_name = "tbm", |
| 1255 | 1255 | .description = "Enable TBM instructions", |
| 1256 | 1256 | .dependencies = featureSet(&[_]Feature{}), |
| 1257 | 1257 | }; |
| 1258 | result[@intFromEnum(Feature.tsxldtrk)] = .{ | |
| 1258 | result[@backingInt(Feature.tsxldtrk)] = .{ | |
| 1259 | 1259 | .llvm_name = "tsxldtrk", |
| 1260 | 1260 | .description = "Support TSXLDTRK instructions", |
| 1261 | 1261 | .dependencies = featureSet(&[_]Feature{}), |
| 1262 | 1262 | }; |
| 1263 | result[@intFromEnum(Feature.tuning_fast_imm_vector_shift)] = .{ | |
| 1263 | result[@backingInt(Feature.tuning_fast_imm_vector_shift)] = .{ | |
| 1264 | 1264 | .llvm_name = "tuning-fast-imm-vector-shift", |
| 1265 | 1265 | .description = "Vector shifts are fast (2/cycle) as opposed to slow (1/cycle)", |
| 1266 | 1266 | .dependencies = featureSet(&[_]Feature{}), |
| 1267 | 1267 | }; |
| 1268 | result[@intFromEnum(Feature.uintr)] = .{ | |
| 1268 | result[@backingInt(Feature.uintr)] = .{ | |
| 1269 | 1269 | .llvm_name = "uintr", |
| 1270 | 1270 | .description = "Has UINTR Instructions", |
| 1271 | 1271 | .dependencies = featureSet(&[_]Feature{}), |
| 1272 | 1272 | }; |
| 1273 | result[@intFromEnum(Feature.use_glm_div_sqrt_costs)] = .{ | |
| 1273 | result[@backingInt(Feature.use_glm_div_sqrt_costs)] = .{ | |
| 1274 | 1274 | .llvm_name = "use-glm-div-sqrt-costs", |
| 1275 | 1275 | .description = "Use Goldmont specific floating point div/sqrt costs", |
| 1276 | 1276 | .dependencies = featureSet(&[_]Feature{}), |
| 1277 | 1277 | }; |
| 1278 | result[@intFromEnum(Feature.use_slm_arith_costs)] = .{ | |
| 1278 | result[@backingInt(Feature.use_slm_arith_costs)] = .{ | |
| 1279 | 1279 | .llvm_name = "use-slm-arith-costs", |
| 1280 | 1280 | .description = "Use Silvermont specific arithmetic costs", |
| 1281 | 1281 | .dependencies = featureSet(&[_]Feature{}), |
| 1282 | 1282 | }; |
| 1283 | result[@intFromEnum(Feature.usermsr)] = .{ | |
| 1283 | result[@backingInt(Feature.usermsr)] = .{ | |
| 1284 | 1284 | .llvm_name = "usermsr", |
| 1285 | 1285 | .description = "Support USERMSR instructions", |
| 1286 | 1286 | .dependencies = featureSet(&[_]Feature{}), |
| 1287 | 1287 | }; |
| 1288 | result[@intFromEnum(Feature.vaes)] = .{ | |
| 1288 | result[@backingInt(Feature.vaes)] = .{ | |
| 1289 | 1289 | .llvm_name = "vaes", |
| 1290 | 1290 | .description = "Promote selected AES instructions to AVX512/AVX registers", |
| 1291 | 1291 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1293,7 +1293,7 @@ pub const all_features = blk: { |
| 1293 | 1293 | .avx2, |
| 1294 | 1294 | }), |
| 1295 | 1295 | }; |
| 1296 | result[@intFromEnum(Feature.vpclmulqdq)] = .{ | |
| 1296 | result[@backingInt(Feature.vpclmulqdq)] = .{ | |
| 1297 | 1297 | .llvm_name = "vpclmulqdq", |
| 1298 | 1298 | .description = "Enable vpclmulqdq instructions", |
| 1299 | 1299 | .dependencies = featureSet(&[_]Feature{ |
| ... | ... | @@ -1301,72 +1301,72 @@ pub const all_features = blk: { |
| 1301 | 1301 | .pclmul, |
| 1302 | 1302 | }), |
| 1303 | 1303 | }; |
| 1304 | result[@intFromEnum(Feature.vzeroupper)] = .{ | |
| 1304 | result[@backingInt(Feature.vzeroupper)] = .{ | |
| 1305 | 1305 | .llvm_name = "vzeroupper", |
| 1306 | 1306 | .description = "Should insert vzeroupper instructions", |
| 1307 | 1307 | .dependencies = featureSet(&[_]Feature{}), |
| 1308 | 1308 | }; |
| 1309 | result[@intFromEnum(Feature.waitpkg)] = .{ | |
| 1309 | result[@backingInt(Feature.waitpkg)] = .{ | |
| 1310 | 1310 | .llvm_name = "waitpkg", |
| 1311 | 1311 | .description = "Wait and pause enhancements", |
| 1312 | 1312 | .dependencies = featureSet(&[_]Feature{}), |
| 1313 | 1313 | }; |
| 1314 | result[@intFromEnum(Feature.wbnoinvd)] = .{ | |
| 1314 | result[@backingInt(Feature.wbnoinvd)] = .{ | |
| 1315 | 1315 | .llvm_name = "wbnoinvd", |
| 1316 | 1316 | .description = "Write Back No Invalidate", |
| 1317 | 1317 | .dependencies = featureSet(&[_]Feature{}), |
| 1318 | 1318 | }; |
| 1319 | result[@intFromEnum(Feature.widekl)] = .{ | |
| 1319 | result[@backingInt(Feature.widekl)] = .{ | |
| 1320 | 1320 | .llvm_name = "widekl", |
| 1321 | 1321 | .description = "Support Key Locker wide Instructions", |
| 1322 | 1322 | .dependencies = featureSet(&[_]Feature{ |
| 1323 | 1323 | .kl, |
| 1324 | 1324 | }), |
| 1325 | 1325 | }; |
| 1326 | result[@intFromEnum(Feature.x32)] = .{ | |
| 1326 | result[@backingInt(Feature.x32)] = .{ | |
| 1327 | 1327 | .llvm_name = "x32", |
| 1328 | 1328 | .description = "64-bit with ILP32 programming model (e.g. x32 ABI)", |
| 1329 | 1329 | .dependencies = featureSet(&[_]Feature{}), |
| 1330 | 1330 | }; |
| 1331 | result[@intFromEnum(Feature.x87)] = .{ | |
| 1331 | result[@backingInt(Feature.x87)] = .{ | |
| 1332 | 1332 | .llvm_name = "x87", |
| 1333 | 1333 | .description = "Enable X87 float instructions", |
| 1334 | 1334 | .dependencies = featureSet(&[_]Feature{}), |
| 1335 | 1335 | }; |
| 1336 | result[@intFromEnum(Feature.xop)] = .{ | |
| 1336 | result[@backingInt(Feature.xop)] = .{ | |
| 1337 | 1337 | .llvm_name = "xop", |
| 1338 | 1338 | .description = "Enable XOP instructions", |
| 1339 | 1339 | .dependencies = featureSet(&[_]Feature{ |
| 1340 | 1340 | .fma4, |
| 1341 | 1341 | }), |
| 1342 | 1342 | }; |
| 1343 | result[@intFromEnum(Feature.xsave)] = .{ | |
| 1343 | result[@backingInt(Feature.xsave)] = .{ | |
| 1344 | 1344 | .llvm_name = "xsave", |
| 1345 | 1345 | .description = "Support xsave instructions", |
| 1346 | 1346 | .dependencies = featureSet(&[_]Feature{}), |
| 1347 | 1347 | }; |
| 1348 | result[@intFromEnum(Feature.xsavec)] = .{ | |
| 1348 | result[@backingInt(Feature.xsavec)] = .{ | |
| 1349 | 1349 | .llvm_name = "xsavec", |
| 1350 | 1350 | .description = "Support xsavec instructions", |
| 1351 | 1351 | .dependencies = featureSet(&[_]Feature{ |
| 1352 | 1352 | .xsave, |
| 1353 | 1353 | }), |
| 1354 | 1354 | }; |
| 1355 | result[@intFromEnum(Feature.xsaveopt)] = .{ | |
| 1355 | result[@backingInt(Feature.xsaveopt)] = .{ | |
| 1356 | 1356 | .llvm_name = "xsaveopt", |
| 1357 | 1357 | .description = "Support xsaveopt instructions", |
| 1358 | 1358 | .dependencies = featureSet(&[_]Feature{ |
| 1359 | 1359 | .xsave, |
| 1360 | 1360 | }), |
| 1361 | 1361 | }; |
| 1362 | result[@intFromEnum(Feature.xsaves)] = .{ | |
| 1362 | result[@backingInt(Feature.xsaves)] = .{ | |
| 1363 | 1363 | .llvm_name = "xsaves", |
| 1364 | 1364 | .description = "Support xsaves instructions", |
| 1365 | 1365 | .dependencies = featureSet(&[_]Feature{ |
| 1366 | 1366 | .xsave, |
| 1367 | 1367 | }), |
| 1368 | 1368 | }; |
| 1369 | result[@intFromEnum(Feature.zu)] = .{ | |
| 1369 | result[@backingInt(Feature.zu)] = .{ | |
| 1370 | 1370 | .llvm_name = "zu", |
| 1371 | 1371 | .description = "Support zero-upper SETcc/IMUL", |
| 1372 | 1372 | .dependencies = featureSet(&[_]Feature{}), |
lib/std/Target/xtensa.zig+37-37| ... | ... | @@ -53,197 +53,197 @@ pub const all_features = blk: { |
| 53 | 53 | const len = @typeInfo(Feature).@"enum".field_names.len; |
| 54 | 54 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); |
| 55 | 55 | var result: [len]CpuFeature = undefined; |
| 56 | result[@intFromEnum(Feature.bool)] = .{ | |
| 56 | result[@backingInt(Feature.bool)] = .{ | |
| 57 | 57 | .llvm_name = "bool", |
| 58 | 58 | .description = "Enable Xtensa Boolean extension", |
| 59 | 59 | .dependencies = featureSet(&[_]Feature{}), |
| 60 | 60 | }; |
| 61 | result[@intFromEnum(Feature.clamps)] = .{ | |
| 61 | result[@backingInt(Feature.clamps)] = .{ | |
| 62 | 62 | .llvm_name = "clamps", |
| 63 | 63 | .description = "Enable Xtensa CLAMPS option", |
| 64 | 64 | .dependencies = featureSet(&[_]Feature{}), |
| 65 | 65 | }; |
| 66 | result[@intFromEnum(Feature.coprocessor)] = .{ | |
| 66 | result[@backingInt(Feature.coprocessor)] = .{ | |
| 67 | 67 | .llvm_name = "coprocessor", |
| 68 | 68 | .description = "Enable Xtensa Coprocessor option", |
| 69 | 69 | .dependencies = featureSet(&[_]Feature{}), |
| 70 | 70 | }; |
| 71 | result[@intFromEnum(Feature.dcache)] = .{ | |
| 71 | result[@backingInt(Feature.dcache)] = .{ | |
| 72 | 72 | .llvm_name = "dcache", |
| 73 | 73 | .description = "Enable Xtensa Data Cache option", |
| 74 | 74 | .dependencies = featureSet(&[_]Feature{}), |
| 75 | 75 | }; |
| 76 | result[@intFromEnum(Feature.debug)] = .{ | |
| 76 | result[@backingInt(Feature.debug)] = .{ | |
| 77 | 77 | .llvm_name = "debug", |
| 78 | 78 | .description = "Enable Xtensa Debug option", |
| 79 | 79 | .dependencies = featureSet(&[_]Feature{}), |
| 80 | 80 | }; |
| 81 | result[@intFromEnum(Feature.density)] = .{ | |
| 81 | result[@backingInt(Feature.density)] = .{ | |
| 82 | 82 | .llvm_name = "density", |
| 83 | 83 | .description = "Enable Density instructions", |
| 84 | 84 | .dependencies = featureSet(&[_]Feature{}), |
| 85 | 85 | }; |
| 86 | result[@intFromEnum(Feature.dfpaccel)] = .{ | |
| 86 | result[@backingInt(Feature.dfpaccel)] = .{ | |
| 87 | 87 | .llvm_name = "dfpaccel", |
| 88 | 88 | .description = "Enable Xtensa Double Precision FP acceleration", |
| 89 | 89 | .dependencies = featureSet(&[_]Feature{}), |
| 90 | 90 | }; |
| 91 | result[@intFromEnum(Feature.div32)] = .{ | |
| 91 | result[@backingInt(Feature.div32)] = .{ | |
| 92 | 92 | .llvm_name = "div32", |
| 93 | 93 | .description = "Enable Xtensa Div32 option", |
| 94 | 94 | .dependencies = featureSet(&[_]Feature{}), |
| 95 | 95 | }; |
| 96 | result[@intFromEnum(Feature.exception)] = .{ | |
| 96 | result[@backingInt(Feature.exception)] = .{ | |
| 97 | 97 | .llvm_name = "exception", |
| 98 | 98 | .description = "Enable Xtensa Exception option", |
| 99 | 99 | .dependencies = featureSet(&[_]Feature{}), |
| 100 | 100 | }; |
| 101 | result[@intFromEnum(Feature.extendedl32r)] = .{ | |
| 101 | result[@backingInt(Feature.extendedl32r)] = .{ | |
| 102 | 102 | .llvm_name = "extendedl32r", |
| 103 | 103 | .description = "Enable Xtensa Extended L32R option", |
| 104 | 104 | .dependencies = featureSet(&[_]Feature{}), |
| 105 | 105 | }; |
| 106 | result[@intFromEnum(Feature.forced_atomics)] = .{ | |
| 106 | result[@backingInt(Feature.forced_atomics)] = .{ | |
| 107 | 107 | .llvm_name = "forced-atomics", |
| 108 | 108 | .description = "Assume that lock-free native-width atomics are available", |
| 109 | 109 | .dependencies = featureSet(&[_]Feature{}), |
| 110 | 110 | }; |
| 111 | result[@intFromEnum(Feature.fp)] = .{ | |
| 111 | result[@backingInt(Feature.fp)] = .{ | |
| 112 | 112 | .llvm_name = "fp", |
| 113 | 113 | .description = "Enable Xtensa Single FP instructions", |
| 114 | 114 | .dependencies = featureSet(&[_]Feature{}), |
| 115 | 115 | }; |
| 116 | result[@intFromEnum(Feature.highpriinterrupts)] = .{ | |
| 116 | result[@backingInt(Feature.highpriinterrupts)] = .{ | |
| 117 | 117 | .llvm_name = "highpriinterrupts", |
| 118 | 118 | .description = "Enable Xtensa HighPriInterrupts option", |
| 119 | 119 | .dependencies = featureSet(&[_]Feature{}), |
| 120 | 120 | }; |
| 121 | result[@intFromEnum(Feature.highpriinterrupts_level3)] = .{ | |
| 121 | result[@backingInt(Feature.highpriinterrupts_level3)] = .{ | |
| 122 | 122 | .llvm_name = "highpriinterrupts-level3", |
| 123 | 123 | .description = "Enable Xtensa HighPriInterrupts Level3", |
| 124 | 124 | .dependencies = featureSet(&[_]Feature{ |
| 125 | 125 | .highpriinterrupts, |
| 126 | 126 | }), |
| 127 | 127 | }; |
| 128 | result[@intFromEnum(Feature.highpriinterrupts_level4)] = .{ | |
| 128 | result[@backingInt(Feature.highpriinterrupts_level4)] = .{ | |
| 129 | 129 | .llvm_name = "highpriinterrupts-level4", |
| 130 | 130 | .description = "Enable Xtensa HighPriInterrupts Level4", |
| 131 | 131 | .dependencies = featureSet(&[_]Feature{ |
| 132 | 132 | .highpriinterrupts, |
| 133 | 133 | }), |
| 134 | 134 | }; |
| 135 | result[@intFromEnum(Feature.highpriinterrupts_level5)] = .{ | |
| 135 | result[@backingInt(Feature.highpriinterrupts_level5)] = .{ | |
| 136 | 136 | .llvm_name = "highpriinterrupts-level5", |
| 137 | 137 | .description = "Enable Xtensa HighPriInterrupts Level5", |
| 138 | 138 | .dependencies = featureSet(&[_]Feature{ |
| 139 | 139 | .highpriinterrupts, |
| 140 | 140 | }), |
| 141 | 141 | }; |
| 142 | result[@intFromEnum(Feature.highpriinterrupts_level6)] = .{ | |
| 142 | result[@backingInt(Feature.highpriinterrupts_level6)] = .{ | |
| 143 | 143 | .llvm_name = "highpriinterrupts-level6", |
| 144 | 144 | .description = "Enable Xtensa HighPriInterrupts Level6", |
| 145 | 145 | .dependencies = featureSet(&[_]Feature{ |
| 146 | 146 | .highpriinterrupts, |
| 147 | 147 | }), |
| 148 | 148 | }; |
| 149 | result[@intFromEnum(Feature.highpriinterrupts_level7)] = .{ | |
| 149 | result[@backingInt(Feature.highpriinterrupts_level7)] = .{ | |
| 150 | 150 | .llvm_name = "highpriinterrupts-level7", |
| 151 | 151 | .description = "Enable Xtensa HighPriInterrupts Level7", |
| 152 | 152 | .dependencies = featureSet(&[_]Feature{ |
| 153 | 153 | .highpriinterrupts, |
| 154 | 154 | }), |
| 155 | 155 | }; |
| 156 | result[@intFromEnum(Feature.interrupt)] = .{ | |
| 156 | result[@backingInt(Feature.interrupt)] = .{ | |
| 157 | 157 | .llvm_name = "interrupt", |
| 158 | 158 | .description = "Enable Xtensa Interrupt option", |
| 159 | 159 | .dependencies = featureSet(&[_]Feature{}), |
| 160 | 160 | }; |
| 161 | result[@intFromEnum(Feature.loop)] = .{ | |
| 161 | result[@backingInt(Feature.loop)] = .{ | |
| 162 | 162 | .llvm_name = "loop", |
| 163 | 163 | .description = "Enable Xtensa Loop extension", |
| 164 | 164 | .dependencies = featureSet(&[_]Feature{}), |
| 165 | 165 | }; |
| 166 | result[@intFromEnum(Feature.mac16)] = .{ | |
| 166 | result[@backingInt(Feature.mac16)] = .{ | |
| 167 | 167 | .llvm_name = "mac16", |
| 168 | 168 | .description = "Enable Xtensa MAC16 instructions", |
| 169 | 169 | .dependencies = featureSet(&[_]Feature{}), |
| 170 | 170 | }; |
| 171 | result[@intFromEnum(Feature.minmax)] = .{ | |
| 171 | result[@backingInt(Feature.minmax)] = .{ | |
| 172 | 172 | .llvm_name = "minmax", |
| 173 | 173 | .description = "Enable Xtensa MINMAX option", |
| 174 | 174 | .dependencies = featureSet(&[_]Feature{}), |
| 175 | 175 | }; |
| 176 | result[@intFromEnum(Feature.miscsr)] = .{ | |
| 176 | result[@backingInt(Feature.miscsr)] = .{ | |
| 177 | 177 | .llvm_name = "miscsr", |
| 178 | 178 | .description = "Enable Xtensa Miscellaneous SR option", |
| 179 | 179 | .dependencies = featureSet(&[_]Feature{}), |
| 180 | 180 | }; |
| 181 | result[@intFromEnum(Feature.mul16)] = .{ | |
| 181 | result[@backingInt(Feature.mul16)] = .{ | |
| 182 | 182 | .llvm_name = "mul16", |
| 183 | 183 | .description = "Enable Xtensa Mul16 option", |
| 184 | 184 | .dependencies = featureSet(&[_]Feature{}), |
| 185 | 185 | }; |
| 186 | result[@intFromEnum(Feature.mul32)] = .{ | |
| 186 | result[@backingInt(Feature.mul32)] = .{ | |
| 187 | 187 | .llvm_name = "mul32", |
| 188 | 188 | .description = "Enable Xtensa Mul32 option", |
| 189 | 189 | .dependencies = featureSet(&[_]Feature{}), |
| 190 | 190 | }; |
| 191 | result[@intFromEnum(Feature.mul32high)] = .{ | |
| 191 | result[@backingInt(Feature.mul32high)] = .{ | |
| 192 | 192 | .llvm_name = "mul32high", |
| 193 | 193 | .description = "Enable Xtensa Mul32High option", |
| 194 | 194 | .dependencies = featureSet(&[_]Feature{}), |
| 195 | 195 | }; |
| 196 | result[@intFromEnum(Feature.nsa)] = .{ | |
| 196 | result[@backingInt(Feature.nsa)] = .{ | |
| 197 | 197 | .llvm_name = "nsa", |
| 198 | 198 | .description = "Enable Xtensa NSA option", |
| 199 | 199 | .dependencies = featureSet(&[_]Feature{}), |
| 200 | 200 | }; |
| 201 | result[@intFromEnum(Feature.prid)] = .{ | |
| 201 | result[@backingInt(Feature.prid)] = .{ | |
| 202 | 202 | .llvm_name = "prid", |
| 203 | 203 | .description = "Enable Xtensa Processor ID option", |
| 204 | 204 | .dependencies = featureSet(&[_]Feature{}), |
| 205 | 205 | }; |
| 206 | result[@intFromEnum(Feature.regprotect)] = .{ | |
| 206 | result[@backingInt(Feature.regprotect)] = .{ | |
| 207 | 207 | .llvm_name = "regprotect", |
| 208 | 208 | .description = "Enable Xtensa Region Protection option", |
| 209 | 209 | .dependencies = featureSet(&[_]Feature{}), |
| 210 | 210 | }; |
| 211 | result[@intFromEnum(Feature.rvector)] = .{ | |
| 211 | result[@backingInt(Feature.rvector)] = .{ | |
| 212 | 212 | .llvm_name = "rvector", |
| 213 | 213 | .description = "Enable Xtensa Relocatable Vector option", |
| 214 | 214 | .dependencies = featureSet(&[_]Feature{}), |
| 215 | 215 | }; |
| 216 | result[@intFromEnum(Feature.s32c1i)] = .{ | |
| 216 | result[@backingInt(Feature.s32c1i)] = .{ | |
| 217 | 217 | .llvm_name = "s32c1i", |
| 218 | 218 | .description = "Enable Xtensa S32C1I option", |
| 219 | 219 | .dependencies = featureSet(&[_]Feature{}), |
| 220 | 220 | }; |
| 221 | result[@intFromEnum(Feature.sext)] = .{ | |
| 221 | result[@backingInt(Feature.sext)] = .{ | |
| 222 | 222 | .llvm_name = "sext", |
| 223 | 223 | .description = "Enable Xtensa Sign Extend option", |
| 224 | 224 | .dependencies = featureSet(&[_]Feature{}), |
| 225 | 225 | }; |
| 226 | result[@intFromEnum(Feature.threadptr)] = .{ | |
| 226 | result[@backingInt(Feature.threadptr)] = .{ | |
| 227 | 227 | .llvm_name = "threadptr", |
| 228 | 228 | .description = "Enable Xtensa THREADPTR option", |
| 229 | 229 | .dependencies = featureSet(&[_]Feature{}), |
| 230 | 230 | }; |
| 231 | result[@intFromEnum(Feature.timers1)] = .{ | |
| 231 | result[@backingInt(Feature.timers1)] = .{ | |
| 232 | 232 | .llvm_name = "timers1", |
| 233 | 233 | .description = "Enable Xtensa Timers 1", |
| 234 | 234 | .dependencies = featureSet(&[_]Feature{}), |
| 235 | 235 | }; |
| 236 | result[@intFromEnum(Feature.timers2)] = .{ | |
| 236 | result[@backingInt(Feature.timers2)] = .{ | |
| 237 | 237 | .llvm_name = "timers2", |
| 238 | 238 | .description = "Enable Xtensa Timers 2", |
| 239 | 239 | .dependencies = featureSet(&[_]Feature{}), |
| 240 | 240 | }; |
| 241 | result[@intFromEnum(Feature.timers3)] = .{ | |
| 241 | result[@backingInt(Feature.timers3)] = .{ | |
| 242 | 242 | .llvm_name = "timers3", |
| 243 | 243 | .description = "Enable Xtensa Timers 3", |
| 244 | 244 | .dependencies = featureSet(&[_]Feature{}), |
| 245 | 245 | }; |
| 246 | result[@intFromEnum(Feature.windowed)] = .{ | |
| 246 | result[@backingInt(Feature.windowed)] = .{ | |
| 247 | 247 | .llvm_name = "windowed", |
| 248 | 248 | .description = "Enable Xtensa Windowed Register option", |
| 249 | 249 | .dependencies = featureSet(&[_]Feature{}), |
lib/std/Thread.zig+13-13| ... | ... | @@ -67,7 +67,7 @@ pub fn setName(self: Thread, io: Io, name: []const u8) SetNameError!void { |
| 67 | 67 | return; |
| 68 | 68 | } else { |
| 69 | 69 | const err = std.c.pthread_setname_np(self.getHandle(), name_with_terminator.ptr); |
| 70 | switch (@as(posix.E, @enumFromInt(err))) { | |
| 70 | switch (@as(posix.E, @fromBackingInt(@intCast(err)))) { | |
| 71 | 71 | .SUCCESS => return, |
| 72 | 72 | .RANGE => unreachable, |
| 73 | 73 | else => |e| return posix.unexpectedErrno(e), |
| ... | ... | @@ -101,14 +101,14 @@ pub fn setName(self: Thread, io: Io, name: []const u8) SetNameError!void { |
| 101 | 101 | if (self.getHandle() != std.c.pthread_self()) return error.Unsupported; |
| 102 | 102 | |
| 103 | 103 | const err = std.c.pthread_setname_np(name_with_terminator.ptr); |
| 104 | switch (@as(posix.E, @enumFromInt(err))) { | |
| 104 | switch (@as(posix.E, @fromBackingInt(@intCast(err)))) { | |
| 105 | 105 | .SUCCESS => return, |
| 106 | 106 | else => |e| return posix.unexpectedErrno(e), |
| 107 | 107 | } |
| 108 | 108 | }, |
| 109 | 109 | .serenity => if (use_pthreads) { |
| 110 | 110 | const err = std.c.pthread_setname_np(self.getHandle(), name_with_terminator.ptr); |
| 111 | switch (@as(posix.E, @enumFromInt(err))) { | |
| 111 | switch (@as(posix.E, @fromBackingInt(@intCast(err)))) { | |
| 112 | 112 | .SUCCESS => return, |
| 113 | 113 | .NAMETOOLONG => unreachable, |
| 114 | 114 | .SRCH => unreachable, |
| ... | ... | @@ -117,7 +117,7 @@ pub fn setName(self: Thread, io: Io, name: []const u8) SetNameError!void { |
| 117 | 117 | }, |
| 118 | 118 | .netbsd, .illumos => if (use_pthreads) { |
| 119 | 119 | const err = std.c.pthread_setname_np(self.getHandle(), name_with_terminator.ptr, null); |
| 120 | switch (@as(posix.E, @enumFromInt(err))) { | |
| 120 | switch (@as(posix.E, @fromBackingInt(@intCast(err)))) { | |
| 121 | 121 | .SUCCESS => return, |
| 122 | 122 | .INVAL => unreachable, |
| 123 | 123 | .SRCH => unreachable, |
| ... | ... | @@ -135,7 +135,7 @@ pub fn setName(self: Thread, io: Io, name: []const u8) SetNameError!void { |
| 135 | 135 | }, |
| 136 | 136 | .dragonfly => if (use_pthreads) { |
| 137 | 137 | const err = std.c.pthread_setname_np(self.getHandle(), name_with_terminator.ptr); |
| 138 | switch (@as(posix.E, @enumFromInt(err))) { | |
| 138 | switch (@as(posix.E, @fromBackingInt(@intCast(err)))) { | |
| 139 | 139 | .SUCCESS => return, |
| 140 | 140 | .INVAL => unreachable, |
| 141 | 141 | .FAULT => unreachable, |
| ... | ... | @@ -168,7 +168,7 @@ pub fn getName(self: Thread, buffer_ptr: *[max_name_len:0]u8) GetNameError!?[]co |
| 168 | 168 | return std.mem.sliceTo(buffer, 0); |
| 169 | 169 | } else { |
| 170 | 170 | const err = std.c.pthread_getname_np(self.getHandle(), buffer.ptr, max_name_len + 1); |
| 171 | switch (@as(posix.E, @enumFromInt(err))) { | |
| 171 | switch (@as(posix.E, @fromBackingInt(@intCast(err)))) { | |
| 172 | 172 | .SUCCESS => return std.mem.sliceTo(buffer, 0), |
| 173 | 173 | .RANGE => unreachable, |
| 174 | 174 | else => |e| return posix.unexpectedErrno(e), |
| ... | ... | @@ -211,7 +211,7 @@ pub fn getName(self: Thread, buffer_ptr: *[max_name_len:0]u8) GetNameError!?[]co |
| 211 | 211 | }, |
| 212 | 212 | .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => if (use_pthreads) { |
| 213 | 213 | const err = std.c.pthread_getname_np(self.getHandle(), buffer.ptr, max_name_len + 1); |
| 214 | switch (@as(posix.E, @enumFromInt(err))) { | |
| 214 | switch (@as(posix.E, @fromBackingInt(@intCast(err)))) { | |
| 215 | 215 | .SUCCESS => return std.mem.sliceTo(buffer, 0), |
| 216 | 216 | .SRCH => unreachable, |
| 217 | 217 | else => |e| return posix.unexpectedErrno(e), |
| ... | ... | @@ -219,7 +219,7 @@ pub fn getName(self: Thread, buffer_ptr: *[max_name_len:0]u8) GetNameError!?[]co |
| 219 | 219 | }, |
| 220 | 220 | .serenity => if (use_pthreads) { |
| 221 | 221 | const err = std.c.pthread_getname_np(self.getHandle(), buffer.ptr, max_name_len + 1); |
| 222 | switch (@as(posix.E, @enumFromInt(err))) { | |
| 222 | switch (@as(posix.E, @fromBackingInt(@intCast(err)))) { | |
| 223 | 223 | .SUCCESS => return, |
| 224 | 224 | .NAMETOOLONG => unreachable, |
| 225 | 225 | .SRCH => unreachable, |
| ... | ... | @@ -229,7 +229,7 @@ pub fn getName(self: Thread, buffer_ptr: *[max_name_len:0]u8) GetNameError!?[]co |
| 229 | 229 | }, |
| 230 | 230 | .netbsd, .illumos => if (use_pthreads) { |
| 231 | 231 | const err = std.c.pthread_getname_np(self.getHandle(), buffer.ptr, max_name_len + 1); |
| 232 | switch (@as(posix.E, @enumFromInt(err))) { | |
| 232 | switch (@as(posix.E, @fromBackingInt(@intCast(err)))) { | |
| 233 | 233 | .SUCCESS => return std.mem.sliceTo(buffer, 0), |
| 234 | 234 | .INVAL => unreachable, |
| 235 | 235 | .SRCH => unreachable, |
| ... | ... | @@ -245,7 +245,7 @@ pub fn getName(self: Thread, buffer_ptr: *[max_name_len:0]u8) GetNameError!?[]co |
| 245 | 245 | }, |
| 246 | 246 | .dragonfly => if (use_pthreads) { |
| 247 | 247 | const err = std.c.pthread_getname_np(self.getHandle(), buffer.ptr, max_name_len + 1); |
| 248 | switch (@as(posix.E, @enumFromInt(err))) { | |
| 248 | switch (@as(posix.E, @fromBackingInt(@intCast(err)))) { | |
| 249 | 249 | .SUCCESS => return std.mem.sliceTo(buffer, 0), |
| 250 | 250 | .INVAL => unreachable, |
| 251 | 251 | .FAULT => unreachable, |
| ... | ... | @@ -429,7 +429,7 @@ fn callFn(comptime f: anytype, args: anytype) switch (Impl) { |
| 429 | 429 | |
| 430 | 430 | const status = @call(.auto, f, args); |
| 431 | 431 | switch (Impl) { |
| 432 | WindowsThreadImpl => return @enumFromInt(status), | |
| 432 | WindowsThreadImpl => return @fromBackingInt(@intCast(status)), | |
| 433 | 433 | LinuxThreadImpl => return status, |
| 434 | 434 | // pthreads don't support exit status, ignore value |
| 435 | 435 | PosixThreadImpl => return default_value, |
| ... | ... | @@ -598,7 +598,7 @@ const WindowsThreadImpl = struct { |
| 598 | 598 | instance, |
| 599 | 599 | .{ .CREATE_SUSPENDED = true }, |
| 600 | 600 | 0, |
| 601 | @enumFromInt(stack_size), | |
| 601 | @fromBackingInt(@intCast(stack_size)), | |
| 602 | 602 | .default, |
| 603 | 603 | &attr_list, |
| 604 | 604 | )) { |
| ... | ... | @@ -712,7 +712,7 @@ const PosixThreadImpl = struct { |
| 712 | 712 | // The "proper" way to get the cpu count would be to query |
| 713 | 713 | // /dev/kstat via ioctls, and traverse a linked list for each |
| 714 | 714 | // cpu. (illumos) |
| 715 | const rc = c.sysconf(@intFromEnum(std.c._SC.NPROCESSORS_ONLN)); | |
| 715 | const rc = c.sysconf(@backingInt(std.c._SC.NPROCESSORS_ONLN)); | |
| 716 | 716 | return switch (posix.errno(rc)) { |
| 717 | 717 | .SUCCESS => @as(usize, @intCast(rc)), |
| 718 | 718 | else => |err| posix.unexpectedErrno(err), |
lib/std/c.zig+20-20| ... | ... | @@ -74,7 +74,7 @@ pub inline fn versionCheck(comptime version: std.SemanticVersion) bool { |
| 74 | 74 | |
| 75 | 75 | /// Get the errno if rc is -1 and SUCCESS if rc is not -1. |
| 76 | 76 | pub fn errno(rc: anytype) E { |
| 77 | return if (rc == -1) @enumFromInt(_errno().*) else .SUCCESS; | |
| 77 | return if (rc == -1) @fromBackingInt(@intCast(_errno().*)) else .SUCCESS; | |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | pub const ino_t = switch (native_os) { |
| ... | ... | @@ -3720,16 +3720,16 @@ pub const W = switch (native_os) { |
| 3720 | 3720 | return @as(u8, @intCast(x >> 8)); |
| 3721 | 3721 | } |
| 3722 | 3722 | pub fn TERMSIG(x: u32) SIG { |
| 3723 | return @enumFromInt(status(x)); | |
| 3723 | return @fromBackingInt(@intCast(status(x))); | |
| 3724 | 3724 | } |
| 3725 | 3725 | pub fn STOPSIG(x: u32) SIG { |
| 3726 | return @enumFromInt(x >> 8); | |
| 3726 | return @fromBackingInt(@intCast(x >> 8)); | |
| 3727 | 3727 | } |
| 3728 | 3728 | pub fn IFEXITED(x: u32) bool { |
| 3729 | 3729 | return status(x) == 0; |
| 3730 | 3730 | } |
| 3731 | 3731 | pub fn IFSTOPPED(x: u32) bool { |
| 3732 | return status(x) == stopped and @as(u32, @intFromEnum(STOPSIG(x))) != 0x13; | |
| 3732 | return status(x) == stopped and @as(u32, @backingInt(STOPSIG(x))) != 0x13; | |
| 3733 | 3733 | } |
| 3734 | 3734 | pub fn IFSIGNALED(x: u32) bool { |
| 3735 | 3735 | return status(x) != stopped and status(x) != 0; |
| ... | ... | @@ -3753,10 +3753,10 @@ pub const W = switch (native_os) { |
| 3753 | 3753 | return @as(u8, @intCast((s & 0xff00) >> 8)); |
| 3754 | 3754 | } |
| 3755 | 3755 | pub fn TERMSIG(s: u32) SIG { |
| 3756 | return @enumFromInt(s & 0x7f); | |
| 3756 | return @fromBackingInt(@intCast(s & 0x7f)); | |
| 3757 | 3757 | } |
| 3758 | 3758 | pub fn STOPSIG(s: u32) SIG { |
| 3759 | return @enumFromInt(EXITSTATUS(s)); | |
| 3759 | return @fromBackingInt(@intCast(EXITSTATUS(s))); | |
| 3760 | 3760 | } |
| 3761 | 3761 | pub fn IFEXITED(s: u32) bool { |
| 3762 | 3762 | return (s & 0x7f) == 0; |
| ... | ... | @@ -3781,10 +3781,10 @@ pub const W = switch (native_os) { |
| 3781 | 3781 | return @as(u8, @intCast((s >> 8) & 0xff)); |
| 3782 | 3782 | } |
| 3783 | 3783 | pub fn TERMSIG(s: u32) SIG { |
| 3784 | return @enumFromInt(s & 0x7f); | |
| 3784 | return @fromBackingInt(@intCast(s & 0x7f)); | |
| 3785 | 3785 | } |
| 3786 | 3786 | pub fn STOPSIG(s: u32) SIG { |
| 3787 | return @enumFromInt(EXITSTATUS(s)); | |
| 3787 | return @fromBackingInt(@intCast(EXITSTATUS(s))); | |
| 3788 | 3788 | } |
| 3789 | 3789 | pub fn IFEXITED(s: u32) bool { |
| 3790 | 3790 | return (s & 0x7f) == 0; |
| ... | ... | @@ -3815,10 +3815,10 @@ pub const W = switch (native_os) { |
| 3815 | 3815 | return @as(u8, @intCast((s >> 8) & 0xff)); |
| 3816 | 3816 | } |
| 3817 | 3817 | pub fn TERMSIG(s: u32) SIG { |
| 3818 | return @enumFromInt(s & 0x7f); | |
| 3818 | return @fromBackingInt(@intCast(s & 0x7f)); | |
| 3819 | 3819 | } |
| 3820 | 3820 | pub fn STOPSIG(s: u32) SIG { |
| 3821 | return @enumFromInt(EXITSTATUS(s)); | |
| 3821 | return @fromBackingInt(@intCast(EXITSTATUS(s))); | |
| 3822 | 3822 | } |
| 3823 | 3823 | pub fn IFEXITED(s: u32) bool { |
| 3824 | 3824 | return (s & 0x7f) == 0; |
| ... | ... | @@ -3849,10 +3849,10 @@ pub const W = switch (native_os) { |
| 3849 | 3849 | return @as(u8, @intCast((s & 0xff00) >> 8)); |
| 3850 | 3850 | } |
| 3851 | 3851 | pub fn TERMSIG(s: u32) SIG { |
| 3852 | return @enumFromInt(s & 0x7f); | |
| 3852 | return @fromBackingInt(@intCast(s & 0x7f)); | |
| 3853 | 3853 | } |
| 3854 | 3854 | pub fn STOPSIG(s: u32) SIG { |
| 3855 | return @enumFromInt(EXITSTATUS(s)); | |
| 3855 | return @fromBackingInt(@intCast(EXITSTATUS(s))); | |
| 3856 | 3856 | } |
| 3857 | 3857 | pub fn IFEXITED(s: u32) bool { |
| 3858 | 3858 | return (s & 0x7f) == 0; |
| ... | ... | @@ -3877,11 +3877,11 @@ pub const W = switch (native_os) { |
| 3877 | 3877 | } |
| 3878 | 3878 | |
| 3879 | 3879 | pub fn TERMSIG(s: u32) SIG { |
| 3880 | return @enumFromInt((s >> 8) & 0xff); | |
| 3880 | return @fromBackingInt(@intCast((s >> 8) & 0xff)); | |
| 3881 | 3881 | } |
| 3882 | 3882 | |
| 3883 | 3883 | pub fn STOPSIG(s: u32) SIG { |
| 3884 | return @enumFromInt((s >> 16) & 0xff); | |
| 3884 | return @fromBackingInt(@intCast((s >> 16) & 0xff)); | |
| 3885 | 3885 | } |
| 3886 | 3886 | |
| 3887 | 3887 | pub fn IFEXITED(s: u32) bool { |
| ... | ... | @@ -3905,10 +3905,10 @@ pub const W = switch (native_os) { |
| 3905 | 3905 | return @as(u8, @intCast((s >> 8) & 0xff)); |
| 3906 | 3906 | } |
| 3907 | 3907 | pub fn TERMSIG(s: u32) SIG { |
| 3908 | return @enumFromInt(s & 0x7f); | |
| 3908 | return @fromBackingInt(@intCast(s & 0x7f)); | |
| 3909 | 3909 | } |
| 3910 | 3910 | pub fn STOPSIG(s: u32) SIG { |
| 3911 | return @enumFromInt(EXITSTATUS(s)); | |
| 3911 | return @fromBackingInt(@intCast(EXITSTATUS(s))); | |
| 3912 | 3912 | } |
| 3913 | 3913 | pub fn IFEXITED(s: u32) bool { |
| 3914 | 3914 | return (s & 0x7f) == 0; |
| ... | ... | @@ -3940,11 +3940,11 @@ pub const W = switch (native_os) { |
| 3940 | 3940 | } |
| 3941 | 3941 | |
| 3942 | 3942 | pub fn STOPSIG(s: u32) SIG { |
| 3943 | return @enumFromInt(EXITSTATUS(s)); | |
| 3943 | return @fromBackingInt(@intCast(EXITSTATUS(s))); | |
| 3944 | 3944 | } |
| 3945 | 3945 | |
| 3946 | 3946 | pub fn TERMSIG(s: u32) SIG { |
| 3947 | return @enumFromInt(s & 0x7f); | |
| 3947 | return @fromBackingInt(@intCast(s & 0x7f)); | |
| 3948 | 3948 | } |
| 3949 | 3949 | |
| 3950 | 3950 | pub fn IFEXITED(s: u32) bool { |
| ... | ... | @@ -10551,7 +10551,7 @@ const sigrt_private = struct { |
| 10551 | 10551 | return switch (native_os) { |
| 10552 | 10552 | .freebsd => 65, |
| 10553 | 10553 | .netbsd => 33, |
| 10554 | .illumos => @truncate(sysconf(@intFromEnum(_SC.SIGRT_MIN))), | |
| 10554 | .illumos => @truncate(sysconf(@backingInt(_SC.SIGRT_MIN))), | |
| 10555 | 10555 | .haiku => @truncate(@as(c_uint, @bitCast(private.__signal_get_sigrtmin()))), |
| 10556 | 10556 | else => @truncate(@as(c_uint, @bitCast(private.__libc_current_sigrtmin()))), |
| 10557 | 10557 | }; |
| ... | ... | @@ -10561,7 +10561,7 @@ const sigrt_private = struct { |
| 10561 | 10561 | return switch (native_os) { |
| 10562 | 10562 | .freebsd => 126, |
| 10563 | 10563 | .netbsd => 63, |
| 10564 | .illumos => @truncate(sysconf(@intFromEnum(_SC.SIGRT_MAX))), | |
| 10564 | .illumos => @truncate(sysconf(@backingInt(_SC.SIGRT_MAX))), | |
| 10565 | 10565 | .haiku => @truncate(@as(c_uint, @bitCast(private.__signal_get_sigrtmax()))), |
| 10566 | 10566 | else => @truncate(@as(c_uint, @bitCast(private.__libc_current_sigrtmax()))), |
| 10567 | 10567 | }; |
lib/std/c/darwin.zig+2-2| ... | ... | @@ -1138,10 +1138,10 @@ pub const mach_msg_return_t = enum(kern_return_t) { |
| 1138 | 1138 | error_code: mach_msg_return_t, |
| 1139 | 1139 | resource_error: ?MACH.MSG, |
| 1140 | 1140 | } { |
| 1141 | const return_code: mach_msg_return_t = @enumFromInt(@intFromEnum(ret) & ~MACH.MSG.MASK); | |
| 1141 | const return_code: mach_msg_return_t = @fromBackingInt(@intCast(@backingInt(ret) & ~MACH.MSG.MASK)); | |
| 1142 | 1142 | switch (return_code) { |
| 1143 | 1143 | .RCV_HEADER_ERROR, .RCV_BODY_ERROR => { |
| 1144 | const resource_error: MACH.MSG = @bitCast(@intFromEnum(ret) & MACH.MSG.MASK); | |
| 1144 | const resource_error: MACH.MSG = @bitCast(@backingInt(ret) & MACH.MSG.MASK); | |
| 1145 | 1145 | return .{ |
| 1146 | 1146 | .error_code = return_code, |
| 1147 | 1147 | .resource_error = resource_error, |
lib/std/c/illumos.zig+1-1| ... | ... | @@ -322,7 +322,7 @@ const IoCtlCommand = enum(u32) { |
| 322 | 322 | fn ioImpl(cmd: IoCtlCommand, io_type: u8, nr: u8, comptime IOT: type) i32 { |
| 323 | 323 | const size = @as(u32, @intCast(@as(u8, @truncate(@sizeOf(IOT))))) << 16; |
| 324 | 324 | const t = @as(u32, @intCast(io_type)) << 8; |
| 325 | return @as(i32, @bitCast(@intFromEnum(cmd) | size | t | nr)); | |
| 325 | return @as(i32, @bitCast(@backingInt(cmd) | size | t | nr)); | |
| 326 | 326 | } |
| 327 | 327 | |
| 328 | 328 | pub fn IO(io_type: u8, nr: u8) i32 { |
lib/std/coff.zig+13-13| ... | ... | @@ -99,8 +99,8 @@ pub const Header = extern struct { |
| 99 | 99 | |
| 100 | 100 | // OptionalHeader.magic values |
| 101 | 101 | // see https://msdn.microsoft.com/en-us/library/windows/desktop/ms680339(v=vs.85).aspx |
| 102 | pub const IMAGE_NT_OPTIONAL_HDR32_MAGIC = @intFromEnum(OptionalHeader.Magic.PE32); | |
| 103 | pub const IMAGE_NT_OPTIONAL_HDR64_MAGIC = @intFromEnum(OptionalHeader.Magic.@"PE32+"); | |
| 102 | pub const IMAGE_NT_OPTIONAL_HDR32_MAGIC = @backingInt(OptionalHeader.Magic.PE32); | |
| 103 | pub const IMAGE_NT_OPTIONAL_HDR64_MAGIC = @backingInt(OptionalHeader.Magic.@"PE32+"); | |
| 104 | 104 | |
| 105 | 105 | pub const DllFlags = packed struct(u16) { |
| 106 | 106 | _reserved_0: u5 = 0, |
| ... | ... | @@ -655,12 +655,12 @@ pub const SectionHeader = extern struct { |
| 655 | 655 | |
| 656 | 656 | pub fn toByteUnits(a: Align) ?u16 { |
| 657 | 657 | if (a == .NONE) return null; |
| 658 | return @as(u16, 1) << (@intFromEnum(a) - 1); | |
| 658 | return @as(u16, 1) << (@backingInt(a) - 1); | |
| 659 | 659 | } |
| 660 | 660 | |
| 661 | 661 | pub fn fromByteUnits(n: u16) Align { |
| 662 | 662 | std.debug.assert(std.math.isPowerOfTwo(n)); |
| 663 | return @enumFromInt(@ctz(n) + 1); | |
| 663 | return @fromBackingInt(@intCast(@ctz(n) + 1)); | |
| 664 | 664 | } |
| 665 | 665 | |
| 666 | 666 | pub fn alignment(a: Align) ?std.mem.Alignment { |
| ... | ... | @@ -1058,9 +1058,9 @@ pub const Coff = struct { |
| 1058 | 1058 | assert(self.is_image); |
| 1059 | 1059 | |
| 1060 | 1060 | const data_dirs = self.getDataDirectories(); |
| 1061 | if (@intFromEnum(IMAGE.DIRECTORY_ENTRY.DEBUG) >= data_dirs.len) return null; | |
| 1061 | if (@backingInt(IMAGE.DIRECTORY_ENTRY.DEBUG) >= data_dirs.len) return null; | |
| 1062 | 1062 | |
| 1063 | const debug_dir = data_dirs[@intFromEnum(IMAGE.DIRECTORY_ENTRY.DEBUG)]; | |
| 1063 | const debug_dir = data_dirs[@backingInt(IMAGE.DIRECTORY_ENTRY.DEBUG)]; | |
| 1064 | 1064 | var reader: std.Io.Reader = .fixed(self.data); |
| 1065 | 1065 | |
| 1066 | 1066 | if (self.is_loaded) { |
| ... | ... | @@ -1125,7 +1125,7 @@ pub const Coff = struct { |
| 1125 | 1125 | |
| 1126 | 1126 | pub fn getImageBase(self: Coff) u64 { |
| 1127 | 1127 | const hdr = self.getOptionalHeader(); |
| 1128 | return switch (@intFromEnum(hdr.magic)) { | |
| 1128 | return switch (@backingInt(hdr.magic)) { | |
| 1129 | 1129 | IMAGE_NT_OPTIONAL_HDR32_MAGIC => self.getOptionalHeader32().image_base, |
| 1130 | 1130 | IMAGE_NT_OPTIONAL_HDR64_MAGIC => self.getOptionalHeader64().image_base, |
| 1131 | 1131 | else => unreachable, // We assume we have validated the header already |
| ... | ... | @@ -1134,7 +1134,7 @@ pub const Coff = struct { |
| 1134 | 1134 | |
| 1135 | 1135 | pub fn getNumberOfDataDirectories(self: Coff) u32 { |
| 1136 | 1136 | const hdr = self.getOptionalHeader(); |
| 1137 | return switch (@intFromEnum(hdr.magic)) { | |
| 1137 | return switch (@backingInt(hdr.magic)) { | |
| 1138 | 1138 | IMAGE_NT_OPTIONAL_HDR32_MAGIC => self.getOptionalHeader32().number_of_rva_and_sizes, |
| 1139 | 1139 | IMAGE_NT_OPTIONAL_HDR64_MAGIC => self.getOptionalHeader64().number_of_rva_and_sizes, |
| 1140 | 1140 | else => unreachable, // We assume we have validated the header already |
| ... | ... | @@ -1143,7 +1143,7 @@ pub const Coff = struct { |
| 1143 | 1143 | |
| 1144 | 1144 | pub fn getDataDirectories(self: *const Coff) []align(1) const ImageDataDirectory { |
| 1145 | 1145 | const hdr = self.getOptionalHeader(); |
| 1146 | const size: usize = switch (@intFromEnum(hdr.magic)) { | |
| 1146 | const size: usize = switch (@backingInt(hdr.magic)) { | |
| 1147 | 1147 | IMAGE_NT_OPTIONAL_HDR32_MAGIC => @sizeOf(OptionalHeader.PE32), |
| 1148 | 1148 | IMAGE_NT_OPTIONAL_HDR64_MAGIC => @sizeOf(OptionalHeader.@"PE32+"), |
| 1149 | 1149 | else => unreachable, // We assume we have validated the header already |
| ... | ... | @@ -1268,9 +1268,9 @@ pub const Symtab = struct { |
| 1268 | 1268 | return .{ |
| 1269 | 1269 | .name = raw[0..8].*, |
| 1270 | 1270 | .value = mem.readInt(u32, raw[8..12], .little), |
| 1271 | .section_number = @as(SectionNumber, @enumFromInt(mem.readInt(u16, raw[12..14], .little))), | |
| 1271 | .section_number = @as(SectionNumber, @fromBackingInt(@intCast(mem.readInt(u16, raw[12..14], .little)))), | |
| 1272 | 1272 | .type = @as(SymType, @bitCast(mem.readInt(u16, raw[14..16], .little))), |
| 1273 | .storage_class = @as(StorageClass, @enumFromInt(raw[16])), | |
| 1273 | .storage_class = @as(StorageClass, @fromBackingInt(@intCast(raw[16]))), | |
| 1274 | 1274 | .number_of_aux_symbols = raw[17], |
| 1275 | 1275 | }; |
| 1276 | 1276 | } |
| ... | ... | @@ -1298,7 +1298,7 @@ pub const Symtab = struct { |
| 1298 | 1298 | fn asWeakExtDef(raw: []const u8) WeakExternalDefinition { |
| 1299 | 1299 | return .{ |
| 1300 | 1300 | .tag_index = mem.readInt(u32, raw[0..4], .little), |
| 1301 | .flag = @as(WeakExternalFlag, @enumFromInt(mem.readInt(u32, raw[4..8], .little))), | |
| 1301 | .flag = @as(WeakExternalFlag, @fromBackingInt(@intCast(mem.readInt(u32, raw[4..8], .little)))), | |
| 1302 | 1302 | .unused = raw[8..18].*, |
| 1303 | 1303 | }; |
| 1304 | 1304 | } |
| ... | ... | @@ -1316,7 +1316,7 @@ pub const Symtab = struct { |
| 1316 | 1316 | .number_of_linenumbers = mem.readInt(u16, raw[6..8], .little), |
| 1317 | 1317 | .checksum = mem.readInt(u32, raw[8..12], .little), |
| 1318 | 1318 | .number = mem.readInt(u16, raw[12..14], .little), |
| 1319 | .selection = @as(ComdatSelection, @enumFromInt(raw[14])), | |
| 1319 | .selection = @as(ComdatSelection, @fromBackingInt(@intCast(raw[14]))), | |
| 1320 | 1320 | .unused = raw[15..18].*, |
| 1321 | 1321 | }; |
| 1322 | 1322 | } |
lib/std/compress/flate/Compress.zig+13-13| ... | ... | @@ -1679,7 +1679,7 @@ pub const Raw = struct { |
| 1679 | 1679 | const is_pattern = rem_splat != splat and vec.len == pattern.len; |
| 1680 | 1680 | if (is_pattern) assert(pattern.len != 0); // exceeded countSplat |
| 1681 | 1681 | |
| 1682 | if (!is_pattern or rem_splat == 0 or pattern.len > @intFromEnum(block_limit) / 2) { | |
| 1682 | if (!is_pattern or rem_splat == 0 or pattern.len > @backingInt(block_limit) / 2) { | |
| 1683 | 1683 | rem_data_elem = rem_data_elem[vec.len..]; |
| 1684 | 1684 | block_limit = block_limit.subtract(vec.len).?; |
| 1685 | 1685 | |
| ... | ... | @@ -1701,7 +1701,7 @@ pub const Raw = struct { |
| 1701 | 1701 | } |
| 1702 | 1702 | if (block_limit == .nothing) break; |
| 1703 | 1703 | } else { |
| 1704 | const out_splat = @intFromEnum(block_limit) / pattern.len; | |
| 1704 | const out_splat = @backingInt(block_limit) / pattern.len; | |
| 1705 | 1705 | assert(out_splat >= 2); |
| 1706 | 1706 | |
| 1707 | 1707 | try r.output.writeSplatAll(vecs[0..vecs_n], out_splat); |
| ... | ... | @@ -2155,7 +2155,7 @@ pub const Huffman = struct { |
| 2155 | 2155 | const bytes = block_limit.sliceConst(rem_data_elem); |
| 2156 | 2156 | const is_pattern = rem_splat != splat and bytes.len == pattern.len; |
| 2157 | 2157 | |
| 2158 | const mul = if (!is_pattern) 1 else @intFromEnum(block_limit) / pattern.len; | |
| 2158 | const mul = if (!is_pattern) 1 else @backingInt(block_limit) / pattern.len; | |
| 2159 | 2159 | assert(mul != 0); |
| 2160 | 2160 | if (is_pattern) assert(mul <= rem_splat + 1); // one more for `rem_data` |
| 2161 | 2161 | |
| ... | ... | @@ -2231,11 +2231,11 @@ pub const Huffman = struct { |
| 2231 | 2231 | @subWithOverflow(data.len - (rem_data.len - @intFromBool(in_pattern)), 1); |
| 2232 | 2232 | const is_elem = in_data == 0 and data[vec_elem_i].len == rem_data_elem.len; |
| 2233 | 2233 | |
| 2234 | if (!is_elem or rem_data_elem.len > @intFromEnum(block_limit)) { | |
| 2234 | if (!is_elem or rem_data_elem.len > @backingInt(block_limit)) { | |
| 2235 | 2235 | block_limit = block_limit.subtract(rem_data_elem.len) orelse { |
| 2236 | try h.bit_writer.output.writeAll(rem_data_elem[0..@intFromEnum(block_limit)]); | |
| 2237 | h.hasher.update(rem_data_elem[0..@intFromEnum(block_limit)]); | |
| 2238 | rem_data_elem = rem_data_elem[@intFromEnum(block_limit)..]; | |
| 2236 | try h.bit_writer.output.writeAll(rem_data_elem[0..@backingInt(block_limit)]); | |
| 2237 | h.hasher.update(rem_data_elem[0..@backingInt(block_limit)]); | |
| 2238 | rem_data_elem = rem_data_elem[@backingInt(block_limit)..]; | |
| 2239 | 2239 | assert(rem_data_elem.len != 0); |
| 2240 | 2240 | break; |
| 2241 | 2241 | }; |
| ... | ... | @@ -2259,7 +2259,7 @@ pub const Huffman = struct { |
| 2259 | 2259 | vec_n += 1; |
| 2260 | 2260 | } else vec_splat: { |
| 2261 | 2261 | // For `pattern.len == 0`, the value of `vec_splat` does not matter. |
| 2262 | const vec_splat = @intFromEnum(vlimit) / @max(1, pattern.len); | |
| 2262 | const vec_splat = @backingInt(vlimit) / @max(1, pattern.len); | |
| 2263 | 2263 | if (pattern.len != 0) assert(vec_splat <= rem_splat + 1); |
| 2264 | 2264 | vlimit = vlimit.subtract(pattern.len * vec_splat).?; |
| 2265 | 2265 | vec_n += 1; |
| ... | ... | @@ -2267,7 +2267,7 @@ pub const Huffman = struct { |
| 2267 | 2267 | }; |
| 2268 | 2268 | |
| 2269 | 2269 | const n = if (vec_n != 0) n: { |
| 2270 | assert(@intFromEnum(block_limit) - @intFromEnum(vlimit) == | |
| 2270 | assert(@backingInt(block_limit) - @backingInt(vlimit) == | |
| 2271 | 2271 | Writer.countSplat(rem_data[0..vec_n], vec_splat)); |
| 2272 | 2272 | break :n try h.bit_writer.output.writeSplat(rem_data[0..vec_n], vec_splat); |
| 2273 | 2273 | } else 0; // Still go into the case below to advance the vector |
| ... | ... | @@ -2278,8 +2278,8 @@ pub const Huffman = struct { |
| 2278 | 2278 | const elem = rem_data[0]; |
| 2279 | 2279 | rem_data = rem_data[1..]; |
| 2280 | 2280 | consumed = consumed.subtract(elem.len) orelse { |
| 2281 | h.hasher.update(elem[0..@intFromEnum(consumed)]); | |
| 2282 | rem_data_elem = elem[@intFromEnum(consumed)..]; | |
| 2281 | h.hasher.update(elem[0..@backingInt(consumed)]); | |
| 2282 | rem_data_elem = elem[@backingInt(consumed)..]; | |
| 2283 | 2283 | break; |
| 2284 | 2284 | }; |
| 2285 | 2285 | h.hasher.update(elem); |
| ... | ... | @@ -2297,8 +2297,8 @@ pub const Huffman = struct { |
| 2297 | 2297 | break; |
| 2298 | 2298 | } |
| 2299 | 2299 | |
| 2300 | const splatted = @intFromEnum(consumed) / pattern.len; | |
| 2301 | const partial = @intFromEnum(consumed) % pattern.len; | |
| 2300 | const splatted = @backingInt(consumed) / pattern.len; | |
| 2301 | const partial = @backingInt(consumed) % pattern.len; | |
| 2302 | 2302 | for (0..splatted) |_| h.hasher.update(pattern); |
| 2303 | 2303 | h.hasher.update(pattern[0..partial]); |
| 2304 | 2304 |
lib/std/compress/flate/Decompress.zig+9-9| ... | ... | @@ -131,7 +131,7 @@ fn discardDirect(r: *Reader, limit: std.Io.Limit) Reader.Error!usize { |
| 131 | 131 | error.WriteFailed => unreachable, |
| 132 | 132 | error.ReadFailed, error.EndOfStream => |e| return e, |
| 133 | 133 | }; |
| 134 | assert(n <= @intFromEnum(limit)); | |
| 134 | assert(n <= @backingInt(limit)); | |
| 135 | 135 | return n; |
| 136 | 136 | } |
| 137 | 137 | |
| ... | ... | @@ -268,7 +268,7 @@ fn streamFallible(d: *Decompress, w: *Writer, limit: std.Io.Limit) Reader.Stream |
| 268 | 268 | } |
| 269 | 269 | |
| 270 | 270 | fn streamInner(d: *Decompress, w: *Writer, limit: std.Io.Limit) (Error || Reader.StreamError)!usize { |
| 271 | var remaining = @intFromEnum(limit); | |
| 271 | var remaining = @backingInt(limit); | |
| 272 | 272 | const in = d.input; |
| 273 | 273 | sw: switch (d.state) { |
| 274 | 274 | .protocol_header => switch (d.container_metadata.container()) { |
| ... | ... | @@ -316,7 +316,7 @@ fn streamInner(d: *Decompress, w: *Writer, limit: std.Io.Limit) (Error || Reader |
| 316 | 316 | }, |
| 317 | 317 | .block_header => { |
| 318 | 318 | d.final_block = (try d.takeIntBits(u1)) != 0; |
| 319 | const block_type: BlockType = @enumFromInt(try d.takeIntBits(u2)); | |
| 319 | const block_type: BlockType = @fromBackingInt(@intCast(try d.takeIntBits(u2))); | |
| 320 | 320 | switch (block_type) { |
| 321 | 321 | .stored => { |
| 322 | 322 | d.alignBitsForward(); |
| ... | ... | @@ -380,7 +380,7 @@ fn streamInner(d: *Decompress, w: *Writer, limit: std.Io.Limit) (Error || Reader |
| 380 | 380 | d.state = .{ .stored_block = @intCast(remaining_len - n) }; |
| 381 | 381 | } |
| 382 | 382 | w.advance(n); |
| 383 | return @intFromEnum(limit) - remaining + n; | |
| 383 | return @backingInt(limit) - remaining + n; | |
| 384 | 384 | }, |
| 385 | 385 | .fixed_block => while (true) { |
| 386 | 386 | // Consume bytes |
| ... | ... | @@ -408,7 +408,7 @@ fn streamInner(d: *Decompress, w: *Writer, limit: std.Io.Limit) (Error || Reader |
| 408 | 408 | try w.writeBytePreserve(flate.history_len, byte); |
| 409 | 409 | } else { |
| 410 | 410 | d.state = .{ .fixed_block_literal = byte }; |
| 411 | return @intFromEnum(limit) - remaining; | |
| 411 | return @backingInt(limit) - remaining; | |
| 412 | 412 | } |
| 413 | 413 | }, |
| 414 | 414 | .fixed_block_literal => |symbol| { |
| ... | ... | @@ -426,7 +426,7 @@ fn streamInner(d: *Decompress, w: *Writer, limit: std.Io.Limit) (Error || Reader |
| 426 | 426 | continue :sw .fixed_block; |
| 427 | 427 | } else { |
| 428 | 428 | d.state = .{ .fixed_block_match = length }; |
| 429 | return @intFromEnum(limit) - remaining; | |
| 429 | return @backingInt(limit) - remaining; | |
| 430 | 430 | } |
| 431 | 431 | }, |
| 432 | 432 | // In larger archives most blocks are usually dynamic, so |
| ... | ... | @@ -457,7 +457,7 @@ fn streamInner(d: *Decompress, w: *Writer, limit: std.Io.Limit) (Error || Reader |
| 457 | 457 | try w.writeBytePreserve(flate.history_len, byte); |
| 458 | 458 | } else { |
| 459 | 459 | d.state = .{ .dynamic_block_literal = byte }; |
| 460 | return @intFromEnum(limit) - remaining; | |
| 460 | return @backingInt(limit) - remaining; | |
| 461 | 461 | } |
| 462 | 462 | }, |
| 463 | 463 | .dynamic_block_literal => |symbol| { |
| ... | ... | @@ -476,7 +476,7 @@ fn streamInner(d: *Decompress, w: *Writer, limit: std.Io.Limit) (Error || Reader |
| 476 | 476 | continue :sw .dynamic_block; |
| 477 | 477 | } else { |
| 478 | 478 | d.state = .{ .dynamic_block_match = length }; |
| 479 | return @intFromEnum(limit) - remaining; | |
| 479 | return @backingInt(limit) - remaining; | |
| 480 | 480 | } |
| 481 | 481 | }, |
| 482 | 482 | .protocol_footer => { |
| ... | ... | @@ -492,7 +492,7 @@ fn streamInner(d: *Decompress, w: *Writer, limit: std.Io.Limit) (Error || Reader |
| 492 | 492 | .raw => {}, |
| 493 | 493 | } |
| 494 | 494 | d.state = .end; |
| 495 | return @intFromEnum(limit) - remaining; | |
| 495 | return @backingInt(limit) - remaining; | |
| 496 | 496 | }, |
| 497 | 497 | .end => return error.EndOfStream, |
| 498 | 498 | } |
lib/std/compress/xz/Decompress.zig+1-1| ... | ... | @@ -219,7 +219,7 @@ fn readBlock(input: *Reader, allocating: *Writer.Allocating) !void { |
| 219 | 219 | _, |
| 220 | 220 | }; |
| 221 | 221 | |
| 222 | const filter_id: FilterId = @enumFromInt(try input.takeLeb128(u64)); | |
| 222 | const filter_id: FilterId = @fromBackingInt(@intCast(try input.takeLeb128(u64))); | |
| 223 | 223 | if (filter_id != .lzma2) return error.Unsupported; |
| 224 | 224 | |
| 225 | 225 | const properties_size = try input.takeLeb128(u64); |
lib/std/compress/zstd/Decompress.zig+15-15| ... | ... | @@ -175,7 +175,7 @@ fn discardDirect(r: *Reader, limit: std.Io.Limit) Reader.Error!usize { |
| 175 | 175 | error.WriteFailed => unreachable, |
| 176 | 176 | error.ReadFailed, error.EndOfStream => |e| return e, |
| 177 | 177 | }; |
| 178 | assert(n <= @intFromEnum(limit)); | |
| 178 | assert(n <= @backingInt(limit)); | |
| 179 | 179 | return n; |
| 180 | 180 | } |
| 181 | 181 | |
| ... | ... | @@ -297,7 +297,7 @@ fn readInFrame(d: *Decompress, w: *Writer, limit: Limit, state: *State.InFrame) |
| 297 | 297 | const block_size = block_header.size; |
| 298 | 298 | const frame_block_size_max = state.frame.block_size_max; |
| 299 | 299 | if (frame_block_size_max < block_size) return error.BlockOversize; |
| 300 | if (@intFromEnum(limit) < block_size) return error.OutputBufferUndersize; | |
| 300 | if (@backingInt(limit) < block_size) return error.OutputBufferUndersize; | |
| 301 | 301 | var bytes_written: usize = 0; |
| 302 | 302 | switch (block_header.type) { |
| 303 | 303 | .raw => { |
| ... | ... | @@ -320,7 +320,7 @@ fn readInFrame(d: *Decompress, w: *Writer, limit: Limit, state: *State.InFrame) |
| 320 | 320 | try decode.prepare(in, &remaining, literals, sequences_header); |
| 321 | 321 | |
| 322 | 322 | { |
| 323 | if (sequence_buffer.len < @intFromEnum(remaining)) | |
| 323 | if (sequence_buffer.len < @backingInt(remaining)) | |
| 324 | 324 | return error.SequenceBufferUndersize; |
| 325 | 325 | const seq_slice = remaining.slice(&sequence_buffer); |
| 326 | 326 | try in.readSliceAll(seq_slice); |
| ... | ... | @@ -409,16 +409,16 @@ pub const Frame = struct { |
| 409 | 409 | _, |
| 410 | 410 | |
| 411 | 411 | pub fn kind(m: Magic) ?Kind { |
| 412 | return switch (@intFromEnum(m)) { | |
| 413 | @intFromEnum(Magic.zstandard) => .zstandard, | |
| 414 | @intFromEnum(Skippable.magic_min)...@intFromEnum(Skippable.magic_max) => .skippable, | |
| 412 | return switch (@backingInt(m)) { | |
| 413 | @backingInt(Magic.zstandard) => .zstandard, | |
| 414 | @backingInt(Skippable.magic_min)...@backingInt(Skippable.magic_max) => .skippable, | |
| 415 | 415 | else => null, |
| 416 | 416 | }; |
| 417 | 417 | } |
| 418 | 418 | |
| 419 | 419 | pub fn isSkippable(m: Magic) bool { |
| 420 | return switch (@intFromEnum(m)) { | |
| 421 | @intFromEnum(Skippable.magic_min)...@intFromEnum(Skippable.magic_max) => true, | |
| 420 | return switch (@backingInt(m)) { | |
| 421 | @backingInt(Skippable.magic_min)...@backingInt(Skippable.magic_max) => true, | |
| 422 | 422 | else => false, |
| 423 | 423 | }; |
| 424 | 424 | } |
| ... | ... | @@ -902,8 +902,8 @@ pub const Frame = struct { |
| 902 | 902 | }; |
| 903 | 903 | |
| 904 | 904 | pub const Skippable = struct { |
| 905 | pub const magic_min: Magic = @enumFromInt(0x184D2A50); | |
| 906 | pub const magic_max: Magic = @enumFromInt(0x184D2A5F); | |
| 905 | pub const magic_min: Magic = @fromBackingInt(@intCast(0x184D2A50)); | |
| 906 | pub const magic_max: Magic = @fromBackingInt(@intCast(0x184D2A5F)); | |
| 907 | 907 | |
| 908 | 908 | pub const Header = struct { |
| 909 | 909 | magic_number: u32, |
| ... | ... | @@ -1001,7 +1001,7 @@ pub const LiteralsSection = struct { |
| 1001 | 1001 | pub fn decode(in: *Reader, remaining: *Limit) !Header { |
| 1002 | 1002 | remaining.* = remaining.subtract(1) orelse return error.EndOfStream; |
| 1003 | 1003 | const byte0 = try in.takeByte(); |
| 1004 | const block_type: BlockType = @enumFromInt(byte0 & 0b11); | |
| 1004 | const block_type: BlockType = @fromBackingInt(@intCast(byte0 & 0b11)); | |
| 1005 | 1005 | const size_format: u2 = @intCast((byte0 & 0b1100) >> 2); |
| 1006 | 1006 | var regenerated_size: u20 = undefined; |
| 1007 | 1007 | var compressed_size: ?u18 = null; |
| ... | ... | @@ -1330,7 +1330,7 @@ pub const LiteralsSection = struct { |
| 1330 | 1330 | try HuffmanTree.decode(in, remaining) |
| 1331 | 1331 | else |
| 1332 | 1332 | null; |
| 1333 | const huffman_tree_size = @intFromEnum(before_remaining) - @intFromEnum(remaining.*); | |
| 1333 | const huffman_tree_size = @backingInt(before_remaining) - @backingInt(remaining.*); | |
| 1334 | 1334 | const total_streams_size = std.math.sub(usize, header.compressed_size.?, huffman_tree_size) catch |
| 1335 | 1335 | return error.MalformedLiteralsSection; |
| 1336 | 1336 | if (total_streams_size > buffer.len) return error.MalformedLiteralsSection; |
| ... | ... | @@ -1398,9 +1398,9 @@ pub const SequencesSection = struct { |
| 1398 | 1398 | |
| 1399 | 1399 | const compression_modes = try in.takeByte(); |
| 1400 | 1400 | |
| 1401 | const matches_mode: Header.Mode = @enumFromInt((compression_modes & 0b00001100) >> 2); | |
| 1402 | const offsets_mode: Header.Mode = @enumFromInt((compression_modes & 0b00110000) >> 4); | |
| 1403 | const literal_mode: Header.Mode = @enumFromInt((compression_modes & 0b11000000) >> 6); | |
| 1401 | const matches_mode: Header.Mode = @fromBackingInt(@intCast((compression_modes & 0b00001100) >> 2)); | |
| 1402 | const offsets_mode: Header.Mode = @fromBackingInt(@intCast((compression_modes & 0b00110000) >> 4)); | |
| 1403 | const literal_mode: Header.Mode = @fromBackingInt(@intCast((compression_modes & 0b11000000) >> 6)); | |
| 1404 | 1404 | if (compression_modes & 0b11 != 0) return error.ReservedBitSet; |
| 1405 | 1405 | |
| 1406 | 1406 | return .{ |
lib/std/crypto/Certificate.zig+2-2| ... | ... | @@ -327,7 +327,7 @@ pub const Parsed = struct { |
| 327 | 327 | while (name_i < general_names.slice.end) { |
| 328 | 328 | const general_name = try der.Element.parse(subject_alt_name, name_i); |
| 329 | 329 | name_i = general_name.slice.end; |
| 330 | switch (@as(GeneralNameTag, @enumFromInt(@intFromEnum(general_name.identifier.tag)))) { | |
| 330 | switch (@as(GeneralNameTag, @fromBackingInt(@intCast(@backingInt(general_name.identifier.tag))))) { | |
| 331 | 331 | .dNSName => { |
| 332 | 332 | const dns_name = subject_alt_name[general_name.slice.start..general_name.slice.end]; |
| 333 | 333 | if (checkHostName(host_name, dns_name)) return; |
| ... | ... | @@ -642,7 +642,7 @@ const Date = struct { |
| 642 | 642 | while (month < date.month) : (month += 1) { |
| 643 | 643 | const days: u64 = std.time.epoch.getDaysInMonth( |
| 644 | 644 | date.year, |
| 645 | @enumFromInt(month), | |
| 645 | @fromBackingInt(@intCast(month)), | |
| 646 | 646 | ); |
| 647 | 647 | sec += days * std.time.epoch.secs_per_day; |
| 648 | 648 | } |
lib/std/crypto/Certificate/Bundle/macos.zig+1-1| ... | ... | @@ -55,7 +55,7 @@ fn scanReader(cb: *Bundle, gpa: Allocator, reader: *Io.Reader, now_sec: i64) !vo |
| 55 | 55 | |
| 56 | 56 | const table_header = try reader.takeStruct(TableHeader, .big); |
| 57 | 57 | |
| 58 | if (@as(std.c.DB_RECORDTYPE, @enumFromInt(table_header.table_id)) != .X509_CERTIFICATE) { | |
| 58 | if (@as(std.c.DB_RECORDTYPE, @fromBackingInt(@intCast(table_header.table_id))) != .X509_CERTIFICATE) { | |
| 59 | 59 | continue; |
| 60 | 60 | } |
| 61 | 61 |
lib/std/crypto/argon2.zig+2-2| ... | ... | @@ -119,7 +119,7 @@ fn initHash( |
| 119 | 119 | mem.writeInt(u32, parameters[8..12], params.m, .little); |
| 120 | 120 | mem.writeInt(u32, parameters[12..16], params.t, .little); |
| 121 | 121 | mem.writeInt(u32, parameters[16..20], version, .little); |
| 122 | mem.writeInt(u32, parameters[20..24], @intFromEnum(mode), .little); | |
| 122 | mem.writeInt(u32, parameters[20..24], @backingInt(mode), .little); | |
| 123 | 123 | b2.update(&parameters); |
| 124 | 124 | mem.writeInt(u32, &tmp, @as(u32, @intCast(password.len)), .little); |
| 125 | 125 | b2.update(&tmp); |
| ... | ... | @@ -290,7 +290,7 @@ fn processSegment( |
| 290 | 290 | in[2] = slice; |
| 291 | 291 | in[3] = memory; |
| 292 | 292 | in[4] = passes; |
| 293 | in[5] = @intFromEnum(mode); | |
| 293 | in[5] = @backingInt(mode); | |
| 294 | 294 | } |
| 295 | 295 | var index: u32 = 0; |
| 296 | 296 | if (n == 0 and slice == 0) { |
lib/std/crypto/codecs/asn1.zig+6-6| ... | ... | @@ -86,14 +86,14 @@ pub const Tag = struct { |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | return Tag{ |
| 89 | .number = @enumFromInt(number), | |
| 89 | .number = @fromBackingInt(@intCast(number)), | |
| 90 | 90 | .constructed = tag1.constructed, |
| 91 | 91 | .class = tag1.class, |
| 92 | 92 | }; |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | pub fn encodeToSlice(self: Tag, buf: *[max_encoded_len]u8) []const u8 { |
| 96 | const n = @intFromEnum(self.number); | |
| 96 | const n = @backingInt(self.number); | |
| 97 | 97 | var tag1: FirstTag = .{ |
| 98 | 98 | .number = undefined, |
| 99 | 99 | .constructed = self.constructed, |
| ... | ... | @@ -175,7 +175,7 @@ test Tag { |
| 175 | 175 | const buf = [_]u8{0xa3}; |
| 176 | 176 | var reader: std.Io.Reader = .fixed(&buf); |
| 177 | 177 | const t = Tag.decode(&reader); |
| 178 | try std.testing.expectEqual(Tag.init(@enumFromInt(3), true, .context_specific), t); | |
| 178 | try std.testing.expectEqual(Tag.init(@fromBackingInt(@intCast(3)), true, .context_specific), t); | |
| 179 | 179 | } |
| 180 | 180 | |
| 181 | 181 | test "Tag.encode produces the exact bytes from X.690" { |
| ... | ... | @@ -190,7 +190,7 @@ test "Tag.encode produces the exact bytes from X.690" { |
| 190 | 190 | .{ .number = 65535, .expected = &.{ 0x1f, 0x83, 0xff, 0x7f } }, |
| 191 | 191 | }; |
| 192 | 192 | for (cases) |c| { |
| 193 | const tag = Tag.init(@enumFromInt(c.number), false, .universal); | |
| 193 | const tag = Tag.init(@fromBackingInt(@intCast(c.number)), false, .universal); | |
| 194 | 194 | var buf: [Tag.max_encoded_len]u8 = undefined; |
| 195 | 195 | try std.testing.expectEqualSlices(u8, c.expected, tag.encodeToSlice(&buf)); |
| 196 | 196 | } |
| ... | ... | @@ -198,7 +198,7 @@ test "Tag.encode produces the exact bytes from X.690" { |
| 198 | 198 | |
| 199 | 199 | test "Tag.encode/decode round trip" { |
| 200 | 200 | for ([_]u16{ 0, 30, 31, 32, 127, 128, 16383, 16384, 65535 }) |n| { |
| 201 | const tag = Tag.init(@enumFromInt(n), false, .universal); | |
| 201 | const tag = Tag.init(@fromBackingInt(@intCast(n)), false, .universal); | |
| 202 | 202 | var buf: [Tag.max_encoded_len]u8 = undefined; |
| 203 | 203 | const encoded = tag.encodeToSlice(&buf); |
| 204 | 204 | var reader: std.Io.Reader = .fixed(encoded); |
| ... | ... | @@ -346,7 +346,7 @@ pub const FieldTag = struct { |
| 346 | 346 | } |
| 347 | 347 | |
| 348 | 348 | pub fn toTag(self: FieldTag) Tag { |
| 349 | return Tag.init(@enumFromInt(self.number), self.explicit, self.class); | |
| 349 | return Tag.init(@fromBackingInt(@intCast(self.number)), self.explicit, self.class); | |
| 350 | 350 | } |
| 351 | 351 | }; |
| 352 | 352 |
lib/std/crypto/codecs/asn1/Oid.zig+1-1| ... | ... | @@ -191,7 +191,7 @@ pub fn StaticMap(comptime Enum: type) type { |
| 191 | 191 | @compileError("Field '" ++ f_name ++ "' missing Oid.StaticMap entry"); |
| 192 | 192 | } |
| 193 | 193 | const encoded = &encodeComptime(@field(key_pairs, f_name)); |
| 194 | const tag: Enum = @enumFromInt(f_value); | |
| 194 | const tag: Enum = @fromBackingInt(@intCast(f_value)); | |
| 195 | 195 | static_key_pairs[i] = .{ encoded, tag }; |
| 196 | 196 | enum_to_oid.set(tag, encoded); |
| 197 | 197 | }; |
lib/std/crypto/codecs/asn1/der/Decoder.zig+2-2| ... | ... | @@ -72,7 +72,7 @@ pub fn any(self: *Decoder, comptime T: type) !T { |
| 72 | 72 | if (@hasDecl(T, "oids")) { |
| 73 | 73 | return T.oids.oidToEnum(bytes) orelse return error.UnknownOid; |
| 74 | 74 | } |
| 75 | return @enumFromInt(try int(e.tag_type, bytes)); | |
| 75 | return @fromBackingInt(@intCast(try int(e.tag_type, bytes))); | |
| 76 | 76 | }, |
| 77 | 77 | .optional => |o| return self.any(o.child) catch return null, |
| 78 | 78 | else => @compileError("cannot decode type " ++ @typeName(T)), |
| ... | ... | @@ -94,7 +94,7 @@ pub fn element( |
| 94 | 94 | const res = try Element.decode(self.bytes, self.index); |
| 95 | 95 | var e = expected; |
| 96 | 96 | if (self.field_tag) |ft| { |
| 97 | e.number = @enumFromInt(ft.number); | |
| 97 | e.number = @fromBackingInt(@intCast(ft.number)); | |
| 98 | 98 | e.class = ft.class; |
| 99 | 99 | } |
| 100 | 100 | if (!e.match(res.tag)) { |
lib/std/crypto/codecs/asn1/der/Encoder.zig+2-2| ... | ... | @@ -68,7 +68,7 @@ fn anyTag(self: *Encoder, tag_: Tag, val: anytype) !void { |
| 68 | 68 | if (@hasDecl(T, "oids")) { |
| 69 | 69 | return self.any(T.oids.enumToOid(val)); |
| 70 | 70 | } else { |
| 71 | try self.int(e.tag_type, @intFromEnum(val)); | |
| 71 | try self.int(e.tag_type, @backingInt(val)); | |
| 72 | 72 | } |
| 73 | 73 | }, |
| 74 | 74 | .optional => if (val) |v| return try self.anyTag(tag_, v) else return, |
| ... | ... | @@ -91,7 +91,7 @@ fn mergedTag(self: *Encoder, tag_: Tag) Tag { |
| 91 | 91 | var res = tag_; |
| 92 | 92 | if (self.field_tag) |ft| { |
| 93 | 93 | if (!ft.explicit) { |
| 94 | res.number = @enumFromInt(ft.number); | |
| 94 | res.number = @fromBackingInt(@intCast(ft.number)); | |
| 95 | 95 | res.class = ft.class; |
| 96 | 96 | } |
| 97 | 97 | } |
lib/std/crypto/tls.zig+5-5| ... | ... | @@ -48,8 +48,8 @@ pub const hello_retry_request_sequence = [32]u8{ |
| 48 | 48 | }; |
| 49 | 49 | |
| 50 | 50 | pub const close_notify_alert = [_]u8{ |
| 51 | @intFromEnum(Alert.Level.warning), | |
| 52 | @intFromEnum(Alert.Description.close_notify), | |
| 51 | @backingInt(Alert.Level.warning), | |
| 52 | @backingInt(Alert.Description.close_notify), | |
| 53 | 53 | }; |
| 54 | 54 | |
| 55 | 55 | pub const ProtocolVersion = enum(u16) { |
| ... | ... | @@ -595,7 +595,7 @@ pub fn hmac(comptime Hmac: type, message: []const u8, key: [Hmac.key_length]u8) |
| 595 | 595 | } |
| 596 | 596 | |
| 597 | 597 | pub fn extension(et: ExtensionType, bytes: anytype) [2 + 2 + bytes.len]u8 { |
| 598 | return int(u16, @intFromEnum(et)) ++ array(u16, u8, bytes); | |
| 598 | return int(u16, @backingInt(et)) ++ array(u16, u8, bytes); | |
| 599 | 599 | } |
| 600 | 600 | |
| 601 | 601 | pub fn array( |
| ... | ... | @@ -614,7 +614,7 @@ pub fn array( |
| 614 | 614 | arr[len_size + elem_size * index ..][0..elem_size], |
| 615 | 615 | switch (@typeInfo(Elem)) { |
| 616 | 616 | .int => @as(Elem, elem), |
| 617 | .@"enum" => @intFromEnum(@as(Elem, elem)), | |
| 617 | .@"enum" => @backingInt(@as(Elem, elem)), | |
| 618 | 618 | else => @bitCast(@as(Elem, elem)), |
| 619 | 619 | }, |
| 620 | 620 | .big, |
| ... | ... | @@ -711,7 +711,7 @@ pub const Decoder = struct { |
| 711 | 711 | }, |
| 712 | 712 | .@"enum" => |info| { |
| 713 | 713 | if (info.mode == .exhaustive) @compileError("exhaustive enum cannot be used"); |
| 714 | return @enumFromInt(d.decode(info.tag_type)); | |
| 714 | return @fromBackingInt(@intCast(d.decode(info.tag_type))); | |
| 715 | 715 | }, |
| 716 | 716 | else => @compileError("unsupported type: " ++ @typeName(T)), |
| 717 | 717 | } |
lib/std/crypto/tls/Client.zig+36-36| ... | ... | @@ -237,16 +237,16 @@ pub fn init(input: *Reader, output: *Writer, options: Options) InitError!Client |
| 237 | 237 | })) ++ tls.extension(.key_share, array( |
| 238 | 238 | u16, |
| 239 | 239 | u8, |
| 240 | int(u16, @intFromEnum(tls.NamedGroup.x25519_ml_kem768)) ++ | |
| 240 | int(u16, @backingInt(tls.NamedGroup.x25519_ml_kem768)) ++ | |
| 241 | 241 | array(u16, u8, key_share.ml_kem768_kp.public_key.toBytes() ++ key_share.x25519_kp.public_key) ++ |
| 242 | int(u16, @intFromEnum(tls.NamedGroup.secp256r1)) ++ | |
| 242 | int(u16, @backingInt(tls.NamedGroup.secp256r1)) ++ | |
| 243 | 243 | array(u16, u8, key_share.secp256r1_kp.public_key.toUncompressedSec1()) ++ |
| 244 | int(u16, @intFromEnum(tls.NamedGroup.secp384r1)) ++ | |
| 244 | int(u16, @backingInt(tls.NamedGroup.secp384r1)) ++ | |
| 245 | 245 | array(u16, u8, key_share.secp384r1_kp.public_key.toUncompressedSec1()) ++ |
| 246 | int(u16, @intFromEnum(tls.NamedGroup.x25519)) ++ | |
| 246 | int(u16, @backingInt(tls.NamedGroup.x25519)) ++ | |
| 247 | 247 | array(u16, u8, key_share.x25519_kp.public_key), |
| 248 | 248 | )); |
| 249 | const server_name_extension = int(u16, @intFromEnum(tls.ExtensionType.server_name)) ++ | |
| 249 | const server_name_extension = int(u16, @backingInt(tls.ExtensionType.server_name)) ++ | |
| 250 | 250 | int(u16, 2 + 1 + 2 + host_len) ++ // byte length of this extension payload |
| 251 | 251 | int(u16, 1 + 2 + host_len) ++ // server_name_list byte count |
| 252 | 252 | .{0x00} ++ // name_type |
| ... | ... | @@ -262,19 +262,19 @@ pub fn init(input: *Reader, output: *Writer, options: Options) InitError!Client |
| 262 | 262 | server_name_extension; |
| 263 | 263 | |
| 264 | 264 | const client_hello = |
| 265 | int(u16, @intFromEnum(tls.ProtocolVersion.tls_1_2)) ++ | |
| 265 | int(u16, @backingInt(tls.ProtocolVersion.tls_1_2)) ++ | |
| 266 | 266 | client_hello_rand ++ |
| 267 | 267 | [1]u8{32} ++ legacy_session_id ++ |
| 268 | 268 | cipher_suites ++ |
| 269 | 269 | array(u8, tls.CompressionMethod, .{.null}) ++ |
| 270 | 270 | extensions_header; |
| 271 | 271 | |
| 272 | const out_handshake = .{@intFromEnum(tls.HandshakeType.client_hello)} ++ | |
| 272 | const out_handshake = .{@backingInt(tls.HandshakeType.client_hello)} ++ | |
| 273 | 273 | int(u24, @intCast(client_hello.len - server_name_extension.len + server_name_extension_len)) ++ |
| 274 | 274 | client_hello; |
| 275 | 275 | |
| 276 | const cleartext_header_buf = .{@intFromEnum(tls.ContentType.handshake)} ++ | |
| 277 | int(u16, @intFromEnum(tls.ProtocolVersion.tls_1_0)) ++ | |
| 276 | const cleartext_header_buf = .{@backingInt(tls.ContentType.handshake)} ++ | |
| 277 | int(u16, @backingInt(tls.ProtocolVersion.tls_1_0)) ++ | |
| 278 | 278 | int(u16, @intCast(out_handshake.len - server_name_extension.len + server_name_extension_len)) ++ |
| 279 | 279 | out_handshake; |
| 280 | 280 | const cleartext_header = switch (options.host) { |
| ... | ... | @@ -389,7 +389,7 @@ pub fn init(input: *Reader, output: *Writer, options: Options) InitError!Client |
| 389 | 389 | } |
| 390 | 390 | read_seq += 1; |
| 391 | 391 | cleartext_fragment_end -= 1; |
| 392 | const ct: tls.ContentType = @enumFromInt(cleartext_buf[cleartext_fragment_end]); | |
| 392 | const ct: tls.ContentType = @fromBackingInt(@intCast(cleartext_buf[cleartext_fragment_end])); | |
| 393 | 393 | if (ct != .handshake) return error.TlsUnexpectedMessage; |
| 394 | 394 | break :content .{ tls.Decoder.fromTheirSlice(@constCast(cleartext_buf[cleartext_fragment_start..cleartext_fragment_end])), ct }; |
| 395 | 395 | }, |
| ... | ... | @@ -495,7 +495,7 @@ pub fn init(input: *Reader, output: *Writer, options: Options) InitError!Client |
| 495 | 495 | } |
| 496 | 496 | } |
| 497 | 497 | |
| 498 | tls_version = @enumFromInt(supported_version orelse legacy_version); | |
| 498 | tls_version = @fromBackingInt(@intCast(supported_version orelse legacy_version)); | |
| 499 | 499 | switch (tls_version) { |
| 500 | 500 | .tls_1_3 => if (!mem.eql(u8, legacy_session_id_echo, &legacy_session_id)) return error.TlsIllegalParameter, |
| 501 | 501 | .tls_1_2 => if (mem.eql(u8, server_hello_rand[24..31], "DOWNGRD") and |
| ... | ... | @@ -739,14 +739,14 @@ pub fn init(input: *Reader, output: *Writer, options: Options) InitError!Client |
| 739 | 739 | else => return error.TlsIllegalParameter, |
| 740 | 740 | }; |
| 741 | 741 | |
| 742 | const client_key_exchange_prefix = .{@intFromEnum(tls.ContentType.handshake)} ++ | |
| 743 | int(u16, @intFromEnum(tls.ProtocolVersion.tls_1_2)) ++ | |
| 742 | const client_key_exchange_prefix = .{@backingInt(tls.ContentType.handshake)} ++ | |
| 743 | int(u16, @backingInt(tls.ProtocolVersion.tls_1_2)) ++ | |
| 744 | 744 | int(u16, @intCast(public_key_bytes.len + 5)) ++ // record length |
| 745 | .{@intFromEnum(tls.HandshakeType.client_key_exchange)} ++ | |
| 745 | .{@backingInt(tls.HandshakeType.client_key_exchange)} ++ | |
| 746 | 746 | int(u24, @intCast(public_key_bytes.len + 1)) ++ // handshake message length |
| 747 | 747 | .{@as(u8, @intCast(public_key_bytes.len))}; // public key length |
| 748 | const client_change_cipher_spec_msg = .{@intFromEnum(tls.ContentType.change_cipher_spec)} ++ | |
| 749 | int(u16, @intFromEnum(tls.ProtocolVersion.tls_1_2)) ++ | |
| 748 | const client_change_cipher_spec_msg = .{@backingInt(tls.ContentType.change_cipher_spec)} ++ | |
| 749 | int(u16, @backingInt(tls.ProtocolVersion.tls_1_2)) ++ | |
| 750 | 750 | array(u16, tls.ChangeCipherSpecType, .{.change_cipher_spec}); |
| 751 | 751 | const pre_master_secret = key_share.getSharedSecret().?; |
| 752 | 752 | switch (handshake_cipher) { |
| ... | ... | @@ -771,7 +771,7 @@ pub fn init(input: *Reader, output: *Writer, options: Options) InitError!Client |
| 771 | 771 | &.{ "key expansion", &server_hello_rand, &client_hello_rand }, |
| 772 | 772 | @sizeOf(P.Tls_1_2), |
| 773 | 773 | ); |
| 774 | const client_verify_cleartext = .{@intFromEnum(tls.HandshakeType.finished)} ++ | |
| 774 | const client_verify_cleartext = .{@backingInt(tls.HandshakeType.finished)} ++ | |
| 775 | 775 | array(u24, u8, hmacExpandLabel( |
| 776 | 776 | P.Hmac, |
| 777 | 777 | &master_secret, |
| ... | ... | @@ -795,8 +795,8 @@ pub fn init(input: *Reader, output: *Writer, options: Options) InitError!Client |
| 795 | 795 | const operand: V = pad ++ @as([8]u8, @bitCast(@byteSwap(write_seq))); |
| 796 | 796 | break :nonce @as(V, pv.app_cipher.client_write_IV ++ pv.app_cipher.client_salt) ^ operand; |
| 797 | 797 | }; |
| 798 | var client_verify_msg = .{@intFromEnum(tls.ContentType.handshake)} ++ | |
| 799 | int(u16, @intFromEnum(tls.ProtocolVersion.tls_1_2)) ++ | |
| 798 | var client_verify_msg = .{@backingInt(tls.ContentType.handshake)} ++ | |
| 799 | int(u16, @backingInt(tls.ProtocolVersion.tls_1_2)) ++ | |
| 800 | 800 | array(u16, u8, nonce[P.fixed_iv_length..].* ++ |
| 801 | 801 | @as([client_verify_cleartext.len + P.mac_length]u8, undefined)); |
| 802 | 802 | P.AEAD.encrypt( |
| ... | ... | @@ -846,8 +846,8 @@ pub fn init(input: *Reader, output: *Writer, options: Options) InitError!Client |
| 846 | 846 | if (cipher_state == .cleartext) return error.TlsUnexpectedMessage; |
| 847 | 847 | if (handshake_state != .finished) return error.TlsUnexpectedMessage; |
| 848 | 848 | // This message is to trick buggy proxies into behaving correctly. |
| 849 | const client_change_cipher_spec_msg = .{@intFromEnum(tls.ContentType.change_cipher_spec)} ++ | |
| 850 | int(u16, @intFromEnum(tls.ProtocolVersion.tls_1_2)) ++ | |
| 849 | const client_change_cipher_spec_msg = .{@backingInt(tls.ContentType.change_cipher_spec)} ++ | |
| 850 | int(u16, @backingInt(tls.ProtocolVersion.tls_1_2)) ++ | |
| 851 | 851 | array(u16, tls.ChangeCipherSpecType, .{.change_cipher_spec}); |
| 852 | 852 | const app_cipher = app_cipher: switch (handshake_cipher) { |
| 853 | 853 | inline else => |*p, tag| switch (tls_version) { |
| ... | ... | @@ -861,14 +861,14 @@ pub fn init(input: *Reader, output: *Writer, options: Options) InitError!Client |
| 861 | 861 | if (!std.crypto.timing_safe.eql([P.Hmac.mac_length]u8, expected_server_verify_data, hsd.array(P.Hmac.mac_length).*)) return error.TlsDecryptError; |
| 862 | 862 | const handshake_hash = p.transcript_hash.finalResult(); |
| 863 | 863 | const verify_data = tls.hmac(P.Hmac, &handshake_hash, pv.client_finished_key); |
| 864 | const out_cleartext = .{@intFromEnum(tls.HandshakeType.finished)} ++ | |
| 864 | const out_cleartext = .{@backingInt(tls.HandshakeType.finished)} ++ | |
| 865 | 865 | array(u24, u8, verify_data) ++ |
| 866 | .{@intFromEnum(tls.ContentType.handshake)}; | |
| 866 | .{@backingInt(tls.ContentType.handshake)}; | |
| 867 | 867 | |
| 868 | 868 | const wrapped_len = out_cleartext.len + P.AEAD.tag_length; |
| 869 | 869 | |
| 870 | var finished_msg = .{@intFromEnum(tls.ContentType.application_data)} ++ | |
| 871 | int(u16, @intFromEnum(tls.ProtocolVersion.tls_1_2)) ++ | |
| 870 | var finished_msg = .{@backingInt(tls.ContentType.application_data)} ++ | |
| 871 | int(u16, @backingInt(tls.ProtocolVersion.tls_1_2)) ++ | |
| 872 | 872 | array(u16, u8, @as([wrapped_len]u8, undefined)); |
| 873 | 873 | |
| 874 | 874 | const ad = finished_msg[0..tls.record_header_len]; |
| ... | ... | @@ -1051,14 +1051,14 @@ fn prepareCiphertextRecord( |
| 1051 | 1051 | }; |
| 1052 | 1052 | |
| 1053 | 1053 | @memcpy(cleartext_buf[0..encrypted_content_len], bytes[bytes_i..][0..encrypted_content_len]); |
| 1054 | cleartext_buf[encrypted_content_len] = @intFromEnum(inner_content_type); | |
| 1054 | cleartext_buf[encrypted_content_len] = @backingInt(inner_content_type); | |
| 1055 | 1055 | bytes_i += encrypted_content_len; |
| 1056 | 1056 | const ciphertext_len = encrypted_content_len + 1; |
| 1057 | 1057 | const cleartext = cleartext_buf[0..ciphertext_len]; |
| 1058 | 1058 | |
| 1059 | 1059 | const ad = ciphertext_buf[ciphertext_end..][0..tls.record_header_len]; |
| 1060 | ad.* = .{@intFromEnum(tls.ContentType.application_data)} ++ | |
| 1061 | int(u16, @intFromEnum(tls.ProtocolVersion.tls_1_2)) ++ | |
| 1060 | ad.* = .{@backingInt(tls.ContentType.application_data)} ++ | |
| 1061 | int(u16, @backingInt(tls.ProtocolVersion.tls_1_2)) ++ | |
| 1062 | 1062 | int(u16, ciphertext_len + P.AEAD.tag_length); |
| 1063 | 1063 | ciphertext_end += ad.len; |
| 1064 | 1064 | const ciphertext = ciphertext_buf[ciphertext_end..][0..ciphertext_len]; |
| ... | ... | @@ -1096,8 +1096,8 @@ fn prepareCiphertextRecord( |
| 1096 | 1096 | |
| 1097 | 1097 | const record_header = ciphertext_buf[ciphertext_end..][0..tls.record_header_len]; |
| 1098 | 1098 | ciphertext_end += tls.record_header_len; |
| 1099 | record_header.* = .{@intFromEnum(inner_content_type)} ++ | |
| 1100 | int(u16, @intFromEnum(tls.ProtocolVersion.tls_1_2)) ++ | |
| 1099 | record_header.* = .{@backingInt(inner_content_type)} ++ | |
| 1100 | int(u16, @backingInt(tls.ProtocolVersion.tls_1_2)) ++ | |
| 1101 | 1101 | int(u16, P.record_iv_length + message_len + P.mac_length); |
| 1102 | 1102 | const ad = mem.toBytes(big(c.write_seq)) ++ record_header[0 .. 1 + 2] ++ int(u16, message_len); |
| 1103 | 1103 | const record_iv = ciphertext_buf[ciphertext_end..][0..P.record_iv_length]; |
| ... | ... | @@ -1160,7 +1160,7 @@ fn readIndirect(c: *Client) Reader.Error!usize { |
| 1160 | 1160 | }, |
| 1161 | 1161 | error.ReadFailed => |e| return e, |
| 1162 | 1162 | }; |
| 1163 | const ct: tls.ContentType = @enumFromInt(record_header[0]); | |
| 1163 | const ct: tls.ContentType = @fromBackingInt(@intCast(record_header[0])); | |
| 1164 | 1164 | const legacy_version = mem.readInt(u16, record_header[1..][0..2], .big); |
| 1165 | 1165 | _ = legacy_version; |
| 1166 | 1166 | const record_len = mem.readInt(u16, record_header[3..][0..2], .big); |
| ... | ... | @@ -1197,7 +1197,7 @@ fn readIndirect(c: *Client) Reader.Error!usize { |
| 1197 | 1197 | // TODO use scalar, non-slice version |
| 1198 | 1198 | const msg = mem.trimEnd(u8, cleartext, "\x00"); |
| 1199 | 1199 | if (msg.len == 0) return failRead(c, error.TlsDecodeError); |
| 1200 | break :cleartext .{ msg.len - 1, @enumFromInt(msg[msg.len - 1]) }; | |
| 1200 | break :cleartext .{ msg.len - 1, @fromBackingInt(@intCast(msg[msg.len - 1])) }; | |
| 1201 | 1201 | }, |
| 1202 | 1202 | .tls_1_2 => { |
| 1203 | 1203 | const pv = &p.tls_1_2; |
| ... | ... | @@ -1234,8 +1234,8 @@ fn readIndirect(c: *Client) Reader.Error!usize { |
| 1234 | 1234 | .alert => { |
| 1235 | 1235 | if (cleartext.len != 2) return failRead(c, error.TlsDecodeError); |
| 1236 | 1236 | const alert: tls.Alert = .{ |
| 1237 | .level = @enumFromInt(cleartext[0]), | |
| 1238 | .description = @enumFromInt(cleartext[1]), | |
| 1237 | .level = @fromBackingInt(@intCast(cleartext[0])), | |
| 1238 | .description = @fromBackingInt(@intCast(cleartext[1])), | |
| 1239 | 1239 | }; |
| 1240 | 1240 | switch (alert.description) { |
| 1241 | 1241 | .close_notify => { |
| ... | ... | @@ -1255,7 +1255,7 @@ fn readIndirect(c: *Client) Reader.Error!usize { |
| 1255 | 1255 | .handshake => { |
| 1256 | 1256 | var ct_i: usize = 0; |
| 1257 | 1257 | while (true) { |
| 1258 | const handshake_type: tls.HandshakeType = @enumFromInt(cleartext[ct_i]); | |
| 1258 | const handshake_type: tls.HandshakeType = @fromBackingInt(@intCast(cleartext[ct_i])); | |
| 1259 | 1259 | ct_i += 1; |
| 1260 | 1260 | const handshake_len = mem.readInt(u24, cleartext[ct_i..][0..3], .big); |
| 1261 | 1261 | ct_i += 3; |
| ... | ... | @@ -1286,7 +1286,7 @@ fn readIndirect(c: *Client) Reader.Error!usize { |
| 1286 | 1286 | } |
| 1287 | 1287 | c.read_seq = 0; |
| 1288 | 1288 | |
| 1289 | switch (@as(tls.KeyUpdateRequest, @enumFromInt(handshake[0]))) { | |
| 1289 | switch (@as(tls.KeyUpdateRequest, @fromBackingInt(@intCast(handshake[0])))) { | |
| 1290 | 1290 | .update_requested => { |
| 1291 | 1291 | switch (c.application_cipher) { |
| 1292 | 1292 | inline else => |*p| { |
lib/std/debug.zig+1-1| ... | ... | @@ -844,7 +844,7 @@ pub fn writeErrorReturnTrace(et: *const std.builtin.StackTrace, t: Io.Terminal) |
| 844 | 844 | // writing the stack trace. |
| 845 | 845 | const len = @min(et.instruction_addresses.len, et.index); |
| 846 | 846 | const skipped = et.index - len; |
| 847 | try writeTrace(et.instruction_addresses[0..len], @enumFromInt(skipped), t, false); | |
| 847 | try writeTrace(et.instruction_addresses[0..len], @fromBackingInt(@intCast(skipped)), t, false); | |
| 848 | 848 | } |
| 849 | 849 | |
| 850 | 850 | /// Write a previously captured stack trace to `writer`, annotated with source locations. |
lib/std/debug/Coverage.zig+12-12| ... | ... | @@ -41,13 +41,13 @@ pub const String = enum(u32) { |
| 41 | 41 | |
| 42 | 42 | pub fn eql(self: @This(), a: String, b: String, b_index: usize) bool { |
| 43 | 43 | _ = b_index; |
| 44 | const a_slice = span(self.string_bytes[@intFromEnum(a)..]); | |
| 45 | const b_slice = span(self.string_bytes[@intFromEnum(b)..]); | |
| 44 | const a_slice = span(self.string_bytes[@backingInt(a)..]); | |
| 45 | const b_slice = span(self.string_bytes[@backingInt(b)..]); | |
| 46 | 46 | return std.mem.eql(u8, a_slice, b_slice); |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | pub fn hash(self: @This(), a: String) u32 { |
| 50 | return @truncate(Hash.hash(0, span(self.string_bytes[@intFromEnum(a)..]))); | |
| 50 | return @truncate(Hash.hash(0, span(self.string_bytes[@backingInt(a)..]))); | |
| 51 | 51 | } |
| 52 | 52 | }; |
| 53 | 53 | |
| ... | ... | @@ -56,7 +56,7 @@ pub const String = enum(u32) { |
| 56 | 56 | |
| 57 | 57 | pub fn eql(self: @This(), a_slice: []const u8, b: String, b_index: usize) bool { |
| 58 | 58 | _ = b_index; |
| 59 | const b_slice = span(self.string_bytes[@intFromEnum(b)..]); | |
| 59 | const b_slice = span(self.string_bytes[@backingInt(b)..]); | |
| 60 | 60 | return std.mem.eql(u8, a_slice, b_slice); |
| 61 | 61 | } |
| 62 | 62 | pub fn hash(self: @This(), a: []const u8) u32 { |
| ... | ... | @@ -91,15 +91,15 @@ pub const File = extern struct { |
| 91 | 91 | string_bytes: []const u8, |
| 92 | 92 | |
| 93 | 93 | pub fn hash(self: MapContext, a: File) u32 { |
| 94 | const a_basename = span(self.string_bytes[@intFromEnum(a.basename)..]); | |
| 94 | const a_basename = span(self.string_bytes[@backingInt(a.basename)..]); | |
| 95 | 95 | return @truncate(Hash.hash(a.directory_index, a_basename)); |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | pub fn eql(self: MapContext, a: File, b: File, b_index: usize) bool { |
| 99 | 99 | _ = b_index; |
| 100 | 100 | if (a.directory_index != b.directory_index) return false; |
| 101 | const a_basename = span(self.string_bytes[@intFromEnum(a.basename)..]); | |
| 102 | const b_basename = span(self.string_bytes[@intFromEnum(b.basename)..]); | |
| 101 | const a_basename = span(self.string_bytes[@backingInt(a.basename)..]); | |
| 102 | const b_basename = span(self.string_bytes[@backingInt(b.basename)..]); | |
| 103 | 103 | return std.mem.eql(u8, a_basename, b_basename); |
| 104 | 104 | } |
| 105 | 105 | }; |
| ... | ... | @@ -120,7 +120,7 @@ pub const File = extern struct { |
| 120 | 120 | pub fn eql(self: @This(), a: Entry, b: File, b_index: usize) bool { |
| 121 | 121 | _ = b_index; |
| 122 | 122 | if (a.directory_index != b.directory_index) return false; |
| 123 | const b_basename = span(self.string_bytes[@intFromEnum(b.basename)..]); | |
| 123 | const b_basename = span(self.string_bytes[@backingInt(b.basename)..]); | |
| 124 | 124 | return std.mem.eql(u8, a.basename, b_basename); |
| 125 | 125 | } |
| 126 | 126 | }; |
| ... | ... | @@ -134,11 +134,11 @@ pub fn deinit(cov: *Coverage, gpa: Allocator) void { |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | pub fn fileAt(cov: *Coverage, index: File.Index) *File { |
| 137 | return &cov.files.keys()[@intFromEnum(index)]; | |
| 137 | return &cov.files.keys()[@backingInt(index)]; | |
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | pub fn stringAt(cov: *Coverage, index: String) [:0]const u8 { |
| 141 | return span(cov.string_bytes.items[@intFromEnum(index)..]); | |
| 141 | return span(cov.string_bytes.items[@backingInt(index)..]); | |
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | pub const ResolveAddressesDwarfError = Dwarf.ScanError || Io.Cancelable; |
| ... | ... | @@ -232,7 +232,7 @@ pub fn resolveAddressesDwarf( |
| 232 | 232 | .basename = addStringAssumeCapacity(cov, file_entry.path), |
| 233 | 233 | }; |
| 234 | 234 | out.* = .{ |
| 235 | .file = @enumFromInt(file_gop.index), | |
| 235 | .file = @fromBackingInt(@intCast(file_gop.index)), | |
| 236 | 236 | .line = entry.line, |
| 237 | 237 | .column = entry.column, |
| 238 | 238 | }; |
| ... | ... | @@ -240,7 +240,7 @@ pub fn resolveAddressesDwarf( |
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | pub fn addStringAssumeCapacity(cov: *Coverage, s: []const u8) String { |
| 243 | const result: String = @enumFromInt(cov.string_bytes.items.len); | |
| 243 | const result: String = @fromBackingInt(@intCast(cov.string_bytes.items.len)); | |
| 244 | 244 | cov.string_bytes.appendSliceAssumeCapacity(s); |
| 245 | 245 | cov.string_bytes.appendAssumeCapacity(0); |
| 246 | 246 | return result; |
lib/std/debug/Dwarf.zig+1-1| ... | ... | @@ -323,7 +323,7 @@ const Func = struct { |
| 323 | 323 | }; |
| 324 | 324 | |
| 325 | 325 | pub fn section(di: Dwarf, dwarf_section: Section.Id) ?[]const u8 { |
| 326 | return if (di.sections[@intFromEnum(dwarf_section)]) |s| s.data else null; | |
| 326 | return if (di.sections[@backingInt(dwarf_section)]) |s| s.data else null; | |
| 327 | 327 | } |
| 328 | 328 | |
| 329 | 329 | pub fn deinit(di: *Dwarf, gpa: Allocator) void { |
lib/std/debug/Dwarf/Unwind/VirtualMachine.zig+1-1| ... | ... | @@ -459,7 +459,7 @@ pub const Instruction = union(enum) { |
| 459 | 459 | .def_cfa_offset_sf => .{ .def_cfa_offset_sf = try reader.takeLeb128(i64) }, |
| 460 | 460 | .def_cfa_expression => .{ .def_cfa_expr = try reader.takeLeb128(usize) }, |
| 461 | 461 | |
| 462 | _ => switch (@intFromEnum(inst.low.extended)) { | |
| 462 | _ => switch (@backingInt(inst.low.extended)) { | |
| 463 | 463 | 0x1C...0x3F => return error.UnimplementedUserOpcode, |
| 464 | 464 | else => return error.InvalidOpcode, |
| 465 | 465 | }, |
lib/std/debug/ElfFile.zig+1-1| ... | ... | @@ -504,7 +504,7 @@ fn loadInner( |
| 504 | 504 | @typeInfo(Section.Id).@"enum".field_values, |
| 505 | 505 | ) |s_name, s_value| { |
| 506 | 506 | if (std.mem.eql(u8, "." ++ s_name, name)) { |
| 507 | break @enumFromInt(s_value); | |
| 507 | break @fromBackingInt(@intCast(s_value)); | |
| 508 | 508 | } |
| 509 | 509 | } else continue; |
| 510 | 510 |
lib/std/debug/MachOFile.zig+4-4| ... | ... | @@ -516,10 +516,10 @@ fn loadOFile(gpa: Allocator, io: Io, o_file_name: []const u8) !OFile { |
| 516 | 516 | }; |
| 517 | 517 | } |
| 518 | 518 | |
| 519 | if (sections[@intFromEnum(Dwarf.Section.Id.debug_info)] == null or | |
| 520 | sections[@intFromEnum(Dwarf.Section.Id.debug_abbrev)] == null or | |
| 521 | sections[@intFromEnum(Dwarf.Section.Id.debug_str)] == null or | |
| 522 | sections[@intFromEnum(Dwarf.Section.Id.debug_line)] == null) | |
| 519 | if (sections[@backingInt(Dwarf.Section.Id.debug_info)] == null or | |
| 520 | sections[@backingInt(Dwarf.Section.Id.debug_abbrev)] == null or | |
| 521 | sections[@backingInt(Dwarf.Section.Id.debug_str)] == null or | |
| 522 | sections[@backingInt(Dwarf.Section.Id.debug_line)] == null) | |
| 523 | 523 | { |
| 524 | 524 | return error.MissingDebugInfo; |
| 525 | 525 | } |
lib/std/debug/Pdb.zig+3-3| ... | ... | @@ -935,7 +935,7 @@ pub fn getStreamById(self: *Pdb, id: u32) ?*MsfStream { |
| 935 | 935 | } |
| 936 | 936 | |
| 937 | 937 | pub fn getStream(self: *Pdb, stream: pdb.StreamType) ?*MsfStream { |
| 938 | const id = @intFromEnum(stream); | |
| 938 | const id = @backingInt(stream); | |
| 939 | 939 | return self.getStreamById(id); |
| 940 | 940 | } |
| 941 | 941 | |
| ... | ... | @@ -1078,7 +1078,7 @@ const MsfStream = struct { |
| 1078 | 1078 | return error.ReadFailed; |
| 1079 | 1079 | }; |
| 1080 | 1080 | |
| 1081 | var remaining = @intFromEnum(limit); | |
| 1081 | var remaining = @backingInt(limit); | |
| 1082 | 1082 | while (remaining != 0) { |
| 1083 | 1083 | const stream_len: usize = @min(remaining, ms.block_size - offset); |
| 1084 | 1084 | const n = try ms.file_reader.interface.stream(w, .limited(stream_len)); |
| ... | ... | @@ -1098,7 +1098,7 @@ const MsfStream = struct { |
| 1098 | 1098 | } |
| 1099 | 1099 | } |
| 1100 | 1100 | |
| 1101 | const total = @intFromEnum(limit) - remaining; | |
| 1101 | const total = @backingInt(limit) - remaining; | |
| 1102 | 1102 | ms.next_read_pos += total; |
| 1103 | 1103 | return total; |
| 1104 | 1104 | } |
lib/std/dynamic_library.zig+1-1| ... | ... | @@ -530,7 +530,7 @@ fn checkver(def_arg: *elf.Verdef, vsym_arg: elf.Versym, vername: []const u8, str |
| 530 | 530 | var def = def_arg; |
| 531 | 531 | const vsym_index = vsym_arg.VERSION; |
| 532 | 532 | while (true) { |
| 533 | if (0 == (def.flags & elf.VER_FLG_BASE) and @intFromEnum(def.ndx) == vsym_index) break; | |
| 533 | if (0 == (def.flags & elf.VER_FLG_BASE) and @backingInt(def.ndx) == vsym_index) break; | |
| 534 | 534 | if (def.next == 0) return false; |
| 535 | 535 | def = @ptrFromInt(@intFromPtr(def) + def.next); |
| 536 | 536 | } |
lib/std/elf.zig+125-125| ... | ... | @@ -268,8 +268,8 @@ pub const Versym = packed struct(u16) { |
| 268 | 268 | VERSION: u15, |
| 269 | 269 | HIDDEN: bool, |
| 270 | 270 | |
| 271 | pub const LOCAL: Versym = @bitCast(@intFromEnum(VER_NDX.LOCAL)); | |
| 272 | pub const GLOBAL: Versym = @bitCast(@intFromEnum(VER_NDX.GLOBAL)); | |
| 271 | pub const LOCAL: Versym = @bitCast(@backingInt(VER_NDX.LOCAL)); | |
| 272 | pub const GLOBAL: Versym = @bitCast(@backingInt(VER_NDX.GLOBAL)); | |
| 273 | 273 | }; |
| 274 | 274 | |
| 275 | 275 | pub const VER_NDX = enum(u16) { |
| ... | ... | @@ -291,178 +291,178 @@ pub const VER_FLG_BASE = 1; |
| 291 | 291 | pub const VER_FLG_WEAK = 2; |
| 292 | 292 | |
| 293 | 293 | /// Deprecated, use `@intFromEnum(std.elf.PT.NULL)` |
| 294 | pub const PT_NULL = @intFromEnum(std.elf.PT.NULL); | |
| 294 | pub const PT_NULL = @backingInt(std.elf.PT.NULL); | |
| 295 | 295 | /// Deprecated, use `@intFromEnum(std.elf.PT.LOAD)` |
| 296 | pub const PT_LOAD = @intFromEnum(std.elf.PT.LOAD); | |
| 296 | pub const PT_LOAD = @backingInt(std.elf.PT.LOAD); | |
| 297 | 297 | /// Deprecated, use `@intFromEnum(std.elf.PT.DYNAMIC)` |
| 298 | pub const PT_DYNAMIC = @intFromEnum(std.elf.PT.DYNAMIC); | |
| 298 | pub const PT_DYNAMIC = @backingInt(std.elf.PT.DYNAMIC); | |
| 299 | 299 | /// Deprecated, use `@intFromEnum(std.elf.PT.INTERP)` |
| 300 | pub const PT_INTERP = @intFromEnum(std.elf.PT.INTERP); | |
| 300 | pub const PT_INTERP = @backingInt(std.elf.PT.INTERP); | |
| 301 | 301 | /// Deprecated, use `@intFromEnum(std.elf.PT.NOTE)` |
| 302 | pub const PT_NOTE = @intFromEnum(std.elf.PT.NOTE); | |
| 302 | pub const PT_NOTE = @backingInt(std.elf.PT.NOTE); | |
| 303 | 303 | /// Deprecated, use `@intFromEnum(std.elf.PT.SHLIB)` |
| 304 | pub const PT_SHLIB = @intFromEnum(std.elf.PT.SHLIB); | |
| 304 | pub const PT_SHLIB = @backingInt(std.elf.PT.SHLIB); | |
| 305 | 305 | /// Deprecated, use `@intFromEnum(std.elf.PT.PHDR)` |
| 306 | pub const PT_PHDR = @intFromEnum(std.elf.PT.PHDR); | |
| 306 | pub const PT_PHDR = @backingInt(std.elf.PT.PHDR); | |
| 307 | 307 | /// Deprecated, use `@intFromEnum(std.elf.PT.TLS)` |
| 308 | pub const PT_TLS = @intFromEnum(std.elf.PT.TLS); | |
| 308 | pub const PT_TLS = @backingInt(std.elf.PT.TLS); | |
| 309 | 309 | /// Deprecated, use `std.elf.PT.NUM`. |
| 310 | 310 | pub const PT_NUM = PT.NUM; |
| 311 | 311 | /// Deprecated, use `@intFromEnum(std.elf.PT.LOOS)` |
| 312 | pub const PT_LOOS = @intFromEnum(std.elf.PT.LOOS); | |
| 312 | pub const PT_LOOS = @backingInt(std.elf.PT.LOOS); | |
| 313 | 313 | /// Deprecated, use `@intFromEnum(std.elf.PT.GNU_EH_FRAME)` |
| 314 | pub const PT_GNU_EH_FRAME = @intFromEnum(std.elf.PT.GNU_EH_FRAME); | |
| 314 | pub const PT_GNU_EH_FRAME = @backingInt(std.elf.PT.GNU_EH_FRAME); | |
| 315 | 315 | /// Deprecated, use `@intFromEnum(std.elf.PT.GNU_STACK)` |
| 316 | pub const PT_GNU_STACK = @intFromEnum(std.elf.PT.GNU_STACK); | |
| 316 | pub const PT_GNU_STACK = @backingInt(std.elf.PT.GNU_STACK); | |
| 317 | 317 | /// Deprecated, use `@intFromEnum(std.elf.PT.GNU_RELRO)` |
| 318 | pub const PT_GNU_RELRO = @intFromEnum(std.elf.PT.GNU_RELRO); | |
| 318 | pub const PT_GNU_RELRO = @backingInt(std.elf.PT.GNU_RELRO); | |
| 319 | 319 | /// Deprecated, use `@intFromEnum(std.elf.PT.LOSUNW)` |
| 320 | pub const PT_LOSUNW = @intFromEnum(std.elf.PT.LOSUNW); | |
| 320 | pub const PT_LOSUNW = @backingInt(std.elf.PT.LOSUNW); | |
| 321 | 321 | /// Deprecated, use `@intFromEnum(std.elf.PT.SUNWBSS)` |
| 322 | pub const PT_SUNWBSS = @intFromEnum(std.elf.PT.SUNWBSS); | |
| 322 | pub const PT_SUNWBSS = @backingInt(std.elf.PT.SUNWBSS); | |
| 323 | 323 | /// Deprecated, use `@intFromEnum(std.elf.PT.SUNWSTACK)` |
| 324 | pub const PT_SUNWSTACK = @intFromEnum(std.elf.PT.SUNWSTACK); | |
| 324 | pub const PT_SUNWSTACK = @backingInt(std.elf.PT.SUNWSTACK); | |
| 325 | 325 | /// Deprecated, use `@intFromEnum(std.elf.PT.HISUNW)` |
| 326 | pub const PT_HISUNW = @intFromEnum(std.elf.PT.HISUNW); | |
| 326 | pub const PT_HISUNW = @backingInt(std.elf.PT.HISUNW); | |
| 327 | 327 | /// Deprecated, use `@intFromEnum(std.elf.PT.HIOS)` |
| 328 | pub const PT_HIOS = @intFromEnum(std.elf.PT.HIOS); | |
| 328 | pub const PT_HIOS = @backingInt(std.elf.PT.HIOS); | |
| 329 | 329 | /// Deprecated, use `@intFromEnum(std.elf.PT.LOPROC)` |
| 330 | pub const PT_LOPROC = @intFromEnum(std.elf.PT.LOPROC); | |
| 330 | pub const PT_LOPROC = @backingInt(std.elf.PT.LOPROC); | |
| 331 | 331 | /// Deprecated, use `@intFromEnum(std.elf.PT.HIPROC)` |
| 332 | pub const PT_HIPROC = @intFromEnum(std.elf.PT.HIPROC); | |
| 332 | pub const PT_HIPROC = @backingInt(std.elf.PT.HIPROC); | |
| 333 | 333 | |
| 334 | 334 | pub const PN_XNUM = 0xffff; |
| 335 | 335 | |
| 336 | 336 | /// Deprecated, use `@intFromEnum(std.elf.SHT.NULL)` |
| 337 | pub const SHT_NULL = @intFromEnum(std.elf.SHT.NULL); | |
| 337 | pub const SHT_NULL = @backingInt(std.elf.SHT.NULL); | |
| 338 | 338 | /// Deprecated, use `@intFromEnum(std.elf.SHT.PROGBITS)` |
| 339 | pub const SHT_PROGBITS = @intFromEnum(std.elf.SHT.PROGBITS); | |
| 339 | pub const SHT_PROGBITS = @backingInt(std.elf.SHT.PROGBITS); | |
| 340 | 340 | /// Deprecated, use `@intFromEnum(std.elf.SHT.SYMTAB)` |
| 341 | pub const SHT_SYMTAB = @intFromEnum(std.elf.SHT.SYMTAB); | |
| 341 | pub const SHT_SYMTAB = @backingInt(std.elf.SHT.SYMTAB); | |
| 342 | 342 | /// Deprecated, use `@intFromEnum(std.elf.SHT.STRTAB)` |
| 343 | pub const SHT_STRTAB = @intFromEnum(std.elf.SHT.STRTAB); | |
| 343 | pub const SHT_STRTAB = @backingInt(std.elf.SHT.STRTAB); | |
| 344 | 344 | /// Deprecated, use `@intFromEnum(std.elf.SHT.RELA)` |
| 345 | pub const SHT_RELA = @intFromEnum(std.elf.SHT.RELA); | |
| 345 | pub const SHT_RELA = @backingInt(std.elf.SHT.RELA); | |
| 346 | 346 | /// Deprecated, use `@intFromEnum(std.elf.SHT.HASH)` |
| 347 | pub const SHT_HASH = @intFromEnum(std.elf.SHT.HASH); | |
| 347 | pub const SHT_HASH = @backingInt(std.elf.SHT.HASH); | |
| 348 | 348 | /// Deprecated, use `@intFromEnum(std.elf.SHT.DYNAMIC)` |
| 349 | pub const SHT_DYNAMIC = @intFromEnum(std.elf.SHT.DYNAMIC); | |
| 349 | pub const SHT_DYNAMIC = @backingInt(std.elf.SHT.DYNAMIC); | |
| 350 | 350 | /// Deprecated, use `@intFromEnum(std.elf.SHT.NOTE)` |
| 351 | pub const SHT_NOTE = @intFromEnum(std.elf.SHT.NOTE); | |
| 351 | pub const SHT_NOTE = @backingInt(std.elf.SHT.NOTE); | |
| 352 | 352 | /// Deprecated, use `@intFromEnum(std.elf.SHT.NOBITS)` |
| 353 | pub const SHT_NOBITS = @intFromEnum(std.elf.SHT.NOBITS); | |
| 353 | pub const SHT_NOBITS = @backingInt(std.elf.SHT.NOBITS); | |
| 354 | 354 | /// Deprecated, use `@intFromEnum(std.elf.SHT.REL)` |
| 355 | pub const SHT_REL = @intFromEnum(std.elf.SHT.REL); | |
| 355 | pub const SHT_REL = @backingInt(std.elf.SHT.REL); | |
| 356 | 356 | /// Deprecated, use `@intFromEnum(std.elf.SHT.SHLIB)` |
| 357 | pub const SHT_SHLIB = @intFromEnum(std.elf.SHT.SHLIB); | |
| 357 | pub const SHT_SHLIB = @backingInt(std.elf.SHT.SHLIB); | |
| 358 | 358 | /// Deprecated, use `@intFromEnum(std.elf.SHT.DYNSYM)` |
| 359 | pub const SHT_DYNSYM = @intFromEnum(std.elf.SHT.DYNSYM); | |
| 359 | pub const SHT_DYNSYM = @backingInt(std.elf.SHT.DYNSYM); | |
| 360 | 360 | /// Deprecated, use `@intFromEnum(std.elf.SHT.INIT_ARRAY)` |
| 361 | pub const SHT_INIT_ARRAY = @intFromEnum(std.elf.SHT.INIT_ARRAY); | |
| 361 | pub const SHT_INIT_ARRAY = @backingInt(std.elf.SHT.INIT_ARRAY); | |
| 362 | 362 | /// Deprecated, use `@intFromEnum(std.elf.SHT.FINI_ARRAY)` |
| 363 | pub const SHT_FINI_ARRAY = @intFromEnum(std.elf.SHT.FINI_ARRAY); | |
| 363 | pub const SHT_FINI_ARRAY = @backingInt(std.elf.SHT.FINI_ARRAY); | |
| 364 | 364 | /// Deprecated, use `@intFromEnum(std.elf.SHT.PREINIT_ARRAY)` |
| 365 | pub const SHT_PREINIT_ARRAY = @intFromEnum(std.elf.SHT.PREINIT_ARRAY); | |
| 365 | pub const SHT_PREINIT_ARRAY = @backingInt(std.elf.SHT.PREINIT_ARRAY); | |
| 366 | 366 | /// Deprecated, use `@intFromEnum(std.elf.SHT.GROUP)` |
| 367 | pub const SHT_GROUP = @intFromEnum(std.elf.SHT.GROUP); | |
| 367 | pub const SHT_GROUP = @backingInt(std.elf.SHT.GROUP); | |
| 368 | 368 | /// Deprecated, use `@intFromEnum(std.elf.SHT.SYMTAB_SHNDX)` |
| 369 | pub const SHT_SYMTAB_SHNDX = @intFromEnum(std.elf.SHT.SYMTAB_SHNDX); | |
| 369 | pub const SHT_SYMTAB_SHNDX = @backingInt(std.elf.SHT.SYMTAB_SHNDX); | |
| 370 | 370 | /// Deprecated, use `@intFromEnum(std.elf.SHT.RELR)` |
| 371 | pub const SHT_RELR = @intFromEnum(std.elf.SHT.RELR); | |
| 371 | pub const SHT_RELR = @backingInt(std.elf.SHT.RELR); | |
| 372 | 372 | /// Deprecated, use `std.elf.SHT.NUM`. |
| 373 | 373 | pub const SHT_NUM = SHT.NUM; |
| 374 | 374 | /// Deprecated, use `@intFromEnum(std.elf.SHT.LOOS)` |
| 375 | pub const SHT_LOOS = @intFromEnum(std.elf.SHT.LOOS); | |
| 375 | pub const SHT_LOOS = @backingInt(std.elf.SHT.LOOS); | |
| 376 | 376 | /// Deprecated, use `@intFromEnum(std.elf.SHT.LLVM_ADDRSIG)` |
| 377 | pub const SHT_LLVM_ADDRSIG = @intFromEnum(std.elf.SHT.LLVM_ADDRSIG); | |
| 377 | pub const SHT_LLVM_ADDRSIG = @backingInt(std.elf.SHT.LLVM_ADDRSIG); | |
| 378 | 378 | /// Deprecated, use `@intFromEnum(std.elf.SHT.GNU_HASH)` |
| 379 | pub const SHT_GNU_HASH = @intFromEnum(std.elf.SHT.GNU_HASH); | |
| 379 | pub const SHT_GNU_HASH = @backingInt(std.elf.SHT.GNU_HASH); | |
| 380 | 380 | /// Deprecated, use `@intFromEnum(std.elf.SHT.GNU_VERDEF)` |
| 381 | pub const SHT_GNU_VERDEF = @intFromEnum(std.elf.SHT.GNU_VERDEF); | |
| 381 | pub const SHT_GNU_VERDEF = @backingInt(std.elf.SHT.GNU_VERDEF); | |
| 382 | 382 | /// Deprecated, use `@intFromEnum(std.elf.SHT.GNU_VERNEED)` |
| 383 | pub const SHT_GNU_VERNEED = @intFromEnum(std.elf.SHT.GNU_VERNEED); | |
| 383 | pub const SHT_GNU_VERNEED = @backingInt(std.elf.SHT.GNU_VERNEED); | |
| 384 | 384 | /// Deprecated, use `@intFromEnum(std.elf.SHT.GNU_VERSYM)` |
| 385 | pub const SHT_GNU_VERSYM = @intFromEnum(std.elf.SHT.GNU_VERSYM); | |
| 385 | pub const SHT_GNU_VERSYM = @backingInt(std.elf.SHT.GNU_VERSYM); | |
| 386 | 386 | /// Deprecated, use `@intFromEnum(std.elf.SHT.HIOS)` |
| 387 | pub const SHT_HIOS = @intFromEnum(std.elf.SHT.HIOS); | |
| 387 | pub const SHT_HIOS = @backingInt(std.elf.SHT.HIOS); | |
| 388 | 388 | /// Deprecated, use `@intFromEnum(std.elf.SHT.LOPROC)` |
| 389 | pub const SHT_LOPROC = @intFromEnum(std.elf.SHT.LOPROC); | |
| 389 | pub const SHT_LOPROC = @backingInt(std.elf.SHT.LOPROC); | |
| 390 | 390 | /// Deprecated, use `@intFromEnum(std.elf.SHT.X86_64_UNWIND)` |
| 391 | pub const SHT_X86_64_UNWIND = @intFromEnum(std.elf.SHT.X86_64_UNWIND); | |
| 391 | pub const SHT_X86_64_UNWIND = @backingInt(std.elf.SHT.X86_64_UNWIND); | |
| 392 | 392 | /// Deprecated, use `@intFromEnum(std.elf.SHT.HIPROC)` |
| 393 | pub const SHT_HIPROC = @intFromEnum(std.elf.SHT.HIPROC); | |
| 393 | pub const SHT_HIPROC = @backingInt(std.elf.SHT.HIPROC); | |
| 394 | 394 | /// Deprecated, use `@intFromEnum(std.elf.SHT.LOUSER)` |
| 395 | pub const SHT_LOUSER = @intFromEnum(std.elf.SHT.LOUSER); | |
| 395 | pub const SHT_LOUSER = @backingInt(std.elf.SHT.LOUSER); | |
| 396 | 396 | /// Deprecated, use `@intFromEnum(std.elf.SHT.HIUSER)` |
| 397 | pub const SHT_HIUSER = @intFromEnum(std.elf.SHT.HIUSER); | |
| 397 | pub const SHT_HIUSER = @backingInt(std.elf.SHT.HIUSER); | |
| 398 | 398 | |
| 399 | 399 | // Note type for .note.gnu.build_id |
| 400 | 400 | pub const NT_GNU_BUILD_ID = 3; |
| 401 | 401 | |
| 402 | 402 | /// Deprecated, use `@intFromEnum(std.elf.STB.LOCAL)` |
| 403 | pub const STB_LOCAL = @intFromEnum(STB.LOCAL); | |
| 403 | pub const STB_LOCAL = @backingInt(STB.LOCAL); | |
| 404 | 404 | /// Deprecated, use `@intFromEnum(std.elf.STB.GLOBAL)` |
| 405 | pub const STB_GLOBAL = @intFromEnum(STB.GLOBAL); | |
| 405 | pub const STB_GLOBAL = @backingInt(STB.GLOBAL); | |
| 406 | 406 | /// Deprecated, use `@intFromEnum(std.elf.STB.WEAK)` |
| 407 | pub const STB_WEAK = @intFromEnum(STB.WEAK); | |
| 407 | pub const STB_WEAK = @backingInt(STB.WEAK); | |
| 408 | 408 | /// Deprecated, use `std.elf.STB.NUM` |
| 409 | 409 | pub const STB_NUM = STB.NUM; |
| 410 | 410 | /// Deprecated, use `@intFromEnum(std.elf.STB.LOOS)` |
| 411 | pub const STB_LOOS = @intFromEnum(STB.LOOS); | |
| 411 | pub const STB_LOOS = @backingInt(STB.LOOS); | |
| 412 | 412 | /// Deprecated, use `@intFromEnum(std.elf.STB.GNU_UNIQUE)` |
| 413 | pub const STB_GNU_UNIQUE = @intFromEnum(STB.GNU_UNIQUE); | |
| 413 | pub const STB_GNU_UNIQUE = @backingInt(STB.GNU_UNIQUE); | |
| 414 | 414 | /// Deprecated, use `@intFromEnum(std.elf.STB.HIOS)` |
| 415 | pub const STB_HIOS = @intFromEnum(STB.HIOS); | |
| 415 | pub const STB_HIOS = @backingInt(STB.HIOS); | |
| 416 | 416 | /// Deprecated, use `@intFromEnum(std.elf.STB.LOPROC)` |
| 417 | pub const STB_LOPROC = @intFromEnum(STB.LOPROC); | |
| 417 | pub const STB_LOPROC = @backingInt(STB.LOPROC); | |
| 418 | 418 | /// Deprecated, use `@intFromEnum(std.elf.STB.HIPROC)` |
| 419 | pub const STB_HIPROC = @intFromEnum(STB.HIPROC); | |
| 419 | pub const STB_HIPROC = @backingInt(STB.HIPROC); | |
| 420 | 420 | |
| 421 | 421 | /// Deprecated, use `@intFromEnum(std.elf.STB.MIPS_SPLIT_COMMON)` |
| 422 | pub const STB_MIPS_SPLIT_COMMON = @intFromEnum(STB.MIBS_SPLIT_COMMON); | |
| 422 | pub const STB_MIPS_SPLIT_COMMON = @backingInt(STB.MIBS_SPLIT_COMMON); | |
| 423 | 423 | |
| 424 | 424 | /// Deprecated, use `@intFromEnum(std.elf.STT.NOTYPE)` |
| 425 | pub const STT_NOTYPE = @intFromEnum(STT.NOTYPE); | |
| 425 | pub const STT_NOTYPE = @backingInt(STT.NOTYPE); | |
| 426 | 426 | /// Deprecated, use `@intFromEnum(std.elf.STT.OBJECT)` |
| 427 | pub const STT_OBJECT = @intFromEnum(STT.OBJECT); | |
| 427 | pub const STT_OBJECT = @backingInt(STT.OBJECT); | |
| 428 | 428 | /// Deprecated, use `@intFromEnum(std.elf.STT.FUNC)` |
| 429 | pub const STT_FUNC = @intFromEnum(STT.FUNC); | |
| 429 | pub const STT_FUNC = @backingInt(STT.FUNC); | |
| 430 | 430 | /// Deprecated, use `@intFromEnum(std.elf.STT.SECTION)` |
| 431 | pub const STT_SECTION = @intFromEnum(STT.SECTION); | |
| 431 | pub const STT_SECTION = @backingInt(STT.SECTION); | |
| 432 | 432 | /// Deprecated, use `@intFromEnum(std.elf.STT.FILE)` |
| 433 | pub const STT_FILE = @intFromEnum(STT.FILE); | |
| 433 | pub const STT_FILE = @backingInt(STT.FILE); | |
| 434 | 434 | /// Deprecated, use `@intFromEnum(std.elf.STT.COMMON)` |
| 435 | pub const STT_COMMON = @intFromEnum(STT.COMMON); | |
| 435 | pub const STT_COMMON = @backingInt(STT.COMMON); | |
| 436 | 436 | /// Deprecated, use `@intFromEnum(std.elf.STT.TLS)` |
| 437 | pub const STT_TLS = @intFromEnum(STT.TLS); | |
| 437 | pub const STT_TLS = @backingInt(STT.TLS); | |
| 438 | 438 | /// Deprecated, use `std.elf.STT.NUM` |
| 439 | 439 | pub const STT_NUM = STT.NUM; |
| 440 | 440 | /// Deprecated, use `@intFromEnum(std.elf.STT.LOOS)` |
| 441 | pub const STT_LOOS = @intFromEnum(STT.LOOS); | |
| 441 | pub const STT_LOOS = @backingInt(STT.LOOS); | |
| 442 | 442 | /// Deprecated, use `@intFromEnum(std.elf.STT.GNU_IFUNC)` |
| 443 | pub const STT_GNU_IFUNC = @intFromEnum(STT.GNU_IFUNC); | |
| 443 | pub const STT_GNU_IFUNC = @backingInt(STT.GNU_IFUNC); | |
| 444 | 444 | /// Deprecated, use `@intFromEnum(std.elf.STT.HIOS)` |
| 445 | pub const STT_HIOS = @intFromEnum(STT.HIOS); | |
| 445 | pub const STT_HIOS = @backingInt(STT.HIOS); | |
| 446 | 446 | /// Deprecated, use `@intFromEnum(std.elf.STT.LOPROC)` |
| 447 | pub const STT_LOPROC = @intFromEnum(STT.LOPROC); | |
| 447 | pub const STT_LOPROC = @backingInt(STT.LOPROC); | |
| 448 | 448 | /// Deprecated, use `@intFromEnum(std.elf.STT.HIPROC)` |
| 449 | pub const STT_HIPROC = @intFromEnum(STT.HIPROC); | |
| 449 | pub const STT_HIPROC = @backingInt(STT.HIPROC); | |
| 450 | 450 | |
| 451 | 451 | /// Deprecated, use `@intFromEnum(std.elf.STT.SPARC_REGISTER)` |
| 452 | pub const STT_SPARC_REGISTER = @intFromEnum(STT.SPARC_REGISTER); | |
| 452 | pub const STT_SPARC_REGISTER = @backingInt(STT.SPARC_REGISTER); | |
| 453 | 453 | |
| 454 | 454 | /// Deprecated, use `@intFromEnum(std.elf.STT.PARISC_MILLICODE)` |
| 455 | pub const STT_PARISC_MILLICODE = @intFromEnum(STT.PARISC_MILLICODE); | |
| 455 | pub const STT_PARISC_MILLICODE = @backingInt(STT.PARISC_MILLICODE); | |
| 456 | 456 | |
| 457 | 457 | /// Deprecated, use `@intFromEnum(std.elf.STT.HP_OPAQUE)` |
| 458 | pub const STT_HP_OPAQUE = @intFromEnum(STT.HP_OPAQUE); | |
| 458 | pub const STT_HP_OPAQUE = @backingInt(STT.HP_OPAQUE); | |
| 459 | 459 | /// Deprecated, use `@intFromEnum(std.elf.STT.HP_STUB)` |
| 460 | pub const STT_HP_STUB = @intFromEnum(STT.HP_STUB); | |
| 460 | pub const STT_HP_STUB = @backingInt(STT.HP_STUB); | |
| 461 | 461 | |
| 462 | 462 | /// Deprecated, use `@intFromEnum(std.elf.STT.ARM_TFUNC)` |
| 463 | pub const STT_ARM_TFUNC = @intFromEnum(STT.ARM_TFUNC); | |
| 463 | pub const STT_ARM_TFUNC = @backingInt(STT.ARM_TFUNC); | |
| 464 | 464 | /// Deprecated, use `@intFromEnum(std.elf.STT.ARM_16BIT)` |
| 465 | pub const STT_ARM_16BIT = @intFromEnum(STT.ARM_16BIT); | |
| 465 | pub const STT_ARM_16BIT = @backingInt(STT.ARM_16BIT); | |
| 466 | 466 | |
| 467 | 467 | pub const PT = enum(Word) { |
| 468 | 468 | /// Program header table entry unused |
| ... | ... | @@ -487,29 +487,29 @@ pub const PT = enum(Word) { |
| 487 | 487 | pub const NUM = @typeInfo(PT).@"enum".field_names.len; |
| 488 | 488 | |
| 489 | 489 | /// Start of OS-specific |
| 490 | pub const LOOS: PT = @enumFromInt(0x60000000); | |
| 490 | pub const LOOS: PT = @fromBackingInt(@intCast(0x60000000)); | |
| 491 | 491 | /// End of OS-specific |
| 492 | pub const HIOS: PT = @enumFromInt(0x6fffffff); | |
| 492 | pub const HIOS: PT = @fromBackingInt(@intCast(0x6fffffff)); | |
| 493 | 493 | |
| 494 | 494 | /// GCC .eh_frame_hdr segment |
| 495 | pub const GNU_EH_FRAME: PT = @enumFromInt(0x6474e550); | |
| 495 | pub const GNU_EH_FRAME: PT = @fromBackingInt(@intCast(0x6474e550)); | |
| 496 | 496 | /// Indicates stack executability |
| 497 | pub const GNU_STACK: PT = @enumFromInt(0x6474e551); | |
| 497 | pub const GNU_STACK: PT = @fromBackingInt(@intCast(0x6474e551)); | |
| 498 | 498 | /// Read-only after relocation |
| 499 | pub const GNU_RELRO: PT = @enumFromInt(0x6474e552); | |
| 499 | pub const GNU_RELRO: PT = @fromBackingInt(@intCast(0x6474e552)); | |
| 500 | 500 | |
| 501 | pub const LOSUNW: PT = @enumFromInt(0x6ffffffa); | |
| 502 | pub const HISUNW: PT = @enumFromInt(0x6fffffff); | |
| 501 | pub const LOSUNW: PT = @fromBackingInt(@intCast(0x6ffffffa)); | |
| 502 | pub const HISUNW: PT = @fromBackingInt(@intCast(0x6fffffff)); | |
| 503 | 503 | |
| 504 | 504 | /// Sun specific segment |
| 505 | pub const SUNWBSS: PT = @enumFromInt(0x6ffffffa); | |
| 505 | pub const SUNWBSS: PT = @fromBackingInt(@intCast(0x6ffffffa)); | |
| 506 | 506 | /// Stack segment |
| 507 | pub const SUNWSTACK: PT = @enumFromInt(0x6ffffffb); | |
| 507 | pub const SUNWSTACK: PT = @fromBackingInt(@intCast(0x6ffffffb)); | |
| 508 | 508 | |
| 509 | 509 | /// Start of processor-specific |
| 510 | pub const LOPROC: PT = @enumFromInt(0x70000000); | |
| 510 | pub const LOPROC: PT = @fromBackingInt(@intCast(0x70000000)); | |
| 511 | 511 | /// End of processor-specific |
| 512 | pub const HIPROC: PT = @enumFromInt(0x7fffffff); | |
| 512 | pub const HIPROC: PT = @fromBackingInt(@intCast(0x7fffffff)); | |
| 513 | 513 | }; |
| 514 | 514 | |
| 515 | 515 | pub const SHT = enum(Word) { |
| ... | ... | @@ -555,34 +555,34 @@ pub const SHT = enum(Word) { |
| 555 | 555 | pub const NUM = @typeInfo(SHT).@"enum".field_names.len; |
| 556 | 556 | |
| 557 | 557 | /// Start of OS-specific |
| 558 | pub const LOOS: SHT = @enumFromInt(0x60000000); | |
| 558 | pub const LOOS: SHT = @fromBackingInt(@intCast(0x60000000)); | |
| 559 | 559 | /// End of OS-specific |
| 560 | pub const HIOS: SHT = @enumFromInt(0x6fffffff); | |
| 560 | pub const HIOS: SHT = @fromBackingInt(@intCast(0x6fffffff)); | |
| 561 | 561 | |
| 562 | 562 | /// LLVM address-significance table |
| 563 | pub const LLVM_ADDRSIG: SHT = @enumFromInt(0x6fff4c03); | |
| 563 | pub const LLVM_ADDRSIG: SHT = @fromBackingInt(@intCast(0x6fff4c03)); | |
| 564 | 564 | |
| 565 | 565 | /// GNU hash table |
| 566 | pub const GNU_HASH: SHT = @enumFromInt(0x6ffffff6); | |
| 566 | pub const GNU_HASH: SHT = @fromBackingInt(@intCast(0x6ffffff6)); | |
| 567 | 567 | /// GNU version definition table |
| 568 | pub const GNU_VERDEF: SHT = @enumFromInt(0x6ffffffd); | |
| 568 | pub const GNU_VERDEF: SHT = @fromBackingInt(@intCast(0x6ffffffd)); | |
| 569 | 569 | /// GNU needed versions table |
| 570 | pub const GNU_VERNEED: SHT = @enumFromInt(0x6ffffffe); | |
| 570 | pub const GNU_VERNEED: SHT = @fromBackingInt(@intCast(0x6ffffffe)); | |
| 571 | 571 | /// GNU symbol version table |
| 572 | pub const GNU_VERSYM: SHT = @enumFromInt(0x6fffffff); | |
| 572 | pub const GNU_VERSYM: SHT = @fromBackingInt(@intCast(0x6fffffff)); | |
| 573 | 573 | |
| 574 | 574 | /// Start of processor-specific |
| 575 | pub const LOPROC: SHT = @enumFromInt(0x70000000); | |
| 575 | pub const LOPROC: SHT = @fromBackingInt(@intCast(0x70000000)); | |
| 576 | 576 | /// End of processor-specific |
| 577 | pub const HIPROC: SHT = @enumFromInt(0x7fffffff); | |
| 577 | pub const HIPROC: SHT = @fromBackingInt(@intCast(0x7fffffff)); | |
| 578 | 578 | |
| 579 | 579 | /// Unwind information |
| 580 | pub const X86_64_UNWIND: SHT = @enumFromInt(0x70000001); | |
| 580 | pub const X86_64_UNWIND: SHT = @fromBackingInt(@intCast(0x70000001)); | |
| 581 | 581 | |
| 582 | 582 | /// Start of application-specific |
| 583 | pub const LOUSER: SHT = @enumFromInt(0x80000000); | |
| 583 | pub const LOUSER: SHT = @fromBackingInt(@intCast(0x80000000)); | |
| 584 | 584 | /// End of application-specific |
| 585 | pub const HIUSER: SHT = @enumFromInt(0xffffffff); | |
| 585 | pub const HIUSER: SHT = @fromBackingInt(@intCast(0xffffffff)); | |
| 586 | 586 | }; |
| 587 | 587 | |
| 588 | 588 | pub const STB = enum(u4) { |
| ... | ... | @@ -598,19 +598,19 @@ pub const STB = enum(u4) { |
| 598 | 598 | pub const NUM = @typeInfo(STB).@"enum".field_names.len; |
| 599 | 599 | |
| 600 | 600 | /// Start of OS-specific |
| 601 | pub const LOOS: STB = @enumFromInt(10); | |
| 601 | pub const LOOS: STB = @fromBackingInt(@intCast(10)); | |
| 602 | 602 | /// End of OS-specific |
| 603 | pub const HIOS: STB = @enumFromInt(12); | |
| 603 | pub const HIOS: STB = @fromBackingInt(@intCast(12)); | |
| 604 | 604 | |
| 605 | 605 | /// Unique symbol |
| 606 | pub const GNU_UNIQUE: STB = @enumFromInt(@intFromEnum(LOOS) + 0); | |
| 606 | pub const GNU_UNIQUE: STB = @fromBackingInt(@intCast(@backingInt(LOOS) + 0)); | |
| 607 | 607 | |
| 608 | 608 | /// Start of processor-specific |
| 609 | pub const LOPROC: STB = @enumFromInt(13); | |
| 609 | pub const LOPROC: STB = @fromBackingInt(@intCast(13)); | |
| 610 | 610 | /// End of processor-specific |
| 611 | pub const HIPROC: STB = @enumFromInt(15); | |
| 611 | pub const HIPROC: STB = @fromBackingInt(@intCast(15)); | |
| 612 | 612 | |
| 613 | pub const MIPS_SPLIT_COMMON: STB = @enumFromInt(@intFromEnum(LOPROC) + 0); | |
| 613 | pub const MIPS_SPLIT_COMMON: STB = @fromBackingInt(@intCast(@backingInt(LOPROC) + 0)); | |
| 614 | 614 | }; |
| 615 | 615 | |
| 616 | 616 | pub const STT = enum(u4) { |
| ... | ... | @@ -634,27 +634,27 @@ pub const STT = enum(u4) { |
| 634 | 634 | pub const NUM = @typeInfo(STT).@"enum".field_names.len; |
| 635 | 635 | |
| 636 | 636 | /// Start of OS-specific |
| 637 | pub const LOOS: STT = @enumFromInt(10); | |
| 637 | pub const LOOS: STT = @fromBackingInt(@intCast(10)); | |
| 638 | 638 | /// End of OS-specific |
| 639 | pub const HIOS: STT = @enumFromInt(12); | |
| 639 | pub const HIOS: STT = @fromBackingInt(@intCast(12)); | |
| 640 | 640 | |
| 641 | 641 | /// Symbol is indirect code object |
| 642 | pub const GNU_IFUNC: STT = @enumFromInt(@intFromEnum(LOOS) + 0); | |
| 642 | pub const GNU_IFUNC: STT = @fromBackingInt(@intCast(@backingInt(LOOS) + 0)); | |
| 643 | 643 | |
| 644 | pub const HP_OPAQUE: STT = @enumFromInt(@intFromEnum(LOOS) + 1); | |
| 645 | pub const HP_STUB: STT = @enumFromInt(@intFromEnum(LOOS) + 2); | |
| 644 | pub const HP_OPAQUE: STT = @fromBackingInt(@intCast(@backingInt(LOOS) + 1)); | |
| 645 | pub const HP_STUB: STT = @fromBackingInt(@intCast(@backingInt(LOOS) + 2)); | |
| 646 | 646 | |
| 647 | 647 | /// Start of processor-specific |
| 648 | pub const LOPROC: STT = @enumFromInt(13); | |
| 648 | pub const LOPROC: STT = @fromBackingInt(@intCast(13)); | |
| 649 | 649 | /// End of processor-specific |
| 650 | pub const HIPROC: STT = @enumFromInt(15); | |
| 650 | pub const HIPROC: STT = @fromBackingInt(@intCast(15)); | |
| 651 | 651 | |
| 652 | pub const SPARC_REGISTER: STT = @enumFromInt(@intFromEnum(LOPROC) + 0); | |
| 652 | pub const SPARC_REGISTER: STT = @fromBackingInt(@intCast(@backingInt(LOPROC) + 0)); | |
| 653 | 653 | |
| 654 | pub const PARISC_MILLICODE: STT = @enumFromInt(@intFromEnum(LOPROC) + 0); | |
| 654 | pub const PARISC_MILLICODE: STT = @fromBackingInt(@intCast(@backingInt(LOPROC) + 0)); | |
| 655 | 655 | |
| 656 | pub const ARM_TFUNC: STT = @enumFromInt(@intFromEnum(LOPROC) + 0); | |
| 657 | pub const ARM_16BIT: STT = @enumFromInt(@intFromEnum(HIPROC) + 2); | |
| 656 | pub const ARM_TFUNC: STT = @fromBackingInt(@intCast(@backingInt(LOPROC) + 0)); | |
| 657 | pub const ARM_16BIT: STT = @fromBackingInt(@intCast(@backingInt(HIPROC) + 2)); | |
| 658 | 658 | }; |
| 659 | 659 | |
| 660 | 660 | pub const STV = enum(u3) { |
| ... | ... | @@ -823,7 +823,7 @@ pub const Header = struct { |
| 823 | 823 | else => @compileError("bad type"), |
| 824 | 824 | }, |
| 825 | 825 | .endian = endian, |
| 826 | .os_abi = @enumFromInt(hdr.e_ident[EI.OSABI]), | |
| 826 | .os_abi = @fromBackingInt(@intCast(hdr.e_ident[EI.OSABI])), | |
| 827 | 827 | .abi_version = hdr.e_ident[EI.ABIVERSION], |
| 828 | 828 | .type = hdr.e_type, |
| 829 | 829 | .machine = hdr.e_machine, |
| ... | ... | @@ -1629,11 +1629,11 @@ pub const Ident = extern struct { |
| 1629 | 1629 | }; |
| 1630 | 1630 | |
| 1631 | 1631 | /// Deprecated, use `@intFromEnum(std.elf.CLASS.NONE)` |
| 1632 | pub const ELFCLASSNONE = @intFromEnum(CLASS.NONE); | |
| 1632 | pub const ELFCLASSNONE = @backingInt(CLASS.NONE); | |
| 1633 | 1633 | /// Deprecated, use `@intFromEnum(std.elf.CLASS.@"32")` |
| 1634 | pub const ELFCLASS32 = @intFromEnum(CLASS.@"32"); | |
| 1634 | pub const ELFCLASS32 = @backingInt(CLASS.@"32"); | |
| 1635 | 1635 | /// Deprecated, use `@intFromEnum(std.elf.CLASS.@"64")` |
| 1636 | pub const ELFCLASS64 = @intFromEnum(CLASS.@"64"); | |
| 1636 | pub const ELFCLASS64 = @backingInt(CLASS.@"64"); | |
| 1637 | 1637 | /// Deprecated, use `@intFromEnum(std.elf.CLASS.NUM)` |
| 1638 | 1638 | pub const ELFCLASSNUM = CLASS.NUM; |
| 1639 | 1639 | pub const CLASS = enum(u8) { |
| ... | ... | @@ -1662,11 +1662,11 @@ pub const CLASS = enum(u8) { |
| 1662 | 1662 | }; |
| 1663 | 1663 | |
| 1664 | 1664 | /// Deprecated, use `@intFromEnum(std.elf.DATA.NONE)` |
| 1665 | pub const ELFDATANONE = @intFromEnum(DATA.NONE); | |
| 1665 | pub const ELFDATANONE = @backingInt(DATA.NONE); | |
| 1666 | 1666 | /// Deprecated, use `@intFromEnum(std.elf.DATA.@"2LSB")` |
| 1667 | pub const ELFDATA2LSB = @intFromEnum(DATA.@"2LSB"); | |
| 1667 | pub const ELFDATA2LSB = @backingInt(DATA.@"2LSB"); | |
| 1668 | 1668 | /// Deprecated, use `@intFromEnum(std.elf.DATA.@"2MSB")` |
| 1669 | pub const ELFDATA2MSB = @intFromEnum(DATA.@"2MSB"); | |
| 1669 | pub const ELFDATA2MSB = @backingInt(DATA.@"2MSB"); | |
| 1670 | 1670 | /// Deprecated, use `@intFromEnum(std.elf.DATA.NUM)` |
| 1671 | 1671 | pub const ELFDATANUM = DATA.NUM; |
| 1672 | 1672 | pub const DATA = enum(u8) { |
lib/std/enums.zig+25-25| ... | ... | @@ -11,7 +11,7 @@ pub fn fromInt(comptime E: type, integer: anytype) ?E { |
| 11 | 11 | const enum_info = @typeInfo(E).@"enum"; |
| 12 | 12 | if (enum_info.mode == .nonexhaustive) { |
| 13 | 13 | if (std.math.cast(enum_info.tag_type, integer)) |tag| { |
| 14 | return @enumFromInt(tag); | |
| 14 | return @fromBackingInt(@intCast(tag)); | |
| 15 | 15 | } |
| 16 | 16 | return null; |
| 17 | 17 | } |
| ... | ... | @@ -21,7 +21,7 @@ pub fn fromInt(comptime E: type, integer: anytype) ?E { |
| 21 | 21 | // without requiring an inline loop. |
| 22 | 22 | // This generates better machine code. |
| 23 | 23 | for (values(E)) |value| { |
| 24 | if (@intFromEnum(value) == integer) return value; | |
| 24 | if (@backingInt(value) == integer) return value; | |
| 25 | 25 | } |
| 26 | 26 | return null; |
| 27 | 27 | } |
| ... | ... | @@ -43,7 +43,7 @@ pub inline fn valuesFromFields(comptime E: type, comptime field_values: []const |
| 43 | 43 | @setEvalBranchQuota(@typeInfo(E).@"enum".field_names.len + eval_branch_quota_cushion); |
| 44 | 44 | var result: [field_values.len]E = undefined; |
| 45 | 45 | for (&result, field_values) |*r, f_value| { |
| 46 | r.* = @enumFromInt(f_value); | |
| 46 | r.* = @fromBackingInt(@intCast(f_value)); | |
| 47 | 47 | } |
| 48 | 48 | const final = result; |
| 49 | 49 | return &final; |
| ... | ... | @@ -64,7 +64,7 @@ pub fn tagName(comptime E: type, e: E) ?[:0]const u8 { |
| 64 | 64 | const field_values = @typeInfo(E).@"enum".field_values; |
| 65 | 65 | @setEvalBranchQuota(field_names.len); |
| 66 | 66 | return inline for (field_names, field_values) |f_name, f_value| { |
| 67 | if (@intFromEnum(e) == f_value) break f_name; | |
| 67 | if (@backingInt(e) == f_value) break f_name; | |
| 68 | 68 | } else null; |
| 69 | 69 | } |
| 70 | 70 | |
| ... | ... | @@ -72,7 +72,7 @@ test tagName { |
| 72 | 72 | const E = enum(u8) { a, b, _ }; |
| 73 | 73 | try testing.expect(tagName(E, .a) != null); |
| 74 | 74 | try testing.expectEqualStrings("a", tagName(E, .a).?); |
| 75 | try testing.expect(tagName(E, @as(E, @enumFromInt(42))) == null); | |
| 75 | try testing.expect(tagName(E, @as(E, @fromBackingInt(@intCast(42)))) == null); | |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | /// Determines the length of a direct-mapped enum array, indexed by |
| ... | ... | @@ -168,7 +168,7 @@ pub fn directEnumArrayDefault( |
| 168 | 168 | var result: [len]Data = @splat(default orelse undefined); |
| 169 | 169 | inline for (@typeInfo(@TypeOf(init_values)).@"struct".field_names) |f_name| { |
| 170 | 170 | const enum_value = @field(E, f_name); |
| 171 | const index = @as(usize, @intCast(@intFromEnum(enum_value))); | |
| 171 | const index = @as(usize, @intCast(@backingInt(enum_value))); | |
| 172 | 172 | result[index] = @field(init_values, f_name); |
| 173 | 173 | } |
| 174 | 174 | return result; |
| ... | ... | @@ -222,8 +222,8 @@ test fromInt { |
| 222 | 222 | try testing.expect(fromInt(E1, zero).? == E1.A); |
| 223 | 223 | try testing.expect(fromInt(E2, one).? == E2.B); |
| 224 | 224 | try testing.expect(fromInt(E3, zero).? == E3.A); |
| 225 | try testing.expect(fromInt(E3, 127).? == @as(E3, @enumFromInt(127))); | |
| 226 | try testing.expect(fromInt(E3, -128).? == @as(E3, @enumFromInt(-128))); | |
| 225 | try testing.expect(fromInt(E3, 127).? == @as(E3, @fromBackingInt(@intCast(127)))); | |
| 226 | try testing.expect(fromInt(E3, -128).? == @as(E3, @fromBackingInt(@intCast(-128)))); | |
| 227 | 227 | try testing.expectEqual(null, fromInt(E1, one)); |
| 228 | 228 | try testing.expectEqual(null, fromInt(E3, 128)); |
| 229 | 229 | try testing.expectEqual(null, fromInt(E3, -129)); |
| ... | ... | @@ -677,7 +677,7 @@ pub fn BoundedEnumMultiset(comptime E: type, comptime CountSize: type) type { |
| 677 | 677 | const info = @typeInfo(E).@"enum"; |
| 678 | 678 | inline for (info.field_names, info.field_values) |field_name, field_value| { |
| 679 | 679 | const c = @field(init_counts, field_name); |
| 680 | const key: E = @enumFromInt(field_value); | |
| 680 | const key: E = @fromBackingInt(@intCast(field_value)); | |
| 681 | 681 | self.counts.set(key, c); |
| 682 | 682 | } |
| 683 | 683 | return self; |
| ... | ... | @@ -746,7 +746,7 @@ pub fn BoundedEnumMultiset(comptime E: type, comptime CountSize: type) type { |
| 746 | 746 | /// asserts operation will not overflow any key. |
| 747 | 747 | pub fn addSetAssertSafe(self: *Self, other: Self) void { |
| 748 | 748 | inline for (@typeInfo(E).@"enum".field_values) |field_value| { |
| 749 | const key = @as(E, @enumFromInt(field_value)); | |
| 749 | const key = @as(E, @fromBackingInt(@intCast(field_value))); | |
| 750 | 750 | self.addAssertSafe(key, other.getCount(key)); |
| 751 | 751 | } |
| 752 | 752 | } |
| ... | ... | @@ -754,7 +754,7 @@ pub fn BoundedEnumMultiset(comptime E: type, comptime CountSize: type) type { |
| 754 | 754 | /// Increases the all key counts by given multiset. |
| 755 | 755 | pub fn addSet(self: *Self, other: Self) error{Overflow}!void { |
| 756 | 756 | inline for (@typeInfo(E).@"enum".field_values) |field_value| { |
| 757 | const key = @as(E, @enumFromInt(field_value)); | |
| 757 | const key = @as(E, @fromBackingInt(@intCast(field_value))); | |
| 758 | 758 | try self.add(key, other.getCount(key)); |
| 759 | 759 | } |
| 760 | 760 | } |
| ... | ... | @@ -764,7 +764,7 @@ pub fn BoundedEnumMultiset(comptime E: type, comptime CountSize: type) type { |
| 764 | 764 | /// then that key will have a key count of zero. |
| 765 | 765 | pub fn removeSet(self: *Self, other: Self) void { |
| 766 | 766 | inline for (@typeInfo(E).@"enum".field_values) |field_value| { |
| 767 | const key = @as(E, @enumFromInt(field_value)); | |
| 767 | const key = @as(E, @fromBackingInt(@intCast(field_value))); | |
| 768 | 768 | self.remove(key, other.getCount(key)); |
| 769 | 769 | } |
| 770 | 770 | } |
| ... | ... | @@ -773,7 +773,7 @@ pub fn BoundedEnumMultiset(comptime E: type, comptime CountSize: type) type { |
| 773 | 773 | /// given multiset. |
| 774 | 774 | pub fn eql(self: Self, other: Self) bool { |
| 775 | 775 | inline for (@typeInfo(E).@"enum".field_values) |field_value| { |
| 776 | const key = @as(E, @enumFromInt(field_value)); | |
| 776 | const key = @as(E, @fromBackingInt(@intCast(field_value))); | |
| 777 | 777 | if (self.getCount(key) != other.getCount(key)) { |
| 778 | 778 | return false; |
| 779 | 779 | } |
| ... | ... | @@ -785,7 +785,7 @@ pub fn BoundedEnumMultiset(comptime E: type, comptime CountSize: type) type { |
| 785 | 785 | /// equal to the given multiset. |
| 786 | 786 | pub fn subsetOf(self: Self, other: Self) bool { |
| 787 | 787 | inline for (@typeInfo(E).@"enum".field_values) |field_value| { |
| 788 | const key = @as(E, @enumFromInt(field_value)); | |
| 788 | const key = @as(E, @fromBackingInt(@intCast(field_value))); | |
| 789 | 789 | if (self.getCount(key) > other.getCount(key)) { |
| 790 | 790 | return false; |
| 791 | 791 | } |
| ... | ... | @@ -797,7 +797,7 @@ pub fn BoundedEnumMultiset(comptime E: type, comptime CountSize: type) type { |
| 797 | 797 | /// equal to the given multiset. |
| 798 | 798 | pub fn supersetOf(self: Self, other: Self) bool { |
| 799 | 799 | inline for (@typeInfo(E).@"enum".field_values) |field_value| { |
| 800 | const key = @as(E, @enumFromInt(field_value)); | |
| 800 | const key = @as(E, @fromBackingInt(@intCast(field_value))); | |
| 801 | 801 | if (self.getCount(key) < other.getCount(key)) { |
| 802 | 802 | return false; |
| 803 | 803 | } |
| ... | ... | @@ -1284,18 +1284,18 @@ pub fn EnumIndexer(comptime E: type) type { |
| 1284 | 1284 | |
| 1285 | 1285 | pub fn indexOf(e: E) usize { |
| 1286 | 1286 | if (backing_int_sign == .unsigned) |
| 1287 | return @intFromEnum(e); | |
| 1287 | return @backingInt(e); | |
| 1288 | 1288 | |
| 1289 | return if (@intFromEnum(e) < 0) | |
| 1290 | @intCast(@intFromEnum(e) - min_value) | |
| 1289 | return if (@backingInt(e) < 0) | |
| 1290 | @intCast(@backingInt(e) - min_value) | |
| 1291 | 1291 | else |
| 1292 | @as(RangeType, -min_value) + @as(RangeType, @intCast(@intFromEnum(e))); | |
| 1292 | @as(RangeType, -min_value) + @as(RangeType, @intCast(@backingInt(e))); | |
| 1293 | 1293 | } |
| 1294 | 1294 | pub fn keyForIndex(i: usize) E { |
| 1295 | 1295 | if (backing_int_sign == .unsigned) |
| 1296 | return @enumFromInt(i); | |
| 1296 | return @fromBackingInt(@intCast(i)); | |
| 1297 | 1297 | |
| 1298 | return @enumFromInt(@as(@Int(.signed, @bitSizeOf(RangeType) + 1), @intCast(i)) + min_value); | |
| 1298 | return @fromBackingInt(@intCast(@as(@Int(.signed, @bitSizeOf(RangeType) + 1), @intCast(i)) + min_value)); | |
| 1299 | 1299 | } |
| 1300 | 1300 | }; |
| 1301 | 1301 | } |
| ... | ... | @@ -1330,14 +1330,14 @@ pub fn EnumIndexer(comptime E: type) type { |
| 1330 | 1330 | pub const Key = E; |
| 1331 | 1331 | pub const count: comptime_int = fields_len; |
| 1332 | 1332 | pub fn indexOf(e: E) usize { |
| 1333 | return @as(usize, @intCast(@intFromEnum(e) - min)); | |
| 1333 | return @as(usize, @intCast(@backingInt(e) - min)); | |
| 1334 | 1334 | } |
| 1335 | 1335 | pub fn keyForIndex(i: usize) E { |
| 1336 | 1336 | // TODO fix addition semantics. This calculation |
| 1337 | 1337 | // gives up some safety to avoid artificially limiting |
| 1338 | 1338 | // the range of signed enum values to max_isize. |
| 1339 | 1339 | const enum_value = if (min < 0) @as(isize, @bitCast(i)) +% min else i + min; |
| 1340 | return @as(E, @enumFromInt(@as(@typeInfo(E).@"enum".tag_type, @intCast(enum_value)))); | |
| 1340 | return @as(E, @fromBackingInt(@intCast(@as(@typeInfo(E).@"enum".tag_type, @intCast(enum_value))))); | |
| 1341 | 1341 | } |
| 1342 | 1342 | }; |
| 1343 | 1343 | } |
| ... | ... | @@ -1384,8 +1384,8 @@ test "EnumIndexer non-exhaustive" { |
| 1384 | 1384 | }; |
| 1385 | 1385 | const Indexer = EnumIndexer(E); |
| 1386 | 1386 | |
| 1387 | const min_tag: E = @enumFromInt(std.math.minInt(BackingInt)); | |
| 1388 | const max_tag: E = @enumFromInt(std.math.maxInt(BackingInt)); | |
| 1387 | const min_tag: E = @fromBackingInt(@intCast(std.math.minInt(BackingInt))); | |
| 1388 | const max_tag: E = @fromBackingInt(@intCast(std.math.maxInt(BackingInt))); | |
| 1389 | 1389 | |
| 1390 | 1390 | const RangedType = @Int(.unsigned, @bitSizeOf(BackingInt)); |
| 1391 | 1391 | const max_index: comptime_int = std.math.maxInt(RangedType); |
lib/std/fmt.zig+3-3| ... | ... | @@ -947,15 +947,15 @@ test "non-exhaustive enum" { |
| 947 | 947 | }; |
| 948 | 948 | try expectFmt("enum: .One\n", "enum: {}\n", .{Enum.One}); |
| 949 | 949 | try expectFmt("enum: .Two\n", "enum: {}\n", .{Enum.Two}); |
| 950 | try expectFmt("enum: @enumFromInt(4660)\n", "enum: {}\n", .{@as(Enum, @enumFromInt(0x1234))}); | |
| 950 | try expectFmt("enum: @enumFromInt(4660)\n", "enum: {}\n", .{@as(Enum, @fromBackingInt(@intCast(0x1234)))}); | |
| 951 | 951 | try expectFmt("enum: f\n", "enum: {x}\n", .{Enum.One}); |
| 952 | 952 | try expectFmt("enum: beef\n", "enum: {x}\n", .{Enum.Two}); |
| 953 | 953 | try expectFmt("enum: BEEF\n", "enum: {X}\n", .{Enum.Two}); |
| 954 | try expectFmt("enum: 1234\n", "enum: {x}\n", .{@as(Enum, @enumFromInt(0x1234))}); | |
| 954 | try expectFmt("enum: 1234\n", "enum: {x}\n", .{@as(Enum, @fromBackingInt(@intCast(0x1234)))}); | |
| 955 | 955 | |
| 956 | 956 | try expectFmt("enum: 15\n", "enum: {d}\n", .{Enum.One}); |
| 957 | 957 | try expectFmt("enum: 48879\n", "enum: {d}\n", .{Enum.Two}); |
| 958 | try expectFmt("enum: 4660\n", "enum: {d}\n", .{@as(Enum, @enumFromInt(0x1234))}); | |
| 958 | try expectFmt("enum: 4660\n", "enum: {d}\n", .{@as(Enum, @fromBackingInt(@intCast(0x1234)))}); | |
| 959 | 959 | } |
| 960 | 960 | |
| 961 | 961 | test "float.scientific" { |
lib/std/hash/auto_hash.zig+1-1| ... | ... | @@ -106,7 +106,7 @@ pub fn hash(hasher: anytype, key: anytype, comptime strat: HashStrategy) void { |
| 106 | 106 | }, |
| 107 | 107 | |
| 108 | 108 | .bool => hash(hasher, @intFromBool(key), strat), |
| 109 | .@"enum" => hash(hasher, @intFromEnum(key), strat), | |
| 109 | .@"enum" => hash(hasher, @backingInt(key), strat), | |
| 110 | 110 | .error_set => hash(hasher, @intFromError(key), strat), |
| 111 | 111 | .@"anyframe", .@"fn" => hash(hasher, @intFromPtr(key), strat), |
| 112 | 112 |
lib/std/heap.zig+2-2| ... | ... | @@ -78,7 +78,7 @@ pub fn defaultQueryPageSize() usize { |
| 78 | 78 | if (size > 0) return size; |
| 79 | 79 | size = size: switch (builtin.os.tag) { |
| 80 | 80 | .linux => if (builtin.link_libc) |
| 81 | @max(std.c.sysconf(@intFromEnum(std.c._SC.PAGESIZE)), 0) | |
| 81 | @max(std.c.sysconf(@backingInt(std.c._SC.PAGESIZE)), 0) | |
| 82 | 82 | else |
| 83 | 83 | std.os.linux.getauxval(std.elf.AT_PAGESZ), |
| 84 | 84 | .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => { |
| ... | ... | @@ -109,7 +109,7 @@ pub fn defaultQueryPageSize() usize { |
| 109 | 109 | } |
| 110 | 110 | }, |
| 111 | 111 | else => if (builtin.link_libc) |
| 112 | @max(std.c.sysconf(@intFromEnum(std.c._SC.PAGESIZE)), 0) | |
| 112 | @max(std.c.sysconf(@backingInt(std.c._SC.PAGESIZE)), 0) | |
| 113 | 113 | else if (builtin.os.tag == .freestanding or builtin.os.tag == .other) |
| 114 | 114 | @compileError("unsupported target: freestanding/other") |
| 115 | 115 | else |
lib/std/heap/ArenaAllocator.zig+12-12| ... | ... | @@ -765,7 +765,7 @@ fn fuzzMultiThreaded(fuzz_init: FuzzContext.Init, smith: *std.testing.Smith) any |
| 765 | 765 | .@"1", |
| 766 | 766 | .fromByteUnits(2 * std.heap.page_size_max), |
| 767 | 767 | ), |
| 768 | @enumFromInt(alloc_index), | |
| 768 | @fromBackingInt(@intCast(alloc_index)), | |
| 769 | 769 | }) catch unreachable; |
| 770 | 770 | }, |
| 771 | 771 | .resize => group.concurrent(io, FuzzContext.doOneResize, .{ &ctx, nextLen(smith) }) catch unreachable, |
| ... | ... | @@ -877,7 +877,7 @@ const FuzzContext = struct { |
| 877 | 877 | for (ctx.allocs[0..n_allocs]) |allocation| { |
| 878 | 878 | const len: usize = switch (allocation.common.len) { |
| 879 | 879 | .free => continue, |
| 880 | _ => |len| @intFromEnum(len), | |
| 880 | _ => |len| @backingInt(len), | |
| 881 | 881 | }; |
| 882 | 882 | const control = allocation.control_ptr[0..len]; |
| 883 | 883 | const sample = allocation.sample_ptr[0..len]; |
| ... | ... | @@ -887,7 +887,7 @@ const FuzzContext = struct { |
| 887 | 887 | |
| 888 | 888 | fn doOneAlloc(ctx: *FuzzContext, len: usize, alignment: Alignment, index: Alloc.Index) void { |
| 889 | 889 | @disableInstrumentation(); |
| 890 | assert(ctx.allocs[@intFromEnum(index)].common.len == .free); | |
| 890 | assert(ctx.allocs[@backingInt(index)].common.len == .free); | |
| 891 | 891 | |
| 892 | 892 | const control_ptr = ctx.control_allocator.rawAlloc(len, alignment, @returnAddress()) orelse |
| 893 | 893 | return; |
| ... | ... | @@ -896,11 +896,11 @@ const FuzzContext = struct { |
| 896 | 896 | return; |
| 897 | 897 | }; |
| 898 | 898 | |
| 899 | ctx.allocs[@intFromEnum(index)] = .{ | |
| 899 | ctx.allocs[@backingInt(index)] = .{ | |
| 900 | 900 | .control_ptr = control_ptr, |
| 901 | 901 | .sample_ptr = sample_ptr, |
| 902 | 902 | .common = .{ |
| 903 | .len = @enumFromInt(len), | |
| 903 | .len = @fromBackingInt(@intCast(len)), | |
| 904 | 904 | .alignment = alignment, |
| 905 | 905 | }, |
| 906 | 906 | }; |
| ... | ... | @@ -918,9 +918,9 @@ const FuzzContext = struct { |
| 918 | 918 | const index = @atomicRmw(Alloc.Index, &ctx.last_alloc_index, .Xchg, .none, .acquire); |
| 919 | 919 | if (index == .none) return; |
| 920 | 920 | |
| 921 | const allocation = &ctx.allocs[@intFromEnum(index)]; | |
| 921 | const allocation = &ctx.allocs[@backingInt(index)]; | |
| 922 | 922 | assert(allocation.common.len != .free); |
| 923 | const memory = allocation.sample_ptr[0..@intFromEnum(allocation.common.len)]; | |
| 923 | const memory = allocation.sample_ptr[0..@backingInt(allocation.common.len)]; | |
| 924 | 924 | const alignment = allocation.common.alignment; |
| 925 | 925 | |
| 926 | 926 | assert(alignment.check(@intFromPtr(allocation.control_ptr))); |
| ... | ... | @@ -940,11 +940,11 @@ const FuzzContext = struct { |
| 940 | 940 | return; |
| 941 | 941 | } |
| 942 | 942 | |
| 943 | ctx.allocs[@intFromEnum(index)] = .{ | |
| 943 | ctx.allocs[@backingInt(index)] = .{ | |
| 944 | 944 | .control_ptr = new_control_ptr, |
| 945 | 945 | .sample_ptr = memory.ptr, |
| 946 | 946 | .common = .{ |
| 947 | .len = @enumFromInt(new_len), | |
| 947 | .len = @fromBackingInt(@intCast(new_len)), | |
| 948 | 948 | .alignment = alignment, |
| 949 | 949 | }, |
| 950 | 950 | }; |
| ... | ... | @@ -972,9 +972,9 @@ const FuzzContext = struct { |
| 972 | 972 | const index = @atomicRmw(Alloc.Index, &ctx.last_alloc_index, .Xchg, .none, .acquire); |
| 973 | 973 | if (index == .none) return; |
| 974 | 974 | |
| 975 | const allocation = &ctx.allocs[@intFromEnum(index)]; | |
| 975 | const allocation = &ctx.allocs[@backingInt(index)]; | |
| 976 | 976 | assert(allocation.common.len != .free); |
| 977 | const len: usize = @intFromEnum(allocation.common.len); | |
| 977 | const len: usize = @backingInt(allocation.common.len); | |
| 978 | 978 | const alignment = allocation.common.alignment; |
| 979 | 979 | |
| 980 | 980 | assert(alignment.check(@intFromPtr(allocation.control_ptr))); |
| ... | ... | @@ -983,7 +983,7 @@ const FuzzContext = struct { |
| 983 | 983 | ctx.control_allocator.rawFree(allocation.control_ptr[0..len], alignment, @returnAddress()); |
| 984 | 984 | ctx.sample_allocator.rawFree(allocation.sample_ptr[0..len], alignment, @returnAddress()); |
| 985 | 985 | |
| 986 | ctx.allocs[@intFromEnum(index)] = .{ | |
| 986 | ctx.allocs[@backingInt(index)] = .{ | |
| 987 | 987 | .control_ptr = undefined, |
| 988 | 988 | .sample_ptr = undefined, |
| 989 | 989 | .common = .{ |
lib/std/heap/SafeAllocator.zig+18-18| ... | ... | @@ -359,12 +359,12 @@ const AllocFooter = struct { |
| 359 | 359 | |
| 360 | 360 | fn storedXor(m: Modify, ptr: *Modify) Modify { |
| 361 | 361 | const addr_hash: u16 = @truncate(std.hash.int(@intFromPtr(ptr))); |
| 362 | return @enumFromInt(@intFromEnum(m) ^ addr_hash); | |
| 362 | return @fromBackingInt(@intCast(@backingInt(m) ^ addr_hash)); | |
| 363 | 363 | } |
| 364 | 364 | }; |
| 365 | 365 | |
| 366 | 366 | fn isExtended(f: *AllocFooter) bool { |
| 367 | return @intFromEnum(f.data.len) >= Data.Len.extended_start; | |
| 367 | return @backingInt(f.data.len) >= Data.Len.extended_start; | |
| 368 | 368 | } |
| 369 | 369 | |
| 370 | 370 | fn extended(f: *AllocFooter) *Extended { |
| ... | ... | @@ -380,13 +380,13 @@ const AllocFooter = struct { |
| 380 | 380 | } |
| 381 | 381 | |
| 382 | 382 | fn userLen(f: *AllocFooter) usize { |
| 383 | const len_int = @intFromEnum(f.data.len); | |
| 383 | const len_int = @backingInt(f.data.len); | |
| 384 | 384 | return if (len_int < Data.Len.extended_start) len_int else f.extended().len; |
| 385 | 385 | } |
| 386 | 386 | |
| 387 | 387 | fn userAlign(f: *AllocFooter) Alignment { |
| 388 | const high = (@intFromEnum(f.data.len) -| Data.Len.extended_start) << 2; | |
| 389 | return @enumFromInt(high | f.data.alignment); | |
| 388 | const high = (@backingInt(f.data.len) -| Data.Len.extended_start) << 2; | |
| 389 | return @fromBackingInt(@intCast(high | f.data.alignment)); | |
| 390 | 390 | } |
| 391 | 391 | |
| 392 | 392 | fn bucketPrev(f: *AllocFooter, b: *Bucket, s: *SafeAllocator) ?*AllocFooter { |
| ... | ... | @@ -439,7 +439,7 @@ const AllocFooter = struct { |
| 439 | 439 | /// Assumes the footer is in a bucket allocation; all |
| 440 | 440 | /// large allocations require an extended header. |
| 441 | 441 | fn requiresExtended(len: usize, alignment: Alignment) bool { |
| 442 | return len >= Data.Len.extended_start or @intFromEnum(alignment) > math.maxInt(u2); | |
| 442 | return len >= Data.Len.extended_start or @backingInt(alignment) > math.maxInt(u2); | |
| 443 | 443 | } |
| 444 | 444 | |
| 445 | 445 | fn lenBucket(s: *SafeAllocator, is_extended: bool) usize { |
| ... | ... | @@ -592,15 +592,15 @@ const AllocFooter = struct { |
| 592 | 592 | |
| 593 | 593 | if (!is_extended) { |
| 594 | 594 | footer.data = .{ |
| 595 | .len = @enumFromInt(len), | |
| 596 | .alignment = @intCast(@intFromEnum(alignment)), | |
| 595 | .len = @fromBackingInt(@intCast(len)), | |
| 596 | .alignment = @intCast(@backingInt(alignment)), | |
| 597 | 597 | .prev_extended = prev_extended, |
| 598 | 598 | }; |
| 599 | 599 | assert(!footer.isExtended()); |
| 600 | 600 | } else { |
| 601 | 601 | footer.data = .{ |
| 602 | .len = @enumFromInt(Data.Len.extended_start + (@intFromEnum(alignment) >> 2)), | |
| 603 | .alignment = @truncate(@intFromEnum(alignment)), | |
| 602 | .len = @fromBackingInt(@intCast(Data.Len.extended_start + (@backingInt(alignment) >> 2))), | |
| 603 | .alignment = @truncate(@backingInt(alignment)), | |
| 604 | 604 | .prev_extended = prev_extended, |
| 605 | 605 | }; |
| 606 | 606 | assert(footer.isExtended()); |
| ... | ... | @@ -720,7 +720,7 @@ fn deinitLeakedBucket(s: *SafeAllocator, b: *Bucket, log: bool) usize { |
| 720 | 720 | |
| 721 | 721 | footer = footer.bucketPrev(b, s) orelse break; |
| 722 | 722 | } |
| 723 | s.backing.rawFree(b.bytes(s), @enumFromInt(s.bucket_size_log2), 0); | |
| 723 | s.backing.rawFree(b.bytes(s), @fromBackingInt(@intCast(s.bucket_size_log2)), 0); | |
| 724 | 724 | |
| 725 | 725 | assert(leaks == expected.n); |
| 726 | 726 | return leaks; |
| ... | ... | @@ -875,7 +875,7 @@ fn captureStackTrace(trace_buf: []usize, ra: usize) void { |
| 875 | 875 | } |
| 876 | 876 | |
| 877 | 877 | const t = std.debug.captureCurrentStackTrace(.{ .first_address = ra }, trace_buf[1..]); |
| 878 | const skipped = @intFromEnum(t.skipped) * | |
| 878 | const skipped = @backingInt(t.skipped) * | |
| 879 | 879 | @intFromBool(t.return_addresses.len == trace_buf[1..].len); |
| 880 | 880 | trace_buf[0] = t.return_addresses.len +| skipped; |
| 881 | 881 | } |
| ... | ... | @@ -888,7 +888,7 @@ fn formatStackTrace(trace_buf: []usize) std.debug.FormatStackTrace { |
| 888 | 888 | break :trace .{ |
| 889 | 889 | .return_addresses = addrs[0..@min(frames, addrs.len)], |
| 890 | 890 | .skipped = switch (frames) { |
| 891 | else => @enumFromInt(frames -| addrs.len), | |
| 891 | else => @fromBackingInt(@intCast(frames -| addrs.len)), | |
| 892 | 892 | 0, math.maxInt(usize) => .unknown, |
| 893 | 893 | }, |
| 894 | 894 | }; |
| ... | ... | @@ -937,7 +937,7 @@ fn allocBucket( |
| 937 | 937 | @branchHint(.unlikely); |
| 938 | 938 | freeAllocEntry(t, b.entry); |
| 939 | 939 | b.check(s); |
| 940 | s.backing.rawFree(b.bytes(s), @enumFromInt(s.bucket_size_log2), ra); | |
| 940 | s.backing.rawFree(b.bytes(s), @fromBackingInt(@intCast(s.bucket_size_log2)), ra); | |
| 941 | 941 | } |
| 942 | 942 | |
| 943 | 943 | return null; |
| ... | ... | @@ -1096,7 +1096,7 @@ fn alloc(ctx: *anyopaque, len: usize, alignment: Alignment, ra: usize) ?[*]u8 { |
| 1096 | 1096 | const entry = s.newAllocEntry(t, ra) catch return null; |
| 1097 | 1097 | const bucket: *Bucket = @ptrCast(@alignCast(s.backing.rawAlloc( |
| 1098 | 1098 | s.bucketSize(), |
| 1099 | @enumFromInt(s.bucket_size_log2), | |
| 1099 | @fromBackingInt(@intCast(s.bucket_size_log2)), | |
| 1100 | 1100 | ra, |
| 1101 | 1101 | ) orelse { |
| 1102 | 1102 | freeAllocEntry(t, entry); |
| ... | ... | @@ -1171,7 +1171,7 @@ fn free(ctx: *anyopaque, memory: []u8, alignment: Alignment, ra: usize) void { |
| 1171 | 1171 | freeAllocEntry(t, b.entry); |
| 1172 | 1172 | t.mutex.unlock(); |
| 1173 | 1173 | b.check(s); |
| 1174 | s.backing.rawFree(b.bytes(s), @enumFromInt(s.bucket_size_log2), ra); | |
| 1174 | s.backing.rawFree(b.bytes(s), @fromBackingInt(@intCast(s.bucket_size_log2)), ra); | |
| 1175 | 1175 | } |
| 1176 | 1176 | } |
| 1177 | 1177 | |
| ... | ... | @@ -1346,8 +1346,8 @@ const Smith = std.testing.Smith; |
| 1346 | 1346 | const fuzz_probs = struct { |
| 1347 | 1347 | const alignment: []const Smith.Weight = &.{ |
| 1348 | 1348 | .rangeAtMost(Alignment, .@"1", .@"16", 32), // ~75% |
| 1349 | .rangeAtMost(Alignment, .@"16", @enumFromInt(@bitSizeOf(usize) - 1), 1), | |
| 1350 | .value(Alignment, @enumFromInt(@bitSizeOf(usize) - 1), 32), // More likely overflow cases | |
| 1349 | .rangeAtMost(Alignment, .@"16", @fromBackingInt(@intCast(@bitSizeOf(usize) - 1)), 1), | |
| 1350 | .value(Alignment, @fromBackingInt(@intCast(@bitSizeOf(usize) - 1)), 32), // More likely overflow cases | |
| 1351 | 1351 | }; |
| 1352 | 1352 | |
| 1353 | 1353 | const eos: []const Smith.Weight = &.{ |
lib/std/heap/SmpAllocator.zig+1-1| ... | ... | @@ -216,7 +216,7 @@ fn free(context: *anyopaque, memory: []u8, alignment: Alignment, ra: usize) void |
| 216 | 216 | } |
| 217 | 217 | |
| 218 | 218 | fn sizeClassIndex(len: usize, alignment: Alignment) usize { |
| 219 | return @max(@bitSizeOf(usize) - @clz(len - 1), @intFromEnum(alignment), min_class) - min_class; | |
| 219 | return @max(@bitSizeOf(usize) - @clz(len - 1), @backingInt(alignment), min_class) - min_class; | |
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | fn slotSize(class: usize) usize { |
lib/std/heap/debug_allocator.zig+11-11| ... | ... | @@ -230,8 +230,8 @@ pub fn DebugAllocator(comptime config: Config) type { |
| 230 | 230 | } |
| 231 | 231 | |
| 232 | 232 | fn getStackTrace(self: *LargeAlloc, trace_kind: TraceKind) std.debug.StackTrace { |
| 233 | assert(@intFromEnum(trace_kind) < trace_n); | |
| 234 | const stack_addresses = &self.stack_addresses[@intFromEnum(trace_kind)]; | |
| 233 | assert(@backingInt(trace_kind) < trace_n); | |
| 234 | const stack_addresses = &self.stack_addresses[@backingInt(trace_kind)]; | |
| 235 | 235 | var len: usize = 0; |
| 236 | 236 | while (len < stack_n and stack_addresses[len] != 0) { |
| 237 | 237 | len += 1; |
| ... | ... | @@ -243,8 +243,8 @@ pub fn DebugAllocator(comptime config: Config) type { |
| 243 | 243 | } |
| 244 | 244 | |
| 245 | 245 | fn captureStackTrace(self: *LargeAlloc, ret_addr: usize, trace_kind: TraceKind) void { |
| 246 | assert(@intFromEnum(trace_kind) < trace_n); | |
| 247 | const stack_addresses = &self.stack_addresses[@intFromEnum(trace_kind)]; | |
| 246 | assert(@backingInt(trace_kind) < trace_n); | |
| 247 | const stack_addresses = &self.stack_addresses[@backingInt(trace_kind)]; | |
| 248 | 248 | collectStackTrace(ret_addr, stack_addresses); |
| 249 | 249 | } |
| 250 | 250 | }; |
| ... | ... | @@ -297,7 +297,7 @@ pub fn DebugAllocator(comptime config: Config) type { |
| 297 | 297 | ) *[stack_n]usize { |
| 298 | 298 | const start_ptr = @as([*]u8, @ptrCast(bucket)) + bucketStackFramesStart(slot_count); |
| 299 | 299 | const addr = start_ptr + one_trace_size * traces_per_slot * slot_index + |
| 300 | @intFromEnum(trace_kind) * @as(usize, one_trace_size); | |
| 300 | @backingInt(trace_kind) * @as(usize, one_trace_size); | |
| 301 | 301 | return @ptrCast(@alignCast(addr)); |
| 302 | 302 | } |
| 303 | 303 | |
| ... | ... | @@ -586,7 +586,7 @@ pub fn DebugAllocator(comptime config: Config) type { |
| 586 | 586 | // If this would move the allocation into a small size class, |
| 587 | 587 | // refuse the request, because it would require creating small |
| 588 | 588 | // allocation metadata. |
| 589 | const new_size_class_index: usize = @max(@bitSizeOf(usize) - @clz(new_size - 1), @intFromEnum(alignment)); | |
| 589 | const new_size_class_index: usize = @max(@bitSizeOf(usize) - @clz(new_size - 1), @backingInt(alignment)); | |
| 590 | 590 | if (new_size_class_index < self.buckets.len) return null; |
| 591 | 591 | |
| 592 | 592 | // Do memory limit accounting with requested sizes rather than what |
| ... | ... | @@ -727,7 +727,7 @@ pub fn DebugAllocator(comptime config: Config) type { |
| 727 | 727 | self.total_requested_bytes = new_req_bytes; |
| 728 | 728 | } |
| 729 | 729 | |
| 730 | const size_class_index: usize = @max(@bitSizeOf(usize) - @clz(len - 1), @intFromEnum(alignment)); | |
| 730 | const size_class_index: usize = @max(@bitSizeOf(usize) - @clz(len - 1), @backingInt(alignment)); | |
| 731 | 731 | if (size_class_index >= self.buckets.len) { |
| 732 | 732 | @branchHint(.unlikely); |
| 733 | 733 | self.large_allocations.ensureUnusedCapacity(self.backing_allocator, 1) catch return null; |
| ... | ... | @@ -834,7 +834,7 @@ pub fn DebugAllocator(comptime config: Config) type { |
| 834 | 834 | if (have_mutex) std.Io.Threaded.mutexLock(&self.mutex); |
| 835 | 835 | defer if (have_mutex) std.Io.Threaded.mutexUnlock(&self.mutex); |
| 836 | 836 | |
| 837 | const size_class_index: usize = @max(@bitSizeOf(usize) - @clz(memory.len - 1), @intFromEnum(alignment)); | |
| 837 | const size_class_index: usize = @max(@bitSizeOf(usize) - @clz(memory.len - 1), @backingInt(alignment)); | |
| 838 | 838 | if (size_class_index >= self.buckets.len) { |
| 839 | 839 | return self.resizeLarge(memory, alignment, new_len, return_address, false) != null; |
| 840 | 840 | } else { |
| ... | ... | @@ -853,7 +853,7 @@ pub fn DebugAllocator(comptime config: Config) type { |
| 853 | 853 | if (have_mutex) std.Io.Threaded.mutexLock(&self.mutex); |
| 854 | 854 | defer if (have_mutex) std.Io.Threaded.mutexUnlock(&self.mutex); |
| 855 | 855 | |
| 856 | const size_class_index: usize = @max(@bitSizeOf(usize) - @clz(memory.len - 1), @intFromEnum(alignment)); | |
| 856 | const size_class_index: usize = @max(@bitSizeOf(usize) - @clz(memory.len - 1), @backingInt(alignment)); | |
| 857 | 857 | if (size_class_index >= self.buckets.len) { |
| 858 | 858 | return self.resizeLarge(memory, alignment, new_len, return_address, true); |
| 859 | 859 | } else { |
| ... | ... | @@ -871,7 +871,7 @@ pub fn DebugAllocator(comptime config: Config) type { |
| 871 | 871 | if (have_mutex) std.Io.Threaded.mutexLock(&self.mutex); |
| 872 | 872 | defer if (have_mutex) std.Io.Threaded.mutexUnlock(&self.mutex); |
| 873 | 873 | |
| 874 | const size_class_index: usize = @max(@bitSizeOf(usize) - @clz(old_memory.len - 1), @intFromEnum(alignment)); | |
| 874 | const size_class_index: usize = @max(@bitSizeOf(usize) - @clz(old_memory.len - 1), @backingInt(alignment)); | |
| 875 | 875 | if (size_class_index >= self.buckets.len) { |
| 876 | 876 | @branchHint(.unlikely); |
| 877 | 877 | self.freeLarge(old_memory, alignment, return_address); |
| ... | ... | @@ -990,7 +990,7 @@ pub fn DebugAllocator(comptime config: Config) type { |
| 990 | 990 | return_address: usize, |
| 991 | 991 | size_class_index: usize, |
| 992 | 992 | ) bool { |
| 993 | const new_size_class_index: usize = @max(@bitSizeOf(usize) - @clz(new_len - 1), @intFromEnum(alignment)); | |
| 993 | const new_size_class_index: usize = @max(@bitSizeOf(usize) - @clz(new_len - 1), @backingInt(alignment)); | |
| 994 | 994 | if (!config.safety) { |
| 995 | 995 | if (new_size_class_index != size_class_index) return false; |
| 996 | 996 | // Still account for total even if safety is off |
lib/std/http.zig+5-5| ... | ... | @@ -247,7 +247,7 @@ pub const Status = enum(u10) { |
| 247 | 247 | }; |
| 248 | 248 | |
| 249 | 249 | pub fn class(self: Status) Class { |
| 250 | return switch (@intFromEnum(self)) { | |
| 250 | return switch (@backingInt(self)) { | |
| 251 | 251 | 100...199 => .informational, |
| 252 | 252 | 200...299 => .success, |
| 253 | 253 | 300...399 => .redirect, |
| ... | ... | @@ -338,11 +338,11 @@ pub const Reader = struct { |
| 338 | 338 | _, |
| 339 | 339 | |
| 340 | 340 | pub fn init(integer: u64) RemainingChunkLen { |
| 341 | return @enumFromInt(integer); | |
| 341 | return @fromBackingInt(@intCast(integer)); | |
| 342 | 342 | } |
| 343 | 343 | |
| 344 | 344 | pub fn int(rcl: RemainingChunkLen) u64 { |
| 345 | return @intFromEnum(rcl); | |
| 345 | return @backingInt(rcl); | |
| 346 | 346 | } |
| 347 | 347 | }; |
| 348 | 348 | |
| ... | ... | @@ -597,8 +597,8 @@ pub const Reader = struct { |
| 597 | 597 | continue :len .head; |
| 598 | 598 | }, |
| 599 | 599 | else => |remaining_chunk_len| { |
| 600 | const n = try in.stream(w, limit.min(.limited64(@intFromEnum(remaining_chunk_len) - 2))); | |
| 601 | chunk_len_ptr.* = .init(@intFromEnum(remaining_chunk_len) - n); | |
| 600 | const n = try in.stream(w, limit.min(.limited64(@backingInt(remaining_chunk_len) - 2))); | |
| 601 | chunk_len_ptr.* = .init(@backingInt(remaining_chunk_len) - n); | |
| 602 | 602 | return n; |
| 603 | 603 | }, |
| 604 | 604 | } |
lib/std/http/Client.zig+11-11| ... | ... | @@ -531,7 +531,7 @@ pub const Response = struct { |
| 531 | 531 | else => return error.HttpHeadersInvalid, |
| 532 | 532 | }; |
| 533 | 533 | if (first_line[8] != ' ') return error.HttpHeadersInvalid; |
| 534 | const status: http.Status = @enumFromInt(parseInt3(first_line[9..12])); | |
| 534 | const status: http.Status = @fromBackingInt(@intCast(parseInt3(first_line[9..12]))); | |
| 535 | 535 | const reason = mem.trimStart(u8, first_line[12..], " "); |
| 536 | 536 | |
| 537 | 537 | res.version = version; |
| ... | ... | @@ -825,9 +825,9 @@ pub const Request = struct { |
| 825 | 825 | |
| 826 | 826 | pub const default_accept_encoding: [@typeInfo(http.ContentEncoding).@"enum".field_names.len]bool = b: { |
| 827 | 827 | var result: [@typeInfo(http.ContentEncoding).@"enum".field_names.len]bool = @splat(false); |
| 828 | result[@intFromEnum(http.ContentEncoding.gzip)] = true; | |
| 829 | result[@intFromEnum(http.ContentEncoding.deflate)] = true; | |
| 830 | result[@intFromEnum(http.ContentEncoding.identity)] = true; | |
| 828 | result[@backingInt(http.ContentEncoding.gzip)] = true; | |
| 829 | result[@backingInt(http.ContentEncoding.deflate)] = true; | |
| 830 | result[@backingInt(http.ContentEncoding.identity)] = true; | |
| 831 | 831 | break :b result; |
| 832 | 832 | }; |
| 833 | 833 | |
| ... | ... | @@ -864,20 +864,20 @@ pub const Request = struct { |
| 864 | 864 | |
| 865 | 865 | pub fn init(n: u16) RedirectBehavior { |
| 866 | 866 | assert(n != std.math.maxInt(u16)); |
| 867 | return @enumFromInt(n); | |
| 867 | return @fromBackingInt(@intCast(n)); | |
| 868 | 868 | } |
| 869 | 869 | |
| 870 | 870 | pub fn subtractOne(rb: *RedirectBehavior) void { |
| 871 | 871 | switch (rb.*) { |
| 872 | 872 | .not_allowed => unreachable, |
| 873 | 873 | .unhandled => unreachable, |
| 874 | _ => rb.* = @enumFromInt(@intFromEnum(rb.*) - 1), | |
| 874 | _ => rb.* = @fromBackingInt(@intCast(@backingInt(rb.*) - 1)), | |
| 875 | 875 | } |
| 876 | 876 | } |
| 877 | 877 | |
| 878 | 878 | pub fn remaining(rb: RedirectBehavior) u16 { |
| 879 | 879 | assert(rb != .unhandled); |
| 880 | return @intFromEnum(rb); | |
| 880 | return @backingInt(rb); | |
| 881 | 881 | } |
| 882 | 882 | }; |
| 883 | 883 | |
| ... | ... | @@ -1037,7 +1037,7 @@ pub const Request = struct { |
| 1037 | 1037 | try w.writeAll("accept-encoding: "); |
| 1038 | 1038 | for (r.accept_encoding, 0..) |enabled, i| { |
| 1039 | 1039 | if (!enabled) continue; |
| 1040 | const tag: http.ContentEncoding = @enumFromInt(i); | |
| 1040 | const tag: http.ContentEncoding = @fromBackingInt(@intCast(i)); | |
| 1041 | 1041 | if (tag == .identity) continue; |
| 1042 | 1042 | const tag_name = @tagName(tag); |
| 1043 | 1043 | try w.ensureUnusedCapacity(tag_name.len + 2); |
| ... | ... | @@ -1188,7 +1188,7 @@ pub const Request = struct { |
| 1188 | 1188 | continue; |
| 1189 | 1189 | } |
| 1190 | 1190 | |
| 1191 | if (!r.accept_encoding[@intFromEnum(head.content_encoding)]) | |
| 1191 | if (!r.accept_encoding[@backingInt(head.content_encoding)]) | |
| 1192 | 1192 | return error.HttpContentEncodingUnsupported; |
| 1193 | 1193 | |
| 1194 | 1194 | r.response_transfer_encoding = head.transfer_encoding; |
| ... | ... | @@ -1654,7 +1654,7 @@ pub const RequestOptions = struct { |
| 1654 | 1654 | /// |
| 1655 | 1655 | /// This will only follow redirects for repeatable requests (ie. with no |
| 1656 | 1656 | /// payload or the server has acknowledged the payload). |
| 1657 | redirect_behavior: Request.RedirectBehavior = @enumFromInt(3), | |
| 1657 | redirect_behavior: Request.RedirectBehavior = @fromBackingInt(@intCast(3)), | |
| 1658 | 1658 | |
| 1659 | 1659 | /// Must be an already acquired connection. |
| 1660 | 1660 | connection: ?*Connection = null, |
| ... | ... | @@ -1813,7 +1813,7 @@ pub fn fetch(client: *Client, options: FetchOptions) FetchError!FetchResult { |
| 1813 | 1813 | if (options.payload != null) .POST else .GET; |
| 1814 | 1814 | |
| 1815 | 1815 | const redirect_behavior: Request.RedirectBehavior = options.redirect_behavior orelse |
| 1816 | if (options.payload == null) @enumFromInt(3) else .unhandled; | |
| 1816 | if (options.payload == null) @fromBackingInt(@intCast(3)) else .unhandled; | |
| 1817 | 1817 | |
| 1818 | 1818 | var req = try request(client, method, uri, .{ |
| 1819 | 1819 | .redirect_behavior = redirect_behavior, |
lib/std/http/Server.zig+5-5| ... | ... | @@ -353,7 +353,7 @@ pub const Request = struct { |
| 353 | 353 | |
| 354 | 354 | const out = request.server.out; |
| 355 | 355 | try out.print("{s} {d} {s}\r\n", .{ |
| 356 | @tagName(options.version), @intFromEnum(options.status), phrase, | |
| 356 | @tagName(options.version), @backingInt(options.status), phrase, | |
| 357 | 357 | }); |
| 358 | 358 | |
| 359 | 359 | switch (options.version) { |
| ... | ... | @@ -424,7 +424,7 @@ pub const Request = struct { |
| 424 | 424 | const out = request.server.out; |
| 425 | 425 | |
| 426 | 426 | try out.print("{s} {d} {s}\r\n", .{ |
| 427 | @tagName(o.version), @intFromEnum(o.status), phrase, | |
| 427 | @tagName(o.version), @backingInt(o.status), phrase, | |
| 428 | 428 | }); |
| 429 | 429 | |
| 430 | 430 | switch (o.version) { |
| ... | ... | @@ -544,7 +544,7 @@ pub const Request = struct { |
| 544 | 544 | sha1.update("258EAFA5-E914-47DA-95CA-C5AB0DC85B11"); |
| 545 | 545 | var digest: [std.crypto.hash.Sha1.digest_length]u8 = undefined; |
| 546 | 546 | sha1.final(&digest); |
| 547 | try out.print("{s} {d} {s}\r\n", .{ @tagName(version), @intFromEnum(status), phrase }); | |
| 547 | try out.print("{s} {d} {s}\r\n", .{ @tagName(version), @backingInt(status), phrase }); | |
| 548 | 548 | try out.writeAll("connection: upgrade\r\nupgrade: websocket\r\nsec-websocket-accept: "); |
| 549 | 549 | const base64_digest = try out.writableArray(28); |
| 550 | 550 | assert(std.base64.standard.Encoder.encode(base64_digest, &digest).len == base64_digest.len); |
| ... | ... | @@ -723,7 +723,7 @@ pub const WebSocket = struct { |
| 723 | 723 | const len: usize = switch (h1.payload_len) { |
| 724 | 724 | .len16 => try in.takeInt(u16, .big), |
| 725 | 725 | .len64 => std.math.cast(usize, try in.takeInt(u64, .big)) orelse return error.MessageOversize, |
| 726 | else => @intFromEnum(h1.payload_len), | |
| 726 | else => @backingInt(h1.payload_len), | |
| 727 | 727 | }; |
| 728 | 728 | if (len > in.buffer.len) return error.MessageOversize; |
| 729 | 729 | const mask: [4]u8 = (try in.takeArray(4)).*; |
| ... | ... | @@ -781,7 +781,7 @@ pub const WebSocket = struct { |
| 781 | 781 | }))); |
| 782 | 782 | switch (total_len) { |
| 783 | 783 | 0...125 => try out.writeByte(@bitCast(@as(Header1, .{ |
| 784 | .payload_len = @enumFromInt(total_len), | |
| 784 | .payload_len = @fromBackingInt(@intCast(total_len)), | |
| 785 | 785 | .mask = false, |
| 786 | 786 | }))), |
| 787 | 787 | 126...0xffff => { |
lib/std/json/Stringify.zig+5-5| ... | ... | @@ -127,7 +127,7 @@ pub fn endObject(self: *Stringify) Error!void { |
| 127 | 127 | fn pushIndentation(self: *Stringify, mode: IndentationMode) !void { |
| 128 | 128 | switch (safety_checks) { |
| 129 | 129 | .checked_to_fixed_depth => { |
| 130 | BitStack.pushWithStateAssumeCapacity(&self.nesting_stack, &self.indent_level, @intFromEnum(mode)); | |
| 130 | BitStack.pushWithStateAssumeCapacity(&self.nesting_stack, &self.indent_level, @backingInt(mode)); | |
| 131 | 131 | }, |
| 132 | 132 | .assumed_correct => { |
| 133 | 133 | self.indent_level += 1; |
| ... | ... | @@ -137,7 +137,7 @@ fn pushIndentation(self: *Stringify, mode: IndentationMode) !void { |
| 137 | 137 | fn popIndentation(self: *Stringify, expected_mode: IndentationMode) void { |
| 138 | 138 | switch (safety_checks) { |
| 139 | 139 | .checked_to_fixed_depth => { |
| 140 | assert(BitStack.popWithState(&self.nesting_stack, &self.indent_level) == @intFromEnum(expected_mode)); | |
| 140 | assert(BitStack.popWithState(&self.nesting_stack, &self.indent_level) == @backingInt(expected_mode)); | |
| 141 | 141 | }, |
| 142 | 142 | .assumed_correct => { |
| 143 | 143 | self.indent_level -= 1; |
| ... | ... | @@ -202,7 +202,7 @@ fn valueDone(self: *Stringify) void { |
| 202 | 202 | fn isObjectKeyExpected(self: *const Stringify) ?bool { |
| 203 | 203 | switch (safety_checks) { |
| 204 | 204 | .checked_to_fixed_depth => return self.indent_level > 0 and |
| 205 | BitStack.peekWithState(&self.nesting_stack, self.indent_level) == @intFromEnum(IndentationMode.object) and | |
| 205 | BitStack.peekWithState(&self.nesting_stack, self.indent_level) == @backingInt(IndentationMode.object) and | |
| 206 | 206 | self.next_punctuation != .colon, |
| 207 | 207 | .assumed_correct => return null, |
| 208 | 208 | } |
| ... | ... | @@ -407,7 +407,7 @@ pub fn write(self: *Stringify, v: anytype) Error!void { |
| 407 | 407 | break; |
| 408 | 408 | } |
| 409 | 409 | } else { |
| 410 | return self.write(@intFromEnum(v)); | |
| 410 | return self.write(@backingInt(v)); | |
| 411 | 411 | } |
| 412 | 412 | } |
| 413 | 413 | |
| ... | ... | @@ -858,7 +858,7 @@ test "stringify non-exhaustive enum" { |
| 858 | 858 | _, |
| 859 | 859 | }; |
| 860 | 860 | try testStringify("\"foo\"", E.foo, .{}); |
| 861 | try testStringify("1", @as(E, @enumFromInt(1)), .{}); | |
| 861 | try testStringify("1", @as(E, @fromBackingInt(@intCast(1))), .{}); | |
| 862 | 862 | } |
| 863 | 863 | |
| 864 | 864 | test "stringify enum literals" { |
lib/std/lang.zig+1-1| ... | ... | @@ -911,7 +911,7 @@ pub const Endian = enum { |
| 911 | 911 | little, |
| 912 | 912 | |
| 913 | 913 | pub const native = builtin.target.cpu.arch.endian(); |
| 914 | pub const foreign: Endian = @enumFromInt(1 - @intFromEnum(native)); | |
| 914 | pub const foreign: Endian = @fromBackingInt(@intCast(1 - @backingInt(native))); | |
| 915 | 915 | }; |
| 916 | 916 | |
| 917 | 917 | /// This data structure is used by the Zig language code generation and |
lib/std/log.zig+2-2| ... | ... | @@ -75,9 +75,9 @@ fn log( |
| 75 | 75 | /// Determine if a specific log message level and scope combination are enabled for logging. |
| 76 | 76 | pub fn logEnabled(comptime level: Level, comptime scope: @EnumLiteral()) bool { |
| 77 | 77 | inline for (std.options.log_scope_levels) |scope_level| { |
| 78 | if (scope_level.scope == scope) return @intFromEnum(level) <= @intFromEnum(scope_level.level); | |
| 78 | if (scope_level.scope == scope) return @backingInt(level) <= @backingInt(scope_level.level); | |
| 79 | 79 | } |
| 80 | return @intFromEnum(level) <= @intFromEnum(std.options.log_level); | |
| 80 | return @backingInt(level) <= @backingInt(std.options.log_level); | |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | pub const terminalMode = std.Options.logTerminalMode; |
lib/std/math.zig+1-1| ... | ... | @@ -1643,7 +1643,7 @@ pub const CompareOperator = enum { |
| 1643 | 1643 | |
| 1644 | 1644 | test reverse { |
| 1645 | 1645 | inline for (@typeInfo(CompareOperator).@"enum".field_values) |op_field_value| { |
| 1646 | const op = @as(CompareOperator, @enumFromInt(op_field_value)); | |
| 1646 | const op = @as(CompareOperator, @fromBackingInt(@intCast(op_field_value))); | |
| 1647 | 1647 | try testing.expect(compare(2, op, 3) == compare(3, op.reverse(), 2)); |
| 1648 | 1648 | try testing.expect(compare(3, op, 3) == compare(3, op.reverse(), 3)); |
| 1649 | 1649 | try testing.expect(compare(4, op, 3) == compare(3, op.reverse(), 4)); |
lib/std/math/float.zig+2-2| ... | ... | @@ -92,13 +92,13 @@ pub fn FloatRepr(comptime Float: type) type { |
| 92 | 92 | pub fn unbias(biased: BiasedExponent) Exponent { |
| 93 | 93 | switch (biased) { |
| 94 | 94 | .denormal => unreachable, |
| 95 | else => return @bitCast(@intFromEnum(biased) -% @intFromEnum(BiasedExponent.zero)), | |
| 95 | else => return @bitCast(@backingInt(biased) -% @backingInt(BiasedExponent.zero)), | |
| 96 | 96 | .infinite => unreachable, |
| 97 | 97 | } |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | pub fn bias(unbiased: Exponent) BiasedExponent { |
| 101 | return @enumFromInt(@intFromEnum(BiasedExponent.zero) +% @as(Int, @bitCast(unbiased))); | |
| 101 | return @fromBackingInt(@intCast(@backingInt(BiasedExponent.zero) +% @as(Int, @bitCast(unbiased)))); | |
| 102 | 102 | } |
| 103 | 103 | }; |
| 104 | 104 |
lib/std/mem.zig+13-13| ... | ... | @@ -32,12 +32,12 @@ pub const Alignment = enum(math.Log2Int(usize)) { |
| 32 | 32 | _, |
| 33 | 33 | |
| 34 | 34 | pub fn toByteUnits(a: Alignment) usize { |
| 35 | return @as(usize, 1) << @intFromEnum(a); | |
| 35 | return @as(usize, 1) << @backingInt(a); | |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | pub fn fromByteUnits(n: usize) Alignment { |
| 39 | 39 | assert(std.math.isPowerOfTwo(n)); |
| 40 | return @enumFromInt(@ctz(n)); | |
| 40 | return @fromBackingInt(@intCast(@ctz(n))); | |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | pub fn fromByteUnitsOptional(maybe_n: ?usize) ?Alignment { |
| ... | ... | @@ -49,36 +49,36 @@ pub const Alignment = enum(math.Log2Int(usize)) { |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | pub fn order(lhs: Alignment, rhs: Alignment) std.math.Order { |
| 52 | return std.math.order(@intFromEnum(lhs), @intFromEnum(rhs)); | |
| 52 | return std.math.order(@backingInt(lhs), @backingInt(rhs)); | |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | pub fn compare(lhs: Alignment, op: std.math.CompareOperator, rhs: Alignment) bool { |
| 56 | return std.math.compare(@intFromEnum(lhs), op, @intFromEnum(rhs)); | |
| 56 | return std.math.compare(@backingInt(lhs), op, @backingInt(rhs)); | |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | pub fn max(lhs: Alignment, rhs: Alignment) Alignment { |
| 60 | return @enumFromInt(@max(@intFromEnum(lhs), @intFromEnum(rhs))); | |
| 60 | return @fromBackingInt(@intCast(@max(@backingInt(lhs), @backingInt(rhs)))); | |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | pub fn min(lhs: Alignment, rhs: Alignment) Alignment { |
| 64 | return @enumFromInt(@min(@intFromEnum(lhs), @intFromEnum(rhs))); | |
| 64 | return @fromBackingInt(@intCast(@min(@backingInt(lhs), @backingInt(rhs)))); | |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | /// Return next address with this alignment. |
| 68 | 68 | pub fn forward(a: Alignment, address: usize) usize { |
| 69 | const x = (@as(usize, 1) << @intFromEnum(a)) - 1; | |
| 69 | const x = (@as(usize, 1) << @backingInt(a)) - 1; | |
| 70 | 70 | return (address + x) & ~x; |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | /// Return previous address with this alignment. |
| 74 | 74 | pub fn backward(a: Alignment, address: usize) usize { |
| 75 | const x = (@as(usize, 1) << @intFromEnum(a)) - 1; | |
| 75 | const x = (@as(usize, 1) << @backingInt(a)) - 1; | |
| 76 | 76 | return address & ~x; |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | /// Return whether address is aligned to this amount. |
| 80 | 80 | pub fn check(a: Alignment, address: usize) bool { |
| 81 | return @ctz(address) >= @intFromEnum(a); | |
| 81 | return @ctz(address) >= @backingInt(a); | |
| 82 | 82 | } |
| 83 | 83 | }; |
| 84 | 84 | |
| ... | ... | @@ -280,7 +280,7 @@ pub fn zeroes(comptime T: type) T { |
| 280 | 280 | return @as(T, 0); |
| 281 | 281 | }, |
| 282 | 282 | .@"enum" => { |
| 283 | return @as(T, @enumFromInt(0)); | |
| 283 | return @as(T, @fromBackingInt(@intCast(0))); | |
| 284 | 284 | }, |
| 285 | 285 | .void => { |
| 286 | 286 | return {}; |
| ... | ... | @@ -2233,7 +2233,7 @@ pub fn byteSwapAllFieldsAligned(comptime S: type, comptime a: Alignment, ptr: *a |
| 2233 | 2233 | .@"struct" => byteSwapAllFieldsAligned(f_type, .fromByteUnits(f_attr.@"align" orelse @alignOf(f_type)), &@field(ptr, f_name)), |
| 2234 | 2234 | .@"union", .array => byteSwapAllFieldsAligned(f_type, .fromByteUnits(f_attr.@"align" orelse @alignOf(f_type)), &@field(ptr, f_name)), |
| 2235 | 2235 | .@"enum" => { |
| 2236 | @field(ptr, f_name) = @enumFromInt(@byteSwap(@intFromEnum(@field(ptr, f_name)))); | |
| 2236 | @field(ptr, f_name) = @fromBackingInt(@intCast(@byteSwap(@backingInt(@field(ptr, f_name))))); | |
| 2237 | 2237 | }, |
| 2238 | 2238 | .bool => {}, |
| 2239 | 2239 | .float => |float| { |
| ... | ... | @@ -2364,7 +2364,7 @@ pub fn byteSwapAllElements(comptime Elem: type, slice: []Elem) void { |
| 2364 | 2364 | switch (@typeInfo(@TypeOf(elem.*))) { |
| 2365 | 2365 | .@"struct", .@"union", .array => byteSwapAllFields(@TypeOf(elem.*), elem), |
| 2366 | 2366 | .@"enum" => { |
| 2367 | elem.* = @enumFromInt(@byteSwap(@intFromEnum(elem.*))); | |
| 2367 | elem.* = @fromBackingInt(@intCast(@byteSwap(@backingInt(elem.*)))); | |
| 2368 | 2368 | }, |
| 2369 | 2369 | .bool => {}, |
| 2370 | 2370 | .float => |float| { |
| ... | ... | @@ -4784,7 +4784,7 @@ pub fn doNotOptimizeAway(val: anytype) void { |
| 4784 | 4784 | const t = @typeInfo(@TypeOf(val)); |
| 4785 | 4785 | switch (t) { |
| 4786 | 4786 | .void, .null, .comptime_int, .comptime_float => return, |
| 4787 | .@"enum" => doNotOptimizeAway(@intFromEnum(val)), | |
| 4787 | .@"enum" => doNotOptimizeAway(@backingInt(val)), | |
| 4788 | 4788 | .bool => doNotOptimizeAway(@intFromBool(val)), |
| 4789 | 4789 | .int => { |
| 4790 | 4790 | const bits = t.int.bits; |
lib/std/meta.zig+2-2| ... | ... | @@ -253,7 +253,7 @@ pub fn fieldInfo(comptime T: type, comptime field: FieldEnum(T)) switch (@typeIn |
| 253 | 253 | .error_set => struct { name: [:0]const u8 }, |
| 254 | 254 | else => @compileError("Expected struct, union, error set or enum type, found '" ++ @typeName(T) ++ "'"), |
| 255 | 255 | } { |
| 256 | const idx = @intFromEnum(field); | |
| 256 | const idx = @backingInt(field); | |
| 257 | 257 | return switch (@typeInfo(T)) { |
| 258 | 258 | .@"struct" => |info| .{ |
| 259 | 259 | .name = info.field_names[idx], |
| ... | ... | @@ -399,7 +399,7 @@ pub fn FieldEnum(comptime T: type) type { |
| 399 | 399 | switch (@typeInfo(T)) { |
| 400 | 400 | .@"union" => |@"union"| if (@"union".tag_type) |EnumTag| { |
| 401 | 401 | for (std.enums.values(EnumTag), 0..) |v, i| { |
| 402 | if (@intFromEnum(v) != i) break; // enum values not consecutive | |
| 402 | if (@backingInt(v) != i) break; // enum values not consecutive | |
| 403 | 403 | if (!std.mem.eql(u8, @tagName(v), field_names[i])) break; // fields out of order |
| 404 | 404 | } else { |
| 405 | 405 | return EnumTag; |
lib/std/meta/trailer_flags.zig+5-5| ... | ... | @@ -42,7 +42,7 @@ pub fn TrailerFlags(comptime Fields: type) type { |
| 42 | 42 | pub const Self = @This(); |
| 43 | 43 | |
| 44 | 44 | pub fn has(self: Self, comptime field: FieldEnum) bool { |
| 45 | const field_index = @intFromEnum(field); | |
| 45 | const field_index = @backingInt(field); | |
| 46 | 46 | return (self.bits & (1 << field_index)) != 0; |
| 47 | 47 | } |
| 48 | 48 | |
| ... | ... | @@ -53,7 +53,7 @@ pub fn TrailerFlags(comptime Fields: type) type { |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | pub fn setFlag(self: *Self, comptime field: FieldEnum) void { |
| 56 | const field_index = @intFromEnum(field); | |
| 56 | const field_index = @backingInt(field); | |
| 57 | 57 | self.bits |= 1 << field_index; |
| 58 | 58 | } |
| 59 | 59 | |
| ... | ... | @@ -71,7 +71,7 @@ pub fn TrailerFlags(comptime Fields: type) type { |
| 71 | 71 | pub fn setMany(self: Self, p: [*]align(@alignOf(Fields)) u8, fields: FieldValues) void { |
| 72 | 72 | inline for (@typeInfo(Fields).@"struct".field_names, 0..) |field_name, i| { |
| 73 | 73 | if (@field(fields, field_name)) |value| |
| 74 | self.set(p, @as(FieldEnum, @enumFromInt(i)), value); | |
| 74 | self.set(p, @as(FieldEnum, @fromBackingInt(@intCast(i))), value); | |
| 75 | 75 | } |
| 76 | 76 | } |
| 77 | 77 | |
| ... | ... | @@ -102,7 +102,7 @@ pub fn TrailerFlags(comptime Fields: type) type { |
| 102 | 102 | var off: usize = 0; |
| 103 | 103 | inline for (@typeInfo(Fields).@"struct".field_types, 0..) |field_type, i| { |
| 104 | 104 | const active = (self.bits & (1 << i)) != 0; |
| 105 | if (i == @intFromEnum(field)) { | |
| 105 | if (i == @backingInt(field)) { | |
| 106 | 106 | assert(active); |
| 107 | 107 | return mem.alignForward(usize, off, @alignOf(field_type)); |
| 108 | 108 | } else if (active) { |
| ... | ... | @@ -113,7 +113,7 @@ pub fn TrailerFlags(comptime Fields: type) type { |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | pub fn Field(comptime field: FieldEnum) type { |
| 116 | return @typeInfo(Fields).@"struct".field_types[@intFromEnum(field)]; | |
| 116 | return @typeInfo(Fields).@"struct".field_types[@backingInt(field)]; | |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | pub fn sizeInBytes(self: Self) usize { |
lib/std/multi_array_list.zig+13-13| ... | ... | @@ -92,7 +92,7 @@ pub fn MultiArrayList(comptime T: type) type { |
| 92 | 92 | if (self.capacity == 0) { |
| 93 | 93 | return &[_]F{}; |
| 94 | 94 | } |
| 95 | const byte_ptr = self.ptrs[@intFromEnum(field)]; | |
| 95 | const byte_ptr = self.ptrs[@backingInt(field)]; | |
| 96 | 96 | const casted_ptr: [*]F = if (@sizeOf(F) == 0) |
| 97 | 97 | undefined |
| 98 | 98 | else |
| ... | ... | @@ -107,14 +107,14 @@ pub fn MultiArrayList(comptime T: type) type { |
| 107 | 107 | else => unreachable, |
| 108 | 108 | }; |
| 109 | 109 | inline for (field_names, 0..) |field_name, i| { |
| 110 | self.items(@as(Field, @enumFromInt(i)))[index] = @field(e, field_name); | |
| 110 | self.items(@as(Field, @fromBackingInt(@intCast(i))))[index] = @field(e, field_name); | |
| 111 | 111 | } |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | pub fn get(self: Slice, index: usize) T { |
| 115 | 115 | var result: Elem = undefined; |
| 116 | 116 | inline for (field_names, 0..) |field_name, i| { |
| 117 | @field(result, field_name) = self.items(@as(Field, @enumFromInt(i)))[index]; | |
| 117 | @field(result, field_name) = self.items(@as(Field, @fromBackingInt(@intCast(i))))[index]; | |
| 118 | 118 | } |
| 119 | 119 | return switch (@typeInfo(T)) { |
| 120 | 120 | .@"struct" => result, |
| ... | ... | @@ -361,7 +361,7 @@ pub fn MultiArrayList(comptime T: type) type { |
| 361 | 361 | }; |
| 362 | 362 | const slices = self.slice(); |
| 363 | 363 | inline for (field_names, 0..) |field_name, field_index| { |
| 364 | const field_slice = slices.items(@as(Field, @enumFromInt(field_index))); | |
| 364 | const field_slice = slices.items(@as(Field, @fromBackingInt(@intCast(field_index)))); | |
| 365 | 365 | var i: usize = self.len - 1; |
| 366 | 366 | while (i > index) : (i -= 1) { |
| 367 | 367 | field_slice[i] = field_slice[i - 1]; |
| ... | ... | @@ -387,7 +387,7 @@ pub fn MultiArrayList(comptime T: type) type { |
| 387 | 387 | pub fn swapRemove(self: *Self, index: usize) void { |
| 388 | 388 | const slices = self.slice(); |
| 389 | 389 | inline for (field_names, 0..) |_, i| { |
| 390 | const field_slice = slices.items(@as(Field, @enumFromInt(i))); | |
| 390 | const field_slice = slices.items(@as(Field, @fromBackingInt(@intCast(i)))); | |
| 391 | 391 | field_slice[index] = field_slice[self.len - 1]; |
| 392 | 392 | field_slice[self.len - 1] = undefined; |
| 393 | 393 | } |
| ... | ... | @@ -399,7 +399,7 @@ pub fn MultiArrayList(comptime T: type) type { |
| 399 | 399 | pub fn orderedRemove(self: *Self, index: usize) void { |
| 400 | 400 | const slices = self.slice(); |
| 401 | 401 | inline for (field_names, 0..) |_, field_index| { |
| 402 | const field_slice = slices.items(@as(Field, @enumFromInt(field_index))); | |
| 402 | const field_slice = slices.items(@as(Field, @fromBackingInt(@intCast(field_index)))); | |
| 403 | 403 | var i = index; |
| 404 | 404 | while (i < self.len - 1) : (i += 1) { |
| 405 | 405 | field_slice[i] = field_slice[i + 1]; |
| ... | ... | @@ -430,7 +430,7 @@ pub fn MultiArrayList(comptime T: type) type { |
| 430 | 430 | const start = removed + 1; |
| 431 | 431 | const len = end - start; // safety checks `sorted_indexes` are sorted |
| 432 | 432 | inline for (field_names, 0..) |_, field_index| { |
| 433 | const field_slice = slices.items(@enumFromInt(field_index)); | |
| 433 | const field_slice = slices.items(@fromBackingInt(@intCast(field_index))); | |
| 434 | 434 | @memmove(field_slice[start - shift ..][0..len], field_slice[start..][0..len]); // safety checks initial `sorted_indexes` are in range |
| 435 | 435 | } |
| 436 | 436 | shift += 1; |
| ... | ... | @@ -439,7 +439,7 @@ pub fn MultiArrayList(comptime T: type) type { |
| 439 | 439 | const end = self.len; |
| 440 | 440 | const len = end - start; // safety checks final `sorted_indexes` are in range |
| 441 | 441 | inline for (field_names, 0..) |_, field_index| { |
| 442 | const field_slice = slices.items(@enumFromInt(field_index)); | |
| 442 | const field_slice = slices.items(@fromBackingInt(@intCast(field_index))); | |
| 443 | 443 | @memmove(field_slice[start - shift ..][0..len], field_slice[start..][0..len]); |
| 444 | 444 | } |
| 445 | 445 | self.len = end - shift; |
| ... | ... | @@ -465,7 +465,7 @@ pub fn MultiArrayList(comptime T: type) type { |
| 465 | 465 | const self_slice = self.slice(); |
| 466 | 466 | inline for (field_types, 0..) |field_type, i| { |
| 467 | 467 | if (@sizeOf(field_type) != 0) { |
| 468 | const field = @as(Field, @enumFromInt(i)); | |
| 468 | const field = @as(Field, @fromBackingInt(@intCast(i))); | |
| 469 | 469 | const dest_slice = self_slice.items(field)[new_len..]; |
| 470 | 470 | // We use memset here for more efficient codegen in safety-checked, |
| 471 | 471 | // valgrind-enabled builds. Otherwise the valgrind client request |
| ... | ... | @@ -486,7 +486,7 @@ pub fn MultiArrayList(comptime T: type) type { |
| 486 | 486 | const other_slice = other.slice(); |
| 487 | 487 | inline for (field_types, 0..) |field_type, i| { |
| 488 | 488 | if (@sizeOf(field_type) != 0) { |
| 489 | const field = @as(Field, @enumFromInt(i)); | |
| 489 | const field = @as(Field, @fromBackingInt(@intCast(i))); | |
| 490 | 490 | @memcpy(other_slice.items(field), self_slice.items(field)); |
| 491 | 491 | } |
| 492 | 492 | } |
| ... | ... | @@ -558,7 +558,7 @@ pub fn MultiArrayList(comptime T: type) type { |
| 558 | 558 | const other_slice = other.slice(); |
| 559 | 559 | inline for (field_types, 0..) |field_type, i| { |
| 560 | 560 | if (@sizeOf(field_type) != 0) { |
| 561 | const field = @as(Field, @enumFromInt(i)); | |
| 561 | const field = @as(Field, @fromBackingInt(@intCast(i))); | |
| 562 | 562 | @memcpy(other_slice.items(field), self_slice.items(field)); |
| 563 | 563 | } |
| 564 | 564 | } |
| ... | ... | @@ -577,7 +577,7 @@ pub fn MultiArrayList(comptime T: type) type { |
| 577 | 577 | const result_slice = result.slice(); |
| 578 | 578 | inline for (field_types, 0..) |field_type, i| { |
| 579 | 579 | if (@sizeOf(field_type) != 0) { |
| 580 | const field = @as(Field, @enumFromInt(i)); | |
| 580 | const field = @as(Field, @fromBackingInt(@intCast(i))); | |
| 581 | 581 | @memcpy(result_slice.items(field), self_slice.items(field)); |
| 582 | 582 | } |
| 583 | 583 | } |
| ... | ... | @@ -594,7 +594,7 @@ pub fn MultiArrayList(comptime T: type) type { |
| 594 | 594 | pub fn swap(sc: @This(), a_index: usize, b_index: usize) void { |
| 595 | 595 | inline for (field_types, 0..) |field_type, i| { |
| 596 | 596 | if (@sizeOf(field_type) != 0) { |
| 597 | const field: Field = @enumFromInt(i); | |
| 597 | const field: Field = @fromBackingInt(@intCast(i)); | |
| 598 | 598 | const ptr = sc.slice.items(field); |
| 599 | 599 | mem.swap(field_type, &ptr[a_index], &ptr[b_index]); |
| 600 | 600 | } |
lib/std/os/emscripten.zig+79-79| ... | ... | @@ -28,85 +28,85 @@ pub fn CPU_COUNT(set: cpu_set_t) cpu_count_t { |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | pub const E = enum(u16) { |
| 31 | SUCCESS = @intFromEnum(wasi.errno_t.SUCCESS), | |
| 32 | @"2BIG" = @intFromEnum(wasi.errno_t.@"2BIG"), | |
| 33 | ACCES = @intFromEnum(wasi.errno_t.ACCES), | |
| 34 | ADDRINUSE = @intFromEnum(wasi.errno_t.ADDRINUSE), | |
| 35 | ADDRNOTAVAIL = @intFromEnum(wasi.errno_t.ADDRNOTAVAIL), | |
| 36 | AFNOSUPPORT = @intFromEnum(wasi.errno_t.AFNOSUPPORT), | |
| 31 | SUCCESS = @backingInt(wasi.errno_t.SUCCESS), | |
| 32 | @"2BIG" = @backingInt(wasi.errno_t.@"2BIG"), | |
| 33 | ACCES = @backingInt(wasi.errno_t.ACCES), | |
| 34 | ADDRINUSE = @backingInt(wasi.errno_t.ADDRINUSE), | |
| 35 | ADDRNOTAVAIL = @backingInt(wasi.errno_t.ADDRNOTAVAIL), | |
| 36 | AFNOSUPPORT = @backingInt(wasi.errno_t.AFNOSUPPORT), | |
| 37 | 37 | /// This is also the error code used for `WOULDBLOCK`. |
| 38 | AGAIN = @intFromEnum(wasi.errno_t.AGAIN), | |
| 39 | ALREADY = @intFromEnum(wasi.errno_t.ALREADY), | |
| 40 | BADF = @intFromEnum(wasi.errno_t.BADF), | |
| 41 | BADMSG = @intFromEnum(wasi.errno_t.BADMSG), | |
| 42 | BUSY = @intFromEnum(wasi.errno_t.BUSY), | |
| 43 | CANCELED = @intFromEnum(wasi.errno_t.CANCELED), | |
| 44 | CHILD = @intFromEnum(wasi.errno_t.CHILD), | |
| 45 | CONNABORTED = @intFromEnum(wasi.errno_t.CONNABORTED), | |
| 46 | CONNREFUSED = @intFromEnum(wasi.errno_t.CONNREFUSED), | |
| 47 | CONNRESET = @intFromEnum(wasi.errno_t.CONNRESET), | |
| 48 | DEADLK = @intFromEnum(wasi.errno_t.DEADLK), | |
| 49 | DESTADDRREQ = @intFromEnum(wasi.errno_t.DESTADDRREQ), | |
| 50 | DOM = @intFromEnum(wasi.errno_t.DOM), | |
| 51 | DQUOT = @intFromEnum(wasi.errno_t.DQUOT), | |
| 52 | EXIST = @intFromEnum(wasi.errno_t.EXIST), | |
| 53 | FAULT = @intFromEnum(wasi.errno_t.FAULT), | |
| 54 | FBIG = @intFromEnum(wasi.errno_t.FBIG), | |
| 55 | HOSTUNREACH = @intFromEnum(wasi.errno_t.HOSTUNREACH), | |
| 56 | IDRM = @intFromEnum(wasi.errno_t.IDRM), | |
| 57 | ILSEQ = @intFromEnum(wasi.errno_t.ILSEQ), | |
| 58 | INPROGRESS = @intFromEnum(wasi.errno_t.INPROGRESS), | |
| 59 | INTR = @intFromEnum(wasi.errno_t.INTR), | |
| 60 | INVAL = @intFromEnum(wasi.errno_t.INVAL), | |
| 61 | IO = @intFromEnum(wasi.errno_t.IO), | |
| 62 | ISCONN = @intFromEnum(wasi.errno_t.ISCONN), | |
| 63 | ISDIR = @intFromEnum(wasi.errno_t.ISDIR), | |
| 64 | LOOP = @intFromEnum(wasi.errno_t.LOOP), | |
| 65 | MFILE = @intFromEnum(wasi.errno_t.MFILE), | |
| 66 | MLINK = @intFromEnum(wasi.errno_t.MLINK), | |
| 67 | MSGSIZE = @intFromEnum(wasi.errno_t.MSGSIZE), | |
| 68 | MULTIHOP = @intFromEnum(wasi.errno_t.MULTIHOP), | |
| 69 | NAMETOOLONG = @intFromEnum(wasi.errno_t.NAMETOOLONG), | |
| 70 | NETDOWN = @intFromEnum(wasi.errno_t.NETDOWN), | |
| 71 | NETRESET = @intFromEnum(wasi.errno_t.NETRESET), | |
| 72 | NETUNREACH = @intFromEnum(wasi.errno_t.NETUNREACH), | |
| 73 | NFILE = @intFromEnum(wasi.errno_t.NFILE), | |
| 74 | NOBUFS = @intFromEnum(wasi.errno_t.NOBUFS), | |
| 75 | NODEV = @intFromEnum(wasi.errno_t.NODEV), | |
| 76 | NOENT = @intFromEnum(wasi.errno_t.NOENT), | |
| 77 | NOEXEC = @intFromEnum(wasi.errno_t.NOEXEC), | |
| 78 | NOLCK = @intFromEnum(wasi.errno_t.NOLCK), | |
| 79 | NOLINK = @intFromEnum(wasi.errno_t.NOLINK), | |
| 80 | NOMEM = @intFromEnum(wasi.errno_t.NOMEM), | |
| 81 | NOMSG = @intFromEnum(wasi.errno_t.NOMSG), | |
| 82 | NOPROTOOPT = @intFromEnum(wasi.errno_t.NOPROTOOPT), | |
| 83 | NOSPC = @intFromEnum(wasi.errno_t.NOSPC), | |
| 84 | NOSYS = @intFromEnum(wasi.errno_t.NOSYS), | |
| 85 | NOTCONN = @intFromEnum(wasi.errno_t.NOTCONN), | |
| 86 | NOTDIR = @intFromEnum(wasi.errno_t.NOTDIR), | |
| 87 | NOTEMPTY = @intFromEnum(wasi.errno_t.NOTEMPTY), | |
| 88 | NOTRECOVERABLE = @intFromEnum(wasi.errno_t.NOTRECOVERABLE), | |
| 89 | NOTSOCK = @intFromEnum(wasi.errno_t.NOTSOCK), | |
| 38 | AGAIN = @backingInt(wasi.errno_t.AGAIN), | |
| 39 | ALREADY = @backingInt(wasi.errno_t.ALREADY), | |
| 40 | BADF = @backingInt(wasi.errno_t.BADF), | |
| 41 | BADMSG = @backingInt(wasi.errno_t.BADMSG), | |
| 42 | BUSY = @backingInt(wasi.errno_t.BUSY), | |
| 43 | CANCELED = @backingInt(wasi.errno_t.CANCELED), | |
| 44 | CHILD = @backingInt(wasi.errno_t.CHILD), | |
| 45 | CONNABORTED = @backingInt(wasi.errno_t.CONNABORTED), | |
| 46 | CONNREFUSED = @backingInt(wasi.errno_t.CONNREFUSED), | |
| 47 | CONNRESET = @backingInt(wasi.errno_t.CONNRESET), | |
| 48 | DEADLK = @backingInt(wasi.errno_t.DEADLK), | |
| 49 | DESTADDRREQ = @backingInt(wasi.errno_t.DESTADDRREQ), | |
| 50 | DOM = @backingInt(wasi.errno_t.DOM), | |
| 51 | DQUOT = @backingInt(wasi.errno_t.DQUOT), | |
| 52 | EXIST = @backingInt(wasi.errno_t.EXIST), | |
| 53 | FAULT = @backingInt(wasi.errno_t.FAULT), | |
| 54 | FBIG = @backingInt(wasi.errno_t.FBIG), | |
| 55 | HOSTUNREACH = @backingInt(wasi.errno_t.HOSTUNREACH), | |
| 56 | IDRM = @backingInt(wasi.errno_t.IDRM), | |
| 57 | ILSEQ = @backingInt(wasi.errno_t.ILSEQ), | |
| 58 | INPROGRESS = @backingInt(wasi.errno_t.INPROGRESS), | |
| 59 | INTR = @backingInt(wasi.errno_t.INTR), | |
| 60 | INVAL = @backingInt(wasi.errno_t.INVAL), | |
| 61 | IO = @backingInt(wasi.errno_t.IO), | |
| 62 | ISCONN = @backingInt(wasi.errno_t.ISCONN), | |
| 63 | ISDIR = @backingInt(wasi.errno_t.ISDIR), | |
| 64 | LOOP = @backingInt(wasi.errno_t.LOOP), | |
| 65 | MFILE = @backingInt(wasi.errno_t.MFILE), | |
| 66 | MLINK = @backingInt(wasi.errno_t.MLINK), | |
| 67 | MSGSIZE = @backingInt(wasi.errno_t.MSGSIZE), | |
| 68 | MULTIHOP = @backingInt(wasi.errno_t.MULTIHOP), | |
| 69 | NAMETOOLONG = @backingInt(wasi.errno_t.NAMETOOLONG), | |
| 70 | NETDOWN = @backingInt(wasi.errno_t.NETDOWN), | |
| 71 | NETRESET = @backingInt(wasi.errno_t.NETRESET), | |
| 72 | NETUNREACH = @backingInt(wasi.errno_t.NETUNREACH), | |
| 73 | NFILE = @backingInt(wasi.errno_t.NFILE), | |
| 74 | NOBUFS = @backingInt(wasi.errno_t.NOBUFS), | |
| 75 | NODEV = @backingInt(wasi.errno_t.NODEV), | |
| 76 | NOENT = @backingInt(wasi.errno_t.NOENT), | |
| 77 | NOEXEC = @backingInt(wasi.errno_t.NOEXEC), | |
| 78 | NOLCK = @backingInt(wasi.errno_t.NOLCK), | |
| 79 | NOLINK = @backingInt(wasi.errno_t.NOLINK), | |
| 80 | NOMEM = @backingInt(wasi.errno_t.NOMEM), | |
| 81 | NOMSG = @backingInt(wasi.errno_t.NOMSG), | |
| 82 | NOPROTOOPT = @backingInt(wasi.errno_t.NOPROTOOPT), | |
| 83 | NOSPC = @backingInt(wasi.errno_t.NOSPC), | |
| 84 | NOSYS = @backingInt(wasi.errno_t.NOSYS), | |
| 85 | NOTCONN = @backingInt(wasi.errno_t.NOTCONN), | |
| 86 | NOTDIR = @backingInt(wasi.errno_t.NOTDIR), | |
| 87 | NOTEMPTY = @backingInt(wasi.errno_t.NOTEMPTY), | |
| 88 | NOTRECOVERABLE = @backingInt(wasi.errno_t.NOTRECOVERABLE), | |
| 89 | NOTSOCK = @backingInt(wasi.errno_t.NOTSOCK), | |
| 90 | 90 | /// This is also the code used for `NOTSUP`. |
| 91 | OPNOTSUPP = @intFromEnum(wasi.errno_t.OPNOTSUPP), | |
| 92 | NOTTY = @intFromEnum(wasi.errno_t.NOTTY), | |
| 93 | NXIO = @intFromEnum(wasi.errno_t.NXIO), | |
| 94 | OVERFLOW = @intFromEnum(wasi.errno_t.OVERFLOW), | |
| 95 | OWNERDEAD = @intFromEnum(wasi.errno_t.OWNERDEAD), | |
| 96 | PERM = @intFromEnum(wasi.errno_t.PERM), | |
| 97 | PIPE = @intFromEnum(wasi.errno_t.PIPE), | |
| 98 | PROTO = @intFromEnum(wasi.errno_t.PROTO), | |
| 99 | PROTONOSUPPORT = @intFromEnum(wasi.errno_t.PROTONOSUPPORT), | |
| 100 | PROTOTYPE = @intFromEnum(wasi.errno_t.PROTOTYPE), | |
| 101 | RANGE = @intFromEnum(wasi.errno_t.RANGE), | |
| 102 | ROFS = @intFromEnum(wasi.errno_t.ROFS), | |
| 103 | SPIPE = @intFromEnum(wasi.errno_t.SPIPE), | |
| 104 | SRCH = @intFromEnum(wasi.errno_t.SRCH), | |
| 105 | STALE = @intFromEnum(wasi.errno_t.STALE), | |
| 106 | TIMEDOUT = @intFromEnum(wasi.errno_t.TIMEDOUT), | |
| 107 | TXTBSY = @intFromEnum(wasi.errno_t.TXTBSY), | |
| 108 | XDEV = @intFromEnum(wasi.errno_t.XDEV), | |
| 109 | NOTCAPABLE = @intFromEnum(wasi.errno_t.NOTCAPABLE), | |
| 91 | OPNOTSUPP = @backingInt(wasi.errno_t.OPNOTSUPP), | |
| 92 | NOTTY = @backingInt(wasi.errno_t.NOTTY), | |
| 93 | NXIO = @backingInt(wasi.errno_t.NXIO), | |
| 94 | OVERFLOW = @backingInt(wasi.errno_t.OVERFLOW), | |
| 95 | OWNERDEAD = @backingInt(wasi.errno_t.OWNERDEAD), | |
| 96 | PERM = @backingInt(wasi.errno_t.PERM), | |
| 97 | PIPE = @backingInt(wasi.errno_t.PIPE), | |
| 98 | PROTO = @backingInt(wasi.errno_t.PROTO), | |
| 99 | PROTONOSUPPORT = @backingInt(wasi.errno_t.PROTONOSUPPORT), | |
| 100 | PROTOTYPE = @backingInt(wasi.errno_t.PROTOTYPE), | |
| 101 | RANGE = @backingInt(wasi.errno_t.RANGE), | |
| 102 | ROFS = @backingInt(wasi.errno_t.ROFS), | |
| 103 | SPIPE = @backingInt(wasi.errno_t.SPIPE), | |
| 104 | SRCH = @backingInt(wasi.errno_t.SRCH), | |
| 105 | STALE = @backingInt(wasi.errno_t.STALE), | |
| 106 | TIMEDOUT = @backingInt(wasi.errno_t.TIMEDOUT), | |
| 107 | TXTBSY = @backingInt(wasi.errno_t.TXTBSY), | |
| 108 | XDEV = @backingInt(wasi.errno_t.XDEV), | |
| 109 | NOTCAPABLE = @backingInt(wasi.errno_t.NOTCAPABLE), | |
| 110 | 110 | |
| 111 | 111 | ENOSTR = 100, |
| 112 | 112 | EBFONT = 101, |
| ... | ... | @@ -209,10 +209,10 @@ pub const W = struct { |
| 209 | 209 | return @as(u8, @intCast((s & 0xff00) >> 8)); |
| 210 | 210 | } |
| 211 | 211 | pub fn TERMSIG(s: u32) SIG { |
| 212 | return @enumFromInt(s & 0x7f); | |
| 212 | return @fromBackingInt(@intCast(s & 0x7f)); | |
| 213 | 213 | } |
| 214 | 214 | pub fn STOPSIG(s: u32) SIG { |
| 215 | return @enumFromInt(EXITSTATUS(s)); | |
| 215 | return @fromBackingInt(@intCast(EXITSTATUS(s))); | |
| 216 | 216 | } |
| 217 | 217 | pub fn IFEXITED(s: u32) bool { |
| 218 | 218 | return (s & 0x7f) == 0; |
lib/std/os/linux.zig+44-44| ... | ... | @@ -755,7 +755,7 @@ fn splitValue64(val: i64) [2]u32 { |
| 755 | 755 | pub fn errno(r: u64) E { |
| 756 | 756 | const signed_r: i32 = @bitCast(@as(u32, @truncate(r))); |
| 757 | 757 | const int = if (signed_r > -4096 and signed_r < 0) -signed_r else 0; |
| 758 | return @enumFromInt(int); | |
| 758 | return @fromBackingInt(@intCast(int)); | |
| 759 | 759 | } |
| 760 | 760 | |
| 761 | 761 | pub fn brk(addr: usize) usize { |
| ... | ... | @@ -822,7 +822,7 @@ pub fn fork() usize { |
| 822 | 822 | } else if (@hasField(SYS, "fork")) { |
| 823 | 823 | return syscall0(.fork); |
| 824 | 824 | } else { |
| 825 | return syscall2(.clone, @intFromEnum(SIG.CHLD), 0); | |
| 825 | return syscall2(.clone, @backingInt(SIG.CHLD), 0); | |
| 826 | 826 | } |
| 827 | 827 | } |
| 828 | 828 | |
| ... | ... | @@ -945,7 +945,7 @@ pub fn futex2_waitv( |
| 945 | 945 | nr_futexes, |
| 946 | 946 | @as(u32, @bitCast(flags)), |
| 947 | 947 | @intFromPtr(timeout), |
| 948 | @intFromEnum(clockid), | |
| 948 | @backingInt(clockid), | |
| 949 | 949 | ); |
| 950 | 950 | } |
| 951 | 951 | |
| ... | ... | @@ -974,7 +974,7 @@ pub fn futex2_wait( |
| 974 | 974 | mask, |
| 975 | 975 | @as(u32, @bitCast(flags)), |
| 976 | 976 | @intFromPtr(timeout), |
| 977 | @intFromEnum(clockid), | |
| 977 | @backingInt(clockid), | |
| 978 | 978 | ); |
| 979 | 979 | } |
| 980 | 980 | |
| ... | ... | @@ -1250,7 +1250,7 @@ pub const FSCONFIG_CMD = enum(u32) { |
| 1250 | 1250 | }; |
| 1251 | 1251 | |
| 1252 | 1252 | pub fn fsconfig(fd: fd_t, cmd: FSCONFIG_CMD, key: ?[*:0]const u8, value: ?[*:0]const u8, aux: u32) usize { |
| 1253 | return syscall5(.fsconfig, @as(u32, @bitCast(fd)), @intFromEnum(cmd), @intFromPtr(key), @intFromPtr(value), aux); | |
| 1253 | return syscall5(.fsconfig, @as(u32, @bitCast(fd)), @backingInt(cmd), @intFromPtr(key), @intFromPtr(value), aux); | |
| 1254 | 1254 | } |
| 1255 | 1255 | |
| 1256 | 1256 | pub const FSMOUNT = packed struct(u32) { |
| ... | ... | @@ -1897,9 +1897,9 @@ pub const LINUX_REBOOT = struct { |
| 1897 | 1897 | pub fn reboot(magic: LINUX_REBOOT.MAGIC1, magic2: LINUX_REBOOT.MAGIC2, cmd: LINUX_REBOOT.CMD, arg: ?*const anyopaque) usize { |
| 1898 | 1898 | return std.os.linux.syscall4( |
| 1899 | 1899 | .reboot, |
| 1900 | @intFromEnum(magic), | |
| 1901 | @intFromEnum(magic2), | |
| 1902 | @intFromEnum(cmd), | |
| 1900 | @backingInt(magic), | |
| 1901 | @backingInt(magic2), | |
| 1902 | @backingInt(cmd), | |
| 1903 | 1903 | @intFromPtr(arg), |
| 1904 | 1904 | ); |
| 1905 | 1905 | } |
| ... | ... | @@ -1909,15 +1909,15 @@ pub fn getrandom(buf: [*]u8, count: usize, flags: u32) usize { |
| 1909 | 1909 | } |
| 1910 | 1910 | |
| 1911 | 1911 | pub fn kill(pid: pid_t, sig: SIG) usize { |
| 1912 | return syscall2(.kill, @as(u32, @bitCast(pid)), @intFromEnum(sig)); | |
| 1912 | return syscall2(.kill, @as(u32, @bitCast(pid)), @backingInt(sig)); | |
| 1913 | 1913 | } |
| 1914 | 1914 | |
| 1915 | 1915 | pub fn tkill(tid: pid_t, sig: SIG) usize { |
| 1916 | return syscall2(.tkill, @as(u32, @bitCast(tid)), @intFromEnum(sig)); | |
| 1916 | return syscall2(.tkill, @as(u32, @bitCast(tid)), @backingInt(sig)); | |
| 1917 | 1917 | } |
| 1918 | 1918 | |
| 1919 | 1919 | pub fn tgkill(tgid: pid_t, tid: pid_t, sig: SIG) usize { |
| 1920 | return syscall3(.tgkill, @as(u32, @bitCast(tgid)), @as(u32, @bitCast(tid)), @intFromEnum(sig)); | |
| 1920 | return syscall3(.tgkill, @as(u32, @bitCast(tgid)), @as(u32, @bitCast(tid)), @backingInt(sig)); | |
| 1921 | 1921 | } |
| 1922 | 1922 | |
| 1923 | 1923 | pub fn link(oldpath: [*:0]const u8, newpath: [*:0]const u8) usize { |
| ... | ... | @@ -1979,7 +1979,7 @@ pub fn wait4(pid: pid_t, status: *i32, flags: u32, usage: ?*rusage) usize { |
| 1979 | 1979 | pub fn waitid(id_type: P, id: pid_t, infop: *siginfo_t, flags: u32, usage: ?*rusage) usize { |
| 1980 | 1980 | return syscall5( |
| 1981 | 1981 | .waitid, |
| 1982 | @intFromEnum(id_type), | |
| 1982 | @backingInt(id_type), | |
| 1983 | 1983 | @as(u32, @bitCast(id)), |
| 1984 | 1984 | @intFromPtr(infop), |
| 1985 | 1985 | flags, |
| ... | ... | @@ -2146,14 +2146,14 @@ pub fn clock_gettime(clk_id: clockid_t, tp: *timespec) usize { |
| 2146 | 2146 | if (ptr) |f| { |
| 2147 | 2147 | const rc = f(clk_id, tp); |
| 2148 | 2148 | switch (rc) { |
| 2149 | 0, @as(usize, @bitCast(-@as(isize, @intFromEnum(E.INVAL)))) => return rc, | |
| 2149 | 0, @as(usize, @bitCast(-@as(isize, @backingInt(E.INVAL)))) => return rc, | |
| 2150 | 2150 | else => {}, |
| 2151 | 2151 | } |
| 2152 | 2152 | } |
| 2153 | 2153 | } |
| 2154 | 2154 | return syscall2( |
| 2155 | 2155 | if (@hasField(SYS, "clock_gettime") and native_arch != .hexagon) .clock_gettime else .clock_gettime64, |
| 2156 | @intFromEnum(clk_id), | |
| 2156 | @backingInt(clk_id), | |
| 2157 | 2157 | @intFromPtr(tp), |
| 2158 | 2158 | ); |
| 2159 | 2159 | } |
| ... | ... | @@ -2165,13 +2165,13 @@ fn init_vdso_clock_gettime(clk: clockid_t, ts: *timespec) callconv(.c) usize { |
| 2165 | 2165 | @atomicStore(?VdsoClockGettime, &vdso_clock_gettime, ptr, .monotonic); |
| 2166 | 2166 | // Call into the VDSO if available |
| 2167 | 2167 | if (ptr) |f| return f(clk, ts); |
| 2168 | return @bitCast(-@as(isize, @intFromEnum(E.NOSYS))); | |
| 2168 | return @bitCast(-@as(isize, @backingInt(E.NOSYS))); | |
| 2169 | 2169 | } |
| 2170 | 2170 | |
| 2171 | 2171 | pub fn clock_getres(clk_id: clockid_t, tp: *timespec) usize { |
| 2172 | 2172 | return syscall2( |
| 2173 | 2173 | if (@hasField(SYS, "clock_getres") and native_arch != .hexagon) .clock_getres else .clock_getres_time64, |
| 2174 | @intFromEnum(clk_id), | |
| 2174 | @backingInt(clk_id), | |
| 2175 | 2175 | @intFromPtr(tp), |
| 2176 | 2176 | ); |
| 2177 | 2177 | } |
| ... | ... | @@ -2179,7 +2179,7 @@ pub fn clock_getres(clk_id: clockid_t, tp: *timespec) usize { |
| 2179 | 2179 | pub fn clock_settime(clk_id: clockid_t, tp: *const timespec) usize { |
| 2180 | 2180 | return syscall2( |
| 2181 | 2181 | if (@hasField(SYS, "clock_settime") and native_arch != .hexagon) .clock_settime else .clock_settime64, |
| 2182 | @intFromEnum(clk_id), | |
| 2182 | @backingInt(clk_id), | |
| 2183 | 2183 | @intFromPtr(tp), |
| 2184 | 2184 | ); |
| 2185 | 2185 | } |
| ... | ... | @@ -2187,7 +2187,7 @@ pub fn clock_settime(clk_id: clockid_t, tp: *const timespec) usize { |
| 2187 | 2187 | pub fn clock_nanosleep(clockid: clockid_t, flags: TIMER, request: *const timespec, remain: ?*timespec) usize { |
| 2188 | 2188 | return syscall4( |
| 2189 | 2189 | if (@hasField(SYS, "clock_nanosleep") and native_arch != .hexagon) .clock_nanosleep else .clock_nanosleep_time64, |
| 2190 | @intFromEnum(clockid), | |
| 2190 | @backingInt(clockid), | |
| 2191 | 2191 | @as(u32, @bitCast(flags)), |
| 2192 | 2192 | @intFromPtr(request), |
| 2193 | 2193 | @intFromPtr(remain), |
| ... | ... | @@ -2384,8 +2384,8 @@ pub fn sigprocmask(flags: u32, noalias set: ?*const sigset_t, noalias oldset: ?* |
| 2384 | 2384 | } |
| 2385 | 2385 | |
| 2386 | 2386 | pub fn sigaction(sig: SIG, noalias act: ?*const Sigaction, noalias oact: ?*Sigaction) usize { |
| 2387 | assert(@intFromEnum(sig) > 0); | |
| 2388 | assert(@intFromEnum(sig) < NSIG); | |
| 2387 | assert(@backingInt(sig) > 0); | |
| 2388 | assert(@backingInt(sig) < NSIG); | |
| 2389 | 2389 | assert(sig != .KILL); |
| 2390 | 2390 | assert(sig != .STOP); |
| 2391 | 2391 | |
| ... | ... | @@ -2418,8 +2418,8 @@ pub fn sigaction(sig: SIG, noalias act: ?*const Sigaction, noalias oact: ?*Sigac |
| 2418 | 2418 | |
| 2419 | 2419 | const result = switch (native_arch) { |
| 2420 | 2420 | // The sparc version of rt_sigaction needs the restorer function to be passed as an argument too. |
| 2421 | .sparc, .sparc64 => syscall5(.rt_sigaction, @intFromEnum(sig), ksa_arg, oldksa_arg, @intFromPtr(ksa.restorer), mask_size), | |
| 2422 | else => syscall4(.rt_sigaction, @intFromEnum(sig), ksa_arg, oldksa_arg, mask_size), | |
| 2421 | .sparc, .sparc64 => syscall5(.rt_sigaction, @backingInt(sig), ksa_arg, oldksa_arg, @intFromPtr(ksa.restorer), mask_size), | |
| 2422 | else => syscall4(.rt_sigaction, @backingInt(sig), ksa_arg, oldksa_arg, mask_size), | |
| 2423 | 2423 | }; |
| 2424 | 2424 | if (errno(result) != .SUCCESS) return result; |
| 2425 | 2425 | |
| ... | ... | @@ -2468,9 +2468,9 @@ pub fn sigfillset() sigset_t { |
| 2468 | 2468 | } |
| 2469 | 2469 | |
| 2470 | 2470 | fn sigset_bit_index(sig: SIG) struct { word: usize, mask: SigsetElement } { |
| 2471 | assert(@intFromEnum(sig) > 0); | |
| 2472 | assert(@intFromEnum(sig) < NSIG); | |
| 2473 | const bit = @intFromEnum(sig) - 1; | |
| 2471 | assert(@backingInt(sig) > 0); | |
| 2472 | assert(@backingInt(sig) < NSIG); | |
| 2473 | const bit = @backingInt(sig) - 1; | |
| 2474 | 2474 | return .{ |
| 2475 | 2475 | .word = bit / @bitSizeOf(SigsetElement), |
| 2476 | 2476 | .mask = @as(SigsetElement, 1) << @truncate(bit % @bitSizeOf(SigsetElement)), |
| ... | ... | @@ -2833,7 +2833,7 @@ pub fn eventfd(count: u32, flags: u32) usize { |
| 2833 | 2833 | pub fn timerfd_create(clockid: timerfd_clockid_t, flags: TFD) usize { |
| 2834 | 2834 | return syscall2( |
| 2835 | 2835 | .timerfd_create, |
| 2836 | @intFromEnum(clockid), | |
| 2836 | @backingInt(clockid), | |
| 2837 | 2837 | @as(u32, @bitCast(flags)), |
| 2838 | 2838 | ); |
| 2839 | 2839 | } |
| ... | ... | @@ -2909,7 +2909,7 @@ pub fn io_uring_enter(fd: fd_t, to_submit: u32, min_complete: u32, flags: u32, s |
| 2909 | 2909 | } |
| 2910 | 2910 | |
| 2911 | 2911 | pub fn io_uring_register(fd: fd_t, opcode: IORING_REGISTER, arg: ?*const anyopaque, nr_args: u32) usize { |
| 2912 | return syscall4(.io_uring_register, @as(u32, @bitCast(fd)), @intFromEnum(opcode), @intFromPtr(arg), nr_args); | |
| 2912 | return syscall4(.io_uring_register, @as(u32, @bitCast(fd)), @backingInt(opcode), @intFromPtr(arg), nr_args); | |
| 2913 | 2913 | } |
| 2914 | 2914 | |
| 2915 | 2915 | pub fn memfd_create(name: [*:0]const u8, flags: u32) usize { |
| ... | ... | @@ -2925,7 +2925,7 @@ pub fn tcgetattr(fd: fd_t, termios_p: *termios) usize { |
| 2925 | 2925 | } |
| 2926 | 2926 | |
| 2927 | 2927 | pub fn tcsetattr(fd: fd_t, optional_action: TCSA, termios_p: *const termios) usize { |
| 2928 | return syscall3(.ioctl, @as(u32, @bitCast(fd)), T.CSETS + @intFromEnum(optional_action), @intFromPtr(termios_p)); | |
| 2928 | return syscall3(.ioctl, @as(u32, @bitCast(fd)), T.CSETS + @backingInt(optional_action), @intFromPtr(termios_p)); | |
| 2929 | 2929 | } |
| 2930 | 2930 | |
| 2931 | 2931 | pub fn tcgetpgrp(fd: fd_t, pgrp: *pid_t) usize { |
| ... | ... | @@ -2961,7 +2961,7 @@ pub fn copy_file_range(fd_in: fd_t, off_in: ?*off_t, fd_out: fd_t, off_out: ?*of |
| 2961 | 2961 | } |
| 2962 | 2962 | |
| 2963 | 2963 | pub fn bpf(cmd: BPF.Cmd, attr: *BPF.Attr, size: u32) usize { |
| 2964 | return syscall3(.bpf, @intFromEnum(cmd), @intFromPtr(attr), size); | |
| 2964 | return syscall3(.bpf, @backingInt(cmd), @intFromPtr(attr), size); | |
| 2965 | 2965 | } |
| 2966 | 2966 | |
| 2967 | 2967 | pub fn sync() void { |
| ... | ... | @@ -2998,7 +2998,7 @@ pub fn prlimit(pid: pid_t, resource: rlimit_resource, new_limit: ?*const rlimit, |
| 2998 | 2998 | return syscall4( |
| 2999 | 2999 | .prlimit64, |
| 3000 | 3000 | @as(u32, @bitCast(pid)), |
| 3001 | @as(u32, @bitCast(@as(i32, @intFromEnum(resource)))), | |
| 3001 | @as(u32, @bitCast(@as(i32, @backingInt(resource)))), | |
| 3002 | 3002 | @intFromPtr(new_limit), |
| 3003 | 3003 | @intFromPtr(old_limit), |
| 3004 | 3004 | ); |
| ... | ... | @@ -3029,7 +3029,7 @@ pub fn pidfd_send_signal(pidfd: fd_t, sig: SIG, info: ?*siginfo_t, flags: u32) u |
| 3029 | 3029 | return syscall4( |
| 3030 | 3030 | .pidfd_send_signal, |
| 3031 | 3031 | @as(u32, @bitCast(pidfd)), |
| 3032 | @intFromEnum(sig), | |
| 3032 | @backingInt(sig), | |
| 3033 | 3033 | @intFromPtr(info), |
| 3034 | 3034 | flags, |
| 3035 | 3035 | ); |
| ... | ... | @@ -4346,10 +4346,10 @@ pub const W = struct { |
| 4346 | 4346 | return @as(u8, @intCast((s & 0xff00) >> 8)); |
| 4347 | 4347 | } |
| 4348 | 4348 | pub fn TERMSIG(s: u32) SIG { |
| 4349 | return @enumFromInt(s & 0x7f); | |
| 4349 | return @fromBackingInt(@intCast(s & 0x7f)); | |
| 4350 | 4350 | } |
| 4351 | 4351 | pub fn STOPSIG(s: u32) SIG { |
| 4352 | return @enumFromInt(EXITSTATUS(s)); | |
| 4352 | return @fromBackingInt(@intCast(EXITSTATUS(s))); | |
| 4353 | 4353 | } |
| 4354 | 4354 | pub fn IFEXITED(s: u32) bool { |
| 4355 | 4355 | return (s & 0x7f) == 0; |
| ... | ... | @@ -7258,26 +7258,26 @@ pub const IOSQE_BIT = enum(u8) { |
| 7258 | 7258 | // io_uring_sqe.flags |
| 7259 | 7259 | |
| 7260 | 7260 | /// use fixed fileset |
| 7261 | pub const IOSQE_FIXED_FILE = 1 << @intFromEnum(IOSQE_BIT.FIXED_FILE); | |
| 7261 | pub const IOSQE_FIXED_FILE = 1 << @backingInt(IOSQE_BIT.FIXED_FILE); | |
| 7262 | 7262 | |
| 7263 | 7263 | /// issue after inflight IO |
| 7264 | pub const IOSQE_IO_DRAIN = 1 << @intFromEnum(IOSQE_BIT.IO_DRAIN); | |
| 7264 | pub const IOSQE_IO_DRAIN = 1 << @backingInt(IOSQE_BIT.IO_DRAIN); | |
| 7265 | 7265 | |
| 7266 | 7266 | /// links next sqe |
| 7267 | pub const IOSQE_IO_LINK = 1 << @intFromEnum(IOSQE_BIT.IO_LINK); | |
| 7267 | pub const IOSQE_IO_LINK = 1 << @backingInt(IOSQE_BIT.IO_LINK); | |
| 7268 | 7268 | |
| 7269 | 7269 | /// like LINK, but stronger |
| 7270 | pub const IOSQE_IO_HARDLINK = 1 << @intFromEnum(IOSQE_BIT.IO_HARDLINK); | |
| 7270 | pub const IOSQE_IO_HARDLINK = 1 << @backingInt(IOSQE_BIT.IO_HARDLINK); | |
| 7271 | 7271 | |
| 7272 | 7272 | /// always go async |
| 7273 | pub const IOSQE_ASYNC = 1 << @intFromEnum(IOSQE_BIT.ASYNC); | |
| 7273 | pub const IOSQE_ASYNC = 1 << @backingInt(IOSQE_BIT.ASYNC); | |
| 7274 | 7274 | |
| 7275 | 7275 | /// select buffer from buf_group |
| 7276 | pub const IOSQE_BUFFER_SELECT = 1 << @intFromEnum(IOSQE_BIT.BUFFER_SELECT); | |
| 7276 | pub const IOSQE_BUFFER_SELECT = 1 << @backingInt(IOSQE_BIT.BUFFER_SELECT); | |
| 7277 | 7277 | |
| 7278 | 7278 | /// don't post CQE if request succeeded |
| 7279 | 7279 | /// Available since Linux 5.17 |
| 7280 | pub const IOSQE_CQE_SKIP_SUCCESS = 1 << @intFromEnum(IOSQE_BIT.CQE_SKIP_SUCCESS); | |
| 7280 | pub const IOSQE_CQE_SKIP_SUCCESS = 1 << @backingInt(IOSQE_BIT.CQE_SKIP_SUCCESS); | |
| 7281 | 7281 | |
| 7282 | 7282 | pub const IORING_OP = enum(u8) { |
| 7283 | 7283 | NOP, |
| ... | ... | @@ -7437,7 +7437,7 @@ pub const io_uring_cqe = extern struct { |
| 7437 | 7437 | |
| 7438 | 7438 | pub fn err(self: io_uring_cqe) E { |
| 7439 | 7439 | if (self.res > -4096 and self.res < 0) { |
| 7440 | return @as(E, @enumFromInt(-self.res)); | |
| 7440 | return @as(E, @fromBackingInt(@intCast(-self.res))); | |
| 7441 | 7441 | } |
| 7442 | 7442 | return .SUCCESS; |
| 7443 | 7443 | } |
| ... | ... | @@ -7724,8 +7724,8 @@ pub const io_uring_probe = extern struct { |
| 7724 | 7724 | |
| 7725 | 7725 | /// Is the operation supported on the running kernel. |
| 7726 | 7726 | pub fn is_supported(self: @This(), op: IORING_OP) bool { |
| 7727 | const i = @intFromEnum(op); | |
| 7728 | if (i > @intFromEnum(self.last_op) or i >= self.ops_len) | |
| 7727 | const i = @backingInt(op); | |
| 7728 | if (i > @backingInt(self.last_op) or i >= self.ops_len) | |
| 7729 | 7729 | return false; |
| 7730 | 7730 | return self.ops[i].is_supported(); |
| 7731 | 7731 | } |
| ... | ... | @@ -10741,7 +10741,7 @@ pub const AUDIT = struct { |
| 10741 | 10741 | LOONGARCH64 = toAudit(.LOONGARCH, @"64BIT" | LE), |
| 10742 | 10742 | |
| 10743 | 10743 | fn toAudit(em: elf.EM, flags: u32) u32 { |
| 10744 | return @intFromEnum(em) | flags; | |
| 10744 | return @backingInt(em) | flags; | |
| 10745 | 10745 | } |
| 10746 | 10746 | |
| 10747 | 10747 | pub const current: AUDIT.ARCH = switch (native_arch) { |
lib/std/os/linux/IoUring/test.zig+9-9| ... | ... | @@ -589,7 +589,7 @@ test "sendmsg/recvmsg" { |
| 589 | 589 | try testing.expectEqual(@as(u32, 2), ring.cq_ready()); |
| 590 | 590 | |
| 591 | 591 | const cqe_sendmsg = try ring.copy_cqe(); |
| 592 | if (cqe_sendmsg.res == -@as(i32, @intFromEnum(linux.E.INVAL))) return error.SkipZigTest; | |
| 592 | if (cqe_sendmsg.res == -@as(i32, @backingInt(linux.E.INVAL))) return error.SkipZigTest; | |
| 593 | 593 | try testing.expectEqual(linux.io_uring_cqe{ |
| 594 | 594 | .user_data = 0x11111111, |
| 595 | 595 | .res = buffer_send.len, |
| ... | ... | @@ -597,7 +597,7 @@ test "sendmsg/recvmsg" { |
| 597 | 597 | }, cqe_sendmsg); |
| 598 | 598 | |
| 599 | 599 | const cqe_recvmsg = try ring.copy_cqe(); |
| 600 | if (cqe_recvmsg.res == -@as(i32, @intFromEnum(linux.E.INVAL))) return error.SkipZigTest; | |
| 600 | if (cqe_recvmsg.res == -@as(i32, @backingInt(linux.E.INVAL))) return error.SkipZigTest; | |
| 601 | 601 | try testing.expectEqual(linux.io_uring_cqe{ |
| 602 | 602 | .user_data = 0x22222222, |
| 603 | 603 | .res = buffer_recv.len, |
| ... | ... | @@ -631,7 +631,7 @@ test "timeout (after a relative time)" { |
| 631 | 631 | |
| 632 | 632 | try testing.expectEqual(linux.io_uring_cqe{ |
| 633 | 633 | .user_data = 0x55555555, |
| 634 | .res = -@as(i32, @intFromEnum(linux.E.TIME)), | |
| 634 | .res = -@as(i32, @backingInt(linux.E.TIME)), | |
| 635 | 635 | .flags = 0, |
| 636 | 636 | }, cqe); |
| 637 | 637 | |
| ... | ... | @@ -716,7 +716,7 @@ test "timeout_remove" { |
| 716 | 716 | if (cqe.user_data == 0x88888888) { |
| 717 | 717 | try testing.expectEqual(linux.io_uring_cqe{ |
| 718 | 718 | .user_data = 0x88888888, |
| 719 | .res = -@as(i32, @intFromEnum(linux.E.CANCELED)), | |
| 719 | .res = -@as(i32, @backingInt(linux.E.CANCELED)), | |
| 720 | 720 | .flags = 0, |
| 721 | 721 | }, cqe); |
| 722 | 722 | } else if (cqe.user_data == 0x99999999) { |
| ... | ... | @@ -759,16 +759,16 @@ test "accept/connect/recv/link_timeout" { |
| 759 | 759 | const cqe = try ring.copy_cqe(); |
| 760 | 760 | switch (cqe.user_data) { |
| 761 | 761 | 0xffffffff => { |
| 762 | if (cqe.res != -@as(i32, @intFromEnum(linux.E.INTR)) and | |
| 763 | cqe.res != -@as(i32, @intFromEnum(linux.E.CANCELED))) | |
| 762 | if (cqe.res != -@as(i32, @backingInt(linux.E.INTR)) and | |
| 763 | cqe.res != -@as(i32, @backingInt(linux.E.CANCELED))) | |
| 764 | 764 | { |
| 765 | 765 | std.debug.print("Req 0x{x} got {d}\n", .{ cqe.user_data, cqe.res }); |
| 766 | 766 | try testing.expect(false); |
| 767 | 767 | } |
| 768 | 768 | }, |
| 769 | 769 | 0x22222222 => { |
| 770 | if (cqe.res != -@as(i32, @intFromEnum(linux.E.ALREADY)) and | |
| 771 | cqe.res != -@as(i32, @intFromEnum(linux.E.TIME))) | |
| 770 | if (cqe.res != -@as(i32, @backingInt(linux.E.ALREADY)) and | |
| 771 | cqe.res != -@as(i32, @backingInt(linux.E.TIME))) | |
| 772 | 772 | { |
| 773 | 773 | std.debug.print("Req 0x{x} got {d}\n", .{ cqe.user_data, cqe.res }); |
| 774 | 774 | try testing.expect(false); |
| ... | ... | @@ -922,7 +922,7 @@ test "accept/connect/recv/cancel" { |
| 922 | 922 | |
| 923 | 923 | try testing.expectEqual(linux.io_uring_cqe{ |
| 924 | 924 | .user_data = 0xffffffff, |
| 925 | .res = -@as(i32, @intFromEnum(linux.E.CANCELED)), | |
| 925 | .res = -@as(i32, @backingInt(linux.E.CANCELED)), | |
| 926 | 926 | .flags = 0, |
| 927 | 927 | }, cqe_recv); |
| 928 | 928 |
lib/std/os/linux/aarch64.zig+9-9| ... | ... | @@ -9,7 +9,7 @@ pub fn syscall0( |
| 9 | 9 | ) u64 { |
| 10 | 10 | return asm volatile ("svc #0" |
| 11 | 11 | : [ret] "={x0}" (-> u64), |
| 12 | : [number] "{x8}" (@intFromEnum(number)), | |
| 12 | : [number] "{x8}" (@backingInt(number)), | |
| 13 | 13 | : .{ .memory = true }); |
| 14 | 14 | } |
| 15 | 15 | |
| ... | ... | @@ -19,7 +19,7 @@ pub fn syscall1( |
| 19 | 19 | ) u64 { |
| 20 | 20 | return asm volatile ("svc #0" |
| 21 | 21 | : [ret] "={x0}" (-> u64), |
| 22 | : [number] "{x8}" (@intFromEnum(number)), | |
| 22 | : [number] "{x8}" (@backingInt(number)), | |
| 23 | 23 | [arg1] "{x0}" (arg1), |
| 24 | 24 | : .{ .memory = true }); |
| 25 | 25 | } |
| ... | ... | @@ -31,7 +31,7 @@ pub fn syscall2( |
| 31 | 31 | ) u64 { |
| 32 | 32 | return asm volatile ("svc #0" |
| 33 | 33 | : [ret] "={x0}" (-> u64), |
| 34 | : [number] "{x8}" (@intFromEnum(number)), | |
| 34 | : [number] "{x8}" (@backingInt(number)), | |
| 35 | 35 | [arg1] "{x0}" (arg1), |
| 36 | 36 | [arg2] "{x1}" (arg2), |
| 37 | 37 | : .{ .memory = true }); |
| ... | ... | @@ -45,7 +45,7 @@ pub fn syscall3( |
| 45 | 45 | ) u64 { |
| 46 | 46 | return asm volatile ("svc #0" |
| 47 | 47 | : [ret] "={x0}" (-> u64), |
| 48 | : [number] "{x8}" (@intFromEnum(number)), | |
| 48 | : [number] "{x8}" (@backingInt(number)), | |
| 49 | 49 | [arg1] "{x0}" (arg1), |
| 50 | 50 | [arg2] "{x1}" (arg2), |
| 51 | 51 | [arg3] "{x2}" (arg3), |
| ... | ... | @@ -61,7 +61,7 @@ pub fn syscall4( |
| 61 | 61 | ) u64 { |
| 62 | 62 | return asm volatile ("svc #0" |
| 63 | 63 | : [ret] "={x0}" (-> u64), |
| 64 | : [number] "{x8}" (@intFromEnum(number)), | |
| 64 | : [number] "{x8}" (@backingInt(number)), | |
| 65 | 65 | [arg1] "{x0}" (arg1), |
| 66 | 66 | [arg2] "{x1}" (arg2), |
| 67 | 67 | [arg3] "{x2}" (arg3), |
| ... | ... | @@ -79,7 +79,7 @@ pub fn syscall5( |
| 79 | 79 | ) u64 { |
| 80 | 80 | return asm volatile ("svc #0" |
| 81 | 81 | : [ret] "={x0}" (-> u64), |
| 82 | : [number] "{x8}" (@intFromEnum(number)), | |
| 82 | : [number] "{x8}" (@backingInt(number)), | |
| 83 | 83 | [arg1] "{x0}" (arg1), |
| 84 | 84 | [arg2] "{x1}" (arg2), |
| 85 | 85 | [arg3] "{x2}" (arg3), |
| ... | ... | @@ -99,7 +99,7 @@ pub fn syscall6( |
| 99 | 99 | ) u64 { |
| 100 | 100 | return asm volatile ("svc #0" |
| 101 | 101 | : [ret] "={x0}" (-> u64), |
| 102 | : [number] "{x8}" (@intFromEnum(number)), | |
| 102 | : [number] "{x8}" (@backingInt(number)), | |
| 103 | 103 | [arg1] "{x0}" (arg1), |
| 104 | 104 | [arg2] "{x1}" (arg2), |
| 105 | 105 | [arg3] "{x2}" (arg3), |
| ... | ... | @@ -157,12 +157,12 @@ pub fn restore_rt() callconv(.naked) noreturn { |
| 157 | 157 | \\ mov x8, %[number] |
| 158 | 158 | \\ svc #0 |
| 159 | 159 | : |
| 160 | : [number] "i" (@intFromEnum(SYS.rt_sigreturn)), | |
| 160 | : [number] "i" (@backingInt(SYS.rt_sigreturn)), | |
| 161 | 161 | ), |
| 162 | 162 | else => asm volatile ( |
| 163 | 163 | \\ svc #0 |
| 164 | 164 | : |
| 165 | : [number] "{x8}" (@intFromEnum(SYS.rt_sigreturn)), | |
| 165 | : [number] "{x8}" (@backingInt(SYS.rt_sigreturn)), | |
| 166 | 166 | ), |
| 167 | 167 | } |
| 168 | 168 | } |
lib/std/os/linux/arc.zig+9-9| ... | ... | @@ -9,7 +9,7 @@ pub fn syscall0( |
| 9 | 9 | ) u32 { |
| 10 | 10 | return asm volatile ("trap_s 0" |
| 11 | 11 | : [ret] "={r0}" (-> u32), |
| 12 | : [number] "{r8}" (@intFromEnum(number)), | |
| 12 | : [number] "{r8}" (@backingInt(number)), | |
| 13 | 13 | : .{ .memory = true }); |
| 14 | 14 | } |
| 15 | 15 | |
| ... | ... | @@ -19,7 +19,7 @@ pub fn syscall1( |
| 19 | 19 | ) u32 { |
| 20 | 20 | return asm volatile ("trap_s 0" |
| 21 | 21 | : [ret] "={r0}" (-> u32), |
| 22 | : [number] "{r8}" (@intFromEnum(number)), | |
| 22 | : [number] "{r8}" (@backingInt(number)), | |
| 23 | 23 | [arg1] "{r0}" (arg1), |
| 24 | 24 | : .{ .memory = true }); |
| 25 | 25 | } |
| ... | ... | @@ -31,7 +31,7 @@ pub fn syscall2( |
| 31 | 31 | ) u32 { |
| 32 | 32 | return asm volatile ("trap_s 0" |
| 33 | 33 | : [ret] "={r0}" (-> u32), |
| 34 | : [number] "{r8}" (@intFromEnum(number)), | |
| 34 | : [number] "{r8}" (@backingInt(number)), | |
| 35 | 35 | [arg1] "{r0}" (arg1), |
| 36 | 36 | [arg2] "{r1}" (arg2), |
| 37 | 37 | : .{ .memory = true }); |
| ... | ... | @@ -45,7 +45,7 @@ pub fn syscall3( |
| 45 | 45 | ) u32 { |
| 46 | 46 | return asm volatile ("trap_s 0" |
| 47 | 47 | : [ret] "={r0}" (-> u32), |
| 48 | : [number] "{r8}" (@intFromEnum(number)), | |
| 48 | : [number] "{r8}" (@backingInt(number)), | |
| 49 | 49 | [arg1] "{r0}" (arg1), |
| 50 | 50 | [arg2] "{r1}" (arg2), |
| 51 | 51 | [arg3] "{r2}" (arg3), |
| ... | ... | @@ -61,7 +61,7 @@ pub fn syscall4( |
| 61 | 61 | ) u32 { |
| 62 | 62 | return asm volatile ("trap_s 0" |
| 63 | 63 | : [ret] "={r0}" (-> u32), |
| 64 | : [number] "{r8}" (@intFromEnum(number)), | |
| 64 | : [number] "{r8}" (@backingInt(number)), | |
| 65 | 65 | [arg1] "{r0}" (arg1), |
| 66 | 66 | [arg2] "{r1}" (arg2), |
| 67 | 67 | [arg3] "{r2}" (arg3), |
| ... | ... | @@ -79,7 +79,7 @@ pub fn syscall5( |
| 79 | 79 | ) u32 { |
| 80 | 80 | return asm volatile ("trap_s 0" |
| 81 | 81 | : [ret] "={r0}" (-> u32), |
| 82 | : [number] "{r8}" (@intFromEnum(number)), | |
| 82 | : [number] "{r8}" (@backingInt(number)), | |
| 83 | 83 | [arg1] "{r0}" (arg1), |
| 84 | 84 | [arg2] "{r1}" (arg2), |
| 85 | 85 | [arg3] "{r2}" (arg3), |
| ... | ... | @@ -99,7 +99,7 @@ pub fn syscall6( |
| 99 | 99 | ) u32 { |
| 100 | 100 | return asm volatile ("trap_s 0" |
| 101 | 101 | : [ret] "={r0}" (-> u32), |
| 102 | : [number] "{r8}" (@intFromEnum(number)), | |
| 102 | : [number] "{r8}" (@backingInt(number)), | |
| 103 | 103 | [arg1] "{r0}" (arg1), |
| 104 | 104 | [arg2] "{r1}" (arg2), |
| 105 | 105 | [arg3] "{r2}" (arg3), |
| ... | ... | @@ -158,12 +158,12 @@ pub fn restore_rt() callconv(.naked) noreturn { |
| 158 | 158 | \\ mov r8, %[number] |
| 159 | 159 | \\ trap_s 0 |
| 160 | 160 | : |
| 161 | : [number] "I" (@intFromEnum(SYS.rt_sigreturn)), | |
| 161 | : [number] "I" (@backingInt(SYS.rt_sigreturn)), | |
| 162 | 162 | ), |
| 163 | 163 | else => asm volatile ( |
| 164 | 164 | \\ trap_s 0 |
| 165 | 165 | : |
| 166 | : [number] "{r8}" (@intFromEnum(SYS.rt_sigreturn)), | |
| 166 | : [number] "{r8}" (@backingInt(SYS.rt_sigreturn)), | |
| 167 | 167 | ), |
| 168 | 168 | } |
| 169 | 169 | } |
lib/std/os/linux/arm.zig+11-11| ... | ... | @@ -9,7 +9,7 @@ pub fn syscall0( |
| 9 | 9 | ) u32 { |
| 10 | 10 | return asm volatile ("svc #0" |
| 11 | 11 | : [ret] "={r0}" (-> u32), |
| 12 | : [number] "{r7}" (@intFromEnum(number)), | |
| 12 | : [number] "{r7}" (@backingInt(number)), | |
| 13 | 13 | : .{ .memory = true }); |
| 14 | 14 | } |
| 15 | 15 | |
| ... | ... | @@ -19,7 +19,7 @@ pub fn syscall1( |
| 19 | 19 | ) u32 { |
| 20 | 20 | return asm volatile ("svc #0" |
| 21 | 21 | : [ret] "={r0}" (-> u32), |
| 22 | : [number] "{r7}" (@intFromEnum(number)), | |
| 22 | : [number] "{r7}" (@backingInt(number)), | |
| 23 | 23 | [arg1] "{r0}" (arg1), |
| 24 | 24 | : .{ .memory = true }); |
| 25 | 25 | } |
| ... | ... | @@ -31,7 +31,7 @@ pub fn syscall2( |
| 31 | 31 | ) u32 { |
| 32 | 32 | return asm volatile ("svc #0" |
| 33 | 33 | : [ret] "={r0}" (-> u32), |
| 34 | : [number] "{r7}" (@intFromEnum(number)), | |
| 34 | : [number] "{r7}" (@backingInt(number)), | |
| 35 | 35 | [arg1] "{r0}" (arg1), |
| 36 | 36 | [arg2] "{r1}" (arg2), |
| 37 | 37 | : .{ .memory = true }); |
| ... | ... | @@ -45,7 +45,7 @@ pub fn syscall3( |
| 45 | 45 | ) u32 { |
| 46 | 46 | return asm volatile ("svc #0" |
| 47 | 47 | : [ret] "={r0}" (-> u32), |
| 48 | : [number] "{r7}" (@intFromEnum(number)), | |
| 48 | : [number] "{r7}" (@backingInt(number)), | |
| 49 | 49 | [arg1] "{r0}" (arg1), |
| 50 | 50 | [arg2] "{r1}" (arg2), |
| 51 | 51 | [arg3] "{r2}" (arg3), |
| ... | ... | @@ -61,7 +61,7 @@ pub fn syscall4( |
| 61 | 61 | ) u32 { |
| 62 | 62 | return asm volatile ("svc #0" |
| 63 | 63 | : [ret] "={r0}" (-> u32), |
| 64 | : [number] "{r7}" (@intFromEnum(number)), | |
| 64 | : [number] "{r7}" (@backingInt(number)), | |
| 65 | 65 | [arg1] "{r0}" (arg1), |
| 66 | 66 | [arg2] "{r1}" (arg2), |
| 67 | 67 | [arg3] "{r2}" (arg3), |
| ... | ... | @@ -79,7 +79,7 @@ pub fn syscall5( |
| 79 | 79 | ) u32 { |
| 80 | 80 | return asm volatile ("svc #0" |
| 81 | 81 | : [ret] "={r0}" (-> u32), |
| 82 | : [number] "{r7}" (@intFromEnum(number)), | |
| 82 | : [number] "{r7}" (@backingInt(number)), | |
| 83 | 83 | [arg1] "{r0}" (arg1), |
| 84 | 84 | [arg2] "{r1}" (arg2), |
| 85 | 85 | [arg3] "{r2}" (arg3), |
| ... | ... | @@ -99,7 +99,7 @@ pub fn syscall6( |
| 99 | 99 | ) u32 { |
| 100 | 100 | return asm volatile ("svc #0" |
| 101 | 101 | : [ret] "={r0}" (-> u32), |
| 102 | : [number] "{r7}" (@intFromEnum(number)), | |
| 102 | : [number] "{r7}" (@backingInt(number)), | |
| 103 | 103 | [arg1] "{r0}" (arg1), |
| 104 | 104 | [arg2] "{r1}" (arg2), |
| 105 | 105 | [arg3] "{r2}" (arg3), |
| ... | ... | @@ -151,12 +151,12 @@ pub fn restore() callconv(.naked) noreturn { |
| 151 | 151 | \\ mov r7, %[number] |
| 152 | 152 | \\ svc #0 |
| 153 | 153 | : |
| 154 | : [number] "I" (@intFromEnum(SYS.sigreturn)), | |
| 154 | : [number] "I" (@backingInt(SYS.sigreturn)), | |
| 155 | 155 | ), |
| 156 | 156 | else => asm volatile ( |
| 157 | 157 | \\ svc #0 |
| 158 | 158 | : |
| 159 | : [number] "{r7}" (@intFromEnum(SYS.sigreturn)), | |
| 159 | : [number] "{r7}" (@backingInt(SYS.sigreturn)), | |
| 160 | 160 | ), |
| 161 | 161 | } |
| 162 | 162 | } |
| ... | ... | @@ -167,12 +167,12 @@ pub fn restore_rt() callconv(.naked) noreturn { |
| 167 | 167 | \\ mov r7, %[number] |
| 168 | 168 | \\ svc #0 |
| 169 | 169 | : |
| 170 | : [number] "I" (@intFromEnum(SYS.rt_sigreturn)), | |
| 170 | : [number] "I" (@backingInt(SYS.rt_sigreturn)), | |
| 171 | 171 | ), |
| 172 | 172 | else => asm volatile ( |
| 173 | 173 | \\ svc #0 |
| 174 | 174 | : |
| 175 | : [number] "{r7}" (@intFromEnum(SYS.rt_sigreturn)), | |
| 175 | : [number] "{r7}" (@backingInt(SYS.rt_sigreturn)), | |
| 176 | 176 | ), |
| 177 | 177 | } |
| 178 | 178 | } |
lib/std/os/linux/bpf.zig+24-24| ... | ... | @@ -547,10 +547,10 @@ pub const Insn = packed struct { |
| 547 | 547 | |
| 548 | 548 | return Insn{ |
| 549 | 549 | .code = code | src_type, |
| 550 | .dst = @intFromEnum(dst), | |
| 550 | .dst = @backingInt(dst), | |
| 551 | 551 | .src = switch (imm_or_reg) { |
| 552 | 552 | .imm => 0, |
| 553 | .reg => |r| @intFromEnum(r), | |
| 553 | .reg => |r| @backingInt(r), | |
| 554 | 554 | }, |
| 555 | 555 | .off = off, |
| 556 | 556 | .imm = switch (imm_or_reg) { |
| ... | ... | @@ -567,7 +567,7 @@ pub const Insn = packed struct { |
| 567 | 567 | else => @compileError("width must be 32 or 64"), |
| 568 | 568 | }; |
| 569 | 569 | |
| 570 | return imm_reg(width_bitfield | @intFromEnum(op), dst, src, 0); | |
| 570 | return imm_reg(width_bitfield | @backingInt(op), dst, src, 0); | |
| 571 | 571 | } |
| 572 | 572 | |
| 573 | 573 | pub fn mov(dst: Reg, src: anytype) Insn { |
| ... | ... | @@ -623,7 +623,7 @@ pub const Insn = packed struct { |
| 623 | 623 | } |
| 624 | 624 | |
| 625 | 625 | pub fn jmp(op: JmpOp, dst: Reg, src: anytype, off: i16) Insn { |
| 626 | return imm_reg(JMP | @intFromEnum(op), dst, src, off); | |
| 626 | return imm_reg(JMP | @backingInt(op), dst, src, off); | |
| 627 | 627 | } |
| 628 | 628 | |
| 629 | 629 | pub fn ja(off: i16) Insn { |
| ... | ... | @@ -677,8 +677,8 @@ pub const Insn = packed struct { |
| 677 | 677 | pub fn xadd(dst: Reg, src: Reg) Insn { |
| 678 | 678 | return Insn{ |
| 679 | 679 | .code = STX | XADD | DW, |
| 680 | .dst = @intFromEnum(dst), | |
| 681 | .src = @intFromEnum(src), | |
| 680 | .dst = @backingInt(dst), | |
| 681 | .src = @backingInt(src), | |
| 682 | 682 | .off = 0, |
| 683 | 683 | .imm = 0, |
| 684 | 684 | }; |
| ... | ... | @@ -686,9 +686,9 @@ pub const Insn = packed struct { |
| 686 | 686 | |
| 687 | 687 | fn ld(mode: Mode, size: Size, dst: Reg, src: Reg, imm: i32) Insn { |
| 688 | 688 | return Insn{ |
| 689 | .code = @intFromEnum(mode) | @intFromEnum(size) | LD, | |
| 690 | .dst = @intFromEnum(dst), | |
| 691 | .src = @intFromEnum(src), | |
| 689 | .code = @backingInt(mode) | @backingInt(size) | LD, | |
| 690 | .dst = @backingInt(dst), | |
| 691 | .src = @backingInt(src), | |
| 692 | 692 | .off = 0, |
| 693 | 693 | .imm = imm, |
| 694 | 694 | }; |
| ... | ... | @@ -704,9 +704,9 @@ pub const Insn = packed struct { |
| 704 | 704 | |
| 705 | 705 | pub fn ldx(size: Size, dst: Reg, src: Reg, off: i16) Insn { |
| 706 | 706 | return Insn{ |
| 707 | .code = MEM | @intFromEnum(size) | LDX, | |
| 708 | .dst = @intFromEnum(dst), | |
| 709 | .src = @intFromEnum(src), | |
| 707 | .code = MEM | @backingInt(size) | LDX, | |
| 708 | .dst = @backingInt(dst), | |
| 709 | .src = @backingInt(src), | |
| 710 | 710 | .off = off, |
| 711 | 711 | .imm = 0, |
| 712 | 712 | }; |
| ... | ... | @@ -715,8 +715,8 @@ pub const Insn = packed struct { |
| 715 | 715 | fn ld_imm_impl1(dst: Reg, src: Reg, imm: u64) Insn { |
| 716 | 716 | return Insn{ |
| 717 | 717 | .code = LD | DW | IMM, |
| 718 | .dst = @intFromEnum(dst), | |
| 719 | .src = @intFromEnum(src), | |
| 718 | .dst = @backingInt(dst), | |
| 719 | .src = @backingInt(src), | |
| 720 | 720 | .off = 0, |
| 721 | 721 | .imm = @as(i32, @bitCast(@as(u32, @truncate(imm)))), |
| 722 | 722 | }; |
| ... | ... | @@ -741,7 +741,7 @@ pub const Insn = packed struct { |
| 741 | 741 | } |
| 742 | 742 | |
| 743 | 743 | pub fn ld_map_fd1(dst: Reg, map_fd: fd_t) Insn { |
| 744 | return ld_imm_impl1(dst, @as(Reg, @enumFromInt(PSEUDO_MAP_FD)), @as(u64, @intCast(map_fd))); | |
| 744 | return ld_imm_impl1(dst, @as(Reg, @fromBackingInt(@intCast(PSEUDO_MAP_FD))), @as(u64, @intCast(map_fd))); | |
| 745 | 745 | } |
| 746 | 746 | |
| 747 | 747 | pub fn ld_map_fd2(map_fd: fd_t) Insn { |
| ... | ... | @@ -750,8 +750,8 @@ pub const Insn = packed struct { |
| 750 | 750 | |
| 751 | 751 | pub fn st(size: Size, dst: Reg, off: i16, imm: i32) Insn { |
| 752 | 752 | return Insn{ |
| 753 | .code = MEM | @intFromEnum(size) | ST, | |
| 754 | .dst = @intFromEnum(dst), | |
| 753 | .code = MEM | @backingInt(size) | ST, | |
| 754 | .dst = @backingInt(dst), | |
| 755 | 755 | .src = 0, |
| 756 | 756 | .off = off, |
| 757 | 757 | .imm = imm, |
| ... | ... | @@ -760,9 +760,9 @@ pub const Insn = packed struct { |
| 760 | 760 | |
| 761 | 761 | pub fn stx(size: Size, dst: Reg, off: i16, src: Reg) Insn { |
| 762 | 762 | return Insn{ |
| 763 | .code = MEM | @intFromEnum(size) | STX, | |
| 764 | .dst = @intFromEnum(dst), | |
| 765 | .src = @intFromEnum(src), | |
| 763 | .code = MEM | @backingInt(size) | STX, | |
| 764 | .dst = @backingInt(dst), | |
| 765 | .src = @backingInt(src), | |
| 766 | 766 | .off = off, |
| 767 | 767 | .imm = 0, |
| 768 | 768 | }; |
| ... | ... | @@ -774,7 +774,7 @@ pub const Insn = packed struct { |
| 774 | 774 | .big => 0xdc, |
| 775 | 775 | .little => 0xd4, |
| 776 | 776 | }, |
| 777 | .dst = @intFromEnum(dst), | |
| 777 | .dst = @backingInt(dst), | |
| 778 | 778 | .src = 0, |
| 779 | 779 | .off = 0, |
| 780 | 780 | .imm = switch (size) { |
| ... | ... | @@ -800,7 +800,7 @@ pub const Insn = packed struct { |
| 800 | 800 | .dst = 0, |
| 801 | 801 | .src = 0, |
| 802 | 802 | .off = 0, |
| 803 | .imm = @intFromEnum(helper), | |
| 803 | .imm = @backingInt(helper), | |
| 804 | 804 | }; |
| 805 | 805 | } |
| 806 | 806 | |
| ... | ... | @@ -1614,7 +1614,7 @@ pub fn map_create(map_type: MapType, key_size: u32, value_size: u32, max_entries |
| 1614 | 1614 | .map_create = std.mem.zeroes(MapCreateAttr), |
| 1615 | 1615 | }; |
| 1616 | 1616 | |
| 1617 | attr.map_create.map_type = @intFromEnum(map_type); | |
| 1617 | attr.map_create.map_type = @backingInt(map_type); | |
| 1618 | 1618 | attr.map_create.key_size = key_size; |
| 1619 | 1619 | attr.map_create.value_size = value_size; |
| 1620 | 1620 | attr.map_create.max_entries = max_entries; |
| ... | ... | @@ -1769,7 +1769,7 @@ pub fn prog_load( |
| 1769 | 1769 | .prog_load = std.mem.zeroes(ProgLoadAttr), |
| 1770 | 1770 | }; |
| 1771 | 1771 | |
| 1772 | attr.prog_load.prog_type = @intFromEnum(prog_type); | |
| 1772 | attr.prog_load.prog_type = @backingInt(prog_type); | |
| 1773 | 1773 | attr.prog_load.insns = @intFromPtr(insns.ptr); |
| 1774 | 1774 | attr.prog_load.insn_cnt = @as(u32, @intCast(insns.len)); |
| 1775 | 1775 | attr.prog_load.license = @intFromPtr(license.ptr); |
lib/std/os/linux/csky.zig+7-7| ... | ... | @@ -9,7 +9,7 @@ pub fn syscall0( |
| 9 | 9 | ) u32 { |
| 10 | 10 | return asm volatile ("trap 0" |
| 11 | 11 | : [ret] "={r0}" (-> u32), |
| 12 | : [number] "{r7}" (@intFromEnum(number)), | |
| 12 | : [number] "{r7}" (@backingInt(number)), | |
| 13 | 13 | : .{ .memory = true }); |
| 14 | 14 | } |
| 15 | 15 | |
| ... | ... | @@ -19,7 +19,7 @@ pub fn syscall1( |
| 19 | 19 | ) u32 { |
| 20 | 20 | return asm volatile ("trap 0" |
| 21 | 21 | : [ret] "={r0}" (-> u32), |
| 22 | : [number] "{r7}" (@intFromEnum(number)), | |
| 22 | : [number] "{r7}" (@backingInt(number)), | |
| 23 | 23 | [arg1] "{r0}" (arg1), |
| 24 | 24 | : .{ .memory = true }); |
| 25 | 25 | } |
| ... | ... | @@ -31,7 +31,7 @@ pub fn syscall2( |
| 31 | 31 | ) u32 { |
| 32 | 32 | return asm volatile ("trap 0" |
| 33 | 33 | : [ret] "={r0}" (-> u32), |
| 34 | : [number] "{r7}" (@intFromEnum(number)), | |
| 34 | : [number] "{r7}" (@backingInt(number)), | |
| 35 | 35 | [arg1] "{r0}" (arg1), |
| 36 | 36 | [arg2] "{r1}" (arg2), |
| 37 | 37 | : .{ .memory = true }); |
| ... | ... | @@ -45,7 +45,7 @@ pub fn syscall3( |
| 45 | 45 | ) u32 { |
| 46 | 46 | return asm volatile ("trap 0" |
| 47 | 47 | : [ret] "={r0}" (-> u32), |
| 48 | : [number] "{r7}" (@intFromEnum(number)), | |
| 48 | : [number] "{r7}" (@backingInt(number)), | |
| 49 | 49 | [arg1] "{r0}" (arg1), |
| 50 | 50 | [arg2] "{r1}" (arg2), |
| 51 | 51 | [arg3] "{r2}" (arg3), |
| ... | ... | @@ -61,7 +61,7 @@ pub fn syscall4( |
| 61 | 61 | ) u32 { |
| 62 | 62 | return asm volatile ("trap 0" |
| 63 | 63 | : [ret] "={r0}" (-> u32), |
| 64 | : [number] "{r7}" (@intFromEnum(number)), | |
| 64 | : [number] "{r7}" (@backingInt(number)), | |
| 65 | 65 | [arg1] "{r0}" (arg1), |
| 66 | 66 | [arg2] "{r1}" (arg2), |
| 67 | 67 | [arg3] "{r2}" (arg3), |
| ... | ... | @@ -79,7 +79,7 @@ pub fn syscall5( |
| 79 | 79 | ) u32 { |
| 80 | 80 | return asm volatile ("trap 0" |
| 81 | 81 | : [ret] "={r0}" (-> u32), |
| 82 | : [number] "{r7}" (@intFromEnum(number)), | |
| 82 | : [number] "{r7}" (@backingInt(number)), | |
| 83 | 83 | [arg1] "{r0}" (arg1), |
| 84 | 84 | [arg2] "{r1}" (arg2), |
| 85 | 85 | [arg3] "{r2}" (arg3), |
| ... | ... | @@ -99,7 +99,7 @@ pub fn syscall6( |
| 99 | 99 | ) u32 { |
| 100 | 100 | return asm volatile ("trap 0" |
| 101 | 101 | : [ret] "={r0}" (-> u32), |
| 102 | : [number] "{r7}" (@intFromEnum(number)), | |
| 102 | : [number] "{r7}" (@backingInt(number)), | |
| 103 | 103 | [arg1] "{r0}" (arg1), |
| 104 | 104 | [arg2] "{r1}" (arg2), |
| 105 | 105 | [arg3] "{r2}" (arg3), |
lib/std/os/linux/hexagon.zig+7-7| ... | ... | @@ -9,7 +9,7 @@ pub fn syscall0( |
| 9 | 9 | ) u32 { |
| 10 | 10 | return asm volatile ("trap0(#1)" |
| 11 | 11 | : [ret] "={r0}" (-> u32), |
| 12 | : [number] "{r6}" (@intFromEnum(number)), | |
| 12 | : [number] "{r6}" (@backingInt(number)), | |
| 13 | 13 | : .{ .memory = true }); |
| 14 | 14 | } |
| 15 | 15 | |
| ... | ... | @@ -19,7 +19,7 @@ pub fn syscall1( |
| 19 | 19 | ) u32 { |
| 20 | 20 | return asm volatile ("trap0(#1)" |
| 21 | 21 | : [ret] "={r0}" (-> u32), |
| 22 | : [number] "{r6}" (@intFromEnum(number)), | |
| 22 | : [number] "{r6}" (@backingInt(number)), | |
| 23 | 23 | [arg1] "{r0}" (arg1), |
| 24 | 24 | : .{ .memory = true }); |
| 25 | 25 | } |
| ... | ... | @@ -31,7 +31,7 @@ pub fn syscall2( |
| 31 | 31 | ) u32 { |
| 32 | 32 | return asm volatile ("trap0(#1)" |
| 33 | 33 | : [ret] "={r0}" (-> u32), |
| 34 | : [number] "{r6}" (@intFromEnum(number)), | |
| 34 | : [number] "{r6}" (@backingInt(number)), | |
| 35 | 35 | [arg1] "{r0}" (arg1), |
| 36 | 36 | [arg2] "{r1}" (arg2), |
| 37 | 37 | : .{ .memory = true }); |
| ... | ... | @@ -45,7 +45,7 @@ pub fn syscall3( |
| 45 | 45 | ) u32 { |
| 46 | 46 | return asm volatile ("trap0(#1)" |
| 47 | 47 | : [ret] "={r0}" (-> u32), |
| 48 | : [number] "{r6}" (@intFromEnum(number)), | |
| 48 | : [number] "{r6}" (@backingInt(number)), | |
| 49 | 49 | [arg1] "{r0}" (arg1), |
| 50 | 50 | [arg2] "{r1}" (arg2), |
| 51 | 51 | [arg3] "{r2}" (arg3), |
| ... | ... | @@ -61,7 +61,7 @@ pub fn syscall4( |
| 61 | 61 | ) u32 { |
| 62 | 62 | return asm volatile ("trap0(#1)" |
| 63 | 63 | : [ret] "={r0}" (-> u32), |
| 64 | : [number] "{r6}" (@intFromEnum(number)), | |
| 64 | : [number] "{r6}" (@backingInt(number)), | |
| 65 | 65 | [arg1] "{r0}" (arg1), |
| 66 | 66 | [arg2] "{r1}" (arg2), |
| 67 | 67 | [arg3] "{r2}" (arg3), |
| ... | ... | @@ -72,7 +72,7 @@ pub fn syscall4( |
| 72 | 72 | pub fn syscall5(number: SYS, arg1: u32, arg2: u32, arg3: u32, arg4: u32, arg5: u32) u32 { |
| 73 | 73 | return asm volatile ("trap0(#1)" |
| 74 | 74 | : [ret] "={r0}" (-> u32), |
| 75 | : [number] "{r6}" (@intFromEnum(number)), | |
| 75 | : [number] "{r6}" (@backingInt(number)), | |
| 76 | 76 | [arg1] "{r0}" (arg1), |
| 77 | 77 | [arg2] "{r1}" (arg2), |
| 78 | 78 | [arg3] "{r2}" (arg3), |
| ... | ... | @@ -92,7 +92,7 @@ pub fn syscall6( |
| 92 | 92 | ) u32 { |
| 93 | 93 | return asm volatile ("trap0(#1)" |
| 94 | 94 | : [ret] "={r0}" (-> u32), |
| 95 | : [number] "{r6}" (@intFromEnum(number)), | |
| 95 | : [number] "{r6}" (@backingInt(number)), | |
| 96 | 96 | [arg1] "{r0}" (arg1), |
| 97 | 97 | [arg2] "{r1}" (arg2), |
| 98 | 98 | [arg3] "{r2}" (arg3), |
lib/std/os/linux/io_uring_sqe.zig+2-2| ... | ... | @@ -615,7 +615,7 @@ pub const io_uring_sqe = extern struct { |
| 615 | 615 | options: u32, |
| 616 | 616 | flags: u32, |
| 617 | 617 | ) void { |
| 618 | sqe.prep_rw(.WAITID, id, 0, @intFromEnum(id_type), @intFromPtr(infop)); | |
| 618 | sqe.prep_rw(.WAITID, id, 0, @backingInt(id_type), @intFromPtr(infop)); | |
| 619 | 619 | sqe.rw_flags = flags; |
| 620 | 620 | sqe.splice_fd_in = @bitCast(options); |
| 621 | 621 | } |
| ... | ... | @@ -652,7 +652,7 @@ pub const io_uring_sqe = extern struct { |
| 652 | 652 | ) void { |
| 653 | 653 | sqe.prep_rw(.URING_CMD, fd, 0, 0, 0); |
| 654 | 654 | // off is overloaded with cmd_op, https://github.com/axboe/liburing/blob/e1003e496e66f9b0ae06674869795edf772d5500/src/include/liburing/io_uring.h#L39 |
| 655 | sqe.off = @intFromEnum(cmd_op); | |
| 655 | sqe.off = @backingInt(cmd_op); | |
| 656 | 656 | // addr is overloaded, https://github.com/axboe/liburing/blob/e1003e496e66f9b0ae06674869795edf772d5500/src/include/liburing/io_uring.h#L46 |
| 657 | 657 | sqe.addr = @bitCast(packed struct { |
| 658 | 658 | level: u32, |
lib/std/os/linux/loongarch32.zig+7-7| ... | ... | @@ -10,7 +10,7 @@ pub fn syscall0( |
| 10 | 10 | return asm volatile ( |
| 11 | 11 | \\ syscall 0 |
| 12 | 12 | : [ret] "={$r4}" (-> u32), |
| 13 | : [number] "{$r11}" (@intFromEnum(number)), | |
| 13 | : [number] "{$r11}" (@backingInt(number)), | |
| 14 | 14 | : .{ .r12 = true, .r13 = true, .r14 = true, .r15 = true, .r16 = true, .r17 = true, .r18 = true, .r19 = true, .r20 = true, .memory = true }); |
| 15 | 15 | } |
| 16 | 16 | |
| ... | ... | @@ -21,7 +21,7 @@ pub fn syscall1( |
| 21 | 21 | return asm volatile ( |
| 22 | 22 | \\ syscall 0 |
| 23 | 23 | : [ret] "={$r4}" (-> u32), |
| 24 | : [number] "{$r11}" (@intFromEnum(number)), | |
| 24 | : [number] "{$r11}" (@backingInt(number)), | |
| 25 | 25 | [arg1] "{$r4}" (arg1), |
| 26 | 26 | : .{ .r12 = true, .r13 = true, .r14 = true, .r15 = true, .r16 = true, .r17 = true, .r18 = true, .r19 = true, .r20 = true, .memory = true }); |
| 27 | 27 | } |
| ... | ... | @@ -34,7 +34,7 @@ pub fn syscall2( |
| 34 | 34 | return asm volatile ( |
| 35 | 35 | \\ syscall 0 |
| 36 | 36 | : [ret] "={$r4}" (-> u32), |
| 37 | : [number] "{$r11}" (@intFromEnum(number)), | |
| 37 | : [number] "{$r11}" (@backingInt(number)), | |
| 38 | 38 | [arg1] "{$r4}" (arg1), |
| 39 | 39 | [arg2] "{$r5}" (arg2), |
| 40 | 40 | : .{ .r12 = true, .r13 = true, .r14 = true, .r15 = true, .r16 = true, .r17 = true, .r18 = true, .r19 = true, .r20 = true, .memory = true }); |
| ... | ... | @@ -49,7 +49,7 @@ pub fn syscall3( |
| 49 | 49 | return asm volatile ( |
| 50 | 50 | \\ syscall 0 |
| 51 | 51 | : [ret] "={$r4}" (-> u32), |
| 52 | : [number] "{$r11}" (@intFromEnum(number)), | |
| 52 | : [number] "{$r11}" (@backingInt(number)), | |
| 53 | 53 | [arg1] "{$r4}" (arg1), |
| 54 | 54 | [arg2] "{$r5}" (arg2), |
| 55 | 55 | [arg3] "{$r6}" (arg3), |
| ... | ... | @@ -66,7 +66,7 @@ pub fn syscall4( |
| 66 | 66 | return asm volatile ( |
| 67 | 67 | \\ syscall 0 |
| 68 | 68 | : [ret] "={$r4}" (-> u32), |
| 69 | : [number] "{$r11}" (@intFromEnum(number)), | |
| 69 | : [number] "{$r11}" (@backingInt(number)), | |
| 70 | 70 | [arg1] "{$r4}" (arg1), |
| 71 | 71 | [arg2] "{$r5}" (arg2), |
| 72 | 72 | [arg3] "{$r6}" (arg3), |
| ... | ... | @@ -85,7 +85,7 @@ pub fn syscall5( |
| 85 | 85 | return asm volatile ( |
| 86 | 86 | \\ syscall 0 |
| 87 | 87 | : [ret] "={$r4}" (-> u32), |
| 88 | : [number] "{$r11}" (@intFromEnum(number)), | |
| 88 | : [number] "{$r11}" (@backingInt(number)), | |
| 89 | 89 | [arg1] "{$r4}" (arg1), |
| 90 | 90 | [arg2] "{$r5}" (arg2), |
| 91 | 91 | [arg3] "{$r6}" (arg3), |
| ... | ... | @@ -106,7 +106,7 @@ pub fn syscall6( |
| 106 | 106 | return asm volatile ( |
| 107 | 107 | \\ syscall 0 |
| 108 | 108 | : [ret] "={$r4}" (-> u32), |
| 109 | : [number] "{$r11}" (@intFromEnum(number)), | |
| 109 | : [number] "{$r11}" (@backingInt(number)), | |
| 110 | 110 | [arg1] "{$r4}" (arg1), |
| 111 | 111 | [arg2] "{$r5}" (arg2), |
| 112 | 112 | [arg3] "{$r6}" (arg3), |
lib/std/os/linux/loongarch64.zig+7-7| ... | ... | @@ -10,7 +10,7 @@ pub fn syscall0( |
| 10 | 10 | return asm volatile ( |
| 11 | 11 | \\ syscall 0 |
| 12 | 12 | : [ret] "={$r4}" (-> u64), |
| 13 | : [number] "{$r11}" (@intFromEnum(number)), | |
| 13 | : [number] "{$r11}" (@backingInt(number)), | |
| 14 | 14 | : .{ .r12 = true, .r13 = true, .r14 = true, .r15 = true, .r16 = true, .r17 = true, .r18 = true, .r19 = true, .r20 = true, .memory = true }); |
| 15 | 15 | } |
| 16 | 16 | |
| ... | ... | @@ -21,7 +21,7 @@ pub fn syscall1( |
| 21 | 21 | return asm volatile ( |
| 22 | 22 | \\ syscall 0 |
| 23 | 23 | : [ret] "={$r4}" (-> u64), |
| 24 | : [number] "{$r11}" (@intFromEnum(number)), | |
| 24 | : [number] "{$r11}" (@backingInt(number)), | |
| 25 | 25 | [arg1] "{$r4}" (arg1), |
| 26 | 26 | : .{ .r12 = true, .r13 = true, .r14 = true, .r15 = true, .r16 = true, .r17 = true, .r18 = true, .r19 = true, .r20 = true, .memory = true }); |
| 27 | 27 | } |
| ... | ... | @@ -34,7 +34,7 @@ pub fn syscall2( |
| 34 | 34 | return asm volatile ( |
| 35 | 35 | \\ syscall 0 |
| 36 | 36 | : [ret] "={$r4}" (-> u64), |
| 37 | : [number] "{$r11}" (@intFromEnum(number)), | |
| 37 | : [number] "{$r11}" (@backingInt(number)), | |
| 38 | 38 | [arg1] "{$r4}" (arg1), |
| 39 | 39 | [arg2] "{$r5}" (arg2), |
| 40 | 40 | : .{ .r12 = true, .r13 = true, .r14 = true, .r15 = true, .r16 = true, .r17 = true, .r18 = true, .r19 = true, .r20 = true, .memory = true }); |
| ... | ... | @@ -49,7 +49,7 @@ pub fn syscall3( |
| 49 | 49 | return asm volatile ( |
| 50 | 50 | \\ syscall 0 |
| 51 | 51 | : [ret] "={$r4}" (-> u64), |
| 52 | : [number] "{$r11}" (@intFromEnum(number)), | |
| 52 | : [number] "{$r11}" (@backingInt(number)), | |
| 53 | 53 | [arg1] "{$r4}" (arg1), |
| 54 | 54 | [arg2] "{$r5}" (arg2), |
| 55 | 55 | [arg3] "{$r6}" (arg3), |
| ... | ... | @@ -66,7 +66,7 @@ pub fn syscall4( |
| 66 | 66 | return asm volatile ( |
| 67 | 67 | \\ syscall 0 |
| 68 | 68 | : [ret] "={$r4}" (-> u64), |
| 69 | : [number] "{$r11}" (@intFromEnum(number)), | |
| 69 | : [number] "{$r11}" (@backingInt(number)), | |
| 70 | 70 | [arg1] "{$r4}" (arg1), |
| 71 | 71 | [arg2] "{$r5}" (arg2), |
| 72 | 72 | [arg3] "{$r6}" (arg3), |
| ... | ... | @@ -85,7 +85,7 @@ pub fn syscall5( |
| 85 | 85 | return asm volatile ( |
| 86 | 86 | \\ syscall 0 |
| 87 | 87 | : [ret] "={$r4}" (-> u64), |
| 88 | : [number] "{$r11}" (@intFromEnum(number)), | |
| 88 | : [number] "{$r11}" (@backingInt(number)), | |
| 89 | 89 | [arg1] "{$r4}" (arg1), |
| 90 | 90 | [arg2] "{$r5}" (arg2), |
| 91 | 91 | [arg3] "{$r6}" (arg3), |
| ... | ... | @@ -106,7 +106,7 @@ pub fn syscall6( |
| 106 | 106 | return asm volatile ( |
| 107 | 107 | \\ syscall 0 |
| 108 | 108 | : [ret] "={$r4}" (-> u64), |
| 109 | : [number] "{$r11}" (@intFromEnum(number)), | |
| 109 | : [number] "{$r11}" (@backingInt(number)), | |
| 110 | 110 | [arg1] "{$r4}" (arg1), |
| 111 | 111 | [arg2] "{$r5}" (arg2), |
| 112 | 112 | [arg3] "{$r6}" (arg3), |
lib/std/os/linux/m68k.zig+8-8| ... | ... | @@ -9,7 +9,7 @@ pub fn syscall0( |
| 9 | 9 | ) u32 { |
| 10 | 10 | return asm volatile ("trap #0" |
| 11 | 11 | : [ret] "={d0}" (-> u32), |
| 12 | : [number] "{d0}" (@intFromEnum(number)), | |
| 12 | : [number] "{d0}" (@backingInt(number)), | |
| 13 | 13 | : .{ .memory = true }); |
| 14 | 14 | } |
| 15 | 15 | |
| ... | ... | @@ -19,7 +19,7 @@ pub fn syscall1( |
| 19 | 19 | ) u32 { |
| 20 | 20 | return asm volatile ("trap #0" |
| 21 | 21 | : [ret] "={d0}" (-> u32), |
| 22 | : [number] "{d0}" (@intFromEnum(number)), | |
| 22 | : [number] "{d0}" (@backingInt(number)), | |
| 23 | 23 | [arg1] "{d1}" (arg1), |
| 24 | 24 | : .{ .memory = true }); |
| 25 | 25 | } |
| ... | ... | @@ -31,7 +31,7 @@ pub fn syscall2( |
| 31 | 31 | ) u32 { |
| 32 | 32 | return asm volatile ("trap #0" |
| 33 | 33 | : [ret] "={d0}" (-> u32), |
| 34 | : [number] "{d0}" (@intFromEnum(number)), | |
| 34 | : [number] "{d0}" (@backingInt(number)), | |
| 35 | 35 | [arg1] "{d1}" (arg1), |
| 36 | 36 | [arg2] "{d2}" (arg2), |
| 37 | 37 | : .{ .memory = true }); |
| ... | ... | @@ -45,7 +45,7 @@ pub fn syscall3( |
| 45 | 45 | ) u32 { |
| 46 | 46 | return asm volatile ("trap #0" |
| 47 | 47 | : [ret] "={d0}" (-> u32), |
| 48 | : [number] "{d0}" (@intFromEnum(number)), | |
| 48 | : [number] "{d0}" (@backingInt(number)), | |
| 49 | 49 | [arg1] "{d1}" (arg1), |
| 50 | 50 | [arg2] "{d2}" (arg2), |
| 51 | 51 | [arg3] "{d3}" (arg3), |
| ... | ... | @@ -61,7 +61,7 @@ pub fn syscall4( |
| 61 | 61 | ) u32 { |
| 62 | 62 | return asm volatile ("trap #0" |
| 63 | 63 | : [ret] "={d0}" (-> u32), |
| 64 | : [number] "{d0}" (@intFromEnum(number)), | |
| 64 | : [number] "{d0}" (@backingInt(number)), | |
| 65 | 65 | [arg1] "{d1}" (arg1), |
| 66 | 66 | [arg2] "{d2}" (arg2), |
| 67 | 67 | [arg3] "{d3}" (arg3), |
| ... | ... | @@ -79,7 +79,7 @@ pub fn syscall5( |
| 79 | 79 | ) u32 { |
| 80 | 80 | return asm volatile ("trap #0" |
| 81 | 81 | : [ret] "={d0}" (-> u32), |
| 82 | : [number] "{d0}" (@intFromEnum(number)), | |
| 82 | : [number] "{d0}" (@backingInt(number)), | |
| 83 | 83 | [arg1] "{d1}" (arg1), |
| 84 | 84 | [arg2] "{d2}" (arg2), |
| 85 | 85 | [arg3] "{d3}" (arg3), |
| ... | ... | @@ -99,7 +99,7 @@ pub fn syscall6( |
| 99 | 99 | ) u32 { |
| 100 | 100 | return asm volatile ("trap #0" |
| 101 | 101 | : [ret] "={d0}" (-> u32), |
| 102 | : [number] "{d0}" (@intFromEnum(number)), | |
| 102 | : [number] "{d0}" (@backingInt(number)), | |
| 103 | 103 | [arg1] "{d1}" (arg1), |
| 104 | 104 | [arg2] "{d2}" (arg2), |
| 105 | 105 | [arg3] "{d3}" (arg3), |
| ... | ... | @@ -167,7 +167,7 @@ pub const restore = restore_rt; |
| 167 | 167 | pub fn restore_rt() callconv(.naked) noreturn { |
| 168 | 168 | asm volatile ("trap #0" |
| 169 | 169 | : |
| 170 | : [number] "{d0}" (@intFromEnum(SYS.rt_sigreturn)), | |
| 170 | : [number] "{d0}" (@backingInt(SYS.rt_sigreturn)), | |
| 171 | 171 | ); |
| 172 | 172 | } |
| 173 | 173 |
lib/std/os/linux/microblaze.zig+9-9| ... | ... | @@ -9,7 +9,7 @@ pub fn syscall0( |
| 9 | 9 | ) u32 { |
| 10 | 10 | return asm volatile ("brki r14, 0x8" |
| 11 | 11 | : [ret] "={r3}" (-> u32), |
| 12 | : [number] "{r12}" (@intFromEnum(number)), | |
| 12 | : [number] "{r12}" (@backingInt(number)), | |
| 13 | 13 | : .{ .r4 = true, .memory = true }); |
| 14 | 14 | } |
| 15 | 15 | |
| ... | ... | @@ -19,7 +19,7 @@ pub fn syscall1( |
| 19 | 19 | ) u32 { |
| 20 | 20 | return asm volatile ("brki r14, 0x8" |
| 21 | 21 | : [ret] "={r3}" (-> u32), |
| 22 | : [number] "{r12}" (@intFromEnum(number)), | |
| 22 | : [number] "{r12}" (@backingInt(number)), | |
| 23 | 23 | [arg1] "{r5}" (arg1), |
| 24 | 24 | : .{ .r4 = true, .memory = true }); |
| 25 | 25 | } |
| ... | ... | @@ -31,7 +31,7 @@ pub fn syscall2( |
| 31 | 31 | ) u32 { |
| 32 | 32 | return asm volatile ("brki r14, 0x8" |
| 33 | 33 | : [ret] "={r3}" (-> u32), |
| 34 | : [number] "{r12}" (@intFromEnum(number)), | |
| 34 | : [number] "{r12}" (@backingInt(number)), | |
| 35 | 35 | [arg1] "{r5}" (arg1), |
| 36 | 36 | [arg2] "{r6}" (arg2), |
| 37 | 37 | : .{ .r4 = true, .memory = true }); |
| ... | ... | @@ -45,7 +45,7 @@ pub fn syscall3( |
| 45 | 45 | ) u32 { |
| 46 | 46 | return asm volatile ("brki r14, 0x8" |
| 47 | 47 | : [ret] "={r3}" (-> u32), |
| 48 | : [number] "{r12}" (@intFromEnum(number)), | |
| 48 | : [number] "{r12}" (@backingInt(number)), | |
| 49 | 49 | [arg1] "{r5}" (arg1), |
| 50 | 50 | [arg2] "{r6}" (arg2), |
| 51 | 51 | [arg3] "{r7}" (arg3), |
| ... | ... | @@ -61,7 +61,7 @@ pub fn syscall4( |
| 61 | 61 | ) u32 { |
| 62 | 62 | return asm volatile ("brki r14, 0x8" |
| 63 | 63 | : [ret] "={r3}" (-> u32), |
| 64 | : [number] "{r12}" (@intFromEnum(number)), | |
| 64 | : [number] "{r12}" (@backingInt(number)), | |
| 65 | 65 | [arg1] "{r5}" (arg1), |
| 66 | 66 | [arg2] "{r6}" (arg2), |
| 67 | 67 | [arg3] "{r7}" (arg3), |
| ... | ... | @@ -79,7 +79,7 @@ pub fn syscall5( |
| 79 | 79 | ) u32 { |
| 80 | 80 | return asm volatile ("brki r14, 0x8" |
| 81 | 81 | : [ret] "={r3}" (-> u32), |
| 82 | : [number] "{r12}" (@intFromEnum(number)), | |
| 82 | : [number] "{r12}" (@backingInt(number)), | |
| 83 | 83 | [arg1] "{r5}" (arg1), |
| 84 | 84 | [arg2] "{r6}" (arg2), |
| 85 | 85 | [arg3] "{r7}" (arg3), |
| ... | ... | @@ -99,7 +99,7 @@ pub fn syscall6( |
| 99 | 99 | ) u32 { |
| 100 | 100 | return asm volatile ("brki r14, 0x8" |
| 101 | 101 | : [ret] "={r3}" (-> u32), |
| 102 | : [number] "{r12}" (@intFromEnum(number)), | |
| 102 | : [number] "{r12}" (@backingInt(number)), | |
| 103 | 103 | [arg1] "{r5}" (arg1), |
| 104 | 104 | [arg2] "{r6}" (arg2), |
| 105 | 105 | [arg3] "{r7}" (arg3), |
| ... | ... | @@ -153,7 +153,7 @@ pub fn restore() callconv(.naked) noreturn { |
| 153 | 153 | asm volatile ( |
| 154 | 154 | \\ brki r14, 0x8 |
| 155 | 155 | : |
| 156 | : [number] "{r7}" (@intFromEnum(SYS.sigreturn)), | |
| 156 | : [number] "{r7}" (@backingInt(SYS.sigreturn)), | |
| 157 | 157 | ); |
| 158 | 158 | } |
| 159 | 159 | |
| ... | ... | @@ -161,7 +161,7 @@ pub fn restore_rt() callconv(.naked) noreturn { |
| 161 | 161 | asm volatile ( |
| 162 | 162 | \\ brki r14, 0x8 |
| 163 | 163 | : |
| 164 | : [number] "{r7}" (@intFromEnum(SYS.rt_sigreturn)), | |
| 164 | : [number] "{r7}" (@backingInt(SYS.rt_sigreturn)), | |
| 165 | 165 | ); |
| 166 | 166 | } |
| 167 | 167 |
lib/std/os/linux/mips.zig+9-9| ... | ... | @@ -14,7 +14,7 @@ pub fn syscall0( |
| 14 | 14 | \\ subu $v0, $zero, $v0 |
| 15 | 15 | \\1: |
| 16 | 16 | : [ret] "={$2}" (-> u32), |
| 17 | : [number] "{$2}" (@intFromEnum(number)), | |
| 17 | : [number] "{$2}" (@backingInt(number)), | |
| 18 | 18 | : .{ .r1 = true, .r3 = true, .r4 = true, .r5 = true, .r6 = true, .r7 = true, .r8 = true, .r9 = true, .r10 = true, .r11 = true, .r12 = true, .r13 = true, .r14 = true, .r15 = true, .r24 = true, .r25 = true, .hi = true, .lo = true, .memory = true }); |
| 19 | 19 | } |
| 20 | 20 | |
| ... | ... | @@ -29,7 +29,7 @@ pub fn syscall1( |
| 29 | 29 | \\ subu $v0, $zero, $v0 |
| 30 | 30 | \\1: |
| 31 | 31 | : [ret] "={$2}" (-> u32), |
| 32 | : [number] "{$2}" (@intFromEnum(number)), | |
| 32 | : [number] "{$2}" (@backingInt(number)), | |
| 33 | 33 | [arg1] "{$4}" (arg1), |
| 34 | 34 | : .{ .r1 = true, .r3 = true, .r5 = true, .r6 = true, .r7 = true, .r8 = true, .r9 = true, .r10 = true, .r11 = true, .r12 = true, .r13 = true, .r14 = true, .r15 = true, .r24 = true, .r25 = true, .hi = true, .lo = true, .memory = true }); |
| 35 | 35 | } |
| ... | ... | @@ -46,7 +46,7 @@ pub fn syscall2( |
| 46 | 46 | \\ subu $v0, $zero, $v0 |
| 47 | 47 | \\1: |
| 48 | 48 | : [ret] "={$2}" (-> u32), |
| 49 | : [number] "{$2}" (@intFromEnum(number)), | |
| 49 | : [number] "{$2}" (@backingInt(number)), | |
| 50 | 50 | [arg1] "{$4}" (arg1), |
| 51 | 51 | [arg2] "{$5}" (arg2), |
| 52 | 52 | : .{ .r1 = true, .r3 = true, .r6 = true, .r7 = true, .r8 = true, .r9 = true, .r10 = true, .r11 = true, .r12 = true, .r13 = true, .r14 = true, .r15 = true, .r24 = true, .r25 = true, .hi = true, .lo = true, .memory = true }); |
| ... | ... | @@ -65,7 +65,7 @@ pub fn syscall3( |
| 65 | 65 | \\ subu $v0, $zero, $v0 |
| 66 | 66 | \\1: |
| 67 | 67 | : [ret] "={$2}" (-> u32), |
| 68 | : [number] "{$2}" (@intFromEnum(number)), | |
| 68 | : [number] "{$2}" (@backingInt(number)), | |
| 69 | 69 | [arg1] "{$4}" (arg1), |
| 70 | 70 | [arg2] "{$5}" (arg2), |
| 71 | 71 | [arg3] "{$6}" (arg3), |
| ... | ... | @@ -86,7 +86,7 @@ pub fn syscall4( |
| 86 | 86 | \\ subu $v0, $zero, $v0 |
| 87 | 87 | \\1: |
| 88 | 88 | : [ret] "={$2}" (-> u32), |
| 89 | : [number] "{$2}" (@intFromEnum(number)), | |
| 89 | : [number] "{$2}" (@backingInt(number)), | |
| 90 | 90 | [arg1] "{$4}" (arg1), |
| 91 | 91 | [arg2] "{$5}" (arg2), |
| 92 | 92 | [arg3] "{$6}" (arg3), |
| ... | ... | @@ -115,7 +115,7 @@ pub fn syscall5( |
| 115 | 115 | \\ subu $v0, $zero, $v0 |
| 116 | 116 | \\1: |
| 117 | 117 | : [ret] "={$2}" (-> u32), |
| 118 | : [number] "{$2}" (@intFromEnum(number)), | |
| 118 | : [number] "{$2}" (@backingInt(number)), | |
| 119 | 119 | [arg1] "{$4}" (arg1), |
| 120 | 120 | [arg2] "{$5}" (arg2), |
| 121 | 121 | [arg3] "{$6}" (arg3), |
| ... | ... | @@ -144,7 +144,7 @@ pub fn syscall6( |
| 144 | 144 | \\ subu $v0, $zero, $v0 |
| 145 | 145 | \\1: |
| 146 | 146 | : [ret] "={$2}" (-> u32), |
| 147 | : [number] "{$2}" (@intFromEnum(number)), | |
| 147 | : [number] "{$2}" (@backingInt(number)), | |
| 148 | 148 | [arg1] "{$4}" (arg1), |
| 149 | 149 | [arg2] "{$5}" (arg2), |
| 150 | 150 | [arg3] "{$6}" (arg3), |
| ... | ... | @@ -176,7 +176,7 @@ pub fn syscall7( |
| 176 | 176 | \\ subu $v0, $zero, $v0 |
| 177 | 177 | \\1: |
| 178 | 178 | : [ret] "={$2}" (-> u32), |
| 179 | : [number] "{$2}" (@intFromEnum(number)), | |
| 179 | : [number] "{$2}" (@backingInt(number)), | |
| 180 | 180 | [arg1] "{$4}" (arg1), |
| 181 | 181 | [arg2] "{$5}" (arg2), |
| 182 | 182 | [arg3] "{$6}" (arg3), |
| ... | ... | @@ -201,7 +201,7 @@ pub fn syscall_pipe( |
| 201 | 201 | \\ sw $v1, 4($a0) |
| 202 | 202 | \\2: |
| 203 | 203 | : [ret] "={$2}" (-> u32), |
| 204 | : [number] "{$2}" (@intFromEnum(SYS.pipe)), | |
| 204 | : [number] "{$2}" (@backingInt(SYS.pipe)), | |
| 205 | 205 | [fd] "{$4}" (fd), |
| 206 | 206 | : .{ .r1 = true, .r3 = true, .r5 = true, .r6 = true, .r7 = true, .r8 = true, .r9 = true, .r10 = true, .r11 = true, .r12 = true, .r13 = true, .r14 = true, .r15 = true, .r24 = true, .r25 = true, .hi = true, .lo = true, .memory = true }); |
| 207 | 207 | } |
lib/std/os/linux/mips64.zig+8-8| ... | ... | @@ -14,7 +14,7 @@ pub fn syscall0( |
| 14 | 14 | \\ dsubu $v0, $zero, $v0 |
| 15 | 15 | \\1: |
| 16 | 16 | : [ret] "={$2}" (-> u64), |
| 17 | : [number] "{$2}" (@intFromEnum(number)), | |
| 17 | : [number] "{$2}" (@backingInt(number)), | |
| 18 | 18 | : .{ .r1 = true, .r3 = true, .r4 = true, .r5 = true, .r6 = true, .r7 = true, .r8 = true, .r9 = true, .r10 = true, .r11 = true, .r12 = true, .r13 = true, .r14 = true, .r15 = true, .r24 = true, .r25 = true, .hi = true, .lo = true, .memory = true }); |
| 19 | 19 | } |
| 20 | 20 | |
| ... | ... | @@ -29,7 +29,7 @@ pub fn syscall1( |
| 29 | 29 | \\ dsubu $v0, $zero, $v0 |
| 30 | 30 | \\1: |
| 31 | 31 | : [ret] "={$2}" (-> u64), |
| 32 | : [number] "{$2}" (@intFromEnum(number)), | |
| 32 | : [number] "{$2}" (@backingInt(number)), | |
| 33 | 33 | [arg1] "{$4}" (arg1), |
| 34 | 34 | : .{ .r1 = true, .r3 = true, .r5 = true, .r6 = true, .r7 = true, .r8 = true, .r9 = true, .r10 = true, .r11 = true, .r12 = true, .r13 = true, .r14 = true, .r15 = true, .r24 = true, .r25 = true, .hi = true, .lo = true, .memory = true }); |
| 35 | 35 | } |
| ... | ... | @@ -46,7 +46,7 @@ pub fn syscall2( |
| 46 | 46 | \\ dsubu $v0, $zero, $v0 |
| 47 | 47 | \\1: |
| 48 | 48 | : [ret] "={$2}" (-> u64), |
| 49 | : [number] "{$2}" (@intFromEnum(number)), | |
| 49 | : [number] "{$2}" (@backingInt(number)), | |
| 50 | 50 | [arg1] "{$4}" (arg1), |
| 51 | 51 | [arg2] "{$5}" (arg2), |
| 52 | 52 | : .{ .r1 = true, .r3 = true, .r6 = true, .r7 = true, .r8 = true, .r9 = true, .r10 = true, .r11 = true, .r12 = true, .r13 = true, .r14 = true, .r15 = true, .r24 = true, .r25 = true, .hi = true, .lo = true, .memory = true }); |
| ... | ... | @@ -65,7 +65,7 @@ pub fn syscall3( |
| 65 | 65 | \\ dsubu $v0, $zero, $v0 |
| 66 | 66 | \\1: |
| 67 | 67 | : [ret] "={$2}" (-> u64), |
| 68 | : [number] "{$2}" (@intFromEnum(number)), | |
| 68 | : [number] "{$2}" (@backingInt(number)), | |
| 69 | 69 | [arg1] "{$4}" (arg1), |
| 70 | 70 | [arg2] "{$5}" (arg2), |
| 71 | 71 | [arg3] "{$6}" (arg3), |
| ... | ... | @@ -86,7 +86,7 @@ pub fn syscall4( |
| 86 | 86 | \\ dsubu $v0, $zero, $v0 |
| 87 | 87 | \\1: |
| 88 | 88 | : [ret] "={$2}" (-> u64), |
| 89 | : [number] "{$2}" (@intFromEnum(number)), | |
| 89 | : [number] "{$2}" (@backingInt(number)), | |
| 90 | 90 | [arg1] "{$4}" (arg1), |
| 91 | 91 | [arg2] "{$5}" (arg2), |
| 92 | 92 | [arg3] "{$6}" (arg3), |
| ... | ... | @@ -109,7 +109,7 @@ pub fn syscall5( |
| 109 | 109 | \\ dsubu $v0, $zero, $v0 |
| 110 | 110 | \\1: |
| 111 | 111 | : [ret] "={$2}" (-> u64), |
| 112 | : [number] "{$2}" (@intFromEnum(number)), | |
| 112 | : [number] "{$2}" (@backingInt(number)), | |
| 113 | 113 | [arg1] "{$4}" (arg1), |
| 114 | 114 | [arg2] "{$5}" (arg2), |
| 115 | 115 | [arg3] "{$6}" (arg3), |
| ... | ... | @@ -134,7 +134,7 @@ pub fn syscall6( |
| 134 | 134 | \\ dsubu $v0, $zero, $v0 |
| 135 | 135 | \\1: |
| 136 | 136 | : [ret] "={$2}" (-> u64), |
| 137 | : [number] "{$2}" (@intFromEnum(number)), | |
| 137 | : [number] "{$2}" (@backingInt(number)), | |
| 138 | 138 | [arg1] "{$4}" (arg1), |
| 139 | 139 | [arg2] "{$5}" (arg2), |
| 140 | 140 | [arg3] "{$6}" (arg3), |
| ... | ... | @@ -158,7 +158,7 @@ pub fn syscall_pipe( |
| 158 | 158 | \\ sw $v1, 4($a0) |
| 159 | 159 | \\2: |
| 160 | 160 | : [ret] "={$2}" (-> u64), |
| 161 | : [number] "{$2}" (@intFromEnum(SYS.pipe)), | |
| 161 | : [number] "{$2}" (@backingInt(SYS.pipe)), | |
| 162 | 162 | [fd] "{$4}" (fd), |
| 163 | 163 | : .{ .r1 = true, .r3 = true, .r5 = true, .r6 = true, .r7 = true, .r8 = true, .r9 = true, .r10 = true, .r11 = true, .r12 = true, .r13 = true, .r14 = true, .r15 = true, .r24 = true, .r25 = true, .hi = true, .lo = true, .memory = true }); |
| 164 | 164 | } |
lib/std/os/linux/mipsn32.zig+9-9| ... | ... | @@ -14,7 +14,7 @@ pub fn syscall0( |
| 14 | 14 | \\ subu $v0, $zero, $v0 |
| 15 | 15 | \\1: |
| 16 | 16 | : [ret] "={$2}" (-> u32), |
| 17 | : [number] "{$2}" (@intFromEnum(number)), | |
| 17 | : [number] "{$2}" (@backingInt(number)), | |
| 18 | 18 | : .{ .r1 = true, .r3 = true, .r4 = true, .r5 = true, .r6 = true, .r7 = true, .r8 = true, .r9 = true, .r10 = true, .r11 = true, .r12 = true, .r13 = true, .r14 = true, .r15 = true, .r24 = true, .r25 = true, .hi = true, .lo = true, .memory = true }); |
| 19 | 19 | } |
| 20 | 20 | |
| ... | ... | @@ -29,7 +29,7 @@ pub fn syscall1( |
| 29 | 29 | \\ subu $v0, $zero, $v0 |
| 30 | 30 | \\1: |
| 31 | 31 | : [ret] "={$2}" (-> u32), |
| 32 | : [number] "{$2}" (@intFromEnum(number)), | |
| 32 | : [number] "{$2}" (@backingInt(number)), | |
| 33 | 33 | [arg1] "{$4}" (arg1), |
| 34 | 34 | : .{ .r1 = true, .r3 = true, .r5 = true, .r6 = true, .r7 = true, .r8 = true, .r9 = true, .r10 = true, .r11 = true, .r12 = true, .r13 = true, .r14 = true, .r15 = true, .r24 = true, .r25 = true, .hi = true, .lo = true, .memory = true }); |
| 35 | 35 | } |
| ... | ... | @@ -46,7 +46,7 @@ pub fn syscall2( |
| 46 | 46 | \\ subu $v0, $zero, $v0 |
| 47 | 47 | \\1: |
| 48 | 48 | : [ret] "={$2}" (-> u32), |
| 49 | : [number] "{$2}" (@intFromEnum(number)), | |
| 49 | : [number] "{$2}" (@backingInt(number)), | |
| 50 | 50 | [arg1] "{$4}" (arg1), |
| 51 | 51 | [arg2] "{$5}" (arg2), |
| 52 | 52 | : .{ .r1 = true, .r3 = true, .r6 = true, .r7 = true, .r8 = true, .r9 = true, .r10 = true, .r11 = true, .r12 = true, .r13 = true, .r14 = true, .r15 = true, .r24 = true, .r25 = true, .hi = true, .lo = true, .memory = true }); |
| ... | ... | @@ -65,7 +65,7 @@ pub fn syscall3( |
| 65 | 65 | \\ subu $v0, $zero, $v0 |
| 66 | 66 | \\1: |
| 67 | 67 | : [ret] "={$2}" (-> u32), |
| 68 | : [number] "{$2}" (@intFromEnum(number)), | |
| 68 | : [number] "{$2}" (@backingInt(number)), | |
| 69 | 69 | [arg1] "{$4}" (arg1), |
| 70 | 70 | [arg2] "{$5}" (arg2), |
| 71 | 71 | [arg3] "{$6}" (arg3), |
| ... | ... | @@ -86,7 +86,7 @@ pub fn syscall4( |
| 86 | 86 | \\ subu $v0, $zero, $v0 |
| 87 | 87 | \\1: |
| 88 | 88 | : [ret] "={$2}" (-> u32), |
| 89 | : [number] "{$2}" (@intFromEnum(number)), | |
| 89 | : [number] "{$2}" (@backingInt(number)), | |
| 90 | 90 | [arg1] "{$4}" (arg1), |
| 91 | 91 | [arg2] "{$5}" (arg2), |
| 92 | 92 | [arg3] "{$6}" (arg3), |
| ... | ... | @@ -109,7 +109,7 @@ pub fn syscall5( |
| 109 | 109 | \\ subu $v0, $zero, $v0 |
| 110 | 110 | \\1: |
| 111 | 111 | : [ret] "={$2}" (-> u32), |
| 112 | : [number] "{$2}" (@intFromEnum(number)), | |
| 112 | : [number] "{$2}" (@backingInt(number)), | |
| 113 | 113 | [arg1] "{$4}" (arg1), |
| 114 | 114 | [arg2] "{$5}" (arg2), |
| 115 | 115 | [arg3] "{$6}" (arg3), |
| ... | ... | @@ -134,7 +134,7 @@ pub fn syscall6( |
| 134 | 134 | \\ subu $v0, $zero, $v0 |
| 135 | 135 | \\1: |
| 136 | 136 | : [ret] "={$2}" (-> u32), |
| 137 | : [number] "{$2}" (@intFromEnum(number)), | |
| 137 | : [number] "{$2}" (@backingInt(number)), | |
| 138 | 138 | [arg1] "{$4}" (arg1), |
| 139 | 139 | [arg2] "{$5}" (arg2), |
| 140 | 140 | [arg3] "{$6}" (arg3), |
| ... | ... | @@ -158,7 +158,7 @@ pub fn syscall_pipe( |
| 158 | 158 | \\ sw $v1, 4($a0) |
| 159 | 159 | \\2: |
| 160 | 160 | : [ret] "={$2}" (-> u32), |
| 161 | : [number] "{$2}" (@intFromEnum(SYS.pipe)), | |
| 161 | : [number] "{$2}" (@backingInt(SYS.pipe)), | |
| 162 | 162 | [fd] "{$4}" (fd), |
| 163 | 163 | : .{ .r1 = true, .r3 = true, .r5 = true, .r6 = true, .r7 = true, .r8 = true, .r9 = true, .r10 = true, .r11 = true, .r12 = true, .r13 = true, .r14 = true, .r15 = true, .r24 = true, .r25 = true, .hi = true, .lo = true, .memory = true }); |
| 164 | 164 | } |
| ... | ... | @@ -175,7 +175,7 @@ pub fn syscall_lseek( |
| 175 | 175 | \\ dsubu $v0, $zero, $v0 |
| 176 | 176 | \\1: |
| 177 | 177 | : [ret] "={$2}" (-> u64), |
| 178 | : [number] "{$2}" (@intFromEnum(SYS.lseek)), | |
| 178 | : [number] "{$2}" (@backingInt(SYS.lseek)), | |
| 179 | 179 | [fd] "{$4}" (@as(u32, @bitCast(fd))), |
| 180 | 180 | [offset] "{$5}" (@as(u64, @bitCast(offset))), |
| 181 | 181 | [whence] "{$6}" (whence), |
lib/std/os/linux/or1k.zig+7-7| ... | ... | @@ -10,7 +10,7 @@ pub fn syscall0( |
| 10 | 10 | return asm volatile ( |
| 11 | 11 | \\ l.sys 1 |
| 12 | 12 | : [ret] "={r11}" (-> u32), |
| 13 | : [number] "{r11}" (@intFromEnum(number)), | |
| 13 | : [number] "{r11}" (@backingInt(number)), | |
| 14 | 14 | : .{ .r3 = true, .r4 = true, .r5 = true, .r6 = true, .r7 = true, .r8 = true, .r12 = true, .r13 = true, .r15 = true, .r17 = true, .r19 = true, .r21 = true, .r23 = true, .r25 = true, .r27 = true, .r29 = true, .r31 = true, .memory = true }); |
| 15 | 15 | } |
| 16 | 16 | |
| ... | ... | @@ -21,7 +21,7 @@ pub fn syscall1( |
| 21 | 21 | return asm volatile ( |
| 22 | 22 | \\ l.sys 1 |
| 23 | 23 | : [ret] "={r11}" (-> u32), |
| 24 | : [number] "{r11}" (@intFromEnum(number)), | |
| 24 | : [number] "{r11}" (@backingInt(number)), | |
| 25 | 25 | [arg1] "{r3}" (arg1), |
| 26 | 26 | : .{ .r4 = true, .r5 = true, .r6 = true, .r7 = true, .r8 = true, .r12 = true, .r13 = true, .r15 = true, .r17 = true, .r19 = true, .r21 = true, .r23 = true, .r25 = true, .r27 = true, .r29 = true, .r31 = true, .memory = true }); |
| 27 | 27 | } |
| ... | ... | @@ -34,7 +34,7 @@ pub fn syscall2( |
| 34 | 34 | return asm volatile ( |
| 35 | 35 | \\ l.sys 1 |
| 36 | 36 | : [ret] "={r11}" (-> u32), |
| 37 | : [number] "{r11}" (@intFromEnum(number)), | |
| 37 | : [number] "{r11}" (@backingInt(number)), | |
| 38 | 38 | [arg1] "{r3}" (arg1), |
| 39 | 39 | [arg2] "{r4}" (arg2), |
| 40 | 40 | : .{ .r5 = true, .r6 = true, .r7 = true, .r8 = true, .r12 = true, .r13 = true, .r15 = true, .r17 = true, .r19 = true, .r21 = true, .r23 = true, .r25 = true, .r27 = true, .r29 = true, .r31 = true, .memory = true }); |
| ... | ... | @@ -49,7 +49,7 @@ pub fn syscall3( |
| 49 | 49 | return asm volatile ( |
| 50 | 50 | \\ l.sys 1 |
| 51 | 51 | : [ret] "={r11}" (-> u32), |
| 52 | : [number] "{r11}" (@intFromEnum(number)), | |
| 52 | : [number] "{r11}" (@backingInt(number)), | |
| 53 | 53 | [arg1] "{r3}" (arg1), |
| 54 | 54 | [arg2] "{r4}" (arg2), |
| 55 | 55 | [arg3] "{r5}" (arg3), |
| ... | ... | @@ -66,7 +66,7 @@ pub fn syscall4( |
| 66 | 66 | return asm volatile ( |
| 67 | 67 | \\ l.sys 1 |
| 68 | 68 | : [ret] "={r11}" (-> u32), |
| 69 | : [number] "{r11}" (@intFromEnum(number)), | |
| 69 | : [number] "{r11}" (@backingInt(number)), | |
| 70 | 70 | [arg1] "{r3}" (arg1), |
| 71 | 71 | [arg2] "{r4}" (arg2), |
| 72 | 72 | [arg3] "{r5}" (arg3), |
| ... | ... | @@ -85,7 +85,7 @@ pub fn syscall5( |
| 85 | 85 | return asm volatile ( |
| 86 | 86 | \\ l.sys 1 |
| 87 | 87 | : [ret] "={r11}" (-> u32), |
| 88 | : [number] "{r11}" (@intFromEnum(number)), | |
| 88 | : [number] "{r11}" (@backingInt(number)), | |
| 89 | 89 | [arg1] "{r3}" (arg1), |
| 90 | 90 | [arg2] "{r4}" (arg2), |
| 91 | 91 | [arg3] "{r5}" (arg3), |
| ... | ... | @@ -106,7 +106,7 @@ pub fn syscall6( |
| 106 | 106 | return asm volatile ( |
| 107 | 107 | \\ l.sys 1 |
| 108 | 108 | : [ret] "={r11}" (-> u32), |
| 109 | : [number] "{r11}" (@intFromEnum(number)), | |
| 109 | : [number] "{r11}" (@backingInt(number)), | |
| 110 | 110 | [arg1] "{r3}" (arg1), |
| 111 | 111 | [arg2] "{r4}" (arg2), |
| 112 | 112 | [arg3] "{r5}" (arg3), |
lib/std/os/linux/powerpc.zig+11-11| ... | ... | @@ -19,7 +19,7 @@ pub fn syscall0( |
| 19 | 19 | \\ 1: |
| 20 | 20 | : [ret] "={r3}" (-> u32), |
| 21 | 21 | [r0_out] "={r0}" (r0_out), |
| 22 | : [number] "{r0}" (@intFromEnum(number)), | |
| 22 | : [number] "{r0}" (@backingInt(number)), | |
| 23 | 23 | : .{ .memory = true, .cr0 = true, .r4 = true, .r5 = true, .r6 = true, .r7 = true, .r8 = true, .r9 = true, .r10 = true, .r11 = true, .r12 = true, .ctr = true, .xer = true }); |
| 24 | 24 | } |
| 25 | 25 | |
| ... | ... | @@ -36,7 +36,7 @@ pub fn syscall1( |
| 36 | 36 | \\ 1: |
| 37 | 37 | : [ret] "={r3}" (-> u32), |
| 38 | 38 | [r0_out] "={r0}" (r0_out), |
| 39 | : [number] "{r0}" (@intFromEnum(number)), | |
| 39 | : [number] "{r0}" (@backingInt(number)), | |
| 40 | 40 | [arg1] "{r3}" (arg1), |
| 41 | 41 | : .{ .memory = true, .cr0 = true, .r4 = true, .r5 = true, .r6 = true, .r7 = true, .r8 = true, .r9 = true, .r10 = true, .r11 = true, .r12 = true, .ctr = true, .xer = true }); |
| 42 | 42 | } |
| ... | ... | @@ -57,7 +57,7 @@ pub fn syscall2( |
| 57 | 57 | : [ret] "={r3}" (-> u32), |
| 58 | 58 | [r0_out] "={r0}" (r0_out), |
| 59 | 59 | [r4_out] "={r4}" (r4_out), |
| 60 | : [number] "{r0}" (@intFromEnum(number)), | |
| 60 | : [number] "{r0}" (@backingInt(number)), | |
| 61 | 61 | [arg1] "{r3}" (arg1), |
| 62 | 62 | [arg2] "{r4}" (arg2), |
| 63 | 63 | : .{ .memory = true, .cr0 = true, .r5 = true, .r6 = true, .r7 = true, .r8 = true, .r9 = true, .r10 = true, .r11 = true, .r12 = true, .ctr = true, .xer = true }); |
| ... | ... | @@ -82,7 +82,7 @@ pub fn syscall3( |
| 82 | 82 | [r0_out] "={r0}" (r0_out), |
| 83 | 83 | [r4_out] "={r4}" (r4_out), |
| 84 | 84 | [r5_out] "={r5}" (r5_out), |
| 85 | : [number] "{r0}" (@intFromEnum(number)), | |
| 85 | : [number] "{r0}" (@backingInt(number)), | |
| 86 | 86 | [arg1] "{r3}" (arg1), |
| 87 | 87 | [arg2] "{r4}" (arg2), |
| 88 | 88 | [arg3] "{r5}" (arg3), |
| ... | ... | @@ -111,7 +111,7 @@ pub fn syscall4( |
| 111 | 111 | [r4_out] "={r4}" (r4_out), |
| 112 | 112 | [r5_out] "={r5}" (r5_out), |
| 113 | 113 | [r6_out] "={r6}" (r6_out), |
| 114 | : [number] "{r0}" (@intFromEnum(number)), | |
| 114 | : [number] "{r0}" (@backingInt(number)), | |
| 115 | 115 | [arg1] "{r3}" (arg1), |
| 116 | 116 | [arg2] "{r4}" (arg2), |
| 117 | 117 | [arg3] "{r5}" (arg3), |
| ... | ... | @@ -144,7 +144,7 @@ pub fn syscall5( |
| 144 | 144 | [r5_out] "={r5}" (r5_out), |
| 145 | 145 | [r6_out] "={r6}" (r6_out), |
| 146 | 146 | [r7_out] "={r7}" (r7_out), |
| 147 | : [number] "{r0}" (@intFromEnum(number)), | |
| 147 | : [number] "{r0}" (@backingInt(number)), | |
| 148 | 148 | [arg1] "{r3}" (arg1), |
| 149 | 149 | [arg2] "{r4}" (arg2), |
| 150 | 150 | [arg3] "{r5}" (arg3), |
| ... | ... | @@ -181,7 +181,7 @@ pub fn syscall6( |
| 181 | 181 | [r6_out] "={r6}" (r6_out), |
| 182 | 182 | [r7_out] "={r7}" (r7_out), |
| 183 | 183 | [r8_out] "={r8}" (r8_out), |
| 184 | : [number] "{r0}" (@intFromEnum(number)), | |
| 184 | : [number] "{r0}" (@backingInt(number)), | |
| 185 | 185 | [arg1] "{r3}" (arg1), |
| 186 | 186 | [arg2] "{r4}" (arg2), |
| 187 | 187 | [arg3] "{r5}" (arg3), |
| ... | ... | @@ -267,12 +267,12 @@ pub fn restore() callconv(.naked) noreturn { |
| 267 | 267 | \\ li 0, %[number] |
| 268 | 268 | \\ sc |
| 269 | 269 | : |
| 270 | : [number] "i" (@intFromEnum(SYS.sigreturn)), | |
| 270 | : [number] "i" (@backingInt(SYS.sigreturn)), | |
| 271 | 271 | ), |
| 272 | 272 | else => asm volatile ( |
| 273 | 273 | \\ sc |
| 274 | 274 | : |
| 275 | : [number] "{r0}" (@intFromEnum(SYS.sigreturn)), | |
| 275 | : [number] "{r0}" (@backingInt(SYS.sigreturn)), | |
| 276 | 276 | ), |
| 277 | 277 | } |
| 278 | 278 | } |
| ... | ... | @@ -283,12 +283,12 @@ pub fn restore_rt() callconv(.naked) noreturn { |
| 283 | 283 | \\ li 0, %[number] |
| 284 | 284 | \\ sc |
| 285 | 285 | : |
| 286 | : [number] "i" (@intFromEnum(SYS.rt_sigreturn)), | |
| 286 | : [number] "i" (@backingInt(SYS.rt_sigreturn)), | |
| 287 | 287 | ), |
| 288 | 288 | else => asm volatile ( |
| 289 | 289 | \\ sc |
| 290 | 290 | : |
| 291 | : [number] "{r0}" (@intFromEnum(SYS.rt_sigreturn)), | |
| 291 | : [number] "{r0}" (@backingInt(SYS.rt_sigreturn)), | |
| 292 | 292 | ), |
| 293 | 293 | } |
| 294 | 294 | } |
lib/std/os/linux/powerpc64.zig+11-11| ... | ... | @@ -19,7 +19,7 @@ pub fn syscall0( |
| 19 | 19 | \\ 1: |
| 20 | 20 | : [ret] "={r3}" (-> u64), |
| 21 | 21 | [r0_out] "={r0}" (r0_out), |
| 22 | : [number] "{r0}" (@intFromEnum(number)), | |
| 22 | : [number] "{r0}" (@backingInt(number)), | |
| 23 | 23 | : .{ .memory = true, .cr0 = true, .r4 = true, .r5 = true, .r6 = true, .r7 = true, .r8 = true, .r9 = true, .r10 = true, .r11 = true, .r12 = true, .ctr = true, .xer = true }); |
| 24 | 24 | } |
| 25 | 25 | |
| ... | ... | @@ -36,7 +36,7 @@ pub fn syscall1( |
| 36 | 36 | \\ 1: |
| 37 | 37 | : [ret] "={r3}" (-> u64), |
| 38 | 38 | [r0_out] "={r0}" (r0_out), |
| 39 | : [number] "{r0}" (@intFromEnum(number)), | |
| 39 | : [number] "{r0}" (@backingInt(number)), | |
| 40 | 40 | [arg1] "{r3}" (arg1), |
| 41 | 41 | : .{ .memory = true, .cr0 = true, .r4 = true, .r5 = true, .r6 = true, .r7 = true, .r8 = true, .r9 = true, .r10 = true, .r11 = true, .r12 = true, .ctr = true, .xer = true }); |
| 42 | 42 | } |
| ... | ... | @@ -57,7 +57,7 @@ pub fn syscall2( |
| 57 | 57 | : [ret] "={r3}" (-> u64), |
| 58 | 58 | [r0_out] "={r0}" (r0_out), |
| 59 | 59 | [r4_out] "={r4}" (r4_out), |
| 60 | : [number] "{r0}" (@intFromEnum(number)), | |
| 60 | : [number] "{r0}" (@backingInt(number)), | |
| 61 | 61 | [arg1] "{r3}" (arg1), |
| 62 | 62 | [arg2] "{r4}" (arg2), |
| 63 | 63 | : .{ .memory = true, .cr0 = true, .r5 = true, .r6 = true, .r7 = true, .r8 = true, .r9 = true, .r10 = true, .r11 = true, .r12 = true, .ctr = true, .xer = true }); |
| ... | ... | @@ -82,7 +82,7 @@ pub fn syscall3( |
| 82 | 82 | [r0_out] "={r0}" (r0_out), |
| 83 | 83 | [r4_out] "={r4}" (r4_out), |
| 84 | 84 | [r5_out] "={r5}" (r5_out), |
| 85 | : [number] "{r0}" (@intFromEnum(number)), | |
| 85 | : [number] "{r0}" (@backingInt(number)), | |
| 86 | 86 | [arg1] "{r3}" (arg1), |
| 87 | 87 | [arg2] "{r4}" (arg2), |
| 88 | 88 | [arg3] "{r5}" (arg3), |
| ... | ... | @@ -111,7 +111,7 @@ pub fn syscall4( |
| 111 | 111 | [r4_out] "={r4}" (r4_out), |
| 112 | 112 | [r5_out] "={r5}" (r5_out), |
| 113 | 113 | [r6_out] "={r6}" (r6_out), |
| 114 | : [number] "{r0}" (@intFromEnum(number)), | |
| 114 | : [number] "{r0}" (@backingInt(number)), | |
| 115 | 115 | [arg1] "{r3}" (arg1), |
| 116 | 116 | [arg2] "{r4}" (arg2), |
| 117 | 117 | [arg3] "{r5}" (arg3), |
| ... | ... | @@ -144,7 +144,7 @@ pub fn syscall5( |
| 144 | 144 | [r5_out] "={r5}" (r5_out), |
| 145 | 145 | [r6_out] "={r6}" (r6_out), |
| 146 | 146 | [r7_out] "={r7}" (r7_out), |
| 147 | : [number] "{r0}" (@intFromEnum(number)), | |
| 147 | : [number] "{r0}" (@backingInt(number)), | |
| 148 | 148 | [arg1] "{r3}" (arg1), |
| 149 | 149 | [arg2] "{r4}" (arg2), |
| 150 | 150 | [arg3] "{r5}" (arg3), |
| ... | ... | @@ -181,7 +181,7 @@ pub fn syscall6( |
| 181 | 181 | [r6_out] "={r6}" (r6_out), |
| 182 | 182 | [r7_out] "={r7}" (r7_out), |
| 183 | 183 | [r8_out] "={r8}" (r8_out), |
| 184 | : [number] "{r0}" (@intFromEnum(number)), | |
| 184 | : [number] "{r0}" (@backingInt(number)), | |
| 185 | 185 | [arg1] "{r3}" (arg1), |
| 186 | 186 | [arg2] "{r4}" (arg2), |
| 187 | 187 | [arg3] "{r5}" (arg3), |
| ... | ... | @@ -252,12 +252,12 @@ pub fn restore() callconv(.naked) noreturn { |
| 252 | 252 | \\ li 0, %[number] |
| 253 | 253 | \\ sc |
| 254 | 254 | : |
| 255 | : [number] "i" (@intFromEnum(SYS.sigreturn)), | |
| 255 | : [number] "i" (@backingInt(SYS.sigreturn)), | |
| 256 | 256 | ), |
| 257 | 257 | else => asm volatile ( |
| 258 | 258 | \\ sc |
| 259 | 259 | : |
| 260 | : [number] "{r0}" (@intFromEnum(SYS.sigreturn)), | |
| 260 | : [number] "{r0}" (@backingInt(SYS.sigreturn)), | |
| 261 | 261 | ), |
| 262 | 262 | } |
| 263 | 263 | } |
| ... | ... | @@ -268,12 +268,12 @@ pub fn restore_rt() callconv(.naked) noreturn { |
| 268 | 268 | \\ li 0, %[number] |
| 269 | 269 | \\ sc |
| 270 | 270 | : |
| 271 | : [number] "i" (@intFromEnum(SYS.rt_sigreturn)), | |
| 271 | : [number] "i" (@backingInt(SYS.rt_sigreturn)), | |
| 272 | 272 | ), |
| 273 | 273 | else => asm volatile ( |
| 274 | 274 | \\ sc |
| 275 | 275 | : |
| 276 | : [number] "{r0}" (@intFromEnum(SYS.rt_sigreturn)), | |
| 276 | : [number] "{r0}" (@backingInt(SYS.rt_sigreturn)), | |
| 277 | 277 | ), |
| 278 | 278 | } |
| 279 | 279 | } |
lib/std/os/linux/riscv32.zig+7-7| ... | ... | @@ -9,7 +9,7 @@ pub fn syscall0( |
| 9 | 9 | ) u32 { |
| 10 | 10 | return asm volatile ("ecall" |
| 11 | 11 | : [ret] "={x10}" (-> u32), |
| 12 | : [number] "{x17}" (@intFromEnum(number)), | |
| 12 | : [number] "{x17}" (@backingInt(number)), | |
| 13 | 13 | : .{ .memory = true }); |
| 14 | 14 | } |
| 15 | 15 | |
| ... | ... | @@ -19,7 +19,7 @@ pub fn syscall1( |
| 19 | 19 | ) u32 { |
| 20 | 20 | return asm volatile ("ecall" |
| 21 | 21 | : [ret] "={x10}" (-> u32), |
| 22 | : [number] "{x17}" (@intFromEnum(number)), | |
| 22 | : [number] "{x17}" (@backingInt(number)), | |
| 23 | 23 | [arg1] "{x10}" (arg1), |
| 24 | 24 | : .{ .memory = true }); |
| 25 | 25 | } |
| ... | ... | @@ -31,7 +31,7 @@ pub fn syscall2( |
| 31 | 31 | ) u32 { |
| 32 | 32 | return asm volatile ("ecall" |
| 33 | 33 | : [ret] "={x10}" (-> u32), |
| 34 | : [number] "{x17}" (@intFromEnum(number)), | |
| 34 | : [number] "{x17}" (@backingInt(number)), | |
| 35 | 35 | [arg1] "{x10}" (arg1), |
| 36 | 36 | [arg2] "{x11}" (arg2), |
| 37 | 37 | : .{ .memory = true }); |
| ... | ... | @@ -45,7 +45,7 @@ pub fn syscall3( |
| 45 | 45 | ) u32 { |
| 46 | 46 | return asm volatile ("ecall" |
| 47 | 47 | : [ret] "={x10}" (-> u32), |
| 48 | : [number] "{x17}" (@intFromEnum(number)), | |
| 48 | : [number] "{x17}" (@backingInt(number)), | |
| 49 | 49 | [arg1] "{x10}" (arg1), |
| 50 | 50 | [arg2] "{x11}" (arg2), |
| 51 | 51 | [arg3] "{x12}" (arg3), |
| ... | ... | @@ -61,7 +61,7 @@ pub fn syscall4( |
| 61 | 61 | ) u32 { |
| 62 | 62 | return asm volatile ("ecall" |
| 63 | 63 | : [ret] "={x10}" (-> u32), |
| 64 | : [number] "{x17}" (@intFromEnum(number)), | |
| 64 | : [number] "{x17}" (@backingInt(number)), | |
| 65 | 65 | [arg1] "{x10}" (arg1), |
| 66 | 66 | [arg2] "{x11}" (arg2), |
| 67 | 67 | [arg3] "{x12}" (arg3), |
| ... | ... | @@ -79,7 +79,7 @@ pub fn syscall5( |
| 79 | 79 | ) u32 { |
| 80 | 80 | return asm volatile ("ecall" |
| 81 | 81 | : [ret] "={x10}" (-> u32), |
| 82 | : [number] "{x17}" (@intFromEnum(number)), | |
| 82 | : [number] "{x17}" (@backingInt(number)), | |
| 83 | 83 | [arg1] "{x10}" (arg1), |
| 84 | 84 | [arg2] "{x11}" (arg2), |
| 85 | 85 | [arg3] "{x12}" (arg3), |
| ... | ... | @@ -99,7 +99,7 @@ pub fn syscall6( |
| 99 | 99 | ) u32 { |
| 100 | 100 | return asm volatile ("ecall" |
| 101 | 101 | : [ret] "={x10}" (-> u32), |
| 102 | : [number] "{x17}" (@intFromEnum(number)), | |
| 102 | : [number] "{x17}" (@backingInt(number)), | |
| 103 | 103 | [arg1] "{x10}" (arg1), |
| 104 | 104 | [arg2] "{x11}" (arg2), |
| 105 | 105 | [arg3] "{x12}" (arg3), |
lib/std/os/linux/riscv64.zig+7-7| ... | ... | @@ -9,7 +9,7 @@ pub fn syscall0( |
| 9 | 9 | ) u64 { |
| 10 | 10 | return asm volatile ("ecall" |
| 11 | 11 | : [ret] "={x10}" (-> u64), |
| 12 | : [number] "{x17}" (@intFromEnum(number)), | |
| 12 | : [number] "{x17}" (@backingInt(number)), | |
| 13 | 13 | : .{ .memory = true }); |
| 14 | 14 | } |
| 15 | 15 | |
| ... | ... | @@ -19,7 +19,7 @@ pub fn syscall1( |
| 19 | 19 | ) u64 { |
| 20 | 20 | return asm volatile ("ecall" |
| 21 | 21 | : [ret] "={x10}" (-> u64), |
| 22 | : [number] "{x17}" (@intFromEnum(number)), | |
| 22 | : [number] "{x17}" (@backingInt(number)), | |
| 23 | 23 | [arg1] "{x10}" (arg1), |
| 24 | 24 | : .{ .memory = true }); |
| 25 | 25 | } |
| ... | ... | @@ -31,7 +31,7 @@ pub fn syscall2( |
| 31 | 31 | ) u64 { |
| 32 | 32 | return asm volatile ("ecall" |
| 33 | 33 | : [ret] "={x10}" (-> u64), |
| 34 | : [number] "{x17}" (@intFromEnum(number)), | |
| 34 | : [number] "{x17}" (@backingInt(number)), | |
| 35 | 35 | [arg1] "{x10}" (arg1), |
| 36 | 36 | [arg2] "{x11}" (arg2), |
| 37 | 37 | : .{ .memory = true }); |
| ... | ... | @@ -45,7 +45,7 @@ pub fn syscall3( |
| 45 | 45 | ) u64 { |
| 46 | 46 | return asm volatile ("ecall" |
| 47 | 47 | : [ret] "={x10}" (-> u64), |
| 48 | : [number] "{x17}" (@intFromEnum(number)), | |
| 48 | : [number] "{x17}" (@backingInt(number)), | |
| 49 | 49 | [arg1] "{x10}" (arg1), |
| 50 | 50 | [arg2] "{x11}" (arg2), |
| 51 | 51 | [arg3] "{x12}" (arg3), |
| ... | ... | @@ -61,7 +61,7 @@ pub fn syscall4( |
| 61 | 61 | ) u64 { |
| 62 | 62 | return asm volatile ("ecall" |
| 63 | 63 | : [ret] "={x10}" (-> u64), |
| 64 | : [number] "{x17}" (@intFromEnum(number)), | |
| 64 | : [number] "{x17}" (@backingInt(number)), | |
| 65 | 65 | [arg1] "{x10}" (arg1), |
| 66 | 66 | [arg2] "{x11}" (arg2), |
| 67 | 67 | [arg3] "{x12}" (arg3), |
| ... | ... | @@ -79,7 +79,7 @@ pub fn syscall5( |
| 79 | 79 | ) u64 { |
| 80 | 80 | return asm volatile ("ecall" |
| 81 | 81 | : [ret] "={x10}" (-> u64), |
| 82 | : [number] "{x17}" (@intFromEnum(number)), | |
| 82 | : [number] "{x17}" (@backingInt(number)), | |
| 83 | 83 | [arg1] "{x10}" (arg1), |
| 84 | 84 | [arg2] "{x11}" (arg2), |
| 85 | 85 | [arg3] "{x12}" (arg3), |
| ... | ... | @@ -99,7 +99,7 @@ pub fn syscall6( |
| 99 | 99 | ) u64 { |
| 100 | 100 | return asm volatile ("ecall" |
| 101 | 101 | : [ret] "={x10}" (-> u64), |
| 102 | : [number] "{x17}" (@intFromEnum(number)), | |
| 102 | : [number] "{x17}" (@backingInt(number)), | |
| 103 | 103 | [arg1] "{x10}" (arg1), |
| 104 | 104 | [arg2] "{x11}" (arg2), |
| 105 | 105 | [arg3] "{x12}" (arg3), |
lib/std/os/linux/s390x.zig+9-9| ... | ... | @@ -9,7 +9,7 @@ pub fn syscall0( |
| 9 | 9 | ) u64 { |
| 10 | 10 | return asm volatile ("svc 0" |
| 11 | 11 | : [ret] "={r2}" (-> u64), |
| 12 | : [number] "{r1}" (@intFromEnum(number)), | |
| 12 | : [number] "{r1}" (@backingInt(number)), | |
| 13 | 13 | : .{ .memory = true }); |
| 14 | 14 | } |
| 15 | 15 | |
| ... | ... | @@ -19,7 +19,7 @@ pub fn syscall1( |
| 19 | 19 | ) u64 { |
| 20 | 20 | return asm volatile ("svc 0" |
| 21 | 21 | : [ret] "={r2}" (-> u64), |
| 22 | : [number] "{r1}" (@intFromEnum(number)), | |
| 22 | : [number] "{r1}" (@backingInt(number)), | |
| 23 | 23 | [arg1] "{r2}" (arg1), |
| 24 | 24 | : .{ .memory = true }); |
| 25 | 25 | } |
| ... | ... | @@ -31,7 +31,7 @@ pub fn syscall2( |
| 31 | 31 | ) u64 { |
| 32 | 32 | return asm volatile ("svc 0" |
| 33 | 33 | : [ret] "={r2}" (-> u64), |
| 34 | : [number] "{r1}" (@intFromEnum(number)), | |
| 34 | : [number] "{r1}" (@backingInt(number)), | |
| 35 | 35 | [arg1] "{r2}" (arg1), |
| 36 | 36 | [arg2] "{r3}" (arg2), |
| 37 | 37 | : .{ .memory = true }); |
| ... | ... | @@ -45,7 +45,7 @@ pub fn syscall3( |
| 45 | 45 | ) u64 { |
| 46 | 46 | return asm volatile ("svc 0" |
| 47 | 47 | : [ret] "={r2}" (-> u64), |
| 48 | : [number] "{r1}" (@intFromEnum(number)), | |
| 48 | : [number] "{r1}" (@backingInt(number)), | |
| 49 | 49 | [arg1] "{r2}" (arg1), |
| 50 | 50 | [arg2] "{r3}" (arg2), |
| 51 | 51 | [arg3] "{r4}" (arg3), |
| ... | ... | @@ -61,7 +61,7 @@ pub fn syscall4( |
| 61 | 61 | ) u64 { |
| 62 | 62 | return asm volatile ("svc 0" |
| 63 | 63 | : [ret] "={r2}" (-> u64), |
| 64 | : [number] "{r1}" (@intFromEnum(number)), | |
| 64 | : [number] "{r1}" (@backingInt(number)), | |
| 65 | 65 | [arg1] "{r2}" (arg1), |
| 66 | 66 | [arg2] "{r3}" (arg2), |
| 67 | 67 | [arg3] "{r4}" (arg3), |
| ... | ... | @@ -79,7 +79,7 @@ pub fn syscall5( |
| 79 | 79 | ) u64 { |
| 80 | 80 | return asm volatile ("svc 0" |
| 81 | 81 | : [ret] "={r2}" (-> u64), |
| 82 | : [number] "{r1}" (@intFromEnum(number)), | |
| 82 | : [number] "{r1}" (@backingInt(number)), | |
| 83 | 83 | [arg1] "{r2}" (arg1), |
| 84 | 84 | [arg2] "{r3}" (arg2), |
| 85 | 85 | [arg3] "{r4}" (arg3), |
| ... | ... | @@ -99,7 +99,7 @@ pub fn syscall6( |
| 99 | 99 | ) u64 { |
| 100 | 100 | return asm volatile ("svc 0" |
| 101 | 101 | : [ret] "={r2}" (-> u64), |
| 102 | : [number] "{r1}" (@intFromEnum(number)), | |
| 102 | : [number] "{r1}" (@backingInt(number)), | |
| 103 | 103 | [arg1] "{r2}" (arg1), |
| 104 | 104 | [arg2] "{r3}" (arg2), |
| 105 | 105 | [arg3] "{r4}" (arg3), |
| ... | ... | @@ -177,7 +177,7 @@ pub fn restore() callconv(.naked) noreturn { |
| 177 | 177 | asm volatile ( |
| 178 | 178 | \\svc 0 |
| 179 | 179 | : |
| 180 | : [number] "{r1}" (@intFromEnum(SYS.sigreturn)), | |
| 180 | : [number] "{r1}" (@backingInt(SYS.sigreturn)), | |
| 181 | 181 | ); |
| 182 | 182 | } |
| 183 | 183 | |
| ... | ... | @@ -185,7 +185,7 @@ pub fn restore_rt() callconv(.naked) noreturn { |
| 185 | 185 | asm volatile ( |
| 186 | 186 | \\svc 0 |
| 187 | 187 | : |
| 188 | : [number] "{r1}" (@intFromEnum(SYS.rt_sigreturn)), | |
| 188 | : [number] "{r1}" (@backingInt(SYS.rt_sigreturn)), | |
| 189 | 189 | ); |
| 190 | 190 | } |
| 191 | 191 |
lib/std/os/linux/sh.zig+9-9| ... | ... | @@ -15,7 +15,7 @@ pub fn syscall0( |
| 15 | 15 | \\ or r0, r0 |
| 16 | 16 | \\ or r0, r0 |
| 17 | 17 | : [ret] "={r0}" (-> u32), |
| 18 | : [number] "{r3}" (@intFromEnum(number)), | |
| 18 | : [number] "{r3}" (@backingInt(number)), | |
| 19 | 19 | : .{ .memory = true }); |
| 20 | 20 | } |
| 21 | 21 | |
| ... | ... | @@ -31,7 +31,7 @@ pub fn syscall1( |
| 31 | 31 | \\ or r0, r0 |
| 32 | 32 | \\ or r0, r0 |
| 33 | 33 | : [ret] "={r0}" (-> u32), |
| 34 | : [number] "{r3}" (@intFromEnum(number)), | |
| 34 | : [number] "{r3}" (@backingInt(number)), | |
| 35 | 35 | [arg1] "{r4}" (arg1), |
| 36 | 36 | : .{ .memory = true }); |
| 37 | 37 | } |
| ... | ... | @@ -49,7 +49,7 @@ pub fn syscall2( |
| 49 | 49 | \\ or r0, r0 |
| 50 | 50 | \\ or r0, r0 |
| 51 | 51 | : [ret] "={r0}" (-> u32), |
| 52 | : [number] "{r3}" (@intFromEnum(number)), | |
| 52 | : [number] "{r3}" (@backingInt(number)), | |
| 53 | 53 | [arg1] "{r4}" (arg1), |
| 54 | 54 | [arg2] "{r5}" (arg2), |
| 55 | 55 | : .{ .memory = true }); |
| ... | ... | @@ -69,7 +69,7 @@ pub fn syscall3( |
| 69 | 69 | \\ or r0, r0 |
| 70 | 70 | \\ or r0, r0 |
| 71 | 71 | : [ret] "={r0}" (-> u32), |
| 72 | : [number] "{r3}" (@intFromEnum(number)), | |
| 72 | : [number] "{r3}" (@backingInt(number)), | |
| 73 | 73 | [arg1] "{r4}" (arg1), |
| 74 | 74 | [arg2] "{r5}" (arg2), |
| 75 | 75 | [arg3] "{r6}" (arg3), |
| ... | ... | @@ -91,7 +91,7 @@ pub fn syscall4( |
| 91 | 91 | \\ or r0, r0 |
| 92 | 92 | \\ or r0, r0 |
| 93 | 93 | : [ret] "={r0}" (-> u32), |
| 94 | : [number] "{r3}" (@intFromEnum(number)), | |
| 94 | : [number] "{r3}" (@backingInt(number)), | |
| 95 | 95 | [arg1] "{r4}" (arg1), |
| 96 | 96 | [arg2] "{r5}" (arg2), |
| 97 | 97 | [arg3] "{r6}" (arg3), |
| ... | ... | @@ -115,7 +115,7 @@ pub fn syscall5( |
| 115 | 115 | \\ or r0, r0 |
| 116 | 116 | \\ or r0, r0 |
| 117 | 117 | : [ret] "={r0}" (-> u32), |
| 118 | : [number] "{r3}" (@intFromEnum(number)), | |
| 118 | : [number] "{r3}" (@backingInt(number)), | |
| 119 | 119 | [arg1] "{r4}" (arg1), |
| 120 | 120 | [arg2] "{r5}" (arg2), |
| 121 | 121 | [arg3] "{r6}" (arg3), |
| ... | ... | @@ -141,7 +141,7 @@ pub fn syscall6( |
| 141 | 141 | \\ or r0, r0 |
| 142 | 142 | \\ or r0, r0 |
| 143 | 143 | : [ret] "={r0}" (-> u32), |
| 144 | : [number] "{r3}" (@intFromEnum(number)), | |
| 144 | : [number] "{r3}" (@backingInt(number)), | |
| 145 | 145 | [arg1] "{r4}" (arg1), |
| 146 | 146 | [arg2] "{r5}" (arg2), |
| 147 | 147 | [arg3] "{r6}" (arg3), |
| ... | ... | @@ -217,7 +217,7 @@ pub fn restore() callconv(.naked) noreturn { |
| 217 | 217 | \\ or r0, r0 |
| 218 | 218 | \\ or r0, r0 |
| 219 | 219 | : |
| 220 | : [number] "{r3}" (@intFromEnum(SYS.sigreturn)), | |
| 220 | : [number] "{r3}" (@backingInt(SYS.sigreturn)), | |
| 221 | 221 | ); |
| 222 | 222 | } |
| 223 | 223 | |
| ... | ... | @@ -230,7 +230,7 @@ pub fn restore_rt() callconv(.naked) noreturn { |
| 230 | 230 | \\ or r0, r0 |
| 231 | 231 | \\ or r0, r0 |
| 232 | 232 | : |
| 233 | : [number] "{r3}" (@intFromEnum(SYS.rt_sigreturn)), | |
| 233 | : [number] "{r3}" (@backingInt(SYS.rt_sigreturn)), | |
| 234 | 234 | ); |
| 235 | 235 | } |
| 236 | 236 |
lib/std/os/linux/sparc.zig+10-10| ... | ... | @@ -14,7 +14,7 @@ pub fn syscall0( |
| 14 | 14 | \\ neg %%o0 |
| 15 | 15 | \\1: |
| 16 | 16 | : [ret] "={o0}" (-> u32), |
| 17 | : [number] "{g1}" (@intFromEnum(number)), | |
| 17 | : [number] "{g1}" (@backingInt(number)), | |
| 18 | 18 | : .{ .memory = true, .xcc = true, .o1 = true, .o2 = true, .o3 = true, .o4 = true, .o5 = true, .o7 = true }); |
| 19 | 19 | } |
| 20 | 20 | |
| ... | ... | @@ -29,7 +29,7 @@ pub fn syscall1( |
| 29 | 29 | \\ neg %%o0 |
| 30 | 30 | \\1: |
| 31 | 31 | : [ret] "={o0}" (-> u32), |
| 32 | : [number] "{g1}" (@intFromEnum(number)), | |
| 32 | : [number] "{g1}" (@backingInt(number)), | |
| 33 | 33 | [arg1] "{o0}" (arg1), |
| 34 | 34 | : .{ .memory = true, .xcc = true, .o1 = true, .o2 = true, .o3 = true, .o4 = true, .o5 = true, .o7 = true }); |
| 35 | 35 | } |
| ... | ... | @@ -46,7 +46,7 @@ pub fn syscall2( |
| 46 | 46 | \\ neg %%o0 |
| 47 | 47 | \\1: |
| 48 | 48 | : [ret] "={o0}" (-> u32), |
| 49 | : [number] "{g1}" (@intFromEnum(number)), | |
| 49 | : [number] "{g1}" (@backingInt(number)), | |
| 50 | 50 | [arg1] "{o0}" (arg1), |
| 51 | 51 | [arg2] "{o1}" (arg2), |
| 52 | 52 | : .{ .memory = true, .xcc = true, .o1 = true, .o2 = true, .o3 = true, .o4 = true, .o5 = true, .o7 = true }); |
| ... | ... | @@ -65,7 +65,7 @@ pub fn syscall3( |
| 65 | 65 | \\ neg %%o0 |
| 66 | 66 | \\1: |
| 67 | 67 | : [ret] "={o0}" (-> u32), |
| 68 | : [number] "{g1}" (@intFromEnum(number)), | |
| 68 | : [number] "{g1}" (@backingInt(number)), | |
| 69 | 69 | [arg1] "{o0}" (arg1), |
| 70 | 70 | [arg2] "{o1}" (arg2), |
| 71 | 71 | [arg3] "{o2}" (arg3), |
| ... | ... | @@ -86,7 +86,7 @@ pub fn syscall4( |
| 86 | 86 | \\ neg %%o0 |
| 87 | 87 | \\1: |
| 88 | 88 | : [ret] "={o0}" (-> u32), |
| 89 | : [number] "{g1}" (@intFromEnum(number)), | |
| 89 | : [number] "{g1}" (@backingInt(number)), | |
| 90 | 90 | [arg1] "{o0}" (arg1), |
| 91 | 91 | [arg2] "{o1}" (arg2), |
| 92 | 92 | [arg3] "{o2}" (arg3), |
| ... | ... | @@ -109,7 +109,7 @@ pub fn syscall5( |
| 109 | 109 | \\ neg %%o0 |
| 110 | 110 | \\1: |
| 111 | 111 | : [ret] "={o0}" (-> u32), |
| 112 | : [number] "{g1}" (@intFromEnum(number)), | |
| 112 | : [number] "{g1}" (@backingInt(number)), | |
| 113 | 113 | [arg1] "{o0}" (arg1), |
| 114 | 114 | [arg2] "{o1}" (arg2), |
| 115 | 115 | [arg3] "{o2}" (arg3), |
| ... | ... | @@ -134,7 +134,7 @@ pub fn syscall6( |
| 134 | 134 | \\ neg %%o0 |
| 135 | 135 | \\1: |
| 136 | 136 | : [ret] "={o0}" (-> u32), |
| 137 | : [number] "{g1}" (@intFromEnum(number)), | |
| 137 | : [number] "{g1}" (@backingInt(number)), | |
| 138 | 138 | [arg1] "{o0}" (arg1), |
| 139 | 139 | [arg2] "{o1}" (arg2), |
| 140 | 140 | [arg3] "{o2}" (arg3), |
| ... | ... | @@ -161,7 +161,7 @@ pub fn syscall_pipe( |
| 161 | 161 | \\ clr %%o0 |
| 162 | 162 | \\2: |
| 163 | 163 | : [ret] "={o0}" (-> u32), |
| 164 | : [number] "{g1}" (@intFromEnum(SYS.pipe)), | |
| 164 | : [number] "{g1}" (@backingInt(SYS.pipe)), | |
| 165 | 165 | [arg] "r" (fd), |
| 166 | 166 | : .{ .memory = true, .g3 = true }); |
| 167 | 167 | } |
| ... | ... | @@ -184,7 +184,7 @@ pub fn syscall_fork() u32 { |
| 184 | 184 | \\ and %%o1, %%o0, %%o0 |
| 185 | 185 | \\2: |
| 186 | 186 | : [ret] "={o0}" (-> u32), |
| 187 | : [number] "{g1}" (@intFromEnum(SYS.fork)), | |
| 187 | : [number] "{g1}" (@backingInt(SYS.fork)), | |
| 188 | 188 | : .{ .memory = true, .xcc = true, .o1 = true, .o2 = true, .o3 = true, .o4 = true, .o5 = true, .o7 = true }); |
| 189 | 189 | } |
| 190 | 190 | |
| ... | ... | @@ -265,7 +265,7 @@ pub const restore = restore_rt; |
| 265 | 265 | pub fn restore_rt() callconv(.c) void { |
| 266 | 266 | return asm volatile ("t 0x10" |
| 267 | 267 | : |
| 268 | : [number] "{g1}" (@intFromEnum(SYS.rt_sigreturn)), | |
| 268 | : [number] "{g1}" (@backingInt(SYS.rt_sigreturn)), | |
| 269 | 269 | : .{ .memory = true, .xcc = true, .o0 = true, .o1 = true, .o2 = true, .o3 = true, .o4 = true, .o5 = true, .o7 = true }); |
| 270 | 270 | } |
| 271 | 271 |
lib/std/os/linux/sparc64.zig+10-10| ... | ... | @@ -14,7 +14,7 @@ pub fn syscall0( |
| 14 | 14 | \\ neg %%o0 |
| 15 | 15 | \\1: |
| 16 | 16 | : [ret] "={o0}" (-> u64), |
| 17 | : [number] "{g1}" (@intFromEnum(number)), | |
| 17 | : [number] "{g1}" (@backingInt(number)), | |
| 18 | 18 | : .{ .memory = true, .xcc = true, .o1 = true, .o2 = true, .o3 = true, .o4 = true, .o5 = true, .o7 = true }); |
| 19 | 19 | } |
| 20 | 20 | |
| ... | ... | @@ -29,7 +29,7 @@ pub fn syscall1( |
| 29 | 29 | \\ neg %%o0 |
| 30 | 30 | \\1: |
| 31 | 31 | : [ret] "={o0}" (-> u64), |
| 32 | : [number] "{g1}" (@intFromEnum(number)), | |
| 32 | : [number] "{g1}" (@backingInt(number)), | |
| 33 | 33 | [arg1] "{o0}" (arg1), |
| 34 | 34 | : .{ .memory = true, .xcc = true, .o1 = true, .o2 = true, .o3 = true, .o4 = true, .o5 = true, .o7 = true }); |
| 35 | 35 | } |
| ... | ... | @@ -46,7 +46,7 @@ pub fn syscall2( |
| 46 | 46 | \\ neg %%o0 |
| 47 | 47 | \\1: |
| 48 | 48 | : [ret] "={o0}" (-> u64), |
| 49 | : [number] "{g1}" (@intFromEnum(number)), | |
| 49 | : [number] "{g1}" (@backingInt(number)), | |
| 50 | 50 | [arg1] "{o0}" (arg1), |
| 51 | 51 | [arg2] "{o1}" (arg2), |
| 52 | 52 | : .{ .memory = true, .xcc = true, .o1 = true, .o2 = true, .o3 = true, .o4 = true, .o5 = true, .o7 = true }); |
| ... | ... | @@ -65,7 +65,7 @@ pub fn syscall3( |
| 65 | 65 | \\ neg %%o0 |
| 66 | 66 | \\1: |
| 67 | 67 | : [ret] "={o0}" (-> u64), |
| 68 | : [number] "{g1}" (@intFromEnum(number)), | |
| 68 | : [number] "{g1}" (@backingInt(number)), | |
| 69 | 69 | [arg1] "{o0}" (arg1), |
| 70 | 70 | [arg2] "{o1}" (arg2), |
| 71 | 71 | [arg3] "{o2}" (arg3), |
| ... | ... | @@ -86,7 +86,7 @@ pub fn syscall4( |
| 86 | 86 | \\ neg %%o0 |
| 87 | 87 | \\1: |
| 88 | 88 | : [ret] "={o0}" (-> u64), |
| 89 | : [number] "{g1}" (@intFromEnum(number)), | |
| 89 | : [number] "{g1}" (@backingInt(number)), | |
| 90 | 90 | [arg1] "{o0}" (arg1), |
| 91 | 91 | [arg2] "{o1}" (arg2), |
| 92 | 92 | [arg3] "{o2}" (arg3), |
| ... | ... | @@ -109,7 +109,7 @@ pub fn syscall5( |
| 109 | 109 | \\ neg %%o0 |
| 110 | 110 | \\1: |
| 111 | 111 | : [ret] "={o0}" (-> u64), |
| 112 | : [number] "{g1}" (@intFromEnum(number)), | |
| 112 | : [number] "{g1}" (@backingInt(number)), | |
| 113 | 113 | [arg1] "{o0}" (arg1), |
| 114 | 114 | [arg2] "{o1}" (arg2), |
| 115 | 115 | [arg3] "{o2}" (arg3), |
| ... | ... | @@ -134,7 +134,7 @@ pub fn syscall6( |
| 134 | 134 | \\ neg %%o0 |
| 135 | 135 | \\1: |
| 136 | 136 | : [ret] "={o0}" (-> u64), |
| 137 | : [number] "{g1}" (@intFromEnum(number)), | |
| 137 | : [number] "{g1}" (@backingInt(number)), | |
| 138 | 138 | [arg1] "{o0}" (arg1), |
| 139 | 139 | [arg2] "{o1}" (arg2), |
| 140 | 140 | [arg3] "{o2}" (arg3), |
| ... | ... | @@ -161,7 +161,7 @@ pub fn syscall_pipe( |
| 161 | 161 | \\ clr %%o0 |
| 162 | 162 | \\2: |
| 163 | 163 | : [ret] "={o0}" (-> u64), |
| 164 | : [number] "{g1}" (@intFromEnum(SYS.pipe)), | |
| 164 | : [number] "{g1}" (@backingInt(SYS.pipe)), | |
| 165 | 165 | [arg] "r" (fd), |
| 166 | 166 | : .{ .memory = true, .g3 = true }); |
| 167 | 167 | } |
| ... | ... | @@ -184,7 +184,7 @@ pub fn syscall_fork() u64 { |
| 184 | 184 | \\ and %%o1, %%o0, %%o0 |
| 185 | 185 | \\2: |
| 186 | 186 | : [ret] "={o0}" (-> u64), |
| 187 | : [number] "{g1}" (@intFromEnum(SYS.fork)), | |
| 187 | : [number] "{g1}" (@backingInt(SYS.fork)), | |
| 188 | 188 | : .{ .memory = true, .xcc = true, .o1 = true, .o2 = true, .o3 = true, .o4 = true, .o5 = true, .o7 = true }); |
| 189 | 189 | } |
| 190 | 190 | |
| ... | ... | @@ -264,7 +264,7 @@ pub const restore = restore_rt; |
| 264 | 264 | pub fn restore_rt() callconv(.c) void { |
| 265 | 265 | return asm volatile ("t 0x6d" |
| 266 | 266 | : |
| 267 | : [number] "{g1}" (@intFromEnum(SYS.rt_sigreturn)), | |
| 267 | : [number] "{g1}" (@backingInt(SYS.rt_sigreturn)), | |
| 268 | 268 | : .{ .memory = true, .xcc = true, .o0 = true, .o1 = true, .o2 = true, .o3 = true, .o4 = true, .o5 = true, .o7 = true }); |
| 269 | 269 | } |
| 270 | 270 |
lib/std/os/linux/test.zig+3-3| ... | ... | @@ -186,8 +186,8 @@ test "sysinfo" { |
| 186 | 186 | } |
| 187 | 187 | |
| 188 | 188 | comptime { |
| 189 | assert(128 == @as(u32, @bitCast(linux.FUTEX_OP{ .cmd = @enumFromInt(0), .private = true, .realtime = false }))); | |
| 190 | assert(256 == @as(u32, @bitCast(linux.FUTEX_OP{ .cmd = @enumFromInt(0), .private = false, .realtime = true }))); | |
| 189 | assert(128 == @as(u32, @bitCast(linux.FUTEX_OP{ .cmd = @fromBackingInt(@intCast(0)), .private = true, .realtime = false }))); | |
| 190 | assert(256 == @as(u32, @bitCast(linux.FUTEX_OP{ .cmd = @fromBackingInt(@intCast(0)), .private = false, .realtime = true }))); | |
| 191 | 191 | |
| 192 | 192 | // Check futex_param4 union is packed correctly |
| 193 | 193 | const param_union = linux.futex_param4{ |
| ... | ... | @@ -277,7 +277,7 @@ test "futex v1" { |
| 277 | 277 | |
| 278 | 278 | comptime { |
| 279 | 279 | assert(2 == @as(u32, @bitCast(linux.FUTEX2_FLAGS{ .size = .U32, .private = false }))); |
| 280 | assert(128 == @as(u32, @bitCast(linux.FUTEX2_FLAGS{ .size = @enumFromInt(0), .private = true }))); | |
| 280 | assert(128 == @as(u32, @bitCast(linux.FUTEX2_FLAGS{ .size = @fromBackingInt(@intCast(0)), .private = true }))); | |
| 281 | 281 | } |
| 282 | 282 | |
| 283 | 283 | test "futex2_waitv" { |
lib/std/os/linux/thumb.zig+7-7| ... | ... | @@ -12,7 +12,7 @@ pub const syscall_arg_t = arm.syscall_arg_t; |
| 12 | 12 | pub fn syscall0( |
| 13 | 13 | number: SYS, |
| 14 | 14 | ) u32 { |
| 15 | var buf: [2]syscall_arg_t = .{ @intFromEnum(number), undefined }; | |
| 15 | var buf: [2]syscall_arg_t = .{ @backingInt(number), undefined }; | |
| 16 | 16 | return asm volatile ( |
| 17 | 17 | \\ str r7, [%[tmp], #4] |
| 18 | 18 | \\ ldr r7, [%[tmp]] |
| ... | ... | @@ -27,7 +27,7 @@ pub fn syscall1( |
| 27 | 27 | number: SYS, |
| 28 | 28 | arg1: syscall_arg_t, |
| 29 | 29 | ) u32 { |
| 30 | var buf: [2]syscall_arg_t = .{ @intFromEnum(number), undefined }; | |
| 30 | var buf: [2]syscall_arg_t = .{ @backingInt(number), undefined }; | |
| 31 | 31 | return asm volatile ( |
| 32 | 32 | \\ str r7, [%[tmp], #4] |
| 33 | 33 | \\ ldr r7, [%[tmp]] |
| ... | ... | @@ -44,7 +44,7 @@ pub fn syscall2( |
| 44 | 44 | arg1: syscall_arg_t, |
| 45 | 45 | arg2: syscall_arg_t, |
| 46 | 46 | ) u32 { |
| 47 | var buf: [2]syscall_arg_t = .{ @intFromEnum(number), undefined }; | |
| 47 | var buf: [2]syscall_arg_t = .{ @backingInt(number), undefined }; | |
| 48 | 48 | return asm volatile ( |
| 49 | 49 | \\ str r7, [%[tmp], #4] |
| 50 | 50 | \\ ldr r7, [%[tmp]] |
| ... | ... | @@ -63,7 +63,7 @@ pub fn syscall3( |
| 63 | 63 | arg2: syscall_arg_t, |
| 64 | 64 | arg3: syscall_arg_t, |
| 65 | 65 | ) u32 { |
| 66 | var buf: [2]syscall_arg_t = .{ @intFromEnum(number), undefined }; | |
| 66 | var buf: [2]syscall_arg_t = .{ @backingInt(number), undefined }; | |
| 67 | 67 | return asm volatile ( |
| 68 | 68 | \\ str r7, [%[tmp], #4] |
| 69 | 69 | \\ ldr r7, [%[tmp]] |
| ... | ... | @@ -84,7 +84,7 @@ pub fn syscall4( |
| 84 | 84 | arg3: syscall_arg_t, |
| 85 | 85 | arg4: syscall_arg_t, |
| 86 | 86 | ) u32 { |
| 87 | var buf: [2]syscall_arg_t = .{ @intFromEnum(number), undefined }; | |
| 87 | var buf: [2]syscall_arg_t = .{ @backingInt(number), undefined }; | |
| 88 | 88 | return asm volatile ( |
| 89 | 89 | \\ str r7, [%[tmp], #4] |
| 90 | 90 | \\ ldr r7, [%[tmp]] |
| ... | ... | @@ -107,7 +107,7 @@ pub fn syscall5( |
| 107 | 107 | arg4: syscall_arg_t, |
| 108 | 108 | arg5: syscall_arg_t, |
| 109 | 109 | ) u32 { |
| 110 | var buf: [2]syscall_arg_t = .{ @intFromEnum(number), undefined }; | |
| 110 | var buf: [2]syscall_arg_t = .{ @backingInt(number), undefined }; | |
| 111 | 111 | return asm volatile ( |
| 112 | 112 | \\ str r7, [%[tmp], #4] |
| 113 | 113 | \\ ldr r7, [%[tmp]] |
| ... | ... | @@ -132,7 +132,7 @@ pub fn syscall6( |
| 132 | 132 | arg5: syscall_arg_t, |
| 133 | 133 | arg6: syscall_arg_t, |
| 134 | 134 | ) u32 { |
| 135 | var buf: [2]syscall_arg_t = .{ @intFromEnum(number), undefined }; | |
| 135 | var buf: [2]syscall_arg_t = .{ @backingInt(number), undefined }; | |
| 136 | 136 | return asm volatile ( |
| 137 | 137 | \\ str r7, [%[tmp], #4] |
| 138 | 138 | \\ ldr r7, [%[tmp]] |
lib/std/os/linux/vdso.zig+1-1| ... | ... | @@ -84,7 +84,7 @@ fn checkver(def_arg: *elf.Verdef, vsym_arg: elf.Versym, vername: []const u8, str |
| 84 | 84 | var def = def_arg; |
| 85 | 85 | const vsym_index = vsym_arg.VERSION; |
| 86 | 86 | while (true) { |
| 87 | if (0 == (def.flags & elf.VER_FLG_BASE) and @intFromEnum(def.ndx) == vsym_index) break; | |
| 87 | if (0 == (def.flags & elf.VER_FLG_BASE) and @backingInt(def.ndx) == vsym_index) break; | |
| 88 | 88 | if (def.next == 0) return false; |
| 89 | 89 | def = @ptrFromInt(@intFromPtr(def) + def.next); |
| 90 | 90 | } |
lib/std/os/linux/x32.zig+10-10| ... | ... | @@ -9,7 +9,7 @@ pub fn syscall0( |
| 9 | 9 | ) u32 { |
| 10 | 10 | return asm volatile ("syscall" |
| 11 | 11 | : [ret] "={rax}" (-> u32), |
| 12 | : [number] "{rax}" (@intFromEnum(number)), | |
| 12 | : [number] "{rax}" (@backingInt(number)), | |
| 13 | 13 | : .{ .rcx = true, .r11 = true, .memory = true }); |
| 14 | 14 | } |
| 15 | 15 | |
| ... | ... | @@ -19,7 +19,7 @@ pub fn syscall1( |
| 19 | 19 | ) u32 { |
| 20 | 20 | return asm volatile ("syscall" |
| 21 | 21 | : [ret] "={rax}" (-> u32), |
| 22 | : [number] "{rax}" (@intFromEnum(number)), | |
| 22 | : [number] "{rax}" (@backingInt(number)), | |
| 23 | 23 | [arg1] "{rdi}" (arg1), |
| 24 | 24 | : .{ .rcx = true, .r11 = true, .memory = true }); |
| 25 | 25 | } |
| ... | ... | @@ -31,7 +31,7 @@ pub fn syscall2( |
| 31 | 31 | ) u32 { |
| 32 | 32 | return asm volatile ("syscall" |
| 33 | 33 | : [ret] "={rax}" (-> u32), |
| 34 | : [number] "{rax}" (@intFromEnum(number)), | |
| 34 | : [number] "{rax}" (@backingInt(number)), | |
| 35 | 35 | [arg1] "{rdi}" (arg1), |
| 36 | 36 | [arg2] "{rsi}" (arg2), |
| 37 | 37 | : .{ .rcx = true, .r11 = true, .memory = true }); |
| ... | ... | @@ -45,7 +45,7 @@ pub fn syscall3( |
| 45 | 45 | ) u32 { |
| 46 | 46 | return asm volatile ("syscall" |
| 47 | 47 | : [ret] "={rax}" (-> u32), |
| 48 | : [number] "{rax}" (@intFromEnum(number)), | |
| 48 | : [number] "{rax}" (@backingInt(number)), | |
| 49 | 49 | [arg1] "{rdi}" (arg1), |
| 50 | 50 | [arg2] "{rsi}" (arg2), |
| 51 | 51 | [arg3] "{rdx}" (arg3), |
| ... | ... | @@ -61,7 +61,7 @@ pub fn syscall4( |
| 61 | 61 | ) u32 { |
| 62 | 62 | return asm volatile ("syscall" |
| 63 | 63 | : [ret] "={rax}" (-> u32), |
| 64 | : [number] "{rax}" (@intFromEnum(number)), | |
| 64 | : [number] "{rax}" (@backingInt(number)), | |
| 65 | 65 | [arg1] "{rdi}" (arg1), |
| 66 | 66 | [arg2] "{rsi}" (arg2), |
| 67 | 67 | [arg3] "{rdx}" (arg3), |
| ... | ... | @@ -79,7 +79,7 @@ pub fn syscall5( |
| 79 | 79 | ) u32 { |
| 80 | 80 | return asm volatile ("syscall" |
| 81 | 81 | : [ret] "={rax}" (-> u32), |
| 82 | : [number] "{rax}" (@intFromEnum(number)), | |
| 82 | : [number] "{rax}" (@backingInt(number)), | |
| 83 | 83 | [arg1] "{rdi}" (arg1), |
| 84 | 84 | [arg2] "{rsi}" (arg2), |
| 85 | 85 | [arg3] "{rdx}" (arg3), |
| ... | ... | @@ -99,7 +99,7 @@ pub fn syscall6( |
| 99 | 99 | ) u32 { |
| 100 | 100 | return asm volatile ("syscall" |
| 101 | 101 | : [ret] "={rax}" (-> u32), |
| 102 | : [number] "{rax}" (@intFromEnum(number)), | |
| 102 | : [number] "{rax}" (@backingInt(number)), | |
| 103 | 103 | [arg1] "{rdi}" (arg1), |
| 104 | 104 | [arg2] "{rsi}" (arg2), |
| 105 | 105 | [arg3] "{rdx}" (arg3), |
| ... | ... | @@ -116,7 +116,7 @@ pub fn syscall_lseek( |
| 116 | 116 | ) u64 { |
| 117 | 117 | return asm volatile ("syscall" |
| 118 | 118 | : [ret] "={rax}" (-> u64), |
| 119 | : [number] "{rax}" (@intFromEnum(SYS.lseek)), | |
| 119 | : [number] "{rax}" (@backingInt(SYS.lseek)), | |
| 120 | 120 | [fd] "{rdi}" (@as(u32, @bitCast(fd))), |
| 121 | 121 | [offset] "{rsi}" (@as(u64, @bitCast(offset))), |
| 122 | 122 | [whence] "{rdx}" (whence), |
| ... | ... | @@ -165,12 +165,12 @@ pub fn restore_rt() callconv(.naked) noreturn { |
| 165 | 165 | \\ movl %[number], %%eax |
| 166 | 166 | \\ syscall |
| 167 | 167 | : |
| 168 | : [number] "i" (@intFromEnum(SYS.rt_sigreturn)), | |
| 168 | : [number] "i" (@backingInt(SYS.rt_sigreturn)), | |
| 169 | 169 | ), |
| 170 | 170 | else => asm volatile ( |
| 171 | 171 | \\ syscall |
| 172 | 172 | : |
| 173 | : [number] "{rax}" (@intFromEnum(SYS.rt_sigreturn)), | |
| 173 | : [number] "{rax}" (@backingInt(SYS.rt_sigreturn)), | |
| 174 | 174 | ), |
| 175 | 175 | } |
| 176 | 176 | } |
lib/std/os/linux/x86.zig+12-12| ... | ... | @@ -9,7 +9,7 @@ pub fn syscall0( |
| 9 | 9 | ) u32 { |
| 10 | 10 | return asm volatile ("int $0x80" |
| 11 | 11 | : [ret] "={eax}" (-> u32), |
| 12 | : [number] "{eax}" (@intFromEnum(number)), | |
| 12 | : [number] "{eax}" (@backingInt(number)), | |
| 13 | 13 | : .{ .memory = true }); |
| 14 | 14 | } |
| 15 | 15 | |
| ... | ... | @@ -19,7 +19,7 @@ pub fn syscall1( |
| 19 | 19 | ) u32 { |
| 20 | 20 | return asm volatile ("int $0x80" |
| 21 | 21 | : [ret] "={eax}" (-> u32), |
| 22 | : [number] "{eax}" (@intFromEnum(number)), | |
| 22 | : [number] "{eax}" (@backingInt(number)), | |
| 23 | 23 | [arg1] "{ebx}" (arg1), |
| 24 | 24 | : .{ .memory = true }); |
| 25 | 25 | } |
| ... | ... | @@ -31,7 +31,7 @@ pub fn syscall2( |
| 31 | 31 | ) u32 { |
| 32 | 32 | return asm volatile ("int $0x80" |
| 33 | 33 | : [ret] "={eax}" (-> u32), |
| 34 | : [number] "{eax}" (@intFromEnum(number)), | |
| 34 | : [number] "{eax}" (@backingInt(number)), | |
| 35 | 35 | [arg1] "{ebx}" (arg1), |
| 36 | 36 | [arg2] "{ecx}" (arg2), |
| 37 | 37 | : .{ .memory = true }); |
| ... | ... | @@ -45,7 +45,7 @@ pub fn syscall3( |
| 45 | 45 | ) u32 { |
| 46 | 46 | return asm volatile ("int $0x80" |
| 47 | 47 | : [ret] "={eax}" (-> u32), |
| 48 | : [number] "{eax}" (@intFromEnum(number)), | |
| 48 | : [number] "{eax}" (@backingInt(number)), | |
| 49 | 49 | [arg1] "{ebx}" (arg1), |
| 50 | 50 | [arg2] "{ecx}" (arg2), |
| 51 | 51 | [arg3] "{edx}" (arg3), |
| ... | ... | @@ -61,7 +61,7 @@ pub fn syscall4( |
| 61 | 61 | ) u32 { |
| 62 | 62 | return asm volatile ("int $0x80" |
| 63 | 63 | : [ret] "={eax}" (-> u32), |
| 64 | : [number] "{eax}" (@intFromEnum(number)), | |
| 64 | : [number] "{eax}" (@backingInt(number)), | |
| 65 | 65 | [arg1] "{ebx}" (arg1), |
| 66 | 66 | [arg2] "{ecx}" (arg2), |
| 67 | 67 | [arg3] "{edx}" (arg3), |
| ... | ... | @@ -79,7 +79,7 @@ pub fn syscall5( |
| 79 | 79 | ) u32 { |
| 80 | 80 | return asm volatile ("int $0x80" |
| 81 | 81 | : [ret] "={eax}" (-> u32), |
| 82 | : [number] "{eax}" (@intFromEnum(number)), | |
| 82 | : [number] "{eax}" (@backingInt(number)), | |
| 83 | 83 | [arg1] "{ebx}" (arg1), |
| 84 | 84 | [arg2] "{ecx}" (arg2), |
| 85 | 85 | [arg3] "{edx}" (arg3), |
| ... | ... | @@ -117,7 +117,7 @@ pub fn syscall6( |
| 117 | 117 | \\ pop %%ebp |
| 118 | 118 | \\ pop %%edi |
| 119 | 119 | : [ret] "={eax}" (-> u32), |
| 120 | : [number] "{eax}" (@intFromEnum(number)), | |
| 120 | : [number] "{eax}" (@backingInt(number)), | |
| 121 | 121 | [arg1] "{ebx}" (arg1), |
| 122 | 122 | [arg2] "{ecx}" (arg2), |
| 123 | 123 | [arg3] "{edx}" (arg3), |
| ... | ... | @@ -129,7 +129,7 @@ pub fn syscall6( |
| 129 | 129 | pub fn socketcall(call: u32, args: [*]const u32) u32 { |
| 130 | 130 | return asm volatile ("int $0x80" |
| 131 | 131 | : [ret] "={eax}" (-> u32), |
| 132 | : [number] "{eax}" (@intFromEnum(SYS.socketcall)), | |
| 132 | : [number] "{eax}" (@backingInt(SYS.socketcall)), | |
| 133 | 133 | [arg1] "{ebx}" (call), |
| 134 | 134 | [arg2] "{ecx}" (@intFromPtr(args)), |
| 135 | 135 | : .{ .memory = true }); |
| ... | ... | @@ -192,13 +192,13 @@ pub fn restore() callconv(.naked) noreturn { |
| 192 | 192 | \\ movl %[number], %%eax |
| 193 | 193 | \\ int $0x80 |
| 194 | 194 | : |
| 195 | : [number] "i" (@intFromEnum(SYS.sigreturn)), | |
| 195 | : [number] "i" (@backingInt(SYS.sigreturn)), | |
| 196 | 196 | ), |
| 197 | 197 | else => asm volatile ( |
| 198 | 198 | \\ addl $4, %%esp |
| 199 | 199 | \\ int $0x80 |
| 200 | 200 | : |
| 201 | : [number] "{eax}" (@intFromEnum(SYS.sigreturn)), | |
| 201 | : [number] "{eax}" (@backingInt(SYS.sigreturn)), | |
| 202 | 202 | ), |
| 203 | 203 | } |
| 204 | 204 | } |
| ... | ... | @@ -209,12 +209,12 @@ pub fn restore_rt() callconv(.naked) noreturn { |
| 209 | 209 | \\ movl %[number], %%eax |
| 210 | 210 | \\ int $0x80 |
| 211 | 211 | : |
| 212 | : [number] "i" (@intFromEnum(SYS.rt_sigreturn)), | |
| 212 | : [number] "i" (@backingInt(SYS.rt_sigreturn)), | |
| 213 | 213 | ), |
| 214 | 214 | else => asm volatile ( |
| 215 | 215 | \\ int $0x80 |
| 216 | 216 | : |
| 217 | : [number] "{eax}" (@intFromEnum(SYS.rt_sigreturn)), | |
| 217 | : [number] "{eax}" (@backingInt(SYS.rt_sigreturn)), | |
| 218 | 218 | ), |
| 219 | 219 | } |
| 220 | 220 | } |
lib/std/os/linux/x86_64.zig+9-9| ... | ... | @@ -9,7 +9,7 @@ pub fn syscall0( |
| 9 | 9 | ) u64 { |
| 10 | 10 | return asm volatile ("syscall" |
| 11 | 11 | : [ret] "={rax}" (-> u64), |
| 12 | : [number] "{rax}" (@intFromEnum(number)), | |
| 12 | : [number] "{rax}" (@backingInt(number)), | |
| 13 | 13 | : .{ .rcx = true, .r11 = true, .memory = true }); |
| 14 | 14 | } |
| 15 | 15 | |
| ... | ... | @@ -19,7 +19,7 @@ pub fn syscall1( |
| 19 | 19 | ) u64 { |
| 20 | 20 | return asm volatile ("syscall" |
| 21 | 21 | : [ret] "={rax}" (-> u64), |
| 22 | : [number] "{rax}" (@intFromEnum(number)), | |
| 22 | : [number] "{rax}" (@backingInt(number)), | |
| 23 | 23 | [arg1] "{rdi}" (arg1), |
| 24 | 24 | : .{ .rcx = true, .r11 = true, .memory = true }); |
| 25 | 25 | } |
| ... | ... | @@ -31,7 +31,7 @@ pub fn syscall2( |
| 31 | 31 | ) u64 { |
| 32 | 32 | return asm volatile ("syscall" |
| 33 | 33 | : [ret] "={rax}" (-> u64), |
| 34 | : [number] "{rax}" (@intFromEnum(number)), | |
| 34 | : [number] "{rax}" (@backingInt(number)), | |
| 35 | 35 | [arg1] "{rdi}" (arg1), |
| 36 | 36 | [arg2] "{rsi}" (arg2), |
| 37 | 37 | : .{ .rcx = true, .r11 = true, .memory = true }); |
| ... | ... | @@ -45,7 +45,7 @@ pub fn syscall3( |
| 45 | 45 | ) u64 { |
| 46 | 46 | return asm volatile ("syscall" |
| 47 | 47 | : [ret] "={rax}" (-> u64), |
| 48 | : [number] "{rax}" (@intFromEnum(number)), | |
| 48 | : [number] "{rax}" (@backingInt(number)), | |
| 49 | 49 | [arg1] "{rdi}" (arg1), |
| 50 | 50 | [arg2] "{rsi}" (arg2), |
| 51 | 51 | [arg3] "{rdx}" (arg3), |
| ... | ... | @@ -61,7 +61,7 @@ pub fn syscall4( |
| 61 | 61 | ) u64 { |
| 62 | 62 | return asm volatile ("syscall" |
| 63 | 63 | : [ret] "={rax}" (-> u64), |
| 64 | : [number] "{rax}" (@intFromEnum(number)), | |
| 64 | : [number] "{rax}" (@backingInt(number)), | |
| 65 | 65 | [arg1] "{rdi}" (arg1), |
| 66 | 66 | [arg2] "{rsi}" (arg2), |
| 67 | 67 | [arg3] "{rdx}" (arg3), |
| ... | ... | @@ -79,7 +79,7 @@ pub fn syscall5( |
| 79 | 79 | ) u64 { |
| 80 | 80 | return asm volatile ("syscall" |
| 81 | 81 | : [ret] "={rax}" (-> u64), |
| 82 | : [number] "{rax}" (@intFromEnum(number)), | |
| 82 | : [number] "{rax}" (@backingInt(number)), | |
| 83 | 83 | [arg1] "{rdi}" (arg1), |
| 84 | 84 | [arg2] "{rsi}" (arg2), |
| 85 | 85 | [arg3] "{rdx}" (arg3), |
| ... | ... | @@ -99,7 +99,7 @@ pub fn syscall6( |
| 99 | 99 | ) u64 { |
| 100 | 100 | return asm volatile ("syscall" |
| 101 | 101 | : [ret] "={rax}" (-> u64), |
| 102 | : [number] "{rax}" (@intFromEnum(number)), | |
| 102 | : [number] "{rax}" (@backingInt(number)), | |
| 103 | 103 | [arg1] "{rdi}" (arg1), |
| 104 | 104 | [arg2] "{rsi}" (arg2), |
| 105 | 105 | [arg3] "{rdx}" (arg3), |
| ... | ... | @@ -151,12 +151,12 @@ pub fn restore_rt() callconv(.naked) noreturn { |
| 151 | 151 | \\ movl %[number], %%eax |
| 152 | 152 | \\ syscall |
| 153 | 153 | : |
| 154 | : [number] "i" (@intFromEnum(SYS.rt_sigreturn)), | |
| 154 | : [number] "i" (@backingInt(SYS.rt_sigreturn)), | |
| 155 | 155 | ), |
| 156 | 156 | else => asm volatile ( |
| 157 | 157 | \\ syscall |
| 158 | 158 | : |
| 159 | : [number] "{rax}" (@intFromEnum(SYS.rt_sigreturn)), | |
| 159 | : [number] "{rax}" (@backingInt(SYS.rt_sigreturn)), | |
| 160 | 160 | ), |
| 161 | 161 | } |
| 162 | 162 | } |
lib/std/os/linux/xtensa.zig+9-9| ... | ... | @@ -9,7 +9,7 @@ pub fn syscall0( |
| 9 | 9 | ) u32 { |
| 10 | 10 | return asm volatile ("syscall" |
| 11 | 11 | : [ret] "={a2}" (-> u32), |
| 12 | : [number] "{a2}" (@intFromEnum(number)), | |
| 12 | : [number] "{a2}" (@backingInt(number)), | |
| 13 | 13 | : .{ .memory = true }); |
| 14 | 14 | } |
| 15 | 15 | |
| ... | ... | @@ -19,7 +19,7 @@ pub fn syscall1( |
| 19 | 19 | ) u32 { |
| 20 | 20 | return asm volatile ("syscall" |
| 21 | 21 | : [ret] "={a2}" (-> u32), |
| 22 | : [number] "{a2}" (@intFromEnum(number)), | |
| 22 | : [number] "{a2}" (@backingInt(number)), | |
| 23 | 23 | [arg1] "{a6}" (arg1), |
| 24 | 24 | : .{ .memory = true }); |
| 25 | 25 | } |
| ... | ... | @@ -31,7 +31,7 @@ pub fn syscall2( |
| 31 | 31 | ) u32 { |
| 32 | 32 | return asm volatile ("syscall" |
| 33 | 33 | : [ret] "={a2}" (-> u32), |
| 34 | : [number] "{a2}" (@intFromEnum(number)), | |
| 34 | : [number] "{a2}" (@backingInt(number)), | |
| 35 | 35 | [arg1] "{a6}" (arg1), |
| 36 | 36 | [arg2] "{a3}" (arg2), |
| 37 | 37 | : .{ .memory = true }); |
| ... | ... | @@ -45,7 +45,7 @@ pub fn syscall3( |
| 45 | 45 | ) u32 { |
| 46 | 46 | return asm volatile ("syscall" |
| 47 | 47 | : [ret] "={a2}" (-> u32), |
| 48 | : [number] "{a2}" (@intFromEnum(number)), | |
| 48 | : [number] "{a2}" (@backingInt(number)), | |
| 49 | 49 | [arg1] "{a6}" (arg1), |
| 50 | 50 | [arg2] "{a3}" (arg2), |
| 51 | 51 | [arg3] "{a4}" (arg3), |
| ... | ... | @@ -61,7 +61,7 @@ pub fn syscall4( |
| 61 | 61 | ) u32 { |
| 62 | 62 | return asm volatile ("syscall" |
| 63 | 63 | : [ret] "={a2}" (-> u32), |
| 64 | : [number] "{a2}" (@intFromEnum(number)), | |
| 64 | : [number] "{a2}" (@backingInt(number)), | |
| 65 | 65 | [arg1] "{a6}" (arg1), |
| 66 | 66 | [arg2] "{a3}" (arg2), |
| 67 | 67 | [arg3] "{a4}" (arg3), |
| ... | ... | @@ -79,7 +79,7 @@ pub fn syscall5( |
| 79 | 79 | ) u32 { |
| 80 | 80 | return asm volatile ("syscall" |
| 81 | 81 | : [ret] "={a2}" (-> u32), |
| 82 | : [number] "{a2}" (@intFromEnum(number)), | |
| 82 | : [number] "{a2}" (@backingInt(number)), | |
| 83 | 83 | [arg1] "{a6}" (arg1), |
| 84 | 84 | [arg2] "{a3}" (arg2), |
| 85 | 85 | [arg3] "{a4}" (arg3), |
| ... | ... | @@ -99,7 +99,7 @@ pub fn syscall6( |
| 99 | 99 | ) u32 { |
| 100 | 100 | return asm volatile ("syscall" |
| 101 | 101 | : [ret] "={a2}" (-> u32), |
| 102 | : [number] "{a2}" (@intFromEnum(number)), | |
| 102 | : [number] "{a2}" (@backingInt(number)), | |
| 103 | 103 | [arg1] "{a6}" (arg1), |
| 104 | 104 | [arg2] "{a3}" (arg2), |
| 105 | 105 | [arg3] "{a4}" (arg3), |
| ... | ... | @@ -178,12 +178,12 @@ pub fn restore_rt() callconv(.naked) noreturn { |
| 178 | 178 | \\ movi a2, %[number] |
| 179 | 179 | \\ syscall |
| 180 | 180 | : |
| 181 | : [number] "I" (@intFromEnum(SYS.rt_sigreturn)), | |
| 181 | : [number] "I" (@backingInt(SYS.rt_sigreturn)), | |
| 182 | 182 | ), |
| 183 | 183 | else => asm volatile ( |
| 184 | 184 | \\ syscall |
| 185 | 185 | : |
| 186 | : [number] "{a2}" (@intFromEnum(SYS.rt_sigreturn)), | |
| 186 | : [number] "{a2}" (@backingInt(SYS.rt_sigreturn)), | |
| 187 | 187 | ), |
| 188 | 188 | } |
| 189 | 189 | } |
lib/std/os/plan9.zig+1-1| ... | ... | @@ -100,7 +100,7 @@ pub const E = enum(u16) { |
| 100 | 100 | pub fn errno(r: usize) E { |
| 101 | 101 | const signed_r: isize = @bitCast(r); |
| 102 | 102 | const int = if (signed_r > -4096 and signed_r < 0) -signed_r else 0; |
| 103 | return @enumFromInt(int); | |
| 103 | return @fromBackingInt(@intCast(int)); | |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | // The max bytes that can be in the errstr buff |
lib/std/os/plan9/x86_64.zig+4-4| ... | ... | @@ -10,7 +10,7 @@ pub fn syscall1(sys: plan9.SYS, arg0: usize) usize { |
| 10 | 10 | \\pop %%r11 |
| 11 | 11 | : [ret] "={rax}" (-> usize), |
| 12 | 12 | : [arg0] "{r8}" (arg0), |
| 13 | [syscall_number] "{rbp}" (@intFromEnum(sys)), | |
| 13 | [syscall_number] "{rbp}" (@backingInt(sys)), | |
| 14 | 14 | : .{ .rcx = true, .rax = true, .rbp = true, .r11 = true, .memory = true }); |
| 15 | 15 | } |
| 16 | 16 | pub fn syscall2(sys: plan9.SYS, arg0: usize, arg1: usize) usize { |
| ... | ... | @@ -25,7 +25,7 @@ pub fn syscall2(sys: plan9.SYS, arg0: usize, arg1: usize) usize { |
| 25 | 25 | : [ret] "={rax}" (-> usize), |
| 26 | 26 | : [arg0] "{r8}" (arg0), |
| 27 | 27 | [arg1] "{r9}" (arg1), |
| 28 | [syscall_number] "{rbp}" (@intFromEnum(sys)), | |
| 28 | [syscall_number] "{rbp}" (@backingInt(sys)), | |
| 29 | 29 | : .{ .rcx = true, .rax = true, .rbp = true, .r11 = true, .memory = true }); |
| 30 | 30 | } |
| 31 | 31 | pub fn syscall3(sys: plan9.SYS, arg0: usize, arg1: usize, arg2: usize) usize { |
| ... | ... | @@ -43,7 +43,7 @@ pub fn syscall3(sys: plan9.SYS, arg0: usize, arg1: usize, arg2: usize) usize { |
| 43 | 43 | : [arg0] "{r8}" (arg0), |
| 44 | 44 | [arg1] "{r9}" (arg1), |
| 45 | 45 | [arg2] "{r10}" (arg2), |
| 46 | [syscall_number] "{rbp}" (@intFromEnum(sys)), | |
| 46 | [syscall_number] "{rbp}" (@backingInt(sys)), | |
| 47 | 47 | : .{ .rcx = true, .rax = true, .rbp = true, .r11 = true, .memory = true }); |
| 48 | 48 | } |
| 49 | 49 | pub fn syscall4(sys: plan9.SYS, arg0: usize, arg1: usize, arg2: usize, arg3: usize) usize { |
| ... | ... | @@ -64,6 +64,6 @@ pub fn syscall4(sys: plan9.SYS, arg0: usize, arg1: usize, arg2: usize, arg3: usi |
| 64 | 64 | [arg1] "{r9}" (arg1), |
| 65 | 65 | [arg2] "{r10}" (arg2), |
| 66 | 66 | [arg3] "{r11}" (arg3), |
| 67 | [syscall_number] "{rbp}" (@intFromEnum(sys)), | |
| 67 | [syscall_number] "{rbp}" (@backingInt(sys)), | |
| 68 | 68 | : .{ .rcx = true, .rax = true, .rbp = true, .r11 = true, .memory = true }); |
| 69 | 69 | } |
lib/std/os/uefi.zig+1-1| ... | ... | @@ -181,7 +181,7 @@ pub const Time = extern struct { |
| 181 | 181 | var days: u9 = 0; |
| 182 | 182 | var month: u4 = 0; |
| 183 | 183 | while (month < max_month) : (month += 1) { |
| 184 | days += std.time.epoch.getDaysInMonth(year, @enumFromInt(month + 1)); | |
| 184 | days += std.time.epoch.getDaysInMonth(year, @fromBackingInt(@intCast(month + 1))); | |
| 185 | 185 | } |
| 186 | 186 | return days; |
| 187 | 187 | } |
lib/std/os/uefi/pool_allocator.zig+3-3| ... | ... | @@ -117,7 +117,7 @@ fn uefi_alloc( |
| 117 | 117 | ) ?[*]u8 { |
| 118 | 118 | _ = ret_addr; |
| 119 | 119 | |
| 120 | std.debug.assert(@intFromEnum(alignment) <= 3); | |
| 120 | std.debug.assert(@backingInt(alignment) <= 3); | |
| 121 | 121 | |
| 122 | 122 | const slice = uefi.system_table.boot_services.?.allocatePool( |
| 123 | 123 | uefi.efi_pool_memory_type, |
| ... | ... | @@ -136,7 +136,7 @@ fn uefi_resize( |
| 136 | 136 | ) bool { |
| 137 | 137 | _ = ret_addr; |
| 138 | 138 | |
| 139 | std.debug.assert(@intFromEnum(alignment) <= 3); | |
| 139 | std.debug.assert(@backingInt(alignment) <= 3); | |
| 140 | 140 | |
| 141 | 141 | if (new_len > buf.len) return false; |
| 142 | 142 | return true; |
| ... | ... | @@ -151,7 +151,7 @@ fn uefi_remap( |
| 151 | 151 | ) ?[*]u8 { |
| 152 | 152 | _ = ret_addr; |
| 153 | 153 | |
| 154 | std.debug.assert(@intFromEnum(alignment) <= 3); | |
| 154 | std.debug.assert(@backingInt(alignment) <= 3); | |
| 155 | 155 | |
| 156 | 156 | if (new_len > buf.len) return null; |
| 157 | 157 | return buf.ptr; |
lib/std/os/uefi/protocol/device_path.zig+2-2| ... | ... | @@ -26,7 +26,7 @@ pub const DevicePath = extern struct { |
| 26 | 26 | |
| 27 | 27 | /// Returns the next DevicePath node in the sequence, if any. |
| 28 | 28 | pub fn next(self: *const DevicePath) ?*const DevicePath { |
| 29 | const subtype: uefi.DevicePath.End.Subtype = @enumFromInt(self.subtype); | |
| 29 | const subtype: uefi.DevicePath.End.Subtype = @fromBackingInt(@intCast(self.subtype)); | |
| 30 | 30 | if (self.type == .end and subtype == .end_entire) return null; |
| 31 | 31 | const bytes: [*]const u8 = @ptrCast(self); |
| 32 | 32 | return @ptrCast(bytes + self.length); |
| ... | ... | @@ -106,7 +106,7 @@ pub const DevicePath = extern struct { |
| 106 | 106 | |
| 107 | 107 | inline for (type_info.field_names, type_info.field_types) |subtype_name, subtype_type| { |
| 108 | 108 | // The tag names match the union names, so just grab that off the enum |
| 109 | const tag_val: u8 = @intFromEnum(@field(TTag, subtype_name)); | |
| 109 | const tag_val: u8 = @backingInt(@field(TTag, subtype_name)); | |
| 110 | 110 | |
| 111 | 111 | if (self.subtype == tag_val) { |
| 112 | 112 | // e.g. expr = .{ .pci = @ptrCast(...) } |
lib/std/os/uefi/tables.zig+14-14| ... | ... | @@ -24,11 +24,11 @@ pub const TimerDelay = enum(u32) { |
| 24 | 24 | pub const MemoryType = enum(u32) { |
| 25 | 25 | pub const Oem = math.IntFittingRange( |
| 26 | 26 | 0, |
| 27 | @intFromEnum(MemoryType.oem_end) - @intFromEnum(MemoryType.oem_start), | |
| 27 | @backingInt(MemoryType.oem_end) - @backingInt(MemoryType.oem_start), | |
| 28 | 28 | ); |
| 29 | 29 | pub const Vendor = math.IntFittingRange( |
| 30 | 30 | 0, |
| 31 | @intFromEnum(MemoryType.vendor_end) - @intFromEnum(MemoryType.vendor_start), | |
| 31 | @backingInt(MemoryType.vendor_end) - @backingInt(MemoryType.vendor_start), | |
| 32 | 32 | ); |
| 33 | 33 | |
| 34 | 34 | /// can only be allocated using .allocate_any_pages mode unless you are explicitly targeting an interface that states otherwise |
| ... | ... | @@ -65,28 +65,28 @@ pub const MemoryType = enum(u32) { |
| 65 | 65 | _, |
| 66 | 66 | |
| 67 | 67 | pub fn fromOem(value: Oem) MemoryType { |
| 68 | const oem_start = @intFromEnum(MemoryType.oem_start); | |
| 69 | return @enumFromInt(oem_start + value); | |
| 68 | const oem_start = @backingInt(MemoryType.oem_start); | |
| 69 | return @fromBackingInt(@intCast(oem_start + value)); | |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | pub fn toOem(memtype: MemoryType) ?Oem { |
| 73 | const as_int = @intFromEnum(memtype); | |
| 74 | const oem_start = @intFromEnum(MemoryType.oem_start); | |
| 73 | const as_int = @backingInt(memtype); | |
| 74 | const oem_start = @backingInt(MemoryType.oem_start); | |
| 75 | 75 | if (as_int < oem_start) return null; |
| 76 | if (as_int > @intFromEnum(MemoryType.oem_end)) return null; | |
| 76 | if (as_int > @backingInt(MemoryType.oem_end)) return null; | |
| 77 | 77 | return @truncate(as_int - oem_start); |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | pub fn fromVendor(value: Vendor) MemoryType { |
| 81 | const vendor_start = @intFromEnum(MemoryType.vendor_start); | |
| 82 | return @enumFromInt(vendor_start + value); | |
| 81 | const vendor_start = @backingInt(MemoryType.vendor_start); | |
| 82 | return @fromBackingInt(@intCast(vendor_start + value)); | |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | pub fn toVendor(memtype: MemoryType) ?Vendor { |
| 86 | const as_int = @intFromEnum(memtype); | |
| 87 | const vendor_start = @intFromEnum(MemoryType.vendor_start); | |
| 88 | if (as_int < @intFromEnum(MemoryType.vendor_end)) return null; | |
| 89 | if (as_int > @intFromEnum(MemoryType.vendor_end)) return null; | |
| 86 | const as_int = @backingInt(memtype); | |
| 87 | const vendor_start = @backingInt(MemoryType.vendor_start); | |
| 88 | if (as_int < @backingInt(MemoryType.vendor_end)) return null; | |
| 89 | if (as_int > @backingInt(MemoryType.vendor_end)) return null; | |
| 90 | 90 | return @truncate(as_int - vendor_start); |
| 91 | 91 | } |
| 92 | 92 | |
| ... | ... | @@ -98,7 +98,7 @@ pub const MemoryType = enum(u32) { |
| 98 | 98 | else if (std.enums.tagName(MemoryType, self)) |name| |
| 99 | 99 | try w.print("{s}", .{name}) |
| 100 | 100 | else |
| 101 | try w.print("INVALID({X})", .{@intFromEnum(self)}); | |
| 101 | try w.print("INVALID({X})", .{@backingInt(self)}); | |
| 102 | 102 | } |
| 103 | 103 | }; |
| 104 | 104 |
lib/std/os/windows.zig+12-12| ... | ... | @@ -77,7 +77,7 @@ pub const PS = struct { |
| 77 | 77 | _, |
| 78 | 78 | |
| 79 | 79 | pub fn construct(num: NUM, thread: bool, input: bool, additive: bool) ULONG_PTR { |
| 80 | var val: ULONG_PTR = @intFromEnum(num); | |
| 80 | var val: ULONG_PTR = @backingInt(num); | |
| 81 | 81 | if (thread) val |= 0x10000; |
| 82 | 82 | if (input) val |= 0x20000; |
| 83 | 83 | if (additive) val |= 0x40000; |
| ... | ... | @@ -739,7 +739,7 @@ pub const FILE = struct { |
| 739 | 739 | SYNCHRONOUS_NONALERT = 0b10, |
| 740 | 740 | _, |
| 741 | 741 | |
| 742 | pub const VALID_FLAGS: @This() = @enumFromInt(0b11); | |
| 742 | pub const VALID_FLAGS: @This() = @fromBackingInt(@intCast(0b11)); | |
| 743 | 743 | }, |
| 744 | 744 | /// The file being opened must not be a directory file or this call |
| 745 | 745 | /// fails. The file object being opened can represent a data file, a |
| ... | ... | @@ -1975,7 +1975,7 @@ pub const HEAP = opaque { |
| 1975 | 1975 | CSR_PORT, |
| 1976 | 1976 | _, |
| 1977 | 1977 | |
| 1978 | pub const MASK: CLASS = @enumFromInt(maxInt(@typeInfo(CLASS).@"enum".tag_type)); | |
| 1978 | pub const MASK: CLASS = @fromBackingInt(@intCast(maxInt(@typeInfo(CLASS).@"enum".tag_type))); | |
| 1979 | 1979 | }; |
| 1980 | 1980 | |
| 1981 | 1981 | pub const CREATE = packed struct(ULONG) { |
| ... | ... | @@ -1990,7 +1990,7 @@ pub const HEAP = opaque { |
| 1990 | 1990 | /// Callers are therefore responsible for synchronizing access to hardened heaps. |
| 1991 | 1991 | HARDENED: bool = false, |
| 1992 | 1992 | Reserved10: u2 = 0, |
| 1993 | CLASS: CLASS = @enumFromInt(0), | |
| 1993 | CLASS: CLASS = @fromBackingInt(@intCast(0)), | |
| 1994 | 1994 | /// Create heap with 16 byte alignment (obsolete) |
| 1995 | 1995 | ALIGN_16: bool = false, |
| 1996 | 1996 | /// Create heap call tracing enabled (obsolete) |
| ... | ... | @@ -2035,7 +2035,7 @@ pub const HEAP = opaque { |
| 2035 | 2035 | FLAG3: bool = false, |
| 2036 | 2036 | } = .{}, |
| 2037 | 2037 | } = .{}, |
| 2038 | CLASS: CLASS = @enumFromInt(0), | |
| 2038 | CLASS: CLASS = @fromBackingInt(@intCast(0)), | |
| 2039 | 2039 | Reserved16: u2 = 0, |
| 2040 | 2040 | TAG: u12 = 0, |
| 2041 | 2041 | Reserved30: u2 = 0, |
| ... | ... | @@ -3945,7 +3945,7 @@ pub fn unexpectedError(err: Win32Error) UnexpectedError { |
| 3945 | 3945 | pub fn unexpectedStatus(status: NTSTATUS) UnexpectedError { |
| 3946 | 3946 | if (std.options.unexpected_error_tracing) { |
| 3947 | 3947 | std.debug.print("error.Unexpected NTSTATUS=0x{x} ({s})\n", .{ |
| 3948 | @intFromEnum(status), | |
| 3948 | @backingInt(status), | |
| 3949 | 3949 | std.enums.tagName(NTSTATUS, status) orelse "<unnamed>", |
| 3950 | 3950 | }); |
| 3951 | 3951 | std.debug.dumpCurrentStackTrace(.{ .first_address = @returnAddress() }); |
| ... | ... | @@ -3956,7 +3956,7 @@ pub fn unexpectedStatus(status: NTSTATUS) UnexpectedError { |
| 3956 | 3956 | pub fn statusBug(status: NTSTATUS) UnexpectedError { |
| 3957 | 3957 | switch (builtin.mode) { |
| 3958 | 3958 | .Debug => std.debug.panic("programmer bug caused syscall status: 0x{x} ({s})", .{ |
| 3959 | @intFromEnum(status), | |
| 3959 | @backingInt(status), | |
| 3960 | 3960 | std.enums.tagName(NTSTATUS, status) orelse "<unnamed>", |
| 3961 | 3961 | }), |
| 3962 | 3962 | else => return error.Unexpected, |
| ... | ... | @@ -3966,7 +3966,7 @@ pub fn statusBug(status: NTSTATUS) UnexpectedError { |
| 3966 | 3966 | pub fn errorBug(err: Win32Error) UnexpectedError { |
| 3967 | 3967 | switch (builtin.mode) { |
| 3968 | 3968 | .Debug => std.debug.panic("programmer bug caused syscall error: 0x{x} ({s})", .{ |
| 3969 | @intFromEnum(err), | |
| 3969 | @backingInt(err), | |
| 3970 | 3970 | std.enums.tagName(Win32Error, err) orelse "<unnamed>", |
| 3971 | 3971 | }), |
| 3972 | 3972 | else => return error.Unexpected, |
| ... | ... | @@ -4091,7 +4091,7 @@ fn Bool(comptime BackingInteger: type) type { |
| 4091 | 4091 | _, |
| 4092 | 4092 | |
| 4093 | 4093 | /// This is not the only truthy value, comparisons against this value are always a bug. |
| 4094 | pub const TRUE: @This() = @enumFromInt(1); | |
| 4094 | pub const TRUE: @This() = @fromBackingInt(@intCast(1)); | |
| 4095 | 4095 | |
| 4096 | 4096 | pub const Backing = BackingInteger; |
| 4097 | 4097 | |
| ... | ... | @@ -4100,7 +4100,7 @@ fn Bool(comptime BackingInteger: type) type { |
| 4100 | 4100 | } |
| 4101 | 4101 | |
| 4102 | 4102 | pub fn fromBool(b: bool) @This() { |
| 4103 | return @enumFromInt(@intFromBool(b)); | |
| 4103 | return @fromBackingInt(@intCast(@intFromBool(b))); | |
| 4104 | 4104 | } |
| 4105 | 4105 | }; |
| 4106 | 4106 | } |
| ... | ... | @@ -5947,8 +5947,8 @@ pub const KUSER_SHARED_DATA = extern struct { |
| 5947 | 5947 | pub const SharedUserData: *const KUSER_SHARED_DATA = @ptrFromInt(0x7FFE0000); |
| 5948 | 5948 | |
| 5949 | 5949 | pub fn IsProcessorFeaturePresent(feature: PF) bool { |
| 5950 | if (@intFromEnum(feature) >= PROCESSOR_FEATURE_MAX) return false; | |
| 5951 | return SharedUserData.ProcessorFeatures[@intFromEnum(feature)].toBool(); | |
| 5950 | if (@backingInt(feature) >= PROCESSOR_FEATURE_MAX) return false; | |
| 5951 | return SharedUserData.ProcessorFeatures[@backingInt(feature)].toBool(); | |
| 5952 | 5952 | } |
| 5953 | 5953 | |
| 5954 | 5954 | // https://github.com/reactos/reactos/blob/master/sdk/include/ndk/pstypes.h#L977-L983 |
lib/std/os/windows/crypt32.zig+3-3| ... | ... | @@ -73,7 +73,7 @@ pub const CERT_STORE = struct { |
| 73 | 73 | _, |
| 74 | 74 | |
| 75 | 75 | pub fn fromString(str: LPCSTR) PROV { |
| 76 | return @enumFromInt(@intFromPtr(str)); | |
| 76 | return @fromBackingInt(@intCast(@intFromPtr(str))); | |
| 77 | 77 | } |
| 78 | 78 | }; |
| 79 | 79 | |
| ... | ... | @@ -159,7 +159,7 @@ pub const HCERTCHAINENGINE = enum(usize) { |
| 159 | 159 | _, |
| 160 | 160 | |
| 161 | 161 | pub fn fromHandle(handle: HANDLE) HCERTCHAINENGINE { |
| 162 | return @enumFromInt(@intFromPtr(handle)); | |
| 162 | return @fromBackingInt(@intCast(@intFromPtr(handle))); | |
| 163 | 163 | } |
| 164 | 164 | }; |
| 165 | 165 | |
| ... | ... | @@ -210,7 +210,7 @@ pub const CERT_CHAIN = packed struct(DWORD) { |
| 210 | 210 | _, |
| 211 | 211 | |
| 212 | 212 | pub fn fromString(str: LPCSTR) POLICY { |
| 213 | return @enumFromInt(@intFromPtr(str)); | |
| 213 | return @fromBackingInt(@intCast(@intFromPtr(str))); | |
| 214 | 214 | } |
| 215 | 215 | |
| 216 | 216 | pub const PARA = extern struct { |
lib/std/posix.zig+6-6| ... | ... | @@ -651,7 +651,7 @@ pub fn mmap( |
| 651 | 651 | const rc = mmap_sym(ptr, length, prot, @bitCast(flags), fd, @bitCast(offset)); |
| 652 | 652 | const err: E = if (builtin.link_libc) blk: { |
| 653 | 653 | if (rc != std.c.MAP_FAILED) return @as([*]align(page_size_min) u8, @ptrCast(@alignCast(rc)))[0..length]; |
| 654 | break :blk @enumFromInt(system._errno().*); | |
| 654 | break :blk @fromBackingInt(@intCast(system._errno().*)); | |
| 655 | 655 | } else blk: { |
| 656 | 656 | const err = errno(rc); |
| 657 | 657 | if (err == .SUCCESS) return @as([*]align(page_size_min) u8, @ptrFromInt(rc))[0..length]; |
| ... | ... | @@ -687,7 +687,7 @@ pub fn munmap(memory: []align(page_size_min) const u8) void { |
| 687 | 687 | .INVAL => unreachable, // Invalid parameters. |
| 688 | 688 | .NOMEM => unreachable, // Attempted to unmap a region in the middle of an existing mapping. |
| 689 | 689 | else => |e| if (std.options.unexpected_error_tracing) { |
| 690 | std.debug.panic("unexpected errno: {d} ({t})", .{ @intFromEnum(e), e }); | |
| 690 | std.debug.panic("unexpected errno: {d} ({t})", .{ @backingInt(e), e }); | |
| 691 | 691 | } else unreachable, |
| 692 | 692 | } |
| 693 | 693 | } |
| ... | ... | @@ -710,7 +710,7 @@ pub fn mremap( |
| 710 | 710 | const rc = system.mremap(old_address, old_len, new_len, flags, new_address); |
| 711 | 711 | const err: E = if (builtin.link_libc) blk: { |
| 712 | 712 | if (rc != std.c.MAP_FAILED) return @as([*]align(page_size_min) u8, @ptrCast(@alignCast(rc)))[0..new_len]; |
| 713 | break :blk @enumFromInt(system._errno().*); | |
| 713 | break :blk @fromBackingInt(@intCast(system._errno().*)); | |
| 714 | 714 | } else blk: { |
| 715 | 715 | const err = errno(rc); |
| 716 | 716 | if (err == .SUCCESS) return @as([*]align(page_size_min) u8, @ptrFromInt(rc))[0..new_len]; |
| ... | ... | @@ -1299,7 +1299,7 @@ pub fn prctl(option: PR, args: anytype) PrctlError!u31 { |
| 1299 | 1299 | inline while (i < args.len) : (i += 1) buf[i] = args[i]; |
| 1300 | 1300 | } |
| 1301 | 1301 | |
| 1302 | const rc = system.prctl(@intFromEnum(option), buf[0], buf[1], buf[2], buf[3]); | |
| 1302 | const rc = system.prctl(@backingInt(option), buf[0], buf[1], buf[2], buf[3]); | |
| 1303 | 1303 | switch (errno(rc)) { |
| 1304 | 1304 | .SUCCESS => return @intCast(rc), |
| 1305 | 1305 | .ACCES => return error.AccessDenied, |
| ... | ... | @@ -1545,7 +1545,7 @@ pub fn ptrace(request: u32, pid: pid_t, addr: usize, data: usize) PtraceError!vo |
| 1545 | 1545 | }, |
| 1546 | 1546 | |
| 1547 | 1547 | .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => switch (errno(std.c.ptrace( |
| 1548 | @enumFromInt(request), | |
| 1548 | @fromBackingInt(@intCast(request)), | |
| 1549 | 1549 | pid, |
| 1550 | 1550 | @ptrFromInt(addr), |
| 1551 | 1551 | @intCast(data), |
| ... | ... | @@ -1668,7 +1668,7 @@ pub const UnexpectedError = std.Io.UnexpectedError; |
| 1668 | 1668 | /// and you get an unexpected error. |
| 1669 | 1669 | pub fn unexpectedErrno(err: E) UnexpectedError { |
| 1670 | 1670 | if (std.options.unexpected_error_tracing) { |
| 1671 | std.debug.print("unexpected errno: {d}\n", .{@intFromEnum(err)}); | |
| 1671 | std.debug.print("unexpected errno: {d}\n", .{@backingInt(err)}); | |
| 1672 | 1672 | std.debug.dumpCurrentStackTrace(.{}); |
| 1673 | 1673 | } |
| 1674 | 1674 | return error.Unexpected; |
lib/std/posix/test.zig+1-1| ... | ... | @@ -333,7 +333,7 @@ test "getrlimit and setrlimit" { |
| 333 | 333 | if (posix.system.rlimit_resource == void) return error.SkipZigTest; |
| 334 | 334 | |
| 335 | 335 | inline for (@typeInfo(posix.rlimit_resource).@"enum".field_values) |field_value| { |
| 336 | const resource: posix.rlimit_resource = @enumFromInt(field_value); | |
| 336 | const resource: posix.rlimit_resource = @fromBackingInt(@intCast(field_value)); | |
| 337 | 337 | const limit = try posix.getrlimit(resource); |
| 338 | 338 | |
| 339 | 339 | // XNU kernel does not support RLIMIT_STACK if a custom stack is active, |
lib/std/process.zig+2-2| ... | ... | @@ -875,10 +875,10 @@ pub fn exit(status: u8) noreturn { |
| 875 | 875 | // exit() is only available if exitBootServices() has not been called yet. |
| 876 | 876 | // This call to exit should not fail, so we catch-ignore errors. |
| 877 | 877 | if (uefi.system_table.boot_services) |bs| { |
| 878 | bs.exit(uefi.handle, @enumFromInt(status), null) catch {}; | |
| 878 | bs.exit(uefi.handle, @fromBackingInt(@intCast(status)), null) catch {}; | |
| 879 | 879 | } |
| 880 | 880 | // If we can't exit, reboot the system instead. |
| 881 | uefi.system_table.runtime_services.resetSystem(.cold, @enumFromInt(status), null); | |
| 881 | uefi.system_table.runtime_services.resetSystem(.cold, @fromBackingInt(@intCast(status)), null); | |
| 882 | 882 | }, |
| 883 | 883 | else => posix.system.exit(status), |
| 884 | 884 | } |
lib/std/simd.zig+1-1| ... | ... | @@ -90,7 +90,7 @@ pub fn suggestVectorLength(comptime T: type) ?comptime_int { |
| 90 | 90 | |
| 91 | 91 | test "suggestVectorLengthForCpu works with signed and unsigned values" { |
| 92 | 92 | comptime var cpu = std.Target.Cpu.baseline(std.Target.Cpu.Arch.x86_64, builtin.os); |
| 93 | comptime cpu.features.addFeature(@intFromEnum(std.Target.x86.Feature.avx512f)); | |
| 93 | comptime cpu.features.addFeature(@backingInt(std.Target.x86.Feature.avx512f)); | |
| 94 | 94 | comptime cpu.features.populateDependencies(&std.Target.x86.all_features); |
| 95 | 95 | const expected_len: usize = switch (builtin.zig_backend) { |
| 96 | 96 | .stage2_x86_64 => 8, |
lib/std/spirv.zig+3-3| ... | ... | @@ -60,8 +60,8 @@ pub fn controlBarrier( |
| 60 | 60 | asm volatile ( |
| 61 | 61 | \\OpControlBarrier %exec %mem %sem |
| 62 | 62 | : |
| 63 | : [exec] "" (@as(u32, @intFromEnum(execution))), | |
| 64 | [mem] "" (@as(u32, @intFromEnum(memory))), | |
| 63 | : [exec] "" (@as(u32, @backingInt(execution))), | |
| 64 | [mem] "" (@as(u32, @backingInt(memory))), | |
| 65 | 65 | [sem] "" (@as(u32, @bitCast(semantics))), |
| 66 | 66 | ); |
| 67 | 67 | } |
| ... | ... | @@ -70,7 +70,7 @@ pub fn memoryBarrier(comptime memory: Scope, comptime semantics: MemorySemantics |
| 70 | 70 | asm volatile ( |
| 71 | 71 | \\OpMemoryBarrier %mem %sem |
| 72 | 72 | : |
| 73 | : [mem] "" (@as(u32, @intFromEnum(memory))), | |
| 73 | : [mem] "" (@as(u32, @backingInt(memory))), | |
| 74 | 74 | [sem] "" (@as(u32, @bitCast(semantics))), |
| 75 | 75 | ); |
| 76 | 76 | } |
lib/std/start.zig+2-2| ... | ... | @@ -141,14 +141,14 @@ fn EfiMain(handle: uefi.Handle, system_table: *uefi.tables.SystemTable) callconv |
| 141 | 141 | return 0; |
| 142 | 142 | }, |
| 143 | 143 | uefi.Status => { |
| 144 | return @intFromEnum(root.main()); | |
| 144 | return @backingInt(root.main()); | |
| 145 | 145 | }, |
| 146 | 146 | uefi.Error!void => { |
| 147 | 147 | root.main() catch |err| switch (err) { |
| 148 | 148 | error.Unexpected => @panic("EfiMain: unexpected error"), |
| 149 | 149 | else => { |
| 150 | 150 | const status = uefi.Status.fromError(@errorCast(err)); |
| 151 | return @intFromEnum(status); | |
| 151 | return @backingInt(status); | |
| 152 | 152 | }, |
| 153 | 153 | }; |
| 154 | 154 |
lib/std/static_string_map.zig+1-1| ... | ... | @@ -117,7 +117,7 @@ pub fn StaticStringMapWithEql( |
| 117 | 117 | |
| 118 | 118 | var sorted_keys: [field_names.len][]const u8 = field_names[0..field_names.len].*; |
| 119 | 119 | var sorted_vals: [field_names.len]V = undefined; |
| 120 | for (&sorted_vals, @typeInfo(V).@"enum".field_values) |*x, i| x.* = @enumFromInt(i); | |
| 120 | for (&sorted_vals, @typeInfo(V).@"enum".field_values) |*x, i| x.* = @fromBackingInt(@intCast(i)); | |
| 121 | 121 | |
| 122 | 122 | for (field_names) |field_name| { |
| 123 | 123 | self.min_len = @min(self.min_len, field_name.len); |
lib/std/tar.zig+1-1| ... | ... | @@ -241,7 +241,7 @@ const Header = struct { |
| 241 | 241 | } |
| 242 | 242 | |
| 243 | 243 | pub fn kind(header: Header) Kind { |
| 244 | const result: Kind = @enumFromInt(header.bytes[156]); | |
| 244 | const result: Kind = @fromBackingInt(@intCast(header.bytes[156])); | |
| 245 | 245 | if (result == .normal_alias) return .normal; |
| 246 | 246 | return result; |
| 247 | 247 | } |
lib/std/testing/Smith.zig+9-9| ... | ... | @@ -169,7 +169,7 @@ test baselineWeights { |
| 169 | 169 | fn valueFromInt(T: anytype, int: Backing(T)) T { |
| 170 | 170 | @disableInstrumentation(); |
| 171 | 171 | return switch (@typeInfo(T)) { |
| 172 | .@"enum" => @enumFromInt(int), | |
| 172 | .@"enum" => @fromBackingInt(@intCast(int)), | |
| 173 | 173 | else => @bitCast(int), |
| 174 | 174 | }; |
| 175 | 175 | } |
| ... | ... | @@ -369,7 +369,7 @@ fn UnionTagWithoutUninitializable(T: type) type { |
| 369 | 369 | else => {}, |
| 370 | 370 | } |
| 371 | 371 | field_names[n_fields] = f_name; |
| 372 | field_values[n_fields] = @intFromEnum(@field(Tag, f_name)); | |
| 372 | field_values[n_fields] = @backingInt(@field(Tag, f_name)); | |
| 373 | 373 | n_fields += 1; |
| 374 | 374 | } |
| 375 | 375 | return @Enum(e.tag_type, .exhaustive, field_names[0..n_fields], field_values[0..n_fields]); |
| ... | ... | @@ -400,8 +400,8 @@ pub fn valueWithHash(s: *Smith, T: type, hash: u32) T { |
| 400 | 400 | break :v s.valueWeightedWithHash(T, baselineWeights(T), hash); |
| 401 | 401 | } |
| 402 | 402 | break :v std.enums.fromInt(T, s.valueWithHash(e.tag_type, hash)) orelse |
| 403 | @enumFromInt(e.field_values[0]); | |
| 404 | } else @enumFromInt(s.valueWithHash(e.tag_type, hash)), | |
| 403 | @fromBackingInt(@intCast(e.field_values[0])); | |
| 404 | } else @fromBackingInt(@intCast(s.valueWithHash(e.tag_type, hash))), | |
| 405 | 405 | .optional => |o| if (s.valueWithHash(bool, hash)) |
| 406 | 406 | null |
| 407 | 407 | else |
| ... | ... | @@ -718,7 +718,7 @@ test value { |
| 718 | 718 | io: u128 = (1 << 80) | (1 << 23), |
| 719 | 719 | fd: f64 = std.math.pi, |
| 720 | 720 | ft: f80 = std.math.e, |
| 721 | eh: enum(u16) { a, _ } = @enumFromInt(999), | |
| 721 | eh: enum(u16) { a, _ } = @fromBackingInt(@intCast(999)), | |
| 722 | 722 | eo: enum(u128) { a, b, _ } = .b, |
| 723 | 723 | aw: [3]u32 = .{ 1 << 30, 1 << 20, 1 << 10 }, |
| 724 | 724 | vw: @Vector(3, u32) = .{ 1 << 10, 1 << 20, 1 << 30 }, |
| ... | ... | @@ -747,7 +747,7 @@ test value { |
| 747 | 747 | }; |
| 748 | 748 | const s: S = .{}; |
| 749 | 749 | const ft_bits: u80 = @bitCast(s.ft); |
| 750 | const eo_bits = @intFromEnum(s.eo); | |
| 750 | const eo_bits = @backingInt(s.eo); | |
| 751 | 751 | |
| 752 | 752 | var smith: Smith = .{ |
| 753 | 753 | .in = constructInput(&.{ |
| ... | ... | @@ -758,7 +758,7 @@ test value { |
| 758 | 758 | .{ .int = @truncate(s.io) }, .{ .int = @intCast(s.io >> 64) }, // io |
| 759 | 759 | .{ .int = @bitCast(s.fd) }, // fd |
| 760 | 760 | .{ .int = @truncate(ft_bits) }, .{ .int = @intCast(ft_bits >> 64) }, // ft |
| 761 | .{ .int = @intFromEnum(s.eh) }, // eh | |
| 761 | .{ .int = @backingInt(s.eh) }, // eh | |
| 762 | 762 | .{ .int = @truncate(eo_bits) }, .{ .int = @intCast(eo_bits >> 64) }, // eo |
| 763 | 763 | .{ .int = s.aw[0] }, .{ .int = s.aw[1] }, .{ .int = s.aw[2] }, // aw |
| 764 | 764 | .{ .int = s.vw[0] }, .{ .int = s.vw[1] }, .{ .int = s.vw[2] }, // vw |
| ... | ... | @@ -767,8 +767,8 @@ test value { |
| 767 | 767 | .{ .int = s.s.q }, // s.q |
| 768 | 768 | //sz |
| 769 | 769 | .{ .int = @as(u8, @bitCast(s.sp)) }, // sp |
| 770 | .{ .int = s.si.a }, .{ .int = @intFromEnum(s.si.b) }, // si | |
| 771 | .{ .int = @intFromEnum(s.u) }, .{ .int = s.u.b }, // u | |
| 770 | .{ .int = s.si.a }, .{ .int = @backingInt(s.si.b) }, // si | |
| 771 | .{ .int = @backingInt(s.u) }, .{ .int = s.u.b }, // u | |
| 772 | 772 | .{ .int = @as(u16, @bitCast(s.up)) }, // up |
| 773 | 773 | // invalid values |
| 774 | 774 | .{ .int = 555 }, // invalid.ib |
lib/std/time/epoch.zig+2-2| ... | ... | @@ -81,7 +81,7 @@ pub const Month = enum(u4) { |
| 81 | 81 | /// return the numeric calendar value for the given month |
| 82 | 82 | /// i.e. jan=1, feb=2, etc |
| 83 | 83 | pub fn numeric(self: Month) u4 { |
| 84 | return @intFromEnum(self); | |
| 84 | return @backingInt(self); | |
| 85 | 85 | } |
| 86 | 86 | }; |
| 87 | 87 | |
| ... | ... | @@ -119,7 +119,7 @@ pub const YearAndDay = struct { |
| 119 | 119 | if (days_left < days_in_month) |
| 120 | 120 | break; |
| 121 | 121 | days_left -= days_in_month; |
| 122 | month = @as(Month, @enumFromInt(@intFromEnum(month) + 1)); | |
| 122 | month = @as(Month, @fromBackingInt(@intCast(@backingInt(month) + 1))); | |
| 123 | 123 | } |
| 124 | 124 | return .{ .month = month, .day_index = @as(u5, @intCast(days_left)) }; |
| 125 | 125 | } |
lib/std/valgrind.zig+1-1| ... | ... | @@ -144,7 +144,7 @@ pub fn IsTool(base: [2]u8, code: usize) bool { |
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | fn doClientRequestExpr(default: usize, request: ClientRequest, a1: usize, a2: usize, a3: usize, a4: usize, a5: usize) usize { |
| 147 | return doClientRequest(default, @as(usize, @intCast(@intFromEnum(request))), a1, a2, a3, a4, a5); | |
| 147 | return doClientRequest(default, @as(usize, @intCast(@backingInt(request))), a1, a2, a3, a4, a5); | |
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | fn doClientRequestStmt(request: ClientRequest, a1: usize, a2: usize, a3: usize, a4: usize, a5: usize) void { |
lib/std/valgrind/cachegrind.zig+1-1| ... | ... | @@ -7,7 +7,7 @@ pub const ClientRequest = enum(usize) { |
| 7 | 7 | }; |
| 8 | 8 | |
| 9 | 9 | fn doClientRequestExpr(default: usize, request: ClientRequest, a1: usize, a2: usize, a3: usize, a4: usize, a5: usize) usize { |
| 10 | return valgrind.doClientRequest(default, @as(usize, @intCast(@intFromEnum(request))), a1, a2, a3, a4, a5); | |
| 10 | return valgrind.doClientRequest(default, @as(usize, @intCast(@backingInt(request))), a1, a2, a3, a4, a5); | |
| 11 | 11 | } |
| 12 | 12 | |
| 13 | 13 | fn doClientRequestStmt(request: ClientRequest, a1: usize, a2: usize, a3: usize, a4: usize, a5: usize) void { |
lib/std/valgrind/callgrind.zig+1-1| ... | ... | @@ -11,7 +11,7 @@ pub const ClientRequest = enum(usize) { |
| 11 | 11 | }; |
| 12 | 12 | |
| 13 | 13 | fn doClientRequestExpr(default: usize, request: ClientRequest, a1: usize, a2: usize, a3: usize, a4: usize, a5: usize) usize { |
| 14 | return valgrind.doClientRequest(default, @as(usize, @intCast(@intFromEnum(request))), a1, a2, a3, a4, a5); | |
| 14 | return valgrind.doClientRequest(default, @as(usize, @intCast(@backingInt(request))), a1, a2, a3, a4, a5); | |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | fn doClientRequestStmt(request: ClientRequest, a1: usize, a2: usize, a3: usize, a4: usize, a5: usize) void { |
lib/std/valgrind/memcheck.zig+1-1| ... | ... | @@ -21,7 +21,7 @@ pub const ClientRequest = enum(usize) { |
| 21 | 21 | }; |
| 22 | 22 | |
| 23 | 23 | fn doClientRequestExpr(default: usize, request: ClientRequest, a1: usize, a2: usize, a3: usize, a4: usize, a5: usize) usize { |
| 24 | return valgrind.doClientRequest(default, @as(usize, @intCast(@intFromEnum(request))), a1, a2, a3, a4, a5); | |
| 24 | return valgrind.doClientRequest(default, @as(usize, @intCast(@backingInt(request))), a1, a2, a3, a4, a5); | |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | fn doClientRequestStmt(request: ClientRequest, a1: usize, a2: usize, a3: usize, a4: usize, a5: usize) void { |
lib/std/wasm.zig+1-1| ... | ... | @@ -664,7 +664,7 @@ pub const BlockType = enum(u8) { |
| 664 | 664 | v128 = 0x7B, |
| 665 | 665 | |
| 666 | 666 | pub fn fromValtype(valtype: Valtype) BlockType { |
| 667 | return @enumFromInt(@intFromEnum(valtype)); | |
| 667 | return @fromBackingInt(@intCast(@backingInt(valtype))); | |
| 668 | 668 | } |
| 669 | 669 | }; |
| 670 | 670 |
lib/std/zig.zig+2-2| ... | ... | @@ -1764,12 +1764,12 @@ pub fn buildExeSubprocess( |
| 1764 | 1764 | received_fs_inputs = true; |
| 1765 | 1765 | var it = mem.splitScalar(u8, body, 0); |
| 1766 | 1766 | while (it.next()) |prefixed_path| { |
| 1767 | const prefix: Server.Message.PathPrefix = @enumFromInt(prefixed_path[0] - 1); | |
| 1767 | const prefix: Server.Message.PathPrefix = @fromBackingInt(@intCast(prefixed_path[0] - 1)); | |
| 1768 | 1768 | const sub_path = try gpa.dupe(u8, prefixed_path[1..]); |
| 1769 | 1769 | var keep = false; |
| 1770 | 1770 | defer if (!keep) gpa.free(sub_path); |
| 1771 | 1771 | keep = man.addPrefixedPathPost(.{ |
| 1772 | .prefix = @intFromEnum(prefix), | |
| 1772 | .prefix = @backingInt(prefix), | |
| 1773 | 1773 | .sub_path = sub_path, |
| 1774 | 1774 | }) catch |err| switch (err) { |
| 1775 | 1775 | error.Canceled, error.OutOfMemory => |e| return e, |
lib/std/zig/Ast.zig+40-40| ... | ... | @@ -41,15 +41,15 @@ pub const OptionalTokenIndex = enum(u32) { |
| 41 | 41 | _, |
| 42 | 42 | |
| 43 | 43 | pub fn unwrap(oti: OptionalTokenIndex) ?TokenIndex { |
| 44 | return if (oti == .none) null else @intFromEnum(oti); | |
| 44 | return if (oti == .none) null else @backingInt(oti); | |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | pub fn fromToken(ti: TokenIndex) OptionalTokenIndex { |
| 48 | return @enumFromInt(ti); | |
| 48 | return @fromBackingInt(@intCast(ti)); | |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | pub fn fromOptional(oti: ?TokenIndex) OptionalTokenIndex { |
| 52 | return if (oti) |ti| @enumFromInt(ti) else .none; | |
| 52 | return if (oti) |ti| @fromBackingInt(@intCast(ti)) else .none; | |
| 53 | 53 | } |
| 54 | 54 | }; |
| 55 | 55 | |
| ... | ... | @@ -61,17 +61,17 @@ pub const TokenOffset = enum(i32) { |
| 61 | 61 | pub fn init(base: TokenIndex, destination: TokenIndex) TokenOffset { |
| 62 | 62 | const base_i64: i64 = base; |
| 63 | 63 | const destination_i64: i64 = destination; |
| 64 | return @enumFromInt(destination_i64 - base_i64); | |
| 64 | return @fromBackingInt(@intCast(destination_i64 - base_i64)); | |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | pub fn toOptional(to: TokenOffset) OptionalTokenOffset { |
| 68 | const result: OptionalTokenOffset = @enumFromInt(@intFromEnum(to)); | |
| 68 | const result: OptionalTokenOffset = @fromBackingInt(@intCast(@backingInt(to))); | |
| 69 | 69 | assert(result != .none); |
| 70 | 70 | return result; |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | pub fn toAbsolute(offset: TokenOffset, base: TokenIndex) TokenIndex { |
| 74 | return @intCast(@as(i64, base) + @intFromEnum(offset)); | |
| 74 | return @intCast(@as(i64, base) + @backingInt(offset)); | |
| 75 | 75 | } |
| 76 | 76 | }; |
| 77 | 77 | |
| ... | ... | @@ -81,7 +81,7 @@ pub const OptionalTokenOffset = enum(i32) { |
| 81 | 81 | _, |
| 82 | 82 | |
| 83 | 83 | pub fn unwrap(oto: OptionalTokenOffset) ?TokenOffset { |
| 84 | return if (oto == .none) null else @enumFromInt(@intFromEnum(oto)); | |
| 84 | return if (oto == .none) null else @fromBackingInt(@intCast(@backingInt(oto))); | |
| 85 | 85 | } |
| 86 | 86 | }; |
| 87 | 87 | |
| ... | ... | @@ -94,15 +94,15 @@ pub fn tokenStart(tree: *const Ast, token_index: TokenIndex) ByteOffset { |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | pub fn nodeTag(tree: *const Ast, node: Node.Index) Node.Tag { |
| 97 | return tree.nodes.items(.tag)[@intFromEnum(node)]; | |
| 97 | return tree.nodes.items(.tag)[@backingInt(node)]; | |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | pub fn nodeMainToken(tree: *const Ast, node: Node.Index) TokenIndex { |
| 101 | return tree.nodes.items(.main_token)[@intFromEnum(node)]; | |
| 101 | return tree.nodes.items(.main_token)[@backingInt(node)]; | |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | pub fn nodeData(tree: *const Ast, node: Node.Index) Node.Data { |
| 105 | return tree.nodes.items(.data)[@intFromEnum(node)]; | |
| 105 | return tree.nodes.items(.data)[@backingInt(node)]; | |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | pub fn isTokenPrecededByTags( |
| ... | ... | @@ -295,11 +295,11 @@ pub fn tokenSlice(tree: Ast, token_index: TokenIndex) []const u8 { |
| 295 | 295 | } |
| 296 | 296 | |
| 297 | 297 | pub fn extraDataSlice(tree: Ast, range: Node.SubRange, comptime T: type) []const T { |
| 298 | return @ptrCast(tree.extra_data[@intFromEnum(range.start)..@intFromEnum(range.end)]); | |
| 298 | return @ptrCast(tree.extra_data[@backingInt(range.start)..@backingInt(range.end)]); | |
| 299 | 299 | } |
| 300 | 300 | |
| 301 | 301 | pub fn extraDataSliceWithLen(tree: Ast, start: ExtraIndex, len: u32, comptime T: type) []const T { |
| 302 | return @ptrCast(tree.extra_data[@intFromEnum(start)..][0..len]); | |
| 302 | return @ptrCast(tree.extra_data[@backingInt(start)..][0..len]); | |
| 303 | 303 | } |
| 304 | 304 | |
| 305 | 305 | pub fn extraData(tree: Ast, index: ExtraIndex, comptime T: type) T { |
| ... | ... | @@ -311,8 +311,8 @@ pub fn extraData(tree: Ast, index: ExtraIndex, comptime T: type) T { |
| 311 | 311 | Node.OptionalIndex, |
| 312 | 312 | OptionalTokenIndex, |
| 313 | 313 | ExtraIndex, |
| 314 | => @enumFromInt(tree.extra_data[@intFromEnum(index) + i]), | |
| 315 | TokenIndex => tree.extra_data[@intFromEnum(index) + i], | |
| 314 | => @fromBackingInt(@intCast(tree.extra_data[@backingInt(index) + i])), | |
| 315 | TokenIndex => tree.extra_data[@backingInt(index) + i], | |
| 316 | 316 | else => @compileError("unexpected field type: " ++ @typeName(field_type)), |
| 317 | 317 | }; |
| 318 | 318 | } |
| ... | ... | @@ -330,7 +330,7 @@ pub fn rootDecls(tree: Ast) []const Node.Index { |
| 330 | 330 | switch (tree.mode) { |
| 331 | 331 | .zig => return tree.extraDataSlice(tree.nodeData(.root).extra_range, Node.Index), |
| 332 | 332 | // Ensure that the returned slice points into the existing memory of the Ast |
| 333 | .zon => return (&tree.nodes.items(.data)[@intFromEnum(Node.Index.root)].node)[0..1], | |
| 333 | .zon => return (&tree.nodes.items(.data)[@backingInt(Node.Index.root)].node)[0..1], | |
| 334 | 334 | } |
| 335 | 335 | } |
| 336 | 336 | |
| ... | ... | @@ -994,7 +994,7 @@ pub fn lastToken(tree: Ast, node: Node.Index) TokenIndex { |
| 994 | 994 | const params = tree.extraData(extra_index, Node.SubRange); |
| 995 | 995 | assert(params.start != params.end); |
| 996 | 996 | end_offset += 1; // for the rparen |
| 997 | n = @enumFromInt(tree.extra_data[@intFromEnum(params.end) - 1]); // last parameter | |
| 997 | n = @fromBackingInt(@intCast(tree.extra_data[@backingInt(params.end) - 1])); // last parameter | |
| 998 | 998 | }, |
| 999 | 999 | .tagged_union_enum_tag => { |
| 1000 | 1000 | const arg, const extra_index = tree.nodeData(n).node_and_extra; |
| ... | ... | @@ -1004,7 +1004,7 @@ pub fn lastToken(tree: Ast, node: Node.Index) TokenIndex { |
| 1004 | 1004 | n = arg; |
| 1005 | 1005 | } else { |
| 1006 | 1006 | end_offset += 1; // for the rbrace |
| 1007 | n = @enumFromInt(tree.extra_data[@intFromEnum(members.end) - 1]); // last parameter | |
| 1007 | n = @fromBackingInt(@intCast(tree.extra_data[@backingInt(members.end) - 1])); // last parameter | |
| 1008 | 1008 | } |
| 1009 | 1009 | }, |
| 1010 | 1010 | .call_comma, |
| ... | ... | @@ -1014,7 +1014,7 @@ pub fn lastToken(tree: Ast, node: Node.Index) TokenIndex { |
| 1014 | 1014 | const params = tree.extraData(extra_index, Node.SubRange); |
| 1015 | 1015 | assert(params.start != params.end); |
| 1016 | 1016 | end_offset += 2; // for the comma/semicolon + rparen/rbrace |
| 1017 | n = @enumFromInt(tree.extra_data[@intFromEnum(params.end) - 1]); // last parameter | |
| 1017 | n = @fromBackingInt(@intCast(tree.extra_data[@backingInt(params.end) - 1])); // last parameter | |
| 1018 | 1018 | }, |
| 1019 | 1019 | .@"switch" => { |
| 1020 | 1020 | const condition, const extra_index = tree.nodeData(n).node_and_extra; |
| ... | ... | @@ -1024,7 +1024,7 @@ pub fn lastToken(tree: Ast, node: Node.Index) TokenIndex { |
| 1024 | 1024 | n = condition; |
| 1025 | 1025 | } else { |
| 1026 | 1026 | end_offset += 1; // for the rbrace |
| 1027 | n = @enumFromInt(tree.extra_data[@intFromEnum(cases.end) - 1]); // last case | |
| 1027 | n = @fromBackingInt(@intCast(tree.extra_data[@backingInt(cases.end) - 1])); // last case | |
| 1028 | 1028 | } |
| 1029 | 1029 | }, |
| 1030 | 1030 | .container_decl_arg => { |
| ... | ... | @@ -1035,7 +1035,7 @@ pub fn lastToken(tree: Ast, node: Node.Index) TokenIndex { |
| 1035 | 1035 | n = arg; |
| 1036 | 1036 | } else { |
| 1037 | 1037 | end_offset += 1; // for the rbrace |
| 1038 | n = @enumFromInt(tree.extra_data[@intFromEnum(members.end) - 1]); // last parameter | |
| 1038 | n = @fromBackingInt(@intCast(tree.extra_data[@backingInt(members.end) - 1])); // last parameter | |
| 1039 | 1039 | } |
| 1040 | 1040 | }, |
| 1041 | 1041 | .@"asm" => { |
| ... | ... | @@ -1050,7 +1050,7 @@ pub fn lastToken(tree: Ast, node: Node.Index) TokenIndex { |
| 1050 | 1050 | const elements = tree.extraData(extra_index, Node.SubRange); |
| 1051 | 1051 | assert(elements.start != elements.end); |
| 1052 | 1052 | end_offset += 1; // for the rbrace |
| 1053 | n = @enumFromInt(tree.extra_data[@intFromEnum(elements.end) - 1]); // last element | |
| 1053 | n = @fromBackingInt(@intCast(tree.extra_data[@backingInt(elements.end) - 1])); // last element | |
| 1054 | 1054 | }, |
| 1055 | 1055 | .array_init_comma, |
| 1056 | 1056 | .struct_init_comma, |
| ... | ... | @@ -1061,7 +1061,7 @@ pub fn lastToken(tree: Ast, node: Node.Index) TokenIndex { |
| 1061 | 1061 | const members = tree.extraData(extra_index, Node.SubRange); |
| 1062 | 1062 | assert(members.start != members.end); |
| 1063 | 1063 | end_offset += 2; // for the comma + rbrace |
| 1064 | n = @enumFromInt(tree.extra_data[@intFromEnum(members.end) - 1]); // last parameter | |
| 1064 | n = @fromBackingInt(@intCast(tree.extra_data[@backingInt(members.end) - 1])); // last parameter | |
| 1065 | 1065 | }, |
| 1066 | 1066 | .array_init_dot, |
| 1067 | 1067 | .struct_init_dot, |
| ... | ... | @@ -1073,7 +1073,7 @@ pub fn lastToken(tree: Ast, node: Node.Index) TokenIndex { |
| 1073 | 1073 | const range = tree.nodeData(n).extra_range; |
| 1074 | 1074 | assert(range.start != range.end); |
| 1075 | 1075 | end_offset += 1; // for the rbrace |
| 1076 | n = @enumFromInt(tree.extra_data[@intFromEnum(range.end) - 1]); // last statement | |
| 1076 | n = @fromBackingInt(@intCast(tree.extra_data[@backingInt(range.end) - 1])); // last statement | |
| 1077 | 1077 | }, |
| 1078 | 1078 | .array_init_dot_comma, |
| 1079 | 1079 | .struct_init_dot_comma, |
| ... | ... | @@ -1085,7 +1085,7 @@ pub fn lastToken(tree: Ast, node: Node.Index) TokenIndex { |
| 1085 | 1085 | const range = tree.nodeData(n).extra_range; |
| 1086 | 1086 | assert(range.start != range.end); |
| 1087 | 1087 | end_offset += 2; // for the comma/semicolon + rbrace/rparen |
| 1088 | n = @enumFromInt(tree.extra_data[@intFromEnum(range.end) - 1]); // last member | |
| 1088 | n = @fromBackingInt(@intCast(tree.extra_data[@backingInt(range.end) - 1])); // last member | |
| 1089 | 1089 | }, |
| 1090 | 1090 | .call_one, |
| 1091 | 1091 | => { |
| ... | ... | @@ -1285,8 +1285,8 @@ pub fn lastToken(tree: Ast, node: Node.Index) TokenIndex { |
| 1285 | 1285 | }, |
| 1286 | 1286 | .@"for" => { |
| 1287 | 1287 | const extra_index, const extra = tree.nodeData(n).@"for"; |
| 1288 | const index = @intFromEnum(extra_index) + extra.inputs + @intFromBool(extra.has_else); | |
| 1289 | n = @enumFromInt(tree.extra_data[index]); | |
| 1288 | const index = @backingInt(extra_index) + extra.inputs + @intFromBool(extra.has_else); | |
| 1289 | n = @fromBackingInt(@intCast(tree.extra_data[index])); | |
| 1290 | 1290 | }, |
| 1291 | 1291 | .array_type_sentinel => { |
| 1292 | 1292 | _, const extra_index = tree.nodeData(n).node_and_extra; |
| ... | ... | @@ -1365,9 +1365,9 @@ pub fn alignedVarDecl(tree: Ast, node: Node.Index) full.VarDecl { |
| 1365 | 1365 | |
| 1366 | 1366 | pub fn assignDestructure(tree: Ast, node: Node.Index) full.AssignDestructure { |
| 1367 | 1367 | const extra_index, const value_expr = tree.nodeData(node).extra_and_node; |
| 1368 | const variable_count = tree.extra_data[@intFromEnum(extra_index)]; | |
| 1368 | const variable_count = tree.extra_data[@backingInt(extra_index)]; | |
| 1369 | 1369 | return tree.fullAssignDestructureComponents(.{ |
| 1370 | .variables = tree.extraDataSliceWithLen(@enumFromInt(@intFromEnum(extra_index) + 1), variable_count, Node.Index), | |
| 1370 | .variables = tree.extraDataSliceWithLen(@fromBackingInt(@intCast(@backingInt(extra_index) + 1)), variable_count, Node.Index), | |
| 1371 | 1371 | .equal_token = tree.nodeMainToken(node), |
| 1372 | 1372 | .value_expr = value_expr, |
| 1373 | 1373 | }); |
| ... | ... | @@ -1856,7 +1856,7 @@ pub fn switchCaseOne(tree: Ast, node: Node.Index) full.SwitchCase { |
| 1856 | 1856 | &.{} |
| 1857 | 1857 | else |
| 1858 | 1858 | // Ensure that the returned slice points into the existing memory of the Ast |
| 1859 | (@as(*const Node.Index, @ptrCast(&tree.nodes.items(.data)[@intFromEnum(node)].opt_node_and_node[0])))[0..1], | |
| 1859 | (@as(*const Node.Index, @ptrCast(&tree.nodes.items(.data)[@backingInt(node)].opt_node_and_node[0])))[0..1], | |
| 1860 | 1860 | .arrow_token = tree.nodeMainToken(node), |
| 1861 | 1861 | .target_expr = target_expr, |
| 1862 | 1862 | }, node); |
| ... | ... | @@ -1932,7 +1932,7 @@ pub fn whileFull(tree: Ast, node: Node.Index) full.While { |
| 1932 | 1932 | } |
| 1933 | 1933 | |
| 1934 | 1934 | pub fn forSimple(tree: Ast, node: Node.Index) full.For { |
| 1935 | const data = &tree.nodes.items(.data)[@intFromEnum(node)].node_and_node; | |
| 1935 | const data = &tree.nodes.items(.data)[@backingInt(node)].node_and_node; | |
| 1936 | 1936 | return tree.fullForComponents(.{ |
| 1937 | 1937 | .for_token = tree.nodeMainToken(node), |
| 1938 | 1938 | .inputs = (&data[0])[0..1], |
| ... | ... | @@ -1944,8 +1944,8 @@ pub fn forSimple(tree: Ast, node: Node.Index) full.For { |
| 1944 | 1944 | pub fn forFull(tree: Ast, node: Node.Index) full.For { |
| 1945 | 1945 | const extra_index, const extra = tree.nodeData(node).@"for"; |
| 1946 | 1946 | const inputs = tree.extraDataSliceWithLen(extra_index, extra.inputs, Node.Index); |
| 1947 | const then_expr: Node.Index = @enumFromInt(tree.extra_data[@intFromEnum(extra_index) + extra.inputs]); | |
| 1948 | const else_expr: Node.OptionalIndex = if (extra.has_else) @enumFromInt(tree.extra_data[@intFromEnum(extra_index) + extra.inputs + 1]) else .none; | |
| 1947 | const then_expr: Node.Index = @fromBackingInt(@intCast(tree.extra_data[@backingInt(extra_index) + extra.inputs])); | |
| 1948 | const else_expr: Node.OptionalIndex = if (extra.has_else) @fromBackingInt(@intCast(tree.extra_data[@backingInt(extra_index) + extra.inputs + 1])) else .none; | |
| 1949 | 1949 | return tree.fullForComponents(.{ |
| 1950 | 1950 | .for_token = tree.nodeMainToken(node), |
| 1951 | 1951 | .inputs = inputs, |
| ... | ... | @@ -2922,15 +2922,15 @@ pub const Node = struct { |
| 2922 | 2922 | _, |
| 2923 | 2923 | |
| 2924 | 2924 | pub fn toOptional(i: Index) OptionalIndex { |
| 2925 | const result: OptionalIndex = @enumFromInt(@intFromEnum(i)); | |
| 2925 | const result: OptionalIndex = @fromBackingInt(@intCast(@backingInt(i))); | |
| 2926 | 2926 | assert(result != .none); |
| 2927 | 2927 | return result; |
| 2928 | 2928 | } |
| 2929 | 2929 | |
| 2930 | 2930 | pub fn toOffset(base: Index, destination: Index) Offset { |
| 2931 | const base_i64: i64 = @intFromEnum(base); | |
| 2932 | const destination_i64: i64 = @intFromEnum(destination); | |
| 2933 | return @enumFromInt(destination_i64 - base_i64); | |
| 2931 | const base_i64: i64 = @backingInt(base); | |
| 2932 | const destination_i64: i64 = @backingInt(destination); | |
| 2933 | return @fromBackingInt(@intCast(destination_i64 - base_i64)); | |
| 2934 | 2934 | } |
| 2935 | 2935 | }; |
| 2936 | 2936 | |
| ... | ... | @@ -2941,7 +2941,7 @@ pub const Node = struct { |
| 2941 | 2941 | _, |
| 2942 | 2942 | |
| 2943 | 2943 | pub fn unwrap(oi: OptionalIndex) ?Index { |
| 2944 | return if (oi == .none) null else @enumFromInt(@intFromEnum(oi)); | |
| 2944 | return if (oi == .none) null else @fromBackingInt(@intCast(@backingInt(oi))); | |
| 2945 | 2945 | } |
| 2946 | 2946 | |
| 2947 | 2947 | pub fn fromOptional(oi: ?Index) OptionalIndex { |
| ... | ... | @@ -2955,13 +2955,13 @@ pub const Node = struct { |
| 2955 | 2955 | _, |
| 2956 | 2956 | |
| 2957 | 2957 | pub fn toOptional(o: Offset) OptionalOffset { |
| 2958 | const result: OptionalOffset = @enumFromInt(@intFromEnum(o)); | |
| 2958 | const result: OptionalOffset = @fromBackingInt(@intCast(@backingInt(o))); | |
| 2959 | 2959 | assert(result != .none); |
| 2960 | 2960 | return result; |
| 2961 | 2961 | } |
| 2962 | 2962 | |
| 2963 | 2963 | pub fn toAbsolute(offset: Offset, base: Index) Index { |
| 2964 | return @enumFromInt(@as(i64, @intFromEnum(base)) + @intFromEnum(offset)); | |
| 2964 | return @fromBackingInt(@intCast(@as(i64, @backingInt(base)) + @backingInt(offset))); | |
| 2965 | 2965 | } |
| 2966 | 2966 | }; |
| 2967 | 2967 | |
| ... | ... | @@ -2971,7 +2971,7 @@ pub const Node = struct { |
| 2971 | 2971 | _, |
| 2972 | 2972 | |
| 2973 | 2973 | pub fn unwrap(oo: OptionalOffset) ?Offset { |
| 2974 | return if (oo == .none) null else @enumFromInt(@intFromEnum(oo)); | |
| 2974 | return if (oo == .none) null else @fromBackingInt(@intCast(@backingInt(oo))); | |
| 2975 | 2975 | } |
| 2976 | 2976 | }; |
| 2977 | 2977 |
lib/std/zig/Ast/Render.zig+3-3| ... | ... | @@ -2191,7 +2191,7 @@ fn renderArrayInit( |
| 2191 | 2191 | width.* = for (w) |c| { |
| 2192 | 2192 | if (!std.ascii.isPrint(c)) |
| 2193 | 2193 | break .nonprint; |
| 2194 | } else @enumFromInt(w.len - @intFromBool(w[w.len - 1] == ',')); | |
| 2194 | } else @fromBackingInt(@intCast(w.len - @intFromBool(w[w.len - 1] == ','))); | |
| 2195 | 2195 | } else { |
| 2196 | 2196 | width.* = .nonprint; |
| 2197 | 2197 | } |
| ... | ... | @@ -2264,7 +2264,7 @@ fn renderArrayInit( |
| 2264 | 2264 | col = 0; |
| 2265 | 2265 | continue; |
| 2266 | 2266 | } |
| 2267 | col_widths[col] = @max(col_widths[col], @intFromEnum(w)); | |
| 2267 | col_widths[col] = @max(col_widths[col], @backingInt(w)); | |
| 2268 | 2268 | col += 1; |
| 2269 | 2269 | if (col == row_size) { |
| 2270 | 2270 | col = 0; |
| ... | ... | @@ -2284,7 +2284,7 @@ fn renderArrayInit( |
| 2284 | 2284 | } |
| 2285 | 2285 | } else { |
| 2286 | 2286 | try renderExpression(r, e, .comma_space); |
| 2287 | try ais.splatByteAll(' ', col_widths[col] - @intFromEnum(w)); | |
| 2287 | try ais.splatByteAll(' ', col_widths[col] - @backingInt(w)); | |
| 2288 | 2288 | col += 1; |
| 2289 | 2289 | } |
| 2290 | 2290 | } |
lib/std/zig/AstGen.zig+233-233| ... | ... | @@ -103,13 +103,13 @@ fn setExtra(astgen: *AstGen, index: usize, extra: anytype) void { |
| 103 | 103 | Ast.OptionalTokenIndex, |
| 104 | 104 | Ast.Node.Index, |
| 105 | 105 | Ast.Node.OptionalIndex, |
| 106 | => @intFromEnum(@field(extra, field_name)), | |
| 106 | => @backingInt(@field(extra, field_name)), | |
| 107 | 107 | |
| 108 | 108 | Ast.TokenOffset, |
| 109 | 109 | Ast.OptionalTokenOffset, |
| 110 | 110 | Ast.Node.Offset, |
| 111 | 111 | Ast.Node.OptionalOffset, |
| 112 | => @bitCast(@intFromEnum(@field(extra, field_name))), | |
| 112 | => @bitCast(@backingInt(@field(extra, field_name))), | |
| 113 | 113 | |
| 114 | 114 | i32, |
| 115 | 115 | Zir.Inst.Call.Flags, |
| ... | ... | @@ -207,7 +207,7 @@ pub fn generate(gpa: Allocator, tree: Ast) Allocator.Error!Zir { |
| 207 | 207 | break :fatal true; |
| 208 | 208 | }; |
| 209 | 209 | |
| 210 | const err_index = @intFromEnum(Zir.ExtraIndex.compile_errors); | |
| 210 | const err_index = @backingInt(Zir.ExtraIndex.compile_errors); | |
| 211 | 211 | if (astgen.compile_errors.items.len == 0) { |
| 212 | 212 | astgen.extra.items[err_index] = 0; |
| 213 | 213 | } else { |
| ... | ... | @@ -223,7 +223,7 @@ pub fn generate(gpa: Allocator, tree: Ast) Allocator.Error!Zir { |
| 223 | 223 | } |
| 224 | 224 | } |
| 225 | 225 | |
| 226 | const imports_index = @intFromEnum(Zir.ExtraIndex.imports); | |
| 226 | const imports_index = @backingInt(Zir.ExtraIndex.imports); | |
| 227 | 227 | if (astgen.imports.count() == 0) { |
| 228 | 228 | astgen.extra.items[imports_index] = 0; |
| 229 | 229 | } else { |
| ... | ... | @@ -1380,7 +1380,7 @@ fn fnProtoExprInner( |
| 1380 | 1380 | defer param_gz.unstack(); |
| 1381 | 1381 | param_gz.is_comptime = true; |
| 1382 | 1382 | const param_type = try fullBodyExpr(&param_gz, scope, coerced_type_ri, param_type_node, .normal); |
| 1383 | const param_inst_expected: Zir.Inst.Index = @enumFromInt(astgen.instructions.len + 1); | |
| 1383 | const param_inst_expected: Zir.Inst.Index = @fromBackingInt(@intCast(astgen.instructions.len + 1)); | |
| 1384 | 1384 | _ = try param_gz.addBreakWithSrcNode(.break_inline, param_inst_expected, param_type, param_type_node); |
| 1385 | 1385 | const name_token = param.name_token orelse tree.nodeMainToken(param_type_node); |
| 1386 | 1386 | const tag: Zir.Inst.Tag = if (is_comptime) .param_comptime else .param; |
| ... | ... | @@ -1506,7 +1506,7 @@ fn arrayInitExpr( |
| 1506 | 1506 | .tag = .array_init_elem_type, |
| 1507 | 1507 | .data = .{ .bin = .{ |
| 1508 | 1508 | .lhs = array_ty, |
| 1509 | .rhs = @enumFromInt(i), | |
| 1509 | .rhs = @fromBackingInt(@intCast(i)), | |
| 1510 | 1510 | } }, |
| 1511 | 1511 | }); |
| 1512 | 1512 | _ = try expr(gz, scope, .{ .rl = .{ .ty = this_elem_ty } }, elem_init); |
| ... | ... | @@ -1598,7 +1598,7 @@ fn arrayInitExprAnon( |
| 1598 | 1598 | |
| 1599 | 1599 | for (elements) |elem_init| { |
| 1600 | 1600 | const elem_ref = try expr(gz, scope, .{ .rl = .none }, elem_init); |
| 1601 | astgen.extra.items[extra_index] = @intFromEnum(elem_ref); | |
| 1601 | astgen.extra.items[extra_index] = @backingInt(elem_ref); | |
| 1602 | 1602 | extra_index += 1; |
| 1603 | 1603 | } |
| 1604 | 1604 | return try gz.addPlNodePayloadIndex(.array_init_anon, node, payload_index); |
| ... | ... | @@ -1621,14 +1621,14 @@ fn arrayInitExprTyped( |
| 1621 | 1621 | .operands_len = @intCast(len), |
| 1622 | 1622 | }); |
| 1623 | 1623 | var extra_index = try reserveExtra(astgen, len); |
| 1624 | astgen.extra.items[extra_index] = @intFromEnum(ty_inst); | |
| 1624 | astgen.extra.items[extra_index] = @backingInt(ty_inst); | |
| 1625 | 1625 | extra_index += 1; |
| 1626 | 1626 | |
| 1627 | 1627 | if (maybe_elem_ty_inst != .none) { |
| 1628 | 1628 | const elem_ri: ResultInfo = .{ .rl = .{ .coerced_ty = maybe_elem_ty_inst } }; |
| 1629 | 1629 | for (elements) |elem_init| { |
| 1630 | 1630 | const elem_inst = try expr(gz, scope, elem_ri, elem_init); |
| 1631 | astgen.extra.items[extra_index] = @intFromEnum(elem_inst); | |
| 1631 | astgen.extra.items[extra_index] = @backingInt(elem_inst); | |
| 1632 | 1632 | extra_index += 1; |
| 1633 | 1633 | } |
| 1634 | 1634 | } else { |
| ... | ... | @@ -1637,12 +1637,12 @@ fn arrayInitExprTyped( |
| 1637 | 1637 | .tag = .array_init_elem_type, |
| 1638 | 1638 | .data = .{ .bin = .{ |
| 1639 | 1639 | .lhs = ty_inst, |
| 1640 | .rhs = @enumFromInt(i), | |
| 1640 | .rhs = @fromBackingInt(@intCast(i)), | |
| 1641 | 1641 | } }, |
| 1642 | 1642 | }) } }; |
| 1643 | 1643 | |
| 1644 | 1644 | const elem_inst = try expr(gz, scope, ri, elem_init); |
| 1645 | astgen.extra.items[extra_index] = @intFromEnum(elem_inst); | |
| 1645 | astgen.extra.items[extra_index] = @backingInt(elem_inst); | |
| 1646 | 1646 | extra_index += 1; |
| 1647 | 1647 | } |
| 1648 | 1648 | } |
| ... | ... | @@ -1673,7 +1673,7 @@ fn arrayInitExprPtr( |
| 1673 | 1673 | .ptr = array_ptr_inst, |
| 1674 | 1674 | .index = @intCast(i), |
| 1675 | 1675 | }); |
| 1676 | astgen.extra.items[extra_index] = @intFromEnum(elem_ptr_inst.toIndex().?); | |
| 1676 | astgen.extra.items[extra_index] = @backingInt(elem_ptr_inst.toIndex().?); | |
| 1677 | 1677 | extra_index += 1; |
| 1678 | 1678 | _ = try expr(gz, scope, .{ .rl = .{ .ptr = .{ .inst = elem_ptr_inst } } }, elem_init); |
| 1679 | 1679 | } |
| ... | ... | @@ -1966,7 +1966,7 @@ fn structInitExprPtr( |
| 1966 | 1966 | .lhs = struct_ptr_inst, |
| 1967 | 1967 | .field_name_start = str_index, |
| 1968 | 1968 | }); |
| 1969 | astgen.extra.items[extra_index] = @intFromEnum(field_ptr.toIndex().?); | |
| 1969 | astgen.extra.items[extra_index] = @backingInt(field_ptr.toIndex().?); | |
| 1970 | 1970 | extra_index += 1; |
| 1971 | 1971 | _ = try expr(gz, scope, .{ .rl = .{ .ptr = .{ .inst = field_ptr } } }, field_init); |
| 1972 | 1972 | } |
| ... | ... | @@ -2658,11 +2658,11 @@ fn addEnsureResult(gz: *GenZir, maybe_unused_result: Zir.Inst.Ref, statement: As |
| 2658 | 2658 | // Note that this array becomes invalid after appending more items to it |
| 2659 | 2659 | // in the above while loop. |
| 2660 | 2660 | const zir_tags = gz.astgen.instructions.items(.tag); |
| 2661 | switch (zir_tags[@intFromEnum(inst)]) { | |
| 2661 | switch (zir_tags[@backingInt(inst)]) { | |
| 2662 | 2662 | // For some instructions, modify the zir data |
| 2663 | 2663 | // so we can avoid a separate ensure_result_used instruction. |
| 2664 | 2664 | .call, .field_call => { |
| 2665 | const break_extra = gz.astgen.instructions.items(.data)[@intFromEnum(inst)].pl_node.payload_index; | |
| 2665 | const break_extra = gz.astgen.instructions.items(.data)[@backingInt(inst)].pl_node.payload_index; | |
| 2666 | 2666 | comptime assert(std.meta.fieldIndex(Zir.Inst.Call, "flags") == |
| 2667 | 2667 | std.meta.fieldIndex(Zir.Inst.FieldCall, "flags")); |
| 2668 | 2668 | const flags: *Zir.Inst.Call.Flags = @ptrCast(&gz.astgen.extra.items[ |
| ... | ... | @@ -2672,7 +2672,7 @@ fn addEnsureResult(gz: *GenZir, maybe_unused_result: Zir.Inst.Ref, statement: As |
| 2672 | 2672 | break :b true; |
| 2673 | 2673 | }, |
| 2674 | 2674 | .builtin_call => { |
| 2675 | const break_extra = gz.astgen.instructions.items(.data)[@intFromEnum(inst)].pl_node.payload_index; | |
| 2675 | const break_extra = gz.astgen.instructions.items(.data)[@backingInt(inst)].pl_node.payload_index; | |
| 2676 | 2676 | const flags: *Zir.Inst.BuiltinCall.Flags = @ptrCast(&gz.astgen.extra.items[ |
| 2677 | 2677 | break_extra + std.meta.fieldIndex(Zir.Inst.BuiltinCall, "flags").? |
| 2678 | 2678 | ]); |
| ... | ... | @@ -2888,7 +2888,7 @@ fn addEnsureResult(gz: *GenZir, maybe_unused_result: Zir.Inst.Ref, statement: As |
| 2888 | 2888 | .array_init_elem_ptr, |
| 2889 | 2889 | => break :b false, |
| 2890 | 2890 | |
| 2891 | .extended => switch (gz.astgen.instructions.items(.data)[@intFromEnum(inst)].extended.opcode) { | |
| 2891 | .extended => switch (gz.astgen.instructions.items(.data)[@backingInt(inst)].extended.opcode) { | |
| 2892 | 2892 | .breakpoint, |
| 2893 | 2893 | .disable_instrumentation, |
| 2894 | 2894 | .disable_intrinsics, |
| ... | ... | @@ -3075,7 +3075,7 @@ fn deferStmt( |
| 3075 | 3075 | const expr_node = tree.nodeData(node).node; |
| 3076 | 3076 | _ = try unusedResultExpr(&defer_gen, &defer_gen.base, expr_node); |
| 3077 | 3077 | try checkUsed(gz, scope, &defer_gen.base); |
| 3078 | _ = try defer_gen.addBreak(.break_inline, @enumFromInt(0), .void_value); | |
| 3078 | _ = try defer_gen.addBreak(.break_inline, @fromBackingInt(@intCast(0)), .void_value); | |
| 3079 | 3079 | |
| 3080 | 3080 | const body = defer_gen.instructionsSlice(); |
| 3081 | 3081 | const body_len = gz.astgen.countBodyLenAfterFixupsExtraRefs(body, &.{}); |
| ... | ... | @@ -3663,12 +3663,12 @@ fn assignOp( |
| 3663 | 3663 | .tag = .extended, |
| 3664 | 3664 | .data = .{ .extended = .{ |
| 3665 | 3665 | .opcode = .inplace_arith_result_ty, |
| 3666 | .small = @intFromEnum(@as(Zir.Inst.InplaceOp, switch (op_inst_tag) { | |
| 3666 | .small = @backingInt(@as(Zir.Inst.InplaceOp, switch (op_inst_tag) { | |
| 3667 | 3667 | .add => .add_eq, |
| 3668 | 3668 | .sub => .sub_eq, |
| 3669 | 3669 | else => unreachable, |
| 3670 | 3670 | })), |
| 3671 | .operand = @intFromEnum(lhs), | |
| 3671 | .operand = @backingInt(lhs), | |
| 3672 | 3672 | } }, |
| 3673 | 3673 | }), |
| 3674 | 3674 | else => try gz.addUnNode(.typeof, lhs, infix_node), // same as LHS type |
| ... | ... | @@ -3819,20 +3819,20 @@ fn ptrType( |
| 3819 | 3819 | .src_node = gz.nodeIndexToRelative(node), |
| 3820 | 3820 | }); |
| 3821 | 3821 | if (sentinel_ref != .none) { |
| 3822 | gz.astgen.extra.appendAssumeCapacity(@intFromEnum(sentinel_ref)); | |
| 3822 | gz.astgen.extra.appendAssumeCapacity(@backingInt(sentinel_ref)); | |
| 3823 | 3823 | } |
| 3824 | 3824 | if (align_ref != .none) { |
| 3825 | gz.astgen.extra.appendAssumeCapacity(@intFromEnum(align_ref)); | |
| 3825 | gz.astgen.extra.appendAssumeCapacity(@backingInt(align_ref)); | |
| 3826 | 3826 | } |
| 3827 | 3827 | if (addrspace_ref != .none) { |
| 3828 | gz.astgen.extra.appendAssumeCapacity(@intFromEnum(addrspace_ref)); | |
| 3828 | gz.astgen.extra.appendAssumeCapacity(@backingInt(addrspace_ref)); | |
| 3829 | 3829 | } |
| 3830 | 3830 | if (bit_start_ref != .none) { |
| 3831 | gz.astgen.extra.appendAssumeCapacity(@intFromEnum(bit_start_ref)); | |
| 3832 | gz.astgen.extra.appendAssumeCapacity(@intFromEnum(bit_end_ref)); | |
| 3831 | gz.astgen.extra.appendAssumeCapacity(@backingInt(bit_start_ref)); | |
| 3832 | gz.astgen.extra.appendAssumeCapacity(@backingInt(bit_end_ref)); | |
| 3833 | 3833 | } |
| 3834 | 3834 | |
| 3835 | const new_index: Zir.Inst.Index = @enumFromInt(gz.astgen.instructions.len); | |
| 3835 | const new_index: Zir.Inst.Index = @fromBackingInt(@intCast(gz.astgen.instructions.len)); | |
| 3836 | 3836 | const result = new_index.toRef(); |
| 3837 | 3837 | gz.astgen.instructions.appendAssumeCapacity(.{ .tag = .ptr_type, .data = .{ |
| 3838 | 3838 | .ptr_type = .{ |
| ... | ... | @@ -3957,7 +3957,7 @@ const WipDecls = struct { |
| 3957 | 3957 | wip.* = undefined; |
| 3958 | 3958 | } |
| 3959 | 3959 | fn nextDecl(wip: *WipDecls, decl_inst: Zir.Inst.Index) void { |
| 3960 | wip.slice.get(wip.astgen)[wip.index] = @intFromEnum(decl_inst); | |
| 3960 | wip.slice.get(wip.astgen)[wip.index] = @backingInt(decl_inst); | |
| 3961 | 3961 | wip.index += 1; |
| 3962 | 3962 | } |
| 3963 | 3963 | }; |
| ... | ... | @@ -4012,7 +4012,7 @@ fn fnDecl( |
| 4012 | 4012 | }; |
| 4013 | 4013 | const lib_name = if (fn_proto.lib_name) |lib_name_token| blk: { |
| 4014 | 4014 | const lib_name_str = try astgen.strLitAsString(lib_name_token); |
| 4015 | const lib_name_slice = astgen.string_bytes.items[@intFromEnum(lib_name_str.index)..][0..lib_name_str.len]; | |
| 4015 | const lib_name_slice = astgen.string_bytes.items[@backingInt(lib_name_str.index)..][0..lib_name_str.len]; | |
| 4016 | 4016 | if (mem.findScalar(u8, lib_name_slice, 0) != null) { |
| 4017 | 4017 | return astgen.failTok(lib_name_token, "library name cannot contain null bytes", .{}); |
| 4018 | 4018 | } else if (lib_name_str.len == 0) { |
| ... | ... | @@ -4231,7 +4231,7 @@ fn fnDeclInner( |
| 4231 | 4231 | var param_gz = decl_gz.makeSubBlock(scope); |
| 4232 | 4232 | defer param_gz.unstack(); |
| 4233 | 4233 | const param_type = try fullBodyExpr(&param_gz, params_scope, coerced_type_ri, param_type_node, .normal); |
| 4234 | const param_inst_expected: Zir.Inst.Index = @enumFromInt(astgen.instructions.len + 1); | |
| 4234 | const param_inst_expected: Zir.Inst.Index = @fromBackingInt(@intCast(astgen.instructions.len + 1)); | |
| 4235 | 4235 | _ = try param_gz.addBreakWithSrcNode(.break_inline, param_inst_expected, param_type, param_type_node); |
| 4236 | 4236 | const param_type_is_generic = any_param_used; |
| 4237 | 4237 | |
| ... | ... | @@ -4276,7 +4276,7 @@ fn fnDeclInner( |
| 4276 | 4276 | // In this case we will send a len=0 body which can be encoded more efficiently. |
| 4277 | 4277 | break :inst inst; |
| 4278 | 4278 | } |
| 4279 | _ = try ret_gz.addBreak(.break_inline, @enumFromInt(0), inst); | |
| 4279 | _ = try ret_gz.addBreak(.break_inline, @fromBackingInt(@intCast(0)), inst); | |
| 4280 | 4280 | break :inst inst; |
| 4281 | 4281 | }; |
| 4282 | 4282 | const ret_body_param_refs = try astgen.fetchRemoveRefEntries(param_insts.items); |
| ... | ... | @@ -4299,11 +4299,11 @@ fn fnDeclInner( |
| 4299 | 4299 | // In this case we will send a len=0 body which can be encoded more efficiently. |
| 4300 | 4300 | break :blk inst; |
| 4301 | 4301 | } |
| 4302 | _ = try cc_gz.addBreak(.break_inline, @enumFromInt(0), inst); | |
| 4302 | _ = try cc_gz.addBreak(.break_inline, @fromBackingInt(@intCast(0)), inst); | |
| 4303 | 4303 | break :blk inst; |
| 4304 | 4304 | } else if (has_inline_keyword) { |
| 4305 | 4305 | const inst = try cc_gz.addStdLangValue(decl_node, .calling_convention_inline); |
| 4306 | _ = try cc_gz.addBreak(.break_inline, @enumFromInt(0), inst); | |
| 4306 | _ = try cc_gz.addBreak(.break_inline, @fromBackingInt(@intCast(0)), inst); | |
| 4307 | 4307 | break :blk inst; |
| 4308 | 4308 | } else { |
| 4309 | 4309 | break :blk .none; |
| ... | ... | @@ -4428,7 +4428,7 @@ fn globalVarDecl( |
| 4428 | 4428 | } else false; |
| 4429 | 4429 | const lib_name = if (var_decl.lib_name) |lib_name_token| blk: { |
| 4430 | 4430 | const lib_name_str = try astgen.strLitAsString(lib_name_token); |
| 4431 | const lib_name_slice = astgen.string_bytes.items[@intFromEnum(lib_name_str.index)..][0..lib_name_str.len]; | |
| 4431 | const lib_name_slice = astgen.string_bytes.items[@backingInt(lib_name_str.index)..][0..lib_name_str.len]; | |
| 4432 | 4432 | if (mem.findScalar(u8, lib_name_slice, 0) != null) { |
| 4433 | 4433 | return astgen.failTok(lib_name_token, "library name cannot contain null bytes", .{}); |
| 4434 | 4434 | } else if (lib_name_str.len == 0) { |
| ... | ... | @@ -4650,7 +4650,7 @@ fn testDecl( |
| 4650 | 4650 | else => .empty, |
| 4651 | 4651 | .string_literal => name: { |
| 4652 | 4652 | const name = try astgen.strLitAsString(test_name_token); |
| 4653 | const slice = astgen.string_bytes.items[@intFromEnum(name.index)..][0..name.len]; | |
| 4653 | const slice = astgen.string_bytes.items[@backingInt(name.index)..][0..name.len]; | |
| 4654 | 4654 | if (mem.findScalar(u8, slice, 0) != null) { |
| 4655 | 4655 | return astgen.failTok(test_name_token, "test name cannot contain null bytes", .{}); |
| 4656 | 4656 | } else if (slice.len == 0) { |
| ... | ... | @@ -4941,7 +4941,7 @@ fn structDeclInner( |
| 4941 | 4941 | member.convertToNonTupleLike(astgen.tree); |
| 4942 | 4942 | assert(!member.ast.tuple_like); |
| 4943 | 4943 | |
| 4944 | field_names.get(astgen)[field_idx] = @intFromEnum(try astgen.identAsString(member.ast.main_token)); | |
| 4944 | field_names.get(astgen)[field_idx] = @backingInt(try astgen.identAsString(member.ast.main_token)); | |
| 4945 | 4945 | |
| 4946 | 4946 | { |
| 4947 | 4947 | const type_node = member.ast.type_expr.unwrap() orelse { |
| ... | ... | @@ -5087,13 +5087,13 @@ fn tupleDecl( |
| 5087 | 5087 | } |
| 5088 | 5088 | |
| 5089 | 5089 | const field_type_ref = try typeExpr(gz, scope, field.ast.type_expr.unwrap().?); |
| 5090 | astgen.scratch.appendAssumeCapacity(@intFromEnum(field_type_ref)); | |
| 5090 | astgen.scratch.appendAssumeCapacity(@backingInt(field_type_ref)); | |
| 5091 | 5091 | |
| 5092 | 5092 | if (field.ast.value_expr.unwrap()) |value_expr| { |
| 5093 | 5093 | const field_init_ref = try comptimeExpr(gz, scope, .{ .rl = .{ .coerced_ty = field_type_ref } }, value_expr, .tuple_field_default_value); |
| 5094 | astgen.scratch.appendAssumeCapacity(@intFromEnum(field_init_ref)); | |
| 5094 | astgen.scratch.appendAssumeCapacity(@backingInt(field_init_ref)); | |
| 5095 | 5095 | } else { |
| 5096 | astgen.scratch.appendAssumeCapacity(@intFromEnum(Zir.Inst.Ref.none)); | |
| 5096 | astgen.scratch.appendAssumeCapacity(@backingInt(Zir.Inst.Ref.none)); | |
| 5097 | 5097 | } |
| 5098 | 5098 | } |
| 5099 | 5099 | |
| ... | ... | @@ -5221,7 +5221,7 @@ fn unionDeclInner( |
| 5221 | 5221 | return astgen.failTok(comptime_token, "union fields cannot be marked comptime", .{}); |
| 5222 | 5222 | } |
| 5223 | 5223 | |
| 5224 | field_names.get(astgen)[field_idx] = @intFromEnum(try astgen.identAsString(member.ast.main_token)); | |
| 5224 | field_names.get(astgen)[field_idx] = @backingInt(try astgen.identAsString(member.ast.main_token)); | |
| 5225 | 5225 | |
| 5226 | 5226 | if (member.ast.type_expr.unwrap()) |type_node| { |
| 5227 | 5227 | const type_ref = try typeExpr(&block_scope, &namespace.base, type_node); |
| ... | ... | @@ -5454,7 +5454,7 @@ fn containerDecl( |
| 5454 | 5454 | |
| 5455 | 5455 | astgen.src_hasher.update(tree.getNodeSource(member_node)); |
| 5456 | 5456 | |
| 5457 | field_names.get(astgen)[field_idx] = @intFromEnum(try astgen.identAsString(member.ast.main_token)); | |
| 5457 | field_names.get(astgen)[field_idx] = @backingInt(try astgen.identAsString(member.ast.main_token)); | |
| 5458 | 5458 | |
| 5459 | 5459 | if (member.ast.value_expr.unwrap()) |value_node| { |
| 5460 | 5460 | if (tag_type_body_len == null) { |
| ... | ... | @@ -5709,7 +5709,7 @@ fn errorSetDecl(gz: *GenZir, ri: ResultInfo, node: Ast.Node.Index) InnerError!Zi |
| 5709 | 5709 | } |
| 5710 | 5710 | gop.value_ptr.* = tok_i; |
| 5711 | 5711 | |
| 5712 | try astgen.extra.append(gpa, @intFromEnum(str_index)); | |
| 5712 | try astgen.extra.append(gpa, @backingInt(str_index)); | |
| 5713 | 5713 | fields_len += 1; |
| 5714 | 5714 | }, |
| 5715 | 5715 | else => unreachable, |
| ... | ... | @@ -6343,7 +6343,7 @@ fn setCondBrPayload( |
| 6343 | 6343 | ); |
| 6344 | 6344 | |
| 6345 | 6345 | const zir_datas = astgen.instructions.items(.data); |
| 6346 | zir_datas[@intFromEnum(condbr)].pl_node.payload_index = astgen.addExtraAssumeCapacity(Zir.Inst.CondBr{ | |
| 6346 | zir_datas[@backingInt(condbr)].pl_node.payload_index = astgen.addExtraAssumeCapacity(Zir.Inst.CondBr{ | |
| 6347 | 6347 | .condition = cond, |
| 6348 | 6348 | .then_body_len = then_body_len, |
| 6349 | 6349 | .else_body_len = else_body_len, |
| ... | ... | @@ -7319,7 +7319,7 @@ fn switchExpr( |
| 7319 | 7319 | // this lowering to avoiding a rather complex special case in Sema. |
| 7320 | 7320 | |
| 7321 | 7321 | assert(switch_full.label_token != null); // use `switch_block_err_union` code path instead! |
| 7322 | assert(.block == astgen.instructions.items(.tag)[@intFromEnum(peer_break_target.block_inst)]); | |
| 7322 | assert(.block == astgen.instructions.items(.tag)[@backingInt(peer_break_target.block_inst)]); | |
| 7323 | 7323 | block_scope.break_target = peer_break_target.block_inst; |
| 7324 | 7324 | block_scope.setBreakResultInfo(peer_break_target.block_ri); |
| 7325 | 7325 | }, |
| ... | ... | @@ -7829,14 +7829,14 @@ fn switchExpr( |
| 7829 | 7829 | .scalar_cases_len = @intCast(scalar_cases_len), |
| 7830 | 7830 | }, |
| 7831 | 7831 | }); |
| 7832 | astgen.instructions.items(.data)[@intFromEnum(switch_block)].pl_node.payload_index = zir_payload_index; | |
| 7832 | astgen.instructions.items(.data)[@backingInt(switch_block)].pl_node.payload_index = zir_payload_index; | |
| 7833 | 7833 | |
| 7834 | 7834 | if (multi_cases_len > 0) astgen.extra.appendAssumeCapacity(multi_cases_len); |
| 7835 | if (payload_capture_inst_is_placeholder) astgen.extra.appendAssumeCapacity(@intFromEnum(payload_capture_inst)); | |
| 7836 | if (tag_capture_inst_is_placeholder) astgen.extra.appendAssumeCapacity(@intFromEnum(tag_capture_inst)); | |
| 7835 | if (payload_capture_inst_is_placeholder) astgen.extra.appendAssumeCapacity(@backingInt(payload_capture_inst)); | |
| 7836 | if (tag_capture_inst_is_placeholder) astgen.extra.appendAssumeCapacity(@backingInt(tag_capture_inst)); | |
| 7837 | 7837 | if (needs_non_err_handling) { |
| 7838 | 7838 | const catch_or_if_src_node_offset = parent_gz.nodeIndexToRelative(catch_or_if_node); |
| 7839 | astgen.extra.appendAssumeCapacity(@bitCast(@intFromEnum(catch_or_if_src_node_offset))); | |
| 7839 | astgen.extra.appendAssumeCapacity(@bitCast(@backingInt(catch_or_if_src_node_offset))); | |
| 7840 | 7840 | astgen.extra.appendAssumeCapacity(@bitCast(non_err_info)); |
| 7841 | 7841 | } |
| 7842 | 7842 | if (has_else) astgen.extra.appendAssumeCapacity(@bitCast(else_info)); |
| ... | ... | @@ -8484,7 +8484,7 @@ fn numberLiteral(gz: *GenZir, ri: ResultInfo, node: Ast.Node.Index, source_node: |
| 8484 | 8484 | var big_int = try std.math.big.int.Managed.init(gpa); |
| 8485 | 8485 | defer big_int.deinit(); |
| 8486 | 8486 | const prefix_offset: usize = if (base == .decimal) 0 else 2; |
| 8487 | big_int.setString(@intFromEnum(base), bytes[prefix_offset..]) catch |err| switch (err) { | |
| 8487 | big_int.setString(@backingInt(base), bytes[prefix_offset..]) catch |err| switch (err) { | |
| 8488 | 8488 | error.InvalidCharacter => unreachable, // caught in `parseNumberLiteral` |
| 8489 | 8489 | error.InvalidBase => unreachable, // we only pass 16, 8, 2, see above |
| 8490 | 8490 | error.OutOfMemory => |e| return e, |
| ... | ... | @@ -8586,7 +8586,7 @@ fn asmExpr( |
| 8586 | 8586 | }, |
| 8587 | 8587 | else => .{ |
| 8588 | 8588 | .tag = .asm_expr, |
| 8589 | .tmpl = @enumFromInt(@intFromEnum(try comptimeExpr(gz, scope, .{ .rl = .none }, full.ast.template, .inline_assembly_code))), | |
| 8589 | .tmpl = @fromBackingInt(@intCast(@backingInt(try comptimeExpr(gz, scope, .{ .rl = .none }, full.ast.template, .inline_assembly_code)))), | |
| 8590 | 8590 | }, |
| 8591 | 8591 | }; |
| 8592 | 8592 | |
| ... | ... | @@ -8903,7 +8903,7 @@ fn typeOf( |
| 8903 | 8903 | |
| 8904 | 8904 | for (args, 0..) |arg, i| { |
| 8905 | 8905 | const param_ref = try reachableExpr(&typeof_scope, &typeof_scope.base, .{ .rl = .none }, arg, node); |
| 8906 | astgen.extra.items[args_index + i] = @intFromEnum(param_ref); | |
| 8906 | astgen.extra.items[args_index + i] = @backingInt(param_ref); | |
| 8907 | 8907 | } |
| 8908 | 8908 | _ = try typeof_scope.addBreak(.break_inline, typeof_inst.toIndex().?, .void_value); |
| 8909 | 8909 | |
| ... | ... | @@ -8952,7 +8952,7 @@ fn minMax( |
| 8952 | 8952 | var extra_index = try reserveExtra(gz.astgen, args.len); |
| 8953 | 8953 | for (args) |arg| { |
| 8954 | 8954 | const arg_ref = try expr(gz, scope, .{ .rl = .none }, arg); |
| 8955 | astgen.extra.items[extra_index] = @intFromEnum(arg_ref); | |
| 8955 | astgen.extra.items[extra_index] = @backingInt(arg_ref); | |
| 8956 | 8956 | extra_index += 1; |
| 8957 | 8957 | } |
| 8958 | 8958 | const tag: Zir.Inst.Extended = switch (op) { |
| ... | ... | @@ -9023,7 +9023,7 @@ fn builtinCall( |
| 9023 | 9023 | } |
| 9024 | 9024 | const str_lit_token = tree.nodeMainToken(operand_node); |
| 9025 | 9025 | const str = try astgen.strLitAsString(str_lit_token); |
| 9026 | const str_slice = astgen.string_bytes.items[@intFromEnum(str.index)..][0..str.len]; | |
| 9026 | const str_slice = astgen.string_bytes.items[@backingInt(str.index)..][0..str.len]; | |
| 9027 | 9027 | if (mem.findScalar(u8, str_slice, 0) != null) { |
| 9028 | 9028 | return astgen.failTok(str_lit_token, "import path cannot contain null bytes", .{}); |
| 9029 | 9029 | } else if (str.len == 0) { |
| ... | ... | @@ -9054,7 +9054,7 @@ fn builtinCall( |
| 9054 | 9054 | var extra_index = try reserveExtra(gz.astgen, params.len); |
| 9055 | 9055 | for (params) |param| { |
| 9056 | 9056 | const param_ref = try expr(gz, scope, .{ .rl = .none }, param); |
| 9057 | astgen.extra.items[extra_index] = @intFromEnum(param_ref); | |
| 9057 | astgen.extra.items[extra_index] = @backingInt(param_ref); | |
| 9058 | 9058 | extra_index += 1; |
| 9059 | 9059 | } |
| 9060 | 9060 | const result = try gz.addExtendedMultiOpPayloadIndex(.compile_log, payload_index, params.len); |
| ... | ... | @@ -9264,7 +9264,7 @@ fn builtinCall( |
| 9264 | 9264 | const param_types = try comptimeExpr(gz, scope, .{ .rl = .{ .coerced_ty = .slice_const_type_type } }, params[0], .fn_param_types); |
| 9265 | 9265 | const param_attrs_ty = try gz.addExtendedPayloadSmall( |
| 9266 | 9266 | .reify_slice_arg_ty, |
| 9267 | @intFromEnum(Zir.Inst.ReifySliceArgInfo.type_to_fn_param_attrs), | |
| 9267 | @backingInt(Zir.Inst.ReifySliceArgInfo.type_to_fn_param_attrs), | |
| 9268 | 9268 | Zir.Inst.UnNode{ .node = gz.nodeIndexToRelative(params[0]), .operand = param_types }, |
| 9269 | 9269 | ); |
| 9270 | 9270 | const param_attrs = try comptimeExpr(gz, scope, .{ .rl = .{ .coerced_ty = param_attrs_ty } }, params[1], .fn_param_attrs); |
| ... | ... | @@ -9286,17 +9286,17 @@ fn builtinCall( |
| 9286 | 9286 | const field_names = try comptimeExpr(gz, scope, .{ .rl = .{ .coerced_ty = .slice_const_slice_const_u8_type } }, params[2], .struct_field_names); |
| 9287 | 9287 | const field_types_ty = try gz.addExtendedPayloadSmall( |
| 9288 | 9288 | .reify_slice_arg_ty, |
| 9289 | @intFromEnum(Zir.Inst.ReifySliceArgInfo.string_to_struct_field_type), | |
| 9289 | @backingInt(Zir.Inst.ReifySliceArgInfo.string_to_struct_field_type), | |
| 9290 | 9290 | Zir.Inst.UnNode{ .node = gz.nodeIndexToRelative(params[2]), .operand = field_names }, |
| 9291 | 9291 | ); |
| 9292 | 9292 | const field_attrs_ty = try gz.addExtendedPayloadSmall( |
| 9293 | 9293 | .reify_slice_arg_ty, |
| 9294 | @intFromEnum(Zir.Inst.ReifySliceArgInfo.string_to_struct_field_attrs), | |
| 9294 | @backingInt(Zir.Inst.ReifySliceArgInfo.string_to_struct_field_attrs), | |
| 9295 | 9295 | Zir.Inst.UnNode{ .node = gz.nodeIndexToRelative(params[2]), .operand = field_names }, |
| 9296 | 9296 | ); |
| 9297 | 9297 | const field_types = try comptimeExpr(gz, scope, .{ .rl = .{ .coerced_ty = field_types_ty } }, params[3], .struct_field_types); |
| 9298 | 9298 | const field_attrs = try comptimeExpr(gz, scope, .{ .rl = .{ .coerced_ty = field_attrs_ty } }, params[4], .struct_field_attrs); |
| 9299 | const result = try gz.addExtendedPayloadSmall(.reify_struct, @intFromEnum(reify_name_strat), Zir.Inst.ReifyStruct{ | |
| 9299 | const result = try gz.addExtendedPayloadSmall(.reify_struct, @backingInt(reify_name_strat), Zir.Inst.ReifyStruct{ | |
| 9300 | 9300 | .src_line = gz.astgen.source_line, |
| 9301 | 9301 | .node = node, |
| 9302 | 9302 | .layout = layout, |
| ... | ... | @@ -9314,17 +9314,17 @@ fn builtinCall( |
| 9314 | 9314 | const field_names = try comptimeExpr(gz, scope, .{ .rl = .{ .coerced_ty = .slice_const_slice_const_u8_type } }, params[2], .union_field_names); |
| 9315 | 9315 | const field_types_ty = try gz.addExtendedPayloadSmall( |
| 9316 | 9316 | .reify_slice_arg_ty, |
| 9317 | @intFromEnum(Zir.Inst.ReifySliceArgInfo.string_to_union_field_type), | |
| 9317 | @backingInt(Zir.Inst.ReifySliceArgInfo.string_to_union_field_type), | |
| 9318 | 9318 | Zir.Inst.UnNode{ .node = gz.nodeIndexToRelative(params[2]), .operand = field_names }, |
| 9319 | 9319 | ); |
| 9320 | 9320 | const field_attrs_ty = try gz.addExtendedPayloadSmall( |
| 9321 | 9321 | .reify_slice_arg_ty, |
| 9322 | @intFromEnum(Zir.Inst.ReifySliceArgInfo.string_to_union_field_attrs), | |
| 9322 | @backingInt(Zir.Inst.ReifySliceArgInfo.string_to_union_field_attrs), | |
| 9323 | 9323 | Zir.Inst.UnNode{ .node = gz.nodeIndexToRelative(params[2]), .operand = field_names }, |
| 9324 | 9324 | ); |
| 9325 | 9325 | const field_types = try comptimeExpr(gz, scope, .{ .rl = .{ .coerced_ty = field_types_ty } }, params[3], .union_field_types); |
| 9326 | 9326 | const field_attrs = try comptimeExpr(gz, scope, .{ .rl = .{ .coerced_ty = field_attrs_ty } }, params[4], .union_field_attrs); |
| 9327 | const result = try gz.addExtendedPayloadSmall(.reify_union, @intFromEnum(reify_name_strat), Zir.Inst.ReifyUnion{ | |
| 9327 | const result = try gz.addExtendedPayloadSmall(.reify_union, @backingInt(reify_name_strat), Zir.Inst.ReifyUnion{ | |
| 9328 | 9328 | .src_line = gz.astgen.source_line, |
| 9329 | 9329 | .node = node, |
| 9330 | 9330 | .layout = layout, |
| ... | ... | @@ -9346,7 +9346,7 @@ fn builtinCall( |
| 9346 | 9346 | .rhs = field_names, |
| 9347 | 9347 | }); |
| 9348 | 9348 | const field_values = try comptimeExpr(gz, scope, .{ .rl = .{ .coerced_ty = field_values_ty } }, params[3], .enum_field_values); |
| 9349 | const result = try gz.addExtendedPayloadSmall(.reify_enum, @intFromEnum(reify_name_strat), Zir.Inst.ReifyEnum{ | |
| 9349 | const result = try gz.addExtendedPayloadSmall(.reify_enum, @backingInt(reify_name_strat), Zir.Inst.ReifyEnum{ | |
| 9350 | 9350 | .src_line = gz.astgen.source_line, |
| 9351 | 9351 | .node = node, |
| 9352 | 9352 | .tag_ty = tag_ty, |
| ... | ... | @@ -9779,7 +9779,7 @@ fn floatRoundOp( |
| 9779 | 9779 | .trunc => .trunc, |
| 9780 | 9780 | else => unreachable, |
| 9781 | 9781 | }; |
| 9782 | const result = try gz.addExtendedPayloadSmall(.round_op, @intFromEnum(round_op), Zir.Inst.BinNode{ | |
| 9782 | const result = try gz.addExtendedPayloadSmall(.round_op, @backingInt(round_op), Zir.Inst.BinNode{ | |
| 9783 | 9783 | .node = gz.nodeIndexToRelative(node), |
| 9784 | 9784 | .lhs = dest_type, |
| 9785 | 9785 | .rhs = operand, |
| ... | ... | @@ -9985,7 +9985,7 @@ fn callExpr( |
| 9985 | 9985 | .field => |field| assert(field.obj_ptr != .none), |
| 9986 | 9986 | } |
| 9987 | 9987 | |
| 9988 | const call_index: Zir.Inst.Index = @enumFromInt(astgen.instructions.len); | |
| 9988 | const call_index: Zir.Inst.Index = @fromBackingInt(@intCast(astgen.instructions.len)); | |
| 9989 | 9989 | const call_inst = call_index.toRef(); |
| 9990 | 9990 | try gz.astgen.instructions.append(astgen.gpa, undefined); |
| 9991 | 9991 | try gz.instructions.append(astgen.gpa, call_index); |
| ... | ... | @@ -10026,14 +10026,14 @@ fn callExpr( |
| 10026 | 10026 | .callee = callee_obj, |
| 10027 | 10027 | .flags = .{ |
| 10028 | 10028 | .pop_error_return_trace = !propagate_error_trace, |
| 10029 | .packed_modifier = @intCast(@intFromEnum(modifier)), | |
| 10029 | .packed_modifier = @intCast(@backingInt(modifier)), | |
| 10030 | 10030 | .args_len = @intCast(call.ast.params.len), |
| 10031 | 10031 | }, |
| 10032 | 10032 | }); |
| 10033 | 10033 | if (call.ast.params.len != 0) { |
| 10034 | 10034 | try astgen.extra.appendSlice(astgen.gpa, astgen.scratch.items[scratch_top..]); |
| 10035 | 10035 | } |
| 10036 | gz.astgen.instructions.set(@intFromEnum(call_index), .{ | |
| 10036 | gz.astgen.instructions.set(@backingInt(call_index), .{ | |
| 10037 | 10037 | .tag = .call, |
| 10038 | 10038 | .data = .{ .pl_node = .{ |
| 10039 | 10039 | .src_node = gz.nodeIndexToRelative(node), |
| ... | ... | @@ -10047,14 +10047,14 @@ fn callExpr( |
| 10047 | 10047 | .field_name_start = callee_field.field_name_start, |
| 10048 | 10048 | .flags = .{ |
| 10049 | 10049 | .pop_error_return_trace = !propagate_error_trace, |
| 10050 | .packed_modifier = @intCast(@intFromEnum(modifier)), | |
| 10050 | .packed_modifier = @intCast(@backingInt(modifier)), | |
| 10051 | 10051 | .args_len = @intCast(call.ast.params.len), |
| 10052 | 10052 | }, |
| 10053 | 10053 | }); |
| 10054 | 10054 | if (call.ast.params.len != 0) { |
| 10055 | 10055 | try astgen.extra.appendSlice(astgen.gpa, astgen.scratch.items[scratch_top..]); |
| 10056 | 10056 | } |
| 10057 | gz.astgen.instructions.set(@intFromEnum(call_index), .{ | |
| 10057 | gz.astgen.instructions.set(@backingInt(call_index), .{ | |
| 10058 | 10058 | .tag = .field_call, |
| 10059 | 10059 | .data = .{ .pl_node = .{ |
| 10060 | 10060 | .src_node = gz.nodeIndexToRelative(node), |
| ... | ... | @@ -10480,8 +10480,8 @@ fn rvalueInner( |
| 10480 | 10480 | const result = r: { |
| 10481 | 10481 | if (raw_result.toIndex()) |result_index| { |
| 10482 | 10482 | const zir_tags = gz.astgen.instructions.items(.tag); |
| 10483 | const data = gz.astgen.instructions.items(.data)[@intFromEnum(result_index)]; | |
| 10484 | if (zir_tags[@intFromEnum(result_index)].isAlwaysVoid(data)) { | |
| 10483 | const data = gz.astgen.instructions.items(.data)[@backingInt(result_index)]; | |
| 10484 | if (zir_tags[@backingInt(result_index)].isAlwaysVoid(data)) { | |
| 10485 | 10485 | break :r Zir.Inst.Ref.void_value; |
| 10486 | 10486 | } |
| 10487 | 10487 | } |
| ... | ... | @@ -10520,108 +10520,108 @@ fn rvalueInner( |
| 10520 | 10520 | }, |
| 10521 | 10521 | .ty => |ty_inst| { |
| 10522 | 10522 | // Quickly eliminate some common, unnecessary type coercion. |
| 10523 | const as_ty = @as(u64, @intFromEnum(Zir.Inst.Ref.type_type)) << 32; | |
| 10524 | const as_bool = @as(u64, @intFromEnum(Zir.Inst.Ref.bool_type)) << 32; | |
| 10525 | const as_void = @as(u64, @intFromEnum(Zir.Inst.Ref.void_type)) << 32; | |
| 10526 | const as_comptime_int = @as(u64, @intFromEnum(Zir.Inst.Ref.comptime_int_type)) << 32; | |
| 10527 | const as_usize = @as(u64, @intFromEnum(Zir.Inst.Ref.usize_type)) << 32; | |
| 10528 | const as_u1 = @as(u64, @intFromEnum(Zir.Inst.Ref.u1_type)) << 32; | |
| 10529 | const as_u8 = @as(u64, @intFromEnum(Zir.Inst.Ref.u8_type)) << 32; | |
| 10530 | switch ((@as(u64, @intFromEnum(ty_inst)) << 32) | @as(u64, @intFromEnum(result))) { | |
| 10531 | as_ty | @intFromEnum(Zir.Inst.Ref.u1_type), | |
| 10532 | as_ty | @intFromEnum(Zir.Inst.Ref.u8_type), | |
| 10533 | as_ty | @intFromEnum(Zir.Inst.Ref.i8_type), | |
| 10534 | as_ty | @intFromEnum(Zir.Inst.Ref.u16_type), | |
| 10535 | as_ty | @intFromEnum(Zir.Inst.Ref.u29_type), | |
| 10536 | as_ty | @intFromEnum(Zir.Inst.Ref.i16_type), | |
| 10537 | as_ty | @intFromEnum(Zir.Inst.Ref.u32_type), | |
| 10538 | as_ty | @intFromEnum(Zir.Inst.Ref.i32_type), | |
| 10539 | as_ty | @intFromEnum(Zir.Inst.Ref.u64_type), | |
| 10540 | as_ty | @intFromEnum(Zir.Inst.Ref.i64_type), | |
| 10541 | as_ty | @intFromEnum(Zir.Inst.Ref.u128_type), | |
| 10542 | as_ty | @intFromEnum(Zir.Inst.Ref.i128_type), | |
| 10543 | as_ty | @intFromEnum(Zir.Inst.Ref.usize_type), | |
| 10544 | as_ty | @intFromEnum(Zir.Inst.Ref.isize_type), | |
| 10545 | as_ty | @intFromEnum(Zir.Inst.Ref.c_char_type), | |
| 10546 | as_ty | @intFromEnum(Zir.Inst.Ref.c_short_type), | |
| 10547 | as_ty | @intFromEnum(Zir.Inst.Ref.c_ushort_type), | |
| 10548 | as_ty | @intFromEnum(Zir.Inst.Ref.c_int_type), | |
| 10549 | as_ty | @intFromEnum(Zir.Inst.Ref.c_uint_type), | |
| 10550 | as_ty | @intFromEnum(Zir.Inst.Ref.c_long_type), | |
| 10551 | as_ty | @intFromEnum(Zir.Inst.Ref.c_ulong_type), | |
| 10552 | as_ty | @intFromEnum(Zir.Inst.Ref.c_longlong_type), | |
| 10553 | as_ty | @intFromEnum(Zir.Inst.Ref.c_ulonglong_type), | |
| 10554 | as_ty | @intFromEnum(Zir.Inst.Ref.c_longdouble_type), | |
| 10555 | as_ty | @intFromEnum(Zir.Inst.Ref.f16_type), | |
| 10556 | as_ty | @intFromEnum(Zir.Inst.Ref.f32_type), | |
| 10557 | as_ty | @intFromEnum(Zir.Inst.Ref.f64_type), | |
| 10558 | as_ty | @intFromEnum(Zir.Inst.Ref.f80_type), | |
| 10559 | as_ty | @intFromEnum(Zir.Inst.Ref.f128_type), | |
| 10560 | as_ty | @intFromEnum(Zir.Inst.Ref.anyopaque_type), | |
| 10561 | as_ty | @intFromEnum(Zir.Inst.Ref.bool_type), | |
| 10562 | as_ty | @intFromEnum(Zir.Inst.Ref.void_type), | |
| 10563 | as_ty | @intFromEnum(Zir.Inst.Ref.type_type), | |
| 10564 | as_ty | @intFromEnum(Zir.Inst.Ref.anyerror_type), | |
| 10565 | as_ty | @intFromEnum(Zir.Inst.Ref.comptime_int_type), | |
| 10566 | as_ty | @intFromEnum(Zir.Inst.Ref.comptime_float_type), | |
| 10567 | as_ty | @intFromEnum(Zir.Inst.Ref.noreturn_type), | |
| 10568 | as_ty | @intFromEnum(Zir.Inst.Ref.anyframe_type), | |
| 10569 | as_ty | @intFromEnum(Zir.Inst.Ref.null_type), | |
| 10570 | as_ty | @intFromEnum(Zir.Inst.Ref.undefined_type), | |
| 10571 | as_ty | @intFromEnum(Zir.Inst.Ref.enum_literal_type), | |
| 10572 | as_ty | @intFromEnum(Zir.Inst.Ref.ptr_usize_type), | |
| 10573 | as_ty | @intFromEnum(Zir.Inst.Ref.ptr_const_comptime_int_type), | |
| 10574 | as_ty | @intFromEnum(Zir.Inst.Ref.manyptr_u8_type), | |
| 10575 | as_ty | @intFromEnum(Zir.Inst.Ref.manyptr_const_u8_type), | |
| 10576 | as_ty | @intFromEnum(Zir.Inst.Ref.manyptr_const_u8_sentinel_0_type), | |
| 10577 | as_ty | @intFromEnum(Zir.Inst.Ref.slice_const_u8_type), | |
| 10578 | as_ty | @intFromEnum(Zir.Inst.Ref.slice_const_u8_sentinel_0_type), | |
| 10579 | as_ty | @intFromEnum(Zir.Inst.Ref.anyerror_void_error_union_type), | |
| 10580 | as_ty | @intFromEnum(Zir.Inst.Ref.generic_poison_type), | |
| 10581 | as_ty | @intFromEnum(Zir.Inst.Ref.empty_tuple_type), | |
| 10582 | as_comptime_int | @intFromEnum(Zir.Inst.Ref.zero), | |
| 10583 | as_comptime_int | @intFromEnum(Zir.Inst.Ref.one), | |
| 10584 | as_comptime_int | @intFromEnum(Zir.Inst.Ref.negative_one), | |
| 10585 | as_usize | @intFromEnum(Zir.Inst.Ref.undef_usize), | |
| 10586 | as_usize | @intFromEnum(Zir.Inst.Ref.zero_usize), | |
| 10587 | as_usize | @intFromEnum(Zir.Inst.Ref.one_usize), | |
| 10588 | as_u1 | @intFromEnum(Zir.Inst.Ref.undef_u1), | |
| 10589 | as_u1 | @intFromEnum(Zir.Inst.Ref.zero_u1), | |
| 10590 | as_u1 | @intFromEnum(Zir.Inst.Ref.one_u1), | |
| 10591 | as_u8 | @intFromEnum(Zir.Inst.Ref.zero_u8), | |
| 10592 | as_u8 | @intFromEnum(Zir.Inst.Ref.one_u8), | |
| 10593 | as_u8 | @intFromEnum(Zir.Inst.Ref.four_u8), | |
| 10594 | as_bool | @intFromEnum(Zir.Inst.Ref.undef_bool), | |
| 10595 | as_bool | @intFromEnum(Zir.Inst.Ref.bool_true), | |
| 10596 | as_bool | @intFromEnum(Zir.Inst.Ref.bool_false), | |
| 10597 | as_void | @intFromEnum(Zir.Inst.Ref.void_value), | |
| 10523 | const as_ty = @as(u64, @backingInt(Zir.Inst.Ref.type_type)) << 32; | |
| 10524 | const as_bool = @as(u64, @backingInt(Zir.Inst.Ref.bool_type)) << 32; | |
| 10525 | const as_void = @as(u64, @backingInt(Zir.Inst.Ref.void_type)) << 32; | |
| 10526 | const as_comptime_int = @as(u64, @backingInt(Zir.Inst.Ref.comptime_int_type)) << 32; | |
| 10527 | const as_usize = @as(u64, @backingInt(Zir.Inst.Ref.usize_type)) << 32; | |
| 10528 | const as_u1 = @as(u64, @backingInt(Zir.Inst.Ref.u1_type)) << 32; | |
| 10529 | const as_u8 = @as(u64, @backingInt(Zir.Inst.Ref.u8_type)) << 32; | |
| 10530 | switch ((@as(u64, @backingInt(ty_inst)) << 32) | @as(u64, @backingInt(result))) { | |
| 10531 | as_ty | @backingInt(Zir.Inst.Ref.u1_type), | |
| 10532 | as_ty | @backingInt(Zir.Inst.Ref.u8_type), | |
| 10533 | as_ty | @backingInt(Zir.Inst.Ref.i8_type), | |
| 10534 | as_ty | @backingInt(Zir.Inst.Ref.u16_type), | |
| 10535 | as_ty | @backingInt(Zir.Inst.Ref.u29_type), | |
| 10536 | as_ty | @backingInt(Zir.Inst.Ref.i16_type), | |
| 10537 | as_ty | @backingInt(Zir.Inst.Ref.u32_type), | |
| 10538 | as_ty | @backingInt(Zir.Inst.Ref.i32_type), | |
| 10539 | as_ty | @backingInt(Zir.Inst.Ref.u64_type), | |
| 10540 | as_ty | @backingInt(Zir.Inst.Ref.i64_type), | |
| 10541 | as_ty | @backingInt(Zir.Inst.Ref.u128_type), | |
| 10542 | as_ty | @backingInt(Zir.Inst.Ref.i128_type), | |
| 10543 | as_ty | @backingInt(Zir.Inst.Ref.usize_type), | |
| 10544 | as_ty | @backingInt(Zir.Inst.Ref.isize_type), | |
| 10545 | as_ty | @backingInt(Zir.Inst.Ref.c_char_type), | |
| 10546 | as_ty | @backingInt(Zir.Inst.Ref.c_short_type), | |
| 10547 | as_ty | @backingInt(Zir.Inst.Ref.c_ushort_type), | |
| 10548 | as_ty | @backingInt(Zir.Inst.Ref.c_int_type), | |
| 10549 | as_ty | @backingInt(Zir.Inst.Ref.c_uint_type), | |
| 10550 | as_ty | @backingInt(Zir.Inst.Ref.c_long_type), | |
| 10551 | as_ty | @backingInt(Zir.Inst.Ref.c_ulong_type), | |
| 10552 | as_ty | @backingInt(Zir.Inst.Ref.c_longlong_type), | |
| 10553 | as_ty | @backingInt(Zir.Inst.Ref.c_ulonglong_type), | |
| 10554 | as_ty | @backingInt(Zir.Inst.Ref.c_longdouble_type), | |
| 10555 | as_ty | @backingInt(Zir.Inst.Ref.f16_type), | |
| 10556 | as_ty | @backingInt(Zir.Inst.Ref.f32_type), | |
| 10557 | as_ty | @backingInt(Zir.Inst.Ref.f64_type), | |
| 10558 | as_ty | @backingInt(Zir.Inst.Ref.f80_type), | |
| 10559 | as_ty | @backingInt(Zir.Inst.Ref.f128_type), | |
| 10560 | as_ty | @backingInt(Zir.Inst.Ref.anyopaque_type), | |
| 10561 | as_ty | @backingInt(Zir.Inst.Ref.bool_type), | |
| 10562 | as_ty | @backingInt(Zir.Inst.Ref.void_type), | |
| 10563 | as_ty | @backingInt(Zir.Inst.Ref.type_type), | |
| 10564 | as_ty | @backingInt(Zir.Inst.Ref.anyerror_type), | |
| 10565 | as_ty | @backingInt(Zir.Inst.Ref.comptime_int_type), | |
| 10566 | as_ty | @backingInt(Zir.Inst.Ref.comptime_float_type), | |
| 10567 | as_ty | @backingInt(Zir.Inst.Ref.noreturn_type), | |
| 10568 | as_ty | @backingInt(Zir.Inst.Ref.anyframe_type), | |
| 10569 | as_ty | @backingInt(Zir.Inst.Ref.null_type), | |
| 10570 | as_ty | @backingInt(Zir.Inst.Ref.undefined_type), | |
| 10571 | as_ty | @backingInt(Zir.Inst.Ref.enum_literal_type), | |
| 10572 | as_ty | @backingInt(Zir.Inst.Ref.ptr_usize_type), | |
| 10573 | as_ty | @backingInt(Zir.Inst.Ref.ptr_const_comptime_int_type), | |
| 10574 | as_ty | @backingInt(Zir.Inst.Ref.manyptr_u8_type), | |
| 10575 | as_ty | @backingInt(Zir.Inst.Ref.manyptr_const_u8_type), | |
| 10576 | as_ty | @backingInt(Zir.Inst.Ref.manyptr_const_u8_sentinel_0_type), | |
| 10577 | as_ty | @backingInt(Zir.Inst.Ref.slice_const_u8_type), | |
| 10578 | as_ty | @backingInt(Zir.Inst.Ref.slice_const_u8_sentinel_0_type), | |
| 10579 | as_ty | @backingInt(Zir.Inst.Ref.anyerror_void_error_union_type), | |
| 10580 | as_ty | @backingInt(Zir.Inst.Ref.generic_poison_type), | |
| 10581 | as_ty | @backingInt(Zir.Inst.Ref.empty_tuple_type), | |
| 10582 | as_comptime_int | @backingInt(Zir.Inst.Ref.zero), | |
| 10583 | as_comptime_int | @backingInt(Zir.Inst.Ref.one), | |
| 10584 | as_comptime_int | @backingInt(Zir.Inst.Ref.negative_one), | |
| 10585 | as_usize | @backingInt(Zir.Inst.Ref.undef_usize), | |
| 10586 | as_usize | @backingInt(Zir.Inst.Ref.zero_usize), | |
| 10587 | as_usize | @backingInt(Zir.Inst.Ref.one_usize), | |
| 10588 | as_u1 | @backingInt(Zir.Inst.Ref.undef_u1), | |
| 10589 | as_u1 | @backingInt(Zir.Inst.Ref.zero_u1), | |
| 10590 | as_u1 | @backingInt(Zir.Inst.Ref.one_u1), | |
| 10591 | as_u8 | @backingInt(Zir.Inst.Ref.zero_u8), | |
| 10592 | as_u8 | @backingInt(Zir.Inst.Ref.one_u8), | |
| 10593 | as_u8 | @backingInt(Zir.Inst.Ref.four_u8), | |
| 10594 | as_bool | @backingInt(Zir.Inst.Ref.undef_bool), | |
| 10595 | as_bool | @backingInt(Zir.Inst.Ref.bool_true), | |
| 10596 | as_bool | @backingInt(Zir.Inst.Ref.bool_false), | |
| 10597 | as_void | @backingInt(Zir.Inst.Ref.void_value), | |
| 10598 | 10598 | => return result, // type of result is already correct |
| 10599 | 10599 | |
| 10600 | as_bool | @intFromEnum(Zir.Inst.Ref.undef) => return .undef_bool, | |
| 10601 | as_usize | @intFromEnum(Zir.Inst.Ref.undef) => return .undef_usize, | |
| 10602 | as_usize | @intFromEnum(Zir.Inst.Ref.undef_u1) => return .undef_usize, | |
| 10603 | as_u1 | @intFromEnum(Zir.Inst.Ref.undef) => return .undef_u1, | |
| 10604 | ||
| 10605 | as_usize | @intFromEnum(Zir.Inst.Ref.zero) => return .zero_usize, | |
| 10606 | as_u1 | @intFromEnum(Zir.Inst.Ref.zero) => return .zero_u1, | |
| 10607 | as_u8 | @intFromEnum(Zir.Inst.Ref.zero) => return .zero_u8, | |
| 10608 | as_usize | @intFromEnum(Zir.Inst.Ref.one) => return .one_usize, | |
| 10609 | as_u1 | @intFromEnum(Zir.Inst.Ref.one) => return .one_u1, | |
| 10610 | as_u8 | @intFromEnum(Zir.Inst.Ref.one) => return .one_u8, | |
| 10611 | as_comptime_int | @intFromEnum(Zir.Inst.Ref.zero_usize) => return .zero, | |
| 10612 | as_u1 | @intFromEnum(Zir.Inst.Ref.zero_usize) => return .zero_u1, | |
| 10613 | as_u8 | @intFromEnum(Zir.Inst.Ref.zero_usize) => return .zero_u8, | |
| 10614 | as_comptime_int | @intFromEnum(Zir.Inst.Ref.one_usize) => return .one, | |
| 10615 | as_u1 | @intFromEnum(Zir.Inst.Ref.one_usize) => return .one_u1, | |
| 10616 | as_u8 | @intFromEnum(Zir.Inst.Ref.one_usize) => return .one_u8, | |
| 10617 | as_comptime_int | @intFromEnum(Zir.Inst.Ref.zero_u1) => return .zero, | |
| 10618 | as_comptime_int | @intFromEnum(Zir.Inst.Ref.zero_u8) => return .zero, | |
| 10619 | as_usize | @intFromEnum(Zir.Inst.Ref.zero_u1) => return .zero_usize, | |
| 10620 | as_usize | @intFromEnum(Zir.Inst.Ref.zero_u8) => return .zero_usize, | |
| 10621 | as_comptime_int | @intFromEnum(Zir.Inst.Ref.one_u1) => return .one, | |
| 10622 | as_comptime_int | @intFromEnum(Zir.Inst.Ref.one_u8) => return .one, | |
| 10623 | as_usize | @intFromEnum(Zir.Inst.Ref.one_u1) => return .one_usize, | |
| 10624 | as_usize | @intFromEnum(Zir.Inst.Ref.one_u8) => return .one_usize, | |
| 10600 | as_bool | @backingInt(Zir.Inst.Ref.undef) => return .undef_bool, | |
| 10601 | as_usize | @backingInt(Zir.Inst.Ref.undef) => return .undef_usize, | |
| 10602 | as_usize | @backingInt(Zir.Inst.Ref.undef_u1) => return .undef_usize, | |
| 10603 | as_u1 | @backingInt(Zir.Inst.Ref.undef) => return .undef_u1, | |
| 10604 | ||
| 10605 | as_usize | @backingInt(Zir.Inst.Ref.zero) => return .zero_usize, | |
| 10606 | as_u1 | @backingInt(Zir.Inst.Ref.zero) => return .zero_u1, | |
| 10607 | as_u8 | @backingInt(Zir.Inst.Ref.zero) => return .zero_u8, | |
| 10608 | as_usize | @backingInt(Zir.Inst.Ref.one) => return .one_usize, | |
| 10609 | as_u1 | @backingInt(Zir.Inst.Ref.one) => return .one_u1, | |
| 10610 | as_u8 | @backingInt(Zir.Inst.Ref.one) => return .one_u8, | |
| 10611 | as_comptime_int | @backingInt(Zir.Inst.Ref.zero_usize) => return .zero, | |
| 10612 | as_u1 | @backingInt(Zir.Inst.Ref.zero_usize) => return .zero_u1, | |
| 10613 | as_u8 | @backingInt(Zir.Inst.Ref.zero_usize) => return .zero_u8, | |
| 10614 | as_comptime_int | @backingInt(Zir.Inst.Ref.one_usize) => return .one, | |
| 10615 | as_u1 | @backingInt(Zir.Inst.Ref.one_usize) => return .one_u1, | |
| 10616 | as_u8 | @backingInt(Zir.Inst.Ref.one_usize) => return .one_u8, | |
| 10617 | as_comptime_int | @backingInt(Zir.Inst.Ref.zero_u1) => return .zero, | |
| 10618 | as_comptime_int | @backingInt(Zir.Inst.Ref.zero_u8) => return .zero, | |
| 10619 | as_usize | @backingInt(Zir.Inst.Ref.zero_u1) => return .zero_usize, | |
| 10620 | as_usize | @backingInt(Zir.Inst.Ref.zero_u8) => return .zero_usize, | |
| 10621 | as_comptime_int | @backingInt(Zir.Inst.Ref.one_u1) => return .one, | |
| 10622 | as_comptime_int | @backingInt(Zir.Inst.Ref.one_u8) => return .one, | |
| 10623 | as_usize | @backingInt(Zir.Inst.Ref.one_u1) => return .one_usize, | |
| 10624 | as_usize | @backingInt(Zir.Inst.Ref.one_u8) => return .one_usize, | |
| 10625 | 10625 | |
| 10626 | 10626 | // Need an explicit type coercion instruction. |
| 10627 | 10627 | else => return gz.addPlNode(ri.zirTag(), src_node, Zir.Inst.As{ |
| ... | ... | @@ -10791,7 +10791,7 @@ fn appendErrorNodeNotes( |
| 10791 | 10791 | @branchHint(.cold); |
| 10792 | 10792 | const gpa = astgen.gpa; |
| 10793 | 10793 | const string_bytes = &astgen.string_bytes; |
| 10794 | const msg: Zir.NullTerminatedString = @enumFromInt(string_bytes.items.len); | |
| 10794 | const msg: Zir.NullTerminatedString = @fromBackingInt(@intCast(string_bytes.items.len)); | |
| 10795 | 10795 | try string_bytes.print(gpa, format ++ "\x00", args); |
| 10796 | 10796 | const notes_index: u32 = if (notes.len != 0) blk: { |
| 10797 | 10797 | const notes_start = astgen.extra.items.len; |
| ... | ... | @@ -10883,7 +10883,7 @@ fn appendErrorTokNotesOff( |
| 10883 | 10883 | @branchHint(.cold); |
| 10884 | 10884 | const gpa = astgen.gpa; |
| 10885 | 10885 | const string_bytes = &astgen.string_bytes; |
| 10886 | const msg: Zir.NullTerminatedString = @enumFromInt(string_bytes.items.len); | |
| 10886 | const msg: Zir.NullTerminatedString = @fromBackingInt(@intCast(string_bytes.items.len)); | |
| 10887 | 10887 | try string_bytes.print(gpa, format ++ "\x00", args); |
| 10888 | 10888 | const notes_index: u32 = if (notes.len != 0) blk: { |
| 10889 | 10889 | const notes_start = astgen.extra.items.len; |
| ... | ... | @@ -10919,7 +10919,7 @@ fn errNoteTokOff( |
| 10919 | 10919 | ) Allocator.Error!u32 { |
| 10920 | 10920 | @branchHint(.cold); |
| 10921 | 10921 | const string_bytes = &astgen.string_bytes; |
| 10922 | const msg: Zir.NullTerminatedString = @enumFromInt(string_bytes.items.len); | |
| 10922 | const msg: Zir.NullTerminatedString = @fromBackingInt(@intCast(string_bytes.items.len)); | |
| 10923 | 10923 | try string_bytes.print(astgen.gpa, format ++ "\x00", args); |
| 10924 | 10924 | return astgen.addExtra(Zir.Inst.CompileErrors.Item{ |
| 10925 | 10925 | .msg = msg, |
| ... | ... | @@ -10938,7 +10938,7 @@ fn errNoteNode( |
| 10938 | 10938 | ) Allocator.Error!u32 { |
| 10939 | 10939 | @branchHint(.cold); |
| 10940 | 10940 | const string_bytes = &astgen.string_bytes; |
| 10941 | const msg: Zir.NullTerminatedString = @enumFromInt(string_bytes.items.len); | |
| 10941 | const msg: Zir.NullTerminatedString = @fromBackingInt(@intCast(string_bytes.items.len)); | |
| 10942 | 10942 | try string_bytes.print(astgen.gpa, format ++ "\x00", args); |
| 10943 | 10943 | return astgen.addExtra(Zir.Inst.CompileErrors.Item{ |
| 10944 | 10944 | .msg = msg, |
| ... | ... | @@ -10962,11 +10962,11 @@ fn identAsString(astgen: *AstGen, ident_token: Ast.TokenIndex) !Zir.NullTerminat |
| 10962 | 10962 | }); |
| 10963 | 10963 | if (gop.found_existing) { |
| 10964 | 10964 | string_bytes.shrinkRetainingCapacity(str_index); |
| 10965 | return @enumFromInt(gop.key_ptr.*); | |
| 10965 | return @fromBackingInt(@intCast(gop.key_ptr.*)); | |
| 10966 | 10966 | } else { |
| 10967 | 10967 | gop.key_ptr.* = str_index; |
| 10968 | 10968 | try string_bytes.append(gpa, 0); |
| 10969 | return @enumFromInt(str_index); | |
| 10969 | return @fromBackingInt(@intCast(str_index)); | |
| 10970 | 10970 | } |
| 10971 | 10971 | } |
| 10972 | 10972 | |
| ... | ... | @@ -10980,7 +10980,7 @@ fn strLitAsString(astgen: *AstGen, str_lit_token: Ast.TokenIndex) !IndexSlice { |
| 10980 | 10980 | try astgen.parseStrLit(str_lit_token, string_bytes, token_bytes, 0); |
| 10981 | 10981 | const key: []const u8 = string_bytes.items[str_index..]; |
| 10982 | 10982 | if (std.mem.findScalar(u8, key, 0)) |_| return .{ |
| 10983 | .index = @enumFromInt(str_index), | |
| 10983 | .index = @fromBackingInt(@intCast(str_index)), | |
| 10984 | 10984 | .len = @intCast(key.len), |
| 10985 | 10985 | }; |
| 10986 | 10986 | const gop = try astgen.string_table.getOrPutContextAdapted(gpa, key, StringIndexAdapter{ |
| ... | ... | @@ -10991,7 +10991,7 @@ fn strLitAsString(astgen: *AstGen, str_lit_token: Ast.TokenIndex) !IndexSlice { |
| 10991 | 10991 | if (gop.found_existing) { |
| 10992 | 10992 | string_bytes.shrinkRetainingCapacity(str_index); |
| 10993 | 10993 | return .{ |
| 10994 | .index = @enumFromInt(gop.key_ptr.*), | |
| 10994 | .index = @fromBackingInt(@intCast(gop.key_ptr.*)), | |
| 10995 | 10995 | .len = @intCast(key.len), |
| 10996 | 10996 | }; |
| 10997 | 10997 | } else { |
| ... | ... | @@ -11001,7 +11001,7 @@ fn strLitAsString(astgen: *AstGen, str_lit_token: Ast.TokenIndex) !IndexSlice { |
| 11001 | 11001 | // be null terminated for that to work. |
| 11002 | 11002 | try string_bytes.append(gpa, 0); |
| 11003 | 11003 | return .{ |
| 11004 | .index = @enumFromInt(str_index), | |
| 11004 | .index = @fromBackingInt(@intCast(str_index)), | |
| 11005 | 11005 | .len = @intCast(key.len), |
| 11006 | 11006 | }; |
| 11007 | 11007 | } |
| ... | ... | @@ -11035,7 +11035,7 @@ fn strLitNodeAsString(astgen: *AstGen, node: Ast.Node.Index) !IndexSlice { |
| 11035 | 11035 | const len = string_bytes.items.len - str_index; |
| 11036 | 11036 | try string_bytes.append(gpa, 0); |
| 11037 | 11037 | return IndexSlice{ |
| 11038 | .index = @enumFromInt(str_index), | |
| 11038 | .index = @fromBackingInt(@intCast(str_index)), | |
| 11039 | 11039 | .len = @intCast(len), |
| 11040 | 11040 | }; |
| 11041 | 11041 | } |
| ... | ... | @@ -11333,14 +11333,14 @@ const GenZir = struct { |
| 11333 | 11333 | if (gz.isEmpty()) return false; |
| 11334 | 11334 | const tags = gz.astgen.instructions.items(.tag); |
| 11335 | 11335 | const last_inst = gz.instructions.items[gz.instructions.items.len - 1]; |
| 11336 | return tags[@intFromEnum(last_inst)].isNoReturn(); | |
| 11336 | return tags[@backingInt(last_inst)].isNoReturn(); | |
| 11337 | 11337 | } |
| 11338 | 11338 | |
| 11339 | 11339 | /// TODO all uses of this should be replaced with uses of `endsWithNoReturn`. |
| 11340 | 11340 | fn refIsNoReturn(gz: GenZir, inst_ref: Zir.Inst.Ref) bool { |
| 11341 | 11341 | if (inst_ref == .unreachable_value) return true; |
| 11342 | 11342 | if (inst_ref.toIndex()) |inst_index| { |
| 11343 | return gz.astgen.instructions.items(.tag)[@intFromEnum(inst_index)].isNoReturn(); | |
| 11343 | return gz.astgen.instructions.items(.tag)[@backingInt(inst_index)].isNoReturn(); | |
| 11344 | 11344 | } |
| 11345 | 11345 | return false; |
| 11346 | 11346 | } |
| ... | ... | @@ -11391,7 +11391,7 @@ const GenZir = struct { |
| 11391 | 11391 | @typeInfo(Zir.Inst.BoolBr).@"struct".field_names.len + body_len, |
| 11392 | 11392 | ); |
| 11393 | 11393 | const zir_datas = astgen.instructions.items(.data); |
| 11394 | zir_datas[@intFromEnum(bool_br)].pl_node.payload_index = astgen.addExtraAssumeCapacity(Zir.Inst.BoolBr{ | |
| 11394 | zir_datas[@backingInt(bool_br)].pl_node.payload_index = astgen.addExtraAssumeCapacity(Zir.Inst.BoolBr{ | |
| 11395 | 11395 | .lhs = bool_br_lhs, |
| 11396 | 11396 | .body_len = body_len, |
| 11397 | 11397 | }); |
| ... | ... | @@ -11408,14 +11408,14 @@ const GenZir = struct { |
| 11408 | 11408 | const body_len = astgen.countBodyLenAfterFixups(body); |
| 11409 | 11409 | |
| 11410 | 11410 | const zir_tags = astgen.instructions.items(.tag); |
| 11411 | assert(zir_tags[@intFromEnum(inst)] != .block_comptime); // use `setComptimeBlockBody` instead | |
| 11411 | assert(zir_tags[@backingInt(inst)] != .block_comptime); // use `setComptimeBlockBody` instead | |
| 11412 | 11412 | |
| 11413 | 11413 | try astgen.extra.ensureUnusedCapacity( |
| 11414 | 11414 | gpa, |
| 11415 | 11415 | @typeInfo(Zir.Inst.Block).@"struct".field_names.len + body_len, |
| 11416 | 11416 | ); |
| 11417 | 11417 | const zir_datas = astgen.instructions.items(.data); |
| 11418 | zir_datas[@intFromEnum(inst)].pl_node.payload_index = astgen.addExtraAssumeCapacity( | |
| 11418 | zir_datas[@backingInt(inst)].pl_node.payload_index = astgen.addExtraAssumeCapacity( | |
| 11419 | 11419 | Zir.Inst.Block{ .body_len = body_len }, |
| 11420 | 11420 | ); |
| 11421 | 11421 | astgen.appendBodyWithFixups(body); |
| ... | ... | @@ -11431,14 +11431,14 @@ const GenZir = struct { |
| 11431 | 11431 | const body_len = astgen.countBodyLenAfterFixups(body); |
| 11432 | 11432 | |
| 11433 | 11433 | const zir_tags = astgen.instructions.items(.tag); |
| 11434 | assert(zir_tags[@intFromEnum(inst)] == .block_comptime); // use `setBlockBody` instead | |
| 11434 | assert(zir_tags[@backingInt(inst)] == .block_comptime); // use `setBlockBody` instead | |
| 11435 | 11435 | |
| 11436 | 11436 | try astgen.extra.ensureUnusedCapacity( |
| 11437 | 11437 | gpa, |
| 11438 | 11438 | @typeInfo(Zir.Inst.BlockComptime).@"struct".field_names.len + body_len, |
| 11439 | 11439 | ); |
| 11440 | 11440 | const zir_datas = astgen.instructions.items(.data); |
| 11441 | zir_datas[@intFromEnum(inst)].pl_node.payload_index = astgen.addExtraAssumeCapacity( | |
| 11441 | zir_datas[@backingInt(inst)].pl_node.payload_index = astgen.addExtraAssumeCapacity( | |
| 11442 | 11442 | Zir.Inst.BlockComptime{ |
| 11443 | 11443 | .reason = comptime_reason, |
| 11444 | 11444 | .body_len = body_len, |
| ... | ... | @@ -11459,7 +11459,7 @@ const GenZir = struct { |
| 11459 | 11459 | @typeInfo(Zir.Inst.Try).@"struct".field_names.len + body_len, |
| 11460 | 11460 | ); |
| 11461 | 11461 | const zir_datas = astgen.instructions.items(.data); |
| 11462 | zir_datas[@intFromEnum(inst)].pl_node.payload_index = astgen.addExtraAssumeCapacity( | |
| 11462 | zir_datas[@backingInt(inst)].pl_node.payload_index = astgen.addExtraAssumeCapacity( | |
| 11463 | 11463 | Zir.Inst.Try{ |
| 11464 | 11464 | .operand = operand, |
| 11465 | 11465 | .body_len = body_len, |
| ... | ... | @@ -11507,7 +11507,7 @@ const GenZir = struct { |
| 11507 | 11507 | const astgen = gz.astgen; |
| 11508 | 11508 | const gpa = astgen.gpa; |
| 11509 | 11509 | const ret_ref = if (args.ret_ref == .void_type) .none else args.ret_ref; |
| 11510 | const new_index: Zir.Inst.Index = @enumFromInt(astgen.instructions.len); | |
| 11510 | const new_index: Zir.Inst.Index = @fromBackingInt(@intCast(astgen.instructions.len)); | |
| 11511 | 11511 | |
| 11512 | 11512 | try gz.instructions.ensureUnusedCapacity(gpa, 1); |
| 11513 | 11513 | try astgen.instructions.ensureUnusedCapacity(gpa, 1); |
| ... | ... | @@ -11598,11 +11598,11 @@ const GenZir = struct { |
| 11598 | 11598 | if (cc_body.len != 0) { |
| 11599 | 11599 | astgen.extra.appendAssumeCapacity(astgen.countBodyLenAfterFixups(cc_body)); |
| 11600 | 11600 | astgen.appendBodyWithFixups(cc_body); |
| 11601 | const break_extra = zir_datas[@intFromEnum(cc_body[cc_body.len - 1])].@"break".payload_index; | |
| 11601 | const break_extra = zir_datas[@backingInt(cc_body[cc_body.len - 1])].@"break".payload_index; | |
| 11602 | 11602 | astgen.extra.items[break_extra + std.meta.fieldIndex(Zir.Inst.Break, "block_inst").?] = |
| 11603 | @intFromEnum(new_index); | |
| 11603 | @backingInt(new_index); | |
| 11604 | 11604 | } else if (args.cc_ref != .none) { |
| 11605 | astgen.extra.appendAssumeCapacity(@intFromEnum(args.cc_ref)); | |
| 11605 | astgen.extra.appendAssumeCapacity(@backingInt(args.cc_ref)); | |
| 11606 | 11606 | } |
| 11607 | 11607 | if (ret_body.len != 0) { |
| 11608 | 11608 | astgen.extra.appendAssumeCapacity( |
| ... | ... | @@ -11611,11 +11611,11 @@ const GenZir = struct { |
| 11611 | 11611 | ); |
| 11612 | 11612 | astgen.appendBodyWithFixups(args.ret_param_refs); |
| 11613 | 11613 | astgen.appendBodyWithFixups(ret_body); |
| 11614 | const break_extra = zir_datas[@intFromEnum(ret_body[ret_body.len - 1])].@"break".payload_index; | |
| 11614 | const break_extra = zir_datas[@backingInt(ret_body[ret_body.len - 1])].@"break".payload_index; | |
| 11615 | 11615 | astgen.extra.items[break_extra + std.meta.fieldIndex(Zir.Inst.Break, "block_inst").?] = |
| 11616 | @intFromEnum(new_index); | |
| 11616 | @backingInt(new_index); | |
| 11617 | 11617 | } else if (ret_ref != .none) { |
| 11618 | astgen.extra.appendAssumeCapacity(@intFromEnum(ret_ref)); | |
| 11618 | astgen.extra.appendAssumeCapacity(@backingInt(ret_ref)); | |
| 11619 | 11619 | } |
| 11620 | 11620 | |
| 11621 | 11621 | if (args.noalias_bits != 0) { |
| ... | ... | @@ -11652,11 +11652,11 @@ const GenZir = struct { |
| 11652 | 11652 | astgen.appendBodyWithFixups(args.ret_param_refs); |
| 11653 | 11653 | astgen.appendBodyWithFixups(ret_body); |
| 11654 | 11654 | |
| 11655 | const break_extra = zir_datas[@intFromEnum(ret_body[ret_body.len - 1])].@"break".payload_index; | |
| 11655 | const break_extra = zir_datas[@backingInt(ret_body[ret_body.len - 1])].@"break".payload_index; | |
| 11656 | 11656 | astgen.extra.items[break_extra + std.meta.fieldIndex(Zir.Inst.Break, "block_inst").?] = |
| 11657 | @intFromEnum(new_index); | |
| 11657 | @backingInt(new_index); | |
| 11658 | 11658 | } else if (ret_ref != .none) { |
| 11659 | astgen.extra.appendAssumeCapacity(@intFromEnum(ret_ref)); | |
| 11659 | astgen.extra.appendAssumeCapacity(@backingInt(ret_ref)); | |
| 11660 | 11660 | } |
| 11661 | 11661 | astgen.appendBodyWithFixupsExtraRefsArrayList(&astgen.extra, body, args.param_insts); |
| 11662 | 11662 | astgen.extra.appendSliceAssumeCapacity(src_locs_and_hash); |
| ... | ... | @@ -11704,11 +11704,11 @@ const GenZir = struct { |
| 11704 | 11704 | try astgen.instructions.ensureUnusedCapacity(gpa, 1); |
| 11705 | 11705 | try astgen.string_bytes.ensureUnusedCapacity(gpa, @sizeOf(std.math.big.Limb) * limbs.len); |
| 11706 | 11706 | |
| 11707 | const new_index: Zir.Inst.Index = @enumFromInt(astgen.instructions.len); | |
| 11707 | const new_index: Zir.Inst.Index = @fromBackingInt(@intCast(astgen.instructions.len)); | |
| 11708 | 11708 | astgen.instructions.appendAssumeCapacity(.{ |
| 11709 | 11709 | .tag = .int_big, |
| 11710 | 11710 | .data = .{ .str = .{ |
| 11711 | .start = @enumFromInt(astgen.string_bytes.items.len), | |
| 11711 | .start = @fromBackingInt(@intCast(astgen.string_bytes.items.len)), | |
| 11712 | 11712 | .len = @intCast(limbs.len), |
| 11713 | 11713 | } }, |
| 11714 | 11714 | }); |
| ... | ... | @@ -11749,7 +11749,7 @@ const GenZir = struct { |
| 11749 | 11749 | src_node: Ast.Node.Index, |
| 11750 | 11750 | ) !Zir.Inst.Index { |
| 11751 | 11751 | assert(operand != .none); |
| 11752 | const new_index: Zir.Inst.Index = @enumFromInt(gz.astgen.instructions.len); | |
| 11752 | const new_index: Zir.Inst.Index = @fromBackingInt(@intCast(gz.astgen.instructions.len)); | |
| 11753 | 11753 | try gz.astgen.instructions.append(gz.astgen.gpa, .{ |
| 11754 | 11754 | .tag = tag, |
| 11755 | 11755 | .data = .{ .un_node = .{ |
| ... | ... | @@ -11772,7 +11772,7 @@ const GenZir = struct { |
| 11772 | 11772 | try gz.astgen.instructions.ensureUnusedCapacity(gpa, 1); |
| 11773 | 11773 | |
| 11774 | 11774 | const payload_index = try gz.astgen.addExtra(extra); |
| 11775 | const new_index: Zir.Inst.Index = @enumFromInt(gz.astgen.instructions.len); | |
| 11775 | const new_index: Zir.Inst.Index = @fromBackingInt(@intCast(gz.astgen.instructions.len)); | |
| 11776 | 11776 | gz.astgen.instructions.appendAssumeCapacity(.{ |
| 11777 | 11777 | .tag = tag, |
| 11778 | 11778 | .data = .{ .pl_node = .{ |
| ... | ... | @@ -11829,7 +11829,7 @@ const GenZir = struct { |
| 11829 | 11829 | gz.astgen.appendBodyWithFixupsExtraRefsArrayList(&gz.astgen.extra, param_body, prev_param_insts); |
| 11830 | 11830 | param_gz.unstack(); |
| 11831 | 11831 | |
| 11832 | const new_index: Zir.Inst.Index = @enumFromInt(gz.astgen.instructions.len); | |
| 11832 | const new_index: Zir.Inst.Index = @fromBackingInt(@intCast(gz.astgen.instructions.len)); | |
| 11833 | 11833 | gz.astgen.instructions.appendAssumeCapacity(.{ |
| 11834 | 11834 | .tag = tag, |
| 11835 | 11835 | .data = .{ .pl_tok = .{ |
| ... | ... | @@ -11842,7 +11842,7 @@ const GenZir = struct { |
| 11842 | 11842 | } |
| 11843 | 11843 | |
| 11844 | 11844 | fn addStdLangValue(gz: *GenZir, src_node: Ast.Node.Index, val: Zir.Inst.StdLangValue) !Zir.Inst.Ref { |
| 11845 | return addExtendedNodeSmall(gz, .std_lang_value, src_node, @intFromEnum(val)); | |
| 11845 | return addExtendedNodeSmall(gz, .std_lang_value, src_node, @backingInt(val)); | |
| 11846 | 11846 | } |
| 11847 | 11847 | |
| 11848 | 11848 | fn addExtendedPayload(gz: *GenZir, opcode: Zir.Inst.Extended, extra: anytype) !Zir.Inst.Ref { |
| ... | ... | @@ -11861,7 +11861,7 @@ const GenZir = struct { |
| 11861 | 11861 | try gz.astgen.instructions.ensureUnusedCapacity(gpa, 1); |
| 11862 | 11862 | |
| 11863 | 11863 | const payload_index = try gz.astgen.addExtra(extra); |
| 11864 | const new_index: Zir.Inst.Index = @enumFromInt(gz.astgen.instructions.len); | |
| 11864 | const new_index: Zir.Inst.Index = @fromBackingInt(@intCast(gz.astgen.instructions.len)); | |
| 11865 | 11865 | gz.astgen.instructions.appendAssumeCapacity(.{ |
| 11866 | 11866 | .tag = .extended, |
| 11867 | 11867 | .data = .{ .extended = .{ |
| ... | ... | @@ -11893,7 +11893,7 @@ const GenZir = struct { |
| 11893 | 11893 | const payload_index = astgen.addExtraAssumeCapacity(Zir.Inst.NodeMultiOp{ |
| 11894 | 11894 | .src_node = gz.nodeIndexToRelative(node), |
| 11895 | 11895 | }); |
| 11896 | const new_index: Zir.Inst.Index = @enumFromInt(astgen.instructions.len); | |
| 11896 | const new_index: Zir.Inst.Index = @fromBackingInt(@intCast(astgen.instructions.len)); | |
| 11897 | 11897 | astgen.instructions.appendAssumeCapacity(.{ |
| 11898 | 11898 | .tag = .extended, |
| 11899 | 11899 | .data = .{ .extended = .{ |
| ... | ... | @@ -11918,7 +11918,7 @@ const GenZir = struct { |
| 11918 | 11918 | |
| 11919 | 11919 | try gz.instructions.ensureUnusedCapacity(gpa, 1); |
| 11920 | 11920 | try astgen.instructions.ensureUnusedCapacity(gpa, 1); |
| 11921 | const new_index: Zir.Inst.Index = @enumFromInt(astgen.instructions.len); | |
| 11921 | const new_index: Zir.Inst.Index = @fromBackingInt(@intCast(astgen.instructions.len)); | |
| 11922 | 11922 | astgen.instructions.appendAssumeCapacity(.{ |
| 11923 | 11923 | .tag = .extended, |
| 11924 | 11924 | .data = .{ .extended = .{ |
| ... | ... | @@ -11942,13 +11942,13 @@ const GenZir = struct { |
| 11942 | 11942 | |
| 11943 | 11943 | try gz.instructions.ensureUnusedCapacity(gpa, 1); |
| 11944 | 11944 | try astgen.instructions.ensureUnusedCapacity(gpa, 1); |
| 11945 | const new_index: Zir.Inst.Index = @enumFromInt(astgen.instructions.len); | |
| 11945 | const new_index: Zir.Inst.Index = @fromBackingInt(@intCast(astgen.instructions.len)); | |
| 11946 | 11946 | astgen.instructions.appendAssumeCapacity(.{ |
| 11947 | 11947 | .tag = .extended, |
| 11948 | 11948 | .data = .{ .extended = .{ |
| 11949 | 11949 | .opcode = opcode, |
| 11950 | 11950 | .small = small, |
| 11951 | .operand = @bitCast(@intFromEnum(gz.nodeIndexToRelative(src_node))), | |
| 11951 | .operand = @bitCast(@backingInt(gz.nodeIndexToRelative(src_node))), | |
| 11952 | 11952 | } }, |
| 11953 | 11953 | }); |
| 11954 | 11954 | gz.instructions.appendAssumeCapacity(new_index); |
| ... | ... | @@ -11980,7 +11980,7 @@ const GenZir = struct { |
| 11980 | 11980 | abs_tok_index: Ast.TokenIndex, |
| 11981 | 11981 | ) !Zir.Inst.Index { |
| 11982 | 11982 | const astgen = gz.astgen; |
| 11983 | const new_index: Zir.Inst.Index = @enumFromInt(astgen.instructions.len); | |
| 11983 | const new_index: Zir.Inst.Index = @fromBackingInt(@intCast(astgen.instructions.len)); | |
| 11984 | 11984 | assert(operand != .none); |
| 11985 | 11985 | try astgen.instructions.append(astgen.gpa, .{ |
| 11986 | 11986 | .tag = tag, |
| ... | ... | @@ -12130,7 +12130,7 @@ const GenZir = struct { |
| 12130 | 12130 | try gz.astgen.instructions.ensureUnusedCapacity(gpa, 1); |
| 12131 | 12131 | try gz.astgen.extra.ensureUnusedCapacity(gpa, @typeInfo(Zir.Inst.Break).@"struct".field_names.len); |
| 12132 | 12132 | |
| 12133 | const new_index: Zir.Inst.Index = @enumFromInt(gz.astgen.instructions.len); | |
| 12133 | const new_index: Zir.Inst.Index = @fromBackingInt(@intCast(gz.astgen.instructions.len)); | |
| 12134 | 12134 | gz.astgen.instructions.appendAssumeCapacity(.{ |
| 12135 | 12135 | .tag = tag, |
| 12136 | 12136 | .data = .{ .@"break" = .{ |
| ... | ... | @@ -12228,7 +12228,7 @@ const GenZir = struct { |
| 12228 | 12228 | .data = .{ .extended = .{ |
| 12229 | 12229 | .opcode = opcode, |
| 12230 | 12230 | .small = undefined, |
| 12231 | .operand = @bitCast(@intFromEnum(gz.nodeIndexToRelative(src_node))), | |
| 12231 | .operand = @bitCast(@backingInt(gz.nodeIndexToRelative(src_node))), | |
| 12232 | 12232 | } }, |
| 12233 | 12233 | }); |
| 12234 | 12234 | } |
| ... | ... | @@ -12259,10 +12259,10 @@ const GenZir = struct { |
| 12259 | 12259 | .src_node = gz.nodeIndexToRelative(args.node), |
| 12260 | 12260 | }); |
| 12261 | 12261 | if (args.type_inst != .none) { |
| 12262 | astgen.extra.appendAssumeCapacity(@intFromEnum(args.type_inst)); | |
| 12262 | astgen.extra.appendAssumeCapacity(@backingInt(args.type_inst)); | |
| 12263 | 12263 | } |
| 12264 | 12264 | if (args.align_inst != .none) { |
| 12265 | astgen.extra.appendAssumeCapacity(@intFromEnum(args.align_inst)); | |
| 12265 | astgen.extra.appendAssumeCapacity(@backingInt(args.align_inst)); | |
| 12266 | 12266 | } |
| 12267 | 12267 | |
| 12268 | 12268 | const has_type: u4 = @intFromBool(args.type_inst != .none); |
| ... | ... | @@ -12271,7 +12271,7 @@ const GenZir = struct { |
| 12271 | 12271 | const is_comptime: u4 = @intFromBool(args.is_comptime); |
| 12272 | 12272 | const small: u16 = has_type | (has_align << 1) | (is_const << 2) | (is_comptime << 3); |
| 12273 | 12273 | |
| 12274 | const new_index: Zir.Inst.Index = @enumFromInt(astgen.instructions.len); | |
| 12274 | const new_index: Zir.Inst.Index = @fromBackingInt(@intCast(astgen.instructions.len)); | |
| 12275 | 12275 | astgen.instructions.appendAssumeCapacity(.{ |
| 12276 | 12276 | .tag = .extended, |
| 12277 | 12277 | .data = .{ .extended = .{ |
| ... | ... | @@ -12326,7 +12326,7 @@ const GenZir = struct { |
| 12326 | 12326 | .inputs_len = @intCast(args.inputs.len), |
| 12327 | 12327 | }; |
| 12328 | 12328 | |
| 12329 | const new_index: Zir.Inst.Index = @enumFromInt(astgen.instructions.len); | |
| 12329 | const new_index: Zir.Inst.Index = @fromBackingInt(@intCast(astgen.instructions.len)); | |
| 12330 | 12330 | astgen.instructions.appendAssumeCapacity(.{ |
| 12331 | 12331 | .tag = .extended, |
| 12332 | 12332 | .data = .{ .extended = .{ |
| ... | ... | @@ -12343,7 +12343,7 @@ const GenZir = struct { |
| 12343 | 12343 | /// Does *not* append the block instruction to the scope. |
| 12344 | 12344 | /// Leaves the `payload_index` field undefined. |
| 12345 | 12345 | fn makeBlockInst(gz: *GenZir, tag: Zir.Inst.Tag, node: Ast.Node.Index) !Zir.Inst.Index { |
| 12346 | const new_index: Zir.Inst.Index = @enumFromInt(gz.astgen.instructions.len); | |
| 12346 | const new_index: Zir.Inst.Index = @fromBackingInt(@intCast(gz.astgen.instructions.len)); | |
| 12347 | 12347 | const gpa = gz.astgen.gpa; |
| 12348 | 12348 | try gz.astgen.instructions.append(gpa, .{ |
| 12349 | 12349 | .tag = tag, |
| ... | ... | @@ -12359,7 +12359,7 @@ const GenZir = struct { |
| 12359 | 12359 | /// Does *not* append the block instruction to the scope. |
| 12360 | 12360 | /// Leaves the `payload_index` field undefined. Use `setDeclaration` to finalize. |
| 12361 | 12361 | fn makeDeclaration(gz: *GenZir, node: Ast.Node.Index) !Zir.Inst.Index { |
| 12362 | const new_index: Zir.Inst.Index = @enumFromInt(gz.astgen.instructions.len); | |
| 12362 | const new_index: Zir.Inst.Index = @fromBackingInt(@intCast(gz.astgen.instructions.len)); | |
| 12363 | 12363 | try gz.astgen.instructions.append(gz.astgen.gpa, .{ |
| 12364 | 12364 | .tag = .declaration, |
| 12365 | 12365 | .data = .{ .declaration = .{ |
| ... | ... | @@ -12375,7 +12375,7 @@ const GenZir = struct { |
| 12375 | 12375 | fn addCondBr(gz: *GenZir, tag: Zir.Inst.Tag, node: Ast.Node.Index) !Zir.Inst.Index { |
| 12376 | 12376 | const gpa = gz.astgen.gpa; |
| 12377 | 12377 | try gz.instructions.ensureUnusedCapacity(gpa, 1); |
| 12378 | const new_index: Zir.Inst.Index = @enumFromInt(gz.astgen.instructions.len); | |
| 12378 | const new_index: Zir.Inst.Index = @fromBackingInt(@intCast(gz.astgen.instructions.len)); | |
| 12379 | 12379 | try gz.astgen.instructions.append(gpa, .{ |
| 12380 | 12380 | .tag = tag, |
| 12381 | 12381 | .data = .{ .pl_node = .{ |
| ... | ... | @@ -12436,7 +12436,7 @@ const GenZir = struct { |
| 12436 | 12436 | astgen.extra.appendSliceAssumeCapacity(@ptrCast(args.capture_names)); |
| 12437 | 12437 | astgen.extra.appendSliceAssumeCapacity(args.remaining); |
| 12438 | 12438 | |
| 12439 | astgen.instructions.set(@intFromEnum(inst), .{ | |
| 12439 | astgen.instructions.set(@backingInt(inst), .{ | |
| 12440 | 12440 | .tag = .extended, |
| 12441 | 12441 | .data = .{ .extended = .{ |
| 12442 | 12442 | .opcode = .struct_decl, |
| ... | ... | @@ -12507,7 +12507,7 @@ const GenZir = struct { |
| 12507 | 12507 | astgen.extra.appendSliceAssumeCapacity(@ptrCast(args.capture_names)); |
| 12508 | 12508 | astgen.extra.appendSliceAssumeCapacity(args.remaining); |
| 12509 | 12509 | |
| 12510 | astgen.instructions.set(@intFromEnum(inst), .{ | |
| 12510 | astgen.instructions.set(@backingInt(inst), .{ | |
| 12511 | 12511 | .tag = .extended, |
| 12512 | 12512 | .data = .{ .extended = .{ |
| 12513 | 12513 | .opcode = .union_decl, |
| ... | ... | @@ -12571,7 +12571,7 @@ const GenZir = struct { |
| 12571 | 12571 | astgen.extra.appendSliceAssumeCapacity(@ptrCast(args.capture_names)); |
| 12572 | 12572 | astgen.extra.appendSliceAssumeCapacity(args.remaining); |
| 12573 | 12573 | |
| 12574 | astgen.instructions.set(@intFromEnum(inst), .{ | |
| 12574 | astgen.instructions.set(@backingInt(inst), .{ | |
| 12575 | 12575 | .tag = .extended, |
| 12576 | 12576 | .data = .{ .extended = .{ |
| 12577 | 12577 | .opcode = .enum_decl, |
| ... | ... | @@ -12620,7 +12620,7 @@ const GenZir = struct { |
| 12620 | 12620 | astgen.extra.appendSliceAssumeCapacity(@ptrCast(args.capture_names)); |
| 12621 | 12621 | astgen.extra.appendSliceAssumeCapacity(@ptrCast(args.decls)); |
| 12622 | 12622 | |
| 12623 | astgen.instructions.set(@intFromEnum(inst), .{ | |
| 12623 | astgen.instructions.set(@backingInt(inst), .{ | |
| 12624 | 12624 | .tag = .extended, |
| 12625 | 12625 | .data = .{ .extended = .{ |
| 12626 | 12626 | .opcode = .opaque_decl, |
| ... | ... | @@ -12643,7 +12643,7 @@ const GenZir = struct { |
| 12643 | 12643 | try gz.instructions.ensureUnusedCapacity(gpa, 1); |
| 12644 | 12644 | try gz.astgen.instructions.ensureUnusedCapacity(gpa, 1); |
| 12645 | 12645 | |
| 12646 | const new_index: Zir.Inst.Index = @enumFromInt(gz.astgen.instructions.len); | |
| 12646 | const new_index: Zir.Inst.Index = @fromBackingInt(@intCast(gz.astgen.instructions.len)); | |
| 12647 | 12647 | gz.astgen.instructions.appendAssumeCapacity(inst); |
| 12648 | 12648 | gz.instructions.appendAssumeCapacity(new_index); |
| 12649 | 12649 | return new_index; |
| ... | ... | @@ -12654,7 +12654,7 @@ const GenZir = struct { |
| 12654 | 12654 | try gz.instructions.ensureUnusedCapacity(gpa, 1); |
| 12655 | 12655 | try gz.astgen.instructions.ensureUnusedCapacity(gpa, 1); |
| 12656 | 12656 | |
| 12657 | const new_index: Zir.Inst.Index = @enumFromInt(gz.astgen.instructions.len); | |
| 12657 | const new_index: Zir.Inst.Index = @fromBackingInt(@intCast(gz.astgen.instructions.len)); | |
| 12658 | 12658 | gz.astgen.instructions.len += 1; |
| 12659 | 12659 | gz.instructions.appendAssumeCapacity(new_index); |
| 12660 | 12660 | return new_index; |
| ... | ... | @@ -12683,7 +12683,7 @@ const GenZir = struct { |
| 12683 | 12683 | /// This can only be for short-lived references; the memory becomes invalidated |
| 12684 | 12684 | /// when another string is added. |
| 12685 | 12685 | fn nullTerminatedString(astgen: AstGen, index: Zir.NullTerminatedString) [*:0]const u8 { |
| 12686 | return @ptrCast(astgen.string_bytes.items[@intFromEnum(index)..]); | |
| 12686 | return @ptrCast(astgen.string_bytes.items[@backingInt(index)..]); | |
| 12687 | 12687 | } |
| 12688 | 12688 | |
| 12689 | 12689 | /// Local variables shadowing detection, including function parameters. |
| ... | ... | @@ -13136,7 +13136,7 @@ fn scanContainer( |
| 13136 | 13136 | } |
| 13137 | 13137 | |
| 13138 | 13138 | fn appendPlaceholder(astgen: *AstGen) Allocator.Error!Zir.Inst.Index { |
| 13139 | const inst: Zir.Inst.Index = @enumFromInt(astgen.instructions.len); | |
| 13139 | const inst: Zir.Inst.Index = @fromBackingInt(@intCast(astgen.instructions.len)); | |
| 13140 | 13140 | try astgen.instructions.append(astgen.gpa, .{ |
| 13141 | 13141 | .tag = .extended, |
| 13142 | 13142 | .data = .{ .extended = .{ |
| ... | ... | @@ -13183,7 +13183,7 @@ fn appendPossiblyRefdBodyInst( |
| 13183 | 13183 | list: *std.ArrayList(u32), |
| 13184 | 13184 | body_inst: Zir.Inst.Index, |
| 13185 | 13185 | ) void { |
| 13186 | list.appendAssumeCapacity(@intFromEnum(body_inst)); | |
| 13186 | list.appendAssumeCapacity(@backingInt(body_inst)); | |
| 13187 | 13187 | const kv = astgen.ref_table.fetchRemove(body_inst) orelse return; |
| 13188 | 13188 | const ref_inst = kv.value; |
| 13189 | 13189 | return appendPossiblyRefdBodyInst(astgen, list, ref_inst); |
| ... | ... | @@ -13221,8 +13221,8 @@ fn emitDbgStmt(gz: *GenZir, lc: LineColumn) !void { |
| 13221 | 13221 | if (gz.instructions.items.len > gz.instructions_top) { |
| 13222 | 13222 | const astgen = gz.astgen; |
| 13223 | 13223 | const last = gz.instructions.items[gz.instructions.items.len - 1]; |
| 13224 | if (astgen.instructions.items(.tag)[@intFromEnum(last)] == .dbg_stmt) { | |
| 13225 | astgen.instructions.items(.data)[@intFromEnum(last)].dbg_stmt = .{ | |
| 13224 | if (astgen.instructions.items(.tag)[@backingInt(last)] == .dbg_stmt) { | |
| 13225 | astgen.instructions.items(.data)[@backingInt(last)].dbg_stmt = .{ | |
| 13226 | 13226 | .line = lc[0], |
| 13227 | 13227 | .column = lc[1], |
| 13228 | 13228 | }; |
| ... | ... | @@ -13245,7 +13245,7 @@ fn emitDbgStmt(gz: *GenZir, lc: LineColumn) !void { |
| 13245 | 13245 | fn emitDbgStmtForceCurrentIndex(gz: *GenZir, lc: LineColumn) !void { |
| 13246 | 13246 | const astgen = gz.astgen; |
| 13247 | 13247 | if (gz.instructions.items.len > gz.instructions_top and |
| 13248 | @intFromEnum(gz.instructions.items[gz.instructions.items.len - 1]) == astgen.instructions.len - 1) | |
| 13248 | @backingInt(gz.instructions.items[gz.instructions.items.len - 1]) == astgen.instructions.len - 1) | |
| 13249 | 13249 | { |
| 13250 | 13250 | const last = astgen.instructions.len - 1; |
| 13251 | 13251 | if (astgen.instructions.items(.tag)[last] == .dbg_stmt) { |
| ... | ... | @@ -13523,14 +13523,14 @@ fn setDeclaration( |
| 13523 | 13523 | .flags_0 = flags_arr[0], |
| 13524 | 13524 | .flags_1 = flags_arr[1], |
| 13525 | 13525 | }; |
| 13526 | astgen.instructions.items(.data)[@intFromEnum(decl_inst)].declaration.payload_index = | |
| 13526 | astgen.instructions.items(.data)[@backingInt(decl_inst)].declaration.payload_index = | |
| 13527 | 13527 | astgen.addExtraAssumeCapacity(extra); |
| 13528 | 13528 | |
| 13529 | 13529 | if (id.hasName()) { |
| 13530 | astgen.extra.appendAssumeCapacity(@intFromEnum(args.name)); | |
| 13530 | astgen.extra.appendAssumeCapacity(@backingInt(args.name)); | |
| 13531 | 13531 | } |
| 13532 | 13532 | if (id.hasLibName()) { |
| 13533 | astgen.extra.appendAssumeCapacity(@intFromEnum(args.lib_name)); | |
| 13533 | astgen.extra.appendAssumeCapacity(@backingInt(args.lib_name)); | |
| 13534 | 13534 | } |
| 13535 | 13535 | if (id.hasTypeBody()) { |
| 13536 | 13536 | astgen.extra.appendAssumeCapacity(type_len); |
lib/std/zig/ErrorBundle.zig+21-21| ... | ... | @@ -107,17 +107,17 @@ pub fn getMessages(eb: ErrorBundle) []const MessageIndex { |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | pub fn getErrorMessage(eb: ErrorBundle, index: MessageIndex) ErrorMessage { |
| 110 | return eb.extraData(ErrorMessage, @intFromEnum(index)).data; | |
| 110 | return eb.extraData(ErrorMessage, @backingInt(index)).data; | |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | pub fn getSourceLocation(eb: ErrorBundle, index: SourceLocationIndex) SourceLocation { |
| 114 | 114 | assert(index != .none); |
| 115 | return eb.extraData(SourceLocation, @intFromEnum(index)).data; | |
| 115 | return eb.extraData(SourceLocation, @backingInt(index)).data; | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | pub fn getNotes(eb: ErrorBundle, index: MessageIndex) []const MessageIndex { |
| 119 | 119 | const notes_len = eb.getErrorMessage(index).notes_len; |
| 120 | const start = @intFromEnum(index) + @typeInfo(ErrorMessage).@"struct".field_names.len; | |
| 120 | const start = @backingInt(index) + @typeInfo(ErrorMessage).@"struct".field_names.len; | |
| 121 | 121 | return @as([]const MessageIndex, @ptrCast(eb.extra[start..][0..notes_len])); |
| 122 | 122 | } |
| 123 | 123 | |
| ... | ... | @@ -135,8 +135,8 @@ fn extraData(eb: ErrorBundle, comptime T: type, index: usize) struct { data: T, |
| 135 | 135 | inline for (field_names, field_types) |field_name, field_type| { |
| 136 | 136 | @field(result, field_name) = switch (field_type) { |
| 137 | 137 | u32 => eb.extra[i], |
| 138 | MessageIndex => @as(MessageIndex, @enumFromInt(eb.extra[i])), | |
| 139 | SourceLocationIndex => @as(SourceLocationIndex, @enumFromInt(eb.extra[i])), | |
| 138 | MessageIndex => @as(MessageIndex, @fromBackingInt(@intCast(eb.extra[i]))), | |
| 139 | SourceLocationIndex => @as(SourceLocationIndex, @fromBackingInt(@intCast(eb.extra[i]))), | |
| 140 | 140 | else => @compileError("bad field type"), |
| 141 | 141 | }; |
| 142 | 142 | i += 1; |
| ... | ... | @@ -209,7 +209,7 @@ fn renderErrorMessage( |
| 209 | 209 | const w = t.writer; |
| 210 | 210 | const err_msg = eb.getErrorMessage(err_msg_index); |
| 211 | 211 | if (err_msg.src_loc != .none) { |
| 212 | const src = eb.extraData(SourceLocation, @intFromEnum(err_msg.src_loc)); | |
| 212 | const src = eb.extraData(SourceLocation, @backingInt(err_msg.src_loc)); | |
| 213 | 213 | var prefix: Writer.Discarding = .init(&.{}); |
| 214 | 214 | try w.splatByteAll(' ', indent); |
| 215 | 215 | prefix.count += indent; |
| ... | ... | @@ -445,20 +445,20 @@ pub const Wip = struct { |
| 445 | 445 | try wip.addRootErrorMessage(msg); |
| 446 | 446 | const notes_start = try wip.reserveNotes(@intCast(notes.len)); |
| 447 | 447 | for (notes_start.., notes) |i, note| { |
| 448 | wip.extra.items[i] = @intFromEnum(wip.addErrorMessageAssumeCapacity(note)); | |
| 448 | wip.extra.items[i] = @backingInt(wip.addErrorMessageAssumeCapacity(note)); | |
| 449 | 449 | } |
| 450 | 450 | } |
| 451 | 451 | |
| 452 | 452 | pub fn addErrorMessage(wip: *Wip, em: ErrorMessage) Allocator.Error!MessageIndex { |
| 453 | return @enumFromInt(try addExtra(wip, em)); | |
| 453 | return @fromBackingInt(@intCast(try addExtra(wip, em))); | |
| 454 | 454 | } |
| 455 | 455 | |
| 456 | 456 | pub fn addErrorMessageAssumeCapacity(wip: *Wip, em: ErrorMessage) MessageIndex { |
| 457 | return @enumFromInt(addExtraAssumeCapacity(wip, em)); | |
| 457 | return @fromBackingInt(@intCast(addExtraAssumeCapacity(wip, em))); | |
| 458 | 458 | } |
| 459 | 459 | |
| 460 | 460 | pub fn addSourceLocation(wip: *Wip, sl: SourceLocation) Allocator.Error!SourceLocationIndex { |
| 461 | return @enumFromInt(try addExtra(wip, sl)); | |
| 461 | return @fromBackingInt(@intCast(try addExtra(wip, sl))); | |
| 462 | 462 | } |
| 463 | 463 | |
| 464 | 464 | pub fn addReferenceTrace(wip: *Wip, rt: ReferenceTrace) Allocator.Error!void { |
| ... | ... | @@ -477,7 +477,7 @@ pub const Wip = struct { |
| 477 | 477 | const notes_start = wip.reserveNotes(@intCast(other_list.len)) catch unreachable; |
| 478 | 478 | for (notes_start.., other_list) |note, message| { |
| 479 | 479 | // This line can cause `wip.extra.items` to be resized. |
| 480 | const note_index = @intFromEnum(wip.addOtherMessage(other, message) catch unreachable); | |
| 480 | const note_index = @backingInt(wip.addOtherMessage(other, message) catch unreachable); | |
| 481 | 481 | wip.extra.items[note] = note_index; |
| 482 | 482 | } |
| 483 | 483 | } |
| ... | ... | @@ -512,7 +512,7 @@ pub const Wip = struct { |
| 512 | 512 | src_path: []const u8, |
| 513 | 513 | ) !void { |
| 514 | 514 | const Zir = std.zig.Zir; |
| 515 | const payload_index = zir.extra[@intFromEnum(Zir.ExtraIndex.compile_errors)]; | |
| 515 | const payload_index = zir.extra[@backingInt(Zir.ExtraIndex.compile_errors)]; | |
| 516 | 516 | assert(payload_index != 0); |
| 517 | 517 | |
| 518 | 518 | const header = zir.extraData(Zir.Inst.CompileErrors, payload_index); |
| ... | ... | @@ -568,7 +568,7 @@ pub const Wip = struct { |
| 568 | 568 | const loc = std.zig.findLineColumn(source, span.main); |
| 569 | 569 | |
| 570 | 570 | // This line can cause `wip.extra.items` to be resized. |
| 571 | const note_index = @intFromEnum(try eb.addErrorMessage(.{ | |
| 571 | const note_index = @backingInt(try eb.addErrorMessage(.{ | |
| 572 | 572 | .msg = try eb.addString(msg), |
| 573 | 573 | .src_loc = try eb.addSourceLocation(.{ |
| 574 | 574 | .src_path = try eb.addString(src_path), |
| ... | ... | @@ -607,7 +607,7 @@ pub const Wip = struct { |
| 607 | 607 | const end = token_start + @as(u32, @intCast(tree.tokenSlice(token).len)); |
| 608 | 608 | break :span .{ .start = start, .end = end, .main = start }; |
| 609 | 609 | } else { |
| 610 | break :span tree.nodeToSpan(@enumFromInt(err.node_or_offset)); | |
| 610 | break :span tree.nodeToSpan(@fromBackingInt(@intCast(err.node_or_offset))); | |
| 611 | 611 | } |
| 612 | 612 | }; |
| 613 | 613 | const err_loc = std.zig.findLineColumn(source, err_span.main); |
| ... | ... | @@ -636,13 +636,13 @@ pub const Wip = struct { |
| 636 | 636 | const end = token_start + @as(u32, @intCast(tree.tokenSlice(token).len)); |
| 637 | 637 | break :span .{ .start = start, .end = end, .main = start }; |
| 638 | 638 | } else { |
| 639 | break :span tree.nodeToSpan(@enumFromInt(note.node_or_offset)); | |
| 639 | break :span tree.nodeToSpan(@fromBackingInt(@intCast(note.node_or_offset))); | |
| 640 | 640 | } |
| 641 | 641 | }; |
| 642 | 642 | const note_loc = std.zig.findLineColumn(source, note_span.main); |
| 643 | 643 | |
| 644 | 644 | // This line can cause `wip.extra.items` to be resized. |
| 645 | const note_index = @intFromEnum(try eb.addErrorMessage(.{ | |
| 645 | const note_index = @backingInt(try eb.addErrorMessage(.{ | |
| 646 | 646 | .msg = try eb.addString(note.msg.get(zoir)), |
| 647 | 647 | .src_loc = try eb.addSourceLocation(.{ |
| 648 | 648 | .src_path = try eb.addString(src_path), |
| ... | ... | @@ -674,7 +674,7 @@ pub const Wip = struct { |
| 674 | 674 | }); |
| 675 | 675 | const notes_start = try wip.reserveNotes(other_msg.notes_len); |
| 676 | 676 | for (notes_start.., other.getNotes(msg_index)) |note, other_note| { |
| 677 | wip.extra.items[note] = @intFromEnum(try wip.addOtherMessage(other, other_note)); | |
| 677 | wip.extra.items[note] = @backingInt(try wip.addOtherMessage(other, other_note)); | |
| 678 | 678 | } |
| 679 | 679 | return msg; |
| 680 | 680 | } |
| ... | ... | @@ -691,7 +691,7 @@ pub const Wip = struct { |
| 691 | 691 | defer ref_traces.deinit(wip.gpa); |
| 692 | 692 | |
| 693 | 693 | if (other_sl.reference_trace_len > 0) { |
| 694 | var ref_index = other.extraData(SourceLocation, @intFromEnum(index)).end; | |
| 694 | var ref_index = other.extraData(SourceLocation, @backingInt(index)).end; | |
| 695 | 695 | for (0..other_sl.reference_trace_len) |_| { |
| 696 | 696 | const other_ref_trace_ed = other.extraData(ReferenceTrace, ref_index); |
| 697 | 697 | const other_ref_trace = other_ref_trace_ed.data; |
| ... | ... | @@ -753,8 +753,8 @@ pub const Wip = struct { |
| 753 | 753 | inline for (field_names, field_types) |field_name, field_type| { |
| 754 | 754 | wip.extra.items[i] = switch (field_type) { |
| 755 | 755 | u32 => @field(extra, field_name), |
| 756 | MessageIndex => @intFromEnum(@field(extra, field_name)), | |
| 757 | SourceLocationIndex => @intFromEnum(@field(extra, field_name)), | |
| 756 | MessageIndex => @backingInt(@field(extra, field_name)), | |
| 757 | SourceLocationIndex => @backingInt(@field(extra, field_name)), | |
| 758 | 758 | else => @compileError("bad field type"), |
| 759 | 759 | }; |
| 760 | 760 | i += 1; |
| ... | ... | @@ -811,7 +811,7 @@ pub const Wip = struct { |
| 811 | 811 | .notes_len = 1, |
| 812 | 812 | }); |
| 813 | 813 | const i = try wip.reserveNotes(1); |
| 814 | const note_index = @intFromEnum(wip.addErrorMessageAssumeCapacity(.{ | |
| 814 | const note_index = @backingInt(wip.addErrorMessageAssumeCapacity(.{ | |
| 815 | 815 | .msg = try wip.addString("this is a note"), |
| 816 | 816 | .src_loc = try wip.addSourceLocation(.{ |
| 817 | 817 | .src_path = try wip.addString("bar"), |
lib/std/zig/Parse.zig+15-15| ... | ... | @@ -34,15 +34,15 @@ fn tokenStart(p: *const Parse, token_index: TokenIndex) Ast.ByteOffset { |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | fn nodeTag(p: *const Parse, node: Node.Index) Node.Tag { |
| 37 | return p.nodes.items(.tag)[@intFromEnum(node)]; | |
| 37 | return p.nodes.items(.tag)[@backingInt(node)]; | |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | fn nodeMainToken(p: *const Parse, node: Node.Index) TokenIndex { |
| 41 | return p.nodes.items(.main_token)[@intFromEnum(node)]; | |
| 41 | return p.nodes.items(.main_token)[@backingInt(node)]; | |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | fn nodeData(p: *const Parse, node: Node.Index) Node.Data { |
| 45 | return p.nodes.items(.data)[@intFromEnum(node)]; | |
| 45 | return p.nodes.items(.data)[@backingInt(node)]; | |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | const SmallSpan = union(enum) { |
| ... | ... | @@ -69,20 +69,20 @@ const Members = struct { |
| 69 | 69 | fn listToSpan(p: *Parse, list: []const Node.Index) Allocator.Error!Node.SubRange { |
| 70 | 70 | try p.extra_data.appendSlice(p.gpa, @ptrCast(list)); |
| 71 | 71 | return .{ |
| 72 | .start = @enumFromInt(p.extra_data.items.len - list.len), | |
| 73 | .end = @enumFromInt(p.extra_data.items.len), | |
| 72 | .start = @fromBackingInt(@intCast(p.extra_data.items.len - list.len)), | |
| 73 | .end = @fromBackingInt(@intCast(p.extra_data.items.len)), | |
| 74 | 74 | }; |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | fn addNode(p: *Parse, elem: Ast.Node) Allocator.Error!Node.Index { |
| 78 | const result: Node.Index = @enumFromInt(p.nodes.len); | |
| 78 | const result: Node.Index = @fromBackingInt(@intCast(p.nodes.len)); | |
| 79 | 79 | try p.nodes.append(p.gpa, elem); |
| 80 | 80 | return result; |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | fn setNode(p: *Parse, i: usize, elem: Ast.Node) Node.Index { |
| 84 | 84 | p.nodes.set(i, elem); |
| 85 | return @enumFromInt(i); | |
| 85 | return @fromBackingInt(@intCast(i)); | |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | fn reserveNode(p: *Parse, tag: Ast.Node.Tag) !usize { |
| ... | ... | @@ -105,14 +105,14 @@ fn unreserveNode(p: *Parse, node_index: usize) void { |
| 105 | 105 | fn addExtra(p: *Parse, extra: anytype) Allocator.Error!ExtraIndex { |
| 106 | 106 | const info = @typeInfo(@TypeOf(extra)).@"struct"; |
| 107 | 107 | try p.extra_data.ensureUnusedCapacity(p.gpa, info.field_names.len); |
| 108 | const result: ExtraIndex = @enumFromInt(p.extra_data.items.len); | |
| 108 | const result: ExtraIndex = @fromBackingInt(@intCast(p.extra_data.items.len)); | |
| 109 | 109 | inline for (info.field_names, info.field_types) |field_name, field_type| { |
| 110 | 110 | const data: u32 = switch (field_type) { |
| 111 | 111 | Node.Index, |
| 112 | 112 | Node.OptionalIndex, |
| 113 | 113 | OptionalTokenIndex, |
| 114 | 114 | ExtraIndex, |
| 115 | => @intFromEnum(@field(extra, field_name)), | |
| 115 | => @backingInt(@field(extra, field_name)), | |
| 116 | 116 | TokenIndex, |
| 117 | 117 | => @field(extra, field_name), |
| 118 | 118 | else => @compileError("unexpected field type"), |
| ... | ... | @@ -796,9 +796,9 @@ fn parseFnProto(p: *Parse) !?Node.Index { |
| 796 | 796 | |
| 797 | 797 | fn setVarDeclInitExpr(p: *Parse, var_decl: Node.Index, init_expr: Node.OptionalIndex) void { |
| 798 | 798 | const init_expr_result = switch (p.nodeTag(var_decl)) { |
| 799 | .simple_var_decl => &p.nodes.items(.data)[@intFromEnum(var_decl)].opt_node_and_opt_node[1], | |
| 800 | .aligned_var_decl => &p.nodes.items(.data)[@intFromEnum(var_decl)].node_and_opt_node[1], | |
| 801 | .local_var_decl, .global_var_decl => &p.nodes.items(.data)[@intFromEnum(var_decl)].extra_and_opt_node[1], | |
| 799 | .simple_var_decl => &p.nodes.items(.data)[@backingInt(var_decl)].opt_node_and_opt_node[1], | |
| 800 | .aligned_var_decl => &p.nodes.items(.data)[@backingInt(var_decl)].node_and_opt_node[1], | |
| 801 | .local_var_decl, .global_var_decl => &p.nodes.items(.data)[@backingInt(var_decl)].extra_and_opt_node[1], | |
| 802 | 802 | else => unreachable, |
| 803 | 803 | }; |
| 804 | 804 | init_expr_result.* = init_expr; |
| ... | ... | @@ -1114,7 +1114,7 @@ fn expectVarAssignStatement(p: *Parse, comptime_token: ?TokenIndex) !Node.Index |
| 1114 | 1114 | |
| 1115 | 1115 | // An actual destructure! No need for any `comptime` wrapper here. |
| 1116 | 1116 | |
| 1117 | const extra_start: ExtraIndex = @enumFromInt(p.extra_data.items.len); | |
| 1117 | const extra_start: ExtraIndex = @fromBackingInt(@intCast(p.extra_data.items.len)); | |
| 1118 | 1118 | try p.extra_data.ensureUnusedCapacity(p.gpa, lhs_count + 1); |
| 1119 | 1119 | p.extra_data.appendAssumeCapacity(@intCast(lhs_count)); |
| 1120 | 1120 | p.extra_data.appendSliceAssumeCapacity(@ptrCast(p.scratch.items[scratch_top..])); |
| ... | ... | @@ -1488,7 +1488,7 @@ fn finishAssignDestructureExpr(p: *Parse, first_lhs: Node.Index) !Node.Index { |
| 1488 | 1488 | const lhs_count = p.scratch.items.len - scratch_top; |
| 1489 | 1489 | assert(lhs_count > 1); // we already had first_lhs, and must have at least one more lvalue |
| 1490 | 1490 | |
| 1491 | const extra_start: ExtraIndex = @enumFromInt(p.extra_data.items.len); | |
| 1491 | const extra_start: ExtraIndex = @fromBackingInt(@intCast(p.extra_data.items.len)); | |
| 1492 | 1492 | try p.extra_data.ensureUnusedCapacity(p.gpa, lhs_count + 1); |
| 1493 | 1493 | p.extra_data.appendAssumeCapacity(@intCast(lhs_count)); |
| 1494 | 1494 | p.extra_data.appendSliceAssumeCapacity(@ptrCast(p.scratch.items[scratch_top..])); |
| ... | ... | @@ -1579,7 +1579,7 @@ fn parseExprPrecedence(p: *Parse, min_prec: i32) Error!?Node.Index { |
| 1579 | 1579 | |
| 1580 | 1580 | while (true) { |
| 1581 | 1581 | const tok_tag = p.tokenTag(p.tok_i); |
| 1582 | const info = operTable[@as(usize, @intCast(@intFromEnum(tok_tag)))]; | |
| 1582 | const info = operTable[@as(usize, @intCast(@backingInt(tok_tag)))]; | |
| 1583 | 1583 | if (info.prec < min_prec) { |
| 1584 | 1584 | break; |
| 1585 | 1585 | } |
lib/std/zig/TokenSmith.zig+2-2| ... | ... | @@ -248,8 +248,8 @@ pub fn list(t: *TokenSmith) TokenList.Slice { |
| 248 | 248 | .capacity = t.tags_len, |
| 249 | 249 | }; |
| 250 | 250 | comptime std.debug.assert(slice.ptrs.len == 2); |
| 251 | slice.ptrs[@intFromEnum(TokenList.Field.tag)] = @ptrCast(&t.tag_buf); | |
| 252 | slice.ptrs[@intFromEnum(TokenList.Field.start)] = @ptrCast(&t.start_buf); | |
| 251 | slice.ptrs[@backingInt(TokenList.Field.tag)] = @ptrCast(&t.tag_buf); | |
| 252 | slice.ptrs[@backingInt(TokenList.Field.start)] = @ptrCast(&t.start_buf); | |
| 253 | 253 | return slice; |
| 254 | 254 | } |
| 255 | 255 |
lib/std/zig/Zir.zig+70-70| ... | ... | @@ -84,13 +84,13 @@ pub fn extraData(code: Zir, comptime T: type, index: usize) ExtraData(T) { |
| 84 | 84 | Ast.OptionalTokenIndex, |
| 85 | 85 | Ast.Node.Index, |
| 86 | 86 | Ast.Node.OptionalIndex, |
| 87 | => @enumFromInt(code.extra[i]), | |
| 87 | => @fromBackingInt(@intCast(code.extra[i])), | |
| 88 | 88 | |
| 89 | 89 | Ast.TokenOffset, |
| 90 | 90 | Ast.OptionalTokenOffset, |
| 91 | 91 | Ast.Node.Offset, |
| 92 | 92 | Ast.Node.OptionalOffset, |
| 93 | => @enumFromInt(@as(i32, @bitCast(code.extra[i]))), | |
| 93 | => @fromBackingInt(@intCast(@as(i32, @bitCast(code.extra[i])))), | |
| 94 | 94 | |
| 95 | 95 | Inst.Call.Flags, |
| 96 | 96 | Inst.BuiltinCall.Flags, |
| ... | ... | @@ -118,7 +118,7 @@ pub const NullTerminatedString = enum(u32) { |
| 118 | 118 | |
| 119 | 119 | /// Given an index into `string_bytes` returns the null-terminated string found there. |
| 120 | 120 | pub fn nullTerminatedString(code: Zir, index: NullTerminatedString) [:0]const u8 { |
| 121 | const slice = code.string_bytes[@intFromEnum(index)..]; | |
| 121 | const slice = code.string_bytes[@backingInt(index)..]; | |
| 122 | 122 | return slice[0..std.mem.findScalar(u8, slice, 0).? :0]; |
| 123 | 123 | } |
| 124 | 124 | |
| ... | ... | @@ -131,7 +131,7 @@ pub fn bodySlice(zir: Zir, start: usize, len: usize) []Inst.Index { |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | pub fn hasCompileErrors(code: Zir) bool { |
| 134 | if (code.extra[@intFromEnum(ExtraIndex.compile_errors)] != 0) { | |
| 134 | if (code.extra[@backingInt(ExtraIndex.compile_errors)] != 0) { | |
| 135 | 135 | return true; |
| 136 | 136 | } else { |
| 137 | 137 | assert(code.instructions.len != 0); // i.e. lowering did not fail |
| ... | ... | @@ -2202,11 +2202,11 @@ pub const Inst = struct { |
| 2202 | 2202 | _, |
| 2203 | 2203 | |
| 2204 | 2204 | pub fn toRef(i: Index) Inst.Ref { |
| 2205 | return @enumFromInt(Ref.static_len + @intFromEnum(i)); | |
| 2205 | return @fromBackingInt(@intCast(Ref.static_len + @backingInt(i))); | |
| 2206 | 2206 | } |
| 2207 | 2207 | |
| 2208 | 2208 | pub fn toOptional(i: Index) OptionalIndex { |
| 2209 | return @enumFromInt(@intFromEnum(i)); | |
| 2209 | return @fromBackingInt(@intCast(@backingInt(i))); | |
| 2210 | 2210 | } |
| 2211 | 2211 | }; |
| 2212 | 2212 | |
| ... | ... | @@ -2218,7 +2218,7 @@ pub const Inst = struct { |
| 2218 | 2218 | _, |
| 2219 | 2219 | |
| 2220 | 2220 | pub fn unwrap(oi: OptionalIndex) ?Index { |
| 2221 | return if (oi == .none) null else @enumFromInt(@intFromEnum(oi)); | |
| 2221 | return if (oi == .none) null else @fromBackingInt(@intCast(@backingInt(oi))); | |
| 2222 | 2222 | } |
| 2223 | 2223 | }; |
| 2224 | 2224 | |
| ... | ... | @@ -2370,9 +2370,9 @@ pub const Inst = struct { |
| 2370 | 2370 | |
| 2371 | 2371 | pub fn toIndex(inst: Ref) ?Index { |
| 2372 | 2372 | assert(inst != .none); |
| 2373 | const ref_int = @intFromEnum(inst); | |
| 2373 | const ref_int = @backingInt(inst); | |
| 2374 | 2374 | if (ref_int >= static_len) { |
| 2375 | return @enumFromInt(ref_int - static_len); | |
| 2375 | return @fromBackingInt(@intCast(ref_int - static_len)); | |
| 2376 | 2376 | } else { |
| 2377 | 2377 | return null; |
| 2378 | 2378 | } |
| ... | ... | @@ -2429,7 +2429,7 @@ pub const Inst = struct { |
| 2429 | 2429 | len: u32, |
| 2430 | 2430 | |
| 2431 | 2431 | pub fn get(self: @This(), code: Zir) []const u8 { |
| 2432 | return code.string_bytes[@intFromEnum(self.start)..][0..self.len]; | |
| 2432 | return code.string_bytes[@backingInt(self.start)..][0..self.len]; | |
| 2433 | 2433 | } |
| 2434 | 2434 | }, |
| 2435 | 2435 | str_tok: struct { |
| ... | ... | @@ -3009,7 +3009,7 @@ pub const Inst = struct { |
| 3009 | 3009 | pub fn isNamedTest(name: Name, zir: Zir) bool { |
| 3010 | 3010 | return switch (name) { |
| 3011 | 3011 | .@"comptime", .unnamed_test => false, |
| 3012 | _ => zir.string_bytes[@intFromEnum(name)] == 0, | |
| 3012 | _ => zir.string_bytes[@backingInt(name)] == 0, | |
| 3013 | 3013 | }; |
| 3014 | 3014 | } |
| 3015 | 3015 | pub fn toString(name: Name, zir: Zir) ?NullTerminatedString { |
| ... | ... | @@ -3017,12 +3017,12 @@ pub const Inst = struct { |
| 3017 | 3017 | .@"comptime", .unnamed_test => return null, |
| 3018 | 3018 | _ => {}, |
| 3019 | 3019 | } |
| 3020 | const idx: u32 = @intFromEnum(name); | |
| 3020 | const idx: u32 = @backingInt(name); | |
| 3021 | 3021 | if (zir.string_bytes[idx] == 0) { |
| 3022 | 3022 | // Named test |
| 3023 | return @enumFromInt(idx + 1); | |
| 3023 | return @fromBackingInt(@intCast(idx + 1)); | |
| 3024 | 3024 | } |
| 3025 | return @enumFromInt(idx); | |
| 3025 | return @fromBackingInt(@intCast(idx)); | |
| 3026 | 3026 | } |
| 3027 | 3027 | }; |
| 3028 | 3028 | |
| ... | ... | @@ -3441,8 +3441,8 @@ pub const Inst = struct { |
| 3441 | 3441 | |
| 3442 | 3442 | pub fn wrap(unwrapped: ItemInfo.Unwrapped) ItemInfo { |
| 3443 | 3443 | const data_uncasted: u32 = switch (unwrapped) { |
| 3444 | .enum_literal => |str_index| @intFromEnum(str_index), | |
| 3445 | .error_value => |str_index| @intFromEnum(str_index), | |
| 3444 | .enum_literal => |str_index| @backingInt(str_index), | |
| 3445 | .error_value => |str_index| @backingInt(str_index), | |
| 3446 | 3446 | .body_len => |body_len| body_len, |
| 3447 | 3447 | .under => 0, |
| 3448 | 3448 | }; |
| ... | ... | @@ -3451,8 +3451,8 @@ pub const Inst = struct { |
| 3451 | 3451 | |
| 3452 | 3452 | pub fn unwrap(item_info: ItemInfo) ItemInfo.Unwrapped { |
| 3453 | 3453 | return switch (item_info.kind) { |
| 3454 | .enum_literal => .{ .enum_literal = @enumFromInt(item_info.data) }, | |
| 3455 | .error_value => .{ .error_value = @enumFromInt(item_info.data) }, | |
| 3454 | .enum_literal => .{ .enum_literal = @fromBackingInt(@intCast(item_info.data)) }, | |
| 3455 | .error_value => .{ .error_value = @fromBackingInt(@intCast(item_info.data)) }, | |
| 3456 | 3456 | .body_len => .{ .body_len = item_info.data }, |
| 3457 | 3457 | .under => .under, |
| 3458 | 3458 | }; |
| ... | ... | @@ -3557,29 +3557,29 @@ pub const Inst = struct { |
| 3557 | 3557 | }, |
| 3558 | 3558 | .instruction => |inst| .{ |
| 3559 | 3559 | .tag = .instruction, |
| 3560 | .data = @intCast(@intFromEnum(inst)), | |
| 3560 | .data = @intCast(@backingInt(inst)), | |
| 3561 | 3561 | }, |
| 3562 | 3562 | .instruction_load => |inst| .{ |
| 3563 | 3563 | .tag = .instruction_load, |
| 3564 | .data = @intCast(@intFromEnum(inst)), | |
| 3564 | .data = @intCast(@backingInt(inst)), | |
| 3565 | 3565 | }, |
| 3566 | 3566 | .decl_val => |str| .{ |
| 3567 | 3567 | .tag = .decl_val, |
| 3568 | .data = @intCast(@intFromEnum(str)), | |
| 3568 | .data = @intCast(@backingInt(str)), | |
| 3569 | 3569 | }, |
| 3570 | 3570 | .decl_ref => |str| .{ |
| 3571 | 3571 | .tag = .decl_ref, |
| 3572 | .data = @intCast(@intFromEnum(str)), | |
| 3572 | .data = @intCast(@backingInt(str)), | |
| 3573 | 3573 | }, |
| 3574 | 3574 | }; |
| 3575 | 3575 | } |
| 3576 | 3576 | pub fn unwrap(cap: Capture) Unwrapped { |
| 3577 | 3577 | return switch (cap.tag) { |
| 3578 | 3578 | .nested => .{ .nested = @intCast(cap.data) }, |
| 3579 | .instruction => .{ .instruction = @enumFromInt(cap.data) }, | |
| 3580 | .instruction_load => .{ .instruction_load = @enumFromInt(cap.data) }, | |
| 3581 | .decl_val => .{ .decl_val = @enumFromInt(cap.data) }, | |
| 3582 | .decl_ref => .{ .decl_ref = @enumFromInt(cap.data) }, | |
| 3579 | .instruction => .{ .instruction = @fromBackingInt(@intCast(cap.data)) }, | |
| 3580 | .instruction_load => .{ .instruction_load = @fromBackingInt(@intCast(cap.data)) }, | |
| 3581 | .decl_val => .{ .decl_val = @fromBackingInt(@intCast(cap.data)) }, | |
| 3582 | .decl_ref => .{ .decl_ref = @fromBackingInt(@intCast(cap.data)) }, | |
| 3583 | 3583 | }; |
| 3584 | 3584 | } |
| 3585 | 3585 | }; |
| ... | ... | @@ -4084,8 +4084,8 @@ pub fn findTrackableFields( |
| 4084 | 4084 | var found_defers: std.AutoHashMapUnmanaged(u32, void) = .empty; |
| 4085 | 4085 | defer found_defers.deinit(gpa); |
| 4086 | 4086 | |
| 4087 | assert(zir.instructions.items(.tag)[@intFromEnum(type_decl_inst)] == .extended); | |
| 4088 | switch (zir.instructions.items(.data)[@intFromEnum(type_decl_inst)].extended.opcode) { | |
| 4087 | assert(zir.instructions.items(.tag)[@backingInt(type_decl_inst)] == .extended); | |
| 4088 | switch (zir.instructions.items(.data)[@backingInt(type_decl_inst)].extended.opcode) { | |
| 4089 | 4089 | .struct_decl => { |
| 4090 | 4090 | const struct_decl = zir.getStructDecl(type_decl_inst); |
| 4091 | 4091 | var it = struct_decl.iterateFields(); |
| ... | ... | @@ -4128,7 +4128,7 @@ fn findTrackableInner( |
| 4128 | 4128 | const tags = zir.instructions.items(.tag); |
| 4129 | 4129 | const datas = zir.instructions.items(.data); |
| 4130 | 4130 | |
| 4131 | switch (tags[@intFromEnum(inst)]) { | |
| 4131 | switch (tags[@backingInt(inst)]) { | |
| 4132 | 4132 | .declaration => unreachable, |
| 4133 | 4133 | |
| 4134 | 4134 | // Boring instruction tags first. These have no body and are not declarations or type declarations. |
| ... | ... | @@ -4369,7 +4369,7 @@ fn findTrackableInner( |
| 4369 | 4369 | => return contents.other.append(gpa, inst), |
| 4370 | 4370 | |
| 4371 | 4371 | .extended => { |
| 4372 | const extended = datas[@intFromEnum(inst)].extended; | |
| 4372 | const extended = datas[@backingInt(inst)].extended; | |
| 4373 | 4373 | switch (extended.opcode) { |
| 4374 | 4374 | .value_placeholder => unreachable, |
| 4375 | 4375 | |
| ... | ... | @@ -4460,7 +4460,7 @@ fn findTrackableInner( |
| 4460 | 4460 | .func, |
| 4461 | 4461 | .func_inferred, |
| 4462 | 4462 | => { |
| 4463 | const inst_data = datas[@intFromEnum(inst)].pl_node; | |
| 4463 | const inst_data = datas[@backingInt(inst)].pl_node; | |
| 4464 | 4464 | const extra = zir.extraData(Inst.Func, inst_data.payload_index); |
| 4465 | 4465 | |
| 4466 | 4466 | if (extra.data.body_len == 0) { |
| ... | ... | @@ -4486,7 +4486,7 @@ fn findTrackableInner( |
| 4486 | 4486 | return zir.findTrackableBody(gpa, contents, defers, body); |
| 4487 | 4487 | }, |
| 4488 | 4488 | .func_fancy => { |
| 4489 | const inst_data = datas[@intFromEnum(inst)].pl_node; | |
| 4489 | const inst_data = datas[@backingInt(inst)].pl_node; | |
| 4490 | 4490 | const extra = zir.extraData(Inst.FuncFancy, inst_data.payload_index); |
| 4491 | 4491 | |
| 4492 | 4492 | if (extra.data.body_len == 0) { |
| ... | ... | @@ -4534,19 +4534,19 @@ fn findTrackableInner( |
| 4534 | 4534 | .typeof_builtin, |
| 4535 | 4535 | .loop, |
| 4536 | 4536 | => { |
| 4537 | const inst_data = datas[@intFromEnum(inst)].pl_node; | |
| 4537 | const inst_data = datas[@backingInt(inst)].pl_node; | |
| 4538 | 4538 | const extra = zir.extraData(Inst.Block, inst_data.payload_index); |
| 4539 | 4539 | const body = zir.bodySlice(extra.end, extra.data.body_len); |
| 4540 | 4540 | return zir.findTrackableBody(gpa, contents, defers, body); |
| 4541 | 4541 | }, |
| 4542 | 4542 | .block_comptime => { |
| 4543 | const inst_data = datas[@intFromEnum(inst)].pl_node; | |
| 4543 | const inst_data = datas[@backingInt(inst)].pl_node; | |
| 4544 | 4544 | const extra = zir.extraData(Inst.BlockComptime, inst_data.payload_index); |
| 4545 | 4545 | const body = zir.bodySlice(extra.end, extra.data.body_len); |
| 4546 | 4546 | return zir.findTrackableBody(gpa, contents, defers, body); |
| 4547 | 4547 | }, |
| 4548 | 4548 | .condbr, .condbr_inline => { |
| 4549 | const inst_data = datas[@intFromEnum(inst)].pl_node; | |
| 4549 | const inst_data = datas[@backingInt(inst)].pl_node; | |
| 4550 | 4550 | const extra = zir.extraData(Inst.CondBr, inst_data.payload_index); |
| 4551 | 4551 | const then_body = zir.bodySlice(extra.end, extra.data.then_body_len); |
| 4552 | 4552 | const else_body = zir.bodySlice(extra.end + then_body.len, extra.data.else_body_len); |
| ... | ... | @@ -4554,7 +4554,7 @@ fn findTrackableInner( |
| 4554 | 4554 | try zir.findTrackableBody(gpa, contents, defers, else_body); |
| 4555 | 4555 | }, |
| 4556 | 4556 | .@"try", .try_ptr => { |
| 4557 | const inst_data = datas[@intFromEnum(inst)].pl_node; | |
| 4557 | const inst_data = datas[@backingInt(inst)].pl_node; | |
| 4558 | 4558 | const extra = zir.extraData(Inst.Try, inst_data.payload_index); |
| 4559 | 4559 | const body = zir.bodySlice(extra.end, extra.data.body_len); |
| 4560 | 4560 | try zir.findTrackableBody(gpa, contents, defers, body); |
| ... | ... | @@ -4602,14 +4602,14 @@ fn findTrackableInner( |
| 4602 | 4602 | .suspend_block => @panic("TODO iterate suspend block"), |
| 4603 | 4603 | |
| 4604 | 4604 | .param, .param_comptime => { |
| 4605 | const inst_data = datas[@intFromEnum(inst)].pl_tok; | |
| 4605 | const inst_data = datas[@backingInt(inst)].pl_tok; | |
| 4606 | 4606 | const extra = zir.extraData(Inst.Param, inst_data.payload_index); |
| 4607 | 4607 | const body = zir.bodySlice(extra.end, extra.data.type.body_len); |
| 4608 | 4608 | try zir.findTrackableBody(gpa, contents, defers, body); |
| 4609 | 4609 | }, |
| 4610 | 4610 | |
| 4611 | 4611 | inline .call, .field_call => |tag| { |
| 4612 | const inst_data = datas[@intFromEnum(inst)].pl_node; | |
| 4612 | const inst_data = datas[@backingInt(inst)].pl_node; | |
| 4613 | 4613 | const extra = zir.extraData(switch (tag) { |
| 4614 | 4614 | .call => Inst.Call, |
| 4615 | 4615 | .field_call => Inst.FieldCall, |
| ... | ... | @@ -4625,7 +4625,7 @@ fn findTrackableInner( |
| 4625 | 4625 | } |
| 4626 | 4626 | }, |
| 4627 | 4627 | .@"defer" => { |
| 4628 | const inst_data = datas[@intFromEnum(inst)].@"defer"; | |
| 4628 | const inst_data = datas[@backingInt(inst)].@"defer"; | |
| 4629 | 4629 | const gop = try defers.getOrPut(gpa, inst_data.index); |
| 4630 | 4630 | if (!gop.found_existing) { |
| 4631 | 4631 | const body = zir.bodySlice(inst_data.index, inst_data.len); |
| ... | ... | @@ -4661,9 +4661,9 @@ pub const FnInfo = struct { |
| 4661 | 4661 | pub fn getParamBody(zir: Zir, fn_inst: Inst.Index) []const Zir.Inst.Index { |
| 4662 | 4662 | const tags = zir.instructions.items(.tag); |
| 4663 | 4663 | const datas = zir.instructions.items(.data); |
| 4664 | const inst_data = datas[@intFromEnum(fn_inst)].pl_node; | |
| 4664 | const inst_data = datas[@backingInt(fn_inst)].pl_node; | |
| 4665 | 4665 | |
| 4666 | const param_block_index = switch (tags[@intFromEnum(fn_inst)]) { | |
| 4666 | const param_block_index = switch (tags[@backingInt(fn_inst)]) { | |
| 4667 | 4667 | .func, .func_inferred => blk: { |
| 4668 | 4668 | const extra = zir.extraData(Inst.Func, inst_data.payload_index); |
| 4669 | 4669 | break :blk extra.data.param_block; |
| ... | ... | @@ -4675,9 +4675,9 @@ pub fn getParamBody(zir: Zir, fn_inst: Inst.Index) []const Zir.Inst.Index { |
| 4675 | 4675 | else => unreachable, |
| 4676 | 4676 | }; |
| 4677 | 4677 | |
| 4678 | switch (tags[@intFromEnum(param_block_index)]) { | |
| 4678 | switch (tags[@backingInt(param_block_index)]) { | |
| 4679 | 4679 | .block, .block_comptime, .block_inline => { |
| 4680 | const param_block = zir.extraData(Inst.Block, datas[@intFromEnum(param_block_index)].pl_node.payload_index); | |
| 4680 | const param_block = zir.extraData(Inst.Block, datas[@backingInt(param_block_index)].pl_node.payload_index); | |
| 4681 | 4681 | return zir.bodySlice(param_block.end, param_block.data.body_len); |
| 4682 | 4682 | }, |
| 4683 | 4683 | .declaration => { |
| ... | ... | @@ -4688,7 +4688,7 @@ pub fn getParamBody(zir: Zir, fn_inst: Inst.Index) []const Zir.Inst.Index { |
| 4688 | 4688 | } |
| 4689 | 4689 | |
| 4690 | 4690 | pub fn getParamName(zir: Zir, param_inst: Inst.Index) ?NullTerminatedString { |
| 4691 | const inst = zir.instructions.get(@intFromEnum(param_inst)); | |
| 4691 | const inst = zir.instructions.get(@backingInt(param_inst)); | |
| 4692 | 4692 | return switch (inst.tag) { |
| 4693 | 4693 | .param, .param_comptime => zir.extraData(Inst.Param, inst.data.pl_tok.payload_index).data.name, |
| 4694 | 4694 | .param_anytype, .param_anytype_comptime => inst.data.str_tok.start, |
| ... | ... | @@ -4706,9 +4706,9 @@ pub fn getFnInfo(zir: Zir, fn_inst: Inst.Index) FnInfo { |
| 4706 | 4706 | ret_ty_body: []const Inst.Index, |
| 4707 | 4707 | ret_ty_is_generic: bool, |
| 4708 | 4708 | ies: bool, |
| 4709 | } = switch (tags[@intFromEnum(fn_inst)]) { | |
| 4709 | } = switch (tags[@backingInt(fn_inst)]) { | |
| 4710 | 4710 | .func, .func_inferred => |tag| blk: { |
| 4711 | const inst_data = datas[@intFromEnum(fn_inst)].pl_node; | |
| 4711 | const inst_data = datas[@backingInt(fn_inst)].pl_node; | |
| 4712 | 4712 | const extra = zir.extraData(Inst.Func, inst_data.payload_index); |
| 4713 | 4713 | |
| 4714 | 4714 | var extra_index: usize = extra.end; |
| ... | ... | @@ -4720,7 +4720,7 @@ pub fn getFnInfo(zir: Zir, fn_inst: Inst.Index) FnInfo { |
| 4720 | 4720 | ret_ty_ref = .void_type; |
| 4721 | 4721 | }, |
| 4722 | 4722 | 1 => { |
| 4723 | ret_ty_ref = @enumFromInt(zir.extra[extra_index]); | |
| 4723 | ret_ty_ref = @fromBackingInt(@intCast(zir.extra[extra_index])); | |
| 4724 | 4724 | extra_index += 1; |
| 4725 | 4725 | }, |
| 4726 | 4726 | else => { |
| ... | ... | @@ -4742,7 +4742,7 @@ pub fn getFnInfo(zir: Zir, fn_inst: Inst.Index) FnInfo { |
| 4742 | 4742 | }; |
| 4743 | 4743 | }, |
| 4744 | 4744 | .func_fancy => blk: { |
| 4745 | const inst_data = datas[@intFromEnum(fn_inst)].pl_node; | |
| 4745 | const inst_data = datas[@backingInt(fn_inst)].pl_node; | |
| 4746 | 4746 | const extra = zir.extraData(Inst.FuncFancy, inst_data.payload_index); |
| 4747 | 4747 | |
| 4748 | 4748 | var extra_index: usize = extra.end; |
| ... | ... | @@ -4760,7 +4760,7 @@ pub fn getFnInfo(zir: Zir, fn_inst: Inst.Index) FnInfo { |
| 4760 | 4760 | ret_ty_body = zir.bodySlice(extra_index, body_len); |
| 4761 | 4761 | extra_index += ret_ty_body.len; |
| 4762 | 4762 | } else if (extra.data.bits.has_ret_ty_ref) { |
| 4763 | ret_ty_ref = @enumFromInt(zir.extra[extra_index]); | |
| 4763 | ret_ty_ref = @fromBackingInt(@intCast(zir.extra[extra_index])); | |
| 4764 | 4764 | extra_index += 1; |
| 4765 | 4765 | } else { |
| 4766 | 4766 | ret_ty_ref = .void_type; |
| ... | ... | @@ -4784,7 +4784,7 @@ pub fn getFnInfo(zir: Zir, fn_inst: Inst.Index) FnInfo { |
| 4784 | 4784 | const param_body = zir.getParamBody(fn_inst); |
| 4785 | 4785 | var total_params_len: u32 = 0; |
| 4786 | 4786 | for (param_body) |inst| { |
| 4787 | switch (tags[@intFromEnum(inst)]) { | |
| 4787 | switch (tags[@backingInt(inst)]) { | |
| 4788 | 4788 | .param, .param_comptime, .param_anytype, .param_anytype_comptime => { |
| 4789 | 4789 | total_params_len += 1; |
| 4790 | 4790 | }, |
| ... | ... | @@ -4804,8 +4804,8 @@ pub fn getFnInfo(zir: Zir, fn_inst: Inst.Index) FnInfo { |
| 4804 | 4804 | } |
| 4805 | 4805 | |
| 4806 | 4806 | pub fn getDeclaration(zir: Zir, inst: Zir.Inst.Index) Inst.Declaration.Unwrapped { |
| 4807 | assert(zir.instructions.items(.tag)[@intFromEnum(inst)] == .declaration); | |
| 4808 | const pl_node = zir.instructions.items(.data)[@intFromEnum(inst)].declaration; | |
| 4807 | assert(zir.instructions.items(.tag)[@backingInt(inst)] == .declaration); | |
| 4808 | const pl_node = zir.instructions.items(.data)[@backingInt(inst)].declaration; | |
| 4809 | 4809 | const extra = zir.extraData(Inst.Declaration, pl_node.payload_index); |
| 4810 | 4810 | |
| 4811 | 4811 | const flags_vals: [2]u32 = .{ extra.data.flags_0, extra.data.flags_1 }; |
| ... | ... | @@ -4816,13 +4816,13 @@ pub fn getDeclaration(zir: Zir, inst: Zir.Inst.Index) Inst.Declaration.Unwrapped |
| 4816 | 4816 | const name: NullTerminatedString = if (flags.id.hasName()) name: { |
| 4817 | 4817 | const name = zir.extra[extra_index]; |
| 4818 | 4818 | extra_index += 1; |
| 4819 | break :name @enumFromInt(name); | |
| 4819 | break :name @fromBackingInt(@intCast(name)); | |
| 4820 | 4820 | } else .empty; |
| 4821 | 4821 | |
| 4822 | 4822 | const lib_name: NullTerminatedString = if (flags.id.hasLibName()) lib_name: { |
| 4823 | 4823 | const lib_name = zir.extra[extra_index]; |
| 4824 | 4824 | extra_index += 1; |
| 4825 | break :lib_name @enumFromInt(lib_name); | |
| 4825 | break :lib_name @fromBackingInt(@intCast(lib_name)); | |
| 4826 | 4826 | } else .empty; |
| 4827 | 4827 | |
| 4828 | 4828 | const type_body_len: u32 = if (flags.id.hasTypeBody()) len: { |
| ... | ... | @@ -4877,9 +4877,9 @@ pub fn getDeclaration(zir: Zir, inst: Zir.Inst.Index) Inst.Declaration.Unwrapped |
| 4877 | 4877 | pub fn getAssociatedSrcHash(zir: Zir, inst: Zir.Inst.Index) ?std.zig.SrcHash { |
| 4878 | 4878 | const tag = zir.instructions.items(.tag); |
| 4879 | 4879 | const data = zir.instructions.items(.data); |
| 4880 | switch (tag[@intFromEnum(inst)]) { | |
| 4880 | switch (tag[@backingInt(inst)]) { | |
| 4881 | 4881 | .declaration => { |
| 4882 | const declaration = data[@intFromEnum(inst)].declaration; | |
| 4882 | const declaration = data[@backingInt(inst)].declaration; | |
| 4883 | 4883 | const extra = zir.extraData(Inst.Declaration, declaration.payload_index); |
| 4884 | 4884 | return @bitCast([4]u32{ |
| 4885 | 4885 | extra.data.src_hash_0, |
| ... | ... | @@ -4889,7 +4889,7 @@ pub fn getAssociatedSrcHash(zir: Zir, inst: Zir.Inst.Index) ?std.zig.SrcHash { |
| 4889 | 4889 | }); |
| 4890 | 4890 | }, |
| 4891 | 4891 | .func, .func_inferred => { |
| 4892 | const pl_node = data[@intFromEnum(inst)].pl_node; | |
| 4892 | const pl_node = data[@backingInt(inst)].pl_node; | |
| 4893 | 4893 | const extra = zir.extraData(Inst.Func, pl_node.payload_index); |
| 4894 | 4894 | if (extra.data.body_len == 0) { |
| 4895 | 4895 | // Function type or extern fn - no associated hash |
| ... | ... | @@ -4907,7 +4907,7 @@ pub fn getAssociatedSrcHash(zir: Zir, inst: Zir.Inst.Index) ?std.zig.SrcHash { |
| 4907 | 4907 | }); |
| 4908 | 4908 | }, |
| 4909 | 4909 | .func_fancy => { |
| 4910 | const pl_node = data[@intFromEnum(inst)].pl_node; | |
| 4910 | const pl_node = data[@backingInt(inst)].pl_node; | |
| 4911 | 4911 | const extra = zir.extraData(Inst.FuncFancy, pl_node.payload_index); |
| 4912 | 4912 | if (extra.data.body_len == 0) { |
| 4913 | 4913 | // Function type or extern fn - no associated hash |
| ... | ... | @@ -4936,7 +4936,7 @@ pub fn getAssociatedSrcHash(zir: Zir, inst: Zir.Inst.Index) ?std.zig.SrcHash { |
| 4936 | 4936 | .extended => {}, |
| 4937 | 4937 | else => return null, |
| 4938 | 4938 | } |
| 4939 | const extended = data[@intFromEnum(inst)].extended; | |
| 4939 | const extended = data[@backingInt(inst)].extended; | |
| 4940 | 4940 | switch (extended.opcode) { |
| 4941 | 4941 | .struct_decl => { |
| 4942 | 4942 | const extra = zir.extraData(Inst.StructDecl, extended.operand).data; |
| ... | ... | @@ -4970,12 +4970,12 @@ pub fn getAssociatedSrcHash(zir: Zir, inst: Zir.Inst.Index) ?std.zig.SrcHash { |
| 4970 | 4970 | } |
| 4971 | 4971 | |
| 4972 | 4972 | pub fn getSwitchBlock(zir: *const Zir, switch_inst: Inst.Index) UnwrappedSwitchBlock { |
| 4973 | const has_non_err = switch (zir.instructions.items(.tag)[@intFromEnum(switch_inst)]) { | |
| 4973 | const has_non_err = switch (zir.instructions.items(.tag)[@backingInt(switch_inst)]) { | |
| 4974 | 4974 | .switch_block, .switch_block_ref => false, |
| 4975 | 4975 | .switch_block_err_union => true, |
| 4976 | 4976 | else => unreachable, |
| 4977 | 4977 | }; |
| 4978 | const inst_data = zir.instructions.items(.data)[@intFromEnum(switch_inst)].pl_node; | |
| 4978 | const inst_data = zir.instructions.items(.data)[@backingInt(switch_inst)].pl_node; | |
| 4979 | 4979 | const extra = zir.extraData(Inst.SwitchBlock, inst_data.payload_index); |
| 4980 | 4980 | const bits = extra.data.bits; |
| 4981 | 4981 | var extra_index = extra.end; |
| ... | ... | @@ -4985,17 +4985,17 @@ pub fn getSwitchBlock(zir: *const Zir, switch_inst: Inst.Index) UnwrappedSwitchB |
| 4985 | 4985 | break :len multi_cases_len; |
| 4986 | 4986 | } else 0; |
| 4987 | 4987 | const payload_capture_placeholder: Inst.OptionalIndex = if (bits.payload_capture_inst_is_placeholder) inst: { |
| 4988 | const inst: Inst.Index = @enumFromInt(zir.extra[extra_index]); | |
| 4988 | const inst: Inst.Index = @fromBackingInt(@intCast(zir.extra[extra_index])); | |
| 4989 | 4989 | extra_index += 1; |
| 4990 | 4990 | break :inst inst.toOptional(); |
| 4991 | 4991 | } else .none; |
| 4992 | 4992 | const tag_capture_placeholder: Inst.OptionalIndex = if (bits.tag_capture_inst_is_placeholder) inst: { |
| 4993 | const inst: Inst.Index = @enumFromInt(zir.extra[extra_index]); | |
| 4993 | const inst: Inst.Index = @fromBackingInt(@intCast(zir.extra[extra_index])); | |
| 4994 | 4994 | extra_index += 1; |
| 4995 | 4995 | break :inst inst.toOptional(); |
| 4996 | 4996 | } else .none; |
| 4997 | 4997 | const catch_or_if_src_node_offset: Ast.Node.OptionalOffset = if (has_non_err) node_offset: { |
| 4998 | const node_offset: Ast.Node.Offset = @enumFromInt(@as(i32, @bitCast(zir.extra[extra_index]))); | |
| 4998 | const node_offset: Ast.Node.Offset = @fromBackingInt(@intCast(@as(i32, @bitCast(zir.extra[extra_index])))); | |
| 4999 | 4999 | extra_index += 1; |
| 5000 | 5000 | break :node_offset node_offset.toOptional(); |
| 5001 | 5001 | } else .none; |
| ... | ... | @@ -5212,7 +5212,7 @@ pub const inst_tracking_version = 0; |
| 5212 | 5212 | /// thus may be given an `InternPool.TrackedInst`. |
| 5213 | 5213 | pub fn assertTrackable(zir: Zir, inst_idx: Zir.Inst.Index) void { |
| 5214 | 5214 | comptime assert(Zir.inst_tracking_version == 0); |
| 5215 | const inst = zir.instructions.get(@intFromEnum(inst_idx)); | |
| 5215 | const inst = zir.instructions.get(@backingInt(inst_idx)); | |
| 5216 | 5216 | switch (inst.tag) { |
| 5217 | 5217 | .struct_init, |
| 5218 | 5218 | .struct_init_ref, |
| ... | ... | @@ -5246,7 +5246,7 @@ pub fn assertTrackable(zir: Zir, inst_idx: Zir.Inst.Index) void { |
| 5246 | 5246 | } |
| 5247 | 5247 | |
| 5248 | 5248 | pub fn typeDecls(zir: Zir, type_decl: Inst.Index) []const Zir.Inst.Index { |
| 5249 | const inst = zir.instructions.get(@intFromEnum(type_decl)); | |
| 5249 | const inst = zir.instructions.get(@backingInt(type_decl)); | |
| 5250 | 5250 | assert(inst.tag == .extended); |
| 5251 | 5251 | return switch (inst.data.extended.opcode) { |
| 5252 | 5252 | .struct_decl => zir.getStructDecl(type_decl).decls, |
| ... | ... | @@ -5258,7 +5258,7 @@ pub fn typeDecls(zir: Zir, type_decl: Inst.Index) []const Zir.Inst.Index { |
| 5258 | 5258 | } |
| 5259 | 5259 | |
| 5260 | 5260 | pub fn getStructDecl(zir: *const Zir, struct_decl: Inst.Index) UnwrappedStructDecl { |
| 5261 | const inst_data = zir.instructions.get(@intFromEnum(struct_decl)); | |
| 5261 | const inst_data = zir.instructions.get(@backingInt(struct_decl)); | |
| 5262 | 5262 | assert(inst_data.tag == .extended); |
| 5263 | 5263 | assert(inst_data.data.extended.opcode == .struct_decl); |
| 5264 | 5264 | const small: Inst.StructDecl.Small = @bitCast(inst_data.data.extended.small); |
| ... | ... | @@ -5409,7 +5409,7 @@ pub const UnwrappedStructDecl = struct { |
| 5409 | 5409 | }; |
| 5410 | 5410 | |
| 5411 | 5411 | pub fn getUnionDecl(zir: *const Zir, union_decl: Inst.Index) UnwrappedUnionDecl { |
| 5412 | const inst_data = zir.instructions.get(@intFromEnum(union_decl)); | |
| 5412 | const inst_data = zir.instructions.get(@backingInt(union_decl)); | |
| 5413 | 5413 | assert(inst_data.tag == .extended); |
| 5414 | 5414 | assert(inst_data.data.extended.opcode == .union_decl); |
| 5415 | 5415 | const small: Inst.UnionDecl.Small = @bitCast(inst_data.data.extended.small); |
| ... | ... | @@ -5543,7 +5543,7 @@ pub const UnwrappedUnionDecl = struct { |
| 5543 | 5543 | }; |
| 5544 | 5544 | |
| 5545 | 5545 | pub fn getEnumDecl(zir: *const Zir, enum_decl: Inst.Index) UnwrappedEnumDecl { |
| 5546 | const inst_data = zir.instructions.get(@intFromEnum(enum_decl)); | |
| 5546 | const inst_data = zir.instructions.get(@backingInt(enum_decl)); | |
| 5547 | 5547 | assert(inst_data.tag == .extended); |
| 5548 | 5548 | assert(inst_data.data.extended.opcode == .enum_decl); |
| 5549 | 5549 | const small: Inst.EnumDecl.Small = @bitCast(inst_data.data.extended.small); |
| ... | ... | @@ -5658,7 +5658,7 @@ pub const UnwrappedEnumDecl = struct { |
| 5658 | 5658 | }; |
| 5659 | 5659 | |
| 5660 | 5660 | pub fn getOpaqueDecl(zir: *const Zir, opaque_decl: Inst.Index) UnwrappedOpaqueDecl { |
| 5661 | const inst_data = zir.instructions.get(@intFromEnum(opaque_decl)); | |
| 5661 | const inst_data = zir.instructions.get(@backingInt(opaque_decl)); | |
| 5662 | 5662 | assert(inst_data.tag == .extended); |
| 5663 | 5663 | assert(inst_data.data.extended.opcode == .opaque_decl); |
| 5664 | 5664 | const small: Inst.OpaqueDecl.Small = @bitCast(inst_data.data.extended.small); |
lib/std/zig/Zoir.zig+9-9| ... | ... | @@ -106,7 +106,7 @@ pub const Node = union(enum) { |
| 106 | 106 | _, |
| 107 | 107 | |
| 108 | 108 | pub fn get(idx: Index, zoir: Zoir) Node { |
| 109 | const repr = zoir.nodes.get(@intFromEnum(idx)); | |
| 109 | const repr = zoir.nodes.get(@backingInt(idx)); | |
| 110 | 110 | return switch (repr.tag) { |
| 111 | 111 | .true => .true, |
| 112 | 112 | .false => .false, |
| ... | ... | @@ -129,30 +129,30 @@ pub const Node = union(enum) { |
| 129 | 129 | .float_literal_small => .{ .float_literal = @as(f32, @bitCast(repr.data)) }, |
| 130 | 130 | .float_literal => .{ .float_literal = @bitCast(zoir.extra[repr.data..][0..4].*) }, |
| 131 | 131 | .char_literal => .{ .char_literal = @intCast(repr.data) }, |
| 132 | .enum_literal => .{ .enum_literal = @enumFromInt(repr.data) }, | |
| 132 | .enum_literal => .{ .enum_literal = @fromBackingInt(@intCast(repr.data)) }, | |
| 133 | 133 | .string_literal => .{ .string_literal = s: { |
| 134 | 134 | const start, const len = zoir.extra[repr.data..][0..2].*; |
| 135 | 135 | break :s zoir.string_bytes[start..][0..len]; |
| 136 | 136 | } }, |
| 137 | .string_literal_null => .{ .string_literal = NullTerminatedString.get(@enumFromInt(repr.data), zoir) }, | |
| 137 | .string_literal_null => .{ .string_literal = NullTerminatedString.get(@fromBackingInt(@intCast(repr.data)), zoir) }, | |
| 138 | 138 | .empty_literal => .empty_literal, |
| 139 | 139 | .array_literal => .{ .array_literal = a: { |
| 140 | 140 | const elem_count, const first_elem = zoir.extra[repr.data..][0..2].*; |
| 141 | break :a .{ .start = @enumFromInt(first_elem), .len = elem_count }; | |
| 141 | break :a .{ .start = @fromBackingInt(@intCast(first_elem)), .len = elem_count }; | |
| 142 | 142 | } }, |
| 143 | 143 | .struct_literal => .{ .struct_literal = s: { |
| 144 | 144 | const elem_count, const first_elem = zoir.extra[repr.data..][0..2].*; |
| 145 | 145 | const field_names = zoir.extra[repr.data + 2 ..][0..elem_count]; |
| 146 | 146 | break :s .{ |
| 147 | 147 | .names = @ptrCast(field_names), |
| 148 | .vals = .{ .start = @enumFromInt(first_elem), .len = elem_count }, | |
| 148 | .vals = .{ .start = @fromBackingInt(@intCast(first_elem)), .len = elem_count }, | |
| 149 | 149 | }; |
| 150 | 150 | } }, |
| 151 | 151 | }; |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | pub fn getAstNode(idx: Index, zoir: Zoir) std.zig.Ast.Node.Index { |
| 155 | return zoir.nodes.items(.ast_node)[@intFromEnum(idx)]; | |
| 155 | return zoir.nodes.items(.ast_node)[@backingInt(idx)]; | |
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | pub const Range = struct { |
| ... | ... | @@ -161,7 +161,7 @@ pub const Node = union(enum) { |
| 161 | 161 | |
| 162 | 162 | pub fn at(r: Range, i: u32) Index { |
| 163 | 163 | assert(i < r.len); |
| 164 | return @enumFromInt(@intFromEnum(r.start) + i); | |
| 164 | return @fromBackingInt(@intCast(@backingInt(r.start) + i)); | |
| 165 | 165 | } |
| 166 | 166 | }; |
| 167 | 167 | }; |
| ... | ... | @@ -228,8 +228,8 @@ pub const Node = union(enum) { |
| 228 | 228 | pub const NullTerminatedString = enum(u32) { |
| 229 | 229 | _, |
| 230 | 230 | pub fn get(nts: NullTerminatedString, zoir: Zoir) [:0]const u8 { |
| 231 | const idx = std.mem.findScalar(u8, zoir.string_bytes[@intFromEnum(nts)..], 0).?; | |
| 232 | return zoir.string_bytes[@intFromEnum(nts)..][0..idx :0]; | |
| 231 | const idx = std.mem.findScalar(u8, zoir.string_bytes[@backingInt(nts)..], 0).?; | |
| 232 | return zoir.string_bytes[@backingInt(nts)..][0..idx :0]; | |
| 233 | 233 | } |
| 234 | 234 | }; |
| 235 | 235 |
lib/std/zig/ZonGen.zig+17-17| ... | ... | @@ -327,14 +327,14 @@ fn expr(zg: *ZonGen, node: Ast.Node.Index, dest_node: Zoir.Node.Index) Allocator |
| 327 | 327 | }; |
| 328 | 328 | zg.setNode(dest_node, .{ |
| 329 | 329 | .tag = .enum_literal, |
| 330 | .data = @intFromEnum(str_index), | |
| 330 | .data = @backingInt(str_index), | |
| 331 | 331 | .ast_node = node, |
| 332 | 332 | }); |
| 333 | 333 | }, |
| 334 | 334 | .string_literal, .multiline_string_literal => if (zg.strLitAsString(node)) |result| switch (result) { |
| 335 | 335 | .nts => |nts| zg.setNode(dest_node, .{ |
| 336 | 336 | .tag = .string_literal_null, |
| 337 | .data = @intFromEnum(nts), | |
| 337 | .data = @backingInt(nts), | |
| 338 | 338 | .ast_node = node, |
| 339 | 339 | }), |
| 340 | 340 | .slice => |slice| { |
| ... | ... | @@ -377,7 +377,7 @@ fn expr(zg: *ZonGen, node: Ast.Node.Index, dest_node: Zoir.Node.Index) Allocator |
| 377 | 377 | }); |
| 378 | 378 | |
| 379 | 379 | for (full.ast.elements, first_elem..) |elem_node, elem_dest_node| { |
| 380 | try zg.expr(elem_node, @enumFromInt(elem_dest_node)); | |
| 380 | try zg.expr(elem_node, @fromBackingInt(@intCast(elem_dest_node))); | |
| 381 | 381 | } |
| 382 | 382 | }, |
| 383 | 383 | |
| ... | ... | @@ -429,7 +429,7 @@ fn expr(zg: *ZonGen, node: Ast.Node.Index, dest_node: Zoir.Node.Index) Allocator |
| 429 | 429 | for (full.ast.fields, names_start.., first_elem..) |elem_node, extra_name_idx, elem_dest_node| { |
| 430 | 430 | const name_token = tree.firstToken(elem_node) - 2; |
| 431 | 431 | if (zg.identAsString(name_token)) |name_str| { |
| 432 | zg.extra.items[extra_name_idx] = @intFromEnum(name_str); | |
| 432 | zg.extra.items[extra_name_idx] = @backingInt(name_str); | |
| 433 | 433 | const gop = try field_names.getOrPut(bfa, name_str); |
| 434 | 434 | if (gop.found_existing and !reported_any_duplicate) { |
| 435 | 435 | reported_any_duplicate = true; |
| ... | ... | @@ -443,7 +443,7 @@ fn expr(zg: *ZonGen, node: Ast.Node.Index, dest_node: Zoir.Node.Index) Allocator |
| 443 | 443 | error.BadString => {}, // there's an error, so it's fine to not populate `zg.extra` |
| 444 | 444 | error.OutOfMemory => |e| return e, |
| 445 | 445 | } |
| 446 | try zg.expr(elem_node, @enumFromInt(elem_dest_node)); | |
| 446 | try zg.expr(elem_node, @fromBackingInt(@intCast(elem_dest_node))); | |
| 447 | 447 | } |
| 448 | 448 | }, |
| 449 | 449 | } |
| ... | ... | @@ -590,11 +590,11 @@ fn strLitAsString(zg: *ZonGen, str_node: Ast.Node.Index) error{ OutOfMemory, Bad |
| 590 | 590 | ); |
| 591 | 591 | if (gop.found_existing) { |
| 592 | 592 | string_bytes.shrinkRetainingCapacity(str_index); |
| 593 | return .{ .nts = @enumFromInt(gop.key_ptr.*) }; | |
| 593 | return .{ .nts = @fromBackingInt(@intCast(gop.key_ptr.*)) }; | |
| 594 | 594 | } |
| 595 | 595 | gop.key_ptr.* = str_index; |
| 596 | 596 | try string_bytes.append(gpa, 0); |
| 597 | return .{ .nts = @enumFromInt(str_index) }; | |
| 597 | return .{ .nts = @fromBackingInt(@intCast(str_index)) }; | |
| 598 | 598 | } |
| 599 | 599 | |
| 600 | 600 | fn identAsString(zg: *ZonGen, ident_token: Ast.TokenIndex) !Zoir.NullTerminatedString { |
| ... | ... | @@ -610,11 +610,11 @@ fn identAsString(zg: *ZonGen, ident_token: Ast.TokenIndex) !Zoir.NullTerminatedS |
| 610 | 610 | ); |
| 611 | 611 | if (gop.found_existing) { |
| 612 | 612 | string_bytes.shrinkRetainingCapacity(str_index); |
| 613 | return @enumFromInt(gop.key_ptr.*); | |
| 613 | return @fromBackingInt(@intCast(gop.key_ptr.*)); | |
| 614 | 614 | } |
| 615 | 615 | gop.key_ptr.* = str_index; |
| 616 | 616 | try string_bytes.append(gpa, 0); |
| 617 | return @enumFromInt(str_index); | |
| 617 | return @fromBackingInt(@intCast(str_index)); | |
| 618 | 618 | } |
| 619 | 619 | |
| 620 | 620 | fn numberLiteral(zg: *ZonGen, num_node: Ast.Node.Index, src_node: Ast.Node.Index, dest_node: Zoir.Node.Index, sign: enum { negative, positive }) !void { |
| ... | ... | @@ -656,7 +656,7 @@ fn numberLiteral(zg: *ZonGen, num_node: Ast.Node.Index, src_node: Ast.Node.Index |
| 656 | 656 | }; |
| 657 | 657 | var big_int: std.math.big.int.Managed = try .init(gpa); |
| 658 | 658 | defer big_int.deinit(); |
| 659 | big_int.setString(@intFromEnum(base), num_without_prefix) catch |err| switch (err) { | |
| 659 | big_int.setString(@backingInt(base), num_without_prefix) catch |err| switch (err) { | |
| 660 | 660 | error.InvalidCharacter => unreachable, // caught in `parseNumberLiteral` |
| 661 | 661 | error.InvalidBase => unreachable, // we only pass 16, 8, 2, see above |
| 662 | 662 | error.OutOfMemory => |e| return e, |
| ... | ... | @@ -763,7 +763,7 @@ fn identifier(zg: *ZonGen, node: Ast.Node.Index, dest_node: Zoir.Node.Index) !vo |
| 763 | 763 | } |
| 764 | 764 | |
| 765 | 765 | fn setNode(zg: *ZonGen, dest: Zoir.Node.Index, repr: Zoir.Node.Repr) void { |
| 766 | zg.nodes.set(@intFromEnum(dest), repr); | |
| 766 | zg.nodes.set(@backingInt(dest), repr); | |
| 767 | 767 | } |
| 768 | 768 | |
| 769 | 769 | fn lowerStrLitError( |
| ... | ... | @@ -812,9 +812,9 @@ fn errNoteNode(zg: *ZonGen, node: Ast.Node.Index, comptime format: []const u8, a |
| 812 | 812 | const message_idx: u32 = @intCast(zg.string_bytes.items.len); |
| 813 | 813 | try zg.string_bytes.print(zg.gpa, format ++ "\x00", args); |
| 814 | 814 | return .{ |
| 815 | .msg = @enumFromInt(message_idx), | |
| 815 | .msg = @fromBackingInt(@intCast(message_idx)), | |
| 816 | 816 | .token = .none, |
| 817 | .node_or_offset = @intFromEnum(node), | |
| 817 | .node_or_offset = @backingInt(node), | |
| 818 | 818 | }; |
| 819 | 819 | } |
| 820 | 820 | |
| ... | ... | @@ -822,20 +822,20 @@ fn errNoteTok(zg: *ZonGen, tok: Ast.TokenIndex, comptime format: []const u8, arg |
| 822 | 822 | const message_idx: u32 = @intCast(zg.string_bytes.items.len); |
| 823 | 823 | try zg.string_bytes.print(zg.gpa, format ++ "\x00", args); |
| 824 | 824 | return .{ |
| 825 | .msg = @enumFromInt(message_idx), | |
| 825 | .msg = @fromBackingInt(@intCast(message_idx)), | |
| 826 | 826 | .token = .fromToken(tok), |
| 827 | 827 | .node_or_offset = 0, |
| 828 | 828 | }; |
| 829 | 829 | } |
| 830 | 830 | |
| 831 | 831 | fn addErrorNode(zg: *ZonGen, node: Ast.Node.Index, comptime format: []const u8, args: anytype) Allocator.Error!void { |
| 832 | return zg.addErrorInner(.none, @intFromEnum(node), format, args, &.{}); | |
| 832 | return zg.addErrorInner(.none, @backingInt(node), format, args, &.{}); | |
| 833 | 833 | } |
| 834 | 834 | fn addErrorTok(zg: *ZonGen, tok: Ast.TokenIndex, comptime format: []const u8, args: anytype) Allocator.Error!void { |
| 835 | 835 | return zg.addErrorInner(.fromToken(tok), 0, format, args, &.{}); |
| 836 | 836 | } |
| 837 | 837 | fn addErrorNodeNotes(zg: *ZonGen, node: Ast.Node.Index, comptime format: []const u8, args: anytype, notes: []const Zoir.CompileError.Note) Allocator.Error!void { |
| 838 | return zg.addErrorInner(.none, @intFromEnum(node), format, args, notes); | |
| 838 | return zg.addErrorInner(.none, @backingInt(node), format, args, notes); | |
| 839 | 839 | } |
| 840 | 840 | fn addErrorTokNotes(zg: *ZonGen, tok: Ast.TokenIndex, comptime format: []const u8, args: anytype, notes: []const Zoir.CompileError.Note) Allocator.Error!void { |
| 841 | 841 | return zg.addErrorInner(.fromToken(tok), 0, format, args, notes); |
| ... | ... | @@ -864,7 +864,7 @@ fn addErrorInner( |
| 864 | 864 | try zg.string_bytes.print(gpa, format ++ "\x00", args); |
| 865 | 865 | |
| 866 | 866 | try zg.compile_errors.append(gpa, .{ |
| 867 | .msg = @enumFromInt(message_idx), | |
| 867 | .msg = @fromBackingInt(@intCast(message_idx)), | |
| 868 | 868 | .token = token, |
| 869 | 869 | .node_or_offset = node_or_offset, |
| 870 | 870 | .first_note = first_note, |
lib/std/zig/llvm/BitcodeReader.zig+12-12| ... | ... | @@ -70,23 +70,23 @@ pub const Record = struct { |
| 70 | 70 | try operands.append(.{ .literal = record.operands[i + 1] }); |
| 71 | 71 | i += 2; |
| 72 | 72 | }, |
| 73 | @intFromEnum(Abbrev.Operand.Encoding.fixed) => { | |
| 73 | @backingInt(Abbrev.Operand.Encoding.fixed) => { | |
| 74 | 74 | try operands.append(.{ .encoding = .{ .fixed = @intCast(record.operands[i + 1]) } }); |
| 75 | 75 | i += 2; |
| 76 | 76 | }, |
| 77 | @intFromEnum(Abbrev.Operand.Encoding.vbr) => { | |
| 77 | @backingInt(Abbrev.Operand.Encoding.vbr) => { | |
| 78 | 78 | try operands.append(.{ .encoding = .{ .vbr = @intCast(record.operands[i + 1]) } }); |
| 79 | 79 | i += 2; |
| 80 | 80 | }, |
| 81 | @intFromEnum(Abbrev.Operand.Encoding.array) => { | |
| 81 | @backingInt(Abbrev.Operand.Encoding.array) => { | |
| 82 | 82 | try operands.append(.{ .encoding = .{ .array = 6 } }); |
| 83 | 83 | i += 1; |
| 84 | 84 | }, |
| 85 | @intFromEnum(Abbrev.Operand.Encoding.char6) => { | |
| 85 | @backingInt(Abbrev.Operand.Encoding.char6) => { | |
| 86 | 86 | try operands.append(.{ .encoding = .char6 }); |
| 87 | 87 | i += 1; |
| 88 | 88 | }, |
| 89 | @intFromEnum(Abbrev.Operand.Encoding.blob) => { | |
| 89 | @backingInt(Abbrev.Operand.Encoding.blob) => { | |
| 90 | 90 | try operands.append(.{ .encoding = .{ .blob = 6 } }); |
| 91 | 91 | i += 1; |
| 92 | 92 | }, |
| ... | ... | @@ -225,8 +225,8 @@ fn nextRecord(bc: *BitcodeReader) !?Record { |
| 225 | 225 | }), |
| 226 | 226 | 0 => { |
| 227 | 227 | const encoding: Abbrev.Operand.Encoding = |
| 228 | @enumFromInt(try bc.readFixed(u3, 3)); | |
| 229 | try operands.append(@intFromEnum(encoding)); | |
| 228 | @fromBackingInt(@intCast(try bc.readFixed(u3, 3))); | |
| 229 | try operands.append(@backingInt(encoding)); | |
| 230 | 230 | switch (encoding) { |
| 231 | 231 | .fixed, .vbr => try operands.append(try bc.readVbr(u7, 5)), |
| 232 | 232 | .array, .char6, .blob => {}, |
| ... | ... | @@ -285,14 +285,14 @@ fn startBlock(bc: *BitcodeReader, block_id: ?u32, new_abbrev_len: u6) !void { |
| 285 | 285 | @typeInfo(Abbrev.Builtin).@"enum".field_names.len + abbrevs.len, |
| 286 | 286 | ); |
| 287 | 287 | |
| 288 | assert(state.abbrevs.abbrevs.items.len == @intFromEnum(Abbrev.Builtin.end_block)); | |
| 288 | assert(state.abbrevs.abbrevs.items.len == @backingInt(Abbrev.Builtin.end_block)); | |
| 289 | 289 | try state.abbrevs.addAbbrevAssumeCapacity(bc.allocator, .{ |
| 290 | 290 | .operands = &.{ |
| 291 | 291 | .{ .literal = Abbrev.Builtin.end_block.toRecordId() }, |
| 292 | 292 | .align_32_bits, |
| 293 | 293 | }, |
| 294 | 294 | }); |
| 295 | assert(state.abbrevs.abbrevs.items.len == @intFromEnum(Abbrev.Builtin.enter_subblock)); | |
| 295 | assert(state.abbrevs.abbrevs.items.len == @backingInt(Abbrev.Builtin.enter_subblock)); | |
| 296 | 296 | try state.abbrevs.addAbbrevAssumeCapacity(bc.allocator, .{ |
| 297 | 297 | .operands = &.{ |
| 298 | 298 | .{ .literal = Abbrev.Builtin.enter_subblock.toRecordId() }, |
| ... | ... | @@ -302,7 +302,7 @@ fn startBlock(bc: *BitcodeReader, block_id: ?u32, new_abbrev_len: u6) !void { |
| 302 | 302 | .block_len, |
| 303 | 303 | }, |
| 304 | 304 | }); |
| 305 | assert(state.abbrevs.abbrevs.items.len == @intFromEnum(Abbrev.Builtin.define_abbrev)); | |
| 305 | assert(state.abbrevs.abbrevs.items.len == @backingInt(Abbrev.Builtin.define_abbrev)); | |
| 306 | 306 | try state.abbrevs.addAbbrevAssumeCapacity(bc.allocator, .{ |
| 307 | 307 | .operands = &.{ |
| 308 | 308 | .{ .literal = Abbrev.Builtin.define_abbrev.toRecordId() }, |
| ... | ... | @@ -310,7 +310,7 @@ fn startBlock(bc: *BitcodeReader, block_id: ?u32, new_abbrev_len: u6) !void { |
| 310 | 310 | .abbrev_op, |
| 311 | 311 | }, |
| 312 | 312 | }); |
| 313 | assert(state.abbrevs.abbrevs.items.len == @intFromEnum(Abbrev.Builtin.unabbrev_record)); | |
| 313 | assert(state.abbrevs.abbrevs.items.len == @backingInt(Abbrev.Builtin.unabbrev_record)); | |
| 314 | 314 | try state.abbrevs.addAbbrevAssumeCapacity(bc.allocator, .{ |
| 315 | 315 | .operands = &.{ |
| 316 | 316 | .{ .encoding = .{ .vbr = 6 } }, // code |
| ... | ... | @@ -459,7 +459,7 @@ const Abbrev = struct { |
| 459 | 459 | |
| 460 | 460 | const first_record_id: u32 = std.math.maxInt(u32) - @typeInfo(Builtin).@"enum".field_names.len + 1; |
| 461 | 461 | fn toRecordId(builtin: Builtin) u32 { |
| 462 | return first_record_id + @intFromEnum(builtin); | |
| 462 | return first_record_id + @backingInt(builtin); | |
| 463 | 463 | } |
| 464 | 464 | }; |
| 465 | 465 |
lib/std/zig/llvm/Builder.zig+379-379| ... | ... | @@ -112,7 +112,7 @@ pub const String = enum(u32) { |
| 112 | 112 | fn format(data: FormatData, w: *Writer) Writer.Error!void { |
| 113 | 113 | assert(data.string != .none); |
| 114 | 114 | const string_slice = data.string.slice(data.builder) orelse |
| 115 | return w.print("{d}", .{@intFromEnum(data.string)}); | |
| 115 | return w.print("{d}", .{@backingInt(data.string)}); | |
| 116 | 116 | const quote_behavior = data.quote_behavior orelse return w.writeAll(string_slice); |
| 117 | 117 | return printEscapedString(string_slice, quote_behavior, w); |
| 118 | 118 | } |
| ... | ... | @@ -142,12 +142,12 @@ pub const String = enum(u32) { |
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | fn fromIndex(index: ?usize) String { |
| 145 | return @enumFromInt(@as(u32, @intCast((index orelse return .none) + | |
| 146 | @intFromEnum(String.empty)))); | |
| 145 | return @fromBackingInt(@intCast(@as(u32, @intCast((index orelse return .none) + | |
| 146 | @backingInt(String.empty))))); | |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | fn toIndex(self: String) ?usize { |
| 150 | return std.math.sub(u32, @intFromEnum(self), @intFromEnum(String.empty)) catch null; | |
| 150 | return std.math.sub(u32, @backingInt(self), @backingInt(String.empty)) catch null; | |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | const Adapter = struct { |
| ... | ... | @@ -272,19 +272,19 @@ pub const Type = enum(u32) { |
| 272 | 272 | |
| 273 | 273 | pub const Simple = enum(u5) { |
| 274 | 274 | const Code = ir.ModuleBlock.TypeBlock.Code; |
| 275 | void = @intFromEnum(Code.VOID), | |
| 276 | half = @intFromEnum(Code.HALF), | |
| 277 | bfloat = @intFromEnum(Code.BFLOAT), | |
| 278 | float = @intFromEnum(Code.FLOAT), | |
| 279 | double = @intFromEnum(Code.DOUBLE), | |
| 280 | fp128 = @intFromEnum(Code.FP128), | |
| 281 | x86_fp80 = @intFromEnum(Code.X86_FP80), | |
| 282 | ppc_fp128 = @intFromEnum(Code.PPC_FP128), | |
| 283 | x86_amx = @intFromEnum(Code.X86_AMX), | |
| 284 | x86_mmx = @intFromEnum(Code.X86_MMX), | |
| 285 | label = @intFromEnum(Code.LABEL), | |
| 286 | token = @intFromEnum(Code.TOKEN), | |
| 287 | metadata = @intFromEnum(Code.METADATA), | |
| 275 | void = @backingInt(Code.VOID), | |
| 276 | half = @backingInt(Code.HALF), | |
| 277 | bfloat = @backingInt(Code.BFLOAT), | |
| 278 | float = @backingInt(Code.FLOAT), | |
| 279 | double = @backingInt(Code.DOUBLE), | |
| 280 | fp128 = @backingInt(Code.FP128), | |
| 281 | x86_fp80 = @backingInt(Code.X86_FP80), | |
| 282 | ppc_fp128 = @backingInt(Code.PPC_FP128), | |
| 283 | x86_amx = @backingInt(Code.X86_AMX), | |
| 284 | x86_mmx = @backingInt(Code.X86_MMX), | |
| 285 | label = @backingInt(Code.LABEL), | |
| 286 | token = @backingInt(Code.TOKEN), | |
| 287 | metadata = @backingInt(Code.METADATA), | |
| 288 | 288 | }; |
| 289 | 289 | |
| 290 | 290 | pub const Function = struct { |
| ... | ... | @@ -344,11 +344,11 @@ pub const Type = enum(u32) { |
| 344 | 344 | }; |
| 345 | 345 | |
| 346 | 346 | pub fn tag(self: Type, builder: *const Builder) Tag { |
| 347 | return builder.type_items.items[@intFromEnum(self)].tag; | |
| 347 | return builder.type_items.items[@backingInt(self)].tag; | |
| 348 | 348 | } |
| 349 | 349 | |
| 350 | 350 | pub fn unnamedTag(self: Type, builder: *const Builder) Tag { |
| 351 | const item = builder.type_items.items[@intFromEnum(self)]; | |
| 351 | const item = builder.type_items.items[@backingInt(self)]; | |
| 352 | 352 | return switch (item.tag) { |
| 353 | 353 | .named_structure => builder.typeExtraData(Type.NamedStructure, item.data).body |
| 354 | 354 | .unnamedTag(builder), |
| ... | ... | @@ -357,7 +357,7 @@ pub const Type = enum(u32) { |
| 357 | 357 | } |
| 358 | 358 | |
| 359 | 359 | pub fn scalarTag(self: Type, builder: *const Builder) Tag { |
| 360 | const item = builder.type_items.items[@intFromEnum(self)]; | |
| 360 | const item = builder.type_items.items[@backingInt(self)]; | |
| 361 | 361 | return switch (item.tag) { |
| 362 | 362 | .vector, .scalable_vector => builder.typeExtraData(Type.Vector, item.data) |
| 363 | 363 | .child.tag(builder), |
| ... | ... | @@ -396,9 +396,9 @@ pub const Type = enum(u32) { |
| 396 | 396 | switch (self) { |
| 397 | 397 | .ptr => return .default, |
| 398 | 398 | else => { |
| 399 | const item = builder.type_items.items[@intFromEnum(self)]; | |
| 399 | const item = builder.type_items.items[@backingInt(self)]; | |
| 400 | 400 | assert(item.tag == .pointer); |
| 401 | return @enumFromInt(item.data); | |
| 401 | return @fromBackingInt(@intCast(item.data)); | |
| 402 | 402 | }, |
| 403 | 403 | } |
| 404 | 404 | } |
| ... | ... | @@ -419,7 +419,7 @@ pub const Type = enum(u32) { |
| 419 | 419 | } |
| 420 | 420 | |
| 421 | 421 | pub fn functionParameters(self: Type, builder: *const Builder) []const Type { |
| 422 | const item = builder.type_items.items[@intFromEnum(self)]; | |
| 422 | const item = builder.type_items.items[@backingInt(self)]; | |
| 423 | 423 | switch (item.tag) { |
| 424 | 424 | .function, |
| 425 | 425 | .vararg_function, |
| ... | ... | @@ -432,7 +432,7 @@ pub const Type = enum(u32) { |
| 432 | 432 | } |
| 433 | 433 | |
| 434 | 434 | pub fn functionReturn(self: Type, builder: *const Builder) Type { |
| 435 | const item = builder.type_items.items[@intFromEnum(self)]; | |
| 435 | const item = builder.type_items.items[@backingInt(self)]; | |
| 436 | 436 | switch (item.tag) { |
| 437 | 437 | .function, |
| 438 | 438 | .vararg_function, |
| ... | ... | @@ -491,7 +491,7 @@ pub const Type = enum(u32) { |
| 491 | 491 | .fp128, .ppc_fp128, .i128 => 128, |
| 492 | 492 | .ptr, .@"ptr addrspace(4)" => @panic("TODO: query data layout"), |
| 493 | 493 | _ => { |
| 494 | const item = builder.type_items.items[@intFromEnum(self)]; | |
| 494 | const item = builder.type_items.items[@backingInt(self)]; | |
| 495 | 495 | return switch (item.tag) { |
| 496 | 496 | .simple, |
| 497 | 497 | .function, |
| ... | ... | @@ -515,7 +515,7 @@ pub const Type = enum(u32) { |
| 515 | 515 | } |
| 516 | 516 | |
| 517 | 517 | pub fn childType(self: Type, builder: *const Builder) Type { |
| 518 | const item = builder.type_items.items[@intFromEnum(self)]; | |
| 518 | const item = builder.type_items.items[@backingInt(self)]; | |
| 519 | 519 | return switch (item.tag) { |
| 520 | 520 | .vector, |
| 521 | 521 | .scalable_vector, |
| ... | ... | @@ -529,7 +529,7 @@ pub const Type = enum(u32) { |
| 529 | 529 | |
| 530 | 530 | pub fn scalarType(self: Type, builder: *const Builder) Type { |
| 531 | 531 | if (self.isFloatingPoint()) return self; |
| 532 | const item = builder.type_items.items[@intFromEnum(self)]; | |
| 532 | const item = builder.type_items.items[@backingInt(self)]; | |
| 533 | 533 | return switch (item.tag) { |
| 534 | 534 | .integer, |
| 535 | 535 | .pointer, |
| ... | ... | @@ -548,7 +548,7 @@ pub const Type = enum(u32) { |
| 548 | 548 | |
| 549 | 549 | pub fn changeScalarAssumeCapacity(self: Type, scalar: Type, builder: *Builder) Type { |
| 550 | 550 | if (self.isFloatingPoint()) return scalar; |
| 551 | const item = builder.type_items.items[@intFromEnum(self)]; | |
| 551 | const item = builder.type_items.items[@backingInt(self)]; | |
| 552 | 552 | return switch (item.tag) { |
| 553 | 553 | .integer, |
| 554 | 554 | .pointer, |
| ... | ... | @@ -569,7 +569,7 @@ pub const Type = enum(u32) { |
| 569 | 569 | } |
| 570 | 570 | |
| 571 | 571 | pub fn vectorLen(self: Type, builder: *const Builder) u32 { |
| 572 | const item = builder.type_items.items[@intFromEnum(self)]; | |
| 572 | const item = builder.type_items.items[@backingInt(self)]; | |
| 573 | 573 | return switch (item.tag) { |
| 574 | 574 | .vector, |
| 575 | 575 | .scalable_vector, |
| ... | ... | @@ -584,7 +584,7 @@ pub const Type = enum(u32) { |
| 584 | 584 | } |
| 585 | 585 | |
| 586 | 586 | pub fn changeLengthAssumeCapacity(self: Type, len: u32, builder: *Builder) Type { |
| 587 | const item = builder.type_items.items[@intFromEnum(self)]; | |
| 587 | const item = builder.type_items.items[@backingInt(self)]; | |
| 588 | 588 | return switch (item.tag) { |
| 589 | 589 | inline .vector, |
| 590 | 590 | .scalable_vector, |
| ... | ... | @@ -610,7 +610,7 @@ pub const Type = enum(u32) { |
| 610 | 610 | } |
| 611 | 611 | |
| 612 | 612 | pub fn aggregateLen(self: Type, builder: *const Builder) usize { |
| 613 | const item = builder.type_items.items[@intFromEnum(self)]; | |
| 613 | const item = builder.type_items.items[@backingInt(self)]; | |
| 614 | 614 | return switch (item.tag) { |
| 615 | 615 | .vector, |
| 616 | 616 | .scalable_vector, |
| ... | ... | @@ -627,7 +627,7 @@ pub const Type = enum(u32) { |
| 627 | 627 | } |
| 628 | 628 | |
| 629 | 629 | pub fn structFields(self: Type, builder: *const Builder) []const Type { |
| 630 | const item = builder.type_items.items[@intFromEnum(self)]; | |
| 630 | const item = builder.type_items.items[@backingInt(self)]; | |
| 631 | 631 | switch (item.tag) { |
| 632 | 632 | .structure, |
| 633 | 633 | .packed_structure, |
| ... | ... | @@ -643,7 +643,7 @@ pub const Type = enum(u32) { |
| 643 | 643 | |
| 644 | 644 | pub fn childTypeAt(self: Type, indices: []const u32, builder: *const Builder) Type { |
| 645 | 645 | if (indices.len == 0) return self; |
| 646 | const item = builder.type_items.items[@intFromEnum(self)]; | |
| 646 | const item = builder.type_items.items[@backingInt(self)]; | |
| 647 | 647 | return switch (item.tag) { |
| 648 | 648 | .small_array => builder.typeExtraData(Type.Vector, item.data).child |
| 649 | 649 | .childTypeAt(indices[1..], builder), |
| ... | ... | @@ -685,9 +685,9 @@ pub const Type = enum(u32) { |
| 685 | 685 | fn format(data: FormatData, w: *Writer) Writer.Error!void { |
| 686 | 686 | assert(data.type != .none); |
| 687 | 687 | if (data.mode == .m) { |
| 688 | const item = data.builder.type_items.items[@intFromEnum(data.type)]; | |
| 688 | const item = data.builder.type_items.items[@backingInt(data.type)]; | |
| 689 | 689 | switch (item.tag) { |
| 690 | .simple => try w.writeAll(switch (@as(Simple, @enumFromInt(item.data))) { | |
| 690 | .simple => try w.writeAll(switch (@as(Simple, @fromBackingInt(@intCast(item.data)))) { | |
| 691 | 691 | .void => "isVoid", |
| 692 | 692 | .half => "f16", |
| 693 | 693 | .bfloat => "bf16", |
| ... | ... | @@ -760,7 +760,7 @@ pub const Type = enum(u32) { |
| 760 | 760 | return; |
| 761 | 761 | } |
| 762 | 762 | if (std.enums.tagName(Type, data.type)) |name| return w.writeAll(name); |
| 763 | const item = data.builder.type_items.items[@intFromEnum(data.type)]; | |
| 763 | const item = data.builder.type_items.items[@backingInt(data.type)]; | |
| 764 | 764 | switch (item.tag) { |
| 765 | 765 | .simple => unreachable, |
| 766 | 766 | .function, .vararg_function => |kind| { |
| ... | ... | @@ -786,7 +786,7 @@ pub const Type = enum(u32) { |
| 786 | 786 | } |
| 787 | 787 | }, |
| 788 | 788 | .integer => try w.print("i{d}", .{item.data}), |
| 789 | .pointer => try w.print("ptr{f}", .{@as(AddrSpace, @enumFromInt(item.data)).fmt(" ")}), | |
| 789 | .pointer => try w.print("ptr{f}", .{@as(AddrSpace, @fromBackingInt(@intCast(item.data))).fmt(" ")}), | |
| 790 | 790 | .target => { |
| 791 | 791 | var extra = data.builder.typeExtraDataTrail(Type.Target, item.data); |
| 792 | 792 | const types = extra.trail.next(extra.data.types_len, Type, data.builder); |
| ... | ... | @@ -891,7 +891,7 @@ pub const Type = enum(u32) { |
| 891 | 891 | => true, |
| 892 | 892 | .none => unreachable, |
| 893 | 893 | _ => { |
| 894 | const item = builder.type_items.items[@intFromEnum(self)]; | |
| 894 | const item = builder.type_items.items[@backingInt(self)]; | |
| 895 | 895 | return switch (item.tag) { |
| 896 | 896 | .simple => unreachable, |
| 897 | 897 | .function, |
| ... | ... | @@ -1045,7 +1045,7 @@ pub const Attribute = union(Kind) { |
| 1045 | 1045 | const storage = self.toStorage(builder); |
| 1046 | 1046 | if (storage.kind.toString()) |kind| return .{ .string = .{ |
| 1047 | 1047 | .kind = kind, |
| 1048 | .value = @enumFromInt(storage.value), | |
| 1048 | .value = @fromBackingInt(@intCast(storage.value)), | |
| 1049 | 1049 | } } else return switch (storage.kind) { |
| 1050 | 1050 | inline .zeroext, |
| 1051 | 1051 | .signext, |
| ... | ... | @@ -1149,7 +1149,7 @@ pub const Attribute = union(Kind) { |
| 1149 | 1149 | return @unionInit(Attribute, field_name, switch (field_type) { |
| 1150 | 1150 | void => {}, |
| 1151 | 1151 | u32 => storage.value, |
| 1152 | Alignment.Lazy, String, Type, UwTable => @enumFromInt(storage.value), | |
| 1152 | Alignment.Lazy, String, Type, UwTable => @fromBackingInt(@intCast(storage.value)), | |
| 1153 | 1153 | AllocKind, AllocSize, FpClass, Memory, VScaleRange => @bitCast(storage.value), |
| 1154 | 1154 | else => @compileError("bad payload type: " ++ field_name ++ ": " ++ |
| 1155 | 1155 | @typeName(field_type)), |
| ... | ... | @@ -1338,7 +1338,7 @@ pub const Attribute = union(Kind) { |
| 1338 | 1338 | } |
| 1339 | 1339 | |
| 1340 | 1340 | fn toStorage(self: Index, builder: *const Builder) Storage { |
| 1341 | return builder.attributes.keys()[@intFromEnum(self)]; | |
| 1341 | return builder.attributes.keys()[@backingInt(self)]; | |
| 1342 | 1342 | } |
| 1343 | 1343 | }; |
| 1344 | 1344 | |
| ... | ... | @@ -1447,14 +1447,14 @@ pub const Attribute = union(Kind) { |
| 1447 | 1447 | |
| 1448 | 1448 | pub fn fromString(str: String) Kind { |
| 1449 | 1449 | assert(!str.isAnon()); |
| 1450 | const kind: Kind = @enumFromInt(@intFromEnum(str)); | |
| 1450 | const kind: Kind = @fromBackingInt(@intCast(@backingInt(str))); | |
| 1451 | 1451 | assert(kind != .none); |
| 1452 | 1452 | return kind; |
| 1453 | 1453 | } |
| 1454 | 1454 | |
| 1455 | 1455 | fn toString(self: Kind) ?String { |
| 1456 | 1456 | assert(self != .none); |
| 1457 | const str: String = @enumFromInt(@intFromEnum(self)); | |
| 1457 | const str: String = @fromBackingInt(@intCast(@backingInt(self))); | |
| 1458 | 1458 | return if (str.isAnon()) null else str; |
| 1459 | 1459 | } |
| 1460 | 1460 | }; |
| ... | ... | @@ -1581,13 +1581,13 @@ pub const Attribute = union(Kind) { |
| 1581 | 1581 | inline else => |value, tag| .{ .kind = @as(Kind, self), .value = switch (@TypeOf(value)) { |
| 1582 | 1582 | void => 0, |
| 1583 | 1583 | u32 => value, |
| 1584 | Alignment.Lazy, String, Type, UwTable => @intFromEnum(value), | |
| 1584 | Alignment.Lazy, String, Type, UwTable => @backingInt(value), | |
| 1585 | 1585 | AllocKind, AllocSize, FpClass, Memory, VScaleRange => @bitCast(value), |
| 1586 | 1586 | else => @compileError("bad payload type: " ++ @tagName(tag) ++ @typeName(@TypeOf(value))), |
| 1587 | 1587 | } }, |
| 1588 | 1588 | .string => |string_attr| .{ |
| 1589 | 1589 | .kind = Kind.fromString(string_attr.kind), |
| 1590 | .value = @intFromEnum(string_attr.value), | |
| 1590 | .value = @backingInt(string_attr.value), | |
| 1591 | 1591 | }, |
| 1592 | 1592 | .none => unreachable, |
| 1593 | 1593 | }; |
| ... | ... | @@ -1599,8 +1599,8 @@ pub const Attributes = enum(u32) { |
| 1599 | 1599 | _, |
| 1600 | 1600 | |
| 1601 | 1601 | pub fn slice(self: Attributes, builder: *const Builder) []const Attribute.Index { |
| 1602 | const start = builder.attributes_indices.items[@intFromEnum(self)]; | |
| 1603 | const end = builder.attributes_indices.items[@intFromEnum(self) + 1]; | |
| 1602 | const start = builder.attributes_indices.items[@backingInt(self)]; | |
| 1603 | const end = builder.attributes_indices.items[@backingInt(self) + 1]; | |
| 1604 | 1604 | return @ptrCast(builder.attributes_extra.items[start..end]); |
| 1605 | 1605 | } |
| 1606 | 1606 | |
| ... | ... | @@ -1785,8 +1785,8 @@ pub const FunctionAttributes = enum(u32) { |
| 1785 | 1785 | } |
| 1786 | 1786 | |
| 1787 | 1787 | fn slice(self: FunctionAttributes, builder: *const Builder) []const Attributes { |
| 1788 | const start = builder.attributes_indices.items[@intFromEnum(self)]; | |
| 1789 | const end = builder.attributes_indices.items[@intFromEnum(self) + 1]; | |
| 1788 | const start = builder.attributes_indices.items[@backingInt(self)]; | |
| 1789 | const end = builder.attributes_indices.items[@backingInt(self) + 1]; | |
| 1790 | 1790 | return @ptrCast(builder.attributes_extra.items[start..end]); |
| 1791 | 1791 | } |
| 1792 | 1792 | }; |
| ... | ... | @@ -1907,87 +1907,87 @@ pub const AddrSpace = enum(u24) { |
| 1907 | 1907 | |
| 1908 | 1908 | // See llvm/lib/Target/X86/X86.h |
| 1909 | 1909 | pub const x86 = struct { |
| 1910 | pub const gs: AddrSpace = @enumFromInt(256); | |
| 1911 | pub const fs: AddrSpace = @enumFromInt(257); | |
| 1912 | pub const ss: AddrSpace = @enumFromInt(258); | |
| 1910 | pub const gs: AddrSpace = @fromBackingInt(@intCast(256)); | |
| 1911 | pub const fs: AddrSpace = @fromBackingInt(@intCast(257)); | |
| 1912 | pub const ss: AddrSpace = @fromBackingInt(@intCast(258)); | |
| 1913 | 1913 | |
| 1914 | pub const ptr32_sptr: AddrSpace = @enumFromInt(270); | |
| 1915 | pub const ptr32_uptr: AddrSpace = @enumFromInt(271); | |
| 1916 | pub const ptr64: AddrSpace = @enumFromInt(272); | |
| 1914 | pub const ptr32_sptr: AddrSpace = @fromBackingInt(@intCast(270)); | |
| 1915 | pub const ptr32_uptr: AddrSpace = @fromBackingInt(@intCast(271)); | |
| 1916 | pub const ptr64: AddrSpace = @fromBackingInt(@intCast(272)); | |
| 1917 | 1917 | }; |
| 1918 | 1918 | pub const x86_64 = x86; |
| 1919 | 1919 | |
| 1920 | 1920 | // See llvm/lib/Target/AVR/AVR.h |
| 1921 | 1921 | pub const avr = struct { |
| 1922 | pub const data: AddrSpace = @enumFromInt(0); | |
| 1923 | pub const program: AddrSpace = @enumFromInt(1); | |
| 1924 | pub const program1: AddrSpace = @enumFromInt(2); | |
| 1925 | pub const program2: AddrSpace = @enumFromInt(3); | |
| 1926 | pub const program3: AddrSpace = @enumFromInt(4); | |
| 1927 | pub const program4: AddrSpace = @enumFromInt(5); | |
| 1928 | pub const program5: AddrSpace = @enumFromInt(6); | |
| 1922 | pub const data: AddrSpace = @fromBackingInt(@intCast(0)); | |
| 1923 | pub const program: AddrSpace = @fromBackingInt(@intCast(1)); | |
| 1924 | pub const program1: AddrSpace = @fromBackingInt(@intCast(2)); | |
| 1925 | pub const program2: AddrSpace = @fromBackingInt(@intCast(3)); | |
| 1926 | pub const program3: AddrSpace = @fromBackingInt(@intCast(4)); | |
| 1927 | pub const program4: AddrSpace = @fromBackingInt(@intCast(5)); | |
| 1928 | pub const program5: AddrSpace = @fromBackingInt(@intCast(6)); | |
| 1929 | 1929 | }; |
| 1930 | 1930 | |
| 1931 | 1931 | // See llvm/lib/Target/NVPTX/NVPTX.h |
| 1932 | 1932 | pub const nvptx = struct { |
| 1933 | pub const generic: AddrSpace = @enumFromInt(0); | |
| 1934 | pub const global: AddrSpace = @enumFromInt(1); | |
| 1935 | pub const constant: AddrSpace = @enumFromInt(2); | |
| 1936 | pub const shared: AddrSpace = @enumFromInt(3); | |
| 1937 | pub const param: AddrSpace = @enumFromInt(4); | |
| 1938 | pub const local: AddrSpace = @enumFromInt(5); | |
| 1933 | pub const generic: AddrSpace = @fromBackingInt(@intCast(0)); | |
| 1934 | pub const global: AddrSpace = @fromBackingInt(@intCast(1)); | |
| 1935 | pub const constant: AddrSpace = @fromBackingInt(@intCast(2)); | |
| 1936 | pub const shared: AddrSpace = @fromBackingInt(@intCast(3)); | |
| 1937 | pub const param: AddrSpace = @fromBackingInt(@intCast(4)); | |
| 1938 | pub const local: AddrSpace = @fromBackingInt(@intCast(5)); | |
| 1939 | 1939 | }; |
| 1940 | 1940 | |
| 1941 | 1941 | // See llvm/lib/Target/AMDGPU/AMDGPU.h |
| 1942 | 1942 | pub const amdgpu = struct { |
| 1943 | pub const flat: AddrSpace = @enumFromInt(0); | |
| 1944 | pub const global: AddrSpace = @enumFromInt(1); | |
| 1945 | pub const region: AddrSpace = @enumFromInt(2); | |
| 1946 | pub const local: AddrSpace = @enumFromInt(3); | |
| 1947 | pub const constant: AddrSpace = @enumFromInt(4); | |
| 1948 | pub const private: AddrSpace = @enumFromInt(5); | |
| 1949 | pub const constant_32bit: AddrSpace = @enumFromInt(6); | |
| 1950 | pub const buffer_fat_pointer: AddrSpace = @enumFromInt(7); | |
| 1951 | pub const buffer_resource: AddrSpace = @enumFromInt(8); | |
| 1952 | pub const buffer_strided_pointer: AddrSpace = @enumFromInt(9); | |
| 1953 | pub const param_d: AddrSpace = @enumFromInt(6); | |
| 1954 | pub const param_i: AddrSpace = @enumFromInt(7); | |
| 1955 | pub const constant_buffer_0: AddrSpace = @enumFromInt(8); | |
| 1956 | pub const constant_buffer_1: AddrSpace = @enumFromInt(9); | |
| 1957 | pub const constant_buffer_2: AddrSpace = @enumFromInt(10); | |
| 1958 | pub const constant_buffer_3: AddrSpace = @enumFromInt(11); | |
| 1959 | pub const constant_buffer_4: AddrSpace = @enumFromInt(12); | |
| 1960 | pub const constant_buffer_5: AddrSpace = @enumFromInt(13); | |
| 1961 | pub const constant_buffer_6: AddrSpace = @enumFromInt(14); | |
| 1962 | pub const constant_buffer_7: AddrSpace = @enumFromInt(15); | |
| 1963 | pub const constant_buffer_8: AddrSpace = @enumFromInt(16); | |
| 1964 | pub const constant_buffer_9: AddrSpace = @enumFromInt(17); | |
| 1965 | pub const constant_buffer_10: AddrSpace = @enumFromInt(18); | |
| 1966 | pub const constant_buffer_11: AddrSpace = @enumFromInt(19); | |
| 1967 | pub const constant_buffer_12: AddrSpace = @enumFromInt(20); | |
| 1968 | pub const constant_buffer_13: AddrSpace = @enumFromInt(21); | |
| 1969 | pub const constant_buffer_14: AddrSpace = @enumFromInt(22); | |
| 1970 | pub const constant_buffer_15: AddrSpace = @enumFromInt(23); | |
| 1971 | pub const streamout_register: AddrSpace = @enumFromInt(128); | |
| 1943 | pub const flat: AddrSpace = @fromBackingInt(@intCast(0)); | |
| 1944 | pub const global: AddrSpace = @fromBackingInt(@intCast(1)); | |
| 1945 | pub const region: AddrSpace = @fromBackingInt(@intCast(2)); | |
| 1946 | pub const local: AddrSpace = @fromBackingInt(@intCast(3)); | |
| 1947 | pub const constant: AddrSpace = @fromBackingInt(@intCast(4)); | |
| 1948 | pub const private: AddrSpace = @fromBackingInt(@intCast(5)); | |
| 1949 | pub const constant_32bit: AddrSpace = @fromBackingInt(@intCast(6)); | |
| 1950 | pub const buffer_fat_pointer: AddrSpace = @fromBackingInt(@intCast(7)); | |
| 1951 | pub const buffer_resource: AddrSpace = @fromBackingInt(@intCast(8)); | |
| 1952 | pub const buffer_strided_pointer: AddrSpace = @fromBackingInt(@intCast(9)); | |
| 1953 | pub const param_d: AddrSpace = @fromBackingInt(@intCast(6)); | |
| 1954 | pub const param_i: AddrSpace = @fromBackingInt(@intCast(7)); | |
| 1955 | pub const constant_buffer_0: AddrSpace = @fromBackingInt(@intCast(8)); | |
| 1956 | pub const constant_buffer_1: AddrSpace = @fromBackingInt(@intCast(9)); | |
| 1957 | pub const constant_buffer_2: AddrSpace = @fromBackingInt(@intCast(10)); | |
| 1958 | pub const constant_buffer_3: AddrSpace = @fromBackingInt(@intCast(11)); | |
| 1959 | pub const constant_buffer_4: AddrSpace = @fromBackingInt(@intCast(12)); | |
| 1960 | pub const constant_buffer_5: AddrSpace = @fromBackingInt(@intCast(13)); | |
| 1961 | pub const constant_buffer_6: AddrSpace = @fromBackingInt(@intCast(14)); | |
| 1962 | pub const constant_buffer_7: AddrSpace = @fromBackingInt(@intCast(15)); | |
| 1963 | pub const constant_buffer_8: AddrSpace = @fromBackingInt(@intCast(16)); | |
| 1964 | pub const constant_buffer_9: AddrSpace = @fromBackingInt(@intCast(17)); | |
| 1965 | pub const constant_buffer_10: AddrSpace = @fromBackingInt(@intCast(18)); | |
| 1966 | pub const constant_buffer_11: AddrSpace = @fromBackingInt(@intCast(19)); | |
| 1967 | pub const constant_buffer_12: AddrSpace = @fromBackingInt(@intCast(20)); | |
| 1968 | pub const constant_buffer_13: AddrSpace = @fromBackingInt(@intCast(21)); | |
| 1969 | pub const constant_buffer_14: AddrSpace = @fromBackingInt(@intCast(22)); | |
| 1970 | pub const constant_buffer_15: AddrSpace = @fromBackingInt(@intCast(23)); | |
| 1971 | pub const streamout_register: AddrSpace = @fromBackingInt(@intCast(128)); | |
| 1972 | 1972 | }; |
| 1973 | 1973 | |
| 1974 | 1974 | pub const spirv = struct { |
| 1975 | pub const function: AddrSpace = @enumFromInt(0); | |
| 1976 | pub const cross_workgroup: AddrSpace = @enumFromInt(1); | |
| 1977 | pub const uniform_constant: AddrSpace = @enumFromInt(2); | |
| 1978 | pub const workgroup: AddrSpace = @enumFromInt(3); | |
| 1979 | pub const generic: AddrSpace = @enumFromInt(4); | |
| 1980 | pub const device_only_intel: AddrSpace = @enumFromInt(5); | |
| 1981 | pub const host_only_intel: AddrSpace = @enumFromInt(6); | |
| 1982 | pub const input: AddrSpace = @enumFromInt(7); | |
| 1975 | pub const function: AddrSpace = @fromBackingInt(@intCast(0)); | |
| 1976 | pub const cross_workgroup: AddrSpace = @fromBackingInt(@intCast(1)); | |
| 1977 | pub const uniform_constant: AddrSpace = @fromBackingInt(@intCast(2)); | |
| 1978 | pub const workgroup: AddrSpace = @fromBackingInt(@intCast(3)); | |
| 1979 | pub const generic: AddrSpace = @fromBackingInt(@intCast(4)); | |
| 1980 | pub const device_only_intel: AddrSpace = @fromBackingInt(@intCast(5)); | |
| 1981 | pub const host_only_intel: AddrSpace = @fromBackingInt(@intCast(6)); | |
| 1982 | pub const input: AddrSpace = @fromBackingInt(@intCast(7)); | |
| 1983 | 1983 | }; |
| 1984 | 1984 | |
| 1985 | 1985 | // See llvm/include/llvm/CodeGen/WasmAddressSpaces.h |
| 1986 | 1986 | pub const wasm = struct { |
| 1987 | pub const default: AddrSpace = @enumFromInt(0); | |
| 1988 | pub const variable: AddrSpace = @enumFromInt(1); | |
| 1989 | pub const externref: AddrSpace = @enumFromInt(10); | |
| 1990 | pub const funcref: AddrSpace = @enumFromInt(20); | |
| 1987 | pub const default: AddrSpace = @fromBackingInt(@intCast(0)); | |
| 1988 | pub const variable: AddrSpace = @fromBackingInt(@intCast(1)); | |
| 1989 | pub const externref: AddrSpace = @fromBackingInt(@intCast(10)); | |
| 1990 | pub const funcref: AddrSpace = @fromBackingInt(@intCast(20)); | |
| 1991 | 1991 | }; |
| 1992 | 1992 | |
| 1993 | 1993 | pub fn format(addr_space: AddrSpace, w: *Writer) Writer.Error!void { |
| ... | ... | @@ -2030,20 +2030,20 @@ pub const Alignment = enum(u6) { |
| 2030 | 2030 | _, |
| 2031 | 2031 | |
| 2032 | 2032 | pub fn wrap(a: Alignment) Lazy { |
| 2033 | return @enumFromInt(@intFromEnum(a)); | |
| 2033 | return @fromBackingInt(@intCast(@backingInt(a))); | |
| 2034 | 2034 | } |
| 2035 | 2035 | pub fn resolve(l: Lazy, b: *const Builder) Alignment { |
| 2036 | return switch (@intFromEnum(l)) { | |
| 2037 | 0...maxInt(u6) => |raw| @enumFromInt(raw), | |
| 2036 | return switch (@backingInt(l)) { | |
| 2037 | 0...maxInt(u6) => |raw| @fromBackingInt(@intCast(raw)), | |
| 2038 | 2038 | else => |offset_index| b.alignment_forward_references.items[offset_index - maxInt(u6)], |
| 2039 | 2039 | }; |
| 2040 | 2040 | } |
| 2041 | 2041 | |
| 2042 | 2042 | fn fromFwdRefIndex(index: usize) Lazy { |
| 2043 | return @enumFromInt(index + maxInt(u6)); | |
| 2043 | return @fromBackingInt(@intCast(index + maxInt(u6))); | |
| 2044 | 2044 | } |
| 2045 | 2045 | fn toFwdRefIndex(l: Lazy) usize { |
| 2046 | return @intFromEnum(l) - maxInt(u6); | |
| 2046 | return @backingInt(l) - maxInt(u6); | |
| 2047 | 2047 | } |
| 2048 | 2048 | }; |
| 2049 | 2049 | |
| ... | ... | @@ -2051,13 +2051,13 @@ pub const Alignment = enum(u6) { |
| 2051 | 2051 | if (bytes == 0) return .default; |
| 2052 | 2052 | assert(std.math.isPowerOfTwo(bytes)); |
| 2053 | 2053 | assert(bytes <= 1 << 32); |
| 2054 | return @enumFromInt(@ctz(bytes)); | |
| 2054 | return @fromBackingInt(@intCast(@ctz(bytes))); | |
| 2055 | 2055 | } |
| 2056 | 2056 | |
| 2057 | 2057 | pub fn toByteUnits(self: Alignment) ?u64 { |
| 2058 | 2058 | return switch (self) { |
| 2059 | 2059 | .default => null, |
| 2060 | else => @as(u64, 1) << @intFromEnum(self), | |
| 2060 | else => @as(u64, 1) << @backingInt(self), | |
| 2061 | 2061 | }; |
| 2062 | 2062 | } |
| 2063 | 2063 | |
| ... | ... | @@ -2065,13 +2065,13 @@ pub const Alignment = enum(u6) { |
| 2065 | 2065 | pub fn max(a: Alignment, b: Alignment) Alignment { |
| 2066 | 2066 | assert(a != .default); |
| 2067 | 2067 | assert(b != .default); |
| 2068 | return @enumFromInt(@max(@intFromEnum(a), @intFromEnum(b))); | |
| 2068 | return @fromBackingInt(@intCast(@max(@backingInt(a), @backingInt(b)))); | |
| 2069 | 2069 | } |
| 2070 | 2070 | |
| 2071 | 2071 | pub fn toLlvm(self: Alignment) u6 { |
| 2072 | 2072 | return switch (self) { |
| 2073 | 2073 | .default => 0, |
| 2074 | else => @intFromEnum(self) + 1, | |
| 2074 | else => @backingInt(self) + 1, | |
| 2075 | 2075 | }; |
| 2076 | 2076 | } |
| 2077 | 2077 | |
| ... | ... | @@ -2214,7 +2214,7 @@ pub const CallConv = enum(u10) { |
| 2214 | 2214 | .m68k_rtdcc, |
| 2215 | 2215 | .riscv_vectorcallcc, |
| 2216 | 2216 | => try w.print(" {s}", .{@tagName(self)}), |
| 2217 | _ => try w.print(" cc{d}", .{@intFromEnum(self)}), | |
| 2217 | _ => try w.print(" cc{d}", .{@backingInt(self)}), | |
| 2218 | 2218 | } |
| 2219 | 2219 | } |
| 2220 | 2220 | }; |
| ... | ... | @@ -2244,7 +2244,7 @@ pub const StrtabString = enum(u32) { |
| 2244 | 2244 | fn format(data: FormatData, w: *Writer) Writer.Error!void { |
| 2245 | 2245 | assert(data.string != .none); |
| 2246 | 2246 | const string_slice = data.string.slice(data.builder) orelse |
| 2247 | return w.print("{d}", .{@intFromEnum(data.string)}); | |
| 2247 | return w.print("{d}", .{@backingInt(data.string)}); | |
| 2248 | 2248 | const quote_behavior = data.quote_behavior orelse return w.writeAll(string_slice); |
| 2249 | 2249 | return printEscapedString(string_slice, quote_behavior, w); |
| 2250 | 2250 | } |
| ... | ... | @@ -2261,12 +2261,12 @@ pub const StrtabString = enum(u32) { |
| 2261 | 2261 | } |
| 2262 | 2262 | |
| 2263 | 2263 | fn fromIndex(index: ?usize) StrtabString { |
| 2264 | return @enumFromInt(@as(u32, @intCast((index orelse return .none) + | |
| 2265 | @intFromEnum(StrtabString.empty)))); | |
| 2264 | return @fromBackingInt(@intCast(@as(u32, @intCast((index orelse return .none) + | |
| 2265 | @backingInt(StrtabString.empty))))); | |
| 2266 | 2266 | } |
| 2267 | 2267 | |
| 2268 | 2268 | fn toIndex(self: StrtabString) ?usize { |
| 2269 | return std.math.sub(u32, @intFromEnum(self), @intFromEnum(StrtabString.empty)) catch null; | |
| 2269 | return std.math.sub(u32, @backingInt(self), @backingInt(StrtabString.empty)) catch null; | |
| 2270 | 2270 | } |
| 2271 | 2271 | |
| 2272 | 2272 | const Adapter = struct { |
| ... | ... | @@ -2354,7 +2354,7 @@ pub const Global = struct { |
| 2354 | 2354 | pub fn unwrap(orig_index: Index, builder: *const Builder) Index { |
| 2355 | 2355 | var cur = orig_index; |
| 2356 | 2356 | while (true) { |
| 2357 | switch (builder.globals.values()[@intFromEnum(cur)].kind) { | |
| 2357 | switch (builder.globals.values()[@backingInt(cur)].kind) { | |
| 2358 | 2358 | .replaced => |replacement| cur = replacement, |
| 2359 | 2359 | else => return cur, |
| 2360 | 2360 | } |
| ... | ... | @@ -2366,15 +2366,15 @@ pub const Global = struct { |
| 2366 | 2366 | } |
| 2367 | 2367 | |
| 2368 | 2368 | pub fn ptr(self: Index, builder: *Builder) *Global { |
| 2369 | return &builder.globals.values()[@intFromEnum(self.unwrap(builder))]; | |
| 2369 | return &builder.globals.values()[@backingInt(self.unwrap(builder))]; | |
| 2370 | 2370 | } |
| 2371 | 2371 | |
| 2372 | 2372 | pub fn ptrConst(self: Index, builder: *const Builder) *const Global { |
| 2373 | return &builder.globals.values()[@intFromEnum(self.unwrap(builder))]; | |
| 2373 | return &builder.globals.values()[@backingInt(self.unwrap(builder))]; | |
| 2374 | 2374 | } |
| 2375 | 2375 | |
| 2376 | 2376 | pub fn name(self: Index, builder: *const Builder) StrtabString { |
| 2377 | return builder.globals.keys()[@intFromEnum(self.unwrap(builder))]; | |
| 2377 | return builder.globals.keys()[@backingInt(self.unwrap(builder))]; | |
| 2378 | 2378 | } |
| 2379 | 2379 | |
| 2380 | 2380 | pub fn strtab(self: Index, builder: *const Builder) struct { |
| ... | ... | @@ -2398,7 +2398,7 @@ pub const Global = struct { |
| 2398 | 2398 | } |
| 2399 | 2399 | |
| 2400 | 2400 | pub fn toConst(global: Index) Constant { |
| 2401 | return @enumFromInt(@intFromEnum(Constant.first_global) + @intFromEnum(global)); | |
| 2401 | return @fromBackingInt(@intCast(@backingInt(Constant.first_global) + @backingInt(global))); | |
| 2402 | 2402 | } |
| 2403 | 2403 | |
| 2404 | 2404 | pub fn toValue(global: Index) Value { |
| ... | ... | @@ -2468,7 +2468,7 @@ pub const Global = struct { |
| 2468 | 2468 | pub fn toNewFunction(global: Index, builder: *Builder) Allocator.Error!Function.Index { |
| 2469 | 2469 | try builder.functions.ensureUnusedCapacity(builder.gpa, 1); |
| 2470 | 2470 | errdefer comptime unreachable; |
| 2471 | const function: Function.Index = @enumFromInt(builder.functions.items.len); | |
| 2471 | const function: Function.Index = @fromBackingInt(@intCast(builder.functions.items.len)); | |
| 2472 | 2472 | builder.functions.appendAssumeCapacity(.{ |
| 2473 | 2473 | .global = global, |
| 2474 | 2474 | .strip = undefined, |
| ... | ... | @@ -2482,7 +2482,7 @@ pub const Global = struct { |
| 2482 | 2482 | pub fn toNewVariable(global: Index, builder: *Builder) Allocator.Error!Variable.Index { |
| 2483 | 2483 | try builder.variables.ensureUnusedCapacity(builder.gpa, 1); |
| 2484 | 2484 | errdefer comptime unreachable; |
| 2485 | const variable: Variable.Index = @enumFromInt(builder.variables.items.len); | |
| 2485 | const variable: Variable.Index = @fromBackingInt(@intCast(builder.variables.items.len)); | |
| 2486 | 2486 | builder.variables.appendAssumeCapacity(.{ .global = global }); |
| 2487 | 2487 | global.ptr(builder).kind = .{ .variable = variable }; |
| 2488 | 2488 | return variable; |
| ... | ... | @@ -2493,7 +2493,7 @@ pub const Global = struct { |
| 2493 | 2493 | pub fn toNewAlias(global: Index, builder: *Builder) Allocator.Error!Alias.Index { |
| 2494 | 2494 | try builder.aliases.ensureUnusedCapacity(builder.gpa, 1); |
| 2495 | 2495 | errdefer comptime unreachable; |
| 2496 | const alias: Alias.Index = @enumFromInt(builder.aliases.items.len); | |
| 2496 | const alias: Alias.Index = @fromBackingInt(@intCast(builder.aliases.items.len)); | |
| 2497 | 2497 | builder.aliass.appendAssumeCapacity(.{ .global = global, .aliasee = .none }); |
| 2498 | 2498 | global.ptr(builder).kind = .{ .alias = alias }; |
| 2499 | 2499 | return alias; |
| ... | ... | @@ -2522,11 +2522,11 @@ pub const Global = struct { |
| 2522 | 2522 | fn renameAssumeCapacity(self: Index, new_name: StrtabString, builder: *Builder) void { |
| 2523 | 2523 | const old_name = self.name(builder); |
| 2524 | 2524 | if (new_name == old_name) return; |
| 2525 | const index = @intFromEnum(self.unwrap(builder)); | |
| 2525 | const index = @backingInt(self.unwrap(builder)); | |
| 2526 | 2526 | _ = builder.addGlobalAssumeCapacity(new_name, builder.globals.values()[index]); |
| 2527 | 2527 | builder.globals.swapRemoveAt(index); |
| 2528 | 2528 | if (!old_name.isAnon()) return; |
| 2529 | builder.next_unnamed_global = @enumFromInt(@intFromEnum(builder.next_unnamed_global) - 1); | |
| 2529 | builder.next_unnamed_global = @fromBackingInt(@intCast(@backingInt(builder.next_unnamed_global) - 1)); | |
| 2530 | 2530 | if (builder.next_unnamed_global == old_name) return; |
| 2531 | 2531 | builder.getGlobal(builder.next_unnamed_global).?.renameAssumeCapacity(old_name, builder); |
| 2532 | 2532 | } |
| ... | ... | @@ -2539,7 +2539,7 @@ pub const Global = struct { |
| 2539 | 2539 | |
| 2540 | 2540 | fn replaceAssumeCapacity(self: Index, other: Index, builder: *Builder) void { |
| 2541 | 2541 | if (self.eql(other, builder)) return; |
| 2542 | builder.next_replaced_global = @enumFromInt(@intFromEnum(builder.next_replaced_global) - 1); | |
| 2542 | builder.next_replaced_global = @fromBackingInt(@intCast(@backingInt(builder.next_replaced_global) - 1)); | |
| 2543 | 2543 | self.renameAssumeCapacity(builder.next_replaced_global, builder); |
| 2544 | 2544 | self.ptr(builder).kind = .{ .replaced = other.unwrap(builder) }; |
| 2545 | 2545 | } |
| ... | ... | @@ -2556,11 +2556,11 @@ pub const Alias = struct { |
| 2556 | 2556 | _, |
| 2557 | 2557 | |
| 2558 | 2558 | pub fn ptr(self: Index, builder: *Builder) *Alias { |
| 2559 | return &builder.aliases.items[@intFromEnum(self)]; | |
| 2559 | return &builder.aliases.items[@backingInt(self)]; | |
| 2560 | 2560 | } |
| 2561 | 2561 | |
| 2562 | 2562 | pub fn ptrConst(self: Index, builder: *const Builder) *const Alias { |
| 2563 | return &builder.aliases.items[@intFromEnum(self)]; | |
| 2563 | return &builder.aliases.items[@backingInt(self)]; | |
| 2564 | 2564 | } |
| 2565 | 2565 | |
| 2566 | 2566 | pub fn name(self: Index, builder: *const Builder) StrtabString { |
| ... | ... | @@ -2608,11 +2608,11 @@ pub const Variable = struct { |
| 2608 | 2608 | _, |
| 2609 | 2609 | |
| 2610 | 2610 | pub fn ptr(self: Index, builder: *Builder) *Variable { |
| 2611 | return &builder.variables.items[@intFromEnum(self)]; | |
| 2611 | return &builder.variables.items[@backingInt(self)]; | |
| 2612 | 2612 | } |
| 2613 | 2613 | |
| 2614 | 2614 | pub fn ptrConst(self: Index, builder: *const Builder) *const Variable { |
| 2615 | return &builder.variables.items[@intFromEnum(self)]; | |
| 2615 | return &builder.variables.items[@backingInt(self)]; | |
| 2616 | 2616 | } |
| 2617 | 2617 | |
| 2618 | 2618 | pub fn name(self: Index, builder: *const Builder) StrtabString { |
| ... | ... | @@ -4119,11 +4119,11 @@ pub const Function = struct { |
| 4119 | 4119 | _, |
| 4120 | 4120 | |
| 4121 | 4121 | pub fn ptr(self: Index, builder: *Builder) *Function { |
| 4122 | return &builder.functions.items[@intFromEnum(self)]; | |
| 4122 | return &builder.functions.items[@backingInt(self)]; | |
| 4123 | 4123 | } |
| 4124 | 4124 | |
| 4125 | 4125 | pub fn ptrConst(self: Index, builder: *const Builder) *const Function { |
| 4126 | return &builder.functions.items[@intFromEnum(self)]; | |
| 4126 | return &builder.functions.items[@backingInt(self)]; | |
| 4127 | 4127 | } |
| 4128 | 4128 | |
| 4129 | 4129 | pub fn name(self: Index, builder: *const Builder) StrtabString { |
| ... | ... | @@ -4479,19 +4479,19 @@ pub const Function = struct { |
| 4479 | 4479 | _, |
| 4480 | 4480 | |
| 4481 | 4481 | pub fn name(self: Instruction.Index, function: *const Function) String { |
| 4482 | return function.names[@intFromEnum(self)]; | |
| 4482 | return function.names[@backingInt(self)]; | |
| 4483 | 4483 | } |
| 4484 | 4484 | |
| 4485 | 4485 | pub fn valueIndex(self: Instruction.Index, function: *const Function) u32 { |
| 4486 | return function.value_indices[@intFromEnum(self)]; | |
| 4486 | return function.value_indices[@backingInt(self)]; | |
| 4487 | 4487 | } |
| 4488 | 4488 | |
| 4489 | 4489 | pub fn toValue(self: Instruction.Index) Value { |
| 4490 | return @enumFromInt(@intFromEnum(self)); | |
| 4490 | return @fromBackingInt(@intCast(@backingInt(self))); | |
| 4491 | 4491 | } |
| 4492 | 4492 | |
| 4493 | 4493 | pub fn isTerminatorWip(self: Instruction.Index, wip: *const WipFunction) bool { |
| 4494 | return switch (wip.instructions.items(.tag)[@intFromEnum(self)]) { | |
| 4494 | return switch (wip.instructions.items(.tag)[@backingInt(self)]) { | |
| 4495 | 4495 | .br, |
| 4496 | 4496 | .br_cond, |
| 4497 | 4497 | .indirectbr, |
| ... | ... | @@ -4505,7 +4505,7 @@ pub const Function = struct { |
| 4505 | 4505 | } |
| 4506 | 4506 | |
| 4507 | 4507 | pub fn hasResultWip(self: Instruction.Index, wip: *const WipFunction) bool { |
| 4508 | return switch (wip.instructions.items(.tag)[@intFromEnum(self)]) { | |
| 4508 | return switch (wip.instructions.items(.tag)[@backingInt(self)]) { | |
| 4509 | 4509 | .br, |
| 4510 | 4510 | .br_cond, |
| 4511 | 4511 | .fence, |
| ... | ... | @@ -4532,7 +4532,7 @@ pub const Function = struct { |
| 4532 | 4532 | } |
| 4533 | 4533 | |
| 4534 | 4534 | pub fn typeOfWip(self: Instruction.Index, wip: *const WipFunction) Type { |
| 4535 | const instruction = wip.instructions.get(@intFromEnum(self)); | |
| 4535 | const instruction = wip.instructions.get(@backingInt(self)); | |
| 4536 | 4536 | return switch (instruction.tag) { |
| 4537 | 4537 | .add, |
| 4538 | 4538 | .@"add nsw", |
| ... | ... | @@ -4679,7 +4679,7 @@ pub const Function = struct { |
| 4679 | 4679 | .changeScalarAssumeCapacity(.i1, wip.builder), |
| 4680 | 4680 | .fneg, |
| 4681 | 4681 | .@"fneg fast", |
| 4682 | => @as(Value, @enumFromInt(instruction.data)).typeOfWip(wip), | |
| 4682 | => @as(Value, @fromBackingInt(@intCast(instruction.data))).typeOfWip(wip), | |
| 4683 | 4683 | .getelementptr, |
| 4684 | 4684 | .@"getelementptr inbounds", |
| 4685 | 4685 | => { |
| ... | ... | @@ -4721,7 +4721,7 @@ pub const Function = struct { |
| 4721 | 4721 | builder: *Builder, |
| 4722 | 4722 | ) Type { |
| 4723 | 4723 | const function = function_index.ptrConst(builder); |
| 4724 | const instruction = function.instructions.get(@intFromEnum(self)); | |
| 4724 | const instruction = function.instructions.get(@backingInt(self)); | |
| 4725 | 4725 | return switch (instruction.tag) { |
| 4726 | 4726 | .add, |
| 4727 | 4727 | .@"add nsw", |
| ... | ... | @@ -4871,7 +4871,7 @@ pub const Function = struct { |
| 4871 | 4871 | .changeScalarAssumeCapacity(.i1, builder), |
| 4872 | 4872 | .fneg, |
| 4873 | 4873 | .@"fneg fast", |
| 4874 | => @as(Value, @enumFromInt(instruction.data)).typeOf(function_index, builder), | |
| 4874 | => @as(Value, @fromBackingInt(@intCast(instruction.data))).typeOf(function_index, builder), | |
| 4875 | 4875 | .getelementptr, |
| 4876 | 4876 | .@"getelementptr inbounds", |
| 4877 | 4877 | => { |
| ... | ... | @@ -4963,11 +4963,11 @@ pub const Function = struct { |
| 4963 | 4963 | |
| 4964 | 4964 | pub fn fromMetadata(metadata: Metadata) Weights { |
| 4965 | 4965 | assert(metadata.kind == .node); |
| 4966 | return @enumFromInt(metadata.index); | |
| 4966 | return @fromBackingInt(@intCast(metadata.index)); | |
| 4967 | 4967 | } |
| 4968 | 4968 | |
| 4969 | 4969 | pub fn toMetadata(weights: Weights) Metadata { |
| 4970 | return .{ .index = @intCast(@intFromEnum(weights)), .kind = .node }; | |
| 4970 | return .{ .index = @intCast(@backingInt(weights)), .kind = .node }; | |
| 4971 | 4971 | } |
| 4972 | 4972 | }; |
| 4973 | 4973 | }; |
| ... | ... | @@ -5156,7 +5156,7 @@ pub const Function = struct { |
| 5156 | 5156 | assert(argument.tag == .arg); |
| 5157 | 5157 | assert(argument.data == index); |
| 5158 | 5158 | |
| 5159 | const argument_index: Instruction.Index = @enumFromInt(index); | |
| 5159 | const argument_index: Instruction.Index = @fromBackingInt(@intCast(index)); | |
| 5160 | 5160 | return argument_index.toValue(); |
| 5161 | 5161 | } |
| 5162 | 5162 | |
| ... | ... | @@ -5202,7 +5202,7 @@ pub const Function = struct { |
| 5202 | 5202 | Type, |
| 5203 | 5203 | Value, |
| 5204 | 5204 | Instruction.BrCond.Weights, |
| 5205 | => @enumFromInt(value), | |
| 5205 | => @fromBackingInt(@intCast(value)), | |
| 5206 | 5206 | MemoryAccessInfo, |
| 5207 | 5207 | Instruction.Alloca.Info, |
| 5208 | 5208 | Instruction.Call.Info, |
| ... | ... | @@ -5271,15 +5271,15 @@ pub const WipFunction = struct { |
| 5271 | 5271 | _, |
| 5272 | 5272 | |
| 5273 | 5273 | pub fn ptr(self: Index, wip: *WipFunction) *Block { |
| 5274 | return &wip.blocks.items[@intFromEnum(self)]; | |
| 5274 | return &wip.blocks.items[@backingInt(self)]; | |
| 5275 | 5275 | } |
| 5276 | 5276 | |
| 5277 | 5277 | pub fn ptrConst(self: Index, wip: *const WipFunction) *const Block { |
| 5278 | return &wip.blocks.items[@intFromEnum(self)]; | |
| 5278 | return &wip.blocks.items[@backingInt(self)]; | |
| 5279 | 5279 | } |
| 5280 | 5280 | |
| 5281 | 5281 | pub fn toInst(self: Index, function: *const Function) Instruction.Index { |
| 5282 | return function.blocks[@intFromEnum(self)].instruction; | |
| 5282 | return function.blocks[@backingInt(self)].instruction; | |
| 5283 | 5283 | } |
| 5284 | 5284 | }; |
| 5285 | 5285 | }; |
| ... | ... | @@ -5327,14 +5327,14 @@ pub const WipFunction = struct { |
| 5327 | 5327 | assert(argument.tag == .arg); |
| 5328 | 5328 | assert(argument.data == index); |
| 5329 | 5329 | |
| 5330 | const argument_index: Instruction.Index = @enumFromInt(index); | |
| 5330 | const argument_index: Instruction.Index = @fromBackingInt(@intCast(index)); | |
| 5331 | 5331 | return argument_index.toValue(); |
| 5332 | 5332 | } |
| 5333 | 5333 | |
| 5334 | 5334 | pub fn block(self: *WipFunction, incoming: u32, name: []const u8) Allocator.Error!Block.Index { |
| 5335 | 5335 | try self.blocks.ensureUnusedCapacity(self.builder.gpa, 1); |
| 5336 | 5336 | |
| 5337 | const index: Block.Index = @enumFromInt(self.blocks.items.len); | |
| 5337 | const index: Block.Index = @fromBackingInt(@intCast(self.blocks.items.len)); | |
| 5338 | 5338 | const final_name = if (self.strip) .empty else try self.builder.string(name); |
| 5339 | 5339 | self.blocks.appendAssumeCapacity(.{ |
| 5340 | 5340 | .name = final_name, |
| ... | ... | @@ -5347,7 +5347,7 @@ pub const WipFunction = struct { |
| 5347 | 5347 | pub fn ret(self: *WipFunction, val: Value) Allocator.Error!Instruction.Index { |
| 5348 | 5348 | assert(val.typeOfWip(self) == self.function.typeOf(self.builder).functionReturn(self.builder)); |
| 5349 | 5349 | try self.ensureUnusedExtraCapacity(1, NoExtra, 0); |
| 5350 | return try self.addInst(null, .{ .tag = .ret, .data = @intFromEnum(val) }); | |
| 5350 | return try self.addInst(null, .{ .tag = .ret, .data = @backingInt(val) }); | |
| 5351 | 5351 | } |
| 5352 | 5352 | |
| 5353 | 5353 | pub fn retVoid(self: *WipFunction) Allocator.Error!Instruction.Index { |
| ... | ... | @@ -5357,7 +5357,7 @@ pub const WipFunction = struct { |
| 5357 | 5357 | |
| 5358 | 5358 | pub fn br(self: *WipFunction, dest: Block.Index) Allocator.Error!Instruction.Index { |
| 5359 | 5359 | try self.ensureUnusedExtraCapacity(1, NoExtra, 0); |
| 5360 | const instruction = try self.addInst(null, .{ .tag = .br, .data = @intFromEnum(dest) }); | |
| 5360 | const instruction = try self.addInst(null, .{ .tag = .br, .data = @backingInt(dest) }); | |
| 5361 | 5361 | dest.ptr(self).branches += 1; |
| 5362 | 5362 | return instruction; |
| 5363 | 5363 | } |
| ... | ... | @@ -5409,7 +5409,7 @@ pub const WipFunction = struct { |
| 5409 | 5409 | dest: Block.Index, |
| 5410 | 5410 | wip: *WipFunction, |
| 5411 | 5411 | ) Allocator.Error!void { |
| 5412 | const instruction = wip.instructions.get(@intFromEnum(self.instruction)); | |
| 5412 | const instruction = wip.instructions.get(@backingInt(self.instruction)); | |
| 5413 | 5413 | var extra = wip.extraDataTrail(Instruction.Switch, instruction.data); |
| 5414 | 5414 | assert(val.typeOf(wip.builder) == extra.data.val.typeOfWip(wip)); |
| 5415 | 5415 | extra.trail.nextMut(extra.data.cases_len, Constant, wip)[self.index] = val; |
| ... | ... | @@ -5419,7 +5419,7 @@ pub const WipFunction = struct { |
| 5419 | 5419 | } |
| 5420 | 5420 | |
| 5421 | 5421 | pub fn finish(self: WipSwitch, wip: *WipFunction) void { |
| 5422 | const instruction = wip.instructions.get(@intFromEnum(self.instruction)); | |
| 5422 | const instruction = wip.instructions.get(@backingInt(self.instruction)); | |
| 5423 | 5423 | const extra = wip.extraData(Instruction.Switch, instruction.data); |
| 5424 | 5424 | assert(self.index == extra.cases_len); |
| 5425 | 5425 | } |
| ... | ... | @@ -5483,7 +5483,7 @@ pub const WipFunction = struct { |
| 5483 | 5483 | else => unreachable, |
| 5484 | 5484 | } |
| 5485 | 5485 | try self.ensureUnusedExtraCapacity(1, NoExtra, 0); |
| 5486 | const instruction = try self.addInst(name, .{ .tag = tag, .data = @intFromEnum(val) }); | |
| 5486 | const instruction = try self.addInst(name, .{ .tag = tag, .data = @backingInt(val) }); | |
| 5487 | 5487 | return instruction.toValue(); |
| 5488 | 5488 | } |
| 5489 | 5489 | |
| ... | ... | @@ -6060,7 +6060,7 @@ pub const WipFunction = struct { |
| 6060 | 6060 | ) void { |
| 6061 | 6061 | const incoming_len = self.block.ptrConst(wip).incoming; |
| 6062 | 6062 | assert(vals.len == incoming_len and blocks.len == incoming_len); |
| 6063 | const instruction = wip.instructions.get(@intFromEnum(self.instruction)); | |
| 6063 | const instruction = wip.instructions.get(@backingInt(self.instruction)); | |
| 6064 | 6064 | var extra = wip.extraDataTrail(Instruction.Phi, instruction.data); |
| 6065 | 6065 | for (vals) |val| assert(val.typeOfWip(wip) == extra.data.type); |
| 6066 | 6066 | @memcpy(extra.trail.nextMut(incoming_len, Value, wip), vals); |
| ... | ... | @@ -6326,7 +6326,7 @@ pub const WipFunction = struct { |
| 6326 | 6326 | if (val == .none) return .none; |
| 6327 | 6327 | return switch (val.unwrap()) { |
| 6328 | 6328 | .instruction => |instruction| instructions.items[ |
| 6329 | @intFromEnum(instruction) | |
| 6329 | @backingInt(instruction) | |
| 6330 | 6330 | ].toValue(), |
| 6331 | 6331 | .constant => |constant| constant.toValue(), |
| 6332 | 6332 | .metadata => |metadata| metadata.toValue(), |
| ... | ... | @@ -6366,7 +6366,7 @@ pub const WipFunction = struct { |
| 6366 | 6366 | Type, |
| 6367 | 6367 | Value, |
| 6368 | 6368 | Instruction.BrCond.Weights, |
| 6369 | => @intFromEnum(value), | |
| 6369 | => @backingInt(value), | |
| 6370 | 6370 | MemoryAccessInfo, |
| 6371 | 6371 | Instruction.Alloca.Info, |
| 6372 | 6372 | Instruction.Call.Info, |
| ... | ... | @@ -6388,7 +6388,7 @@ pub const WipFunction = struct { |
| 6388 | 6388 | |
| 6389 | 6389 | fn appendMappedValues(wip_extra: *@This(), vals: []const Value, ctx: anytype) void { |
| 6390 | 6390 | for (wip_extra.items[wip_extra.index..][0..vals.len], vals) |*extra, val| |
| 6391 | extra.* = @intFromEnum(ctx.map(val)); | |
| 6391 | extra.* = @backingInt(ctx.map(val)); | |
| 6392 | 6392 | wip_extra.index += @intCast(vals.len); |
| 6393 | 6393 | } |
| 6394 | 6394 | |
| ... | ... | @@ -6414,24 +6414,24 @@ pub const WipFunction = struct { |
| 6414 | 6414 | errdefer function.instructions.shrinkRetainingCapacity(0); |
| 6415 | 6415 | |
| 6416 | 6416 | { |
| 6417 | var final_instruction_index: Instruction.Index = @enumFromInt(0); | |
| 6417 | var final_instruction_index: Instruction.Index = @fromBackingInt(@intCast(0)); | |
| 6418 | 6418 | for (0..params_len) |param_index| { |
| 6419 | 6419 | instructions.items[param_index] = final_instruction_index; |
| 6420 | final_instruction_index = @enumFromInt(@intFromEnum(final_instruction_index) + 1); | |
| 6420 | final_instruction_index = @fromBackingInt(@intCast(@backingInt(final_instruction_index) + 1)); | |
| 6421 | 6421 | } |
| 6422 | 6422 | for (blocks, self.blocks.items) |*final_block, current_block| { |
| 6423 | 6423 | assert(current_block.incoming == current_block.branches); |
| 6424 | 6424 | final_block.instruction = final_instruction_index; |
| 6425 | final_instruction_index = @enumFromInt(@intFromEnum(final_instruction_index) + 1); | |
| 6425 | final_instruction_index = @fromBackingInt(@intCast(@backingInt(final_instruction_index) + 1)); | |
| 6426 | 6426 | for (current_block.instructions.items) |instruction| { |
| 6427 | instructions.items[@intFromEnum(instruction)] = final_instruction_index; | |
| 6428 | final_instruction_index = @enumFromInt(@intFromEnum(final_instruction_index) + 1); | |
| 6427 | instructions.items[@backingInt(instruction)] = final_instruction_index; | |
| 6428 | final_instruction_index = @fromBackingInt(@intCast(@backingInt(final_instruction_index) + 1)); | |
| 6429 | 6429 | } |
| 6430 | 6430 | } |
| 6431 | 6431 | } |
| 6432 | 6432 | |
| 6433 | 6433 | var wip_name: struct { |
| 6434 | next_name: String = @enumFromInt(0), | |
| 6434 | next_name: String = @fromBackingInt(@intCast(0)), | |
| 6435 | 6435 | next_unique_name: std.AutoHashMap(String, String), |
| 6436 | 6436 | builder: *Builder, |
| 6437 | 6437 | |
| ... | ... | @@ -6440,19 +6440,19 @@ pub const WipFunction = struct { |
| 6440 | 6440 | .none => return .none, |
| 6441 | 6441 | .empty => { |
| 6442 | 6442 | assert(wip_name.next_name != .none); |
| 6443 | defer wip_name.next_name = @enumFromInt(@intFromEnum(wip_name.next_name) + 1); | |
| 6443 | defer wip_name.next_name = @fromBackingInt(@intCast(@backingInt(wip_name.next_name) + 1)); | |
| 6444 | 6444 | return wip_name.next_name; |
| 6445 | 6445 | }, |
| 6446 | 6446 | _ => { |
| 6447 | 6447 | assert(!name.isAnon()); |
| 6448 | 6448 | const gop = try wip_name.next_unique_name.getOrPut(name); |
| 6449 | 6449 | if (!gop.found_existing) { |
| 6450 | gop.value_ptr.* = @enumFromInt(0); | |
| 6450 | gop.value_ptr.* = @fromBackingInt(@intCast(0)); | |
| 6451 | 6451 | return name; |
| 6452 | 6452 | } |
| 6453 | 6453 | |
| 6454 | 6454 | while (true) { |
| 6455 | gop.value_ptr.* = @enumFromInt(@intFromEnum(gop.value_ptr.*) + 1); | |
| 6455 | gop.value_ptr.* = @fromBackingInt(@intCast(@backingInt(gop.value_ptr.*) + 1)); | |
| 6456 | 6456 | const unique_name = try wip_name.builder.fmt("{f}{s}{f}", .{ |
| 6457 | 6457 | name.fmtRaw(wip_name.builder), |
| 6458 | 6458 | sep, |
| ... | ... | @@ -6460,7 +6460,7 @@ pub const WipFunction = struct { |
| 6460 | 6460 | }); |
| 6461 | 6461 | const unique_gop = try wip_name.next_unique_name.getOrPut(unique_name); |
| 6462 | 6462 | if (!unique_gop.found_existing) { |
| 6463 | unique_gop.value_ptr.* = @enumFromInt(0); | |
| 6463 | unique_gop.value_ptr.* = @fromBackingInt(@intCast(0)); | |
| 6464 | 6464 | return unique_name; |
| 6465 | 6465 | } |
| 6466 | 6466 | } |
| ... | ... | @@ -6475,16 +6475,16 @@ pub const WipFunction = struct { |
| 6475 | 6475 | |
| 6476 | 6476 | var value_index: u32 = 0; |
| 6477 | 6477 | for (0..params_len) |param_index| { |
| 6478 | const old_argument_index: Instruction.Index = @enumFromInt(param_index); | |
| 6479 | const new_argument_index: Instruction.Index = @enumFromInt(function.instructions.len); | |
| 6480 | const argument = self.instructions.get(@intFromEnum(old_argument_index)); | |
| 6478 | const old_argument_index: Instruction.Index = @fromBackingInt(@intCast(param_index)); | |
| 6479 | const new_argument_index: Instruction.Index = @fromBackingInt(@intCast(function.instructions.len)); | |
| 6480 | const argument = self.instructions.get(@backingInt(old_argument_index)); | |
| 6481 | 6481 | assert(argument.tag == .arg); |
| 6482 | 6482 | assert(argument.data == param_index); |
| 6483 | 6483 | value_indices[function.instructions.len] = value_index; |
| 6484 | 6484 | value_index += 1; |
| 6485 | 6485 | function.instructions.appendAssumeCapacity(argument); |
| 6486 | names[@intFromEnum(new_argument_index)] = try wip_name.map( | |
| 6487 | if (self.strip) .empty else self.names.items[@intFromEnum(old_argument_index)], | |
| 6486 | names[@backingInt(new_argument_index)] = try wip_name.map( | |
| 6487 | if (self.strip) .empty else self.names.items[@backingInt(old_argument_index)], | |
| 6488 | 6488 | ".", |
| 6489 | 6489 | ); |
| 6490 | 6490 | if (self.debug_locations.get(old_argument_index)) |location| { |
| ... | ... | @@ -6495,16 +6495,16 @@ pub const WipFunction = struct { |
| 6495 | 6495 | } |
| 6496 | 6496 | } |
| 6497 | 6497 | for (self.blocks.items) |current_block| { |
| 6498 | const new_block_index: Instruction.Index = @enumFromInt(function.instructions.len); | |
| 6498 | const new_block_index: Instruction.Index = @fromBackingInt(@intCast(function.instructions.len)); | |
| 6499 | 6499 | value_indices[function.instructions.len] = value_index; |
| 6500 | 6500 | function.instructions.appendAssumeCapacity(.{ |
| 6501 | 6501 | .tag = .block, |
| 6502 | 6502 | .data = current_block.incoming, |
| 6503 | 6503 | }); |
| 6504 | names[@intFromEnum(new_block_index)] = try wip_name.map(current_block.name, ""); | |
| 6504 | names[@backingInt(new_block_index)] = try wip_name.map(current_block.name, ""); | |
| 6505 | 6505 | for (current_block.instructions.items) |old_instruction_index| { |
| 6506 | const new_instruction_index: Instruction.Index = @enumFromInt(function.instructions.len); | |
| 6507 | var instruction = self.instructions.get(@intFromEnum(old_instruction_index)); | |
| 6506 | const new_instruction_index: Instruction.Index = @fromBackingInt(@intCast(function.instructions.len)); | |
| 6507 | var instruction = self.instructions.get(@backingInt(old_instruction_index)); | |
| 6508 | 6508 | switch (instruction.tag) { |
| 6509 | 6509 | .add, |
| 6510 | 6510 | .@"add nsw", |
| ... | ... | @@ -6702,7 +6702,7 @@ pub const WipFunction = struct { |
| 6702 | 6702 | .fneg, |
| 6703 | 6703 | .@"fneg fast", |
| 6704 | 6704 | .ret, |
| 6705 | => instruction.data = @intFromEnum(instructions.map(@enumFromInt(instruction.data))), | |
| 6705 | => instruction.data = @backingInt(instructions.map(@fromBackingInt(@intCast(instruction.data)))), | |
| 6706 | 6706 | .getelementptr, |
| 6707 | 6707 | .@"getelementptr inbounds", |
| 6708 | 6708 | => { |
| ... | ... | @@ -6815,10 +6815,10 @@ pub const WipFunction = struct { |
| 6815 | 6815 | }, |
| 6816 | 6816 | } |
| 6817 | 6817 | function.instructions.appendAssumeCapacity(instruction); |
| 6818 | names[@intFromEnum(new_instruction_index)] = try wip_name.map(if (self.strip) | |
| 6818 | names[@backingInt(new_instruction_index)] = try wip_name.map(if (self.strip) | |
| 6819 | 6819 | if (old_instruction_index.hasResultWip(self)) .empty else .none |
| 6820 | 6820 | else |
| 6821 | self.names.items[@intFromEnum(old_instruction_index)], "."); | |
| 6821 | self.names.items[@backingInt(old_instruction_index)], "."); | |
| 6822 | 6822 | |
| 6823 | 6823 | if (self.debug_locations.get(old_instruction_index)) |location| { |
| 6824 | 6824 | debug_locations.putAssumeCapacity(new_instruction_index, location); |
| ... | ... | @@ -6828,7 +6828,7 @@ pub const WipFunction = struct { |
| 6828 | 6828 | debug_values[index] = new_instruction_index; |
| 6829 | 6829 | } |
| 6830 | 6830 | |
| 6831 | value_indices[@intFromEnum(new_instruction_index)] = value_index; | |
| 6831 | value_indices[@backingInt(new_instruction_index)] = value_index; | |
| 6832 | 6832 | if (old_instruction_index.hasResultWip(self)) value_index += 1; |
| 6833 | 6833 | } |
| 6834 | 6834 | } |
| ... | ... | @@ -6996,7 +6996,7 @@ pub const WipFunction = struct { |
| 6996 | 6996 | else |
| 6997 | 6997 | .none; |
| 6998 | 6998 | |
| 6999 | const index: Instruction.Index = @enumFromInt(self.instructions.len); | |
| 6999 | const index: Instruction.Index = @fromBackingInt(@intCast(self.instructions.len)); | |
| 7000 | 7000 | self.instructions.appendAssumeCapacity(instruction); |
| 7001 | 7001 | if (!self.strip) { |
| 7002 | 7002 | self.names.appendAssumeCapacity(final_name); |
| ... | ... | @@ -7026,7 +7026,7 @@ pub const WipFunction = struct { |
| 7026 | 7026 | Type, |
| 7027 | 7027 | Value, |
| 7028 | 7028 | Instruction.BrCond.Weights, |
| 7029 | => @intFromEnum(value), | |
| 7029 | => @backingInt(value), | |
| 7030 | 7030 | MemoryAccessInfo, |
| 7031 | 7031 | Instruction.Alloca.Info, |
| 7032 | 7032 | Instruction.Call.Info, |
| ... | ... | @@ -7079,7 +7079,7 @@ pub const WipFunction = struct { |
| 7079 | 7079 | Type, |
| 7080 | 7080 | Value, |
| 7081 | 7081 | Instruction.BrCond.Weights, |
| 7082 | => @enumFromInt(value), | |
| 7082 | => @fromBackingInt(@intCast(value)), | |
| 7083 | 7083 | MemoryAccessInfo, |
| 7084 | 7084 | Instruction.Alloca.Info, |
| 7085 | 7085 | Instruction.Call.Info, |
| ... | ... | @@ -7268,7 +7268,7 @@ pub const Constant = enum(u32) { |
| 7268 | 7268 | no_init = (1 << 30) - 1, |
| 7269 | 7269 | _, |
| 7270 | 7270 | |
| 7271 | const first_global: Constant = @enumFromInt(1 << 29); | |
| 7271 | const first_global: Constant = @fromBackingInt(@intCast(1 << 29)); | |
| 7272 | 7272 | |
| 7273 | 7273 | pub const Tag = enum(u7) { |
| 7274 | 7274 | positive_integer, |
| ... | ... | @@ -7441,14 +7441,14 @@ pub const Constant = enum(u32) { |
| 7441 | 7441 | constant: u30, |
| 7442 | 7442 | global: Global.Index, |
| 7443 | 7443 | } { |
| 7444 | return if (@intFromEnum(self) < @intFromEnum(first_global)) | |
| 7445 | .{ .constant = @intCast(@intFromEnum(self)) } | |
| 7444 | return if (@backingInt(self) < @backingInt(first_global)) | |
| 7445 | .{ .constant = @intCast(@backingInt(self)) } | |
| 7446 | 7446 | else |
| 7447 | .{ .global = @enumFromInt(@intFromEnum(self) - @intFromEnum(first_global)) }; | |
| 7447 | .{ .global = @fromBackingInt(@intCast(@backingInt(self) - @backingInt(first_global))) }; | |
| 7448 | 7448 | } |
| 7449 | 7449 | |
| 7450 | 7450 | pub fn toValue(self: Constant) Value { |
| 7451 | return @enumFromInt(Value.first_constant + @intFromEnum(self)); | |
| 7451 | return @fromBackingInt(@intCast(Value.first_constant + @backingInt(self))); | |
| 7452 | 7452 | } |
| 7453 | 7453 | |
| 7454 | 7454 | pub fn typeOf(self: Constant, builder: *Builder) Type { |
| ... | ... | @@ -7474,7 +7474,7 @@ pub const Constant = enum(u32) { |
| 7474 | 7474 | .zeroinitializer, |
| 7475 | 7475 | .undef, |
| 7476 | 7476 | .poison, |
| 7477 | => @enumFromInt(item.data), | |
| 7477 | => @fromBackingInt(@intCast(item.data)), | |
| 7478 | 7478 | .structure, |
| 7479 | 7479 | .packed_structure, |
| 7480 | 7480 | .array, |
| ... | ... | @@ -7482,7 +7482,7 @@ pub const Constant = enum(u32) { |
| 7482 | 7482 | => builder.constantExtraData(Aggregate, item.data).type, |
| 7483 | 7483 | .splat => builder.constantExtraData(Splat, item.data).type, |
| 7484 | 7484 | .string => builder.arrayTypeAssumeCapacity( |
| 7485 | @as(String, @enumFromInt(item.data)).slice(builder).?.len, | |
| 7485 | @as(String, @fromBackingInt(@intCast(item.data))).slice(builder).?.len, | |
| 7486 | 7486 | .i8, |
| 7487 | 7487 | ), |
| 7488 | 7488 | .blockaddress => builder.ptrTypeAssumeCapacity( |
| ... | ... | @@ -7491,7 +7491,7 @@ pub const Constant = enum(u32) { |
| 7491 | 7491 | ), |
| 7492 | 7492 | .dso_local_equivalent, |
| 7493 | 7493 | .no_cfi, |
| 7494 | => builder.ptrTypeAssumeCapacity(@as(Function.Index, @enumFromInt(item.data)) | |
| 7494 | => builder.ptrTypeAssumeCapacity(@as(Function.Index, @fromBackingInt(@intCast(item.data))) | |
| 7495 | 7495 | .ptrConst(builder).global.ptrConst(builder).addr_space), |
| 7496 | 7496 | .trunc, |
| 7497 | 7497 | .ptrtoint, |
| ... | ... | @@ -7802,7 +7802,7 @@ pub const Constant = enum(u32) { |
| 7802 | 7802 | try w.writeByte('>'); |
| 7803 | 7803 | }, |
| 7804 | 7804 | .string => try w.print("c{f}", .{ |
| 7805 | @as(String, @enumFromInt(item.data)).fmtQ(data.builder), | |
| 7805 | @as(String, @fromBackingInt(@intCast(item.data))).fmtQ(data.builder), | |
| 7806 | 7806 | }), |
| 7807 | 7807 | .blockaddress => |tag| { |
| 7808 | 7808 | const extra = data.builder.constantExtraData(BlockAddress, item.data); |
| ... | ... | @@ -7816,7 +7816,7 @@ pub const Constant = enum(u32) { |
| 7816 | 7816 | .dso_local_equivalent, |
| 7817 | 7817 | .no_cfi, |
| 7818 | 7818 | => |tag| { |
| 7819 | const function: Function.Index = @enumFromInt(item.data); | |
| 7819 | const function: Function.Index = @fromBackingInt(@intCast(item.data)); | |
| 7820 | 7820 | try w.print("{s} {f}", .{ |
| 7821 | 7821 | @tagName(tag), |
| 7822 | 7822 | function.ptrConst(data.builder).global.fmt(data.builder), |
| ... | ... | @@ -7905,10 +7905,10 @@ pub const Constant = enum(u32) { |
| 7905 | 7905 | |
| 7906 | 7906 | pub const Value = enum(u32) { |
| 7907 | 7907 | none = maxInt(u31), |
| 7908 | false = first_constant + @intFromEnum(Constant.false), | |
| 7909 | true = first_constant + @intFromEnum(Constant.true), | |
| 7910 | @"0" = first_constant + @intFromEnum(Constant.@"0"), | |
| 7911 | @"1" = first_constant + @intFromEnum(Constant.@"1"), | |
| 7908 | false = first_constant + @backingInt(Constant.false), | |
| 7909 | true = first_constant + @backingInt(Constant.true), | |
| 7910 | @"0" = first_constant + @backingInt(Constant.@"0"), | |
| 7911 | @"1" = first_constant + @backingInt(Constant.@"1"), | |
| 7912 | 7912 | _, |
| 7913 | 7913 | |
| 7914 | 7914 | const first_constant = 1 << 30; |
| ... | ... | @@ -7919,12 +7919,12 @@ pub const Value = enum(u32) { |
| 7919 | 7919 | constant: Constant, |
| 7920 | 7920 | metadata: Metadata, |
| 7921 | 7921 | } { |
| 7922 | return if (@intFromEnum(self) < first_constant) | |
| 7923 | .{ .instruction = @enumFromInt(@intFromEnum(self)) } | |
| 7924 | else if (@intFromEnum(self) < first_metadata) | |
| 7925 | .{ .constant = @enumFromInt(@intFromEnum(self) - first_constant) } | |
| 7922 | return if (@backingInt(self) < first_constant) | |
| 7923 | .{ .instruction = @fromBackingInt(@intCast(@backingInt(self))) } | |
| 7924 | else if (@backingInt(self) < first_metadata) | |
| 7925 | .{ .constant = @fromBackingInt(@intCast(@backingInt(self) - first_constant)) } | |
| 7926 | 7926 | else |
| 7927 | .{ .metadata = @bitCast(@intFromEnum(self) - first_metadata) }; | |
| 7927 | .{ .metadata = @bitCast(@backingInt(self) - first_metadata) }; | |
| 7928 | 7928 | } |
| 7929 | 7929 | |
| 7930 | 7930 | pub fn typeOfWip(self: Value, wip: *const WipFunction) Type { |
| ... | ... | @@ -8016,7 +8016,7 @@ pub const Metadata = packed struct(u32) { |
| 8016 | 8016 | return .{ .index = metadata.index, .kind = metadata.kind, .is_none = false }; |
| 8017 | 8017 | } |
| 8018 | 8018 | pub fn toValue(metadata: Metadata) Value { |
| 8019 | return @enumFromInt(Value.first_metadata + @as(u32, @bitCast(metadata))); | |
| 8019 | return @fromBackingInt(@intCast(Value.first_metadata + @as(u32, @bitCast(metadata)))); | |
| 8020 | 8020 | } |
| 8021 | 8021 | |
| 8022 | 8022 | pub const String = enum(u32) { |
| ... | ... | @@ -8032,7 +8032,7 @@ pub const Metadata = packed struct(u32) { |
| 8032 | 8032 | pub fn unwrap(metadata: Metadata.String.Optional) ?Metadata.String { |
| 8033 | 8033 | return switch (metadata) { |
| 8034 | 8034 | .none => null, |
| 8035 | else => @enumFromInt(@intFromEnum(metadata)), | |
| 8035 | else => @fromBackingInt(@intCast(@backingInt(metadata))), | |
| 8036 | 8036 | }; |
| 8037 | 8037 | } |
| 8038 | 8038 | pub fn toMetadata(metadata: Metadata.String.Optional) Metadata.Optional { |
| ... | ... | @@ -8040,14 +8040,14 @@ pub const Metadata = packed struct(u32) { |
| 8040 | 8040 | } |
| 8041 | 8041 | }; |
| 8042 | 8042 | pub fn toOptional(metadata: Metadata.String) Metadata.String.Optional { |
| 8043 | return @enumFromInt(@intFromEnum(metadata)); | |
| 8043 | return @fromBackingInt(@intCast(@backingInt(metadata))); | |
| 8044 | 8044 | } |
| 8045 | 8045 | pub fn toMetadata(metadata: Metadata.String) Metadata { |
| 8046 | return .{ .index = @intCast(@intFromEnum(metadata)), .kind = .string }; | |
| 8046 | return .{ .index = @intCast(@backingInt(metadata)), .kind = .string }; | |
| 8047 | 8047 | } |
| 8048 | 8048 | |
| 8049 | 8049 | pub fn slice(metadata: Metadata.String, builder: *const Builder) []const u8 { |
| 8050 | const index = @intFromEnum(metadata); | |
| 8050 | const index = @backingInt(metadata); | |
| 8051 | 8051 | const start = builder.metadata_string_indices.items[index]; |
| 8052 | 8052 | const end = builder.metadata_string_indices.items[index + 1]; |
| 8053 | 8053 | return builder.metadata_string_bytes.items[start..end]; |
| ... | ... | @@ -8059,7 +8059,7 @@ pub const Metadata = packed struct(u32) { |
| 8059 | 8059 | return @truncate(std.hash.Wyhash.hash(0, key)); |
| 8060 | 8060 | } |
| 8061 | 8061 | pub fn eql(ctx: Adapter, lhs_key: []const u8, _: void, rhs_index: usize) bool { |
| 8062 | const rhs_metadata: Metadata.String = @enumFromInt(rhs_index); | |
| 8062 | const rhs_metadata: Metadata.String = @fromBackingInt(@intCast(rhs_index)); | |
| 8063 | 8063 | return std.mem.eql(u8, lhs_key, rhs_metadata.slice(ctx.builder)); |
| 8064 | 8064 | } |
| 8065 | 8065 | }; |
| ... | ... | @@ -8077,7 +8077,7 @@ pub const Metadata = packed struct(u32) { |
| 8077 | 8077 | }; |
| 8078 | 8078 | pub fn toString(metadata: Metadata) Metadata.String { |
| 8079 | 8079 | assert(metadata.kind == .string); |
| 8080 | return @enumFromInt(metadata.index); | |
| 8080 | return @fromBackingInt(@intCast(metadata.index)); | |
| 8081 | 8081 | } |
| 8082 | 8082 | |
| 8083 | 8083 | pub const Tag = enum(u6) { |
| ... | ... | @@ -8542,7 +8542,7 @@ pub const Metadata = packed struct(u32) { |
| 8542 | 8542 | try w.writeByte(')'); |
| 8543 | 8543 | }, |
| 8544 | 8544 | .constant => try Constant.format(.{ |
| 8545 | .constant = @enumFromInt(node_item.data), | |
| 8545 | .constant = @fromBackingInt(@intCast(node_item.data)), | |
| 8546 | 8546 | .builder = builder, |
| 8547 | 8547 | .flags = data.specialized orelse .{}, |
| 8548 | 8548 | }, w), |
| ... | ... | @@ -8744,7 +8744,7 @@ pub fn init(options: Options) Allocator.Error!Builder { |
| 8744 | 8744 | .string_bytes = .empty, |
| 8745 | 8745 | |
| 8746 | 8746 | .types = .empty, |
| 8747 | .next_unnamed_type = @enumFromInt(0), | |
| 8747 | .next_unnamed_type = @fromBackingInt(@intCast(0)), | |
| 8748 | 8748 | .next_unique_type_id = .empty, |
| 8749 | 8749 | .type_map = .empty, |
| 8750 | 8750 | .type_items = .empty, |
| ... | ... | @@ -8758,7 +8758,7 @@ pub fn init(options: Options) Allocator.Error!Builder { |
| 8758 | 8758 | .function_attributes_set = .empty, |
| 8759 | 8759 | |
| 8760 | 8760 | .globals = .empty, |
| 8761 | .next_unnamed_global = @enumFromInt(0), | |
| 8761 | .next_unnamed_global = @fromBackingInt(@intCast(0)), | |
| 8762 | 8762 | .next_replaced_global = .none, |
| 8763 | 8763 | .next_unique_global_id = .empty, |
| 8764 | 8764 | .aliases = .empty, |
| ... | ... | @@ -8815,7 +8815,7 @@ pub fn init(options: Options) Allocator.Error!Builder { |
| 8815 | 8815 | assert(self.intTypeAssumeCapacity(bits) == |
| 8816 | 8816 | @field(Type, std.fmt.comptimePrint("i{d}", .{bits}))); |
| 8817 | 8817 | inline for (.{ 0, 4 }) |addr_space_index| { |
| 8818 | const addr_space: AddrSpace = @enumFromInt(addr_space_index); | |
| 8818 | const addr_space: AddrSpace = @fromBackingInt(@intCast(addr_space_index)); | |
| 8819 | 8819 | assert(self.ptrTypeAssumeCapacity(addr_space) == |
| 8820 | 8820 | @field(Type, std.fmt.comptimePrint("ptr{f}", .{addr_space.fmt(" ")}))); |
| 8821 | 8821 | } |
| ... | ... | @@ -9070,9 +9070,9 @@ pub fn namedTypeSetBody( |
| 9070 | 9070 | named_type: Type, |
| 9071 | 9071 | body_type: Type, |
| 9072 | 9072 | ) void { |
| 9073 | const named_item = self.type_items.items[@intFromEnum(named_type)]; | |
| 9073 | const named_item = self.type_items.items[@backingInt(named_type)]; | |
| 9074 | 9074 | self.type_extra.items[named_item.data + std.meta.fieldIndex(Type.NamedStructure, "body").?] = |
| 9075 | @intFromEnum(body_type); | |
| 9075 | @backingInt(body_type); | |
| 9076 | 9076 | } |
| 9077 | 9077 | |
| 9078 | 9078 | pub fn attr(self: *Builder, attribute: Attribute) Allocator.Error!Attribute.Index { |
| ... | ... | @@ -9080,7 +9080,7 @@ pub fn attr(self: *Builder, attribute: Attribute) Allocator.Error!Attribute.Inde |
| 9080 | 9080 | |
| 9081 | 9081 | const gop = self.attributes.getOrPutAssumeCapacity(attribute.toStorage()); |
| 9082 | 9082 | if (!gop.found_existing) gop.value_ptr.* = {}; |
| 9083 | return @enumFromInt(gop.index); | |
| 9083 | return @fromBackingInt(@intCast(gop.index)); | |
| 9084 | 9084 | } |
| 9085 | 9085 | |
| 9086 | 9086 | pub fn attrs(self: *Builder, attributes: []Attribute.Index) Allocator.Error!Attributes { |
| ... | ... | @@ -9089,20 +9089,20 @@ pub fn attrs(self: *Builder, attributes: []Attribute.Index) Allocator.Error!Attr |
| 9089 | 9089 | const lhs_kind = lhs.getKind(builder); |
| 9090 | 9090 | const rhs_kind = rhs.getKind(builder); |
| 9091 | 9091 | assert(lhs_kind != rhs_kind); |
| 9092 | return @intFromEnum(lhs_kind) < @intFromEnum(rhs_kind); | |
| 9092 | return @backingInt(lhs_kind) < @backingInt(rhs_kind); | |
| 9093 | 9093 | } |
| 9094 | 9094 | }.lessThan); |
| 9095 | return @enumFromInt(try self.attrGeneric(@ptrCast(attributes))); | |
| 9095 | return @fromBackingInt(@intCast(try self.attrGeneric(@ptrCast(attributes)))); | |
| 9096 | 9096 | } |
| 9097 | 9097 | |
| 9098 | 9098 | pub fn fnAttrs(self: *Builder, fn_attributes: []const Attributes) Allocator.Error!FunctionAttributes { |
| 9099 | 9099 | try self.function_attributes_set.ensureUnusedCapacity(self.gpa, 1); |
| 9100 | const function_attributes: FunctionAttributes = @enumFromInt(try self.attrGeneric(@ptrCast( | |
| 9100 | const function_attributes: FunctionAttributes = @fromBackingInt(@intCast(try self.attrGeneric(@ptrCast( | |
| 9101 | 9101 | fn_attributes[0..if (std.mem.lastIndexOfNone(Attributes, fn_attributes, &.{.none})) |last| |
| 9102 | 9102 | last + 1 |
| 9103 | 9103 | else |
| 9104 | 9104 | 0], |
| 9105 | ))); | |
| 9105 | )))); | |
| 9106 | 9106 | |
| 9107 | 9107 | _ = self.function_attributes_set.getOrPutAssumeCapacity(function_attributes); |
| 9108 | 9108 | return function_attributes; |
| ... | ... | @@ -9121,13 +9121,13 @@ pub fn addGlobalAssumeCapacity(self: *Builder, name: StrtabString, global: Globa |
| 9121 | 9121 | if (name == .empty) { |
| 9122 | 9122 | id = self.next_unnamed_global; |
| 9123 | 9123 | assert(id != self.next_replaced_global); |
| 9124 | self.next_unnamed_global = @enumFromInt(@intFromEnum(id) + 1); | |
| 9124 | self.next_unnamed_global = @fromBackingInt(@intCast(@backingInt(id) + 1)); | |
| 9125 | 9125 | } |
| 9126 | 9126 | while (true) { |
| 9127 | 9127 | const global_gop = self.globals.getOrPutAssumeCapacity(id); |
| 9128 | 9128 | if (!global_gop.found_existing) { |
| 9129 | 9129 | global_gop.value_ptr.* = global; |
| 9130 | const global_index: Global.Index = @enumFromInt(global_gop.index); | |
| 9130 | const global_index: Global.Index = @fromBackingInt(@intCast(global_gop.index)); | |
| 9131 | 9131 | global_index.updateDsoLocal(self); |
| 9132 | 9132 | return global_index; |
| 9133 | 9133 | } |
| ... | ... | @@ -9140,7 +9140,7 @@ pub fn addGlobalAssumeCapacity(self: *Builder, name: StrtabString, global: Globa |
| 9140 | 9140 | } |
| 9141 | 9141 | |
| 9142 | 9142 | pub fn getGlobal(self: *const Builder, name: StrtabString) ?Global.Index { |
| 9143 | return @enumFromInt(self.globals.getIndex(name) orelse return null); | |
| 9143 | return @fromBackingInt(@intCast(self.globals.getIndex(name) orelse return null)); | |
| 9144 | 9144 | } |
| 9145 | 9145 | |
| 9146 | 9146 | pub fn addAlias( |
| ... | ... | @@ -9164,7 +9164,7 @@ pub fn addAliasAssumeCapacity( |
| 9164 | 9164 | addr_space: AddrSpace, |
| 9165 | 9165 | aliasee: Constant, |
| 9166 | 9166 | ) Alias.Index { |
| 9167 | const alias_index: Alias.Index = @enumFromInt(self.aliases.items.len); | |
| 9167 | const alias_index: Alias.Index = @fromBackingInt(@intCast(self.aliases.items.len)); | |
| 9168 | 9168 | self.aliases.appendAssumeCapacity(.{ .global = self.addGlobalAssumeCapacity(name, .{ |
| 9169 | 9169 | .addr_space = addr_space, |
| 9170 | 9170 | .type = ty, |
| ... | ... | @@ -9192,7 +9192,7 @@ pub fn addVariableAssumeCapacity( |
| 9192 | 9192 | name: StrtabString, |
| 9193 | 9193 | addr_space: AddrSpace, |
| 9194 | 9194 | ) Variable.Index { |
| 9195 | const variable_index: Variable.Index = @enumFromInt(self.variables.items.len); | |
| 9195 | const variable_index: Variable.Index = @fromBackingInt(@intCast(self.variables.items.len)); | |
| 9196 | 9196 | self.variables.appendAssumeCapacity(.{ .global = self.addGlobalAssumeCapacity(name, .{ |
| 9197 | 9197 | .addr_space = addr_space, |
| 9198 | 9198 | .type = ty, |
| ... | ... | @@ -9221,7 +9221,7 @@ pub fn addFunctionAssumeCapacity( |
| 9221 | 9221 | addr_space: AddrSpace, |
| 9222 | 9222 | ) Function.Index { |
| 9223 | 9223 | assert(ty.isFunction(self)); |
| 9224 | const function_index: Function.Index = @enumFromInt(self.functions.items.len); | |
| 9224 | const function_index: Function.Index = @fromBackingInt(@intCast(self.functions.items.len)); | |
| 9225 | 9225 | self.functions.appendAssumeCapacity(.{ |
| 9226 | 9226 | .global = self.addGlobalAssumeCapacity(name, .{ |
| 9227 | 9227 | .addr_space = addr_space, |
| ... | ... | @@ -9331,7 +9331,7 @@ pub fn getIntrinsic( |
| 9331 | 9331 | pub fn intConst(self: *Builder, ty: Type, value: anytype) Allocator.Error!Constant { |
| 9332 | 9332 | const int_value = switch (@typeInfo(@TypeOf(value))) { |
| 9333 | 9333 | .int, .comptime_int => value, |
| 9334 | .@"enum" => @intFromEnum(value), | |
| 9334 | .@"enum" => @backingInt(value), | |
| 9335 | 9335 | else => @compileError("intConst expected an integral value, got " ++ @typeName(@TypeOf(value))), |
| 9336 | 9336 | }; |
| 9337 | 9337 | var limbs: [ |
| ... | ... | @@ -9750,7 +9750,7 @@ pub fn print(self: *Builder, w: *Writer) (Writer.Error || Allocator.Error)!void |
| 9750 | 9750 | for (self.variables.items, 0..) |variable, variable_i| { |
| 9751 | 9751 | // Skip the variable if its global has been repurposed for something else. |
| 9752 | 9752 | switch (variable.global.ptrConst(self).kind) { |
| 9753 | .variable => |v| if (@intFromEnum(v) != variable_i) continue, | |
| 9753 | .variable => |v| if (@backingInt(v) != variable_i) continue, | |
| 9754 | 9754 | else => continue, |
| 9755 | 9755 | } |
| 9756 | 9756 | const global = variable.global.ptrConst(self); |
| ... | ... | @@ -9792,7 +9792,7 @@ pub fn print(self: *Builder, w: *Writer) (Writer.Error || Allocator.Error)!void |
| 9792 | 9792 | for (self.aliases.items, 0..) |alias, alias_i| { |
| 9793 | 9793 | // Skip the alias if its global has been repurposed for something else. |
| 9794 | 9794 | switch (alias.global.ptrConst(self).kind) { |
| 9795 | .alias => |a| if (@intFromEnum(a) != alias_i) continue, | |
| 9795 | .alias => |a| if (@backingInt(a) != alias_i) continue, | |
| 9796 | 9796 | else => continue, |
| 9797 | 9797 | } |
| 9798 | 9798 | const global = alias.global.ptrConst(self); |
| ... | ... | @@ -9822,11 +9822,11 @@ pub fn print(self: *Builder, w: *Writer) (Writer.Error || Allocator.Error)!void |
| 9822 | 9822 | for (0.., self.functions.items) |function_i, function| { |
| 9823 | 9823 | // Skip the function if its global has been repurposed for something else. |
| 9824 | 9824 | switch (function.global.ptrConst(self).kind) { |
| 9825 | .function => |f| if (@intFromEnum(f) != function_i) continue, | |
| 9825 | .function => |f| if (@backingInt(f) != function_i) continue, | |
| 9826 | 9826 | else => continue, |
| 9827 | 9827 | } |
| 9828 | 9828 | if (need_newline) try w.writeByte('\n') else need_newline = true; |
| 9829 | const function_index: Function.Index = @enumFromInt(function_i); | |
| 9829 | const function_index: Function.Index = @fromBackingInt(@intCast(function_i)); | |
| 9830 | 9830 | const global = function.global.ptrConst(self); |
| 9831 | 9831 | const params_len = global.type.functionParameters(self).len; |
| 9832 | 9832 | const function_attributes = function.attributes.func(self); |
| ... | ... | @@ -9887,8 +9887,8 @@ pub fn print(self: *Builder, w: *Writer) (Writer.Error || Allocator.Error)!void |
| 9887 | 9887 | try w.writeAll(" {\n"); |
| 9888 | 9888 | var maybe_dbg_index: ?u32 = null; |
| 9889 | 9889 | for (params_len..function.instructions.len) |instruction_i| { |
| 9890 | const instruction_index: Function.Instruction.Index = @enumFromInt(instruction_i); | |
| 9891 | const instruction = function.instructions.get(@intFromEnum(instruction_index)); | |
| 9890 | const instruction_index: Function.Instruction.Index = @fromBackingInt(@intCast(instruction_i)); | |
| 9891 | const instruction = function.instructions.get(@backingInt(instruction_index)); | |
| 9892 | 9892 | if (function.debug_locations.get(instruction_index)) |debug_location| switch (debug_location) { |
| 9893 | 9893 | .no_location => maybe_dbg_index = null, |
| 9894 | 9894 | .location => |location| { |
| ... | ... | @@ -10052,13 +10052,13 @@ pub fn print(self: *Builder, w: *Writer) (Writer.Error || Allocator.Error)!void |
| 10052 | 10052 | .block => { |
| 10053 | 10053 | block_incoming_len = instruction.data; |
| 10054 | 10054 | const name = instruction_index.name(&function); |
| 10055 | if (@intFromEnum(instruction_index) > params_len) | |
| 10055 | if (@backingInt(instruction_index) > params_len) | |
| 10056 | 10056 | try w.writeByte('\n'); |
| 10057 | 10057 | try w.print("{f}:\n", .{name.fmt(self)}); |
| 10058 | 10058 | continue; |
| 10059 | 10059 | }, |
| 10060 | 10060 | .br => |tag| { |
| 10061 | const target: Function.Block.Index = @enumFromInt(instruction.data); | |
| 10061 | const target: Function.Block.Index = @fromBackingInt(@intCast(instruction.data)); | |
| 10062 | 10062 | try w.print(" {s} {f}", .{ |
| 10063 | 10063 | @tagName(tag), target.toInst(&function).fmt(function_index, self, .{ .percent = true }), |
| 10064 | 10064 | }); |
| ... | ... | @@ -10187,7 +10187,7 @@ pub fn print(self: *Builder, w: *Writer) (Writer.Error || Allocator.Error)!void |
| 10187 | 10187 | .fneg, |
| 10188 | 10188 | .@"fneg fast", |
| 10189 | 10189 | => |tag| { |
| 10190 | const val: Value = @enumFromInt(instruction.data); | |
| 10190 | const val: Value = @fromBackingInt(@intCast(instruction.data)); | |
| 10191 | 10191 | try w.print(" %{f} = {s} {f}", .{ |
| 10192 | 10192 | instruction_index.name(&function).fmt(self), |
| 10193 | 10193 | @tagName(tag), |
| ... | ... | @@ -10288,7 +10288,7 @@ pub fn print(self: *Builder, w: *Writer) (Writer.Error || Allocator.Error)!void |
| 10288 | 10288 | } |
| 10289 | 10289 | }, |
| 10290 | 10290 | .ret => |tag| { |
| 10291 | const val: Value = @enumFromInt(instruction.data); | |
| 10291 | const val: Value = @fromBackingInt(@intCast(instruction.data)); | |
| 10292 | 10292 | try w.print(" {s} {f}", .{ |
| 10293 | 10293 | @tagName(tag), |
| 10294 | 10294 | val.fmt(function_index, self, .{ .percent = true }), |
| ... | ... | @@ -10498,7 +10498,7 @@ pub fn print(self: *Builder, w: *Writer) (Writer.Error || Allocator.Error)!void |
| 10498 | 10498 | .thisAdjustment = null, |
| 10499 | 10499 | .flags = extra.di_flags, |
| 10500 | 10500 | .spFlags = @as(Metadata.Subprogram.DISPFlags, @bitCast(@as(u32, @as(u3, @intCast( |
| 10501 | @intFromEnum(kind) - @intFromEnum(Metadata.Tag.subprogram), | |
| 10501 | @backingInt(kind) - @backingInt(Metadata.Tag.subprogram), | |
| 10502 | 10502 | ))) << 2)), |
| 10503 | 10503 | .unit = extra.compile_unit, |
| 10504 | 10504 | .templateParams = null, |
| ... | ... | @@ -10818,7 +10818,7 @@ fn fnTypeAssumeCapacity( |
| 10818 | 10818 | const Adapter = struct { |
| 10819 | 10819 | builder: *const Builder, |
| 10820 | 10820 | pub fn hash(_: @This(), key: Key) u32 { |
| 10821 | var hasher = std.hash.Wyhash.init(comptime std.hash.int(@intFromEnum(tag))); | |
| 10821 | var hasher = std.hash.Wyhash.init(comptime std.hash.int(@backingInt(tag))); | |
| 10822 | 10822 | hasher.update(std.mem.asBytes(&key.ret)); |
| 10823 | 10823 | hasher.update(std.mem.sliceAsBytes(key.params)); |
| 10824 | 10824 | return @truncate(hasher.final()); |
| ... | ... | @@ -10847,7 +10847,7 @@ fn fnTypeAssumeCapacity( |
| 10847 | 10847 | }); |
| 10848 | 10848 | self.type_extra.appendSliceAssumeCapacity(@ptrCast(params)); |
| 10849 | 10849 | } |
| 10850 | return @enumFromInt(gop.index); | |
| 10850 | return @fromBackingInt(@intCast(gop.index)); | |
| 10851 | 10851 | } |
| 10852 | 10852 | |
| 10853 | 10853 | fn intTypeAssumeCapacity(self: *Builder, bits: u24) Type { |
| ... | ... | @@ -10858,7 +10858,7 @@ fn intTypeAssumeCapacity(self: *Builder, bits: u24) Type { |
| 10858 | 10858 | |
| 10859 | 10859 | fn ptrTypeAssumeCapacity(self: *Builder, addr_space: AddrSpace) Type { |
| 10860 | 10860 | const result = self.getOrPutTypeNoExtraAssumeCapacity( |
| 10861 | .{ .tag = .pointer, .data = @intFromEnum(addr_space) }, | |
| 10861 | .{ .tag = .pointer, .data = @backingInt(addr_space) }, | |
| 10862 | 10862 | ); |
| 10863 | 10863 | return result.type; |
| 10864 | 10864 | } |
| ... | ... | @@ -10878,7 +10878,7 @@ fn vectorTypeAssumeCapacity( |
| 10878 | 10878 | builder: *const Builder, |
| 10879 | 10879 | pub fn hash(_: @This(), key: Type.Vector) u32 { |
| 10880 | 10880 | return @truncate(std.hash.Wyhash.hash( |
| 10881 | comptime std.hash.int(@intFromEnum(tag)), | |
| 10881 | comptime std.hash.int(@backingInt(tag)), | |
| 10882 | 10882 | std.mem.asBytes(&key), |
| 10883 | 10883 | )); |
| 10884 | 10884 | } |
| ... | ... | @@ -10898,7 +10898,7 @@ fn vectorTypeAssumeCapacity( |
| 10898 | 10898 | .data = self.addTypeExtraAssumeCapacity(data), |
| 10899 | 10899 | }); |
| 10900 | 10900 | } |
| 10901 | return @enumFromInt(gop.index); | |
| 10901 | return @fromBackingInt(@intCast(gop.index)); | |
| 10902 | 10902 | } |
| 10903 | 10903 | |
| 10904 | 10904 | fn arrayTypeAssumeCapacity(self: *Builder, len: u64, child: Type) Type { |
| ... | ... | @@ -10907,7 +10907,7 @@ fn arrayTypeAssumeCapacity(self: *Builder, len: u64, child: Type) Type { |
| 10907 | 10907 | builder: *const Builder, |
| 10908 | 10908 | pub fn hash(_: @This(), key: Type.Vector) u32 { |
| 10909 | 10909 | return @truncate(std.hash.Wyhash.hash( |
| 10910 | comptime std.hash.int(@intFromEnum(Type.Tag.small_array)), | |
| 10910 | comptime std.hash.int(@backingInt(Type.Tag.small_array)), | |
| 10911 | 10911 | std.mem.asBytes(&key), |
| 10912 | 10912 | )); |
| 10913 | 10913 | } |
| ... | ... | @@ -10927,13 +10927,13 @@ fn arrayTypeAssumeCapacity(self: *Builder, len: u64, child: Type) Type { |
| 10927 | 10927 | .data = self.addTypeExtraAssumeCapacity(data), |
| 10928 | 10928 | }); |
| 10929 | 10929 | } |
| 10930 | return @enumFromInt(gop.index); | |
| 10930 | return @fromBackingInt(@intCast(gop.index)); | |
| 10931 | 10931 | } else { |
| 10932 | 10932 | const Adapter = struct { |
| 10933 | 10933 | builder: *const Builder, |
| 10934 | 10934 | pub fn hash(_: @This(), key: Type.Array) u32 { |
| 10935 | 10935 | return @truncate(std.hash.Wyhash.hash( |
| 10936 | comptime std.hash.int(@intFromEnum(Type.Tag.array)), | |
| 10936 | comptime std.hash.int(@backingInt(Type.Tag.array)), | |
| 10937 | 10937 | std.mem.asBytes(&key), |
| 10938 | 10938 | )); |
| 10939 | 10939 | } |
| ... | ... | @@ -10957,7 +10957,7 @@ fn arrayTypeAssumeCapacity(self: *Builder, len: u64, child: Type) Type { |
| 10957 | 10957 | .data = self.addTypeExtraAssumeCapacity(data), |
| 10958 | 10958 | }); |
| 10959 | 10959 | } |
| 10960 | return @enumFromInt(gop.index); | |
| 10960 | return @fromBackingInt(@intCast(gop.index)); | |
| 10961 | 10961 | } |
| 10962 | 10962 | } |
| 10963 | 10963 | |
| ... | ... | @@ -10974,7 +10974,7 @@ fn structTypeAssumeCapacity( |
| 10974 | 10974 | builder: *const Builder, |
| 10975 | 10975 | pub fn hash(_: @This(), key: []const Type) u32 { |
| 10976 | 10976 | return @truncate(std.hash.Wyhash.hash( |
| 10977 | comptime std.hash.int(@intFromEnum(tag)), | |
| 10977 | comptime std.hash.int(@backingInt(tag)), | |
| 10978 | 10978 | std.mem.sliceAsBytes(key), |
| 10979 | 10979 | )); |
| 10980 | 10980 | } |
| ... | ... | @@ -10998,7 +10998,7 @@ fn structTypeAssumeCapacity( |
| 10998 | 10998 | }); |
| 10999 | 10999 | self.type_extra.appendSliceAssumeCapacity(@ptrCast(fields)); |
| 11000 | 11000 | } |
| 11001 | return @enumFromInt(gop.index); | |
| 11001 | return @fromBackingInt(@intCast(gop.index)); | |
| 11002 | 11002 | } |
| 11003 | 11003 | |
| 11004 | 11004 | fn opaqueTypeAssumeCapacity(self: *Builder, name: String) Type { |
| ... | ... | @@ -11006,7 +11006,7 @@ fn opaqueTypeAssumeCapacity(self: *Builder, name: String) Type { |
| 11006 | 11006 | builder: *const Builder, |
| 11007 | 11007 | pub fn hash(_: @This(), key: String) u32 { |
| 11008 | 11008 | return @truncate(std.hash.Wyhash.hash( |
| 11009 | comptime std.hash.int(@intFromEnum(Type.Tag.named_structure)), | |
| 11009 | comptime std.hash.int(@backingInt(Type.Tag.named_structure)), | |
| 11010 | 11010 | std.mem.asBytes(&key), |
| 11011 | 11011 | )); |
| 11012 | 11012 | } |
| ... | ... | @@ -11020,7 +11020,7 @@ fn opaqueTypeAssumeCapacity(self: *Builder, name: String) Type { |
| 11020 | 11020 | if (name == .empty) { |
| 11021 | 11021 | id = self.next_unnamed_type; |
| 11022 | 11022 | assert(id != .none); |
| 11023 | self.next_unnamed_type = @enumFromInt(@intFromEnum(id) + 1); | |
| 11023 | self.next_unnamed_type = @fromBackingInt(@intCast(@backingInt(id) + 1)); | |
| 11024 | 11024 | } else assert(!name.isAnon()); |
| 11025 | 11025 | while (true) { |
| 11026 | 11026 | const type_gop = self.types.getOrPutAssumeCapacity(id); |
| ... | ... | @@ -11036,7 +11036,7 @@ fn opaqueTypeAssumeCapacity(self: *Builder, name: String) Type { |
| 11036 | 11036 | .body = .none, |
| 11037 | 11037 | }), |
| 11038 | 11038 | }); |
| 11039 | const result: Type = @enumFromInt(gop.index); | |
| 11039 | const result: Type = @fromBackingInt(@intCast(gop.index)); | |
| 11040 | 11040 | type_gop.value_ptr.* = result; |
| 11041 | 11041 | return result; |
| 11042 | 11042 | } |
| ... | ... | @@ -11067,7 +11067,7 @@ fn getOrPutTypeNoExtraAssumeCapacity(self: *Builder, item: Type.Item) struct { n |
| 11067 | 11067 | builder: *const Builder, |
| 11068 | 11068 | pub fn hash(_: @This(), key: Type.Item) u32 { |
| 11069 | 11069 | return @truncate(std.hash.Wyhash.hash( |
| 11070 | comptime std.hash.int(@intFromEnum(Type.Tag.simple)), | |
| 11070 | comptime std.hash.int(@backingInt(Type.Tag.simple)), | |
| 11071 | 11071 | std.mem.asBytes(&key), |
| 11072 | 11072 | )); |
| 11073 | 11073 | } |
| ... | ... | @@ -11083,7 +11083,7 @@ fn getOrPutTypeNoExtraAssumeCapacity(self: *Builder, item: Type.Item) struct { n |
| 11083 | 11083 | gop.value_ptr.* = {}; |
| 11084 | 11084 | self.type_items.appendAssumeCapacity(item); |
| 11085 | 11085 | } |
| 11086 | return .{ .new = !gop.found_existing, .type = @enumFromInt(gop.index) }; | |
| 11086 | return .{ .new = !gop.found_existing, .type = @fromBackingInt(@intCast(gop.index)) }; | |
| 11087 | 11087 | } |
| 11088 | 11088 | |
| 11089 | 11089 | fn addTypeExtraAssumeCapacity(self: *Builder, extra: anytype) Type.Item.ExtraIndex { |
| ... | ... | @@ -11093,7 +11093,7 @@ fn addTypeExtraAssumeCapacity(self: *Builder, extra: anytype) Type.Item.ExtraInd |
| 11093 | 11093 | const value = @field(extra, field_name); |
| 11094 | 11094 | self.type_extra.appendAssumeCapacity(switch (field_type) { |
| 11095 | 11095 | u32 => value, |
| 11096 | String, Type => @intFromEnum(value), | |
| 11096 | String, Type => @backingInt(value), | |
| 11097 | 11097 | else => @compileError("bad field type: " ++ field_name ++ ": " ++ @typeName(field_type)), |
| 11098 | 11098 | }); |
| 11099 | 11099 | } |
| ... | ... | @@ -11135,7 +11135,7 @@ fn typeExtraDataTrail( |
| 11135 | 11135 | ) |field_name, field_type, value| |
| 11136 | 11136 | @field(result, field_name) = switch (field_type) { |
| 11137 | 11137 | u32 => value, |
| 11138 | String, Type => @enumFromInt(value), | |
| 11138 | String, Type => @fromBackingInt(@intCast(value)), | |
| 11139 | 11139 | else => @compileError("bad field type: " ++ @typeName(field_type)), |
| 11140 | 11140 | }; |
| 11141 | 11141 | return .{ |
| ... | ... | @@ -11177,7 +11177,7 @@ fn bigIntConstAssumeCapacity( |
| 11177 | 11177 | ty: Type, |
| 11178 | 11178 | value: std.math.big.int.Const, |
| 11179 | 11179 | ) Allocator.Error!Constant { |
| 11180 | const type_item = self.type_items.items[@intFromEnum(ty)]; | |
| 11180 | const type_item = self.type_items.items[@backingInt(ty)]; | |
| 11181 | 11181 | assert(type_item.tag == .integer); |
| 11182 | 11182 | const bits = type_item.data; |
| 11183 | 11183 | |
| ... | ... | @@ -11206,7 +11206,7 @@ fn bigIntConstAssumeCapacity( |
| 11206 | 11206 | const Adapter = struct { |
| 11207 | 11207 | builder: *const Builder, |
| 11208 | 11208 | pub fn hash(_: @This(), key: Key) u32 { |
| 11209 | var hasher = std.hash.Wyhash.init(std.hash.int(@intFromEnum(key.tag))); | |
| 11209 | var hasher = std.hash.Wyhash.init(std.hash.int(@backingInt(key.tag))); | |
| 11210 | 11210 | hasher.update(std.mem.asBytes(&key.type)); |
| 11211 | 11211 | hasher.update(std.mem.sliceAsBytes(key.limbs)); |
| 11212 | 11212 | return @truncate(hasher.final()); |
| ... | ... | @@ -11239,7 +11239,7 @@ fn bigIntConstAssumeCapacity( |
| 11239 | 11239 | extra.* = .{ .type = ty, .limbs_len = @intCast(canonical_value.limbs.len) }; |
| 11240 | 11240 | self.constant_limbs.appendSliceAssumeCapacity(canonical_value.limbs); |
| 11241 | 11241 | } |
| 11242 | return @enumFromInt(gop.index); | |
| 11242 | return @fromBackingInt(@intCast(gop.index)); | |
| 11243 | 11243 | } |
| 11244 | 11244 | |
| 11245 | 11245 | fn halfConstAssumeCapacity(self: *Builder, val: f16) Constant { |
| ... | ... | @@ -11269,7 +11269,7 @@ fn doubleConstAssumeCapacity(self: *Builder, val: f64) Constant { |
| 11269 | 11269 | builder: *const Builder, |
| 11270 | 11270 | pub fn hash(_: @This(), key: f64) u32 { |
| 11271 | 11271 | return @truncate(std.hash.Wyhash.hash( |
| 11272 | comptime std.hash.int(@intFromEnum(Constant.Tag.double)), | |
| 11272 | comptime std.hash.int(@backingInt(Constant.Tag.double)), | |
| 11273 | 11273 | std.mem.asBytes(&key), |
| 11274 | 11274 | )); |
| 11275 | 11275 | } |
| ... | ... | @@ -11292,7 +11292,7 @@ fn doubleConstAssumeCapacity(self: *Builder, val: f64) Constant { |
| 11292 | 11292 | }), |
| 11293 | 11293 | }); |
| 11294 | 11294 | } |
| 11295 | return @enumFromInt(gop.index); | |
| 11295 | return @fromBackingInt(@intCast(gop.index)); | |
| 11296 | 11296 | } |
| 11297 | 11297 | |
| 11298 | 11298 | fn fp128ConstAssumeCapacity(self: *Builder, val: f128) Constant { |
| ... | ... | @@ -11300,7 +11300,7 @@ fn fp128ConstAssumeCapacity(self: *Builder, val: f128) Constant { |
| 11300 | 11300 | builder: *const Builder, |
| 11301 | 11301 | pub fn hash(_: @This(), key: f128) u32 { |
| 11302 | 11302 | return @truncate(std.hash.Wyhash.hash( |
| 11303 | comptime std.hash.int(@intFromEnum(Constant.Tag.fp128)), | |
| 11303 | comptime std.hash.int(@backingInt(Constant.Tag.fp128)), | |
| 11304 | 11304 | std.mem.asBytes(&key), |
| 11305 | 11305 | )); |
| 11306 | 11306 | } |
| ... | ... | @@ -11326,7 +11326,7 @@ fn fp128ConstAssumeCapacity(self: *Builder, val: f128) Constant { |
| 11326 | 11326 | }), |
| 11327 | 11327 | }); |
| 11328 | 11328 | } |
| 11329 | return @enumFromInt(gop.index); | |
| 11329 | return @fromBackingInt(@intCast(gop.index)); | |
| 11330 | 11330 | } |
| 11331 | 11331 | |
| 11332 | 11332 | fn x86_fp80ConstAssumeCapacity(self: *Builder, val: f80) Constant { |
| ... | ... | @@ -11334,7 +11334,7 @@ fn x86_fp80ConstAssumeCapacity(self: *Builder, val: f80) Constant { |
| 11334 | 11334 | builder: *const Builder, |
| 11335 | 11335 | pub fn hash(_: @This(), key: f80) u32 { |
| 11336 | 11336 | return @truncate(std.hash.Wyhash.hash( |
| 11337 | comptime std.hash.int(@intFromEnum(Constant.Tag.x86_fp80)), | |
| 11337 | comptime std.hash.int(@backingInt(Constant.Tag.x86_fp80)), | |
| 11338 | 11338 | std.mem.asBytes(&key)[0..10], |
| 11339 | 11339 | )); |
| 11340 | 11340 | } |
| ... | ... | @@ -11359,7 +11359,7 @@ fn x86_fp80ConstAssumeCapacity(self: *Builder, val: f80) Constant { |
| 11359 | 11359 | }), |
| 11360 | 11360 | }); |
| 11361 | 11361 | } |
| 11362 | return @enumFromInt(gop.index); | |
| 11362 | return @fromBackingInt(@intCast(gop.index)); | |
| 11363 | 11363 | } |
| 11364 | 11364 | |
| 11365 | 11365 | fn ppc_fp128ConstAssumeCapacity(self: *Builder, val: [2]f64) Constant { |
| ... | ... | @@ -11367,7 +11367,7 @@ fn ppc_fp128ConstAssumeCapacity(self: *Builder, val: [2]f64) Constant { |
| 11367 | 11367 | builder: *const Builder, |
| 11368 | 11368 | pub fn hash(_: @This(), key: [2]f64) u32 { |
| 11369 | 11369 | return @truncate(std.hash.Wyhash.hash( |
| 11370 | comptime std.hash.int(@intFromEnum(Constant.Tag.ppc_fp128)), | |
| 11370 | comptime std.hash.int(@backingInt(Constant.Tag.ppc_fp128)), | |
| 11371 | 11371 | std.mem.asBytes(&key), |
| 11372 | 11372 | )); |
| 11373 | 11373 | } |
| ... | ... | @@ -11393,13 +11393,13 @@ fn ppc_fp128ConstAssumeCapacity(self: *Builder, val: [2]f64) Constant { |
| 11393 | 11393 | }), |
| 11394 | 11394 | }); |
| 11395 | 11395 | } |
| 11396 | return @enumFromInt(gop.index); | |
| 11396 | return @fromBackingInt(@intCast(gop.index)); | |
| 11397 | 11397 | } |
| 11398 | 11398 | |
| 11399 | 11399 | fn nullConstAssumeCapacity(self: *Builder, ty: Type) Constant { |
| 11400 | assert(self.type_items.items[@intFromEnum(ty)].tag == .pointer); | |
| 11400 | assert(self.type_items.items[@backingInt(ty)].tag == .pointer); | |
| 11401 | 11401 | const result = self.getOrPutConstantNoExtraAssumeCapacity( |
| 11402 | .{ .tag = .null, .data = @intFromEnum(ty) }, | |
| 11402 | .{ .tag = .null, .data = @backingInt(ty) }, | |
| 11403 | 11403 | ); |
| 11404 | 11404 | return result.constant; |
| 11405 | 11405 | } |
| ... | ... | @@ -11407,18 +11407,18 @@ fn nullConstAssumeCapacity(self: *Builder, ty: Type) Constant { |
| 11407 | 11407 | fn noneConstAssumeCapacity(self: *Builder, ty: Type) Constant { |
| 11408 | 11408 | assert(ty == .token); |
| 11409 | 11409 | const result = self.getOrPutConstantNoExtraAssumeCapacity( |
| 11410 | .{ .tag = .none, .data = @intFromEnum(ty) }, | |
| 11410 | .{ .tag = .none, .data = @backingInt(ty) }, | |
| 11411 | 11411 | ); |
| 11412 | 11412 | return result.constant; |
| 11413 | 11413 | } |
| 11414 | 11414 | |
| 11415 | 11415 | fn structConstAssumeCapacity(self: *Builder, ty: Type, vals: []const Constant) Constant { |
| 11416 | const type_item = self.type_items.items[@intFromEnum(ty)]; | |
| 11416 | const type_item = self.type_items.items[@backingInt(ty)]; | |
| 11417 | 11417 | var extra = self.typeExtraDataTrail(Type.Structure, switch (type_item.tag) { |
| 11418 | 11418 | .structure, .packed_structure => type_item.data, |
| 11419 | 11419 | .named_structure => data: { |
| 11420 | 11420 | const body_ty = self.typeExtraData(Type.NamedStructure, type_item.data).body; |
| 11421 | const body_item = self.type_items.items[@intFromEnum(body_ty)]; | |
| 11421 | const body_item = self.type_items.items[@backingInt(body_ty)]; | |
| 11422 | 11422 | switch (body_item.tag) { |
| 11423 | 11423 | .structure, .packed_structure => break :data body_item.data, |
| 11424 | 11424 | else => unreachable, |
| ... | ... | @@ -11443,7 +11443,7 @@ fn structConstAssumeCapacity(self: *Builder, ty: Type, vals: []const Constant) C |
| 11443 | 11443 | } |
| 11444 | 11444 | |
| 11445 | 11445 | fn arrayConstAssumeCapacity(self: *Builder, ty: Type, vals: []const Constant) Constant { |
| 11446 | const type_item = self.type_items.items[@intFromEnum(ty)]; | |
| 11446 | const type_item = self.type_items.items[@backingInt(ty)]; | |
| 11447 | 11447 | const type_extra: struct { len: u64, child: Type } = switch (type_item.tag) { |
| 11448 | 11448 | inline .small_array, .array => |kind| extra: { |
| 11449 | 11449 | const extra = self.typeExtraData(switch (kind) { |
| ... | ... | @@ -11471,7 +11471,7 @@ fn stringConstAssumeCapacity(self: *Builder, val: String) Constant { |
| 11471 | 11471 | const ty = self.arrayTypeAssumeCapacity(slice.len, .i8); |
| 11472 | 11472 | if (std.mem.allEqual(u8, slice, 0)) return self.zeroInitConstAssumeCapacity(ty); |
| 11473 | 11473 | const result = self.getOrPutConstantNoExtraAssumeCapacity( |
| 11474 | .{ .tag = .string, .data = @intFromEnum(val) }, | |
| 11474 | .{ .tag = .string, .data = @backingInt(val) }, | |
| 11475 | 11475 | ); |
| 11476 | 11476 | return result.constant; |
| 11477 | 11477 | } |
| ... | ... | @@ -11502,7 +11502,7 @@ fn splatConstAssumeCapacity(self: *Builder, ty: Type, val: Constant) Constant { |
| 11502 | 11502 | builder: *const Builder, |
| 11503 | 11503 | pub fn hash(_: @This(), key: Constant.Splat) u32 { |
| 11504 | 11504 | return @truncate(std.hash.Wyhash.hash( |
| 11505 | comptime std.hash.int(@intFromEnum(Constant.Tag.splat)), | |
| 11505 | comptime std.hash.int(@backingInt(Constant.Tag.splat)), | |
| 11506 | 11506 | std.mem.asBytes(&key), |
| 11507 | 11507 | )); |
| 11508 | 11508 | } |
| ... | ... | @@ -11523,7 +11523,7 @@ fn splatConstAssumeCapacity(self: *Builder, ty: Type, val: Constant) Constant { |
| 11523 | 11523 | .data = self.addConstantExtraAssumeCapacity(data), |
| 11524 | 11524 | }); |
| 11525 | 11525 | } |
| 11526 | return @enumFromInt(gop.index); | |
| 11526 | return @fromBackingInt(@intCast(gop.index)); | |
| 11527 | 11527 | } |
| 11528 | 11528 | |
| 11529 | 11529 | fn zeroInitConstAssumeCapacity(self: *Builder, ty: Type) Constant { |
| ... | ... | @@ -11538,7 +11538,7 @@ fn zeroInitConstAssumeCapacity(self: *Builder, ty: Type) Constant { |
| 11538 | 11538 | .ppc_fp128 => return self.ppc_fp128ConstAssumeCapacity(.{ 0.0, 0.0 }), |
| 11539 | 11539 | .token => return .none, |
| 11540 | 11540 | .i1 => return .false, |
| 11541 | else => switch (self.type_items.items[@intFromEnum(ty)].tag) { | |
| 11541 | else => switch (self.type_items.items[@backingInt(ty)].tag) { | |
| 11542 | 11542 | .simple, |
| 11543 | 11543 | .function, |
| 11544 | 11544 | .vararg_function, |
| ... | ... | @@ -11561,13 +11561,13 @@ fn zeroInitConstAssumeCapacity(self: *Builder, ty: Type) Constant { |
| 11561 | 11561 | }, |
| 11562 | 11562 | } |
| 11563 | 11563 | const result = self.getOrPutConstantNoExtraAssumeCapacity( |
| 11564 | .{ .tag = .zeroinitializer, .data = @intFromEnum(ty) }, | |
| 11564 | .{ .tag = .zeroinitializer, .data = @backingInt(ty) }, | |
| 11565 | 11565 | ); |
| 11566 | 11566 | return result.constant; |
| 11567 | 11567 | } |
| 11568 | 11568 | |
| 11569 | 11569 | fn undefConstAssumeCapacity(self: *Builder, ty: Type) Constant { |
| 11570 | switch (self.type_items.items[@intFromEnum(ty)].tag) { | |
| 11570 | switch (self.type_items.items[@backingInt(ty)].tag) { | |
| 11571 | 11571 | .simple => switch (ty) { |
| 11572 | 11572 | .void, .label => unreachable, |
| 11573 | 11573 | else => {}, |
| ... | ... | @@ -11576,13 +11576,13 @@ fn undefConstAssumeCapacity(self: *Builder, ty: Type) Constant { |
| 11576 | 11576 | else => {}, |
| 11577 | 11577 | } |
| 11578 | 11578 | const result = self.getOrPutConstantNoExtraAssumeCapacity( |
| 11579 | .{ .tag = .undef, .data = @intFromEnum(ty) }, | |
| 11579 | .{ .tag = .undef, .data = @backingInt(ty) }, | |
| 11580 | 11580 | ); |
| 11581 | 11581 | return result.constant; |
| 11582 | 11582 | } |
| 11583 | 11583 | |
| 11584 | 11584 | fn poisonConstAssumeCapacity(self: *Builder, ty: Type) Constant { |
| 11585 | switch (self.type_items.items[@intFromEnum(ty)].tag) { | |
| 11585 | switch (self.type_items.items[@backingInt(ty)].tag) { | |
| 11586 | 11586 | .simple => switch (ty) { |
| 11587 | 11587 | .void, .label => unreachable, |
| 11588 | 11588 | else => {}, |
| ... | ... | @@ -11591,7 +11591,7 @@ fn poisonConstAssumeCapacity(self: *Builder, ty: Type) Constant { |
| 11591 | 11591 | else => {}, |
| 11592 | 11592 | } |
| 11593 | 11593 | const result = self.getOrPutConstantNoExtraAssumeCapacity( |
| 11594 | .{ .tag = .poison, .data = @intFromEnum(ty) }, | |
| 11594 | .{ .tag = .poison, .data = @backingInt(ty) }, | |
| 11595 | 11595 | ); |
| 11596 | 11596 | return result.constant; |
| 11597 | 11597 | } |
| ... | ... | @@ -11605,7 +11605,7 @@ fn blockAddrConstAssumeCapacity( |
| 11605 | 11605 | builder: *const Builder, |
| 11606 | 11606 | pub fn hash(_: @This(), key: Constant.BlockAddress) u32 { |
| 11607 | 11607 | return @truncate(std.hash.Wyhash.hash( |
| 11608 | comptime std.hash.int(@intFromEnum(Constant.Tag.blockaddress)), | |
| 11608 | comptime std.hash.int(@backingInt(Constant.Tag.blockaddress)), | |
| 11609 | 11609 | std.mem.asBytes(&key), |
| 11610 | 11610 | )); |
| 11611 | 11611 | } |
| ... | ... | @@ -11626,19 +11626,19 @@ fn blockAddrConstAssumeCapacity( |
| 11626 | 11626 | .data = self.addConstantExtraAssumeCapacity(data), |
| 11627 | 11627 | }); |
| 11628 | 11628 | } |
| 11629 | return @enumFromInt(gop.index); | |
| 11629 | return @fromBackingInt(@intCast(gop.index)); | |
| 11630 | 11630 | } |
| 11631 | 11631 | |
| 11632 | 11632 | fn dsoLocalEquivalentConstAssumeCapacity(self: *Builder, function: Function.Index) Constant { |
| 11633 | 11633 | const result = self.getOrPutConstantNoExtraAssumeCapacity( |
| 11634 | .{ .tag = .dso_local_equivalent, .data = @intFromEnum(function) }, | |
| 11634 | .{ .tag = .dso_local_equivalent, .data = @backingInt(function) }, | |
| 11635 | 11635 | ); |
| 11636 | 11636 | return result.constant; |
| 11637 | 11637 | } |
| 11638 | 11638 | |
| 11639 | 11639 | fn noCfiConstAssumeCapacity(self: *Builder, function: Function.Index) Constant { |
| 11640 | 11640 | const result = self.getOrPutConstantNoExtraAssumeCapacity( |
| 11641 | .{ .tag = .no_cfi, .data = @intFromEnum(function) }, | |
| 11641 | .{ .tag = .no_cfi, .data = @backingInt(function) }, | |
| 11642 | 11642 | ); |
| 11643 | 11643 | return result.constant; |
| 11644 | 11644 | } |
| ... | ... | @@ -11735,7 +11735,7 @@ fn castConstAssumeCapacity(self: *Builder, tag: Constant.Tag, val: Constant, ty: |
| 11735 | 11735 | builder: *const Builder, |
| 11736 | 11736 | pub fn hash(_: @This(), key: Key) u32 { |
| 11737 | 11737 | return @truncate(std.hash.Wyhash.hash( |
| 11738 | std.hash.int(@intFromEnum(key.tag)), | |
| 11738 | std.hash.int(@backingInt(key.tag)), | |
| 11739 | 11739 | std.mem.asBytes(&key.cast), |
| 11740 | 11740 | )); |
| 11741 | 11741 | } |
| ... | ... | @@ -11756,7 +11756,7 @@ fn castConstAssumeCapacity(self: *Builder, tag: Constant.Tag, val: Constant, ty: |
| 11756 | 11756 | .data = self.addConstantExtraAssumeCapacity(data.cast), |
| 11757 | 11757 | }); |
| 11758 | 11758 | } |
| 11759 | return @enumFromInt(gop.index); | |
| 11759 | return @fromBackingInt(@intCast(gop.index)); | |
| 11760 | 11760 | } |
| 11761 | 11761 | |
| 11762 | 11762 | fn gepConstAssumeCapacity( |
| ... | ... | @@ -11810,7 +11810,7 @@ fn gepConstAssumeCapacity( |
| 11810 | 11810 | const Adapter = struct { |
| 11811 | 11811 | builder: *const Builder, |
| 11812 | 11812 | pub fn hash(_: @This(), key: Key) u32 { |
| 11813 | var hasher = std.hash.Wyhash.init(comptime std.hash.int(@intFromEnum(tag))); | |
| 11813 | var hasher = std.hash.Wyhash.init(comptime std.hash.int(@backingInt(tag))); | |
| 11814 | 11814 | hasher.update(std.mem.asBytes(&key.type)); |
| 11815 | 11815 | hasher.update(std.mem.asBytes(&key.base)); |
| 11816 | 11816 | hasher.update(std.mem.asBytes(&key.inrange)); |
| ... | ... | @@ -11831,7 +11831,7 @@ fn gepConstAssumeCapacity( |
| 11831 | 11831 | const data = Key{ |
| 11832 | 11832 | .type = ty, |
| 11833 | 11833 | .base = base, |
| 11834 | .inrange = if (inrange) |index| @enumFromInt(index) else .none, | |
| 11834 | .inrange = if (inrange) |index| @fromBackingInt(@intCast(index)) else .none, | |
| 11835 | 11835 | .indices = indices, |
| 11836 | 11836 | }; |
| 11837 | 11837 | const gop = self.constant_map.getOrPutAssumeCapacityAdapted(data, Adapter{ .builder = self }); |
| ... | ... | @@ -11848,7 +11848,7 @@ fn gepConstAssumeCapacity( |
| 11848 | 11848 | }); |
| 11849 | 11849 | self.constant_extra.appendSliceAssumeCapacity(@ptrCast(indices)); |
| 11850 | 11850 | } |
| 11851 | return @enumFromInt(gop.index); | |
| 11851 | return @fromBackingInt(@intCast(gop.index)); | |
| 11852 | 11852 | } |
| 11853 | 11853 | |
| 11854 | 11854 | fn binConstAssumeCapacity( |
| ... | ... | @@ -11874,7 +11874,7 @@ fn binConstAssumeCapacity( |
| 11874 | 11874 | builder: *const Builder, |
| 11875 | 11875 | pub fn hash(_: @This(), key: Key) u32 { |
| 11876 | 11876 | return @truncate(std.hash.Wyhash.hash( |
| 11877 | std.hash.int(@intFromEnum(key.tag)), | |
| 11877 | std.hash.int(@backingInt(key.tag)), | |
| 11878 | 11878 | std.mem.asBytes(&key.extra), |
| 11879 | 11879 | )); |
| 11880 | 11880 | } |
| ... | ... | @@ -11895,7 +11895,7 @@ fn binConstAssumeCapacity( |
| 11895 | 11895 | .data = self.addConstantExtraAssumeCapacity(data.extra), |
| 11896 | 11896 | }); |
| 11897 | 11897 | } |
| 11898 | return @enumFromInt(gop.index); | |
| 11898 | return @fromBackingInt(@intCast(gop.index)); | |
| 11899 | 11899 | } |
| 11900 | 11900 | |
| 11901 | 11901 | fn asmConstAssumeCapacity( |
| ... | ... | @@ -11912,7 +11912,7 @@ fn asmConstAssumeCapacity( |
| 11912 | 11912 | builder: *const Builder, |
| 11913 | 11913 | pub fn hash(_: @This(), key: Key) u32 { |
| 11914 | 11914 | return @truncate(std.hash.Wyhash.hash( |
| 11915 | std.hash.int(@intFromEnum(key.tag)), | |
| 11915 | std.hash.int(@backingInt(key.tag)), | |
| 11916 | 11916 | std.mem.asBytes(&key.extra), |
| 11917 | 11917 | )); |
| 11918 | 11918 | } |
| ... | ... | @@ -11925,7 +11925,7 @@ fn asmConstAssumeCapacity( |
| 11925 | 11925 | }; |
| 11926 | 11926 | |
| 11927 | 11927 | const data = Key{ |
| 11928 | .tag = @enumFromInt(@intFromEnum(Constant.Tag.@"asm") + @as(u4, @bitCast(info))), | |
| 11928 | .tag = @fromBackingInt(@intCast(@backingInt(Constant.Tag.@"asm") + @as(u4, @bitCast(info)))), | |
| 11929 | 11929 | .extra = .{ .type = ty, .assembly = assembly, .constraints = constraints }, |
| 11930 | 11930 | }; |
| 11931 | 11931 | const gop = self.constant_map.getOrPutAssumeCapacityAdapted(data, Adapter{ .builder = self }); |
| ... | ... | @@ -11937,7 +11937,7 @@ fn asmConstAssumeCapacity( |
| 11937 | 11937 | .data = self.addConstantExtraAssumeCapacity(data.extra), |
| 11938 | 11938 | }); |
| 11939 | 11939 | } |
| 11940 | return @enumFromInt(gop.index); | |
| 11940 | return @fromBackingInt(@intCast(gop.index)); | |
| 11941 | 11941 | } |
| 11942 | 11942 | |
| 11943 | 11943 | fn ensureUnusedConstantCapacity( |
| ... | ... | @@ -11962,7 +11962,7 @@ fn getOrPutConstantNoExtraAssumeCapacity( |
| 11962 | 11962 | builder: *const Builder, |
| 11963 | 11963 | pub fn hash(_: @This(), key: Constant.Item) u32 { |
| 11964 | 11964 | return @truncate(std.hash.Wyhash.hash( |
| 11965 | std.hash.int(@intFromEnum(key.tag)), | |
| 11965 | std.hash.int(@backingInt(key.tag)), | |
| 11966 | 11966 | std.mem.asBytes(&key.data), |
| 11967 | 11967 | )); |
| 11968 | 11968 | } |
| ... | ... | @@ -11976,7 +11976,7 @@ fn getOrPutConstantNoExtraAssumeCapacity( |
| 11976 | 11976 | gop.value_ptr.* = {}; |
| 11977 | 11977 | self.constant_items.appendAssumeCapacity(item); |
| 11978 | 11978 | } |
| 11979 | return .{ .new = !gop.found_existing, .constant = @enumFromInt(gop.index) }; | |
| 11979 | return .{ .new = !gop.found_existing, .constant = @fromBackingInt(@intCast(gop.index)) }; | |
| 11980 | 11980 | } |
| 11981 | 11981 | |
| 11982 | 11982 | fn getOrPutConstantAggregateAssumeCapacity( |
| ... | ... | @@ -11993,7 +11993,7 @@ fn getOrPutConstantAggregateAssumeCapacity( |
| 11993 | 11993 | const Adapter = struct { |
| 11994 | 11994 | builder: *const Builder, |
| 11995 | 11995 | pub fn hash(_: @This(), key: Key) u32 { |
| 11996 | var hasher = std.hash.Wyhash.init(std.hash.int(@intFromEnum(key.tag))); | |
| 11996 | var hasher = std.hash.Wyhash.init(std.hash.int(@backingInt(key.tag))); | |
| 11997 | 11997 | hasher.update(std.mem.asBytes(&key.type)); |
| 11998 | 11998 | hasher.update(std.mem.sliceAsBytes(key.vals)); |
| 11999 | 11999 | return @truncate(hasher.final()); |
| ... | ... | @@ -12020,7 +12020,7 @@ fn getOrPutConstantAggregateAssumeCapacity( |
| 12020 | 12020 | }); |
| 12021 | 12021 | self.constant_extra.appendSliceAssumeCapacity(@ptrCast(vals)); |
| 12022 | 12022 | } |
| 12023 | return .{ .new = !gop.found_existing, .constant = @enumFromInt(gop.index) }; | |
| 12023 | return .{ .new = !gop.found_existing, .constant = @fromBackingInt(@intCast(gop.index)) }; | |
| 12024 | 12024 | } |
| 12025 | 12025 | |
| 12026 | 12026 | fn addConstantExtraAssumeCapacity(self: *Builder, extra: anytype) Constant.Item.ExtraIndex { |
| ... | ... | @@ -12030,7 +12030,7 @@ fn addConstantExtraAssumeCapacity(self: *Builder, extra: anytype) Constant.Item. |
| 12030 | 12030 | const value = @field(extra, field_name); |
| 12031 | 12031 | self.constant_extra.appendAssumeCapacity(switch (field_type) { |
| 12032 | 12032 | u32 => value, |
| 12033 | String, Type, Constant, Function.Index, Function.Block.Index => @intFromEnum(value), | |
| 12033 | String, Type, Constant, Function.Index, Function.Block.Index => @backingInt(value), | |
| 12034 | 12034 | Constant.GetElementPtr.Info => @bitCast(value), |
| 12035 | 12035 | else => @compileError("bad field type: " ++ @typeName(field_type)), |
| 12036 | 12036 | }); |
| ... | ... | @@ -12073,7 +12073,7 @@ fn constantExtraDataTrail( |
| 12073 | 12073 | ) |field_name, field_type, value| |
| 12074 | 12074 | @field(result, field_name) = switch (field_type) { |
| 12075 | 12075 | u32 => value, |
| 12076 | String, Type, Constant, Function.Index, Function.Block.Index => @enumFromInt(value), | |
| 12076 | String, Type, Constant, Function.Index, Function.Block.Index => @fromBackingInt(@intCast(value)), | |
| 12077 | 12077 | Constant.GetElementPtr.Info => @bitCast(value), |
| 12078 | 12078 | else => @compileError("bad field type: " ++ @typeName(field_type)), |
| 12079 | 12079 | }; |
| ... | ... | @@ -12108,7 +12108,7 @@ fn addMetadataExtraAssumeCapacity(self: *Builder, extra: anytype) Metadata.Item. |
| 12108 | 12108 | const value = @field(extra, field_name); |
| 12109 | 12109 | self.metadata_extra.appendAssumeCapacity(switch (field_type) { |
| 12110 | 12110 | u32 => value, |
| 12111 | Metadata.String, Metadata.String.Optional, Variable.Index, Value => @intFromEnum(value), | |
| 12111 | Metadata.String, Metadata.String.Optional, Variable.Index, Value => @backingInt(value), | |
| 12112 | 12112 | Metadata, Metadata.Optional, Metadata.DIFlags => @bitCast(value), |
| 12113 | 12113 | else => @compileError("bad field type: " ++ @typeName(field_type)), |
| 12114 | 12114 | }); |
| ... | ... | @@ -12151,7 +12151,7 @@ fn metadataExtraDataTrail( |
| 12151 | 12151 | ) |field_name, field_type, value| |
| 12152 | 12152 | @field(result, field_name) = switch (field_type) { |
| 12153 | 12153 | u32 => value, |
| 12154 | Metadata.String, Metadata.String.Optional, Variable.Index, Value => @enumFromInt(value), | |
| 12154 | Metadata.String, Metadata.String.Optional, Variable.Index, Value => @fromBackingInt(@intCast(value)), | |
| 12155 | 12155 | Metadata, Metadata.Optional, Metadata.DIFlags => @bitCast(value), |
| 12156 | 12156 | else => @compileError("bad field type: " ++ @typeName(field_type)), |
| 12157 | 12157 | }; |
| ... | ... | @@ -12181,7 +12181,7 @@ pub fn metadataString(self: *Builder, bytes: []const u8) Allocator.Error!Metadat |
| 12181 | 12181 | @intCast(self.metadata_string_bytes.items.len), |
| 12182 | 12182 | ); |
| 12183 | 12183 | } |
| 12184 | return @enumFromInt(gop.index); | |
| 12184 | return @fromBackingInt(@intCast(gop.index)); | |
| 12185 | 12185 | } |
| 12186 | 12186 | |
| 12187 | 12187 | pub fn metadataStringFromStrtabString( |
| ... | ... | @@ -12230,7 +12230,7 @@ pub fn trailingMetadataStringAssumeCapacity(self: *Builder) Metadata.String { |
| 12230 | 12230 | } else { |
| 12231 | 12231 | self.metadata_string_indices.appendAssumeCapacity(@intCast(self.metadata_string_bytes.items.len)); |
| 12232 | 12232 | } |
| 12233 | return @enumFromInt(gop.index); | |
| 12233 | return @fromBackingInt(@intCast(gop.index)); | |
| 12234 | 12234 | } |
| 12235 | 12235 | |
| 12236 | 12236 | pub fn addNamedMetadata(self: *Builder, name: String, operands: []const Metadata) Allocator.Error!void { |
| ... | ... | @@ -12662,7 +12662,7 @@ fn metadataSimpleAssumeCapacity(self: *Builder, tag: Metadata.Tag, value: anytyp |
| 12662 | 12662 | const Adapter = struct { |
| 12663 | 12663 | builder: *const Builder, |
| 12664 | 12664 | pub fn hash(_: @This(), key: Key) u32 { |
| 12665 | var hasher = std.hash.Wyhash.init(std.hash.int(@intFromEnum(key.tag))); | |
| 12665 | var hasher = std.hash.Wyhash.init(std.hash.int(@backingInt(key.tag))); | |
| 12666 | 12666 | inline for (comptime std.meta.fieldNames(@TypeOf(value))) |field_name| { |
| 12667 | 12667 | hasher.update(std.mem.asBytes(&@field(key.value, field_name))); |
| 12668 | 12668 | } |
| ... | ... | @@ -12759,8 +12759,8 @@ fn debugSubprogramAssumeCapacity( |
| 12759 | 12759 | compile_unit: ?Metadata, |
| 12760 | 12760 | ) Metadata { |
| 12761 | 12761 | assert(!self.strip); |
| 12762 | const tag: Metadata.Tag = @enumFromInt(@intFromEnum(Metadata.Tag.subprogram) + | |
| 12763 | @as(u3, @truncate(@as(u32, @bitCast(options.sp_flags)) >> 2))); | |
| 12762 | const tag: Metadata.Tag = @fromBackingInt(@intCast(@backingInt(Metadata.Tag.subprogram) + | |
| 12763 | @as(u3, @truncate(@as(u32, @bitCast(options.sp_flags)) >> 2)))); | |
| 12764 | 12764 | return self.metadataDistinctAssumeCapacity(tag, Metadata.Subprogram{ |
| 12765 | 12765 | .file = .wrap(file), |
| 12766 | 12766 | .name = .wrap(name), |
| ... | ... | @@ -13105,7 +13105,7 @@ fn debugEnumeratorAssumeCapacity( |
| 13105 | 13105 | const Adapter = struct { |
| 13106 | 13106 | builder: *const Builder, |
| 13107 | 13107 | pub fn hash(_: @This(), key: Key) u32 { |
| 13108 | var hasher = std.hash.Wyhash.init(std.hash.int(@intFromEnum(key.tag))); | |
| 13108 | var hasher = std.hash.Wyhash.init(std.hash.int(@backingInt(key.tag))); | |
| 13109 | 13109 | hasher.update(std.mem.asBytes(&key.name)); |
| 13110 | 13110 | hasher.update(std.mem.asBytes(&key.bit_width)); |
| 13111 | 13111 | hasher.update(std.mem.sliceAsBytes(key.value.limbs)); |
| ... | ... | @@ -13178,7 +13178,7 @@ fn debugExpressionAssumeCapacity(self: *Builder, elements: []const u32) Metadata |
| 13178 | 13178 | builder: *const Builder, |
| 13179 | 13179 | pub fn hash(_: @This(), key: Key) u32 { |
| 13180 | 13180 | var hasher = |
| 13181 | comptime std.hash.Wyhash.init(std.hash.int(@intFromEnum(Metadata.Tag.expression))); | |
| 13181 | comptime std.hash.Wyhash.init(std.hash.int(@backingInt(Metadata.Tag.expression))); | |
| 13182 | 13182 | hasher.update(std.mem.sliceAsBytes(key.elements)); |
| 13183 | 13183 | return @truncate(hasher.final()); |
| 13184 | 13184 | } |
| ... | ... | @@ -13222,7 +13222,7 @@ fn metadataTupleOptionalsAssumeCapacity(self: *Builder, elements: []const Metada |
| 13222 | 13222 | const Adapter = struct { |
| 13223 | 13223 | builder: *const Builder, |
| 13224 | 13224 | pub fn hash(_: @This(), key: Key) u32 { |
| 13225 | var hasher = comptime std.hash.Wyhash.init(std.hash.int(@intFromEnum(Metadata.Tag.tuple))); | |
| 13225 | var hasher = comptime std.hash.Wyhash.init(std.hash.int(@backingInt(Metadata.Tag.tuple))); | |
| 13226 | 13226 | hasher.update(std.mem.sliceAsBytes(key.elements)); |
| 13227 | 13227 | return @truncate(hasher.final()); |
| 13228 | 13228 | } |
| ... | ... | @@ -13338,14 +13338,14 @@ fn metadataConstantAssumeCapacity(self: *Builder, constant: Constant) Metadata { |
| 13338 | 13338 | const Adapter = struct { |
| 13339 | 13339 | builder: *const Builder, |
| 13340 | 13340 | pub fn hash(_: @This(), key: Constant) u32 { |
| 13341 | var hasher = comptime std.hash.Wyhash.init(std.hash.int(@intFromEnum(Metadata.Tag.constant))); | |
| 13341 | var hasher = comptime std.hash.Wyhash.init(std.hash.int(@backingInt(Metadata.Tag.constant))); | |
| 13342 | 13342 | hasher.update(std.mem.asBytes(&key)); |
| 13343 | 13343 | return @truncate(hasher.final()); |
| 13344 | 13344 | } |
| 13345 | 13345 | |
| 13346 | 13346 | pub fn eql(ctx: @This(), lhs_key: Constant, _: void, rhs_index: usize) bool { |
| 13347 | 13347 | if (Metadata.Tag.constant != ctx.builder.metadata_items.items(.tag)[rhs_index]) return false; |
| 13348 | const rhs_data: Constant = @enumFromInt(ctx.builder.metadata_items.items(.data)[rhs_index]); | |
| 13348 | const rhs_data: Constant = @fromBackingInt(@intCast(ctx.builder.metadata_items.items(.data)[rhs_index])); | |
| 13349 | 13349 | return rhs_data == lhs_key; |
| 13350 | 13350 | } |
| 13351 | 13351 | }; |
| ... | ... | @@ -13360,7 +13360,7 @@ fn metadataConstantAssumeCapacity(self: *Builder, constant: Constant) Metadata { |
| 13360 | 13360 | gop.value_ptr.* = {}; |
| 13361 | 13361 | self.metadata_items.appendAssumeCapacity(.{ |
| 13362 | 13362 | .tag = .constant, |
| 13363 | .data = @intFromEnum(constant), | |
| 13363 | .data = @backingInt(constant), | |
| 13364 | 13364 | }); |
| 13365 | 13365 | } |
| 13366 | 13366 | return .{ .index = @intCast(gop.index), .kind = .node }; |
| ... | ... | @@ -13447,10 +13447,10 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco |
| 13447 | 13447 | try type_block.writeAbbrev(TypeBlock.NumEntry{ .num = @intCast(self.type_items.items.len) }); |
| 13448 | 13448 | |
| 13449 | 13449 | for (self.type_items.items, 0..) |item, i| { |
| 13450 | const ty: Type = @enumFromInt(i); | |
| 13450 | const ty: Type = @fromBackingInt(@intCast(i)); | |
| 13451 | 13451 | |
| 13452 | 13452 | switch (item.tag) { |
| 13453 | .simple => try type_block.writeAbbrev(TypeBlock.Simple{ .code = @enumFromInt(item.data) }), | |
| 13453 | .simple => try type_block.writeAbbrev(TypeBlock.Simple{ .code = @fromBackingInt(@intCast(item.data)) }), | |
| 13454 | 13454 | .integer => try type_block.writeAbbrev(TypeBlock.Integer{ .width = item.data }), |
| 13455 | 13455 | .structure, |
| 13456 | 13456 | .packed_structure, |
| ... | ... | @@ -13475,7 +13475,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco |
| 13475 | 13475 | switch (extra.body) { |
| 13476 | 13476 | .none => try type_block.writeAbbrev(TypeBlock.Opaque{}), |
| 13477 | 13477 | else => { |
| 13478 | const real_struct = self.type_items.items[@intFromEnum(extra.body)]; | |
| 13478 | const real_struct = self.type_items.items[@backingInt(extra.body)]; | |
| 13479 | 13479 | const is_packed: bool = switch (real_struct.tag) { |
| 13480 | 13480 | .structure => false, |
| 13481 | 13481 | .packed_structure => true, |
| ... | ... | @@ -13648,7 +13648,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco |
| 13648 | 13648 | => { |
| 13649 | 13649 | try record.ensureUnusedCapacity(self.gpa, 2); |
| 13650 | 13650 | record.appendAssumeCapacity(0); |
| 13651 | record.appendAssumeCapacity(@intFromEnum(kind)); | |
| 13651 | record.appendAssumeCapacity(@backingInt(kind)); | |
| 13652 | 13652 | }, |
| 13653 | 13653 | .byval, |
| 13654 | 13654 | .byref, |
| ... | ... | @@ -13659,15 +13659,15 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco |
| 13659 | 13659 | => |ty| { |
| 13660 | 13660 | try record.ensureUnusedCapacity(self.gpa, 3); |
| 13661 | 13661 | record.appendAssumeCapacity(6); |
| 13662 | record.appendAssumeCapacity(@intFromEnum(kind)); | |
| 13663 | record.appendAssumeCapacity(@intFromEnum(ty)); | |
| 13662 | record.appendAssumeCapacity(@backingInt(kind)); | |
| 13663 | record.appendAssumeCapacity(@backingInt(ty)); | |
| 13664 | 13664 | }, |
| 13665 | 13665 | .@"align", |
| 13666 | 13666 | .alignstack, |
| 13667 | 13667 | => |alignment| { |
| 13668 | 13668 | try record.ensureUnusedCapacity(self.gpa, 3); |
| 13669 | 13669 | record.appendAssumeCapacity(1); |
| 13670 | record.appendAssumeCapacity(@intFromEnum(kind)); | |
| 13670 | record.appendAssumeCapacity(@backingInt(kind)); | |
| 13671 | 13671 | record.appendAssumeCapacity(alignment.resolve(self).toByteUnits() orelse 0); |
| 13672 | 13672 | }, |
| 13673 | 13673 | .dereferenceable, |
| ... | ... | @@ -13675,44 +13675,44 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco |
| 13675 | 13675 | => |size| { |
| 13676 | 13676 | try record.ensureUnusedCapacity(self.gpa, 3); |
| 13677 | 13677 | record.appendAssumeCapacity(1); |
| 13678 | record.appendAssumeCapacity(@intFromEnum(kind)); | |
| 13678 | record.appendAssumeCapacity(@backingInt(kind)); | |
| 13679 | 13679 | record.appendAssumeCapacity(size); |
| 13680 | 13680 | }, |
| 13681 | 13681 | .nofpclass => |fpclass| { |
| 13682 | 13682 | try record.ensureUnusedCapacity(self.gpa, 3); |
| 13683 | 13683 | record.appendAssumeCapacity(1); |
| 13684 | record.appendAssumeCapacity(@intFromEnum(kind)); | |
| 13684 | record.appendAssumeCapacity(@backingInt(kind)); | |
| 13685 | 13685 | record.appendAssumeCapacity(@as(u32, @bitCast(fpclass))); |
| 13686 | 13686 | }, |
| 13687 | 13687 | .allockind => |allockind| { |
| 13688 | 13688 | try record.ensureUnusedCapacity(self.gpa, 3); |
| 13689 | 13689 | record.appendAssumeCapacity(1); |
| 13690 | record.appendAssumeCapacity(@intFromEnum(kind)); | |
| 13690 | record.appendAssumeCapacity(@backingInt(kind)); | |
| 13691 | 13691 | record.appendAssumeCapacity(@as(u32, @bitCast(allockind))); |
| 13692 | 13692 | }, |
| 13693 | 13693 | |
| 13694 | 13694 | .allocsize => |allocsize| { |
| 13695 | 13695 | try record.ensureUnusedCapacity(self.gpa, 3); |
| 13696 | 13696 | record.appendAssumeCapacity(1); |
| 13697 | record.appendAssumeCapacity(@intFromEnum(kind)); | |
| 13697 | record.appendAssumeCapacity(@backingInt(kind)); | |
| 13698 | 13698 | record.appendAssumeCapacity(@bitCast(allocsize.toLlvm())); |
| 13699 | 13699 | }, |
| 13700 | 13700 | .memory => |memory| { |
| 13701 | 13701 | try record.ensureUnusedCapacity(self.gpa, 3); |
| 13702 | 13702 | record.appendAssumeCapacity(1); |
| 13703 | record.appendAssumeCapacity(@intFromEnum(kind)); | |
| 13703 | record.appendAssumeCapacity(@backingInt(kind)); | |
| 13704 | 13704 | record.appendAssumeCapacity(@as(u32, @bitCast(memory))); |
| 13705 | 13705 | }, |
| 13706 | 13706 | .uwtable => |uwtable| if (uwtable != .none) { |
| 13707 | 13707 | try record.ensureUnusedCapacity(self.gpa, 3); |
| 13708 | 13708 | record.appendAssumeCapacity(1); |
| 13709 | record.appendAssumeCapacity(@intFromEnum(kind)); | |
| 13710 | record.appendAssumeCapacity(@intFromEnum(uwtable)); | |
| 13709 | record.appendAssumeCapacity(@backingInt(kind)); | |
| 13710 | record.appendAssumeCapacity(@backingInt(uwtable)); | |
| 13711 | 13711 | }, |
| 13712 | 13712 | .vscale_range => |vscale_range| { |
| 13713 | 13713 | try record.ensureUnusedCapacity(self.gpa, 3); |
| 13714 | 13714 | record.appendAssumeCapacity(1); |
| 13715 | record.appendAssumeCapacity(@intFromEnum(kind)); | |
| 13715 | record.appendAssumeCapacity(@backingInt(kind)); | |
| 13716 | 13716 | record.appendAssumeCapacity(@bitCast(vscale_range.toLlvm())); |
| 13717 | 13717 | }, |
| 13718 | 13718 | .string => |string_attr| { |
| ... | ... | @@ -13787,7 +13787,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco |
| 13787 | 13787 | for (self.variables.items, 0..) |variable, variable_i| { |
| 13788 | 13788 | // Skip the variable if its global has been repurposed for something else. |
| 13789 | 13789 | switch (variable.global.ptrConst(self).kind) { |
| 13790 | .variable => |v| if (@intFromEnum(v) != variable_i) continue, | |
| 13790 | .variable => |v| if (@backingInt(v) != variable_i) continue, | |
| 13791 | 13791 | else => continue, |
| 13792 | 13792 | } |
| 13793 | 13793 | |
| ... | ... | @@ -13797,7 +13797,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco |
| 13797 | 13797 | for (self.functions.items, 0..) |function, function_i| { |
| 13798 | 13798 | // Skip the function if its global has been repurposed for something else. |
| 13799 | 13799 | switch (function.global.ptrConst(self).kind) { |
| 13800 | .function => |f| if (@intFromEnum(f) != function_i) continue, | |
| 13800 | .function => |f| if (@backingInt(f) != function_i) continue, | |
| 13801 | 13801 | else => continue, |
| 13802 | 13802 | } |
| 13803 | 13803 | |
| ... | ... | @@ -13807,7 +13807,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco |
| 13807 | 13807 | for (self.aliases.items, 0..) |alias, alias_i| { |
| 13808 | 13808 | // Skip the alias if its global has been repurposed for something else. |
| 13809 | 13809 | switch (alias.global.ptrConst(self).kind) { |
| 13810 | .alias => |a| if (@intFromEnum(a) != alias_i) continue, | |
| 13810 | .alias => |a| if (@backingInt(a) != alias_i) continue, | |
| 13811 | 13811 | else => continue, |
| 13812 | 13812 | } |
| 13813 | 13813 | |
| ... | ... | @@ -13854,7 +13854,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco |
| 13854 | 13854 | for (self.variables.items, 0..) |variable, variable_i| { |
| 13855 | 13855 | // Skip the variable if its global has been repurposed for something else. |
| 13856 | 13856 | switch (variable.global.ptrConst(self).kind) { |
| 13857 | .variable => |v| if (@intFromEnum(v) != variable_i) continue, | |
| 13857 | .variable => |v| if (@backingInt(v) != variable_i) continue, | |
| 13858 | 13858 | else => continue, |
| 13859 | 13859 | } |
| 13860 | 13860 | |
| ... | ... | @@ -13905,7 +13905,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco |
| 13905 | 13905 | for (self.functions.items, 0..) |func, func_i| { |
| 13906 | 13906 | // Skip the function if its global has been repurposed for something else. |
| 13907 | 13907 | switch (func.global.ptrConst(self).kind) { |
| 13908 | .function => |f| if (@intFromEnum(f) != func_i) continue, | |
| 13908 | .function => |f| if (@backingInt(f) != func_i) continue, | |
| 13909 | 13909 | else => continue, |
| 13910 | 13910 | } |
| 13911 | 13911 | |
| ... | ... | @@ -13950,7 +13950,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco |
| 13950 | 13950 | for (self.aliases.items, 0..) |alias, alias_i| { |
| 13951 | 13951 | // Skip the alias if its global has been repurposed for something else. |
| 13952 | 13952 | switch (alias.global.ptrConst(self).kind) { |
| 13953 | .alias => |a| if (@intFromEnum(a) != alias_i) continue, | |
| 13953 | .alias => |a| if (@backingInt(a) != alias_i) continue, | |
| 13954 | 13954 | else => continue, |
| 13955 | 13955 | } |
| 13956 | 13956 | |
| ... | ... | @@ -13983,7 +13983,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco |
| 13983 | 13983 | const datas = self.constant_items.items(.data); |
| 13984 | 13984 | for (0..self.constant_items.len) |index| { |
| 13985 | 13985 | record.clearRetainingCapacity(); |
| 13986 | const constant: Constant = @enumFromInt(index); | |
| 13986 | const constant: Constant = @fromBackingInt(@intCast(index)); | |
| 13987 | 13987 | const constant_type = constant.typeOf(self); |
| 13988 | 13988 | if (constant_type != current_type) { |
| 13989 | 13989 | try constants_block.writeAbbrev(ConstantsBlock.SetType{ .type_id = constant_type }); |
| ... | ... | @@ -14096,7 +14096,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco |
| 14096 | 14096 | } |
| 14097 | 14097 | }, |
| 14098 | 14098 | .string => { |
| 14099 | const str: String = @enumFromInt(data); | |
| 14099 | const str: String = @fromBackingInt(@intCast(data)); | |
| 14100 | 14100 | if (str == .none) { |
| 14101 | 14101 | try constants_block.writeAbbrev(ConstantsBlock.Null{}); |
| 14102 | 14102 | } else { |
| ... | ... | @@ -14143,13 +14143,13 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco |
| 14143 | 14143 | const indices = extra.trail.next(extra.data.info.indices_len, Constant, self); |
| 14144 | 14144 | try record.ensureUnusedCapacity(self.gpa, 1 + 2 + 2 * indices.len); |
| 14145 | 14145 | |
| 14146 | record.appendAssumeCapacity(@intFromEnum(extra.data.type)); | |
| 14146 | record.appendAssumeCapacity(@backingInt(extra.data.type)); | |
| 14147 | 14147 | |
| 14148 | record.appendAssumeCapacity(@intFromEnum(extra.data.base.typeOf(self))); | |
| 14148 | record.appendAssumeCapacity(@backingInt(extra.data.base.typeOf(self))); | |
| 14149 | 14149 | record.appendAssumeCapacity(constant_adapter.getConstantIndex(extra.data.base)); |
| 14150 | 14150 | |
| 14151 | 14151 | for (indices) |i| { |
| 14152 | record.appendAssumeCapacity(@intFromEnum(i.typeOf(self))); | |
| 14152 | record.appendAssumeCapacity(@backingInt(i.typeOf(self))); | |
| 14153 | 14153 | record.appendAssumeCapacity(constant_adapter.getConstantIndex(i)); |
| 14154 | 14154 | } |
| 14155 | 14155 | |
| ... | ... | @@ -14183,7 +14183,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco |
| 14183 | 14183 | |
| 14184 | 14184 | try record.ensureUnusedCapacity(self.gpa, 4 + assembly_slice.len + constraints_slice.len); |
| 14185 | 14185 | |
| 14186 | record.appendAssumeCapacity(@intFromEnum(extra.type)); | |
| 14186 | record.appendAssumeCapacity(@backingInt(extra.type)); | |
| 14187 | 14187 | record.appendAssumeCapacity(switch (tag) { |
| 14188 | 14188 | .@"asm" => 0, |
| 14189 | 14189 | .@"asm sideeffect" => 0b0001, |
| ... | ... | @@ -14217,13 +14217,13 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco |
| 14217 | 14217 | try constants_block.writeAbbrev(ConstantsBlock.BlockAddress{ |
| 14218 | 14218 | .type_id = extra.function.typeOf(self), |
| 14219 | 14219 | .function = constant_adapter.getConstantIndex(extra.function.toConst(self)), |
| 14220 | .block = @intFromEnum(extra.block), | |
| 14220 | .block = @backingInt(extra.block), | |
| 14221 | 14221 | }); |
| 14222 | 14222 | }, |
| 14223 | 14223 | .dso_local_equivalent, |
| 14224 | 14224 | .no_cfi, |
| 14225 | 14225 | => |tag| { |
| 14226 | const function: Function.Index = @enumFromInt(data); | |
| 14226 | const function: Function.Index = @fromBackingInt(@intCast(data)); | |
| 14227 | 14227 | try constants_block.writeAbbrev(ConstantsBlock.DsoLocalEquivalentOrNoCfi{ |
| 14228 | 14228 | .code = switch (tag) { |
| 14229 | 14229 | .dso_local_equivalent => .DSO_LOCAL_EQUIVALENT, |
| ... | ... | @@ -14384,7 +14384,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco |
| 14384 | 14384 | .ty = extra.ty, |
| 14385 | 14385 | .scope_line = extra.scope_line, |
| 14386 | 14386 | .sp_flags = @bitCast(@as(u32, @as(u3, @intCast( |
| 14387 | @intFromEnum(kind) - @intFromEnum(Metadata.Tag.subprogram), | |
| 14387 | @backingInt(kind) - @backingInt(Metadata.Tag.subprogram), | |
| 14388 | 14388 | ))) << 2), |
| 14389 | 14389 | .flags = extra.di_flags, |
| 14390 | 14390 | .compile_unit = extra.compile_unit, |
| ... | ... | @@ -14528,7 +14528,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco |
| 14528 | 14528 | else |
| 14529 | 14529 | -%val << 1 | 1); |
| 14530 | 14530 | } |
| 14531 | try metadata_block.writeUnabbrev(@intFromEnum(MetadataBlock.Code.ENUMERATOR), record.items); | |
| 14531 | try metadata_block.writeUnabbrev(@backingInt(MetadataBlock.Code.ENUMERATOR), record.items); | |
| 14532 | 14532 | continue; |
| 14533 | 14533 | }; |
| 14534 | 14534 | try metadata_block.writeAbbrevAdapted(MetadataBlock.Enumerator{ |
| ... | ... | @@ -14606,7 +14606,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco |
| 14606 | 14606 | }, metadata_adapter); |
| 14607 | 14607 | }, |
| 14608 | 14608 | .constant => { |
| 14609 | const constant: Constant = @enumFromInt(data); | |
| 14609 | const constant: Constant = @fromBackingInt(@intCast(data)); | |
| 14610 | 14610 | try metadata_block.writeAbbrevAdapted(MetadataBlock.Constant{ |
| 14611 | 14611 | .ty = constant.typeOf(self), |
| 14612 | 14612 | .constant = constant, |
| ... | ... | @@ -14663,28 +14663,28 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco |
| 14663 | 14663 | var block_info_block = try module_block.enterSubBlock(BlockInfoBlock, true); |
| 14664 | 14664 | |
| 14665 | 14665 | try block_info_block.writeUnabbrev(BlockInfoBlock.set_block_id, &.{ |
| 14666 | @intFromEnum(ir.ModuleBlock.FunctionBlock.id), | |
| 14666 | @backingInt(ir.ModuleBlock.FunctionBlock.id), | |
| 14667 | 14667 | }); |
| 14668 | 14668 | inline for (ir.ModuleBlock.FunctionBlock.abbrevs) |abbrev| { |
| 14669 | 14669 | try block_info_block.defineAbbrev(&abbrev.ops); |
| 14670 | 14670 | } |
| 14671 | 14671 | |
| 14672 | 14672 | try block_info_block.writeUnabbrev(BlockInfoBlock.set_block_id, &.{ |
| 14673 | @intFromEnum(ir.ModuleBlock.FunctionBlock.ValueSymtabBlock.id), | |
| 14673 | @backingInt(ir.ModuleBlock.FunctionBlock.ValueSymtabBlock.id), | |
| 14674 | 14674 | }); |
| 14675 | 14675 | inline for (ir.ModuleBlock.FunctionBlock.ValueSymtabBlock.abbrevs) |abbrev| { |
| 14676 | 14676 | try block_info_block.defineAbbrev(&abbrev.ops); |
| 14677 | 14677 | } |
| 14678 | 14678 | |
| 14679 | 14679 | try block_info_block.writeUnabbrev(BlockInfoBlock.set_block_id, &.{ |
| 14680 | @intFromEnum(ir.ModuleBlock.FunctionBlock.MetadataBlock.id), | |
| 14680 | @backingInt(ir.ModuleBlock.FunctionBlock.MetadataBlock.id), | |
| 14681 | 14681 | }); |
| 14682 | 14682 | inline for (ir.ModuleBlock.FunctionBlock.MetadataBlock.abbrevs) |abbrev| { |
| 14683 | 14683 | try block_info_block.defineAbbrev(&abbrev.ops); |
| 14684 | 14684 | } |
| 14685 | 14685 | |
| 14686 | 14686 | try block_info_block.writeUnabbrev(BlockInfoBlock.set_block_id, &.{ |
| 14687 | @intFromEnum(ir.ModuleBlock.FunctionBlock.MetadataAttachmentBlock.id), | |
| 14687 | @backingInt(ir.ModuleBlock.FunctionBlock.MetadataAttachmentBlock.id), | |
| 14688 | 14688 | }); |
| 14689 | 14689 | inline for (ir.ModuleBlock.FunctionBlock.MetadataAttachmentBlock.abbrevs) |abbrev| { |
| 14690 | 14690 | try block_info_block.defineAbbrev(&abbrev.ops); |
| ... | ... | @@ -14760,7 +14760,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco |
| 14760 | 14760 | for (self.functions.items, 0..) |func, func_index| { |
| 14761 | 14761 | // Skip the function if its global has been repurposed for something else. |
| 14762 | 14762 | switch (func.global.ptrConst(self).kind) { |
| 14763 | .function => |f| if (@intFromEnum(f) != func_index) continue, | |
| 14763 | .function => |f| if (@backingInt(f) != func_index) continue, | |
| 14764 | 14764 | else => continue, |
| 14765 | 14765 | } |
| 14766 | 14766 | |
| ... | ... | @@ -14775,7 +14775,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco |
| 14775 | 14775 | var adapter: FunctionAdapter = .{ |
| 14776 | 14776 | .metadata_adapter = metadata_adapter, |
| 14777 | 14777 | .func = &func, |
| 14778 | .instruction_index = @enumFromInt(0), | |
| 14778 | .instruction_index = @fromBackingInt(@intCast(0)), | |
| 14779 | 14779 | }; |
| 14780 | 14780 | |
| 14781 | 14781 | // Emit function level metadata block |
| ... | ... | @@ -14785,8 +14785,8 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco |
| 14785 | 14785 | |
| 14786 | 14786 | for (func.debug_values) |value| { |
| 14787 | 14787 | try metadata_block.writeAbbrev(MetadataBlock.Value{ |
| 14788 | .ty = value.typeOf(@enumFromInt(func_index), self), | |
| 14789 | .value = @enumFromInt(adapter.getValueIndex(value.toValue())), | |
| 14788 | .ty = value.typeOf(@fromBackingInt(@intCast(func_index)), self), | |
| 14789 | .value = @fromBackingInt(@intCast(adapter.getValueIndex(value.toValue()))), | |
| 14790 | 14790 | }); |
| 14791 | 14791 | } |
| 14792 | 14792 | |
| ... | ... | @@ -14800,7 +14800,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco |
| 14800 | 14800 | |
| 14801 | 14801 | var block_incoming_len: u32 = undefined; |
| 14802 | 14802 | for (tags, datas, 0..) |tag, data, instr_index| { |
| 14803 | adapter.instruction_index = @enumFromInt(instr_index); | |
| 14803 | adapter.instruction_index = @fromBackingInt(@intCast(instr_index)); | |
| 14804 | 14804 | record.clearRetainingCapacity(); |
| 14805 | 14805 | |
| 14806 | 14806 | switch (tag) { |
| ... | ... | @@ -14962,7 +14962,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco |
| 14962 | 14962 | const alignment = extra.info.alignment.toLlvm(); |
| 14963 | 14963 | try function_block.writeAbbrev(FunctionBlock.Alloca{ |
| 14964 | 14964 | .inst_type = extra.type, |
| 14965 | .len_type = extra.len.typeOf(@enumFromInt(func_index), self), | |
| 14965 | .len_type = extra.len.typeOf(@fromBackingInt(@intCast(func_index)), self), | |
| 14966 | 14966 | .len_value = adapter.getValueIndex(extra.len), |
| 14967 | 14967 | .flags = .{ |
| 14968 | 14968 | .align_lower = @truncate(alignment), |
| ... | ... | @@ -15068,10 +15068,10 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco |
| 15068 | 15068 | }); |
| 15069 | 15069 | }, |
| 15070 | 15070 | .fneg => try function_block.writeAbbrev(FunctionBlock.FNeg{ |
| 15071 | .val = adapter.getOffsetValueIndex(@enumFromInt(data)), | |
| 15071 | .val = adapter.getOffsetValueIndex(@fromBackingInt(@intCast(data))), | |
| 15072 | 15072 | }), |
| 15073 | 15073 | .@"fneg fast" => try function_block.writeAbbrev(FunctionBlock.FNegFast{ |
| 15074 | .val = adapter.getOffsetValueIndex(@enumFromInt(data)), | |
| 15074 | .val = adapter.getOffsetValueIndex(@fromBackingInt(@intCast(data))), | |
| 15075 | 15075 | .fast_math = FastMath.fast, |
| 15076 | 15076 | }), |
| 15077 | 15077 | .extractvalue => { |
| ... | ... | @@ -15096,7 +15096,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco |
| 15096 | 15096 | extra.trail.next(extra.data.targets_len, Function.Block.Index, &func); |
| 15097 | 15097 | try function_block.writeAbbrevAdapted( |
| 15098 | 15098 | FunctionBlock.IndirectBr{ |
| 15099 | .ty = extra.data.addr.typeOf(@enumFromInt(func_index), self), | |
| 15099 | .ty = extra.data.addr.typeOf(@fromBackingInt(@intCast(func_index)), self), | |
| 15100 | 15100 | .addr = extra.data.addr, |
| 15101 | 15101 | .targets = targets, |
| 15102 | 15102 | }, |
| ... | ... | @@ -15208,8 +15208,8 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco |
| 15208 | 15208 | .br_cond => { |
| 15209 | 15209 | const extra = func.extraData(Function.Instruction.BrCond, data); |
| 15210 | 15210 | try function_block.writeAbbrev(FunctionBlock.BrConditional{ |
| 15211 | .then_block = @intFromEnum(extra.then), | |
| 15212 | .else_block = @intFromEnum(extra.@"else"), | |
| 15211 | .then_block = @backingInt(extra.then), | |
| 15212 | .else_block = @backingInt(extra.@"else"), | |
| 15213 | 15213 | .condition = adapter.getOffsetValueIndex(extra.cond), |
| 15214 | 15214 | }); |
| 15215 | 15215 | }, |
| ... | ... | @@ -15219,19 +15219,19 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco |
| 15219 | 15219 | try record.ensureUnusedCapacity(self.gpa, 3 + extra.data.cases_len * 2); |
| 15220 | 15220 | |
| 15221 | 15221 | // Conditional type |
| 15222 | record.appendAssumeCapacity(@intFromEnum(extra.data.val.typeOf(@enumFromInt(func_index), self))); | |
| 15222 | record.appendAssumeCapacity(@backingInt(extra.data.val.typeOf(@fromBackingInt(@intCast(func_index)), self))); | |
| 15223 | 15223 | |
| 15224 | 15224 | // Conditional |
| 15225 | 15225 | record.appendAssumeCapacity(adapter.getOffsetValueIndex(extra.data.val)); |
| 15226 | 15226 | |
| 15227 | 15227 | // Default block |
| 15228 | record.appendAssumeCapacity(@intFromEnum(extra.data.default)); | |
| 15228 | record.appendAssumeCapacity(@backingInt(extra.data.default)); | |
| 15229 | 15229 | |
| 15230 | 15230 | const vals = extra.trail.next(extra.data.cases_len, Constant, &func); |
| 15231 | 15231 | const blocks = extra.trail.next(extra.data.cases_len, Function.Block.Index, &func); |
| 15232 | 15232 | for (vals, blocks) |val, block| { |
| 15233 | 15233 | record.appendAssumeCapacity(adapter.metadata_adapter.constant_adapter.getConstantIndex(val)); |
| 15234 | record.appendAssumeCapacity(@intFromEnum(block)); | |
| 15234 | record.appendAssumeCapacity(@backingInt(block)); | |
| 15235 | 15235 | } |
| 15236 | 15236 | |
| 15237 | 15237 | try function_block.writeUnabbrev(12, record.items); |
| ... | ... | @@ -15239,7 +15239,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco |
| 15239 | 15239 | .va_arg => { |
| 15240 | 15240 | const extra = func.extraData(Function.Instruction.VaArg, data); |
| 15241 | 15241 | try function_block.writeAbbrev(FunctionBlock.VaArg{ |
| 15242 | .list_type = extra.list.typeOf(@enumFromInt(func_index), self), | |
| 15242 | .list_type = extra.list.typeOf(@fromBackingInt(@intCast(func_index)), self), | |
| 15243 | 15243 | .list = adapter.getOffsetValueIndex(extra.list), |
| 15244 | 15244 | .type = extra.type, |
| 15245 | 15245 | }); |
| ... | ... | @@ -15256,14 +15256,14 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco |
| 15256 | 15256 | 1 + block_incoming_len * 2 + @intFromBool(kind == .@"phi fast"), |
| 15257 | 15257 | ); |
| 15258 | 15258 | |
| 15259 | record.appendAssumeCapacity(@intFromEnum(extra.data.type)); | |
| 15259 | record.appendAssumeCapacity(@backingInt(extra.data.type)); | |
| 15260 | 15260 | |
| 15261 | 15261 | for (vals, blocks) |val, block| { |
| 15262 | 15262 | const offset_value = adapter.getOffsetValueSignedIndex(val); |
| 15263 | 15263 | const abs_value: u32 = @intCast(@abs(offset_value)); |
| 15264 | 15264 | const signed_vbr = if (offset_value > 0) abs_value << 1 else ((abs_value << 1) | 1); |
| 15265 | 15265 | record.appendAssumeCapacity(signed_vbr); |
| 15266 | record.appendAssumeCapacity(@intFromEnum(block)); | |
| 15266 | record.appendAssumeCapacity(@backingInt(block)); | |
| 15267 | 15267 | } |
| 15268 | 15268 | |
| 15269 | 15269 | if (kind == .@"phi fast") record.appendAssumeCapacity(@as(u8, @bitCast(FastMath{}))); |
| ... | ... | @@ -15271,7 +15271,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco |
| 15271 | 15271 | try function_block.writeUnabbrev(16, record.items); |
| 15272 | 15272 | }, |
| 15273 | 15273 | .ret => try function_block.writeAbbrev(FunctionBlock.Ret{ |
| 15274 | .val = adapter.getOffsetValueIndex(@enumFromInt(data)), | |
| 15274 | .val = adapter.getOffsetValueIndex(@fromBackingInt(@intCast(data))), | |
| 15275 | 15275 | }), |
| 15276 | 15276 | .@"ret void" => try function_block.writeAbbrev(FunctionBlock.RetVoid{}), |
| 15277 | 15277 | .atomicrmw => { |
lib/std/zig/llvm/bitcode_writer.zig+1-1| ... | ... | @@ -423,7 +423,7 @@ fn BufType(comptime T: type, comptime min_len: usize) type { |
| 423 | 423 | fn bufValue(value: anytype, comptime min_len: usize) BufType(@TypeOf(value), min_len) { |
| 424 | 424 | return switch (@typeInfo(@TypeOf(value))) { |
| 425 | 425 | .comptime_int, .int => @intCast(value), |
| 426 | .@"enum" => @intFromEnum(value), | |
| 426 | .@"enum" => @backingInt(value), | |
| 427 | 427 | .bool => @intFromBool(value), |
| 428 | 428 | .@"struct" => @intCast(@as(@Int(.unsigned, @bitSizeOf(@TypeOf(value))), @bitCast(value))), |
| 429 | 429 | else => unreachable, |
lib/std/zig/llvm/ir.zig+108-108| ... | ... | @@ -189,7 +189,7 @@ pub const ModuleBlock = struct { |
| 189 | 189 | |
| 190 | 190 | pub const Version = struct { |
| 191 | 191 | pub const ops = [_]AbbrevOp{ |
| 192 | .{ .literal = @intFromEnum(ModuleBlock.Code.VERSION) }, | |
| 192 | .{ .literal = @backingInt(ModuleBlock.Code.VERSION) }, | |
| 193 | 193 | .{ .literal = 2 }, |
| 194 | 194 | }; |
| 195 | 195 | }; |
| ... | ... | @@ -211,7 +211,7 @@ pub const ModuleBlock = struct { |
| 211 | 211 | }; |
| 212 | 212 | |
| 213 | 213 | pub const ops = [_]AbbrevOp{ |
| 214 | .{ .literal = @intFromEnum(ModuleBlock.Code.GLOBALVAR) }, // Code | |
| 214 | .{ .literal = @backingInt(ModuleBlock.Code.GLOBALVAR) }, // Code | |
| 215 | 215 | .{ .vbr = 16 }, // strtab_offset |
| 216 | 216 | .{ .vbr = 16 }, // strtab_size |
| 217 | 217 | .{ .fixed_runtime = Builder.Type }, |
| ... | ... | @@ -247,7 +247,7 @@ pub const ModuleBlock = struct { |
| 247 | 247 | |
| 248 | 248 | pub const Function = struct { |
| 249 | 249 | pub const ops = [_]AbbrevOp{ |
| 250 | .{ .literal = @intFromEnum(ModuleBlock.Code.FUNCTION) }, // Code | |
| 250 | .{ .literal = @backingInt(ModuleBlock.Code.FUNCTION) }, // Code | |
| 251 | 251 | .{ .vbr = 16 }, // strtab_offset |
| 252 | 252 | .{ .vbr = 16 }, // strtab_size |
| 253 | 253 | .{ .fixed_runtime = Builder.Type }, |
| ... | ... | @@ -286,7 +286,7 @@ pub const ModuleBlock = struct { |
| 286 | 286 | |
| 287 | 287 | pub const Alias = struct { |
| 288 | 288 | pub const ops = [_]AbbrevOp{ |
| 289 | .{ .literal = @intFromEnum(ModuleBlock.Code.ALIAS) }, // Code | |
| 289 | .{ .literal = @backingInt(ModuleBlock.Code.ALIAS) }, // Code | |
| 290 | 290 | .{ .vbr = 16 }, // strtab_offset |
| 291 | 291 | .{ .vbr = 16 }, // strtab_size |
| 292 | 292 | .{ .fixed_runtime = Builder.Type }, |
| ... | ... | @@ -330,7 +330,7 @@ pub const ModuleBlock = struct { |
| 330 | 330 | |
| 331 | 331 | pub const Entry = struct { |
| 332 | 332 | pub const ops = [_]AbbrevOp{ |
| 333 | .{ .literal = @intFromEnum(ModuleBlock.ParamattrBlock.Code.ENTRY) }, | |
| 333 | .{ .literal = @backingInt(ModuleBlock.ParamattrBlock.Code.ENTRY) }, | |
| 334 | 334 | .{ .array_vbr = 8 }, |
| 335 | 335 | }; |
| 336 | 336 | group_indices: []const u64, |
| ... | ... | @@ -451,7 +451,7 @@ pub const ModuleBlock = struct { |
| 451 | 451 | |
| 452 | 452 | pub const SetType = struct { |
| 453 | 453 | pub const ops = [_]AbbrevOp{ |
| 454 | .{ .literal = @intFromEnum(ModuleBlock.ConstantsBlock.Code.SETTYPE) }, | |
| 454 | .{ .literal = @backingInt(ModuleBlock.ConstantsBlock.Code.SETTYPE) }, | |
| 455 | 455 | .{ .fixed_runtime = Builder.Type }, |
| 456 | 456 | }; |
| 457 | 457 | type_id: Builder.Type, |
| ... | ... | @@ -459,25 +459,25 @@ pub const ModuleBlock = struct { |
| 459 | 459 | |
| 460 | 460 | pub const Null = struct { |
| 461 | 461 | pub const ops = [_]AbbrevOp{ |
| 462 | .{ .literal = @intFromEnum(ModuleBlock.ConstantsBlock.Code.NULL) }, | |
| 462 | .{ .literal = @backingInt(ModuleBlock.ConstantsBlock.Code.NULL) }, | |
| 463 | 463 | }; |
| 464 | 464 | }; |
| 465 | 465 | |
| 466 | 466 | pub const Undef = struct { |
| 467 | 467 | pub const ops = [_]AbbrevOp{ |
| 468 | .{ .literal = @intFromEnum(ModuleBlock.ConstantsBlock.Code.UNDEF) }, | |
| 468 | .{ .literal = @backingInt(ModuleBlock.ConstantsBlock.Code.UNDEF) }, | |
| 469 | 469 | }; |
| 470 | 470 | }; |
| 471 | 471 | |
| 472 | 472 | pub const Poison = struct { |
| 473 | 473 | pub const ops = [_]AbbrevOp{ |
| 474 | .{ .literal = @intFromEnum(ModuleBlock.ConstantsBlock.Code.POISON) }, | |
| 474 | .{ .literal = @backingInt(ModuleBlock.ConstantsBlock.Code.POISON) }, | |
| 475 | 475 | }; |
| 476 | 476 | }; |
| 477 | 477 | |
| 478 | 478 | pub const Integer = struct { |
| 479 | 479 | pub const ops = [_]AbbrevOp{ |
| 480 | .{ .literal = @intFromEnum(ModuleBlock.ConstantsBlock.Code.INTEGER) }, | |
| 480 | .{ .literal = @backingInt(ModuleBlock.ConstantsBlock.Code.INTEGER) }, | |
| 481 | 481 | .{ .vbr = 16 }, |
| 482 | 482 | }; |
| 483 | 483 | value: u64, |
| ... | ... | @@ -485,7 +485,7 @@ pub const ModuleBlock = struct { |
| 485 | 485 | |
| 486 | 486 | pub const Half = struct { |
| 487 | 487 | pub const ops = [_]AbbrevOp{ |
| 488 | .{ .literal = @intFromEnum(ModuleBlock.ConstantsBlock.Code.FLOAT) }, | |
| 488 | .{ .literal = @backingInt(ModuleBlock.ConstantsBlock.Code.FLOAT) }, | |
| 489 | 489 | .{ .fixed = 16 }, |
| 490 | 490 | }; |
| 491 | 491 | value: u16, |
| ... | ... | @@ -493,7 +493,7 @@ pub const ModuleBlock = struct { |
| 493 | 493 | |
| 494 | 494 | pub const Float = struct { |
| 495 | 495 | pub const ops = [_]AbbrevOp{ |
| 496 | .{ .literal = @intFromEnum(ModuleBlock.ConstantsBlock.Code.FLOAT) }, | |
| 496 | .{ .literal = @backingInt(ModuleBlock.ConstantsBlock.Code.FLOAT) }, | |
| 497 | 497 | .{ .fixed = 32 }, |
| 498 | 498 | }; |
| 499 | 499 | value: u32, |
| ... | ... | @@ -501,7 +501,7 @@ pub const ModuleBlock = struct { |
| 501 | 501 | |
| 502 | 502 | pub const Double = struct { |
| 503 | 503 | pub const ops = [_]AbbrevOp{ |
| 504 | .{ .literal = @intFromEnum(ModuleBlock.ConstantsBlock.Code.FLOAT) }, | |
| 504 | .{ .literal = @backingInt(ModuleBlock.ConstantsBlock.Code.FLOAT) }, | |
| 505 | 505 | .{ .vbr = 6 }, |
| 506 | 506 | }; |
| 507 | 507 | value: u64, |
| ... | ... | @@ -509,7 +509,7 @@ pub const ModuleBlock = struct { |
| 509 | 509 | |
| 510 | 510 | pub const Fp80 = struct { |
| 511 | 511 | pub const ops = [_]AbbrevOp{ |
| 512 | .{ .literal = @intFromEnum(ModuleBlock.ConstantsBlock.Code.FLOAT) }, | |
| 512 | .{ .literal = @backingInt(ModuleBlock.ConstantsBlock.Code.FLOAT) }, | |
| 513 | 513 | .{ .vbr = 6 }, |
| 514 | 514 | .{ .vbr = 6 }, |
| 515 | 515 | }; |
| ... | ... | @@ -519,7 +519,7 @@ pub const ModuleBlock = struct { |
| 519 | 519 | |
| 520 | 520 | pub const Fp128 = struct { |
| 521 | 521 | pub const ops = [_]AbbrevOp{ |
| 522 | .{ .literal = @intFromEnum(ModuleBlock.ConstantsBlock.Code.FLOAT) }, | |
| 522 | .{ .literal = @backingInt(ModuleBlock.ConstantsBlock.Code.FLOAT) }, | |
| 523 | 523 | .{ .vbr = 6 }, |
| 524 | 524 | .{ .vbr = 6 }, |
| 525 | 525 | }; |
| ... | ... | @@ -529,7 +529,7 @@ pub const ModuleBlock = struct { |
| 529 | 529 | |
| 530 | 530 | pub const Aggregate = struct { |
| 531 | 531 | pub const ops = [_]AbbrevOp{ |
| 532 | .{ .literal = @intFromEnum(ModuleBlock.ConstantsBlock.Code.AGGREGATE) }, | |
| 532 | .{ .literal = @backingInt(ModuleBlock.ConstantsBlock.Code.AGGREGATE) }, | |
| 533 | 533 | .{ .array_fixed = 32 }, |
| 534 | 534 | }; |
| 535 | 535 | values: []const Builder.Constant, |
| ... | ... | @@ -537,7 +537,7 @@ pub const ModuleBlock = struct { |
| 537 | 537 | |
| 538 | 538 | pub const String = struct { |
| 539 | 539 | pub const ops = [_]AbbrevOp{ |
| 540 | .{ .literal = @intFromEnum(ModuleBlock.ConstantsBlock.Code.STRING) }, | |
| 540 | .{ .literal = @backingInt(ModuleBlock.ConstantsBlock.Code.STRING) }, | |
| 541 | 541 | .{ .array_fixed = 8 }, |
| 542 | 542 | }; |
| 543 | 543 | string: []const u8, |
| ... | ... | @@ -545,7 +545,7 @@ pub const ModuleBlock = struct { |
| 545 | 545 | |
| 546 | 546 | pub const CString = struct { |
| 547 | 547 | pub const ops = [_]AbbrevOp{ |
| 548 | .{ .literal = @intFromEnum(ModuleBlock.ConstantsBlock.Code.CSTRING) }, | |
| 548 | .{ .literal = @backingInt(ModuleBlock.ConstantsBlock.Code.CSTRING) }, | |
| 549 | 549 | .{ .array_fixed = 8 }, |
| 550 | 550 | }; |
| 551 | 551 | string: []const u8, |
| ... | ... | @@ -554,7 +554,7 @@ pub const ModuleBlock = struct { |
| 554 | 554 | pub const Cast = struct { |
| 555 | 555 | const CastOpcode = Builder.CastOpcode; |
| 556 | 556 | pub const ops = [_]AbbrevOp{ |
| 557 | .{ .literal = @intFromEnum(ModuleBlock.ConstantsBlock.Code.CE_CAST) }, | |
| 557 | .{ .literal = @backingInt(ModuleBlock.ConstantsBlock.Code.CE_CAST) }, | |
| 558 | 558 | .{ .fixed = @bitSizeOf(CastOpcode) }, |
| 559 | 559 | .{ .fixed_runtime = Builder.Type }, |
| 560 | 560 | ConstantAbbrev, |
| ... | ... | @@ -568,7 +568,7 @@ pub const ModuleBlock = struct { |
| 568 | 568 | pub const Binary = struct { |
| 569 | 569 | const BinaryOpcode = Builder.BinaryOpcode; |
| 570 | 570 | pub const ops = [_]AbbrevOp{ |
| 571 | .{ .literal = @intFromEnum(ModuleBlock.ConstantsBlock.Code.CE_BINOP) }, | |
| 571 | .{ .literal = @backingInt(ModuleBlock.ConstantsBlock.Code.CE_BINOP) }, | |
| 572 | 572 | .{ .fixed = @bitSizeOf(BinaryOpcode) }, |
| 573 | 573 | ConstantAbbrev, |
| 574 | 574 | ConstantAbbrev, |
| ... | ... | @@ -581,7 +581,7 @@ pub const ModuleBlock = struct { |
| 581 | 581 | |
| 582 | 582 | pub const Cmp = struct { |
| 583 | 583 | pub const ops = [_]AbbrevOp{ |
| 584 | .{ .literal = @intFromEnum(ModuleBlock.ConstantsBlock.Code.CE_CMP) }, | |
| 584 | .{ .literal = @backingInt(ModuleBlock.ConstantsBlock.Code.CE_CMP) }, | |
| 585 | 585 | .{ .fixed_runtime = Builder.Type }, |
| 586 | 586 | ConstantAbbrev, |
| 587 | 587 | ConstantAbbrev, |
| ... | ... | @@ -596,7 +596,7 @@ pub const ModuleBlock = struct { |
| 596 | 596 | |
| 597 | 597 | pub const ExtractElement = struct { |
| 598 | 598 | pub const ops = [_]AbbrevOp{ |
| 599 | .{ .literal = @intFromEnum(ModuleBlock.ConstantsBlock.Code.CE_EXTRACTELT) }, | |
| 599 | .{ .literal = @backingInt(ModuleBlock.ConstantsBlock.Code.CE_EXTRACTELT) }, | |
| 600 | 600 | .{ .fixed_runtime = Builder.Type }, |
| 601 | 601 | ConstantAbbrev, |
| 602 | 602 | .{ .fixed_runtime = Builder.Type }, |
| ... | ... | @@ -611,7 +611,7 @@ pub const ModuleBlock = struct { |
| 611 | 611 | |
| 612 | 612 | pub const InsertElement = struct { |
| 613 | 613 | pub const ops = [_]AbbrevOp{ |
| 614 | .{ .literal = @intFromEnum(ModuleBlock.ConstantsBlock.Code.CE_INSERTELT) }, | |
| 614 | .{ .literal = @backingInt(ModuleBlock.ConstantsBlock.Code.CE_INSERTELT) }, | |
| 615 | 615 | ConstantAbbrev, |
| 616 | 616 | ConstantAbbrev, |
| 617 | 617 | .{ .fixed_runtime = Builder.Type }, |
| ... | ... | @@ -626,7 +626,7 @@ pub const ModuleBlock = struct { |
| 626 | 626 | |
| 627 | 627 | pub const ShuffleVector = struct { |
| 628 | 628 | pub const ops = [_]AbbrevOp{ |
| 629 | .{ .literal = @intFromEnum(ModuleBlock.ConstantsBlock.Code.CE_SHUFFLEVEC) }, | |
| 629 | .{ .literal = @backingInt(ModuleBlock.ConstantsBlock.Code.CE_SHUFFLEVEC) }, | |
| 630 | 630 | ValueAbbrev, |
| 631 | 631 | ValueAbbrev, |
| 632 | 632 | ValueAbbrev, |
| ... | ... | @@ -639,7 +639,7 @@ pub const ModuleBlock = struct { |
| 639 | 639 | |
| 640 | 640 | pub const ShuffleVectorEx = struct { |
| 641 | 641 | pub const ops = [_]AbbrevOp{ |
| 642 | .{ .literal = @intFromEnum(ModuleBlock.ConstantsBlock.Code.CE_SHUFVEC_EX) }, | |
| 642 | .{ .literal = @backingInt(ModuleBlock.ConstantsBlock.Code.CE_SHUFVEC_EX) }, | |
| 643 | 643 | .{ .fixed_runtime = Builder.Type }, |
| 644 | 644 | ValueAbbrev, |
| 645 | 645 | ValueAbbrev, |
| ... | ... | @@ -654,7 +654,7 @@ pub const ModuleBlock = struct { |
| 654 | 654 | |
| 655 | 655 | pub const BlockAddress = struct { |
| 656 | 656 | pub const ops = [_]AbbrevOp{ |
| 657 | .{ .literal = @intFromEnum(ModuleBlock.ConstantsBlock.Code.BLOCKADDRESS) }, | |
| 657 | .{ .literal = @backingInt(ModuleBlock.ConstantsBlock.Code.BLOCKADDRESS) }, | |
| 658 | 658 | .{ .fixed_runtime = Builder.Type }, |
| 659 | 659 | ConstantAbbrev, |
| 660 | 660 | BlockAbbrev, |
| ... | ... | @@ -867,7 +867,7 @@ pub const ModuleBlock = struct { |
| 867 | 867 | |
| 868 | 868 | pub const DeclareBlocks = struct { |
| 869 | 869 | pub const ops = [_]AbbrevOp{ |
| 870 | .{ .literal = @intFromEnum(ModuleBlock.FunctionBlock.Code.DECLAREBLOCKS) }, | |
| 870 | .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.DECLAREBLOCKS) }, | |
| 871 | 871 | .{ .vbr = 8 }, |
| 872 | 872 | }; |
| 873 | 873 | num_blocks: usize, |
| ... | ... | @@ -884,7 +884,7 @@ pub const ModuleBlock = struct { |
| 884 | 884 | no_tail: bool = false, |
| 885 | 885 | }; |
| 886 | 886 | pub const ops = [_]AbbrevOp{ |
| 887 | .{ .literal = @intFromEnum(ModuleBlock.FunctionBlock.Code.INST_CALL) }, | |
| 887 | .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_CALL) }, | |
| 888 | 888 | .{ .fixed_runtime = Builder.FunctionAttributes }, |
| 889 | 889 | .{ .fixed = @bitSizeOf(CallType) }, |
| 890 | 890 | .{ .fixed_runtime = Builder.Type }, |
| ... | ... | @@ -912,7 +912,7 @@ pub const ModuleBlock = struct { |
| 912 | 912 | }; |
| 913 | 913 | |
| 914 | 914 | pub const ops = [_]AbbrevOp{ |
| 915 | .{ .literal = @intFromEnum(ModuleBlock.FunctionBlock.Code.INST_CALL) }, | |
| 915 | .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_CALL) }, | |
| 916 | 916 | .{ .fixed_runtime = Builder.FunctionAttributes }, |
| 917 | 917 | .{ .fixed = @bitSizeOf(CallType) }, |
| 918 | 918 | .{ .fixed = @bitSizeOf(Builder.FastMath) }, |
| ... | ... | @@ -931,7 +931,7 @@ pub const ModuleBlock = struct { |
| 931 | 931 | |
| 932 | 932 | pub const FNeg = struct { |
| 933 | 933 | pub const ops = [_]AbbrevOp{ |
| 934 | .{ .literal = @intFromEnum(ModuleBlock.FunctionBlock.Code.INST_UNOP) }, | |
| 934 | .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_UNOP) }, | |
| 935 | 935 | ValueAbbrev, |
| 936 | 936 | .{ .literal = 0 }, |
| 937 | 937 | }; |
| ... | ... | @@ -941,7 +941,7 @@ pub const ModuleBlock = struct { |
| 941 | 941 | |
| 942 | 942 | pub const FNegFast = struct { |
| 943 | 943 | pub const ops = [_]AbbrevOp{ |
| 944 | .{ .literal = @intFromEnum(ModuleBlock.FunctionBlock.Code.INST_UNOP) }, | |
| 944 | .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_UNOP) }, | |
| 945 | 945 | ValueAbbrev, |
| 946 | 946 | .{ .literal = 0 }, |
| 947 | 947 | .{ .fixed = @bitSizeOf(Builder.FastMath) }, |
| ... | ... | @@ -954,7 +954,7 @@ pub const ModuleBlock = struct { |
| 954 | 954 | pub const Binary = struct { |
| 955 | 955 | const BinaryOpcode = Builder.BinaryOpcode; |
| 956 | 956 | pub const ops = [_]AbbrevOp{ |
| 957 | .{ .literal = @intFromEnum(ModuleBlock.FunctionBlock.Code.INST_BINOP) }, | |
| 957 | .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_BINOP) }, | |
| 958 | 958 | ValueAbbrev, |
| 959 | 959 | ValueAbbrev, |
| 960 | 960 | .{ .fixed = @bitSizeOf(BinaryOpcode) }, |
| ... | ... | @@ -968,7 +968,7 @@ pub const ModuleBlock = struct { |
| 968 | 968 | pub const BinaryNoWrap = struct { |
| 969 | 969 | const BinaryOpcode = Builder.BinaryOpcode; |
| 970 | 970 | pub const ops = [_]AbbrevOp{ |
| 971 | .{ .literal = @intFromEnum(ModuleBlock.FunctionBlock.Code.INST_BINOP) }, | |
| 971 | .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_BINOP) }, | |
| 972 | 972 | ValueAbbrev, |
| 973 | 973 | ValueAbbrev, |
| 974 | 974 | .{ .fixed = @bitSizeOf(BinaryOpcode) }, |
| ... | ... | @@ -987,7 +987,7 @@ pub const ModuleBlock = struct { |
| 987 | 987 | pub const BinaryExact = struct { |
| 988 | 988 | const BinaryOpcode = Builder.BinaryOpcode; |
| 989 | 989 | pub const ops = [_]AbbrevOp{ |
| 990 | .{ .literal = @intFromEnum(ModuleBlock.FunctionBlock.Code.INST_BINOP) }, | |
| 990 | .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_BINOP) }, | |
| 991 | 991 | ValueAbbrev, |
| 992 | 992 | ValueAbbrev, |
| 993 | 993 | .{ .fixed = @bitSizeOf(BinaryOpcode) }, |
| ... | ... | @@ -1002,7 +1002,7 @@ pub const ModuleBlock = struct { |
| 1002 | 1002 | pub const BinaryFast = struct { |
| 1003 | 1003 | const BinaryOpcode = Builder.BinaryOpcode; |
| 1004 | 1004 | pub const ops = [_]AbbrevOp{ |
| 1005 | .{ .literal = @intFromEnum(ModuleBlock.FunctionBlock.Code.INST_BINOP) }, | |
| 1005 | .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_BINOP) }, | |
| 1006 | 1006 | ValueAbbrev, |
| 1007 | 1007 | ValueAbbrev, |
| 1008 | 1008 | .{ .fixed = @bitSizeOf(BinaryOpcode) }, |
| ... | ... | @@ -1018,7 +1018,7 @@ pub const ModuleBlock = struct { |
| 1018 | 1018 | pub const Cmp = struct { |
| 1019 | 1019 | const CmpPredicate = Builder.CmpPredicate; |
| 1020 | 1020 | pub const ops = [_]AbbrevOp{ |
| 1021 | .{ .literal = @intFromEnum(ModuleBlock.FunctionBlock.Code.INST_CMP2) }, | |
| 1021 | .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_CMP2) }, | |
| 1022 | 1022 | ValueAbbrev, |
| 1023 | 1023 | ValueAbbrev, |
| 1024 | 1024 | .{ .fixed = @bitSizeOf(CmpPredicate) }, |
| ... | ... | @@ -1032,7 +1032,7 @@ pub const ModuleBlock = struct { |
| 1032 | 1032 | pub const CmpFast = struct { |
| 1033 | 1033 | const CmpPredicate = Builder.CmpPredicate; |
| 1034 | 1034 | pub const ops = [_]AbbrevOp{ |
| 1035 | .{ .literal = @intFromEnum(ModuleBlock.FunctionBlock.Code.INST_CMP2) }, | |
| 1035 | .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_CMP2) }, | |
| 1036 | 1036 | ValueAbbrev, |
| 1037 | 1037 | ValueAbbrev, |
| 1038 | 1038 | .{ .fixed = @bitSizeOf(CmpPredicate) }, |
| ... | ... | @@ -1047,7 +1047,7 @@ pub const ModuleBlock = struct { |
| 1047 | 1047 | |
| 1048 | 1048 | pub const Select = struct { |
| 1049 | 1049 | pub const ops = [_]AbbrevOp{ |
| 1050 | .{ .literal = @intFromEnum(ModuleBlock.FunctionBlock.Code.INST_VSELECT) }, | |
| 1050 | .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_VSELECT) }, | |
| 1051 | 1051 | ValueAbbrev, |
| 1052 | 1052 | ValueAbbrev, |
| 1053 | 1053 | ValueAbbrev, |
| ... | ... | @@ -1060,7 +1060,7 @@ pub const ModuleBlock = struct { |
| 1060 | 1060 | |
| 1061 | 1061 | pub const SelectFast = struct { |
| 1062 | 1062 | pub const ops = [_]AbbrevOp{ |
| 1063 | .{ .literal = @intFromEnum(ModuleBlock.FunctionBlock.Code.INST_VSELECT) }, | |
| 1063 | .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_VSELECT) }, | |
| 1064 | 1064 | ValueAbbrev, |
| 1065 | 1065 | ValueAbbrev, |
| 1066 | 1066 | ValueAbbrev, |
| ... | ... | @@ -1076,7 +1076,7 @@ pub const ModuleBlock = struct { |
| 1076 | 1076 | pub const Cast = struct { |
| 1077 | 1077 | const CastOpcode = Builder.CastOpcode; |
| 1078 | 1078 | pub const ops = [_]AbbrevOp{ |
| 1079 | .{ .literal = @intFromEnum(ModuleBlock.FunctionBlock.Code.INST_CAST) }, | |
| 1079 | .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_CAST) }, | |
| 1080 | 1080 | ValueAbbrev, |
| 1081 | 1081 | .{ .fixed_runtime = Builder.Type }, |
| 1082 | 1082 | .{ .fixed = @bitSizeOf(CastOpcode) }, |
| ... | ... | @@ -1093,10 +1093,10 @@ pub const ModuleBlock = struct { |
| 1093 | 1093 | no_signed_wrap: bool, |
| 1094 | 1094 | }; |
| 1095 | 1095 | pub const ops = [_]AbbrevOp{ |
| 1096 | .{ .literal = @intFromEnum(ModuleBlock.FunctionBlock.Code.INST_CAST) }, | |
| 1096 | .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_CAST) }, | |
| 1097 | 1097 | ValueAbbrev, |
| 1098 | 1098 | .{ .fixed_runtime = Builder.Type }, |
| 1099 | .{ .literal = @intFromEnum(Builder.CastOpcode.trunc) }, | |
| 1099 | .{ .literal = @backingInt(Builder.CastOpcode.trunc) }, | |
| 1100 | 1100 | .{ .fixed = @bitSizeOf(Flags) }, |
| 1101 | 1101 | }; |
| 1102 | 1102 | |
| ... | ... | @@ -1114,7 +1114,7 @@ pub const ModuleBlock = struct { |
| 1114 | 1114 | align_upper: u3, |
| 1115 | 1115 | }; |
| 1116 | 1116 | pub const ops = [_]AbbrevOp{ |
| 1117 | .{ .literal = @intFromEnum(ModuleBlock.FunctionBlock.Code.INST_ALLOCA) }, | |
| 1117 | .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_ALLOCA) }, | |
| 1118 | 1118 | .{ .fixed_runtime = Builder.Type }, |
| 1119 | 1119 | .{ .fixed_runtime = Builder.Type }, |
| 1120 | 1120 | ValueAbbrev, |
| ... | ... | @@ -1129,13 +1129,13 @@ pub const ModuleBlock = struct { |
| 1129 | 1129 | |
| 1130 | 1130 | pub const RetVoid = struct { |
| 1131 | 1131 | pub const ops = [_]AbbrevOp{ |
| 1132 | .{ .literal = @intFromEnum(ModuleBlock.FunctionBlock.Code.INST_RET) }, | |
| 1132 | .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_RET) }, | |
| 1133 | 1133 | }; |
| 1134 | 1134 | }; |
| 1135 | 1135 | |
| 1136 | 1136 | pub const Ret = struct { |
| 1137 | 1137 | pub const ops = [_]AbbrevOp{ |
| 1138 | .{ .literal = @intFromEnum(ModuleBlock.FunctionBlock.Code.INST_RET) }, | |
| 1138 | .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_RET) }, | |
| 1139 | 1139 | ValueAbbrev, |
| 1140 | 1140 | }; |
| 1141 | 1141 | val: u32, |
| ... | ... | @@ -1143,7 +1143,7 @@ pub const ModuleBlock = struct { |
| 1143 | 1143 | |
| 1144 | 1144 | pub const GetElementPtr = struct { |
| 1145 | 1145 | pub const ops = [_]AbbrevOp{ |
| 1146 | .{ .literal = @intFromEnum(ModuleBlock.FunctionBlock.Code.INST_GEP) }, | |
| 1146 | .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_GEP) }, | |
| 1147 | 1147 | .{ .fixed = 1 }, |
| 1148 | 1148 | .{ .fixed_runtime = Builder.Type }, |
| 1149 | 1149 | ValueAbbrev, |
| ... | ... | @@ -1158,7 +1158,7 @@ pub const ModuleBlock = struct { |
| 1158 | 1158 | |
| 1159 | 1159 | pub const ExtractValue = struct { |
| 1160 | 1160 | pub const ops = [_]AbbrevOp{ |
| 1161 | .{ .literal = @intFromEnum(ModuleBlock.FunctionBlock.Code.INST_EXTRACTVAL) }, | |
| 1161 | .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_EXTRACTVAL) }, | |
| 1162 | 1162 | ValueAbbrev, |
| 1163 | 1163 | ValueArrayAbbrev, |
| 1164 | 1164 | }; |
| ... | ... | @@ -1169,7 +1169,7 @@ pub const ModuleBlock = struct { |
| 1169 | 1169 | |
| 1170 | 1170 | pub const InsertValue = struct { |
| 1171 | 1171 | pub const ops = [_]AbbrevOp{ |
| 1172 | .{ .literal = @intFromEnum(ModuleBlock.FunctionBlock.Code.INST_INSERTVAL) }, | |
| 1172 | .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_INSERTVAL) }, | |
| 1173 | 1173 | ValueAbbrev, |
| 1174 | 1174 | ValueAbbrev, |
| 1175 | 1175 | ValueArrayAbbrev, |
| ... | ... | @@ -1182,7 +1182,7 @@ pub const ModuleBlock = struct { |
| 1182 | 1182 | |
| 1183 | 1183 | pub const ExtractElement = struct { |
| 1184 | 1184 | pub const ops = [_]AbbrevOp{ |
| 1185 | .{ .literal = @intFromEnum(ModuleBlock.FunctionBlock.Code.INST_EXTRACTELT) }, | |
| 1185 | .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_EXTRACTELT) }, | |
| 1186 | 1186 | ValueAbbrev, |
| 1187 | 1187 | ValueAbbrev, |
| 1188 | 1188 | }; |
| ... | ... | @@ -1193,7 +1193,7 @@ pub const ModuleBlock = struct { |
| 1193 | 1193 | |
| 1194 | 1194 | pub const InsertElement = struct { |
| 1195 | 1195 | pub const ops = [_]AbbrevOp{ |
| 1196 | .{ .literal = @intFromEnum(ModuleBlock.FunctionBlock.Code.INST_INSERTELT) }, | |
| 1196 | .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_INSERTELT) }, | |
| 1197 | 1197 | ValueAbbrev, |
| 1198 | 1198 | ValueAbbrev, |
| 1199 | 1199 | ValueAbbrev, |
| ... | ... | @@ -1206,7 +1206,7 @@ pub const ModuleBlock = struct { |
| 1206 | 1206 | |
| 1207 | 1207 | pub const ShuffleVector = struct { |
| 1208 | 1208 | pub const ops = [_]AbbrevOp{ |
| 1209 | .{ .literal = @intFromEnum(ModuleBlock.FunctionBlock.Code.INST_SHUFFLEVEC) }, | |
| 1209 | .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_SHUFFLEVEC) }, | |
| 1210 | 1210 | ValueAbbrev, |
| 1211 | 1211 | ValueAbbrev, |
| 1212 | 1212 | ValueAbbrev, |
| ... | ... | @@ -1219,13 +1219,13 @@ pub const ModuleBlock = struct { |
| 1219 | 1219 | |
| 1220 | 1220 | pub const Unreachable = struct { |
| 1221 | 1221 | pub const ops = [_]AbbrevOp{ |
| 1222 | .{ .literal = @intFromEnum(ModuleBlock.FunctionBlock.Code.INST_UNREACHABLE) }, | |
| 1222 | .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_UNREACHABLE) }, | |
| 1223 | 1223 | }; |
| 1224 | 1224 | }; |
| 1225 | 1225 | |
| 1226 | 1226 | pub const Load = struct { |
| 1227 | 1227 | pub const ops = [_]AbbrevOp{ |
| 1228 | .{ .literal = @intFromEnum(ModuleBlock.FunctionBlock.Code.INST_LOAD) }, | |
| 1228 | .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_LOAD) }, | |
| 1229 | 1229 | ValueAbbrev, |
| 1230 | 1230 | .{ .fixed_runtime = Builder.Type }, |
| 1231 | 1231 | .{ .fixed = @bitSizeOf(Builder.Alignment) }, |
| ... | ... | @@ -1239,7 +1239,7 @@ pub const ModuleBlock = struct { |
| 1239 | 1239 | |
| 1240 | 1240 | pub const LoadAtomic = struct { |
| 1241 | 1241 | pub const ops = [_]AbbrevOp{ |
| 1242 | .{ .literal = @intFromEnum(ModuleBlock.FunctionBlock.Code.INST_LOADATOMIC) }, | |
| 1242 | .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_LOADATOMIC) }, | |
| 1243 | 1243 | ValueAbbrev, |
| 1244 | 1244 | .{ .fixed_runtime = Builder.Type }, |
| 1245 | 1245 | .{ .fixed = @bitSizeOf(Builder.Alignment) }, |
| ... | ... | @@ -1257,7 +1257,7 @@ pub const ModuleBlock = struct { |
| 1257 | 1257 | |
| 1258 | 1258 | pub const Store = struct { |
| 1259 | 1259 | pub const ops = [_]AbbrevOp{ |
| 1260 | .{ .literal = @intFromEnum(ModuleBlock.FunctionBlock.Code.INST_STORE) }, | |
| 1260 | .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_STORE) }, | |
| 1261 | 1261 | ValueAbbrev, |
| 1262 | 1262 | ValueAbbrev, |
| 1263 | 1263 | .{ .fixed = @bitSizeOf(Builder.Alignment) }, |
| ... | ... | @@ -1271,7 +1271,7 @@ pub const ModuleBlock = struct { |
| 1271 | 1271 | |
| 1272 | 1272 | pub const StoreAtomic = struct { |
| 1273 | 1273 | pub const ops = [_]AbbrevOp{ |
| 1274 | .{ .literal = @intFromEnum(ModuleBlock.FunctionBlock.Code.INST_STOREATOMIC) }, | |
| 1274 | .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_STOREATOMIC) }, | |
| 1275 | 1275 | ValueAbbrev, |
| 1276 | 1276 | ValueAbbrev, |
| 1277 | 1277 | .{ .fixed = @bitSizeOf(Builder.Alignment) }, |
| ... | ... | @@ -1289,7 +1289,7 @@ pub const ModuleBlock = struct { |
| 1289 | 1289 | |
| 1290 | 1290 | pub const BrUnconditional = struct { |
| 1291 | 1291 | pub const ops = [_]AbbrevOp{ |
| 1292 | .{ .literal = @intFromEnum(ModuleBlock.FunctionBlock.Code.INST_BR) }, | |
| 1292 | .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_BR) }, | |
| 1293 | 1293 | BlockAbbrev, |
| 1294 | 1294 | }; |
| 1295 | 1295 | block: u32, |
| ... | ... | @@ -1297,7 +1297,7 @@ pub const ModuleBlock = struct { |
| 1297 | 1297 | |
| 1298 | 1298 | pub const BrConditional = struct { |
| 1299 | 1299 | pub const ops = [_]AbbrevOp{ |
| 1300 | .{ .literal = @intFromEnum(ModuleBlock.FunctionBlock.Code.INST_BR) }, | |
| 1300 | .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_BR) }, | |
| 1301 | 1301 | BlockAbbrev, |
| 1302 | 1302 | BlockAbbrev, |
| 1303 | 1303 | BlockAbbrev, |
| ... | ... | @@ -1309,7 +1309,7 @@ pub const ModuleBlock = struct { |
| 1309 | 1309 | |
| 1310 | 1310 | pub const VaArg = struct { |
| 1311 | 1311 | pub const ops = [_]AbbrevOp{ |
| 1312 | .{ .literal = @intFromEnum(ModuleBlock.FunctionBlock.Code.INST_VAARG) }, | |
| 1312 | .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_VAARG) }, | |
| 1313 | 1313 | .{ .fixed_runtime = Builder.Type }, |
| 1314 | 1314 | ValueAbbrev, |
| 1315 | 1315 | .{ .fixed_runtime = Builder.Type }, |
| ... | ... | @@ -1321,7 +1321,7 @@ pub const ModuleBlock = struct { |
| 1321 | 1321 | |
| 1322 | 1322 | pub const AtomicRmw = struct { |
| 1323 | 1323 | pub const ops = [_]AbbrevOp{ |
| 1324 | .{ .literal = @intFromEnum(ModuleBlock.FunctionBlock.Code.INST_ATOMICRMW) }, | |
| 1324 | .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_ATOMICRMW) }, | |
| 1325 | 1325 | ValueAbbrev, |
| 1326 | 1326 | ValueAbbrev, |
| 1327 | 1327 | .{ .fixed = @bitSizeOf(Builder.Function.Instruction.AtomicRmw.Operation) }, |
| ... | ... | @@ -1341,7 +1341,7 @@ pub const ModuleBlock = struct { |
| 1341 | 1341 | |
| 1342 | 1342 | pub const CmpXchg = struct { |
| 1343 | 1343 | pub const ops = [_]AbbrevOp{ |
| 1344 | .{ .literal = @intFromEnum(ModuleBlock.FunctionBlock.Code.INST_CMPXCHG) }, | |
| 1344 | .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_CMPXCHG) }, | |
| 1345 | 1345 | ValueAbbrev, |
| 1346 | 1346 | ValueAbbrev, |
| 1347 | 1347 | ValueAbbrev, |
| ... | ... | @@ -1365,7 +1365,7 @@ pub const ModuleBlock = struct { |
| 1365 | 1365 | |
| 1366 | 1366 | pub const Fence = struct { |
| 1367 | 1367 | pub const ops = [_]AbbrevOp{ |
| 1368 | .{ .literal = @intFromEnum(ModuleBlock.FunctionBlock.Code.INST_FENCE) }, | |
| 1368 | .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_FENCE) }, | |
| 1369 | 1369 | .{ .fixed = @bitSizeOf(Builder.AtomicOrdering) }, |
| 1370 | 1370 | .{ .fixed = @bitSizeOf(Builder.SyncScope) }, |
| 1371 | 1371 | }; |
| ... | ... | @@ -1375,7 +1375,7 @@ pub const ModuleBlock = struct { |
| 1375 | 1375 | |
| 1376 | 1376 | pub const DebugLoc = struct { |
| 1377 | 1377 | pub const ops = [_]AbbrevOp{ |
| 1378 | .{ .literal = @intFromEnum(ModuleBlock.FunctionBlock.Code.DEBUG_LOC) }, | |
| 1378 | .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.DEBUG_LOC) }, | |
| 1379 | 1379 | LineAbbrev, |
| 1380 | 1380 | ColumnAbbrev, |
| 1381 | 1381 | MetadataAbbrev, |
| ... | ... | @@ -1390,20 +1390,20 @@ pub const ModuleBlock = struct { |
| 1390 | 1390 | |
| 1391 | 1391 | pub const DebugLocAgain = struct { |
| 1392 | 1392 | pub const ops = [_]AbbrevOp{ |
| 1393 | .{ .literal = @intFromEnum(ModuleBlock.FunctionBlock.Code.DEBUG_LOC_AGAIN) }, | |
| 1393 | .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.DEBUG_LOC_AGAIN) }, | |
| 1394 | 1394 | }; |
| 1395 | 1395 | }; |
| 1396 | 1396 | |
| 1397 | 1397 | pub const ColdOperandBundle = struct { |
| 1398 | 1398 | pub const ops = [_]AbbrevOp{ |
| 1399 | .{ .literal = @intFromEnum(ModuleBlock.FunctionBlock.Code.OPERAND_BUNDLE) }, | |
| 1399 | .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.OPERAND_BUNDLE) }, | |
| 1400 | 1400 | .{ .literal = 0 }, |
| 1401 | 1401 | }; |
| 1402 | 1402 | }; |
| 1403 | 1403 | |
| 1404 | 1404 | pub const IndirectBr = struct { |
| 1405 | 1405 | pub const ops = [_]AbbrevOp{ |
| 1406 | .{ .literal = @intFromEnum(ModuleBlock.FunctionBlock.Code.INST_INDIRECTBR) }, | |
| 1406 | .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_INDIRECTBR) }, | |
| 1407 | 1407 | .{ .fixed_runtime = Builder.Type }, |
| 1408 | 1408 | ValueAbbrev, |
| 1409 | 1409 | BlockArrayAbbrev, |
| ... | ... | @@ -1434,7 +1434,7 @@ pub const ModuleBlock = struct { |
| 1434 | 1434 | |
| 1435 | 1435 | pub const BlockEntry = struct { |
| 1436 | 1436 | pub const ops = [_]AbbrevOp{ |
| 1437 | .{ .literal = @intFromEnum(ModuleBlock.FunctionBlock.ValueSymtabBlock.Code.BBENTRY) }, | |
| 1437 | .{ .literal = @backingInt(ModuleBlock.FunctionBlock.ValueSymtabBlock.Code.BBENTRY) }, | |
| 1438 | 1438 | ValueAbbrev, |
| 1439 | 1439 | .{ .array_fixed = 8 }, |
| 1440 | 1440 | }; |
| ... | ... | @@ -1452,7 +1452,7 @@ pub const ModuleBlock = struct { |
| 1452 | 1452 | |
| 1453 | 1453 | pub const Value = struct { |
| 1454 | 1454 | pub const ops = [_]AbbrevOp{ |
| 1455 | .{ .literal = @intFromEnum(ModuleBlock.MetadataBlock.Code.VALUE) }, | |
| 1455 | .{ .literal = @backingInt(ModuleBlock.MetadataBlock.Code.VALUE) }, | |
| 1456 | 1456 | .{ .fixed = 32 }, // variable |
| 1457 | 1457 | .{ .fixed = 32 }, // expression |
| 1458 | 1458 | }; |
| ... | ... | @@ -1472,7 +1472,7 @@ pub const ModuleBlock = struct { |
| 1472 | 1472 | |
| 1473 | 1473 | pub const AttachmentGlobalSingle = struct { |
| 1474 | 1474 | pub const ops = [_]AbbrevOp{ |
| 1475 | .{ .literal = @intFromEnum(ModuleBlock.MetadataBlock.Code.ATTACHMENT) }, | |
| 1475 | .{ .literal = @backingInt(ModuleBlock.MetadataBlock.Code.ATTACHMENT) }, | |
| 1476 | 1476 | .{ .fixed = 1 }, |
| 1477 | 1477 | MetadataAbbrev, |
| 1478 | 1478 | }; |
| ... | ... | @@ -1482,7 +1482,7 @@ pub const ModuleBlock = struct { |
| 1482 | 1482 | |
| 1483 | 1483 | pub const AttachmentInstructionSingle = struct { |
| 1484 | 1484 | pub const ops = [_]AbbrevOp{ |
| 1485 | .{ .literal = @intFromEnum(ModuleBlock.MetadataBlock.Code.ATTACHMENT) }, | |
| 1485 | .{ .literal = @backingInt(ModuleBlock.MetadataBlock.Code.ATTACHMENT) }, | |
| 1486 | 1486 | ValueAbbrev, |
| 1487 | 1487 | .{ .fixed = 5 }, |
| 1488 | 1488 | MetadataAbbrev, |
| ... | ... | @@ -1617,7 +1617,7 @@ pub const ModuleBlock = struct { |
| 1617 | 1617 | |
| 1618 | 1618 | pub const Strings = struct { |
| 1619 | 1619 | pub const ops = [_]AbbrevOp{ |
| 1620 | .{ .literal = @intFromEnum(ModuleBlock.MetadataBlock.Code.STRINGS) }, | |
| 1620 | .{ .literal = @backingInt(ModuleBlock.MetadataBlock.Code.STRINGS) }, | |
| 1621 | 1621 | .{ .vbr = 6 }, |
| 1622 | 1622 | .{ .vbr = 6 }, |
| 1623 | 1623 | .blob, |
| ... | ... | @@ -1629,7 +1629,7 @@ pub const ModuleBlock = struct { |
| 1629 | 1629 | |
| 1630 | 1630 | pub const File = struct { |
| 1631 | 1631 | pub const ops = [_]AbbrevOp{ |
| 1632 | .{ .literal = @intFromEnum(ModuleBlock.MetadataBlock.Code.FILE) }, | |
| 1632 | .{ .literal = @backingInt(ModuleBlock.MetadataBlock.Code.FILE) }, | |
| 1633 | 1633 | .{ .literal = 0 }, // is distinct |
| 1634 | 1634 | MetadataAbbrev, // filename |
| 1635 | 1635 | MetadataAbbrev, // directory |
| ... | ... | @@ -1643,7 +1643,7 @@ pub const ModuleBlock = struct { |
| 1643 | 1643 | |
| 1644 | 1644 | pub const CompileUnit = struct { |
| 1645 | 1645 | pub const ops = [_]AbbrevOp{ |
| 1646 | .{ .literal = @intFromEnum(ModuleBlock.MetadataBlock.Code.COMPILE_UNIT) }, | |
| 1646 | .{ .literal = @backingInt(ModuleBlock.MetadataBlock.Code.COMPILE_UNIT) }, | |
| 1647 | 1647 | .{ .literal = 1 }, // is distinct |
| 1648 | 1648 | .{ .literal = std.dwarf.LANG.C99 }, // source language |
| 1649 | 1649 | MetadataAbbrev, // file |
| ... | ... | @@ -1677,7 +1677,7 @@ pub const ModuleBlock = struct { |
| 1677 | 1677 | |
| 1678 | 1678 | pub const Subprogram = struct { |
| 1679 | 1679 | pub const ops = [_]AbbrevOp{ |
| 1680 | .{ .literal = @intFromEnum(ModuleBlock.MetadataBlock.Code.SUBPROGRAM) }, | |
| 1680 | .{ .literal = @backingInt(ModuleBlock.MetadataBlock.Code.SUBPROGRAM) }, | |
| 1681 | 1681 | .{ .literal = 0b111 }, // is distinct | has sp flags | has flags |
| 1682 | 1682 | MetadataAbbrev, // scope |
| 1683 | 1683 | MetadataAbbrev, // name |
| ... | ... | @@ -1714,7 +1714,7 @@ pub const ModuleBlock = struct { |
| 1714 | 1714 | |
| 1715 | 1715 | pub const LexicalBlock = struct { |
| 1716 | 1716 | pub const ops = [_]AbbrevOp{ |
| 1717 | .{ .literal = @intFromEnum(ModuleBlock.MetadataBlock.Code.LEXICAL_BLOCK) }, | |
| 1717 | .{ .literal = @backingInt(ModuleBlock.MetadataBlock.Code.LEXICAL_BLOCK) }, | |
| 1718 | 1718 | .{ .literal = 0 }, // is distinct |
| 1719 | 1719 | MetadataAbbrev, // scope |
| 1720 | 1720 | MetadataAbbrev, // file |
| ... | ... | @@ -1730,7 +1730,7 @@ pub const ModuleBlock = struct { |
| 1730 | 1730 | |
| 1731 | 1731 | pub const Location = struct { |
| 1732 | 1732 | pub const ops = [_]AbbrevOp{ |
| 1733 | .{ .literal = @intFromEnum(ModuleBlock.MetadataBlock.Code.LOCATION) }, | |
| 1733 | .{ .literal = @backingInt(ModuleBlock.MetadataBlock.Code.LOCATION) }, | |
| 1734 | 1734 | .{ .literal = 0 }, // is distinct |
| 1735 | 1735 | LineAbbrev, // line |
| 1736 | 1736 | ColumnAbbrev, // column |
| ... | ... | @@ -1747,7 +1747,7 @@ pub const ModuleBlock = struct { |
| 1747 | 1747 | |
| 1748 | 1748 | pub const BasicType = struct { |
| 1749 | 1749 | pub const ops = [_]AbbrevOp{ |
| 1750 | .{ .literal = @intFromEnum(ModuleBlock.MetadataBlock.Code.BASIC_TYPE) }, | |
| 1750 | .{ .literal = @backingInt(ModuleBlock.MetadataBlock.Code.BASIC_TYPE) }, | |
| 1751 | 1751 | .{ .literal = 0 }, // is distinct |
| 1752 | 1752 | .{ .literal = std.dwarf.TAG.base_type }, // tag |
| 1753 | 1753 | MetadataAbbrev, // name |
| ... | ... | @@ -1764,7 +1764,7 @@ pub const ModuleBlock = struct { |
| 1764 | 1764 | |
| 1765 | 1765 | pub const CompositeType = struct { |
| 1766 | 1766 | pub const ops = [_]AbbrevOp{ |
| 1767 | .{ .literal = @intFromEnum(ModuleBlock.MetadataBlock.Code.COMPOSITE_TYPE) }, | |
| 1767 | .{ .literal = @backingInt(ModuleBlock.MetadataBlock.Code.COMPOSITE_TYPE) }, | |
| 1768 | 1768 | .{ .literal = 0 | 0x2 }, // is distinct | is not used in old type ref |
| 1769 | 1769 | .{ .fixed = 32 }, // tag |
| 1770 | 1770 | MetadataAbbrev, // name |
| ... | ... | @@ -1803,7 +1803,7 @@ pub const ModuleBlock = struct { |
| 1803 | 1803 | |
| 1804 | 1804 | pub const DerivedType = struct { |
| 1805 | 1805 | pub const ops = [_]AbbrevOp{ |
| 1806 | .{ .literal = @intFromEnum(ModuleBlock.MetadataBlock.Code.DERIVED_TYPE) }, | |
| 1806 | .{ .literal = @backingInt(ModuleBlock.MetadataBlock.Code.DERIVED_TYPE) }, | |
| 1807 | 1807 | .{ .literal = 0 }, // is distinct |
| 1808 | 1808 | .{ .fixed = 32 }, // tag |
| 1809 | 1809 | MetadataAbbrev, // name |
| ... | ... | @@ -1831,7 +1831,7 @@ pub const ModuleBlock = struct { |
| 1831 | 1831 | |
| 1832 | 1832 | pub const SubroutineType = struct { |
| 1833 | 1833 | pub const ops = [_]AbbrevOp{ |
| 1834 | .{ .literal = @intFromEnum(ModuleBlock.MetadataBlock.Code.SUBROUTINE_TYPE) }, | |
| 1834 | .{ .literal = @backingInt(ModuleBlock.MetadataBlock.Code.SUBROUTINE_TYPE) }, | |
| 1835 | 1835 | .{ .literal = 0 | 0x2 }, // is distinct | has no old type refs |
| 1836 | 1836 | .{ .literal = 0 }, // flags |
| 1837 | 1837 | MetadataAbbrev, // types |
| ... | ... | @@ -1849,7 +1849,7 @@ pub const ModuleBlock = struct { |
| 1849 | 1849 | }; |
| 1850 | 1850 | |
| 1851 | 1851 | pub const ops = [_]AbbrevOp{ |
| 1852 | .{ .literal = @intFromEnum(ModuleBlock.MetadataBlock.Code.ENUMERATOR) }, | |
| 1852 | .{ .literal = @backingInt(ModuleBlock.MetadataBlock.Code.ENUMERATOR) }, | |
| 1853 | 1853 | .{ .fixed = @bitSizeOf(Flags) }, // flags |
| 1854 | 1854 | .{ .vbr = 6 }, // bit width |
| 1855 | 1855 | MetadataAbbrev, // name |
| ... | ... | @@ -1864,7 +1864,7 @@ pub const ModuleBlock = struct { |
| 1864 | 1864 | |
| 1865 | 1865 | pub const Subrange = struct { |
| 1866 | 1866 | pub const ops = [_]AbbrevOp{ |
| 1867 | .{ .literal = @intFromEnum(ModuleBlock.MetadataBlock.Code.SUBRANGE) }, | |
| 1867 | .{ .literal = @backingInt(ModuleBlock.MetadataBlock.Code.SUBRANGE) }, | |
| 1868 | 1868 | .{ .literal = 0 | (2 << 1) }, // is distinct | version |
| 1869 | 1869 | MetadataAbbrev, // count |
| 1870 | 1870 | MetadataAbbrev, // lower bound |
| ... | ... | @@ -1878,7 +1878,7 @@ pub const ModuleBlock = struct { |
| 1878 | 1878 | |
| 1879 | 1879 | pub const Expression = struct { |
| 1880 | 1880 | pub const ops = [_]AbbrevOp{ |
| 1881 | .{ .literal = @intFromEnum(ModuleBlock.MetadataBlock.Code.EXPRESSION) }, | |
| 1881 | .{ .literal = @backingInt(ModuleBlock.MetadataBlock.Code.EXPRESSION) }, | |
| 1882 | 1882 | .{ .literal = 0 | (3 << 1) }, // is distinct | version |
| 1883 | 1883 | MetadataArrayAbbrev, // elements |
| 1884 | 1884 | }; |
| ... | ... | @@ -1888,7 +1888,7 @@ pub const ModuleBlock = struct { |
| 1888 | 1888 | |
| 1889 | 1889 | pub const Node = struct { |
| 1890 | 1890 | pub const ops = [_]AbbrevOp{ |
| 1891 | .{ .literal = @intFromEnum(ModuleBlock.MetadataBlock.Code.NODE) }, | |
| 1891 | .{ .literal = @backingInt(ModuleBlock.MetadataBlock.Code.NODE) }, | |
| 1892 | 1892 | MetadataArrayAbbrev, // elements |
| 1893 | 1893 | }; |
| 1894 | 1894 | |
| ... | ... | @@ -1897,7 +1897,7 @@ pub const ModuleBlock = struct { |
| 1897 | 1897 | |
| 1898 | 1898 | pub const LocalVar = struct { |
| 1899 | 1899 | pub const ops = [_]AbbrevOp{ |
| 1900 | .{ .literal = @intFromEnum(ModuleBlock.MetadataBlock.Code.LOCAL_VAR) }, | |
| 1900 | .{ .literal = @backingInt(ModuleBlock.MetadataBlock.Code.LOCAL_VAR) }, | |
| 1901 | 1901 | .{ .literal = 0b10 }, // is distinct | has alignment |
| 1902 | 1902 | MetadataAbbrev, // scope |
| 1903 | 1903 | MetadataAbbrev, // name |
| ... | ... | @@ -1919,7 +1919,7 @@ pub const ModuleBlock = struct { |
| 1919 | 1919 | |
| 1920 | 1920 | pub const Parameter = struct { |
| 1921 | 1921 | pub const ops = [_]AbbrevOp{ |
| 1922 | .{ .literal = @intFromEnum(ModuleBlock.MetadataBlock.Code.LOCAL_VAR) }, | |
| 1922 | .{ .literal = @backingInt(ModuleBlock.MetadataBlock.Code.LOCAL_VAR) }, | |
| 1923 | 1923 | .{ .literal = 0b10 }, // is distinct | has alignment |
| 1924 | 1924 | MetadataAbbrev, // scope |
| 1925 | 1925 | MetadataAbbrev, // name |
| ... | ... | @@ -1942,7 +1942,7 @@ pub const ModuleBlock = struct { |
| 1942 | 1942 | |
| 1943 | 1943 | pub const GlobalVar = struct { |
| 1944 | 1944 | pub const ops = [_]AbbrevOp{ |
| 1945 | .{ .literal = @intFromEnum(ModuleBlock.MetadataBlock.Code.GLOBAL_VAR) }, | |
| 1945 | .{ .literal = @backingInt(ModuleBlock.MetadataBlock.Code.GLOBAL_VAR) }, | |
| 1946 | 1946 | .{ .literal = 0b101 }, // is distinct | version |
| 1947 | 1947 | MetadataAbbrev, // scope |
| 1948 | 1948 | MetadataAbbrev, // name |
| ... | ... | @@ -1969,7 +1969,7 @@ pub const ModuleBlock = struct { |
| 1969 | 1969 | |
| 1970 | 1970 | pub const GlobalVarExpression = struct { |
| 1971 | 1971 | pub const ops = [_]AbbrevOp{ |
| 1972 | .{ .literal = @intFromEnum(ModuleBlock.MetadataBlock.Code.GLOBAL_VAR_EXPR) }, | |
| 1972 | .{ .literal = @backingInt(ModuleBlock.MetadataBlock.Code.GLOBAL_VAR_EXPR) }, | |
| 1973 | 1973 | .{ .literal = 0 }, // is distinct |
| 1974 | 1974 | MetadataAbbrev, // variable |
| 1975 | 1975 | MetadataAbbrev, // expression |
| ... | ... | @@ -1981,7 +1981,7 @@ pub const ModuleBlock = struct { |
| 1981 | 1981 | |
| 1982 | 1982 | pub const Constant = struct { |
| 1983 | 1983 | pub const ops = [_]AbbrevOp{ |
| 1984 | .{ .literal = @intFromEnum(ModuleBlock.MetadataBlock.Code.VALUE) }, | |
| 1984 | .{ .literal = @backingInt(ModuleBlock.MetadataBlock.Code.VALUE) }, | |
| 1985 | 1985 | MetadataAbbrev, // type |
| 1986 | 1986 | MetadataAbbrev, // value |
| 1987 | 1987 | }; |
| ... | ... | @@ -1992,7 +1992,7 @@ pub const ModuleBlock = struct { |
| 1992 | 1992 | |
| 1993 | 1993 | pub const Name = struct { |
| 1994 | 1994 | pub const ops = [_]AbbrevOp{ |
| 1995 | .{ .literal = @intFromEnum(ModuleBlock.MetadataBlock.Code.NAME) }, | |
| 1995 | .{ .literal = @backingInt(ModuleBlock.MetadataBlock.Code.NAME) }, | |
| 1996 | 1996 | .{ .array_fixed = 8 }, // name |
| 1997 | 1997 | }; |
| 1998 | 1998 | |
| ... | ... | @@ -2001,7 +2001,7 @@ pub const ModuleBlock = struct { |
| 2001 | 2001 | |
| 2002 | 2002 | pub const NamedNode = struct { |
| 2003 | 2003 | pub const ops = [_]AbbrevOp{ |
| 2004 | .{ .literal = @intFromEnum(ModuleBlock.MetadataBlock.Code.NAMED_NODE) }, | |
| 2004 | .{ .literal = @backingInt(ModuleBlock.MetadataBlock.Code.NAMED_NODE) }, | |
| 2005 | 2005 | MetadataArrayAbbrev, // elements |
| 2006 | 2006 | }; |
| 2007 | 2007 | |
| ... | ... | @@ -2010,7 +2010,7 @@ pub const ModuleBlock = struct { |
| 2010 | 2010 | |
| 2011 | 2011 | pub const GlobalDeclAttachment = struct { |
| 2012 | 2012 | pub const ops = [_]AbbrevOp{ |
| 2013 | .{ .literal = @intFromEnum(ModuleBlock.MetadataBlock.Code.GLOBAL_DECL_ATTACHMENT) }, | |
| 2013 | .{ .literal = @backingInt(ModuleBlock.MetadataBlock.Code.GLOBAL_DECL_ATTACHMENT) }, | |
| 2014 | 2014 | ValueAbbrev, // value id |
| 2015 | 2015 | .{ .fixed = 1 }, // kind |
| 2016 | 2016 | MetadataAbbrev, // elements |
| ... | ... | @@ -2115,7 +2115,7 @@ pub const ModuleBlock = struct { |
| 2115 | 2115 | |
| 2116 | 2116 | pub const NumEntry = struct { |
| 2117 | 2117 | pub const ops = [_]AbbrevOp{ |
| 2118 | .{ .literal = @intFromEnum(ModuleBlock.TypeBlock.Code.NUMENTRY) }, | |
| 2118 | .{ .literal = @backingInt(ModuleBlock.TypeBlock.Code.NUMENTRY) }, | |
| 2119 | 2119 | .{ .fixed = 32 }, |
| 2120 | 2120 | }; |
| 2121 | 2121 | num: u32, |
| ... | ... | @@ -2130,14 +2130,14 @@ pub const ModuleBlock = struct { |
| 2130 | 2130 | |
| 2131 | 2131 | pub const Opaque = struct { |
| 2132 | 2132 | pub const ops = [_]AbbrevOp{ |
| 2133 | .{ .literal = @intFromEnum(ModuleBlock.TypeBlock.Code.OPAQUE) }, | |
| 2133 | .{ .literal = @backingInt(ModuleBlock.TypeBlock.Code.OPAQUE) }, | |
| 2134 | 2134 | .{ .literal = 0 }, |
| 2135 | 2135 | }; |
| 2136 | 2136 | }; |
| 2137 | 2137 | |
| 2138 | 2138 | pub const Integer = struct { |
| 2139 | 2139 | pub const ops = [_]AbbrevOp{ |
| 2140 | .{ .literal = @intFromEnum(ModuleBlock.TypeBlock.Code.INTEGER) }, | |
| 2140 | .{ .literal = @backingInt(ModuleBlock.TypeBlock.Code.INTEGER) }, | |
| 2141 | 2141 | .{ .fixed = 28 }, |
| 2142 | 2142 | }; |
| 2143 | 2143 | width: u28, |
| ... | ... | @@ -2145,7 +2145,7 @@ pub const ModuleBlock = struct { |
| 2145 | 2145 | |
| 2146 | 2146 | pub const StructAnon = struct { |
| 2147 | 2147 | pub const ops = [_]AbbrevOp{ |
| 2148 | .{ .literal = @intFromEnum(ModuleBlock.TypeBlock.Code.STRUCT_ANON) }, | |
| 2148 | .{ .literal = @backingInt(ModuleBlock.TypeBlock.Code.STRUCT_ANON) }, | |
| 2149 | 2149 | .{ .fixed = 1 }, |
| 2150 | 2150 | .{ .array_fixed_runtime = Builder.Type }, |
| 2151 | 2151 | }; |
| ... | ... | @@ -2155,7 +2155,7 @@ pub const ModuleBlock = struct { |
| 2155 | 2155 | |
| 2156 | 2156 | pub const StructNamed = struct { |
| 2157 | 2157 | pub const ops = [_]AbbrevOp{ |
| 2158 | .{ .literal = @intFromEnum(ModuleBlock.TypeBlock.Code.STRUCT_NAMED) }, | |
| 2158 | .{ .literal = @backingInt(ModuleBlock.TypeBlock.Code.STRUCT_NAMED) }, | |
| 2159 | 2159 | .{ .fixed = 1 }, |
| 2160 | 2160 | .{ .array_fixed_runtime = Builder.Type }, |
| 2161 | 2161 | }; |
| ... | ... | @@ -2165,7 +2165,7 @@ pub const ModuleBlock = struct { |
| 2165 | 2165 | |
| 2166 | 2166 | pub const StructName = struct { |
| 2167 | 2167 | pub const ops = [_]AbbrevOp{ |
| 2168 | .{ .literal = @intFromEnum(ModuleBlock.TypeBlock.Code.STRUCT_NAME) }, | |
| 2168 | .{ .literal = @backingInt(ModuleBlock.TypeBlock.Code.STRUCT_NAME) }, | |
| 2169 | 2169 | .{ .array_fixed = 8 }, |
| 2170 | 2170 | }; |
| 2171 | 2171 | string: []const u8, |
| ... | ... | @@ -2173,7 +2173,7 @@ pub const ModuleBlock = struct { |
| 2173 | 2173 | |
| 2174 | 2174 | pub const Array = struct { |
| 2175 | 2175 | pub const ops = [_]AbbrevOp{ |
| 2176 | .{ .literal = @intFromEnum(ModuleBlock.TypeBlock.Code.ARRAY) }, | |
| 2176 | .{ .literal = @backingInt(ModuleBlock.TypeBlock.Code.ARRAY) }, | |
| 2177 | 2177 | .{ .vbr = 16 }, |
| 2178 | 2178 | .{ .fixed_runtime = Builder.Type }, |
| 2179 | 2179 | }; |
| ... | ... | @@ -2183,7 +2183,7 @@ pub const ModuleBlock = struct { |
| 2183 | 2183 | |
| 2184 | 2184 | pub const Vector = struct { |
| 2185 | 2185 | pub const ops = [_]AbbrevOp{ |
| 2186 | .{ .literal = @intFromEnum(ModuleBlock.TypeBlock.Code.VECTOR) }, | |
| 2186 | .{ .literal = @backingInt(ModuleBlock.TypeBlock.Code.VECTOR) }, | |
| 2187 | 2187 | .{ .vbr = 16 }, |
| 2188 | 2188 | .{ .fixed_runtime = Builder.Type }, |
| 2189 | 2189 | }; |
| ... | ... | @@ -2193,7 +2193,7 @@ pub const ModuleBlock = struct { |
| 2193 | 2193 | |
| 2194 | 2194 | pub const Pointer = struct { |
| 2195 | 2195 | pub const ops = [_]AbbrevOp{ |
| 2196 | .{ .literal = @intFromEnum(ModuleBlock.TypeBlock.Code.OPAQUE_POINTER) }, | |
| 2196 | .{ .literal = @backingInt(ModuleBlock.TypeBlock.Code.OPAQUE_POINTER) }, | |
| 2197 | 2197 | .{ .vbr = 4 }, |
| 2198 | 2198 | }; |
| 2199 | 2199 | addr_space: Builder.AddrSpace, |
| ... | ... | @@ -2201,7 +2201,7 @@ pub const ModuleBlock = struct { |
| 2201 | 2201 | |
| 2202 | 2202 | pub const Target = struct { |
| 2203 | 2203 | pub const ops = [_]AbbrevOp{ |
| 2204 | .{ .literal = @intFromEnum(ModuleBlock.TypeBlock.Code.TARGET_TYPE) }, | |
| 2204 | .{ .literal = @backingInt(ModuleBlock.TypeBlock.Code.TARGET_TYPE) }, | |
| 2205 | 2205 | .{ .vbr = 4 }, |
| 2206 | 2206 | .{ .array_fixed_runtime = Builder.Type }, |
| 2207 | 2207 | .{ .array_fixed = 32 }, |
| ... | ... | @@ -2213,7 +2213,7 @@ pub const ModuleBlock = struct { |
| 2213 | 2213 | |
| 2214 | 2214 | pub const Function = struct { |
| 2215 | 2215 | pub const ops = [_]AbbrevOp{ |
| 2216 | .{ .literal = @intFromEnum(ModuleBlock.TypeBlock.Code.FUNCTION) }, | |
| 2216 | .{ .literal = @backingInt(ModuleBlock.TypeBlock.Code.FUNCTION) }, | |
| 2217 | 2217 | .{ .fixed = 1 }, |
| 2218 | 2218 | .{ .fixed_runtime = Builder.Type }, |
| 2219 | 2219 | .{ .array_fixed_runtime = Builder.Type }, |
| ... | ... | @@ -2238,7 +2238,7 @@ pub const ModuleBlock = struct { |
| 2238 | 2238 | |
| 2239 | 2239 | pub const OperandBundleTag = struct { |
| 2240 | 2240 | pub const ops = [_]AbbrevOp{ |
| 2241 | .{ .literal = @intFromEnum(ModuleBlock.OperandBundleTagsBlock.Code.OPERAND_BUNDLE_TAG) }, | |
| 2241 | .{ .literal = @backingInt(ModuleBlock.OperandBundleTagsBlock.Code.OPERAND_BUNDLE_TAG) }, | |
| 2242 | 2242 | .array_char6, |
| 2243 | 2243 | }; |
| 2244 | 2244 | tag: []const u8, |
| ... | ... | @@ -2254,7 +2254,7 @@ pub const ModuleBlock = struct { |
| 2254 | 2254 | |
| 2255 | 2255 | pub const Kind = struct { |
| 2256 | 2256 | pub const ops = [_]AbbrevOp{ |
| 2257 | .{ .literal = @intFromEnum(ModuleBlock.MetadataBlock.Code.KIND) }, | |
| 2257 | .{ .literal = @backingInt(ModuleBlock.MetadataBlock.Code.KIND) }, | |
| 2258 | 2258 | .{ .vbr = 4 }, |
| 2259 | 2259 | .{ .array_fixed = 8 }, |
| 2260 | 2260 | }; |
| ... | ... | @@ -2283,7 +2283,7 @@ pub const IdentificationBlock = struct { |
| 2283 | 2283 | |
| 2284 | 2284 | pub const Version = struct { |
| 2285 | 2285 | pub const ops = [_]AbbrevOp{ |
| 2286 | .{ .literal = @intFromEnum(IdentificationBlock.Code.STRING) }, | |
| 2286 | .{ .literal = @backingInt(IdentificationBlock.Code.STRING) }, | |
| 2287 | 2287 | .{ .array_fixed = 8 }, |
| 2288 | 2288 | }; |
| 2289 | 2289 | string: []const u8, |
| ... | ... | @@ -2291,7 +2291,7 @@ pub const IdentificationBlock = struct { |
| 2291 | 2291 | |
| 2292 | 2292 | pub const Epoch = struct { |
| 2293 | 2293 | pub const ops = [_]AbbrevOp{ |
| 2294 | .{ .literal = @intFromEnum(IdentificationBlock.Code.EPOCH) }, | |
| 2294 | .{ .literal = @backingInt(IdentificationBlock.Code.EPOCH) }, | |
| 2295 | 2295 | .{ .vbr = 6 }, |
| 2296 | 2296 | }; |
| 2297 | 2297 | epoch: u32, |
| ... | ... | @@ -2309,7 +2309,7 @@ pub const StrtabBlock = struct { |
| 2309 | 2309 | |
| 2310 | 2310 | pub const Blob = struct { |
| 2311 | 2311 | pub const ops = [_]AbbrevOp{ |
| 2312 | .{ .literal = @intFromEnum(StrtabBlock.Code.BLOB) }, | |
| 2312 | .{ .literal = @backingInt(StrtabBlock.Code.BLOB) }, | |
| 2313 | 2313 | .blob, |
| 2314 | 2314 | }; |
| 2315 | 2315 | blob: []const u8, |
lib/std/zig/number_literal.zig+3-3| ... | ... | @@ -147,7 +147,7 @@ pub fn parseNumberLiteral(bytes: []const u8) Result { |
| 147 | 147 | 'a'...'z' => c - 'a' + 10, |
| 148 | 148 | else => return .{ .failure = .{ .invalid_character = i } }, |
| 149 | 149 | }; |
| 150 | if (digit >= base) return .{ .failure = .{ .invalid_digit = .{ .i = i, .base = @as(Base, @enumFromInt(base)) } } }; | |
| 150 | if (digit >= base) return .{ .failure = .{ .invalid_digit = .{ .i = i, .base = @as(Base, @fromBackingInt(@intCast(base))) } } }; | |
| 151 | 151 | if (exponent and digit >= 10) return .{ .failure = .{ .invalid_digit_exponent = i } }; |
| 152 | 152 | underscore = false; |
| 153 | 153 | special = 0; |
| ... | ... | @@ -165,8 +165,8 @@ pub fn parseNumberLiteral(bytes: []const u8) Result { |
| 165 | 165 | if (underscore) return .{ .failure = .{ .trailing_underscore = bytes.len - 1 } }; |
| 166 | 166 | if (special != 0) return .{ .failure = .{ .trailing_special = bytes.len - 1 } }; |
| 167 | 167 | |
| 168 | if (float) return .{ .float = @as(FloatBase, @enumFromInt(base)) }; | |
| 169 | if (overflow) return .{ .big_int = @as(Base, @enumFromInt(base)) }; | |
| 168 | if (float) return .{ .float = @as(FloatBase, @fromBackingInt(@intCast(base))) }; | |
| 169 | if (overflow) return .{ .big_int = @as(Base, @fromBackingInt(@intCast(base))) }; | |
| 170 | 170 | return .{ .int = x }; |
| 171 | 171 | } |
| 172 | 172 |
lib/std/zig/parser_generated_oracle.zig+272-272| ... | ... | @@ -292,7 +292,7 @@ const Parser = struct { |
| 292 | 292 | i: usize, |
| 293 | 293 | depths: [272]u8, |
| 294 | 294 | pub fn parseRoot(p: *Parser) Error!bool { |
| 295 | const def_index = @intFromEnum(Def.defRoot); | |
| 295 | const def_index = @backingInt(Def.defRoot); | |
| 296 | 296 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 297 | 297 | p.depths[def_index] += 1; |
| 298 | 298 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -304,7 +304,7 @@ const Parser = struct { |
| 304 | 304 | }; |
| 305 | 305 | } |
| 306 | 306 | pub fn parseContainerMembers(p: *Parser) Error!bool { |
| 307 | const def_index = @intFromEnum(Def.defContainerMembers); | |
| 307 | const def_index = @backingInt(Def.defContainerMembers); | |
| 308 | 308 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 309 | 309 | p.depths[def_index] += 1; |
| 310 | 310 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -323,7 +323,7 @@ const Parser = struct { |
| 323 | 323 | }; |
| 324 | 324 | } |
| 325 | 325 | pub fn parseContainerMembersRest(p: *Parser) Error!bool { |
| 326 | const def_index = @intFromEnum(Def.defContainerMembersRest); | |
| 326 | const def_index = @backingInt(Def.defContainerMembersRest); | |
| 327 | 327 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 328 | 328 | p.depths[def_index] += 1; |
| 329 | 329 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -354,7 +354,7 @@ const Parser = struct { |
| 354 | 354 | }; |
| 355 | 355 | } |
| 356 | 356 | pub fn parseContainerDecl(p: *Parser) Error!bool { |
| 357 | const def_index = @intFromEnum(Def.defContainerDecl); | |
| 357 | const def_index = @backingInt(Def.defContainerDecl); | |
| 358 | 358 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 359 | 359 | p.depths[def_index] += 1; |
| 360 | 360 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -370,7 +370,7 @@ const Parser = struct { |
| 370 | 370 | }; |
| 371 | 371 | } |
| 372 | 372 | pub fn parseContainerDeclPrefix(p: *Parser) Error!bool { |
| 373 | const def_index = @intFromEnum(Def.defContainerDeclPrefix); | |
| 373 | const def_index = @backingInt(Def.defContainerDeclPrefix); | |
| 374 | 374 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 375 | 375 | p.depths[def_index] += 1; |
| 376 | 376 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -386,7 +386,7 @@ const Parser = struct { |
| 386 | 386 | }; |
| 387 | 387 | } |
| 388 | 388 | pub fn parseTestDecl(p: *Parser) Error!bool { |
| 389 | const def_index = @intFromEnum(Def.defTestDecl); | |
| 389 | const def_index = @backingInt(Def.defTestDecl); | |
| 390 | 390 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 391 | 391 | p.depths[def_index] += 1; |
| 392 | 392 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -405,7 +405,7 @@ const Parser = struct { |
| 405 | 405 | }; |
| 406 | 406 | } |
| 407 | 407 | pub fn parseComptimeDecl(p: *Parser) Error!bool { |
| 408 | const def_index = @intFromEnum(Def.defComptimeDecl); | |
| 408 | const def_index = @backingInt(Def.defComptimeDecl); | |
| 409 | 409 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 410 | 410 | p.depths[def_index] += 1; |
| 411 | 411 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -417,7 +417,7 @@ const Parser = struct { |
| 417 | 417 | }; |
| 418 | 418 | } |
| 419 | 419 | pub fn parseDecl(p: *Parser) Error!bool { |
| 420 | const def_index = @intFromEnum(Def.defDecl); | |
| 420 | const def_index = @backingInt(Def.defDecl); | |
| 421 | 421 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 422 | 422 | p.depths[def_index] += 1; |
| 423 | 423 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -456,7 +456,7 @@ const Parser = struct { |
| 456 | 456 | }; |
| 457 | 457 | } |
| 458 | 458 | pub fn parseDeclPrefix(p: *Parser) Error!bool { |
| 459 | const def_index = @intFromEnum(Def.defDeclPrefix); | |
| 459 | const def_index = @backingInt(Def.defDeclPrefix); | |
| 460 | 460 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 461 | 461 | p.depths[def_index] += 1; |
| 462 | 462 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -495,7 +495,7 @@ const Parser = struct { |
| 495 | 495 | }; |
| 496 | 496 | } |
| 497 | 497 | pub fn parseFnProto(p: *Parser) Error!bool { |
| 498 | const def_index = @intFromEnum(Def.defFnProto); | |
| 498 | const def_index = @backingInt(Def.defFnProto); | |
| 499 | 499 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 500 | 500 | p.depths[def_index] += 1; |
| 501 | 501 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -507,7 +507,7 @@ const Parser = struct { |
| 507 | 507 | }; |
| 508 | 508 | } |
| 509 | 509 | pub fn parseVarDeclProto(p: *Parser) Error!bool { |
| 510 | const def_index = @intFromEnum(Def.defVarDeclProto); | |
| 510 | const def_index = @backingInt(Def.defVarDeclProto); | |
| 511 | 511 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 512 | 512 | p.depths[def_index] += 1; |
| 513 | 513 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -531,7 +531,7 @@ const Parser = struct { |
| 531 | 531 | }; |
| 532 | 532 | } |
| 533 | 533 | pub fn parseGlobalVarDecl(p: *Parser) Error!bool { |
| 534 | const def_index = @intFromEnum(Def.defGlobalVarDecl); | |
| 534 | const def_index = @backingInt(Def.defGlobalVarDecl); | |
| 535 | 535 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 536 | 536 | p.depths[def_index] += 1; |
| 537 | 537 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -548,7 +548,7 @@ const Parser = struct { |
| 548 | 548 | }; |
| 549 | 549 | } |
| 550 | 550 | pub fn parseContainerField(p: *Parser) Error!bool { |
| 551 | const def_index = @intFromEnum(Def.defContainerField); | |
| 551 | const def_index = @backingInt(Def.defContainerField); | |
| 552 | 552 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 553 | 553 | p.depths[def_index] += 1; |
| 554 | 554 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -570,7 +570,7 @@ const Parser = struct { |
| 570 | 570 | }; |
| 571 | 571 | } |
| 572 | 572 | pub fn parseBlockStatement(p: *Parser) Error!bool { |
| 573 | const def_index = @intFromEnum(Def.defBlockStatement); | |
| 573 | const def_index = @backingInt(Def.defBlockStatement); | |
| 574 | 574 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 575 | 575 | p.depths[def_index] += 1; |
| 576 | 576 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -593,7 +593,7 @@ const Parser = struct { |
| 593 | 593 | }; |
| 594 | 594 | } |
| 595 | 595 | pub fn parseStatement(p: *Parser) Error!bool { |
| 596 | const def_index = @intFromEnum(Def.defStatement); | |
| 596 | const def_index = @backingInt(Def.defStatement); | |
| 597 | 597 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 598 | 598 | p.depths[def_index] += 1; |
| 599 | 599 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -620,7 +620,7 @@ const Parser = struct { |
| 620 | 620 | }; |
| 621 | 621 | } |
| 622 | 622 | pub fn parseStatementPrefix(p: *Parser) Error!bool { |
| 623 | const def_index = @intFromEnum(Def.defStatementPrefix); | |
| 623 | const def_index = @backingInt(Def.defStatementPrefix); | |
| 624 | 624 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 625 | 625 | p.depths[def_index] += 1; |
| 626 | 626 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -654,7 +654,7 @@ const Parser = struct { |
| 654 | 654 | }; |
| 655 | 655 | } |
| 656 | 656 | pub fn parseIfStatement(p: *Parser) Error!bool { |
| 657 | const def_index = @intFromEnum(Def.defIfStatement); | |
| 657 | const def_index = @backingInt(Def.defIfStatement); | |
| 658 | 658 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 659 | 659 | p.depths[def_index] += 1; |
| 660 | 660 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -692,7 +692,7 @@ const Parser = struct { |
| 692 | 692 | }; |
| 693 | 693 | } |
| 694 | 694 | pub fn parseLabeledStatement(p: *Parser) Error!bool { |
| 695 | const def_index = @intFromEnum(Def.defLabeledStatement); | |
| 695 | const def_index = @backingInt(Def.defLabeledStatement); | |
| 696 | 696 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 697 | 697 | p.depths[def_index] += 1; |
| 698 | 698 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -713,7 +713,7 @@ const Parser = struct { |
| 713 | 713 | }; |
| 714 | 714 | } |
| 715 | 715 | pub fn parseLoopStatement(p: *Parser) Error!bool { |
| 716 | const def_index = @intFromEnum(Def.defLoopStatement); | |
| 716 | const def_index = @backingInt(Def.defLoopStatement); | |
| 717 | 717 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 718 | 718 | p.depths[def_index] += 1; |
| 719 | 719 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -732,7 +732,7 @@ const Parser = struct { |
| 732 | 732 | }; |
| 733 | 733 | } |
| 734 | 734 | pub fn parseForStatement(p: *Parser) Error!bool { |
| 735 | const def_index = @intFromEnum(Def.defForStatement); | |
| 735 | const def_index = @backingInt(Def.defForStatement); | |
| 736 | 736 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 737 | 737 | p.depths[def_index] += 1; |
| 738 | 738 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -770,7 +770,7 @@ const Parser = struct { |
| 770 | 770 | }; |
| 771 | 771 | } |
| 772 | 772 | pub fn parseWhileStatement(p: *Parser) Error!bool { |
| 773 | const def_index = @intFromEnum(Def.defWhileStatement); | |
| 773 | const def_index = @backingInt(Def.defWhileStatement); | |
| 774 | 774 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 775 | 775 | p.depths[def_index] += 1; |
| 776 | 776 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -808,7 +808,7 @@ const Parser = struct { |
| 808 | 808 | }; |
| 809 | 809 | } |
| 810 | 810 | pub fn parseBlockExprStatement(p: *Parser) Error!bool { |
| 811 | const def_index = @intFromEnum(Def.defBlockExprStatement); | |
| 811 | const def_index = @backingInt(Def.defBlockExprStatement); | |
| 812 | 812 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 813 | 813 | p.depths[def_index] += 1; |
| 814 | 814 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -827,7 +827,7 @@ const Parser = struct { |
| 827 | 827 | }; |
| 828 | 828 | } |
| 829 | 829 | pub fn parseBlockExprPrefix(p: *Parser) Error!bool { |
| 830 | const def_index = @intFromEnum(Def.defBlockExprPrefix); | |
| 830 | const def_index = @backingInt(Def.defBlockExprPrefix); | |
| 831 | 831 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 832 | 832 | p.depths[def_index] += 1; |
| 833 | 833 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -839,7 +839,7 @@ const Parser = struct { |
| 839 | 839 | }; |
| 840 | 840 | } |
| 841 | 841 | pub fn parseBlockExpr(p: *Parser) Error!bool { |
| 842 | const def_index = @intFromEnum(Def.defBlockExpr); | |
| 842 | const def_index = @backingInt(Def.defBlockExpr); | |
| 843 | 843 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 844 | 844 | p.depths[def_index] += 1; |
| 845 | 845 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -851,7 +851,7 @@ const Parser = struct { |
| 851 | 851 | }; |
| 852 | 852 | } |
| 853 | 853 | pub fn parseVarAssignStatement(p: *Parser) Error!bool { |
| 854 | const def_index = @intFromEnum(Def.defVarAssignStatement); | |
| 854 | const def_index = @backingInt(Def.defVarAssignStatement); | |
| 855 | 855 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 856 | 856 | p.depths[def_index] += 1; |
| 857 | 857 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -889,7 +889,7 @@ const Parser = struct { |
| 889 | 889 | }; |
| 890 | 890 | } |
| 891 | 891 | pub fn parseAssignExpr(p: *Parser) Error!bool { |
| 892 | const def_index = @intFromEnum(Def.defAssignExpr); | |
| 892 | const def_index = @backingInt(Def.defAssignExpr); | |
| 893 | 893 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 894 | 894 | p.depths[def_index] += 1; |
| 895 | 895 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -934,7 +934,7 @@ const Parser = struct { |
| 934 | 934 | }; |
| 935 | 935 | } |
| 936 | 936 | pub fn parseSingleAssignExpr(p: *Parser) Error!bool { |
| 937 | const def_index = @intFromEnum(Def.defSingleAssignExpr); | |
| 937 | const def_index = @backingInt(Def.defSingleAssignExpr); | |
| 938 | 938 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 939 | 939 | p.depths[def_index] += 1; |
| 940 | 940 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -958,7 +958,7 @@ const Parser = struct { |
| 958 | 958 | }; |
| 959 | 959 | } |
| 960 | 960 | pub fn parseExpr(p: *Parser) Error!bool { |
| 961 | const def_index = @intFromEnum(Def.defExpr); | |
| 961 | const def_index = @backingInt(Def.defExpr); | |
| 962 | 962 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 963 | 963 | p.depths[def_index] += 1; |
| 964 | 964 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -970,7 +970,7 @@ const Parser = struct { |
| 970 | 970 | }; |
| 971 | 971 | } |
| 972 | 972 | pub fn parseBoolOrExpr(p: *Parser) Error!bool { |
| 973 | const def_index = @intFromEnum(Def.defBoolOrExpr); | |
| 973 | const def_index = @backingInt(Def.defBoolOrExpr); | |
| 974 | 974 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 975 | 975 | p.depths[def_index] += 1; |
| 976 | 976 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -999,7 +999,7 @@ const Parser = struct { |
| 999 | 999 | }; |
| 1000 | 1000 | } |
| 1001 | 1001 | pub fn parseBoolAndExpr(p: *Parser) Error!bool { |
| 1002 | const def_index = @intFromEnum(Def.defBoolAndExpr); | |
| 1002 | const def_index = @backingInt(Def.defBoolAndExpr); | |
| 1003 | 1003 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1004 | 1004 | p.depths[def_index] += 1; |
| 1005 | 1005 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -1028,7 +1028,7 @@ const Parser = struct { |
| 1028 | 1028 | }; |
| 1029 | 1029 | } |
| 1030 | 1030 | pub fn parseCompareExpr(p: *Parser) Error!bool { |
| 1031 | const def_index = @intFromEnum(Def.defCompareExpr); | |
| 1031 | const def_index = @backingInt(Def.defCompareExpr); | |
| 1032 | 1032 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1033 | 1033 | p.depths[def_index] += 1; |
| 1034 | 1034 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -1050,7 +1050,7 @@ const Parser = struct { |
| 1050 | 1050 | }; |
| 1051 | 1051 | } |
| 1052 | 1052 | pub fn parseBitwiseExpr(p: *Parser) Error!bool { |
| 1053 | const def_index = @intFromEnum(Def.defBitwiseExpr); | |
| 1053 | const def_index = @backingInt(Def.defBitwiseExpr); | |
| 1054 | 1054 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1055 | 1055 | p.depths[def_index] += 1; |
| 1056 | 1056 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -1079,7 +1079,7 @@ const Parser = struct { |
| 1079 | 1079 | }; |
| 1080 | 1080 | } |
| 1081 | 1081 | pub fn parseBitShiftExpr(p: *Parser) Error!bool { |
| 1082 | const def_index = @intFromEnum(Def.defBitShiftExpr); | |
| 1082 | const def_index = @backingInt(Def.defBitShiftExpr); | |
| 1083 | 1083 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1084 | 1084 | p.depths[def_index] += 1; |
| 1085 | 1085 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -1108,7 +1108,7 @@ const Parser = struct { |
| 1108 | 1108 | }; |
| 1109 | 1109 | } |
| 1110 | 1110 | pub fn parseAdditionExpr(p: *Parser) Error!bool { |
| 1111 | const def_index = @intFromEnum(Def.defAdditionExpr); | |
| 1111 | const def_index = @backingInt(Def.defAdditionExpr); | |
| 1112 | 1112 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1113 | 1113 | p.depths[def_index] += 1; |
| 1114 | 1114 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -1137,7 +1137,7 @@ const Parser = struct { |
| 1137 | 1137 | }; |
| 1138 | 1138 | } |
| 1139 | 1139 | pub fn parseMultiplyExpr(p: *Parser) Error!bool { |
| 1140 | const def_index = @intFromEnum(Def.defMultiplyExpr); | |
| 1140 | const def_index = @backingInt(Def.defMultiplyExpr); | |
| 1141 | 1141 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1142 | 1142 | p.depths[def_index] += 1; |
| 1143 | 1143 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -1166,7 +1166,7 @@ const Parser = struct { |
| 1166 | 1166 | }; |
| 1167 | 1167 | } |
| 1168 | 1168 | pub fn parsePrefixExpr(p: *Parser) Error!bool { |
| 1169 | const def_index = @intFromEnum(Def.defPrefixExpr); | |
| 1169 | const def_index = @backingInt(Def.defPrefixExpr); | |
| 1170 | 1170 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1171 | 1171 | p.depths[def_index] += 1; |
| 1172 | 1172 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -1190,7 +1190,7 @@ const Parser = struct { |
| 1190 | 1190 | }; |
| 1191 | 1191 | } |
| 1192 | 1192 | pub fn parsePrimaryExpr(p: *Parser) Error!bool { |
| 1193 | const def_index = @intFromEnum(Def.defPrimaryExpr); | |
| 1193 | const def_index = @backingInt(Def.defPrimaryExpr); | |
| 1194 | 1194 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1195 | 1195 | p.depths[def_index] += 1; |
| 1196 | 1196 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -1258,7 +1258,7 @@ const Parser = struct { |
| 1258 | 1258 | }; |
| 1259 | 1259 | } |
| 1260 | 1260 | pub fn parseIfExpr(p: *Parser) Error!bool { |
| 1261 | const def_index = @intFromEnum(Def.defIfExpr); | |
| 1261 | const def_index = @backingInt(Def.defIfExpr); | |
| 1262 | 1262 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1263 | 1263 | p.depths[def_index] += 1; |
| 1264 | 1264 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -1282,7 +1282,7 @@ const Parser = struct { |
| 1282 | 1282 | }; |
| 1283 | 1283 | } |
| 1284 | 1284 | pub fn parseBlock(p: *Parser) Error!bool { |
| 1285 | const def_index = @intFromEnum(Def.defBlock); | |
| 1285 | const def_index = @backingInt(Def.defBlock); | |
| 1286 | 1286 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1287 | 1287 | p.depths[def_index] += 1; |
| 1288 | 1288 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -1301,7 +1301,7 @@ const Parser = struct { |
| 1301 | 1301 | }; |
| 1302 | 1302 | } |
| 1303 | 1303 | pub fn parseLoopExpr(p: *Parser) Error!bool { |
| 1304 | const def_index = @intFromEnum(Def.defLoopExpr); | |
| 1304 | const def_index = @backingInt(Def.defLoopExpr); | |
| 1305 | 1305 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1306 | 1306 | p.depths[def_index] += 1; |
| 1307 | 1307 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -1320,7 +1320,7 @@ const Parser = struct { |
| 1320 | 1320 | }; |
| 1321 | 1321 | } |
| 1322 | 1322 | pub fn parseForExpr(p: *Parser) Error!bool { |
| 1323 | const def_index = @intFromEnum(Def.defForExpr); | |
| 1323 | const def_index = @backingInt(Def.defForExpr); | |
| 1324 | 1324 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1325 | 1325 | p.depths[def_index] += 1; |
| 1326 | 1326 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -1344,7 +1344,7 @@ const Parser = struct { |
| 1344 | 1344 | }; |
| 1345 | 1345 | } |
| 1346 | 1346 | pub fn parseWhileExpr(p: *Parser) Error!bool { |
| 1347 | const def_index = @intFromEnum(Def.defWhileExpr); | |
| 1347 | const def_index = @backingInt(Def.defWhileExpr); | |
| 1348 | 1348 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1349 | 1349 | p.depths[def_index] += 1; |
| 1350 | 1350 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -1361,7 +1361,7 @@ const Parser = struct { |
| 1361 | 1361 | }; |
| 1362 | 1362 | } |
| 1363 | 1363 | pub fn parseCurlySuffixExpr(p: *Parser) Error!bool { |
| 1364 | const def_index = @intFromEnum(Def.defCurlySuffixExpr); | |
| 1364 | const def_index = @backingInt(Def.defCurlySuffixExpr); | |
| 1365 | 1365 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1366 | 1366 | p.depths[def_index] += 1; |
| 1367 | 1367 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -1385,7 +1385,7 @@ const Parser = struct { |
| 1385 | 1385 | }; |
| 1386 | 1386 | } |
| 1387 | 1387 | pub fn parseInitList(p: *Parser) Error!bool { |
| 1388 | const def_index = @intFromEnum(Def.defInitList); | |
| 1388 | const def_index = @backingInt(Def.defInitList); | |
| 1389 | 1389 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1390 | 1390 | p.depths[def_index] += 1; |
| 1391 | 1391 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -1425,7 +1425,7 @@ const Parser = struct { |
| 1425 | 1425 | }; |
| 1426 | 1426 | } |
| 1427 | 1427 | pub fn parseTypeExpr(p: *Parser) Error!bool { |
| 1428 | const def_index = @intFromEnum(Def.defTypeExpr); | |
| 1428 | const def_index = @backingInt(Def.defTypeExpr); | |
| 1429 | 1429 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1430 | 1430 | p.depths[def_index] += 1; |
| 1431 | 1431 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -1449,7 +1449,7 @@ const Parser = struct { |
| 1449 | 1449 | }; |
| 1450 | 1450 | } |
| 1451 | 1451 | pub fn parseErrorUnionExpr(p: *Parser) Error!bool { |
| 1452 | const def_index = @intFromEnum(Def.defErrorUnionExpr); | |
| 1452 | const def_index = @backingInt(Def.defErrorUnionExpr); | |
| 1453 | 1453 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1454 | 1454 | p.depths[def_index] += 1; |
| 1455 | 1455 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -1473,7 +1473,7 @@ const Parser = struct { |
| 1473 | 1473 | }; |
| 1474 | 1474 | } |
| 1475 | 1475 | pub fn parseSuffixExpr(p: *Parser) Error!bool { |
| 1476 | const def_index = @intFromEnum(Def.defSuffixExpr); | |
| 1476 | const def_index = @backingInt(Def.defSuffixExpr); | |
| 1477 | 1477 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1478 | 1478 | p.depths[def_index] += 1; |
| 1479 | 1479 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -1497,7 +1497,7 @@ const Parser = struct { |
| 1497 | 1497 | }; |
| 1498 | 1498 | } |
| 1499 | 1499 | pub fn parsePrimaryTypeExpr(p: *Parser) Error!bool { |
| 1500 | const def_index = @intFromEnum(Def.defPrimaryTypeExpr); | |
| 1500 | const def_index = @backingInt(Def.defPrimaryTypeExpr); | |
| 1501 | 1501 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1502 | 1502 | p.depths[def_index] += 1; |
| 1503 | 1503 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -1541,7 +1541,7 @@ const Parser = struct { |
| 1541 | 1541 | }; |
| 1542 | 1542 | } |
| 1543 | 1543 | pub fn parseContainerType(p: *Parser) Error!bool { |
| 1544 | const def_index = @intFromEnum(Def.defContainerType); | |
| 1544 | const def_index = @backingInt(Def.defContainerType); | |
| 1545 | 1545 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1546 | 1546 | p.depths[def_index] += 1; |
| 1547 | 1547 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -1560,7 +1560,7 @@ const Parser = struct { |
| 1560 | 1560 | }; |
| 1561 | 1561 | } |
| 1562 | 1562 | pub fn parseErrorSetDecl(p: *Parser) Error!bool { |
| 1563 | const def_index = @intFromEnum(Def.defErrorSetDecl); | |
| 1563 | const def_index = @backingInt(Def.defErrorSetDecl); | |
| 1564 | 1564 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1565 | 1565 | p.depths[def_index] += 1; |
| 1566 | 1566 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -1572,7 +1572,7 @@ const Parser = struct { |
| 1572 | 1572 | }; |
| 1573 | 1573 | } |
| 1574 | 1574 | pub fn parseGroupedExpr(p: *Parser) Error!bool { |
| 1575 | const def_index = @intFromEnum(Def.defGroupedExpr); | |
| 1575 | const def_index = @backingInt(Def.defGroupedExpr); | |
| 1576 | 1576 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1577 | 1577 | p.depths[def_index] += 1; |
| 1578 | 1578 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -1584,7 +1584,7 @@ const Parser = struct { |
| 1584 | 1584 | }; |
| 1585 | 1585 | } |
| 1586 | 1586 | pub fn parseIfTypeExpr(p: *Parser) Error!bool { |
| 1587 | const def_index = @intFromEnum(Def.defIfTypeExpr); | |
| 1587 | const def_index = @backingInt(Def.defIfTypeExpr); | |
| 1588 | 1588 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1589 | 1589 | p.depths[def_index] += 1; |
| 1590 | 1590 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -1608,7 +1608,7 @@ const Parser = struct { |
| 1608 | 1608 | }; |
| 1609 | 1609 | } |
| 1610 | 1610 | pub fn parseLabeledTypeExpr(p: *Parser) Error!bool { |
| 1611 | const def_index = @intFromEnum(Def.defLabeledTypeExpr); | |
| 1611 | const def_index = @backingInt(Def.defLabeledTypeExpr); | |
| 1612 | 1612 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1613 | 1613 | p.depths[def_index] += 1; |
| 1614 | 1614 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -1624,7 +1624,7 @@ const Parser = struct { |
| 1624 | 1624 | }; |
| 1625 | 1625 | } |
| 1626 | 1626 | pub fn parseLoopTypeExpr(p: *Parser) Error!bool { |
| 1627 | const def_index = @intFromEnum(Def.defLoopTypeExpr); | |
| 1627 | const def_index = @backingInt(Def.defLoopTypeExpr); | |
| 1628 | 1628 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1629 | 1629 | p.depths[def_index] += 1; |
| 1630 | 1630 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -1643,7 +1643,7 @@ const Parser = struct { |
| 1643 | 1643 | }; |
| 1644 | 1644 | } |
| 1645 | 1645 | pub fn parseForTypeExpr(p: *Parser) Error!bool { |
| 1646 | const def_index = @intFromEnum(Def.defForTypeExpr); | |
| 1646 | const def_index = @backingInt(Def.defForTypeExpr); | |
| 1647 | 1647 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1648 | 1648 | p.depths[def_index] += 1; |
| 1649 | 1649 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -1667,7 +1667,7 @@ const Parser = struct { |
| 1667 | 1667 | }; |
| 1668 | 1668 | } |
| 1669 | 1669 | pub fn parseWhileTypeExpr(p: *Parser) Error!bool { |
| 1670 | const def_index = @intFromEnum(Def.defWhileTypeExpr); | |
| 1670 | const def_index = @backingInt(Def.defWhileTypeExpr); | |
| 1671 | 1671 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1672 | 1672 | p.depths[def_index] += 1; |
| 1673 | 1673 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -1691,7 +1691,7 @@ const Parser = struct { |
| 1691 | 1691 | }; |
| 1692 | 1692 | } |
| 1693 | 1693 | pub fn parseSwitchExpr(p: *Parser) Error!bool { |
| 1694 | const def_index = @intFromEnum(Def.defSwitchExpr); | |
| 1694 | const def_index = @backingInt(Def.defSwitchExpr); | |
| 1695 | 1695 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1696 | 1696 | p.depths[def_index] += 1; |
| 1697 | 1697 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -1703,7 +1703,7 @@ const Parser = struct { |
| 1703 | 1703 | }; |
| 1704 | 1704 | } |
| 1705 | 1705 | pub fn parseAsmExpr(p: *Parser) Error!bool { |
| 1706 | const def_index = @intFromEnum(Def.defAsmExpr); | |
| 1706 | const def_index = @backingInt(Def.defAsmExpr); | |
| 1707 | 1707 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1708 | 1708 | p.depths[def_index] += 1; |
| 1709 | 1709 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -1715,7 +1715,7 @@ const Parser = struct { |
| 1715 | 1715 | }; |
| 1716 | 1716 | } |
| 1717 | 1717 | pub fn parseAsmOutput(p: *Parser) Error!bool { |
| 1718 | const def_index = @intFromEnum(Def.defAsmOutput); | |
| 1718 | const def_index = @backingInt(Def.defAsmOutput); | |
| 1719 | 1719 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1720 | 1720 | p.depths[def_index] += 1; |
| 1721 | 1721 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -1727,7 +1727,7 @@ const Parser = struct { |
| 1727 | 1727 | }; |
| 1728 | 1728 | } |
| 1729 | 1729 | pub fn parseAsmOutputItem(p: *Parser) Error!bool { |
| 1730 | const def_index = @intFromEnum(Def.defAsmOutputItem); | |
| 1730 | const def_index = @backingInt(Def.defAsmOutputItem); | |
| 1731 | 1731 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1732 | 1732 | p.depths[def_index] += 1; |
| 1733 | 1733 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -1746,7 +1746,7 @@ const Parser = struct { |
| 1746 | 1746 | }; |
| 1747 | 1747 | } |
| 1748 | 1748 | pub fn parseAsmInput(p: *Parser) Error!bool { |
| 1749 | const def_index = @intFromEnum(Def.defAsmInput); | |
| 1749 | const def_index = @backingInt(Def.defAsmInput); | |
| 1750 | 1750 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1751 | 1751 | p.depths[def_index] += 1; |
| 1752 | 1752 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -1758,7 +1758,7 @@ const Parser = struct { |
| 1758 | 1758 | }; |
| 1759 | 1759 | } |
| 1760 | 1760 | pub fn parseAsmInputItem(p: *Parser) Error!bool { |
| 1761 | const def_index = @intFromEnum(Def.defAsmInputItem); | |
| 1761 | const def_index = @backingInt(Def.defAsmInputItem); | |
| 1762 | 1762 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1763 | 1763 | p.depths[def_index] += 1; |
| 1764 | 1764 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -1770,7 +1770,7 @@ const Parser = struct { |
| 1770 | 1770 | }; |
| 1771 | 1771 | } |
| 1772 | 1772 | pub fn parseAsmClobbers(p: *Parser) Error!bool { |
| 1773 | const def_index = @intFromEnum(Def.defAsmClobbers); | |
| 1773 | const def_index = @backingInt(Def.defAsmClobbers); | |
| 1774 | 1774 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1775 | 1775 | p.depths[def_index] += 1; |
| 1776 | 1776 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -1782,7 +1782,7 @@ const Parser = struct { |
| 1782 | 1782 | }; |
| 1783 | 1783 | } |
| 1784 | 1784 | pub fn parseBreakLabel(p: *Parser) Error!bool { |
| 1785 | const def_index = @intFromEnum(Def.defBreakLabel); | |
| 1785 | const def_index = @backingInt(Def.defBreakLabel); | |
| 1786 | 1786 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1787 | 1787 | p.depths[def_index] += 1; |
| 1788 | 1788 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -1794,7 +1794,7 @@ const Parser = struct { |
| 1794 | 1794 | }; |
| 1795 | 1795 | } |
| 1796 | 1796 | pub fn parseBlockLabel(p: *Parser) Error!bool { |
| 1797 | const def_index = @intFromEnum(Def.defBlockLabel); | |
| 1797 | const def_index = @backingInt(Def.defBlockLabel); | |
| 1798 | 1798 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1799 | 1799 | p.depths[def_index] += 1; |
| 1800 | 1800 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -1806,7 +1806,7 @@ const Parser = struct { |
| 1806 | 1806 | }; |
| 1807 | 1807 | } |
| 1808 | 1808 | pub fn parseFieldInit(p: *Parser) Error!bool { |
| 1809 | const def_index = @intFromEnum(Def.defFieldInit); | |
| 1809 | const def_index = @backingInt(Def.defFieldInit); | |
| 1810 | 1810 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1811 | 1811 | p.depths[def_index] += 1; |
| 1812 | 1812 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -1818,7 +1818,7 @@ const Parser = struct { |
| 1818 | 1818 | }; |
| 1819 | 1819 | } |
| 1820 | 1820 | pub fn parseWhileContinueExpr(p: *Parser) Error!bool { |
| 1821 | const def_index = @intFromEnum(Def.defWhileContinueExpr); | |
| 1821 | const def_index = @backingInt(Def.defWhileContinueExpr); | |
| 1822 | 1822 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1823 | 1823 | p.depths[def_index] += 1; |
| 1824 | 1824 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -1830,7 +1830,7 @@ const Parser = struct { |
| 1830 | 1830 | }; |
| 1831 | 1831 | } |
| 1832 | 1832 | pub fn parseLinkSection(p: *Parser) Error!bool { |
| 1833 | const def_index = @intFromEnum(Def.defLinkSection); | |
| 1833 | const def_index = @backingInt(Def.defLinkSection); | |
| 1834 | 1834 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1835 | 1835 | p.depths[def_index] += 1; |
| 1836 | 1836 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -1842,7 +1842,7 @@ const Parser = struct { |
| 1842 | 1842 | }; |
| 1843 | 1843 | } |
| 1844 | 1844 | pub fn parseAddrSpace(p: *Parser) Error!bool { |
| 1845 | const def_index = @intFromEnum(Def.defAddrSpace); | |
| 1845 | const def_index = @backingInt(Def.defAddrSpace); | |
| 1846 | 1846 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1847 | 1847 | p.depths[def_index] += 1; |
| 1848 | 1848 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -1854,7 +1854,7 @@ const Parser = struct { |
| 1854 | 1854 | }; |
| 1855 | 1855 | } |
| 1856 | 1856 | pub fn parseCallConv(p: *Parser) Error!bool { |
| 1857 | const def_index = @intFromEnum(Def.defCallConv); | |
| 1857 | const def_index = @backingInt(Def.defCallConv); | |
| 1858 | 1858 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1859 | 1859 | p.depths[def_index] += 1; |
| 1860 | 1860 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -1866,7 +1866,7 @@ const Parser = struct { |
| 1866 | 1866 | }; |
| 1867 | 1867 | } |
| 1868 | 1868 | pub fn parseParamDecl(p: *Parser) Error!bool { |
| 1869 | const def_index = @intFromEnum(Def.defParamDecl); | |
| 1869 | const def_index = @backingInt(Def.defParamDecl); | |
| 1870 | 1870 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1871 | 1871 | p.depths[def_index] += 1; |
| 1872 | 1872 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -1890,7 +1890,7 @@ const Parser = struct { |
| 1890 | 1890 | }; |
| 1891 | 1891 | } |
| 1892 | 1892 | pub fn parseParamType(p: *Parser) Error!bool { |
| 1893 | const def_index = @intFromEnum(Def.defParamType); | |
| 1893 | const def_index = @backingInt(Def.defParamType); | |
| 1894 | 1894 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1895 | 1895 | p.depths[def_index] += 1; |
| 1896 | 1896 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -1904,7 +1904,7 @@ const Parser = struct { |
| 1904 | 1904 | }; |
| 1905 | 1905 | } |
| 1906 | 1906 | pub fn parseIfPrefix(p: *Parser) Error!bool { |
| 1907 | const def_index = @intFromEnum(Def.defIfPrefix); | |
| 1907 | const def_index = @backingInt(Def.defIfPrefix); | |
| 1908 | 1908 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1909 | 1909 | p.depths[def_index] += 1; |
| 1910 | 1910 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -1916,7 +1916,7 @@ const Parser = struct { |
| 1916 | 1916 | }; |
| 1917 | 1917 | } |
| 1918 | 1918 | pub fn parseWhilePrefix(p: *Parser) Error!bool { |
| 1919 | const def_index = @intFromEnum(Def.defWhilePrefix); | |
| 1919 | const def_index = @backingInt(Def.defWhilePrefix); | |
| 1920 | 1920 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1921 | 1921 | p.depths[def_index] += 1; |
| 1922 | 1922 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -1928,7 +1928,7 @@ const Parser = struct { |
| 1928 | 1928 | }; |
| 1929 | 1929 | } |
| 1930 | 1930 | pub fn parseForPrefix(p: *Parser) Error!bool { |
| 1931 | const def_index = @intFromEnum(Def.defForPrefix); | |
| 1931 | const def_index = @backingInt(Def.defForPrefix); | |
| 1932 | 1932 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1933 | 1933 | p.depths[def_index] += 1; |
| 1934 | 1934 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -1940,7 +1940,7 @@ const Parser = struct { |
| 1940 | 1940 | }; |
| 1941 | 1941 | } |
| 1942 | 1942 | pub fn parsePayload(p: *Parser) Error!bool { |
| 1943 | const def_index = @intFromEnum(Def.defPayload); | |
| 1943 | const def_index = @backingInt(Def.defPayload); | |
| 1944 | 1944 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1945 | 1945 | p.depths[def_index] += 1; |
| 1946 | 1946 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -1952,7 +1952,7 @@ const Parser = struct { |
| 1952 | 1952 | }; |
| 1953 | 1953 | } |
| 1954 | 1954 | pub fn parsePtrPayload(p: *Parser) Error!bool { |
| 1955 | const def_index = @intFromEnum(Def.defPtrPayload); | |
| 1955 | const def_index = @backingInt(Def.defPtrPayload); | |
| 1956 | 1956 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1957 | 1957 | p.depths[def_index] += 1; |
| 1958 | 1958 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -1964,7 +1964,7 @@ const Parser = struct { |
| 1964 | 1964 | }; |
| 1965 | 1965 | } |
| 1966 | 1966 | pub fn parsePtrIndexPayload(p: *Parser) Error!bool { |
| 1967 | const def_index = @intFromEnum(Def.defPtrIndexPayload); | |
| 1967 | const def_index = @backingInt(Def.defPtrIndexPayload); | |
| 1968 | 1968 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1969 | 1969 | p.depths[def_index] += 1; |
| 1970 | 1970 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -1981,7 +1981,7 @@ const Parser = struct { |
| 1981 | 1981 | }; |
| 1982 | 1982 | } |
| 1983 | 1983 | pub fn parsePtrListPayload(p: *Parser) Error!bool { |
| 1984 | const def_index = @intFromEnum(Def.defPtrListPayload); | |
| 1984 | const def_index = @backingInt(Def.defPtrListPayload); | |
| 1985 | 1985 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1986 | 1986 | p.depths[def_index] += 1; |
| 1987 | 1987 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -2005,7 +2005,7 @@ const Parser = struct { |
| 2005 | 2005 | }; |
| 2006 | 2006 | } |
| 2007 | 2007 | pub fn parseSwitchProng(p: *Parser) Error!bool { |
| 2008 | const def_index = @intFromEnum(Def.defSwitchProng); | |
| 2008 | const def_index = @backingInt(Def.defSwitchProng); | |
| 2009 | 2009 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 2010 | 2010 | p.depths[def_index] += 1; |
| 2011 | 2011 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -2017,7 +2017,7 @@ const Parser = struct { |
| 2017 | 2017 | }; |
| 2018 | 2018 | } |
| 2019 | 2019 | pub fn parseSwitchCase(p: *Parser) Error!bool { |
| 2020 | const def_index = @intFromEnum(Def.defSwitchCase); | |
| 2020 | const def_index = @backingInt(Def.defSwitchCase); | |
| 2021 | 2021 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 2022 | 2022 | p.depths[def_index] += 1; |
| 2023 | 2023 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -2043,7 +2043,7 @@ const Parser = struct { |
| 2043 | 2043 | }; |
| 2044 | 2044 | } |
| 2045 | 2045 | pub fn parseSwitchItem(p: *Parser) Error!bool { |
| 2046 | const def_index = @intFromEnum(Def.defSwitchItem); | |
| 2046 | const def_index = @backingInt(Def.defSwitchItem); | |
| 2047 | 2047 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 2048 | 2048 | p.depths[def_index] += 1; |
| 2049 | 2049 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -2060,7 +2060,7 @@ const Parser = struct { |
| 2060 | 2060 | }; |
| 2061 | 2061 | } |
| 2062 | 2062 | pub fn parseForArgumentsList(p: *Parser) Error!bool { |
| 2063 | const def_index = @intFromEnum(Def.defForArgumentsList); | |
| 2063 | const def_index = @backingInt(Def.defForArgumentsList); | |
| 2064 | 2064 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 2065 | 2065 | p.depths[def_index] += 1; |
| 2066 | 2066 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -2084,7 +2084,7 @@ const Parser = struct { |
| 2084 | 2084 | }; |
| 2085 | 2085 | } |
| 2086 | 2086 | pub fn parseForItem(p: *Parser) Error!bool { |
| 2087 | const def_index = @intFromEnum(Def.defForItem); | |
| 2087 | const def_index = @backingInt(Def.defForItem); | |
| 2088 | 2088 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 2089 | 2089 | p.depths[def_index] += 1; |
| 2090 | 2090 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -2120,7 +2120,7 @@ const Parser = struct { |
| 2120 | 2120 | }; |
| 2121 | 2121 | } |
| 2122 | 2122 | pub fn parseAssignOp(p: *Parser) Error!bool { |
| 2123 | const def_index = @intFromEnum(Def.defAssignOp); | |
| 2123 | const def_index = @backingInt(Def.defAssignOp); | |
| 2124 | 2124 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 2125 | 2125 | p.depths[def_index] += 1; |
| 2126 | 2126 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -2166,7 +2166,7 @@ const Parser = struct { |
| 2166 | 2166 | }; |
| 2167 | 2167 | } |
| 2168 | 2168 | pub fn parseOrOp(p: *Parser) Error!bool { |
| 2169 | const def_index = @intFromEnum(Def.defOrOp); | |
| 2169 | const def_index = @backingInt(Def.defOrOp); | |
| 2170 | 2170 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 2171 | 2171 | p.depths[def_index] += 1; |
| 2172 | 2172 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -2190,7 +2190,7 @@ const Parser = struct { |
| 2190 | 2190 | }; |
| 2191 | 2191 | } |
| 2192 | 2192 | pub fn parseAndOp(p: *Parser) Error!bool { |
| 2193 | const def_index = @intFromEnum(Def.defAndOp); | |
| 2193 | const def_index = @backingInt(Def.defAndOp); | |
| 2194 | 2194 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 2195 | 2195 | p.depths[def_index] += 1; |
| 2196 | 2196 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -2214,7 +2214,7 @@ const Parser = struct { |
| 2214 | 2214 | }; |
| 2215 | 2215 | } |
| 2216 | 2216 | pub fn parseCompareOp(p: *Parser) Error!bool { |
| 2217 | const def_index = @intFromEnum(Def.defCompareOp); | |
| 2217 | const def_index = @backingInt(Def.defCompareOp); | |
| 2218 | 2218 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 2219 | 2219 | p.depths[def_index] += 1; |
| 2220 | 2220 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -2238,7 +2238,7 @@ const Parser = struct { |
| 2238 | 2238 | }; |
| 2239 | 2239 | } |
| 2240 | 2240 | pub fn parseCompareOpTok(p: *Parser) Error!bool { |
| 2241 | const def_index = @intFromEnum(Def.defCompareOpTok); | |
| 2241 | const def_index = @backingInt(Def.defCompareOpTok); | |
| 2242 | 2242 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 2243 | 2243 | p.depths[def_index] += 1; |
| 2244 | 2244 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -2260,7 +2260,7 @@ const Parser = struct { |
| 2260 | 2260 | }; |
| 2261 | 2261 | } |
| 2262 | 2262 | pub fn parseBitwiseOp(p: *Parser) Error!bool { |
| 2263 | const def_index = @intFromEnum(Def.defBitwiseOp); | |
| 2263 | const def_index = @backingInt(Def.defBitwiseOp); | |
| 2264 | 2264 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 2265 | 2265 | p.depths[def_index] += 1; |
| 2266 | 2266 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -2298,7 +2298,7 @@ const Parser = struct { |
| 2298 | 2298 | }; |
| 2299 | 2299 | } |
| 2300 | 2300 | pub fn parseBitwiseOpTok(p: *Parser) Error!bool { |
| 2301 | const def_index = @intFromEnum(Def.defBitwiseOpTok); | |
| 2301 | const def_index = @backingInt(Def.defBitwiseOpTok); | |
| 2302 | 2302 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 2303 | 2303 | p.depths[def_index] += 1; |
| 2304 | 2304 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -2328,7 +2328,7 @@ const Parser = struct { |
| 2328 | 2328 | }; |
| 2329 | 2329 | } |
| 2330 | 2330 | pub fn parseBitShiftOp(p: *Parser) Error!bool { |
| 2331 | const def_index = @intFromEnum(Def.defBitShiftOp); | |
| 2331 | const def_index = @backingInt(Def.defBitShiftOp); | |
| 2332 | 2332 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 2333 | 2333 | p.depths[def_index] += 1; |
| 2334 | 2334 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -2352,7 +2352,7 @@ const Parser = struct { |
| 2352 | 2352 | }; |
| 2353 | 2353 | } |
| 2354 | 2354 | pub fn parseBitShiftOpTok(p: *Parser) Error!bool { |
| 2355 | const def_index = @intFromEnum(Def.defBitShiftOpTok); | |
| 2355 | const def_index = @backingInt(Def.defBitShiftOpTok); | |
| 2356 | 2356 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 2357 | 2357 | p.depths[def_index] += 1; |
| 2358 | 2358 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -2368,7 +2368,7 @@ const Parser = struct { |
| 2368 | 2368 | }; |
| 2369 | 2369 | } |
| 2370 | 2370 | pub fn parseAdditionOp(p: *Parser) Error!bool { |
| 2371 | const def_index = @intFromEnum(Def.defAdditionOp); | |
| 2371 | const def_index = @backingInt(Def.defAdditionOp); | |
| 2372 | 2372 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 2373 | 2373 | p.depths[def_index] += 1; |
| 2374 | 2374 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -2392,7 +2392,7 @@ const Parser = struct { |
| 2392 | 2392 | }; |
| 2393 | 2393 | } |
| 2394 | 2394 | pub fn parseAdditionOpTok(p: *Parser) Error!bool { |
| 2395 | const def_index = @intFromEnum(Def.defAdditionOpTok); | |
| 2395 | const def_index = @backingInt(Def.defAdditionOpTok); | |
| 2396 | 2396 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 2397 | 2397 | p.depths[def_index] += 1; |
| 2398 | 2398 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -2416,7 +2416,7 @@ const Parser = struct { |
| 2416 | 2416 | }; |
| 2417 | 2417 | } |
| 2418 | 2418 | pub fn parseMultiplyOp(p: *Parser) Error!bool { |
| 2419 | const def_index = @intFromEnum(Def.defMultiplyOp); | |
| 2419 | const def_index = @backingInt(Def.defMultiplyOp); | |
| 2420 | 2420 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 2421 | 2421 | p.depths[def_index] += 1; |
| 2422 | 2422 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -2440,7 +2440,7 @@ const Parser = struct { |
| 2440 | 2440 | }; |
| 2441 | 2441 | } |
| 2442 | 2442 | pub fn parseMultiplyOpTok(p: *Parser) Error!bool { |
| 2443 | const def_index = @intFromEnum(Def.defMultiplyOpTok); | |
| 2443 | const def_index = @backingInt(Def.defMultiplyOpTok); | |
| 2444 | 2444 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 2445 | 2445 | p.depths[def_index] += 1; |
| 2446 | 2446 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -2462,7 +2462,7 @@ const Parser = struct { |
| 2462 | 2462 | }; |
| 2463 | 2463 | } |
| 2464 | 2464 | pub fn parsePrefixOp(p: *Parser) Error!bool { |
| 2465 | const def_index = @intFromEnum(Def.defPrefixOp); | |
| 2465 | const def_index = @backingInt(Def.defPrefixOp); | |
| 2466 | 2466 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 2467 | 2467 | p.depths[def_index] += 1; |
| 2468 | 2468 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -2484,7 +2484,7 @@ const Parser = struct { |
| 2484 | 2484 | }; |
| 2485 | 2485 | } |
| 2486 | 2486 | pub fn parsePrefixTypeOp(p: *Parser) Error!bool { |
| 2487 | const def_index = @intFromEnum(Def.defPrefixTypeOp); | |
| 2487 | const def_index = @backingInt(Def.defPrefixTypeOp); | |
| 2488 | 2488 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 2489 | 2489 | p.depths[def_index] += 1; |
| 2490 | 2490 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -2511,7 +2511,7 @@ const Parser = struct { |
| 2511 | 2511 | }; |
| 2512 | 2512 | } |
| 2513 | 2513 | pub fn parsePtrMods(p: *Parser) Error!bool { |
| 2514 | const def_index = @intFromEnum(Def.defPtrMods); | |
| 2514 | const def_index = @backingInt(Def.defPtrMods); | |
| 2515 | 2515 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 2516 | 2516 | p.depths[def_index] += 1; |
| 2517 | 2517 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -2577,7 +2577,7 @@ const Parser = struct { |
| 2577 | 2577 | }; |
| 2578 | 2578 | } |
| 2579 | 2579 | pub fn parseSinglePtrMods(p: *Parser) Error!bool { |
| 2580 | const def_index = @intFromEnum(Def.defSinglePtrMods); | |
| 2580 | const def_index = @backingInt(Def.defSinglePtrMods); | |
| 2581 | 2581 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 2582 | 2582 | p.depths[def_index] += 1; |
| 2583 | 2583 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -2643,7 +2643,7 @@ const Parser = struct { |
| 2643 | 2643 | }; |
| 2644 | 2644 | } |
| 2645 | 2645 | pub fn parsePtrMod(p: *Parser) Error!bool { |
| 2646 | const def_index = @intFromEnum(Def.defPtrMod); | |
| 2646 | const def_index = @backingInt(Def.defPtrMod); | |
| 2647 | 2647 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 2648 | 2648 | p.depths[def_index] += 1; |
| 2649 | 2649 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -2659,7 +2659,7 @@ const Parser = struct { |
| 2659 | 2659 | }; |
| 2660 | 2660 | } |
| 2661 | 2661 | pub fn parsePrefixTypeOpPrefix(p: *Parser) Error!bool { |
| 2662 | const def_index = @intFromEnum(Def.defPrefixTypeOpPrefix); | |
| 2662 | const def_index = @backingInt(Def.defPrefixTypeOpPrefix); | |
| 2663 | 2663 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 2664 | 2664 | p.depths[def_index] += 1; |
| 2665 | 2665 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -2677,7 +2677,7 @@ const Parser = struct { |
| 2677 | 2677 | }; |
| 2678 | 2678 | } |
| 2679 | 2679 | pub fn parseSuffixOp(p: *Parser) Error!bool { |
| 2680 | const def_index = @intFromEnum(Def.defSuffixOp); | |
| 2680 | const def_index = @backingInt(Def.defSuffixOp); | |
| 2681 | 2681 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 2682 | 2682 | p.depths[def_index] += 1; |
| 2683 | 2683 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -2719,7 +2719,7 @@ const Parser = struct { |
| 2719 | 2719 | }; |
| 2720 | 2720 | } |
| 2721 | 2721 | pub fn parseSuffixOpPrefix(p: *Parser) Error!bool { |
| 2722 | const def_index = @intFromEnum(Def.defSuffixOpPrefix); | |
| 2722 | const def_index = @backingInt(Def.defSuffixOpPrefix); | |
| 2723 | 2723 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 2724 | 2724 | p.depths[def_index] += 1; |
| 2725 | 2725 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -2739,7 +2739,7 @@ const Parser = struct { |
| 2739 | 2739 | }; |
| 2740 | 2740 | } |
| 2741 | 2741 | pub fn parseFnCallArguments(p: *Parser) Error!bool { |
| 2742 | const def_index = @intFromEnum(Def.defFnCallArguments); | |
| 2742 | const def_index = @backingInt(Def.defFnCallArguments); | |
| 2743 | 2743 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 2744 | 2744 | p.depths[def_index] += 1; |
| 2745 | 2745 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -2751,7 +2751,7 @@ const Parser = struct { |
| 2751 | 2751 | }; |
| 2752 | 2752 | } |
| 2753 | 2753 | pub fn parseSliceTypeStart(p: *Parser) Error!bool { |
| 2754 | const def_index = @intFromEnum(Def.defSliceTypeStart); | |
| 2754 | const def_index = @backingInt(Def.defSliceTypeStart); | |
| 2755 | 2755 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 2756 | 2756 | p.depths[def_index] += 1; |
| 2757 | 2757 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -2768,7 +2768,7 @@ const Parser = struct { |
| 2768 | 2768 | }; |
| 2769 | 2769 | } |
| 2770 | 2770 | pub fn parseSinglePtrTypeStart(p: *Parser) Error!bool { |
| 2771 | const def_index = @intFromEnum(Def.defSinglePtrTypeStart); | |
| 2771 | const def_index = @backingInt(Def.defSinglePtrTypeStart); | |
| 2772 | 2772 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 2773 | 2773 | p.depths[def_index] += 1; |
| 2774 | 2774 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -2780,7 +2780,7 @@ const Parser = struct { |
| 2780 | 2780 | }; |
| 2781 | 2781 | } |
| 2782 | 2782 | pub fn parseManyPtrTypeStart(p: *Parser) Error!bool { |
| 2783 | const def_index = @intFromEnum(Def.defManyPtrTypeStart); | |
| 2783 | const def_index = @backingInt(Def.defManyPtrTypeStart); | |
| 2784 | 2784 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 2785 | 2785 | p.depths[def_index] += 1; |
| 2786 | 2786 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -2799,7 +2799,7 @@ const Parser = struct { |
| 2799 | 2799 | }; |
| 2800 | 2800 | } |
| 2801 | 2801 | pub fn parseArrayTypeStart(p: *Parser) Error!bool { |
| 2802 | const def_index = @intFromEnum(Def.defArrayTypeStart); | |
| 2802 | const def_index = @backingInt(Def.defArrayTypeStart); | |
| 2803 | 2803 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 2804 | 2804 | p.depths[def_index] += 1; |
| 2805 | 2805 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -2821,7 +2821,7 @@ const Parser = struct { |
| 2821 | 2821 | }; |
| 2822 | 2822 | } |
| 2823 | 2823 | pub fn parseContainerTypeAuto(p: *Parser) Error!bool { |
| 2824 | const def_index = @intFromEnum(Def.defContainerTypeAuto); | |
| 2824 | const def_index = @backingInt(Def.defContainerTypeAuto); | |
| 2825 | 2825 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 2826 | 2826 | p.depths[def_index] += 1; |
| 2827 | 2827 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -2833,7 +2833,7 @@ const Parser = struct { |
| 2833 | 2833 | }; |
| 2834 | 2834 | } |
| 2835 | 2835 | pub fn parseContainerTypeKind(p: *Parser) Error!bool { |
| 2836 | const def_index = @intFromEnum(Def.defContainerTypeKind); | |
| 2836 | const def_index = @backingInt(Def.defContainerTypeKind); | |
| 2837 | 2837 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 2838 | 2838 | p.depths[def_index] += 1; |
| 2839 | 2839 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -2878,7 +2878,7 @@ const Parser = struct { |
| 2878 | 2878 | }; |
| 2879 | 2879 | } |
| 2880 | 2880 | pub fn parseByteAlign(p: *Parser) Error!bool { |
| 2881 | const def_index = @intFromEnum(Def.defByteAlign); | |
| 2881 | const def_index = @backingInt(Def.defByteAlign); | |
| 2882 | 2882 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 2883 | 2883 | p.depths[def_index] += 1; |
| 2884 | 2884 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -2890,7 +2890,7 @@ const Parser = struct { |
| 2890 | 2890 | }; |
| 2891 | 2891 | } |
| 2892 | 2892 | pub fn parseBitAlign(p: *Parser) Error!bool { |
| 2893 | const def_index = @intFromEnum(Def.defBitAlign); | |
| 2893 | const def_index = @backingInt(Def.defBitAlign); | |
| 2894 | 2894 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 2895 | 2895 | p.depths[def_index] += 1; |
| 2896 | 2896 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -2907,7 +2907,7 @@ const Parser = struct { |
| 2907 | 2907 | }; |
| 2908 | 2908 | } |
| 2909 | 2909 | pub fn parseIdentifierList(p: *Parser) Error!bool { |
| 2910 | const def_index = @intFromEnum(Def.defIdentifierList); | |
| 2910 | const def_index = @backingInt(Def.defIdentifierList); | |
| 2911 | 2911 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 2912 | 2912 | p.depths[def_index] += 1; |
| 2913 | 2913 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -2929,7 +2929,7 @@ const Parser = struct { |
| 2929 | 2929 | }; |
| 2930 | 2930 | } |
| 2931 | 2931 | pub fn parseSwitchProngList(p: *Parser) Error!bool { |
| 2932 | const def_index = @intFromEnum(Def.defSwitchProngList); | |
| 2932 | const def_index = @backingInt(Def.defSwitchProngList); | |
| 2933 | 2933 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 2934 | 2934 | p.depths[def_index] += 1; |
| 2935 | 2935 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -2951,7 +2951,7 @@ const Parser = struct { |
| 2951 | 2951 | }; |
| 2952 | 2952 | } |
| 2953 | 2953 | pub fn parseAsmOutputList(p: *Parser) Error!bool { |
| 2954 | const def_index = @intFromEnum(Def.defAsmOutputList); | |
| 2954 | const def_index = @backingInt(Def.defAsmOutputList); | |
| 2955 | 2955 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 2956 | 2956 | p.depths[def_index] += 1; |
| 2957 | 2957 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -2973,7 +2973,7 @@ const Parser = struct { |
| 2973 | 2973 | }; |
| 2974 | 2974 | } |
| 2975 | 2975 | pub fn parseAsmInputList(p: *Parser) Error!bool { |
| 2976 | const def_index = @intFromEnum(Def.defAsmInputList); | |
| 2976 | const def_index = @backingInt(Def.defAsmInputList); | |
| 2977 | 2977 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 2978 | 2978 | p.depths[def_index] += 1; |
| 2979 | 2979 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -2995,7 +2995,7 @@ const Parser = struct { |
| 2995 | 2995 | }; |
| 2996 | 2996 | } |
| 2997 | 2997 | pub fn parseParamDeclList(p: *Parser) Error!bool { |
| 2998 | const def_index = @intFromEnum(Def.defParamDeclList); | |
| 2998 | const def_index = @backingInt(Def.defParamDeclList); | |
| 2999 | 2999 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 3000 | 3000 | p.depths[def_index] += 1; |
| 3001 | 3001 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -3007,7 +3007,7 @@ const Parser = struct { |
| 3007 | 3007 | }; |
| 3008 | 3008 | } |
| 3009 | 3009 | pub fn parseParamDeclListRest(p: *Parser) Error!bool { |
| 3010 | const def_index = @intFromEnum(Def.defParamDeclListRest); | |
| 3010 | const def_index = @backingInt(Def.defParamDeclListRest); | |
| 3011 | 3011 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 3012 | 3012 | p.depths[def_index] += 1; |
| 3013 | 3013 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -3030,7 +3030,7 @@ const Parser = struct { |
| 3030 | 3030 | }; |
| 3031 | 3031 | } |
| 3032 | 3032 | pub fn parseExprList(p: *Parser) Error!bool { |
| 3033 | const def_index = @intFromEnum(Def.defExprList); | |
| 3033 | const def_index = @backingInt(Def.defExprList); | |
| 3034 | 3034 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 3035 | 3035 | p.depths[def_index] += 1; |
| 3036 | 3036 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -3054,7 +3054,7 @@ const Parser = struct { |
| 3054 | 3054 | }; |
| 3055 | 3055 | } |
| 3056 | 3056 | pub fn parseExprPrefix(p: *Parser) Error!bool { |
| 3057 | const def_index = @intFromEnum(Def.defExprPrefix); | |
| 3057 | const def_index = @backingInt(Def.defExprPrefix); | |
| 3058 | 3058 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 3059 | 3059 | p.depths[def_index] += 1; |
| 3060 | 3060 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -3066,7 +3066,7 @@ const Parser = struct { |
| 3066 | 3066 | }; |
| 3067 | 3067 | } |
| 3068 | 3068 | pub fn parsebyte_order_mark(p: *Parser) Error!bool { |
| 3069 | const def_index = @intFromEnum(Def.defbyte_order_mark); | |
| 3069 | const def_index = @backingInt(Def.defbyte_order_mark); | |
| 3070 | 3070 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 3071 | 3071 | p.depths[def_index] += 1; |
| 3072 | 3072 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -3084,7 +3084,7 @@ const Parser = struct { |
| 3084 | 3084 | }; |
| 3085 | 3085 | } |
| 3086 | 3086 | pub fn parsesof(p: *Parser) Error!bool { |
| 3087 | const def_index = @intFromEnum(Def.defsof); | |
| 3087 | const def_index = @backingInt(Def.defsof); | |
| 3088 | 3088 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 3089 | 3089 | p.depths[def_index] += 1; |
| 3090 | 3090 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -3096,7 +3096,7 @@ const Parser = struct { |
| 3096 | 3096 | }; |
| 3097 | 3097 | } |
| 3098 | 3098 | pub fn parseeof(p: *Parser) Error!bool { |
| 3099 | const def_index = @intFromEnum(Def.defeof); | |
| 3099 | const def_index = @backingInt(Def.defeof); | |
| 3100 | 3100 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 3101 | 3101 | p.depths[def_index] += 1; |
| 3102 | 3102 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -3119,7 +3119,7 @@ const Parser = struct { |
| 3119 | 3119 | }; |
| 3120 | 3120 | } |
| 3121 | 3121 | pub fn parseox80_oxBF(p: *Parser) Error!bool { |
| 3122 | const def_index = @intFromEnum(Def.defox80_oxBF); | |
| 3122 | const def_index = @backingInt(Def.defox80_oxBF); | |
| 3123 | 3123 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 3124 | 3124 | p.depths[def_index] += 1; |
| 3125 | 3125 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -3138,7 +3138,7 @@ const Parser = struct { |
| 3138 | 3138 | }; |
| 3139 | 3139 | } |
| 3140 | 3140 | pub fn parseoxF4(p: *Parser) Error!bool { |
| 3141 | const def_index = @intFromEnum(Def.defoxF4); | |
| 3141 | const def_index = @backingInt(Def.defoxF4); | |
| 3142 | 3142 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 3143 | 3143 | p.depths[def_index] += 1; |
| 3144 | 3144 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -3156,7 +3156,7 @@ const Parser = struct { |
| 3156 | 3156 | }; |
| 3157 | 3157 | } |
| 3158 | 3158 | pub fn parseox80_ox8F(p: *Parser) Error!bool { |
| 3159 | const def_index = @intFromEnum(Def.defox80_ox8F); | |
| 3159 | const def_index = @backingInt(Def.defox80_ox8F); | |
| 3160 | 3160 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 3161 | 3161 | p.depths[def_index] += 1; |
| 3162 | 3162 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -3175,7 +3175,7 @@ const Parser = struct { |
| 3175 | 3175 | }; |
| 3176 | 3176 | } |
| 3177 | 3177 | pub fn parseoxF1_oxF3(p: *Parser) Error!bool { |
| 3178 | const def_index = @intFromEnum(Def.defoxF1_oxF3); | |
| 3178 | const def_index = @backingInt(Def.defoxF1_oxF3); | |
| 3179 | 3179 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 3180 | 3180 | p.depths[def_index] += 1; |
| 3181 | 3181 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -3194,7 +3194,7 @@ const Parser = struct { |
| 3194 | 3194 | }; |
| 3195 | 3195 | } |
| 3196 | 3196 | pub fn parseoxF0(p: *Parser) Error!bool { |
| 3197 | const def_index = @intFromEnum(Def.defoxF0); | |
| 3197 | const def_index = @backingInt(Def.defoxF0); | |
| 3198 | 3198 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 3199 | 3199 | p.depths[def_index] += 1; |
| 3200 | 3200 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -3212,7 +3212,7 @@ const Parser = struct { |
| 3212 | 3212 | }; |
| 3213 | 3213 | } |
| 3214 | 3214 | pub fn parseox90_0xBF(p: *Parser) Error!bool { |
| 3215 | const def_index = @intFromEnum(Def.defox90_0xBF); | |
| 3215 | const def_index = @backingInt(Def.defox90_0xBF); | |
| 3216 | 3216 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 3217 | 3217 | p.depths[def_index] += 1; |
| 3218 | 3218 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -3231,7 +3231,7 @@ const Parser = struct { |
| 3231 | 3231 | }; |
| 3232 | 3232 | } |
| 3233 | 3233 | pub fn parseoxEE_oxEF(p: *Parser) Error!bool { |
| 3234 | const def_index = @intFromEnum(Def.defoxEE_oxEF); | |
| 3234 | const def_index = @backingInt(Def.defoxEE_oxEF); | |
| 3235 | 3235 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 3236 | 3236 | p.depths[def_index] += 1; |
| 3237 | 3237 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -3250,7 +3250,7 @@ const Parser = struct { |
| 3250 | 3250 | }; |
| 3251 | 3251 | } |
| 3252 | 3252 | pub fn parseoxED(p: *Parser) Error!bool { |
| 3253 | const def_index = @intFromEnum(Def.defoxED); | |
| 3253 | const def_index = @backingInt(Def.defoxED); | |
| 3254 | 3254 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 3255 | 3255 | p.depths[def_index] += 1; |
| 3256 | 3256 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -3268,7 +3268,7 @@ const Parser = struct { |
| 3268 | 3268 | }; |
| 3269 | 3269 | } |
| 3270 | 3270 | pub fn parseox80_ox9F(p: *Parser) Error!bool { |
| 3271 | const def_index = @intFromEnum(Def.defox80_ox9F); | |
| 3271 | const def_index = @backingInt(Def.defox80_ox9F); | |
| 3272 | 3272 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 3273 | 3273 | p.depths[def_index] += 1; |
| 3274 | 3274 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -3287,7 +3287,7 @@ const Parser = struct { |
| 3287 | 3287 | }; |
| 3288 | 3288 | } |
| 3289 | 3289 | pub fn parseoxE1_oxEC(p: *Parser) Error!bool { |
| 3290 | const def_index = @intFromEnum(Def.defoxE1_oxEC); | |
| 3290 | const def_index = @backingInt(Def.defoxE1_oxEC); | |
| 3291 | 3291 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 3292 | 3292 | p.depths[def_index] += 1; |
| 3293 | 3293 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -3306,7 +3306,7 @@ const Parser = struct { |
| 3306 | 3306 | }; |
| 3307 | 3307 | } |
| 3308 | 3308 | pub fn parseoxE0(p: *Parser) Error!bool { |
| 3309 | const def_index = @intFromEnum(Def.defoxE0); | |
| 3309 | const def_index = @backingInt(Def.defoxE0); | |
| 3310 | 3310 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 3311 | 3311 | p.depths[def_index] += 1; |
| 3312 | 3312 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -3324,7 +3324,7 @@ const Parser = struct { |
| 3324 | 3324 | }; |
| 3325 | 3325 | } |
| 3326 | 3326 | pub fn parseoxA0_oxBF(p: *Parser) Error!bool { |
| 3327 | const def_index = @intFromEnum(Def.defoxA0_oxBF); | |
| 3327 | const def_index = @backingInt(Def.defoxA0_oxBF); | |
| 3328 | 3328 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 3329 | 3329 | p.depths[def_index] += 1; |
| 3330 | 3330 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -3343,7 +3343,7 @@ const Parser = struct { |
| 3343 | 3343 | }; |
| 3344 | 3344 | } |
| 3345 | 3345 | pub fn parseoxC2_oxDF(p: *Parser) Error!bool { |
| 3346 | const def_index = @intFromEnum(Def.defoxC2_oxDF); | |
| 3346 | const def_index = @backingInt(Def.defoxC2_oxDF); | |
| 3347 | 3347 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 3348 | 3348 | p.depths[def_index] += 1; |
| 3349 | 3349 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -3362,7 +3362,7 @@ const Parser = struct { |
| 3362 | 3362 | }; |
| 3363 | 3363 | } |
| 3364 | 3364 | pub fn parsemultibyte_utf8(p: *Parser) Error!bool { |
| 3365 | const def_index = @intFromEnum(Def.defmultibyte_utf8); | |
| 3365 | const def_index = @backingInt(Def.defmultibyte_utf8); | |
| 3366 | 3366 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 3367 | 3367 | p.depths[def_index] += 1; |
| 3368 | 3368 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -3388,7 +3388,7 @@ const Parser = struct { |
| 3388 | 3388 | }; |
| 3389 | 3389 | } |
| 3390 | 3390 | pub fn parsenon_control_ascii(p: *Parser) Error!bool { |
| 3391 | const def_index = @intFromEnum(Def.defnon_control_ascii); | |
| 3391 | const def_index = @backingInt(Def.defnon_control_ascii); | |
| 3392 | 3392 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 3393 | 3393 | p.depths[def_index] += 1; |
| 3394 | 3394 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -3407,7 +3407,7 @@ const Parser = struct { |
| 3407 | 3407 | }; |
| 3408 | 3408 | } |
| 3409 | 3409 | pub fn parsenon_control_utf8(p: *Parser) Error!bool { |
| 3410 | const def_index = @intFromEnum(Def.defnon_control_utf8); | |
| 3410 | const def_index = @backingInt(Def.defnon_control_utf8); | |
| 3411 | 3411 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 3412 | 3412 | p.depths[def_index] += 1; |
| 3413 | 3413 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -3427,7 +3427,7 @@ const Parser = struct { |
| 3427 | 3427 | }; |
| 3428 | 3428 | } |
| 3429 | 3429 | pub fn parsechar_char(p: *Parser) Error!bool { |
| 3430 | const def_index = @intFromEnum(Def.defchar_char); | |
| 3430 | const def_index = @backingInt(Def.defchar_char); | |
| 3431 | 3431 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 3432 | 3432 | p.depths[def_index] += 1; |
| 3433 | 3433 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -3467,7 +3467,7 @@ const Parser = struct { |
| 3467 | 3467 | }; |
| 3468 | 3468 | } |
| 3469 | 3469 | pub fn parsestring_char(p: *Parser) Error!bool { |
| 3470 | const def_index = @intFromEnum(Def.defstring_char); | |
| 3470 | const def_index = @backingInt(Def.defstring_char); | |
| 3471 | 3471 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 3472 | 3472 | p.depths[def_index] += 1; |
| 3473 | 3473 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -3507,7 +3507,7 @@ const Parser = struct { |
| 3507 | 3507 | }; |
| 3508 | 3508 | } |
| 3509 | 3509 | pub fn parsecontainer_doc_comment(p: *Parser) Error!bool { |
| 3510 | const def_index = @intFromEnum(Def.defcontainer_doc_comment); | |
| 3510 | const def_index = @backingInt(Def.defcontainer_doc_comment); | |
| 3511 | 3511 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 3512 | 3512 | p.depths[def_index] += 1; |
| 3513 | 3513 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -3546,7 +3546,7 @@ const Parser = struct { |
| 3546 | 3546 | }; |
| 3547 | 3547 | } |
| 3548 | 3548 | pub fn parsedoc_comment(p: *Parser) Error!bool { |
| 3549 | const def_index = @intFromEnum(Def.defdoc_comment); | |
| 3549 | const def_index = @backingInt(Def.defdoc_comment); | |
| 3550 | 3550 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 3551 | 3551 | p.depths[def_index] += 1; |
| 3552 | 3552 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -3592,7 +3592,7 @@ const Parser = struct { |
| 3592 | 3592 | }; |
| 3593 | 3593 | } |
| 3594 | 3594 | pub fn parseline_comment(p: *Parser) Error!bool { |
| 3595 | const def_index = @intFromEnum(Def.defline_comment); | |
| 3595 | const def_index = @backingInt(Def.defline_comment); | |
| 3596 | 3596 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 3597 | 3597 | p.depths[def_index] += 1; |
| 3598 | 3598 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -3645,7 +3645,7 @@ const Parser = struct { |
| 3645 | 3645 | }; |
| 3646 | 3646 | } |
| 3647 | 3647 | pub fn parseline_string(p: *Parser) Error!bool { |
| 3648 | const def_index = @intFromEnum(Def.defline_string); | |
| 3648 | const def_index = @backingInt(Def.defline_string); | |
| 3649 | 3649 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 3650 | 3650 | p.depths[def_index] += 1; |
| 3651 | 3651 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -3670,7 +3670,7 @@ const Parser = struct { |
| 3670 | 3670 | }; |
| 3671 | 3671 | } |
| 3672 | 3672 | pub fn parsenewline(p: *Parser) Error!bool { |
| 3673 | const def_index = @intFromEnum(Def.defnewline); | |
| 3673 | const def_index = @backingInt(Def.defnewline); | |
| 3674 | 3674 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 3675 | 3675 | p.depths[def_index] += 1; |
| 3676 | 3676 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -3708,7 +3708,7 @@ const Parser = struct { |
| 3708 | 3708 | }; |
| 3709 | 3709 | } |
| 3710 | 3710 | pub fn parseskip(p: *Parser) Error!bool { |
| 3711 | const def_index = @intFromEnum(Def.defskip); | |
| 3711 | const def_index = @backingInt(Def.defskip); | |
| 3712 | 3712 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 3713 | 3713 | p.depths[def_index] += 1; |
| 3714 | 3714 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -3744,7 +3744,7 @@ const Parser = struct { |
| 3744 | 3744 | }; |
| 3745 | 3745 | } |
| 3746 | 3746 | pub fn parseskip_require_newline(p: *Parser) Error!bool { |
| 3747 | const def_index = @intFromEnum(Def.defskip_require_newline); | |
| 3747 | const def_index = @backingInt(Def.defskip_require_newline); | |
| 3748 | 3748 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 3749 | 3749 | p.depths[def_index] += 1; |
| 3750 | 3750 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -3786,7 +3786,7 @@ const Parser = struct { |
| 3786 | 3786 | }; |
| 3787 | 3787 | } |
| 3788 | 3788 | pub fn parsepre_op_white(p: *Parser) Error!bool { |
| 3789 | const def_index = @intFromEnum(Def.defpre_op_white); | |
| 3789 | const def_index = @backingInt(Def.defpre_op_white); | |
| 3790 | 3790 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 3791 | 3791 | p.depths[def_index] += 1; |
| 3792 | 3792 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -3824,7 +3824,7 @@ const Parser = struct { |
| 3824 | 3824 | }; |
| 3825 | 3825 | } |
| 3826 | 3826 | pub fn parsepost_op_white(p: *Parser) Error!bool { |
| 3827 | const def_index = @intFromEnum(Def.defpost_op_white); | |
| 3827 | const def_index = @backingInt(Def.defpost_op_white); | |
| 3828 | 3828 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 3829 | 3829 | p.depths[def_index] += 1; |
| 3830 | 3830 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -3846,7 +3846,7 @@ const Parser = struct { |
| 3846 | 3846 | }; |
| 3847 | 3847 | } |
| 3848 | 3848 | pub fn parseCHAR_LITERAL(p: *Parser) Error!bool { |
| 3849 | const def_index = @intFromEnum(Def.defCHAR_LITERAL); | |
| 3849 | const def_index = @backingInt(Def.defCHAR_LITERAL); | |
| 3850 | 3850 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 3851 | 3851 | p.depths[def_index] += 1; |
| 3852 | 3852 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -3879,7 +3879,7 @@ const Parser = struct { |
| 3879 | 3879 | }; |
| 3880 | 3880 | } |
| 3881 | 3881 | pub fn parsedigit(p: *Parser) Error!bool { |
| 3882 | const def_index = @intFromEnum(Def.defdigit); | |
| 3882 | const def_index = @backingInt(Def.defdigit); | |
| 3883 | 3883 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 3884 | 3884 | p.depths[def_index] += 1; |
| 3885 | 3885 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -3905,7 +3905,7 @@ const Parser = struct { |
| 3905 | 3905 | }; |
| 3906 | 3906 | } |
| 3907 | 3907 | pub fn parsedigit_int(p: *Parser) Error!bool { |
| 3908 | const def_index = @intFromEnum(Def.defdigit_int); | |
| 3908 | const def_index = @backingInt(Def.defdigit_int); | |
| 3909 | 3909 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 3910 | 3910 | p.depths[def_index] += 1; |
| 3911 | 3911 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -3929,7 +3929,7 @@ const Parser = struct { |
| 3929 | 3929 | }; |
| 3930 | 3930 | } |
| 3931 | 3931 | pub fn parsedigit_float(p: *Parser) Error!bool { |
| 3932 | const def_index = @intFromEnum(Def.defdigit_float); | |
| 3932 | const def_index = @backingInt(Def.defdigit_float); | |
| 3933 | 3933 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 3934 | 3934 | p.depths[def_index] += 1; |
| 3935 | 3935 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -3961,7 +3961,7 @@ const Parser = struct { |
| 3961 | 3961 | }; |
| 3962 | 3962 | } |
| 3963 | 3963 | pub fn parseNUMBERLITERAL(p: *Parser) Error!bool { |
| 3964 | const def_index = @intFromEnum(Def.defNUMBERLITERAL); | |
| 3964 | const def_index = @backingInt(Def.defNUMBERLITERAL); | |
| 3965 | 3965 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 3966 | 3966 | p.depths[def_index] += 1; |
| 3967 | 3967 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -4018,7 +4018,7 @@ const Parser = struct { |
| 4018 | 4018 | }; |
| 4019 | 4019 | } |
| 4020 | 4020 | pub fn parsestring(p: *Parser) Error!bool { |
| 4021 | const def_index = @intFromEnum(Def.defstring); | |
| 4021 | const def_index = @backingInt(Def.defstring); | |
| 4022 | 4022 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 4023 | 4023 | p.depths[def_index] += 1; |
| 4024 | 4024 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -4051,7 +4051,7 @@ const Parser = struct { |
| 4051 | 4051 | }; |
| 4052 | 4052 | } |
| 4053 | 4053 | pub fn parseSTRINGLITERALSINGLE(p: *Parser) Error!bool { |
| 4054 | const def_index = @intFromEnum(Def.defSTRINGLITERALSINGLE); | |
| 4054 | const def_index = @backingInt(Def.defSTRINGLITERALSINGLE); | |
| 4055 | 4055 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 4056 | 4056 | p.depths[def_index] += 1; |
| 4057 | 4057 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -4063,7 +4063,7 @@ const Parser = struct { |
| 4063 | 4063 | }; |
| 4064 | 4064 | } |
| 4065 | 4065 | pub fn parseSTRINGLITERAL(p: *Parser) Error!bool { |
| 4066 | const def_index = @intFromEnum(Def.defSTRINGLITERAL); | |
| 4066 | const def_index = @backingInt(Def.defSTRINGLITERAL); | |
| 4067 | 4067 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 4068 | 4068 | p.depths[def_index] += 1; |
| 4069 | 4069 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -4091,7 +4091,7 @@ const Parser = struct { |
| 4091 | 4091 | }; |
| 4092 | 4092 | } |
| 4093 | 4093 | pub fn parseIDENTIFIER(p: *Parser) Error!bool { |
| 4094 | const def_index = @intFromEnum(Def.defIDENTIFIER); | |
| 4094 | const def_index = @backingInt(Def.defIDENTIFIER); | |
| 4095 | 4095 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 4096 | 4096 | p.depths[def_index] += 1; |
| 4097 | 4097 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -4142,7 +4142,7 @@ const Parser = struct { |
| 4142 | 4142 | }; |
| 4143 | 4143 | } |
| 4144 | 4144 | pub fn parseBUILTINIDENTIFIER(p: *Parser) Error!bool { |
| 4145 | const def_index = @intFromEnum(Def.defBUILTINIDENTIFIER); | |
| 4145 | const def_index = @backingInt(Def.defBUILTINIDENTIFIER); | |
| 4146 | 4146 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 4147 | 4147 | p.depths[def_index] += 1; |
| 4148 | 4148 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -4186,7 +4186,7 @@ const Parser = struct { |
| 4186 | 4186 | }; |
| 4187 | 4187 | } |
| 4188 | 4188 | pub fn parseAMPERSAND(p: *Parser) Error!bool { |
| 4189 | const def_index = @intFromEnum(Def.defAMPERSAND); | |
| 4189 | const def_index = @backingInt(Def.defAMPERSAND); | |
| 4190 | 4190 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 4191 | 4191 | p.depths[def_index] += 1; |
| 4192 | 4192 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -4216,7 +4216,7 @@ const Parser = struct { |
| 4216 | 4216 | }; |
| 4217 | 4217 | } |
| 4218 | 4218 | pub fn parseAMPERSANDEQUAL(p: *Parser) Error!bool { |
| 4219 | const def_index = @intFromEnum(Def.defAMPERSANDEQUAL); | |
| 4219 | const def_index = @backingInt(Def.defAMPERSANDEQUAL); | |
| 4220 | 4220 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 4221 | 4221 | p.depths[def_index] += 1; |
| 4222 | 4222 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -4234,7 +4234,7 @@ const Parser = struct { |
| 4234 | 4234 | }; |
| 4235 | 4235 | } |
| 4236 | 4236 | pub fn parseASTERISK(p: *Parser) Error!bool { |
| 4237 | const def_index = @intFromEnum(Def.defASTERISK); | |
| 4237 | const def_index = @backingInt(Def.defASTERISK); | |
| 4238 | 4238 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 4239 | 4239 | p.depths[def_index] += 1; |
| 4240 | 4240 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -4266,7 +4266,7 @@ const Parser = struct { |
| 4266 | 4266 | }; |
| 4267 | 4267 | } |
| 4268 | 4268 | pub fn parseASTERISKEQUAL(p: *Parser) Error!bool { |
| 4269 | const def_index = @intFromEnum(Def.defASTERISKEQUAL); | |
| 4269 | const def_index = @backingInt(Def.defASTERISKEQUAL); | |
| 4270 | 4270 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 4271 | 4271 | p.depths[def_index] += 1; |
| 4272 | 4272 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -4284,7 +4284,7 @@ const Parser = struct { |
| 4284 | 4284 | }; |
| 4285 | 4285 | } |
| 4286 | 4286 | pub fn parseASTERISKPERCENT(p: *Parser) Error!bool { |
| 4287 | const def_index = @intFromEnum(Def.defASTERISKPERCENT); | |
| 4287 | const def_index = @backingInt(Def.defASTERISKPERCENT); | |
| 4288 | 4288 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 4289 | 4289 | p.depths[def_index] += 1; |
| 4290 | 4290 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -4314,7 +4314,7 @@ const Parser = struct { |
| 4314 | 4314 | }; |
| 4315 | 4315 | } |
| 4316 | 4316 | pub fn parseASTERISKPERCENTEQUAL(p: *Parser) Error!bool { |
| 4317 | const def_index = @intFromEnum(Def.defASTERISKPERCENTEQUAL); | |
| 4317 | const def_index = @backingInt(Def.defASTERISKPERCENTEQUAL); | |
| 4318 | 4318 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 4319 | 4319 | p.depths[def_index] += 1; |
| 4320 | 4320 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -4332,7 +4332,7 @@ const Parser = struct { |
| 4332 | 4332 | }; |
| 4333 | 4333 | } |
| 4334 | 4334 | pub fn parseASTERISKPIPE(p: *Parser) Error!bool { |
| 4335 | const def_index = @intFromEnum(Def.defASTERISKPIPE); | |
| 4335 | const def_index = @backingInt(Def.defASTERISKPIPE); | |
| 4336 | 4336 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 4337 | 4337 | p.depths[def_index] += 1; |
| 4338 | 4338 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -4362,7 +4362,7 @@ const Parser = struct { |
| 4362 | 4362 | }; |
| 4363 | 4363 | } |
| 4364 | 4364 | pub fn parseASTERISKPIPEEQUAL(p: *Parser) Error!bool { |
| 4365 | const def_index = @intFromEnum(Def.defASTERISKPIPEEQUAL); | |
| 4365 | const def_index = @backingInt(Def.defASTERISKPIPEEQUAL); | |
| 4366 | 4366 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 4367 | 4367 | p.depths[def_index] += 1; |
| 4368 | 4368 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -4380,7 +4380,7 @@ const Parser = struct { |
| 4380 | 4380 | }; |
| 4381 | 4381 | } |
| 4382 | 4382 | pub fn parseCARET(p: *Parser) Error!bool { |
| 4383 | const def_index = @intFromEnum(Def.defCARET); | |
| 4383 | const def_index = @backingInt(Def.defCARET); | |
| 4384 | 4384 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 4385 | 4385 | p.depths[def_index] += 1; |
| 4386 | 4386 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -4410,7 +4410,7 @@ const Parser = struct { |
| 4410 | 4410 | }; |
| 4411 | 4411 | } |
| 4412 | 4412 | pub fn parseCARETEQUAL(p: *Parser) Error!bool { |
| 4413 | const def_index = @intFromEnum(Def.defCARETEQUAL); | |
| 4413 | const def_index = @backingInt(Def.defCARETEQUAL); | |
| 4414 | 4414 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 4415 | 4415 | p.depths[def_index] += 1; |
| 4416 | 4416 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -4428,7 +4428,7 @@ const Parser = struct { |
| 4428 | 4428 | }; |
| 4429 | 4429 | } |
| 4430 | 4430 | pub fn parseCOLON(p: *Parser) Error!bool { |
| 4431 | const def_index = @intFromEnum(Def.defCOLON); | |
| 4431 | const def_index = @backingInt(Def.defCOLON); | |
| 4432 | 4432 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 4433 | 4433 | p.depths[def_index] += 1; |
| 4434 | 4434 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -4446,7 +4446,7 @@ const Parser = struct { |
| 4446 | 4446 | }; |
| 4447 | 4447 | } |
| 4448 | 4448 | pub fn parseCOMMA(p: *Parser) Error!bool { |
| 4449 | const def_index = @intFromEnum(Def.defCOMMA); | |
| 4449 | const def_index = @backingInt(Def.defCOMMA); | |
| 4450 | 4450 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 4451 | 4451 | p.depths[def_index] += 1; |
| 4452 | 4452 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -4464,7 +4464,7 @@ const Parser = struct { |
| 4464 | 4464 | }; |
| 4465 | 4465 | } |
| 4466 | 4466 | pub fn parseDOT(p: *Parser) Error!bool { |
| 4467 | const def_index = @intFromEnum(Def.defDOT); | |
| 4467 | const def_index = @backingInt(Def.defDOT); | |
| 4468 | 4468 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 4469 | 4469 | p.depths[def_index] += 1; |
| 4470 | 4470 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -4495,7 +4495,7 @@ const Parser = struct { |
| 4495 | 4495 | }; |
| 4496 | 4496 | } |
| 4497 | 4497 | pub fn parseDOT2(p: *Parser) Error!bool { |
| 4498 | const def_index = @intFromEnum(Def.defDOT2); | |
| 4498 | const def_index = @backingInt(Def.defDOT2); | |
| 4499 | 4499 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 4500 | 4500 | p.depths[def_index] += 1; |
| 4501 | 4501 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -4525,7 +4525,7 @@ const Parser = struct { |
| 4525 | 4525 | }; |
| 4526 | 4526 | } |
| 4527 | 4527 | pub fn parseDOT3(p: *Parser) Error!bool { |
| 4528 | const def_index = @intFromEnum(Def.defDOT3); | |
| 4528 | const def_index = @backingInt(Def.defDOT3); | |
| 4529 | 4529 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 4530 | 4530 | p.depths[def_index] += 1; |
| 4531 | 4531 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -4543,7 +4543,7 @@ const Parser = struct { |
| 4543 | 4543 | }; |
| 4544 | 4544 | } |
| 4545 | 4545 | pub fn parseDOTASTERISK(p: *Parser) Error!bool { |
| 4546 | const def_index = @intFromEnum(Def.defDOTASTERISK); | |
| 4546 | const def_index = @backingInt(Def.defDOTASTERISK); | |
| 4547 | 4547 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 4548 | 4548 | p.depths[def_index] += 1; |
| 4549 | 4549 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -4561,7 +4561,7 @@ const Parser = struct { |
| 4561 | 4561 | }; |
| 4562 | 4562 | } |
| 4563 | 4563 | pub fn parseEQUAL(p: *Parser) Error!bool { |
| 4564 | const def_index = @intFromEnum(Def.defEQUAL); | |
| 4564 | const def_index = @backingInt(Def.defEQUAL); | |
| 4565 | 4565 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 4566 | 4566 | p.depths[def_index] += 1; |
| 4567 | 4567 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -4592,7 +4592,7 @@ const Parser = struct { |
| 4592 | 4592 | }; |
| 4593 | 4593 | } |
| 4594 | 4594 | pub fn parseEQUALEQUAL(p: *Parser) Error!bool { |
| 4595 | const def_index = @intFromEnum(Def.defEQUALEQUAL); | |
| 4595 | const def_index = @backingInt(Def.defEQUALEQUAL); | |
| 4596 | 4596 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 4597 | 4597 | p.depths[def_index] += 1; |
| 4598 | 4598 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -4610,7 +4610,7 @@ const Parser = struct { |
| 4610 | 4610 | }; |
| 4611 | 4611 | } |
| 4612 | 4612 | pub fn parseEQUALRARROW(p: *Parser) Error!bool { |
| 4613 | const def_index = @intFromEnum(Def.defEQUALRARROW); | |
| 4613 | const def_index = @backingInt(Def.defEQUALRARROW); | |
| 4614 | 4614 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 4615 | 4615 | p.depths[def_index] += 1; |
| 4616 | 4616 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -4628,7 +4628,7 @@ const Parser = struct { |
| 4628 | 4628 | }; |
| 4629 | 4629 | } |
| 4630 | 4630 | pub fn parseEXCLAMATIONMARK(p: *Parser) Error!bool { |
| 4631 | const def_index = @intFromEnum(Def.defEXCLAMATIONMARK); | |
| 4631 | const def_index = @backingInt(Def.defEXCLAMATIONMARK); | |
| 4632 | 4632 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 4633 | 4633 | p.depths[def_index] += 1; |
| 4634 | 4634 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -4658,7 +4658,7 @@ const Parser = struct { |
| 4658 | 4658 | }; |
| 4659 | 4659 | } |
| 4660 | 4660 | pub fn parseEXCLAMATIONMARKEQUAL(p: *Parser) Error!bool { |
| 4661 | const def_index = @intFromEnum(Def.defEXCLAMATIONMARKEQUAL); | |
| 4661 | const def_index = @backingInt(Def.defEXCLAMATIONMARKEQUAL); | |
| 4662 | 4662 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 4663 | 4663 | p.depths[def_index] += 1; |
| 4664 | 4664 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -4676,7 +4676,7 @@ const Parser = struct { |
| 4676 | 4676 | }; |
| 4677 | 4677 | } |
| 4678 | 4678 | pub fn parseLARROW(p: *Parser) Error!bool { |
| 4679 | const def_index = @intFromEnum(Def.defLARROW); | |
| 4679 | const def_index = @backingInt(Def.defLARROW); | |
| 4680 | 4680 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 4681 | 4681 | p.depths[def_index] += 1; |
| 4682 | 4682 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -4707,7 +4707,7 @@ const Parser = struct { |
| 4707 | 4707 | }; |
| 4708 | 4708 | } |
| 4709 | 4709 | pub fn parseLARROW2(p: *Parser) Error!bool { |
| 4710 | const def_index = @intFromEnum(Def.defLARROW2); | |
| 4710 | const def_index = @backingInt(Def.defLARROW2); | |
| 4711 | 4711 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 4712 | 4712 | p.depths[def_index] += 1; |
| 4713 | 4713 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -4738,7 +4738,7 @@ const Parser = struct { |
| 4738 | 4738 | }; |
| 4739 | 4739 | } |
| 4740 | 4740 | pub fn parseLARROW2EQUAL(p: *Parser) Error!bool { |
| 4741 | const def_index = @intFromEnum(Def.defLARROW2EQUAL); | |
| 4741 | const def_index = @backingInt(Def.defLARROW2EQUAL); | |
| 4742 | 4742 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 4743 | 4743 | p.depths[def_index] += 1; |
| 4744 | 4744 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -4756,7 +4756,7 @@ const Parser = struct { |
| 4756 | 4756 | }; |
| 4757 | 4757 | } |
| 4758 | 4758 | pub fn parseLARROW2PIPE(p: *Parser) Error!bool { |
| 4759 | const def_index = @intFromEnum(Def.defLARROW2PIPE); | |
| 4759 | const def_index = @backingInt(Def.defLARROW2PIPE); | |
| 4760 | 4760 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 4761 | 4761 | p.depths[def_index] += 1; |
| 4762 | 4762 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -4786,7 +4786,7 @@ const Parser = struct { |
| 4786 | 4786 | }; |
| 4787 | 4787 | } |
| 4788 | 4788 | pub fn parseLARROW2PIPEEQUAL(p: *Parser) Error!bool { |
| 4789 | const def_index = @intFromEnum(Def.defLARROW2PIPEEQUAL); | |
| 4789 | const def_index = @backingInt(Def.defLARROW2PIPEEQUAL); | |
| 4790 | 4790 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 4791 | 4791 | p.depths[def_index] += 1; |
| 4792 | 4792 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -4804,7 +4804,7 @@ const Parser = struct { |
| 4804 | 4804 | }; |
| 4805 | 4805 | } |
| 4806 | 4806 | pub fn parseLARROWEQUAL(p: *Parser) Error!bool { |
| 4807 | const def_index = @intFromEnum(Def.defLARROWEQUAL); | |
| 4807 | const def_index = @backingInt(Def.defLARROWEQUAL); | |
| 4808 | 4808 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 4809 | 4809 | p.depths[def_index] += 1; |
| 4810 | 4810 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -4822,7 +4822,7 @@ const Parser = struct { |
| 4822 | 4822 | }; |
| 4823 | 4823 | } |
| 4824 | 4824 | pub fn parseLBRACE(p: *Parser) Error!bool { |
| 4825 | const def_index = @intFromEnum(Def.defLBRACE); | |
| 4825 | const def_index = @backingInt(Def.defLBRACE); | |
| 4826 | 4826 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 4827 | 4827 | p.depths[def_index] += 1; |
| 4828 | 4828 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -4840,7 +4840,7 @@ const Parser = struct { |
| 4840 | 4840 | }; |
| 4841 | 4841 | } |
| 4842 | 4842 | pub fn parseLBRACKET(p: *Parser) Error!bool { |
| 4843 | const def_index = @intFromEnum(Def.defLBRACKET); | |
| 4843 | const def_index = @backingInt(Def.defLBRACKET); | |
| 4844 | 4844 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 4845 | 4845 | p.depths[def_index] += 1; |
| 4846 | 4846 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -4858,7 +4858,7 @@ const Parser = struct { |
| 4858 | 4858 | }; |
| 4859 | 4859 | } |
| 4860 | 4860 | pub fn parseLPAREN(p: *Parser) Error!bool { |
| 4861 | const def_index = @intFromEnum(Def.defLPAREN); | |
| 4861 | const def_index = @backingInt(Def.defLPAREN); | |
| 4862 | 4862 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 4863 | 4863 | p.depths[def_index] += 1; |
| 4864 | 4864 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -4876,7 +4876,7 @@ const Parser = struct { |
| 4876 | 4876 | }; |
| 4877 | 4877 | } |
| 4878 | 4878 | pub fn parseMINUS(p: *Parser) Error!bool { |
| 4879 | const def_index = @intFromEnum(Def.defMINUS); | |
| 4879 | const def_index = @backingInt(Def.defMINUS); | |
| 4880 | 4880 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 4881 | 4881 | p.depths[def_index] += 1; |
| 4882 | 4882 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -4909,7 +4909,7 @@ const Parser = struct { |
| 4909 | 4909 | }; |
| 4910 | 4910 | } |
| 4911 | 4911 | pub fn parseMINUSEQUAL(p: *Parser) Error!bool { |
| 4912 | const def_index = @intFromEnum(Def.defMINUSEQUAL); | |
| 4912 | const def_index = @backingInt(Def.defMINUSEQUAL); | |
| 4913 | 4913 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 4914 | 4914 | p.depths[def_index] += 1; |
| 4915 | 4915 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -4927,7 +4927,7 @@ const Parser = struct { |
| 4927 | 4927 | }; |
| 4928 | 4928 | } |
| 4929 | 4929 | pub fn parseMINUSPERCENT(p: *Parser) Error!bool { |
| 4930 | const def_index = @intFromEnum(Def.defMINUSPERCENT); | |
| 4930 | const def_index = @backingInt(Def.defMINUSPERCENT); | |
| 4931 | 4931 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 4932 | 4932 | p.depths[def_index] += 1; |
| 4933 | 4933 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -4957,7 +4957,7 @@ const Parser = struct { |
| 4957 | 4957 | }; |
| 4958 | 4958 | } |
| 4959 | 4959 | pub fn parseMINUSPERCENTEQUAL(p: *Parser) Error!bool { |
| 4960 | const def_index = @intFromEnum(Def.defMINUSPERCENTEQUAL); | |
| 4960 | const def_index = @backingInt(Def.defMINUSPERCENTEQUAL); | |
| 4961 | 4961 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 4962 | 4962 | p.depths[def_index] += 1; |
| 4963 | 4963 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -4975,7 +4975,7 @@ const Parser = struct { |
| 4975 | 4975 | }; |
| 4976 | 4976 | } |
| 4977 | 4977 | pub fn parseMINUSPIPE(p: *Parser) Error!bool { |
| 4978 | const def_index = @intFromEnum(Def.defMINUSPIPE); | |
| 4978 | const def_index = @backingInt(Def.defMINUSPIPE); | |
| 4979 | 4979 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 4980 | 4980 | p.depths[def_index] += 1; |
| 4981 | 4981 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -5005,7 +5005,7 @@ const Parser = struct { |
| 5005 | 5005 | }; |
| 5006 | 5006 | } |
| 5007 | 5007 | pub fn parseMINUSPIPEEQUAL(p: *Parser) Error!bool { |
| 5008 | const def_index = @intFromEnum(Def.defMINUSPIPEEQUAL); | |
| 5008 | const def_index = @backingInt(Def.defMINUSPIPEEQUAL); | |
| 5009 | 5009 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5010 | 5010 | p.depths[def_index] += 1; |
| 5011 | 5011 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -5023,7 +5023,7 @@ const Parser = struct { |
| 5023 | 5023 | }; |
| 5024 | 5024 | } |
| 5025 | 5025 | pub fn parseMINUSRARROW(p: *Parser) Error!bool { |
| 5026 | const def_index = @intFromEnum(Def.defMINUSRARROW); | |
| 5026 | const def_index = @backingInt(Def.defMINUSRARROW); | |
| 5027 | 5027 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5028 | 5028 | p.depths[def_index] += 1; |
| 5029 | 5029 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -5041,7 +5041,7 @@ const Parser = struct { |
| 5041 | 5041 | }; |
| 5042 | 5042 | } |
| 5043 | 5043 | pub fn parsePERCENT(p: *Parser) Error!bool { |
| 5044 | const def_index = @intFromEnum(Def.defPERCENT); | |
| 5044 | const def_index = @backingInt(Def.defPERCENT); | |
| 5045 | 5045 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5046 | 5046 | p.depths[def_index] += 1; |
| 5047 | 5047 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -5071,7 +5071,7 @@ const Parser = struct { |
| 5071 | 5071 | }; |
| 5072 | 5072 | } |
| 5073 | 5073 | pub fn parsePERCENTEQUAL(p: *Parser) Error!bool { |
| 5074 | const def_index = @intFromEnum(Def.defPERCENTEQUAL); | |
| 5074 | const def_index = @backingInt(Def.defPERCENTEQUAL); | |
| 5075 | 5075 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5076 | 5076 | p.depths[def_index] += 1; |
| 5077 | 5077 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -5089,7 +5089,7 @@ const Parser = struct { |
| 5089 | 5089 | }; |
| 5090 | 5090 | } |
| 5091 | 5091 | pub fn parsePIPE(p: *Parser) Error!bool { |
| 5092 | const def_index = @intFromEnum(Def.defPIPE); | |
| 5092 | const def_index = @backingInt(Def.defPIPE); | |
| 5093 | 5093 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5094 | 5094 | p.depths[def_index] += 1; |
| 5095 | 5095 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -5120,7 +5120,7 @@ const Parser = struct { |
| 5120 | 5120 | }; |
| 5121 | 5121 | } |
| 5122 | 5122 | pub fn parsePIPE2(p: *Parser) Error!bool { |
| 5123 | const def_index = @intFromEnum(Def.defPIPE2); | |
| 5123 | const def_index = @backingInt(Def.defPIPE2); | |
| 5124 | 5124 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5125 | 5125 | p.depths[def_index] += 1; |
| 5126 | 5126 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -5138,7 +5138,7 @@ const Parser = struct { |
| 5138 | 5138 | }; |
| 5139 | 5139 | } |
| 5140 | 5140 | pub fn parsePIPEEQUAL(p: *Parser) Error!bool { |
| 5141 | const def_index = @intFromEnum(Def.defPIPEEQUAL); | |
| 5141 | const def_index = @backingInt(Def.defPIPEEQUAL); | |
| 5142 | 5142 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5143 | 5143 | p.depths[def_index] += 1; |
| 5144 | 5144 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -5156,7 +5156,7 @@ const Parser = struct { |
| 5156 | 5156 | }; |
| 5157 | 5157 | } |
| 5158 | 5158 | pub fn parsePLUS(p: *Parser) Error!bool { |
| 5159 | const def_index = @intFromEnum(Def.defPLUS); | |
| 5159 | const def_index = @backingInt(Def.defPLUS); | |
| 5160 | 5160 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5161 | 5161 | p.depths[def_index] += 1; |
| 5162 | 5162 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -5189,7 +5189,7 @@ const Parser = struct { |
| 5189 | 5189 | }; |
| 5190 | 5190 | } |
| 5191 | 5191 | pub fn parsePLUS2(p: *Parser) Error!bool { |
| 5192 | const def_index = @intFromEnum(Def.defPLUS2); | |
| 5192 | const def_index = @backingInt(Def.defPLUS2); | |
| 5193 | 5193 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5194 | 5194 | p.depths[def_index] += 1; |
| 5195 | 5195 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -5207,7 +5207,7 @@ const Parser = struct { |
| 5207 | 5207 | }; |
| 5208 | 5208 | } |
| 5209 | 5209 | pub fn parsePLUSEQUAL(p: *Parser) Error!bool { |
| 5210 | const def_index = @intFromEnum(Def.defPLUSEQUAL); | |
| 5210 | const def_index = @backingInt(Def.defPLUSEQUAL); | |
| 5211 | 5211 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5212 | 5212 | p.depths[def_index] += 1; |
| 5213 | 5213 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -5225,7 +5225,7 @@ const Parser = struct { |
| 5225 | 5225 | }; |
| 5226 | 5226 | } |
| 5227 | 5227 | pub fn parsePLUSPERCENT(p: *Parser) Error!bool { |
| 5228 | const def_index = @intFromEnum(Def.defPLUSPERCENT); | |
| 5228 | const def_index = @backingInt(Def.defPLUSPERCENT); | |
| 5229 | 5229 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5230 | 5230 | p.depths[def_index] += 1; |
| 5231 | 5231 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -5255,7 +5255,7 @@ const Parser = struct { |
| 5255 | 5255 | }; |
| 5256 | 5256 | } |
| 5257 | 5257 | pub fn parsePLUSPERCENTEQUAL(p: *Parser) Error!bool { |
| 5258 | const def_index = @intFromEnum(Def.defPLUSPERCENTEQUAL); | |
| 5258 | const def_index = @backingInt(Def.defPLUSPERCENTEQUAL); | |
| 5259 | 5259 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5260 | 5260 | p.depths[def_index] += 1; |
| 5261 | 5261 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -5273,7 +5273,7 @@ const Parser = struct { |
| 5273 | 5273 | }; |
| 5274 | 5274 | } |
| 5275 | 5275 | pub fn parsePLUSPIPE(p: *Parser) Error!bool { |
| 5276 | const def_index = @intFromEnum(Def.defPLUSPIPE); | |
| 5276 | const def_index = @backingInt(Def.defPLUSPIPE); | |
| 5277 | 5277 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5278 | 5278 | p.depths[def_index] += 1; |
| 5279 | 5279 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -5303,7 +5303,7 @@ const Parser = struct { |
| 5303 | 5303 | }; |
| 5304 | 5304 | } |
| 5305 | 5305 | pub fn parsePLUSPIPEEQUAL(p: *Parser) Error!bool { |
| 5306 | const def_index = @intFromEnum(Def.defPLUSPIPEEQUAL); | |
| 5306 | const def_index = @backingInt(Def.defPLUSPIPEEQUAL); | |
| 5307 | 5307 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5308 | 5308 | p.depths[def_index] += 1; |
| 5309 | 5309 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -5321,7 +5321,7 @@ const Parser = struct { |
| 5321 | 5321 | }; |
| 5322 | 5322 | } |
| 5323 | 5323 | pub fn parseLETTERC(p: *Parser) Error!bool { |
| 5324 | const def_index = @intFromEnum(Def.defLETTERC); | |
| 5324 | const def_index = @backingInt(Def.defLETTERC); | |
| 5325 | 5325 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5326 | 5326 | p.depths[def_index] += 1; |
| 5327 | 5327 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -5339,7 +5339,7 @@ const Parser = struct { |
| 5339 | 5339 | }; |
| 5340 | 5340 | } |
| 5341 | 5341 | pub fn parseQUESTIONMARK(p: *Parser) Error!bool { |
| 5342 | const def_index = @intFromEnum(Def.defQUESTIONMARK); | |
| 5342 | const def_index = @backingInt(Def.defQUESTIONMARK); | |
| 5343 | 5343 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5344 | 5344 | p.depths[def_index] += 1; |
| 5345 | 5345 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -5357,7 +5357,7 @@ const Parser = struct { |
| 5357 | 5357 | }; |
| 5358 | 5358 | } |
| 5359 | 5359 | pub fn parseRARROW(p: *Parser) Error!bool { |
| 5360 | const def_index = @intFromEnum(Def.defRARROW); | |
| 5360 | const def_index = @backingInt(Def.defRARROW); | |
| 5361 | 5361 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5362 | 5362 | p.depths[def_index] += 1; |
| 5363 | 5363 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -5388,7 +5388,7 @@ const Parser = struct { |
| 5388 | 5388 | }; |
| 5389 | 5389 | } |
| 5390 | 5390 | pub fn parseRARROW2(p: *Parser) Error!bool { |
| 5391 | const def_index = @intFromEnum(Def.defRARROW2); | |
| 5391 | const def_index = @backingInt(Def.defRARROW2); | |
| 5392 | 5392 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5393 | 5393 | p.depths[def_index] += 1; |
| 5394 | 5394 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -5418,7 +5418,7 @@ const Parser = struct { |
| 5418 | 5418 | }; |
| 5419 | 5419 | } |
| 5420 | 5420 | pub fn parseRARROW2EQUAL(p: *Parser) Error!bool { |
| 5421 | const def_index = @intFromEnum(Def.defRARROW2EQUAL); | |
| 5421 | const def_index = @backingInt(Def.defRARROW2EQUAL); | |
| 5422 | 5422 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5423 | 5423 | p.depths[def_index] += 1; |
| 5424 | 5424 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -5436,7 +5436,7 @@ const Parser = struct { |
| 5436 | 5436 | }; |
| 5437 | 5437 | } |
| 5438 | 5438 | pub fn parseRARROWEQUAL(p: *Parser) Error!bool { |
| 5439 | const def_index = @intFromEnum(Def.defRARROWEQUAL); | |
| 5439 | const def_index = @backingInt(Def.defRARROWEQUAL); | |
| 5440 | 5440 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5441 | 5441 | p.depths[def_index] += 1; |
| 5442 | 5442 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -5454,7 +5454,7 @@ const Parser = struct { |
| 5454 | 5454 | }; |
| 5455 | 5455 | } |
| 5456 | 5456 | pub fn parseRBRACE(p: *Parser) Error!bool { |
| 5457 | const def_index = @intFromEnum(Def.defRBRACE); | |
| 5457 | const def_index = @backingInt(Def.defRBRACE); | |
| 5458 | 5458 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5459 | 5459 | p.depths[def_index] += 1; |
| 5460 | 5460 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -5472,7 +5472,7 @@ const Parser = struct { |
| 5472 | 5472 | }; |
| 5473 | 5473 | } |
| 5474 | 5474 | pub fn parseRBRACKET(p: *Parser) Error!bool { |
| 5475 | const def_index = @intFromEnum(Def.defRBRACKET); | |
| 5475 | const def_index = @backingInt(Def.defRBRACKET); | |
| 5476 | 5476 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5477 | 5477 | p.depths[def_index] += 1; |
| 5478 | 5478 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -5490,7 +5490,7 @@ const Parser = struct { |
| 5490 | 5490 | }; |
| 5491 | 5491 | } |
| 5492 | 5492 | pub fn parseRPAREN(p: *Parser) Error!bool { |
| 5493 | const def_index = @intFromEnum(Def.defRPAREN); | |
| 5493 | const def_index = @backingInt(Def.defRPAREN); | |
| 5494 | 5494 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5495 | 5495 | p.depths[def_index] += 1; |
| 5496 | 5496 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -5508,7 +5508,7 @@ const Parser = struct { |
| 5508 | 5508 | }; |
| 5509 | 5509 | } |
| 5510 | 5510 | pub fn parseSEMICOLON(p: *Parser) Error!bool { |
| 5511 | const def_index = @intFromEnum(Def.defSEMICOLON); | |
| 5511 | const def_index = @backingInt(Def.defSEMICOLON); | |
| 5512 | 5512 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5513 | 5513 | p.depths[def_index] += 1; |
| 5514 | 5514 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -5526,7 +5526,7 @@ const Parser = struct { |
| 5526 | 5526 | }; |
| 5527 | 5527 | } |
| 5528 | 5528 | pub fn parseSLASH(p: *Parser) Error!bool { |
| 5529 | const def_index = @intFromEnum(Def.defSLASH); | |
| 5529 | const def_index = @backingInt(Def.defSLASH); | |
| 5530 | 5530 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5531 | 5531 | p.depths[def_index] += 1; |
| 5532 | 5532 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -5557,7 +5557,7 @@ const Parser = struct { |
| 5557 | 5557 | }; |
| 5558 | 5558 | } |
| 5559 | 5559 | pub fn parseSLASHEQUAL(p: *Parser) Error!bool { |
| 5560 | const def_index = @intFromEnum(Def.defSLASHEQUAL); | |
| 5560 | const def_index = @backingInt(Def.defSLASHEQUAL); | |
| 5561 | 5561 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5562 | 5562 | p.depths[def_index] += 1; |
| 5563 | 5563 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -5575,7 +5575,7 @@ const Parser = struct { |
| 5575 | 5575 | }; |
| 5576 | 5576 | } |
| 5577 | 5577 | pub fn parseTILDE(p: *Parser) Error!bool { |
| 5578 | const def_index = @intFromEnum(Def.defTILDE); | |
| 5578 | const def_index = @backingInt(Def.defTILDE); | |
| 5579 | 5579 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5580 | 5580 | p.depths[def_index] += 1; |
| 5581 | 5581 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -5593,7 +5593,7 @@ const Parser = struct { |
| 5593 | 5593 | }; |
| 5594 | 5594 | } |
| 5595 | 5595 | pub fn parseend_of_word(p: *Parser) Error!bool { |
| 5596 | const def_index = @intFromEnum(Def.defend_of_word); | |
| 5596 | const def_index = @backingInt(Def.defend_of_word); | |
| 5597 | 5597 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5598 | 5598 | p.depths[def_index] += 1; |
| 5599 | 5599 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -5620,7 +5620,7 @@ const Parser = struct { |
| 5620 | 5620 | }; |
| 5621 | 5621 | } |
| 5622 | 5622 | pub fn parseKEYWORD_addrspace(p: *Parser) Error!bool { |
| 5623 | const def_index = @intFromEnum(Def.defKEYWORD_addrspace); | |
| 5623 | const def_index = @backingInt(Def.defKEYWORD_addrspace); | |
| 5624 | 5624 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5625 | 5625 | p.depths[def_index] += 1; |
| 5626 | 5626 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -5638,7 +5638,7 @@ const Parser = struct { |
| 5638 | 5638 | }; |
| 5639 | 5639 | } |
| 5640 | 5640 | pub fn parseKEYWORD_align(p: *Parser) Error!bool { |
| 5641 | const def_index = @intFromEnum(Def.defKEYWORD_align); | |
| 5641 | const def_index = @backingInt(Def.defKEYWORD_align); | |
| 5642 | 5642 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5643 | 5643 | p.depths[def_index] += 1; |
| 5644 | 5644 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -5656,7 +5656,7 @@ const Parser = struct { |
| 5656 | 5656 | }; |
| 5657 | 5657 | } |
| 5658 | 5658 | pub fn parseKEYWORD_allowzero(p: *Parser) Error!bool { |
| 5659 | const def_index = @intFromEnum(Def.defKEYWORD_allowzero); | |
| 5659 | const def_index = @backingInt(Def.defKEYWORD_allowzero); | |
| 5660 | 5660 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5661 | 5661 | p.depths[def_index] += 1; |
| 5662 | 5662 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -5674,7 +5674,7 @@ const Parser = struct { |
| 5674 | 5674 | }; |
| 5675 | 5675 | } |
| 5676 | 5676 | pub fn parseKEYWORD_and(p: *Parser) Error!bool { |
| 5677 | const def_index = @intFromEnum(Def.defKEYWORD_and); | |
| 5677 | const def_index = @backingInt(Def.defKEYWORD_and); | |
| 5678 | 5678 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5679 | 5679 | p.depths[def_index] += 1; |
| 5680 | 5680 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -5692,7 +5692,7 @@ const Parser = struct { |
| 5692 | 5692 | }; |
| 5693 | 5693 | } |
| 5694 | 5694 | pub fn parseKEYWORD_anyframe(p: *Parser) Error!bool { |
| 5695 | const def_index = @intFromEnum(Def.defKEYWORD_anyframe); | |
| 5695 | const def_index = @backingInt(Def.defKEYWORD_anyframe); | |
| 5696 | 5696 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5697 | 5697 | p.depths[def_index] += 1; |
| 5698 | 5698 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -5710,7 +5710,7 @@ const Parser = struct { |
| 5710 | 5710 | }; |
| 5711 | 5711 | } |
| 5712 | 5712 | pub fn parseKEYWORD_anytype(p: *Parser) Error!bool { |
| 5713 | const def_index = @intFromEnum(Def.defKEYWORD_anytype); | |
| 5713 | const def_index = @backingInt(Def.defKEYWORD_anytype); | |
| 5714 | 5714 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5715 | 5715 | p.depths[def_index] += 1; |
| 5716 | 5716 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -5728,7 +5728,7 @@ const Parser = struct { |
| 5728 | 5728 | }; |
| 5729 | 5729 | } |
| 5730 | 5730 | pub fn parseKEYWORD_asm(p: *Parser) Error!bool { |
| 5731 | const def_index = @intFromEnum(Def.defKEYWORD_asm); | |
| 5731 | const def_index = @backingInt(Def.defKEYWORD_asm); | |
| 5732 | 5732 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5733 | 5733 | p.depths[def_index] += 1; |
| 5734 | 5734 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -5746,7 +5746,7 @@ const Parser = struct { |
| 5746 | 5746 | }; |
| 5747 | 5747 | } |
| 5748 | 5748 | pub fn parseKEYWORD_break(p: *Parser) Error!bool { |
| 5749 | const def_index = @intFromEnum(Def.defKEYWORD_break); | |
| 5749 | const def_index = @backingInt(Def.defKEYWORD_break); | |
| 5750 | 5750 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5751 | 5751 | p.depths[def_index] += 1; |
| 5752 | 5752 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -5764,7 +5764,7 @@ const Parser = struct { |
| 5764 | 5764 | }; |
| 5765 | 5765 | } |
| 5766 | 5766 | pub fn parseKEYWORD_callconv(p: *Parser) Error!bool { |
| 5767 | const def_index = @intFromEnum(Def.defKEYWORD_callconv); | |
| 5767 | const def_index = @backingInt(Def.defKEYWORD_callconv); | |
| 5768 | 5768 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5769 | 5769 | p.depths[def_index] += 1; |
| 5770 | 5770 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -5782,7 +5782,7 @@ const Parser = struct { |
| 5782 | 5782 | }; |
| 5783 | 5783 | } |
| 5784 | 5784 | pub fn parseKEYWORD_catch(p: *Parser) Error!bool { |
| 5785 | const def_index = @intFromEnum(Def.defKEYWORD_catch); | |
| 5785 | const def_index = @backingInt(Def.defKEYWORD_catch); | |
| 5786 | 5786 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5787 | 5787 | p.depths[def_index] += 1; |
| 5788 | 5788 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -5800,7 +5800,7 @@ const Parser = struct { |
| 5800 | 5800 | }; |
| 5801 | 5801 | } |
| 5802 | 5802 | pub fn parseKEYWORD_comptime(p: *Parser) Error!bool { |
| 5803 | const def_index = @intFromEnum(Def.defKEYWORD_comptime); | |
| 5803 | const def_index = @backingInt(Def.defKEYWORD_comptime); | |
| 5804 | 5804 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5805 | 5805 | p.depths[def_index] += 1; |
| 5806 | 5806 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -5818,7 +5818,7 @@ const Parser = struct { |
| 5818 | 5818 | }; |
| 5819 | 5819 | } |
| 5820 | 5820 | pub fn parseKEYWORD_const(p: *Parser) Error!bool { |
| 5821 | const def_index = @intFromEnum(Def.defKEYWORD_const); | |
| 5821 | const def_index = @backingInt(Def.defKEYWORD_const); | |
| 5822 | 5822 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5823 | 5823 | p.depths[def_index] += 1; |
| 5824 | 5824 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -5836,7 +5836,7 @@ const Parser = struct { |
| 5836 | 5836 | }; |
| 5837 | 5837 | } |
| 5838 | 5838 | pub fn parseKEYWORD_continue(p: *Parser) Error!bool { |
| 5839 | const def_index = @intFromEnum(Def.defKEYWORD_continue); | |
| 5839 | const def_index = @backingInt(Def.defKEYWORD_continue); | |
| 5840 | 5840 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5841 | 5841 | p.depths[def_index] += 1; |
| 5842 | 5842 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -5854,7 +5854,7 @@ const Parser = struct { |
| 5854 | 5854 | }; |
| 5855 | 5855 | } |
| 5856 | 5856 | pub fn parseKEYWORD_defer(p: *Parser) Error!bool { |
| 5857 | const def_index = @intFromEnum(Def.defKEYWORD_defer); | |
| 5857 | const def_index = @backingInt(Def.defKEYWORD_defer); | |
| 5858 | 5858 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5859 | 5859 | p.depths[def_index] += 1; |
| 5860 | 5860 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -5872,7 +5872,7 @@ const Parser = struct { |
| 5872 | 5872 | }; |
| 5873 | 5873 | } |
| 5874 | 5874 | pub fn parseKEYWORD_else(p: *Parser) Error!bool { |
| 5875 | const def_index = @intFromEnum(Def.defKEYWORD_else); | |
| 5875 | const def_index = @backingInt(Def.defKEYWORD_else); | |
| 5876 | 5876 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5877 | 5877 | p.depths[def_index] += 1; |
| 5878 | 5878 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -5890,7 +5890,7 @@ const Parser = struct { |
| 5890 | 5890 | }; |
| 5891 | 5891 | } |
| 5892 | 5892 | pub fn parseKEYWORD_enum(p: *Parser) Error!bool { |
| 5893 | const def_index = @intFromEnum(Def.defKEYWORD_enum); | |
| 5893 | const def_index = @backingInt(Def.defKEYWORD_enum); | |
| 5894 | 5894 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5895 | 5895 | p.depths[def_index] += 1; |
| 5896 | 5896 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -5908,7 +5908,7 @@ const Parser = struct { |
| 5908 | 5908 | }; |
| 5909 | 5909 | } |
| 5910 | 5910 | pub fn parseKEYWORD_errdefer(p: *Parser) Error!bool { |
| 5911 | const def_index = @intFromEnum(Def.defKEYWORD_errdefer); | |
| 5911 | const def_index = @backingInt(Def.defKEYWORD_errdefer); | |
| 5912 | 5912 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5913 | 5913 | p.depths[def_index] += 1; |
| 5914 | 5914 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -5926,7 +5926,7 @@ const Parser = struct { |
| 5926 | 5926 | }; |
| 5927 | 5927 | } |
| 5928 | 5928 | pub fn parseKEYWORD_error(p: *Parser) Error!bool { |
| 5929 | const def_index = @intFromEnum(Def.defKEYWORD_error); | |
| 5929 | const def_index = @backingInt(Def.defKEYWORD_error); | |
| 5930 | 5930 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5931 | 5931 | p.depths[def_index] += 1; |
| 5932 | 5932 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -5944,7 +5944,7 @@ const Parser = struct { |
| 5944 | 5944 | }; |
| 5945 | 5945 | } |
| 5946 | 5946 | pub fn parseKEYWORD_export(p: *Parser) Error!bool { |
| 5947 | const def_index = @intFromEnum(Def.defKEYWORD_export); | |
| 5947 | const def_index = @backingInt(Def.defKEYWORD_export); | |
| 5948 | 5948 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5949 | 5949 | p.depths[def_index] += 1; |
| 5950 | 5950 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -5962,7 +5962,7 @@ const Parser = struct { |
| 5962 | 5962 | }; |
| 5963 | 5963 | } |
| 5964 | 5964 | pub fn parseKEYWORD_extern(p: *Parser) Error!bool { |
| 5965 | const def_index = @intFromEnum(Def.defKEYWORD_extern); | |
| 5965 | const def_index = @backingInt(Def.defKEYWORD_extern); | |
| 5966 | 5966 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5967 | 5967 | p.depths[def_index] += 1; |
| 5968 | 5968 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -5980,7 +5980,7 @@ const Parser = struct { |
| 5980 | 5980 | }; |
| 5981 | 5981 | } |
| 5982 | 5982 | pub fn parseKEYWORD_fn(p: *Parser) Error!bool { |
| 5983 | const def_index = @intFromEnum(Def.defKEYWORD_fn); | |
| 5983 | const def_index = @backingInt(Def.defKEYWORD_fn); | |
| 5984 | 5984 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5985 | 5985 | p.depths[def_index] += 1; |
| 5986 | 5986 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -5998,7 +5998,7 @@ const Parser = struct { |
| 5998 | 5998 | }; |
| 5999 | 5999 | } |
| 6000 | 6000 | pub fn parseKEYWORD_for(p: *Parser) Error!bool { |
| 6001 | const def_index = @intFromEnum(Def.defKEYWORD_for); | |
| 6001 | const def_index = @backingInt(Def.defKEYWORD_for); | |
| 6002 | 6002 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 6003 | 6003 | p.depths[def_index] += 1; |
| 6004 | 6004 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -6016,7 +6016,7 @@ const Parser = struct { |
| 6016 | 6016 | }; |
| 6017 | 6017 | } |
| 6018 | 6018 | pub fn parseKEYWORD_if(p: *Parser) Error!bool { |
| 6019 | const def_index = @intFromEnum(Def.defKEYWORD_if); | |
| 6019 | const def_index = @backingInt(Def.defKEYWORD_if); | |
| 6020 | 6020 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 6021 | 6021 | p.depths[def_index] += 1; |
| 6022 | 6022 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -6034,7 +6034,7 @@ const Parser = struct { |
| 6034 | 6034 | }; |
| 6035 | 6035 | } |
| 6036 | 6036 | pub fn parseKEYWORD_inline(p: *Parser) Error!bool { |
| 6037 | const def_index = @intFromEnum(Def.defKEYWORD_inline); | |
| 6037 | const def_index = @backingInt(Def.defKEYWORD_inline); | |
| 6038 | 6038 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 6039 | 6039 | p.depths[def_index] += 1; |
| 6040 | 6040 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -6052,7 +6052,7 @@ const Parser = struct { |
| 6052 | 6052 | }; |
| 6053 | 6053 | } |
| 6054 | 6054 | pub fn parseKEYWORD_noalias(p: *Parser) Error!bool { |
| 6055 | const def_index = @intFromEnum(Def.defKEYWORD_noalias); | |
| 6055 | const def_index = @backingInt(Def.defKEYWORD_noalias); | |
| 6056 | 6056 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 6057 | 6057 | p.depths[def_index] += 1; |
| 6058 | 6058 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -6070,7 +6070,7 @@ const Parser = struct { |
| 6070 | 6070 | }; |
| 6071 | 6071 | } |
| 6072 | 6072 | pub fn parseKEYWORD_nosuspend(p: *Parser) Error!bool { |
| 6073 | const def_index = @intFromEnum(Def.defKEYWORD_nosuspend); | |
| 6073 | const def_index = @backingInt(Def.defKEYWORD_nosuspend); | |
| 6074 | 6074 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 6075 | 6075 | p.depths[def_index] += 1; |
| 6076 | 6076 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -6088,7 +6088,7 @@ const Parser = struct { |
| 6088 | 6088 | }; |
| 6089 | 6089 | } |
| 6090 | 6090 | pub fn parseKEYWORD_noinline(p: *Parser) Error!bool { |
| 6091 | const def_index = @intFromEnum(Def.defKEYWORD_noinline); | |
| 6091 | const def_index = @backingInt(Def.defKEYWORD_noinline); | |
| 6092 | 6092 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 6093 | 6093 | p.depths[def_index] += 1; |
| 6094 | 6094 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -6106,7 +6106,7 @@ const Parser = struct { |
| 6106 | 6106 | }; |
| 6107 | 6107 | } |
| 6108 | 6108 | pub fn parseKEYWORD_opaque(p: *Parser) Error!bool { |
| 6109 | const def_index = @intFromEnum(Def.defKEYWORD_opaque); | |
| 6109 | const def_index = @backingInt(Def.defKEYWORD_opaque); | |
| 6110 | 6110 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 6111 | 6111 | p.depths[def_index] += 1; |
| 6112 | 6112 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -6124,7 +6124,7 @@ const Parser = struct { |
| 6124 | 6124 | }; |
| 6125 | 6125 | } |
| 6126 | 6126 | pub fn parseKEYWORD_or(p: *Parser) Error!bool { |
| 6127 | const def_index = @intFromEnum(Def.defKEYWORD_or); | |
| 6127 | const def_index = @backingInt(Def.defKEYWORD_or); | |
| 6128 | 6128 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 6129 | 6129 | p.depths[def_index] += 1; |
| 6130 | 6130 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -6142,7 +6142,7 @@ const Parser = struct { |
| 6142 | 6142 | }; |
| 6143 | 6143 | } |
| 6144 | 6144 | pub fn parseKEYWORD_orelse(p: *Parser) Error!bool { |
| 6145 | const def_index = @intFromEnum(Def.defKEYWORD_orelse); | |
| 6145 | const def_index = @backingInt(Def.defKEYWORD_orelse); | |
| 6146 | 6146 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 6147 | 6147 | p.depths[def_index] += 1; |
| 6148 | 6148 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -6160,7 +6160,7 @@ const Parser = struct { |
| 6160 | 6160 | }; |
| 6161 | 6161 | } |
| 6162 | 6162 | pub fn parseKEYWORD_packed(p: *Parser) Error!bool { |
| 6163 | const def_index = @intFromEnum(Def.defKEYWORD_packed); | |
| 6163 | const def_index = @backingInt(Def.defKEYWORD_packed); | |
| 6164 | 6164 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 6165 | 6165 | p.depths[def_index] += 1; |
| 6166 | 6166 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -6178,7 +6178,7 @@ const Parser = struct { |
| 6178 | 6178 | }; |
| 6179 | 6179 | } |
| 6180 | 6180 | pub fn parseKEYWORD_pub(p: *Parser) Error!bool { |
| 6181 | const def_index = @intFromEnum(Def.defKEYWORD_pub); | |
| 6181 | const def_index = @backingInt(Def.defKEYWORD_pub); | |
| 6182 | 6182 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 6183 | 6183 | p.depths[def_index] += 1; |
| 6184 | 6184 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -6196,7 +6196,7 @@ const Parser = struct { |
| 6196 | 6196 | }; |
| 6197 | 6197 | } |
| 6198 | 6198 | pub fn parseKEYWORD_resume(p: *Parser) Error!bool { |
| 6199 | const def_index = @intFromEnum(Def.defKEYWORD_resume); | |
| 6199 | const def_index = @backingInt(Def.defKEYWORD_resume); | |
| 6200 | 6200 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 6201 | 6201 | p.depths[def_index] += 1; |
| 6202 | 6202 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -6214,7 +6214,7 @@ const Parser = struct { |
| 6214 | 6214 | }; |
| 6215 | 6215 | } |
| 6216 | 6216 | pub fn parseKEYWORD_return(p: *Parser) Error!bool { |
| 6217 | const def_index = @intFromEnum(Def.defKEYWORD_return); | |
| 6217 | const def_index = @backingInt(Def.defKEYWORD_return); | |
| 6218 | 6218 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 6219 | 6219 | p.depths[def_index] += 1; |
| 6220 | 6220 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -6232,7 +6232,7 @@ const Parser = struct { |
| 6232 | 6232 | }; |
| 6233 | 6233 | } |
| 6234 | 6234 | pub fn parseKEYWORD_linksection(p: *Parser) Error!bool { |
| 6235 | const def_index = @intFromEnum(Def.defKEYWORD_linksection); | |
| 6235 | const def_index = @backingInt(Def.defKEYWORD_linksection); | |
| 6236 | 6236 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 6237 | 6237 | p.depths[def_index] += 1; |
| 6238 | 6238 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -6250,7 +6250,7 @@ const Parser = struct { |
| 6250 | 6250 | }; |
| 6251 | 6251 | } |
| 6252 | 6252 | pub fn parseKEYWORD_struct(p: *Parser) Error!bool { |
| 6253 | const def_index = @intFromEnum(Def.defKEYWORD_struct); | |
| 6253 | const def_index = @backingInt(Def.defKEYWORD_struct); | |
| 6254 | 6254 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 6255 | 6255 | p.depths[def_index] += 1; |
| 6256 | 6256 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -6268,7 +6268,7 @@ const Parser = struct { |
| 6268 | 6268 | }; |
| 6269 | 6269 | } |
| 6270 | 6270 | pub fn parseKEYWORD_suspend(p: *Parser) Error!bool { |
| 6271 | const def_index = @intFromEnum(Def.defKEYWORD_suspend); | |
| 6271 | const def_index = @backingInt(Def.defKEYWORD_suspend); | |
| 6272 | 6272 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 6273 | 6273 | p.depths[def_index] += 1; |
| 6274 | 6274 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -6286,7 +6286,7 @@ const Parser = struct { |
| 6286 | 6286 | }; |
| 6287 | 6287 | } |
| 6288 | 6288 | pub fn parseKEYWORD_switch(p: *Parser) Error!bool { |
| 6289 | const def_index = @intFromEnum(Def.defKEYWORD_switch); | |
| 6289 | const def_index = @backingInt(Def.defKEYWORD_switch); | |
| 6290 | 6290 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 6291 | 6291 | p.depths[def_index] += 1; |
| 6292 | 6292 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -6304,7 +6304,7 @@ const Parser = struct { |
| 6304 | 6304 | }; |
| 6305 | 6305 | } |
| 6306 | 6306 | pub fn parseKEYWORD_test(p: *Parser) Error!bool { |
| 6307 | const def_index = @intFromEnum(Def.defKEYWORD_test); | |
| 6307 | const def_index = @backingInt(Def.defKEYWORD_test); | |
| 6308 | 6308 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 6309 | 6309 | p.depths[def_index] += 1; |
| 6310 | 6310 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -6322,7 +6322,7 @@ const Parser = struct { |
| 6322 | 6322 | }; |
| 6323 | 6323 | } |
| 6324 | 6324 | pub fn parseKEYWORD_threadlocal(p: *Parser) Error!bool { |
| 6325 | const def_index = @intFromEnum(Def.defKEYWORD_threadlocal); | |
| 6325 | const def_index = @backingInt(Def.defKEYWORD_threadlocal); | |
| 6326 | 6326 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 6327 | 6327 | p.depths[def_index] += 1; |
| 6328 | 6328 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -6340,7 +6340,7 @@ const Parser = struct { |
| 6340 | 6340 | }; |
| 6341 | 6341 | } |
| 6342 | 6342 | pub fn parseKEYWORD_try(p: *Parser) Error!bool { |
| 6343 | const def_index = @intFromEnum(Def.defKEYWORD_try); | |
| 6343 | const def_index = @backingInt(Def.defKEYWORD_try); | |
| 6344 | 6344 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 6345 | 6345 | p.depths[def_index] += 1; |
| 6346 | 6346 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -6358,7 +6358,7 @@ const Parser = struct { |
| 6358 | 6358 | }; |
| 6359 | 6359 | } |
| 6360 | 6360 | pub fn parseKEYWORD_union(p: *Parser) Error!bool { |
| 6361 | const def_index = @intFromEnum(Def.defKEYWORD_union); | |
| 6361 | const def_index = @backingInt(Def.defKEYWORD_union); | |
| 6362 | 6362 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 6363 | 6363 | p.depths[def_index] += 1; |
| 6364 | 6364 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -6376,7 +6376,7 @@ const Parser = struct { |
| 6376 | 6376 | }; |
| 6377 | 6377 | } |
| 6378 | 6378 | pub fn parseKEYWORD_unreachable(p: *Parser) Error!bool { |
| 6379 | const def_index = @intFromEnum(Def.defKEYWORD_unreachable); | |
| 6379 | const def_index = @backingInt(Def.defKEYWORD_unreachable); | |
| 6380 | 6380 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 6381 | 6381 | p.depths[def_index] += 1; |
| 6382 | 6382 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -6394,7 +6394,7 @@ const Parser = struct { |
| 6394 | 6394 | }; |
| 6395 | 6395 | } |
| 6396 | 6396 | pub fn parseKEYWORD_var(p: *Parser) Error!bool { |
| 6397 | const def_index = @intFromEnum(Def.defKEYWORD_var); | |
| 6397 | const def_index = @backingInt(Def.defKEYWORD_var); | |
| 6398 | 6398 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 6399 | 6399 | p.depths[def_index] += 1; |
| 6400 | 6400 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -6412,7 +6412,7 @@ const Parser = struct { |
| 6412 | 6412 | }; |
| 6413 | 6413 | } |
| 6414 | 6414 | pub fn parseKEYWORD_volatile(p: *Parser) Error!bool { |
| 6415 | const def_index = @intFromEnum(Def.defKEYWORD_volatile); | |
| 6415 | const def_index = @backingInt(Def.defKEYWORD_volatile); | |
| 6416 | 6416 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 6417 | 6417 | p.depths[def_index] += 1; |
| 6418 | 6418 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -6430,7 +6430,7 @@ const Parser = struct { |
| 6430 | 6430 | }; |
| 6431 | 6431 | } |
| 6432 | 6432 | pub fn parseKEYWORD_while(p: *Parser) Error!bool { |
| 6433 | const def_index = @intFromEnum(Def.defKEYWORD_while); | |
| 6433 | const def_index = @backingInt(Def.defKEYWORD_while); | |
| 6434 | 6434 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 6435 | 6435 | p.depths[def_index] += 1; |
| 6436 | 6436 | defer p.depths[def_index] -= 1; |
| ... | ... | @@ -6448,7 +6448,7 @@ const Parser = struct { |
| 6448 | 6448 | }; |
| 6449 | 6449 | } |
| 6450 | 6450 | pub fn parsekeyword(p: *Parser) Error!bool { |
| 6451 | const def_index = @intFromEnum(Def.defkeyword); | |
| 6451 | const def_index = @backingInt(Def.defkeyword); | |
| 6452 | 6452 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 6453 | 6453 | p.depths[def_index] += 1; |
| 6454 | 6454 | defer p.depths[def_index] -= 1; |
lib/std/zig/system.zig+7-7| ... | ... | @@ -390,13 +390,13 @@ pub fn resolveTargetQuery(io: Io, query: Target.Query) DetectError!Target { |
| 390 | 390 | // sets one of them, that takes precedence. |
| 391 | 391 | switch (query_cpu_arch) { |
| 392 | 392 | .x86_16 => { |
| 393 | cpu.features.addFeature(@intFromEnum(Target.x86.Feature.@"16bit_mode")); | |
| 393 | cpu.features.addFeature(@backingInt(Target.x86.Feature.@"16bit_mode")); | |
| 394 | 394 | }, |
| 395 | 395 | .x86 => { |
| 396 | 396 | if (!Target.x86.featureSetHasAny(query.cpu_features_add, .{ |
| 397 | 397 | .@"16bit_mode", .@"32bit_mode", |
| 398 | 398 | })) { |
| 399 | cpu.features.addFeature(@intFromEnum(Target.x86.Feature.@"32bit_mode")); | |
| 399 | cpu.features.addFeature(@backingInt(Target.x86.Feature.@"32bit_mode")); | |
| 400 | 400 | } |
| 401 | 401 | }, |
| 402 | 402 | .arm, .armeb => { |
| ... | ... | @@ -404,7 +404,7 @@ pub fn resolveTargetQuery(io: Io, query: Target.Query) DetectError!Target { |
| 404 | 404 | // What do we do if the user specifies +thumb_mode? |
| 405 | 405 | }, |
| 406 | 406 | .thumb, .thumbeb => { |
| 407 | cpu.features.addFeature(@intFromEnum(Target.arm.Feature.thumb_mode)); | |
| 407 | cpu.features.addFeature(@backingInt(Target.arm.Feature.thumb_mode)); | |
| 408 | 408 | }, |
| 409 | 409 | else => {}, |
| 410 | 410 | } |
| ... | ... | @@ -452,16 +452,16 @@ pub fn resolveTargetQuery(io: Io, query: Target.Query) DetectError!Target { |
| 452 | 452 | // `-G <n>` to Clang...) We can't do the `-gpsize` hack because we can have multiple |
| 453 | 453 | // concurrent LLVM emit jobs, and command line options in LLVM are shared globally. So |
| 454 | 454 | // just force this feature off. Lovely stuff. |
| 455 | result.cpu.features.removeFeature(@intFromEnum(Target.hexagon.Feature.small_data)); | |
| 455 | result.cpu.features.removeFeature(@backingInt(Target.hexagon.Feature.small_data)); | |
| 456 | 456 | } |
| 457 | 457 | |
| 458 | 458 | // https://github.com/llvm/llvm-project/issues/105978 |
| 459 | 459 | if (result.cpu.arch.isArm() and result.abi.float() == .soft) { |
| 460 | result.cpu.features.removeFeature(@intFromEnum(Target.arm.Feature.vfp2)); | |
| 460 | result.cpu.features.removeFeature(@backingInt(Target.arm.Feature.vfp2)); | |
| 461 | 461 | } |
| 462 | 462 | |
| 463 | 463 | if (result.cpu.arch.isXtensa() and result.abi == .call0) { |
| 464 | result.cpu.features.removeFeature(@intFromEnum(Target.xtensa.Feature.windowed)); | |
| 464 | result.cpu.features.removeFeature(@backingInt(Target.xtensa.Feature.windowed)); | |
| 465 | 465 | } |
| 466 | 466 | } |
| 467 | 467 | |
| ... | ... | @@ -972,7 +972,7 @@ fn detectAbiAndDynamicLinker(io: Io, cpu: Target.Cpu, os: Target.Os, query: Targ |
| 972 | 972 | // and supported by Zig. But that means that we must detect the system ABI here rather than |
| 973 | 973 | // relying on `builtin.target`. |
| 974 | 974 | const all_abis = comptime blk: { |
| 975 | assert(@intFromEnum(Target.Abi.none) == 0); | |
| 975 | assert(@backingInt(Target.Abi.none) == 0); | |
| 976 | 976 | const field_names = std.meta.fieldNames(Target.Abi)[1..]; |
| 977 | 977 | var array: [field_names.len]Target.Abi = undefined; |
| 978 | 978 | for (field_names, 0..) |field_name, i| { |
lib/std/zig/system/arm.zig+1-1| ... | ... | @@ -233,7 +233,7 @@ pub const cpu_models = struct { |
| 233 | 233 | |
| 234 | 234 | pub const aarch64 = struct { |
| 235 | 235 | fn setFeature(cpu: *Target.Cpu, feature: Target.aarch64.Feature, enabled: bool) void { |
| 236 | const idx = @as(Target.Cpu.Feature.Set.Index, @intFromEnum(feature)); | |
| 236 | const idx = @as(Target.Cpu.Feature.Set.Index, @backingInt(feature)); | |
| 237 | 237 | |
| 238 | 238 | if (enabled) cpu.features.addFeature(idx) else cpu.features.removeFeature(idx); |
| 239 | 239 | } |
lib/std/zig/system/loongarch.zig+2-2| ... | ... | @@ -13,7 +13,7 @@ inline fn bit(input: u32, offset: u5) bool { |
| 13 | 13 | } |
| 14 | 14 | |
| 15 | 15 | fn setFeature(cpu: *std.Target.Cpu, feature: std.Target.loongarch.Feature, enabled: bool) void { |
| 16 | const idx = @as(std.Target.Cpu.Feature.Set.Index, @intFromEnum(feature)); | |
| 16 | const idx = @as(std.Target.Cpu.Feature.Set.Index, @backingInt(feature)); | |
| 17 | 17 | |
| 18 | 18 | if (enabled) cpu.features.addFeature(idx) else cpu.features.removeFeature(idx); |
| 19 | 19 | } |
| ... | ... | @@ -26,7 +26,7 @@ pub fn detectNativeCpuAndFeatures( |
| 26 | 26 | _ = os; |
| 27 | 27 | _ = query; |
| 28 | 28 | |
| 29 | const variant: Variant = @enumFromInt(cpucfg(1) & 0b11); | |
| 29 | const variant: Variant = @fromBackingInt(@intCast(cpucfg(1) & 0b11)); | |
| 30 | 30 | |
| 31 | 31 | var cpu: std.Target.Cpu = .{ |
| 32 | 32 | .arch = arch, |
lib/std/zig/system/windows.zig+2-2| ... | ... | @@ -43,7 +43,7 @@ pub fn detectRuntimeVersion() WindowsVersion { |
| 43 | 43 | |
| 44 | 44 | const version: u32 = @as(u32, os_ver) << 16 | @as(u16, sp_ver) << 8 | sub_ver; |
| 45 | 45 | |
| 46 | return @as(WindowsVersion, @enumFromInt(version)); | |
| 46 | return @as(WindowsVersion, @fromBackingInt(@intCast(version))); | |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | // Technically, a registry value can be as long as 1MB. However, MS recommends storing |
| ... | ... | @@ -188,7 +188,7 @@ fn getCpuInfoFromRegistry(core: usize, args: anytype) !void { |
| 188 | 188 | } |
| 189 | 189 | |
| 190 | 190 | fn setFeature(comptime Feature: type, cpu: *Target.Cpu, feature: Feature, enabled: bool) void { |
| 191 | const idx = @as(Target.Cpu.Feature.Set.Index, @intFromEnum(feature)); | |
| 191 | const idx = @as(Target.Cpu.Feature.Set.Index, @backingInt(feature)); | |
| 192 | 192 | |
| 193 | 193 | if (enabled) cpu.features.addFeature(idx) else cpu.features.removeFeature(idx); |
| 194 | 194 | } |
lib/std/zig/system/x86.zig+1-1| ... | ... | @@ -28,7 +28,7 @@ const Xcr0 = packed struct(u32) { |
| 28 | 28 | }; |
| 29 | 29 | |
| 30 | 30 | fn setFeature(cpu: *Target.Cpu, feature: Target.x86.Feature, enabled: bool) void { |
| 31 | const idx = @as(Target.Cpu.Feature.Set.Index, @intFromEnum(feature)); | |
| 31 | const idx = @as(Target.Cpu.Feature.Set.Index, @backingInt(feature)); | |
| 32 | 32 | |
| 33 | 33 | if (enabled) cpu.features.addFeature(idx) else cpu.features.removeFeature(idx); |
| 34 | 34 | } |
lib/std/zip.zig+2-2| ... | ... | @@ -377,7 +377,7 @@ pub const Iterator = struct { |
| 377 | 377 | if (end > extra.len) |
| 378 | 378 | return error.ZipBadExtraFieldSize; |
| 379 | 379 | const data = extra[extra_offset + 4 .. end]; |
| 380 | switch (@as(ExtraHeader, @enumFromInt(header_id))) { | |
| 380 | switch (@as(ExtraHeader, @fromBackingInt(@intCast(header_id)))) { | |
| 381 | 381 | .zip64_info => try readZip64FileExtents(CentralDirectoryFileHeader, header, &extents, data), |
| 382 | 382 | else => {}, // ignore |
| 383 | 383 | } |
| ... | ... | @@ -485,7 +485,7 @@ pub const Iterator = struct { |
| 485 | 485 | if (end > local_header.extra_len) |
| 486 | 486 | return error.ZipBadExtraFieldSize; |
| 487 | 487 | const data = extra[extra_offset + 4 .. end]; |
| 488 | switch (@as(ExtraHeader, @enumFromInt(header_id))) { | |
| 488 | switch (@as(ExtraHeader, @fromBackingInt(@intCast(header_id)))) { | |
| 489 | 489 | .zip64_info => try readZip64FileExtents(LocalFileHeader, local_header, &extents, data), |
| 490 | 490 | else => {}, // ignore |
| 491 | 491 | } |
lib/std/zon/parse.zig+2-2| ... | ... | @@ -183,7 +183,7 @@ pub const Error = union(enum) { |
| 183 | 183 | location.column += node_or_offset; |
| 184 | 184 | return location; |
| 185 | 185 | } else { |
| 186 | const ast_node: Ast.Node.Index = @enumFromInt(node_or_offset); | |
| 186 | const ast_node: Ast.Node.Index = @fromBackingInt(@intCast(node_or_offset)); | |
| 187 | 187 | const token = ast.nodeMainToken(ast_node); |
| 188 | 188 | return ast.tokenLocation(0, token); |
| 189 | 189 | } |
| ... | ... | @@ -672,7 +672,7 @@ const Parser = struct { |
| 672 | 672 | const enum_info = @typeInfo(T).@"enum"; |
| 673 | 673 | comptime var kvs_list: [enum_info.field_names.len]struct { []const u8, T } = undefined; |
| 674 | 674 | inline for (enum_info.field_names, enum_info.field_values, 0..) |enum_field_name, enum_field_value, i| { |
| 675 | kvs_list[i] = .{ enum_field_name, @enumFromInt(enum_field_value) }; | |
| 675 | kvs_list[i] = .{ enum_field_name, @fromBackingInt(@intCast(enum_field_value)) }; | |
| 676 | 676 | } |
| 677 | 677 | const enum_tags = std.StaticStringMap(T).initComptime(kvs_list); |
| 678 | 678 |
src/Air.zig+196-196| ... | ... | @@ -1052,9 +1052,9 @@ pub const Inst = struct { |
| 1052 | 1052 | _, |
| 1053 | 1053 | |
| 1054 | 1054 | pub fn unwrap(index: Index) union(enum) { ref: Inst.Ref, target: u31 } { |
| 1055 | const low_index: u31 = @truncate(@intFromEnum(index)); | |
| 1056 | return switch (@as(u1, @intCast(@intFromEnum(index) >> 31))) { | |
| 1057 | 0 => .{ .ref = @enumFromInt(@as(u32, 1 << 31) | low_index) }, | |
| 1055 | const low_index: u31 = @truncate(@backingInt(index)); | |
| 1056 | return switch (@as(u1, @intCast(@backingInt(index) >> 31))) { | |
| 1057 | 0 => .{ .ref = @fromBackingInt(@intCast(@as(u32, 1 << 31) | low_index)) }, | |
| 1058 | 1058 | 1 => .{ .target = low_index }, |
| 1059 | 1059 | }; |
| 1060 | 1060 | } |
| ... | ... | @@ -1064,7 +1064,7 @@ pub const Inst = struct { |
| 1064 | 1064 | } |
| 1065 | 1065 | |
| 1066 | 1066 | pub fn fromTargetIndex(index: u31) Index { |
| 1067 | return @enumFromInt((1 << 31) | @as(u32, index)); | |
| 1067 | return @fromBackingInt(@intCast((1 << 31) | @as(u32, index))); | |
| 1068 | 1068 | } |
| 1069 | 1069 | |
| 1070 | 1070 | pub fn toTargetIndex(index: Index) u31 { |
| ... | ... | @@ -1077,7 +1077,7 @@ pub const Inst = struct { |
| 1077 | 1077 | .ref => {}, |
| 1078 | 1078 | .target => try w.writeByte('t'), |
| 1079 | 1079 | } |
| 1080 | try w.print("{d}", .{@as(u31, @truncate(@intFromEnum(index)))}); | |
| 1080 | try w.print("{d}", .{@as(u31, @truncate(@backingInt(index)))}); | |
| 1081 | 1081 | } |
| 1082 | 1082 | }; |
| 1083 | 1083 | |
| ... | ... | @@ -1087,138 +1087,138 @@ pub const Inst = struct { |
| 1087 | 1087 | /// |
| 1088 | 1088 | /// The ref `none` is an exception: it has the tag bit set but refers to the InternPool. |
| 1089 | 1089 | pub const Ref = enum(u32) { |
| 1090 | u0_type = @intFromEnum(InternPool.Index.u0_type), | |
| 1091 | u1_type = @intFromEnum(InternPool.Index.u1_type), | |
| 1092 | u8_type = @intFromEnum(InternPool.Index.u8_type), | |
| 1093 | i8_type = @intFromEnum(InternPool.Index.i8_type), | |
| 1094 | u16_type = @intFromEnum(InternPool.Index.u16_type), | |
| 1095 | i16_type = @intFromEnum(InternPool.Index.i16_type), | |
| 1096 | u29_type = @intFromEnum(InternPool.Index.u29_type), | |
| 1097 | u32_type = @intFromEnum(InternPool.Index.u32_type), | |
| 1098 | i32_type = @intFromEnum(InternPool.Index.i32_type), | |
| 1099 | u64_type = @intFromEnum(InternPool.Index.u64_type), | |
| 1100 | i64_type = @intFromEnum(InternPool.Index.i64_type), | |
| 1101 | u80_type = @intFromEnum(InternPool.Index.u80_type), | |
| 1102 | u128_type = @intFromEnum(InternPool.Index.u128_type), | |
| 1103 | i128_type = @intFromEnum(InternPool.Index.i128_type), | |
| 1104 | u256_type = @intFromEnum(InternPool.Index.u256_type), | |
| 1105 | usize_type = @intFromEnum(InternPool.Index.usize_type), | |
| 1106 | isize_type = @intFromEnum(InternPool.Index.isize_type), | |
| 1107 | c_char_type = @intFromEnum(InternPool.Index.c_char_type), | |
| 1108 | c_short_type = @intFromEnum(InternPool.Index.c_short_type), | |
| 1109 | c_ushort_type = @intFromEnum(InternPool.Index.c_ushort_type), | |
| 1110 | c_int_type = @intFromEnum(InternPool.Index.c_int_type), | |
| 1111 | c_uint_type = @intFromEnum(InternPool.Index.c_uint_type), | |
| 1112 | c_long_type = @intFromEnum(InternPool.Index.c_long_type), | |
| 1113 | c_ulong_type = @intFromEnum(InternPool.Index.c_ulong_type), | |
| 1114 | c_longlong_type = @intFromEnum(InternPool.Index.c_longlong_type), | |
| 1115 | c_ulonglong_type = @intFromEnum(InternPool.Index.c_ulonglong_type), | |
| 1116 | c_longdouble_type = @intFromEnum(InternPool.Index.c_longdouble_type), | |
| 1117 | f16_type = @intFromEnum(InternPool.Index.f16_type), | |
| 1118 | f32_type = @intFromEnum(InternPool.Index.f32_type), | |
| 1119 | f64_type = @intFromEnum(InternPool.Index.f64_type), | |
| 1120 | f80_type = @intFromEnum(InternPool.Index.f80_type), | |
| 1121 | f128_type = @intFromEnum(InternPool.Index.f128_type), | |
| 1122 | anyopaque_type = @intFromEnum(InternPool.Index.anyopaque_type), | |
| 1123 | bool_type = @intFromEnum(InternPool.Index.bool_type), | |
| 1124 | void_type = @intFromEnum(InternPool.Index.void_type), | |
| 1125 | type_type = @intFromEnum(InternPool.Index.type_type), | |
| 1126 | anyerror_type = @intFromEnum(InternPool.Index.anyerror_type), | |
| 1127 | comptime_int_type = @intFromEnum(InternPool.Index.comptime_int_type), | |
| 1128 | comptime_float_type = @intFromEnum(InternPool.Index.comptime_float_type), | |
| 1129 | noreturn_type = @intFromEnum(InternPool.Index.noreturn_type), | |
| 1130 | anyframe_type = @intFromEnum(InternPool.Index.anyframe_type), | |
| 1131 | null_type = @intFromEnum(InternPool.Index.null_type), | |
| 1132 | undefined_type = @intFromEnum(InternPool.Index.undefined_type), | |
| 1133 | enum_literal_type = @intFromEnum(InternPool.Index.enum_literal_type), | |
| 1134 | ptr_usize_type = @intFromEnum(InternPool.Index.ptr_usize_type), | |
| 1135 | ptr_const_comptime_int_type = @intFromEnum(InternPool.Index.ptr_const_comptime_int_type), | |
| 1136 | manyptr_u8_type = @intFromEnum(InternPool.Index.manyptr_u8_type), | |
| 1137 | manyptr_const_u8_type = @intFromEnum(InternPool.Index.manyptr_const_u8_type), | |
| 1138 | manyptr_const_u8_sentinel_0_type = @intFromEnum(InternPool.Index.manyptr_const_u8_sentinel_0_type), | |
| 1139 | slice_const_u8_type = @intFromEnum(InternPool.Index.slice_const_u8_type), | |
| 1140 | slice_const_u8_sentinel_0_type = @intFromEnum(InternPool.Index.slice_const_u8_sentinel_0_type), | |
| 1141 | manyptr_const_slice_const_u8_type = @intFromEnum(InternPool.Index.manyptr_const_slice_const_u8_type), | |
| 1142 | slice_const_slice_const_u8_type = @intFromEnum(InternPool.Index.slice_const_slice_const_u8_type), | |
| 1143 | optional_type_type = @intFromEnum(InternPool.Index.optional_type_type), | |
| 1144 | manyptr_const_type_type = @intFromEnum(InternPool.Index.manyptr_const_type_type), | |
| 1145 | slice_const_type_type = @intFromEnum(InternPool.Index.slice_const_type_type), | |
| 1146 | vector_8_i8_type = @intFromEnum(InternPool.Index.vector_8_i8_type), | |
| 1147 | vector_16_i8_type = @intFromEnum(InternPool.Index.vector_16_i8_type), | |
| 1148 | vector_32_i8_type = @intFromEnum(InternPool.Index.vector_32_i8_type), | |
| 1149 | vector_64_i8_type = @intFromEnum(InternPool.Index.vector_64_i8_type), | |
| 1150 | vector_1_u8_type = @intFromEnum(InternPool.Index.vector_1_u8_type), | |
| 1151 | vector_2_u8_type = @intFromEnum(InternPool.Index.vector_2_u8_type), | |
| 1152 | vector_4_u8_type = @intFromEnum(InternPool.Index.vector_4_u8_type), | |
| 1153 | vector_8_u8_type = @intFromEnum(InternPool.Index.vector_8_u8_type), | |
| 1154 | vector_16_u8_type = @intFromEnum(InternPool.Index.vector_16_u8_type), | |
| 1155 | vector_32_u8_type = @intFromEnum(InternPool.Index.vector_32_u8_type), | |
| 1156 | vector_64_u8_type = @intFromEnum(InternPool.Index.vector_64_u8_type), | |
| 1157 | vector_2_i16_type = @intFromEnum(InternPool.Index.vector_2_i16_type), | |
| 1158 | vector_4_i16_type = @intFromEnum(InternPool.Index.vector_4_i16_type), | |
| 1159 | vector_8_i16_type = @intFromEnum(InternPool.Index.vector_8_i16_type), | |
| 1160 | vector_16_i16_type = @intFromEnum(InternPool.Index.vector_16_i16_type), | |
| 1161 | vector_32_i16_type = @intFromEnum(InternPool.Index.vector_32_i16_type), | |
| 1162 | vector_4_u16_type = @intFromEnum(InternPool.Index.vector_4_u16_type), | |
| 1163 | vector_8_u16_type = @intFromEnum(InternPool.Index.vector_8_u16_type), | |
| 1164 | vector_16_u16_type = @intFromEnum(InternPool.Index.vector_16_u16_type), | |
| 1165 | vector_32_u16_type = @intFromEnum(InternPool.Index.vector_32_u16_type), | |
| 1166 | vector_2_i32_type = @intFromEnum(InternPool.Index.vector_2_i32_type), | |
| 1167 | vector_4_i32_type = @intFromEnum(InternPool.Index.vector_4_i32_type), | |
| 1168 | vector_8_i32_type = @intFromEnum(InternPool.Index.vector_8_i32_type), | |
| 1169 | vector_16_i32_type = @intFromEnum(InternPool.Index.vector_16_i32_type), | |
| 1170 | vector_4_u32_type = @intFromEnum(InternPool.Index.vector_4_u32_type), | |
| 1171 | vector_8_u32_type = @intFromEnum(InternPool.Index.vector_8_u32_type), | |
| 1172 | vector_16_u32_type = @intFromEnum(InternPool.Index.vector_16_u32_type), | |
| 1173 | vector_2_i64_type = @intFromEnum(InternPool.Index.vector_2_i64_type), | |
| 1174 | vector_4_i64_type = @intFromEnum(InternPool.Index.vector_4_i64_type), | |
| 1175 | vector_8_i64_type = @intFromEnum(InternPool.Index.vector_8_i64_type), | |
| 1176 | vector_2_u64_type = @intFromEnum(InternPool.Index.vector_2_u64_type), | |
| 1177 | vector_4_u64_type = @intFromEnum(InternPool.Index.vector_4_u64_type), | |
| 1178 | vector_8_u64_type = @intFromEnum(InternPool.Index.vector_8_u64_type), | |
| 1179 | vector_1_u128_type = @intFromEnum(InternPool.Index.vector_1_u128_type), | |
| 1180 | vector_2_u128_type = @intFromEnum(InternPool.Index.vector_2_u128_type), | |
| 1181 | vector_1_u256_type = @intFromEnum(InternPool.Index.vector_1_u256_type), | |
| 1182 | vector_4_f16_type = @intFromEnum(InternPool.Index.vector_4_f16_type), | |
| 1183 | vector_8_f16_type = @intFromEnum(InternPool.Index.vector_8_f16_type), | |
| 1184 | vector_16_f16_type = @intFromEnum(InternPool.Index.vector_16_f16_type), | |
| 1185 | vector_32_f16_type = @intFromEnum(InternPool.Index.vector_32_f16_type), | |
| 1186 | vector_2_f32_type = @intFromEnum(InternPool.Index.vector_2_f32_type), | |
| 1187 | vector_4_f32_type = @intFromEnum(InternPool.Index.vector_4_f32_type), | |
| 1188 | vector_8_f32_type = @intFromEnum(InternPool.Index.vector_8_f32_type), | |
| 1189 | vector_16_f32_type = @intFromEnum(InternPool.Index.vector_16_f32_type), | |
| 1190 | vector_2_f64_type = @intFromEnum(InternPool.Index.vector_2_f64_type), | |
| 1191 | vector_4_f64_type = @intFromEnum(InternPool.Index.vector_4_f64_type), | |
| 1192 | vector_8_f64_type = @intFromEnum(InternPool.Index.vector_8_f64_type), | |
| 1193 | optional_noreturn_type = @intFromEnum(InternPool.Index.optional_noreturn_type), | |
| 1194 | anyerror_void_error_union_type = @intFromEnum(InternPool.Index.anyerror_void_error_union_type), | |
| 1195 | adhoc_inferred_error_set_type = @intFromEnum(InternPool.Index.adhoc_inferred_error_set_type), | |
| 1196 | generic_poison_type = @intFromEnum(InternPool.Index.generic_poison_type), | |
| 1197 | empty_tuple_type = @intFromEnum(InternPool.Index.empty_tuple_type), | |
| 1198 | undef = @intFromEnum(InternPool.Index.undef), | |
| 1199 | undef_bool = @intFromEnum(InternPool.Index.undef_bool), | |
| 1200 | undef_usize = @intFromEnum(InternPool.Index.undef_usize), | |
| 1201 | undef_u1 = @intFromEnum(InternPool.Index.undef_u1), | |
| 1202 | zero = @intFromEnum(InternPool.Index.zero), | |
| 1203 | zero_usize = @intFromEnum(InternPool.Index.zero_usize), | |
| 1204 | zero_u1 = @intFromEnum(InternPool.Index.zero_u1), | |
| 1205 | zero_u8 = @intFromEnum(InternPool.Index.zero_u8), | |
| 1206 | one = @intFromEnum(InternPool.Index.one), | |
| 1207 | one_usize = @intFromEnum(InternPool.Index.one_usize), | |
| 1208 | one_u1 = @intFromEnum(InternPool.Index.one_u1), | |
| 1209 | one_u8 = @intFromEnum(InternPool.Index.one_u8), | |
| 1210 | four_u8 = @intFromEnum(InternPool.Index.four_u8), | |
| 1211 | negative_one = @intFromEnum(InternPool.Index.negative_one), | |
| 1212 | void_value = @intFromEnum(InternPool.Index.void_value), | |
| 1213 | unreachable_value = @intFromEnum(InternPool.Index.unreachable_value), | |
| 1214 | null_value = @intFromEnum(InternPool.Index.null_value), | |
| 1215 | bool_true = @intFromEnum(InternPool.Index.bool_true), | |
| 1216 | bool_false = @intFromEnum(InternPool.Index.bool_false), | |
| 1217 | empty_tuple = @intFromEnum(InternPool.Index.empty_tuple), | |
| 1090 | u0_type = @backingInt(InternPool.Index.u0_type), | |
| 1091 | u1_type = @backingInt(InternPool.Index.u1_type), | |
| 1092 | u8_type = @backingInt(InternPool.Index.u8_type), | |
| 1093 | i8_type = @backingInt(InternPool.Index.i8_type), | |
| 1094 | u16_type = @backingInt(InternPool.Index.u16_type), | |
| 1095 | i16_type = @backingInt(InternPool.Index.i16_type), | |
| 1096 | u29_type = @backingInt(InternPool.Index.u29_type), | |
| 1097 | u32_type = @backingInt(InternPool.Index.u32_type), | |
| 1098 | i32_type = @backingInt(InternPool.Index.i32_type), | |
| 1099 | u64_type = @backingInt(InternPool.Index.u64_type), | |
| 1100 | i64_type = @backingInt(InternPool.Index.i64_type), | |
| 1101 | u80_type = @backingInt(InternPool.Index.u80_type), | |
| 1102 | u128_type = @backingInt(InternPool.Index.u128_type), | |
| 1103 | i128_type = @backingInt(InternPool.Index.i128_type), | |
| 1104 | u256_type = @backingInt(InternPool.Index.u256_type), | |
| 1105 | usize_type = @backingInt(InternPool.Index.usize_type), | |
| 1106 | isize_type = @backingInt(InternPool.Index.isize_type), | |
| 1107 | c_char_type = @backingInt(InternPool.Index.c_char_type), | |
| 1108 | c_short_type = @backingInt(InternPool.Index.c_short_type), | |
| 1109 | c_ushort_type = @backingInt(InternPool.Index.c_ushort_type), | |
| 1110 | c_int_type = @backingInt(InternPool.Index.c_int_type), | |
| 1111 | c_uint_type = @backingInt(InternPool.Index.c_uint_type), | |
| 1112 | c_long_type = @backingInt(InternPool.Index.c_long_type), | |
| 1113 | c_ulong_type = @backingInt(InternPool.Index.c_ulong_type), | |
| 1114 | c_longlong_type = @backingInt(InternPool.Index.c_longlong_type), | |
| 1115 | c_ulonglong_type = @backingInt(InternPool.Index.c_ulonglong_type), | |
| 1116 | c_longdouble_type = @backingInt(InternPool.Index.c_longdouble_type), | |
| 1117 | f16_type = @backingInt(InternPool.Index.f16_type), | |
| 1118 | f32_type = @backingInt(InternPool.Index.f32_type), | |
| 1119 | f64_type = @backingInt(InternPool.Index.f64_type), | |
| 1120 | f80_type = @backingInt(InternPool.Index.f80_type), | |
| 1121 | f128_type = @backingInt(InternPool.Index.f128_type), | |
| 1122 | anyopaque_type = @backingInt(InternPool.Index.anyopaque_type), | |
| 1123 | bool_type = @backingInt(InternPool.Index.bool_type), | |
| 1124 | void_type = @backingInt(InternPool.Index.void_type), | |
| 1125 | type_type = @backingInt(InternPool.Index.type_type), | |
| 1126 | anyerror_type = @backingInt(InternPool.Index.anyerror_type), | |
| 1127 | comptime_int_type = @backingInt(InternPool.Index.comptime_int_type), | |
| 1128 | comptime_float_type = @backingInt(InternPool.Index.comptime_float_type), | |
| 1129 | noreturn_type = @backingInt(InternPool.Index.noreturn_type), | |
| 1130 | anyframe_type = @backingInt(InternPool.Index.anyframe_type), | |
| 1131 | null_type = @backingInt(InternPool.Index.null_type), | |
| 1132 | undefined_type = @backingInt(InternPool.Index.undefined_type), | |
| 1133 | enum_literal_type = @backingInt(InternPool.Index.enum_literal_type), | |
| 1134 | ptr_usize_type = @backingInt(InternPool.Index.ptr_usize_type), | |
| 1135 | ptr_const_comptime_int_type = @backingInt(InternPool.Index.ptr_const_comptime_int_type), | |
| 1136 | manyptr_u8_type = @backingInt(InternPool.Index.manyptr_u8_type), | |
| 1137 | manyptr_const_u8_type = @backingInt(InternPool.Index.manyptr_const_u8_type), | |
| 1138 | manyptr_const_u8_sentinel_0_type = @backingInt(InternPool.Index.manyptr_const_u8_sentinel_0_type), | |
| 1139 | slice_const_u8_type = @backingInt(InternPool.Index.slice_const_u8_type), | |
| 1140 | slice_const_u8_sentinel_0_type = @backingInt(InternPool.Index.slice_const_u8_sentinel_0_type), | |
| 1141 | manyptr_const_slice_const_u8_type = @backingInt(InternPool.Index.manyptr_const_slice_const_u8_type), | |
| 1142 | slice_const_slice_const_u8_type = @backingInt(InternPool.Index.slice_const_slice_const_u8_type), | |
| 1143 | optional_type_type = @backingInt(InternPool.Index.optional_type_type), | |
| 1144 | manyptr_const_type_type = @backingInt(InternPool.Index.manyptr_const_type_type), | |
| 1145 | slice_const_type_type = @backingInt(InternPool.Index.slice_const_type_type), | |
| 1146 | vector_8_i8_type = @backingInt(InternPool.Index.vector_8_i8_type), | |
| 1147 | vector_16_i8_type = @backingInt(InternPool.Index.vector_16_i8_type), | |
| 1148 | vector_32_i8_type = @backingInt(InternPool.Index.vector_32_i8_type), | |
| 1149 | vector_64_i8_type = @backingInt(InternPool.Index.vector_64_i8_type), | |
| 1150 | vector_1_u8_type = @backingInt(InternPool.Index.vector_1_u8_type), | |
| 1151 | vector_2_u8_type = @backingInt(InternPool.Index.vector_2_u8_type), | |
| 1152 | vector_4_u8_type = @backingInt(InternPool.Index.vector_4_u8_type), | |
| 1153 | vector_8_u8_type = @backingInt(InternPool.Index.vector_8_u8_type), | |
| 1154 | vector_16_u8_type = @backingInt(InternPool.Index.vector_16_u8_type), | |
| 1155 | vector_32_u8_type = @backingInt(InternPool.Index.vector_32_u8_type), | |
| 1156 | vector_64_u8_type = @backingInt(InternPool.Index.vector_64_u8_type), | |
| 1157 | vector_2_i16_type = @backingInt(InternPool.Index.vector_2_i16_type), | |
| 1158 | vector_4_i16_type = @backingInt(InternPool.Index.vector_4_i16_type), | |
| 1159 | vector_8_i16_type = @backingInt(InternPool.Index.vector_8_i16_type), | |
| 1160 | vector_16_i16_type = @backingInt(InternPool.Index.vector_16_i16_type), | |
| 1161 | vector_32_i16_type = @backingInt(InternPool.Index.vector_32_i16_type), | |
| 1162 | vector_4_u16_type = @backingInt(InternPool.Index.vector_4_u16_type), | |
| 1163 | vector_8_u16_type = @backingInt(InternPool.Index.vector_8_u16_type), | |
| 1164 | vector_16_u16_type = @backingInt(InternPool.Index.vector_16_u16_type), | |
| 1165 | vector_32_u16_type = @backingInt(InternPool.Index.vector_32_u16_type), | |
| 1166 | vector_2_i32_type = @backingInt(InternPool.Index.vector_2_i32_type), | |
| 1167 | vector_4_i32_type = @backingInt(InternPool.Index.vector_4_i32_type), | |
| 1168 | vector_8_i32_type = @backingInt(InternPool.Index.vector_8_i32_type), | |
| 1169 | vector_16_i32_type = @backingInt(InternPool.Index.vector_16_i32_type), | |
| 1170 | vector_4_u32_type = @backingInt(InternPool.Index.vector_4_u32_type), | |
| 1171 | vector_8_u32_type = @backingInt(InternPool.Index.vector_8_u32_type), | |
| 1172 | vector_16_u32_type = @backingInt(InternPool.Index.vector_16_u32_type), | |
| 1173 | vector_2_i64_type = @backingInt(InternPool.Index.vector_2_i64_type), | |
| 1174 | vector_4_i64_type = @backingInt(InternPool.Index.vector_4_i64_type), | |
| 1175 | vector_8_i64_type = @backingInt(InternPool.Index.vector_8_i64_type), | |
| 1176 | vector_2_u64_type = @backingInt(InternPool.Index.vector_2_u64_type), | |
| 1177 | vector_4_u64_type = @backingInt(InternPool.Index.vector_4_u64_type), | |
| 1178 | vector_8_u64_type = @backingInt(InternPool.Index.vector_8_u64_type), | |
| 1179 | vector_1_u128_type = @backingInt(InternPool.Index.vector_1_u128_type), | |
| 1180 | vector_2_u128_type = @backingInt(InternPool.Index.vector_2_u128_type), | |
| 1181 | vector_1_u256_type = @backingInt(InternPool.Index.vector_1_u256_type), | |
| 1182 | vector_4_f16_type = @backingInt(InternPool.Index.vector_4_f16_type), | |
| 1183 | vector_8_f16_type = @backingInt(InternPool.Index.vector_8_f16_type), | |
| 1184 | vector_16_f16_type = @backingInt(InternPool.Index.vector_16_f16_type), | |
| 1185 | vector_32_f16_type = @backingInt(InternPool.Index.vector_32_f16_type), | |
| 1186 | vector_2_f32_type = @backingInt(InternPool.Index.vector_2_f32_type), | |
| 1187 | vector_4_f32_type = @backingInt(InternPool.Index.vector_4_f32_type), | |
| 1188 | vector_8_f32_type = @backingInt(InternPool.Index.vector_8_f32_type), | |
| 1189 | vector_16_f32_type = @backingInt(InternPool.Index.vector_16_f32_type), | |
| 1190 | vector_2_f64_type = @backingInt(InternPool.Index.vector_2_f64_type), | |
| 1191 | vector_4_f64_type = @backingInt(InternPool.Index.vector_4_f64_type), | |
| 1192 | vector_8_f64_type = @backingInt(InternPool.Index.vector_8_f64_type), | |
| 1193 | optional_noreturn_type = @backingInt(InternPool.Index.optional_noreturn_type), | |
| 1194 | anyerror_void_error_union_type = @backingInt(InternPool.Index.anyerror_void_error_union_type), | |
| 1195 | adhoc_inferred_error_set_type = @backingInt(InternPool.Index.adhoc_inferred_error_set_type), | |
| 1196 | generic_poison_type = @backingInt(InternPool.Index.generic_poison_type), | |
| 1197 | empty_tuple_type = @backingInt(InternPool.Index.empty_tuple_type), | |
| 1198 | undef = @backingInt(InternPool.Index.undef), | |
| 1199 | undef_bool = @backingInt(InternPool.Index.undef_bool), | |
| 1200 | undef_usize = @backingInt(InternPool.Index.undef_usize), | |
| 1201 | undef_u1 = @backingInt(InternPool.Index.undef_u1), | |
| 1202 | zero = @backingInt(InternPool.Index.zero), | |
| 1203 | zero_usize = @backingInt(InternPool.Index.zero_usize), | |
| 1204 | zero_u1 = @backingInt(InternPool.Index.zero_u1), | |
| 1205 | zero_u8 = @backingInt(InternPool.Index.zero_u8), | |
| 1206 | one = @backingInt(InternPool.Index.one), | |
| 1207 | one_usize = @backingInt(InternPool.Index.one_usize), | |
| 1208 | one_u1 = @backingInt(InternPool.Index.one_u1), | |
| 1209 | one_u8 = @backingInt(InternPool.Index.one_u8), | |
| 1210 | four_u8 = @backingInt(InternPool.Index.four_u8), | |
| 1211 | negative_one = @backingInt(InternPool.Index.negative_one), | |
| 1212 | void_value = @backingInt(InternPool.Index.void_value), | |
| 1213 | unreachable_value = @backingInt(InternPool.Index.unreachable_value), | |
| 1214 | null_value = @backingInt(InternPool.Index.null_value), | |
| 1215 | bool_true = @backingInt(InternPool.Index.bool_true), | |
| 1216 | bool_false = @backingInt(InternPool.Index.bool_false), | |
| 1217 | empty_tuple = @backingInt(InternPool.Index.empty_tuple), | |
| 1218 | 1218 | |
| 1219 | 1219 | /// This Ref does not correspond to any AIR instruction or constant |
| 1220 | 1220 | /// value and may instead be used as a sentinel to indicate null. |
| 1221 | none = @intFromEnum(InternPool.Index.none), | |
| 1221 | none = @backingInt(InternPool.Index.none), | |
| 1222 | 1222 | _, |
| 1223 | 1223 | |
| 1224 | 1224 | pub fn toInterned(ref: Ref) ?InternPool.Index { |
| ... | ... | @@ -1229,8 +1229,8 @@ pub const Inst = struct { |
| 1229 | 1229 | pub fn toInternedAllowNone(ref: Ref) ?InternPool.Index { |
| 1230 | 1230 | return switch (ref) { |
| 1231 | 1231 | .none => .none, |
| 1232 | else => if (@intFromEnum(ref) >> 31 == 0) | |
| 1233 | @enumFromInt(@as(u31, @truncate(@intFromEnum(ref)))) | |
| 1232 | else => if (@backingInt(ref) >> 31 == 0) | |
| 1233 | @fromBackingInt(@intCast(@as(u31, @truncate(@backingInt(ref))))) | |
| 1234 | 1234 | else |
| 1235 | 1235 | null, |
| 1236 | 1236 | }; |
| ... | ... | @@ -1244,8 +1244,8 @@ pub const Inst = struct { |
| 1244 | 1244 | pub fn toIndexAllowNone(ref: Ref) ?Index { |
| 1245 | 1245 | return switch (ref) { |
| 1246 | 1246 | .none => null, |
| 1247 | else => if (@intFromEnum(ref) >> 31 != 0) | |
| 1248 | @enumFromInt(@as(u31, @truncate(@intFromEnum(ref)))) | |
| 1247 | else => if (@backingInt(ref) >> 31 != 0) | |
| 1248 | @fromBackingInt(@intCast(@as(u31, @truncate(@backingInt(ref))))) | |
| 1249 | 1249 | else |
| 1250 | 1250 | null, |
| 1251 | 1251 | }; |
| ... | ... | @@ -1259,8 +1259,8 @@ pub const Inst = struct { |
| 1259 | 1259 | return switch (ip_index) { |
| 1260 | 1260 | .none => .none, |
| 1261 | 1261 | else => { |
| 1262 | assert(@intFromEnum(ip_index) >> 31 == 0); | |
| 1263 | return @enumFromInt(@as(u31, @intCast(@intFromEnum(ip_index)))); | |
| 1262 | assert(@backingInt(ip_index) >> 31 == 0); | |
| 1263 | return @fromBackingInt(@intCast(@as(u31, @intCast(@backingInt(ip_index))))); | |
| 1264 | 1264 | }, |
| 1265 | 1265 | }; |
| 1266 | 1266 | } |
| ... | ... | @@ -1452,11 +1452,11 @@ pub const VectorCmp = struct { |
| 1452 | 1452 | op: u32, |
| 1453 | 1453 | |
| 1454 | 1454 | pub fn compareOperator(self: VectorCmp) std.math.CompareOperator { |
| 1455 | return @enumFromInt(@as(u3, @intCast(self.op))); | |
| 1455 | return @fromBackingInt(@intCast(@as(u3, @intCast(self.op)))); | |
| 1456 | 1456 | } |
| 1457 | 1457 | |
| 1458 | 1458 | pub fn encodeOp(compare_operator: std.math.CompareOperator) u32 { |
| 1459 | return @intFromEnum(compare_operator); | |
| 1459 | return @backingInt(compare_operator); | |
| 1460 | 1460 | } |
| 1461 | 1461 | }; |
| 1462 | 1462 | |
| ... | ... | @@ -1469,7 +1469,7 @@ pub const ShuffleOneMask = packed struct(u32) { |
| 1469 | 1469 | return .{ .index = @intCast(idx), .kind = .elem }; |
| 1470 | 1470 | } |
| 1471 | 1471 | pub fn value(val: Value) ShuffleOneMask { |
| 1472 | return .{ .index = @intCast(@intFromEnum(val.toIntern())), .kind = .value }; | |
| 1472 | return .{ .index = @intCast(@backingInt(val.toIntern())), .kind = .value }; | |
| 1473 | 1473 | } |
| 1474 | 1474 | pub const Unwrapped = union(enum) { |
| 1475 | 1475 | /// The resulting element is this index into the runtime vector. |
| ... | ... | @@ -1481,7 +1481,7 @@ pub const ShuffleOneMask = packed struct(u32) { |
| 1481 | 1481 | pub fn unwrap(raw: ShuffleOneMask) Unwrapped { |
| 1482 | 1482 | return switch (raw.kind) { |
| 1483 | 1483 | .elem => .{ .elem = raw.index }, |
| 1484 | .value => .{ .value = @enumFromInt(raw.index) }, | |
| 1484 | .value => .{ .value = @fromBackingInt(@intCast(raw.index)) }, | |
| 1485 | 1485 | }; |
| 1486 | 1486 | } |
| 1487 | 1487 | }; |
| ... | ... | @@ -1492,10 +1492,10 @@ pub const ShuffleTwoMask = enum(u32) { |
| 1492 | 1492 | undef = std.math.maxInt(u32), |
| 1493 | 1493 | _, |
| 1494 | 1494 | pub fn aElem(idx: u32) ShuffleTwoMask { |
| 1495 | return @enumFromInt(idx << 1); | |
| 1495 | return @fromBackingInt(@intCast(idx << 1)); | |
| 1496 | 1496 | } |
| 1497 | 1497 | pub fn bElem(idx: u32) ShuffleTwoMask { |
| 1498 | return @enumFromInt(idx << 1 | 1); | |
| 1498 | return @fromBackingInt(@intCast(idx << 1 | 1)); | |
| 1499 | 1499 | } |
| 1500 | 1500 | pub const Unwrapped = union(enum) { |
| 1501 | 1501 | /// The resulting element is this index into the first runtime vector. |
| ... | ... | @@ -1510,7 +1510,7 @@ pub const ShuffleTwoMask = enum(u32) { |
| 1510 | 1510 | .undef => return .undef, |
| 1511 | 1511 | _ => {}, |
| 1512 | 1512 | } |
| 1513 | const x = @intFromEnum(raw); | |
| 1513 | const x = @backingInt(raw); | |
| 1514 | 1514 | return switch (@as(u1, @truncate(x))) { |
| 1515 | 1515 | 0 => .{ .a_elem = x >> 1 }, |
| 1516 | 1516 | 1 => .{ .b_elem = x >> 1 }, |
| ... | ... | @@ -1556,11 +1556,11 @@ pub const Cmpxchg = struct { |
| 1556 | 1556 | flags: u32, |
| 1557 | 1557 | |
| 1558 | 1558 | pub fn successOrder(self: Cmpxchg) std.lang.AtomicOrder { |
| 1559 | return @enumFromInt(@as(u3, @truncate(self.flags))); | |
| 1559 | return @fromBackingInt(@intCast(@as(u3, @truncate(self.flags)))); | |
| 1560 | 1560 | } |
| 1561 | 1561 | |
| 1562 | 1562 | pub fn failureOrder(self: Cmpxchg) std.lang.AtomicOrder { |
| 1563 | return @enumFromInt(@as(u3, @intCast(self.flags >> 3))); | |
| 1563 | return @fromBackingInt(@intCast(@as(u3, @intCast(self.flags >> 3)))); | |
| 1564 | 1564 | } |
| 1565 | 1565 | }; |
| 1566 | 1566 | |
| ... | ... | @@ -1571,11 +1571,11 @@ pub const AtomicRmw = struct { |
| 1571 | 1571 | flags: u32, |
| 1572 | 1572 | |
| 1573 | 1573 | pub fn ordering(self: AtomicRmw) std.lang.AtomicOrder { |
| 1574 | return @enumFromInt(@as(u3, @truncate(self.flags))); | |
| 1574 | return @fromBackingInt(@intCast(@as(u3, @truncate(self.flags)))); | |
| 1575 | 1575 | } |
| 1576 | 1576 | |
| 1577 | 1577 | pub fn op(self: AtomicRmw) std.lang.AtomicRmwOp { |
| 1578 | return @enumFromInt(@as(u4, @intCast(self.flags >> 3))); | |
| 1578 | return @fromBackingInt(@intCast(@as(u4, @intCast(self.flags >> 3)))); | |
| 1579 | 1579 | } |
| 1580 | 1580 | }; |
| 1581 | 1581 | |
| ... | ... | @@ -1585,7 +1585,7 @@ pub const UnionInit = struct { |
| 1585 | 1585 | }; |
| 1586 | 1586 | |
| 1587 | 1587 | pub fn getMainBody(air: Air) []const Air.Inst.Index { |
| 1588 | const body_index = air.extra.items[@intFromEnum(ExtraIndex.main_block)]; | |
| 1588 | const body_index = air.extra.items[@backingInt(ExtraIndex.main_block)]; | |
| 1589 | 1589 | const extra = air.extraData(Block, body_index); |
| 1590 | 1590 | return @ptrCast(air.extra.items[extra.end..][0..extra.data.body_len]); |
| 1591 | 1591 | } |
| ... | ... | @@ -1600,7 +1600,7 @@ pub fn typeOf(air: *const Air, inst: Air.Inst.Ref, ip: *const InternPool) Type { |
| 1600 | 1600 | |
| 1601 | 1601 | pub fn typeOfIndex(air: *const Air, inst: Air.Inst.Index, ip: *const InternPool) Type { |
| 1602 | 1602 | const datas = air.instructions.items(.data); |
| 1603 | switch (air.instructions.items(.tag)[@intFromEnum(inst)]) { | |
| 1603 | switch (air.instructions.items(.tag)[@backingInt(inst)]) { | |
| 1604 | 1604 | .add, |
| 1605 | 1605 | .add_safe, |
| 1606 | 1606 | .add_wrap, |
| ... | ... | @@ -1640,7 +1640,7 @@ pub fn typeOfIndex(air: *const Air, inst: Air.Inst.Index, ip: *const InternPool) |
| 1640 | 1640 | .div_exact_optimized, |
| 1641 | 1641 | .rem_optimized, |
| 1642 | 1642 | .mod_optimized, |
| 1643 | => return air.typeOf(datas[@intFromEnum(inst)].bin_op.lhs, ip), | |
| 1643 | => return air.typeOf(datas[@backingInt(inst)].bin_op.lhs, ip), | |
| 1644 | 1644 | |
| 1645 | 1645 | .sqrt, |
| 1646 | 1646 | .sin, |
| ... | ... | @@ -1657,7 +1657,7 @@ pub fn typeOfIndex(air: *const Air, inst: Air.Inst.Index, ip: *const InternPool) |
| 1657 | 1657 | .trunc_float, |
| 1658 | 1658 | .neg, |
| 1659 | 1659 | .neg_optimized, |
| 1660 | => return air.typeOf(datas[@intFromEnum(inst)].un_op, ip), | |
| 1660 | => return air.typeOf(datas[@backingInt(inst)].un_op, ip), | |
| 1661 | 1661 | |
| 1662 | 1662 | .cmp_lt, |
| 1663 | 1663 | .cmp_lte, |
| ... | ... | @@ -1688,9 +1688,9 @@ pub fn typeOfIndex(air: *const Air, inst: Air.Inst.Index, ip: *const InternPool) |
| 1688 | 1688 | .ret_ptr, |
| 1689 | 1689 | .err_return_trace, |
| 1690 | 1690 | .c_va_start, |
| 1691 | => return datas[@intFromEnum(inst)].ty, | |
| 1691 | => return datas[@backingInt(inst)].ty, | |
| 1692 | 1692 | |
| 1693 | .arg => return datas[@intFromEnum(inst)].arg.ty.toType(), | |
| 1693 | .arg => return datas[@backingInt(inst)].arg.ty.toType(), | |
| 1694 | 1694 | |
| 1695 | 1695 | .assembly, |
| 1696 | 1696 | .block, |
| ... | ... | @@ -1717,7 +1717,7 @@ pub fn typeOfIndex(air: *const Air, inst: Air.Inst.Index, ip: *const InternPool) |
| 1717 | 1717 | .try_ptr_cold, |
| 1718 | 1718 | .shuffle_one, |
| 1719 | 1719 | .shuffle_two, |
| 1720 | => return datas[@intFromEnum(inst)].ty_pl.ty.toType(), | |
| 1720 | => return datas[@backingInt(inst)].ty_pl.ty.toType(), | |
| 1721 | 1721 | |
| 1722 | 1722 | .not, |
| 1723 | 1723 | .bit_cast, |
| ... | ... | @@ -1770,7 +1770,7 @@ pub fn typeOfIndex(air: *const Air, inst: Air.Inst.Index, ip: *const InternPool) |
| 1770 | 1770 | .c_va_arg, |
| 1771 | 1771 | .c_va_copy, |
| 1772 | 1772 | .abs, |
| 1773 | => return datas[@intFromEnum(inst)].ty_op.ty.toType(), | |
| 1773 | => return datas[@backingInt(inst)].ty_op.ty.toType(), | |
| 1774 | 1774 | |
| 1775 | 1775 | .loop, |
| 1776 | 1776 | .repeat, |
| ... | ... | @@ -1821,40 +1821,40 @@ pub fn typeOfIndex(air: *const Air, inst: Air.Inst.Index, ip: *const InternPool) |
| 1821 | 1821 | .tag_name, .error_name => return .slice_const_u8_sentinel_0, |
| 1822 | 1822 | |
| 1823 | 1823 | .call, .call_always_tail, .call_never_tail, .call_never_inline => { |
| 1824 | const callee_ty = air.typeOf(datas[@intFromEnum(inst)].pl_op.operand, ip); | |
| 1824 | const callee_ty = air.typeOf(datas[@backingInt(inst)].pl_op.operand, ip); | |
| 1825 | 1825 | return .fromInterned(ip.funcTypeReturnType(callee_ty.toIntern())); |
| 1826 | 1826 | }, |
| 1827 | 1827 | |
| 1828 | 1828 | .slice_elem_val, .ptr_elem_val, .array_elem_val, .legalize_vec_elem_val => { |
| 1829 | const ptr_ty = air.typeOf(datas[@intFromEnum(inst)].bin_op.lhs, ip); | |
| 1829 | const ptr_ty = air.typeOf(datas[@backingInt(inst)].bin_op.lhs, ip); | |
| 1830 | 1830 | return ptr_ty.childTypeIp(ip); |
| 1831 | 1831 | }, |
| 1832 | 1832 | .atomic_load => { |
| 1833 | const ptr_ty = air.typeOf(datas[@intFromEnum(inst)].atomic_load.ptr, ip); | |
| 1833 | const ptr_ty = air.typeOf(datas[@backingInt(inst)].atomic_load.ptr, ip); | |
| 1834 | 1834 | return ptr_ty.childTypeIp(ip); |
| 1835 | 1835 | }, |
| 1836 | 1836 | .atomic_rmw => { |
| 1837 | const ptr_ty = air.typeOf(datas[@intFromEnum(inst)].pl_op.operand, ip); | |
| 1837 | const ptr_ty = air.typeOf(datas[@backingInt(inst)].pl_op.operand, ip); | |
| 1838 | 1838 | return ptr_ty.childTypeIp(ip); |
| 1839 | 1839 | }, |
| 1840 | 1840 | |
| 1841 | 1841 | .reduce, .reduce_optimized => { |
| 1842 | const operand_ty = air.typeOf(datas[@intFromEnum(inst)].reduce.operand, ip); | |
| 1842 | const operand_ty = air.typeOf(datas[@backingInt(inst)].reduce.operand, ip); | |
| 1843 | 1843 | return .fromInterned(ip.indexToKey(operand_ty.ip_index).vector_type.child); |
| 1844 | 1844 | }, |
| 1845 | 1845 | |
| 1846 | .mul_add => return air.typeOf(datas[@intFromEnum(inst)].pl_op.operand, ip), | |
| 1846 | .mul_add => return air.typeOf(datas[@backingInt(inst)].pl_op.operand, ip), | |
| 1847 | 1847 | .select => { |
| 1848 | const extra = air.extraData(Air.Bin, datas[@intFromEnum(inst)].pl_op.payload).data; | |
| 1848 | const extra = air.extraData(Air.Bin, datas[@backingInt(inst)].pl_op.payload).data; | |
| 1849 | 1849 | return air.typeOf(extra.lhs, ip); |
| 1850 | 1850 | }, |
| 1851 | 1851 | |
| 1852 | 1852 | .@"try", .try_cold => { |
| 1853 | const err_union_ty = air.typeOf(datas[@intFromEnum(inst)].pl_op.operand, ip); | |
| 1853 | const err_union_ty = air.typeOf(datas[@backingInt(inst)].pl_op.operand, ip); | |
| 1854 | 1854 | return .fromInterned(ip.indexToKey(err_union_ty.ip_index).error_union_type.payload_type); |
| 1855 | 1855 | }, |
| 1856 | 1856 | |
| 1857 | .runtime_nav_ptr => return .fromInterned(datas[@intFromEnum(inst)].ty_nav.ty), | |
| 1857 | .runtime_nav_ptr => return .fromInterned(datas[@backingInt(inst)].ty_nav.ty), | |
| 1858 | 1858 | |
| 1859 | 1859 | .work_item_id, |
| 1860 | 1860 | .work_group_size, |
| ... | ... | @@ -1862,7 +1862,7 @@ pub fn typeOfIndex(air: *const Air, inst: Air.Inst.Index, ip: *const InternPool) |
| 1862 | 1862 | .spirv_runtime_array_len, |
| 1863 | 1863 | => return .u32, |
| 1864 | 1864 | |
| 1865 | .legalize_compiler_rt_call => return datas[@intFromEnum(inst)].legalize_compiler_rt_call.func.returnType(), | |
| 1865 | .legalize_compiler_rt_call => return datas[@backingInt(inst)].legalize_compiler_rt_call.func.returnType(), | |
| 1866 | 1866 | |
| 1867 | 1867 | .inferred_alloc => unreachable, |
| 1868 | 1868 | .inferred_alloc_comptime => unreachable, |
| ... | ... | @@ -1878,7 +1878,7 @@ pub fn extraData(air: Air, comptime T: type, index: usize) struct { data: T, end |
| 1878 | 1878 | inline for (info.field_names, info.field_types) |field_name, field_type| { |
| 1879 | 1879 | @field(result, field_name) = switch (field_type) { |
| 1880 | 1880 | u32 => air.extra.items[i], |
| 1881 | InternPool.Index, Inst.Ref => @enumFromInt(air.extra.items[i]), | |
| 1881 | InternPool.Index, Inst.Ref => @fromBackingInt(@intCast(air.extra.items[i])), | |
| 1882 | 1882 | i32, CondBr.BranchHints, Asm.Flags => @bitCast(air.extra.items[i]), |
| 1883 | 1883 | else => @compileError("bad field type: " ++ @typeName(field_type)), |
| 1884 | 1884 | }; |
| ... | ... | @@ -1906,7 +1906,7 @@ pub const NullTerminatedString = enum(u32) { |
| 1906 | 1906 | |
| 1907 | 1907 | pub fn toSlice(nts: NullTerminatedString, air: Air) [:0]const u8 { |
| 1908 | 1908 | if (nts == .none) return ""; |
| 1909 | const bytes = std.mem.sliceAsBytes(air.extra.items[@intFromEnum(nts)..]); | |
| 1909 | const bytes = std.mem.sliceAsBytes(air.extra.items[@backingInt(nts)..]); | |
| 1910 | 1910 | return bytes[0..std.mem.indexOfScalar(u8, bytes, 0).? :0]; |
| 1911 | 1911 | } |
| 1912 | 1912 | }; |
| ... | ... | @@ -1916,8 +1916,8 @@ pub const NullTerminatedString = enum(u32) { |
| 1916 | 1916 | /// lowered, and Liveness determines its result is unused, backends should |
| 1917 | 1917 | /// avoid lowering it. |
| 1918 | 1918 | pub fn mustLower(air: Air, inst: Air.Inst.Index, ip: *const InternPool) bool { |
| 1919 | const data = air.instructions.items(.data)[@intFromEnum(inst)]; | |
| 1920 | return switch (air.instructions.items(.tag)[@intFromEnum(inst)]) { | |
| 1919 | const data = air.instructions.items(.data)[@backingInt(inst)]; | |
| 1920 | return switch (air.instructions.items(.tag)[@backingInt(inst)]) { | |
| 1921 | 1921 | .arg, |
| 1922 | 1922 | .assembly, |
| 1923 | 1923 | .block, |
| ... | ... | @@ -2165,7 +2165,7 @@ pub const UnwrappedSwitch = struct { |
| 2165 | 2165 | fn getHintInner(us: UnwrappedSwitch, idx: u32) std.lang.BranchHint { |
| 2166 | 2166 | const bag = us.air.extra.items[us.branch_hints_start..][idx / 10]; |
| 2167 | 2167 | const bits: u3 = @truncate(bag >> @intCast(3 * (idx % 10))); |
| 2168 | return @enumFromInt(bits); | |
| 2168 | return @fromBackingInt(@intCast(bits)); | |
| 2169 | 2169 | } |
| 2170 | 2170 | |
| 2171 | 2171 | pub fn iterateCases(us: UnwrappedSwitch) CaseIterator { |
| ... | ... | @@ -2224,7 +2224,7 @@ pub const UnwrappedSwitch = struct { |
| 2224 | 2224 | }; |
| 2225 | 2225 | |
| 2226 | 2226 | pub fn unwrapSwitch(air: *const Air, switch_inst: Inst.Index) UnwrappedSwitch { |
| 2227 | const inst = air.instructions.get(@intFromEnum(switch_inst)); | |
| 2227 | const inst = air.instructions.get(@backingInt(switch_inst)); | |
| 2228 | 2228 | switch (inst.tag) { |
| 2229 | 2229 | .switch_br, .loop_switch_br => {}, |
| 2230 | 2230 | else => unreachable, // assertion failure |
| ... | ... | @@ -2249,8 +2249,8 @@ pub const UnwrappedDbgInlineBlock = struct { |
| 2249 | 2249 | }; |
| 2250 | 2250 | |
| 2251 | 2251 | pub fn unwrapDbgBlock(air: *const Air, inst_index: Inst.Index) UnwrappedDbgInlineBlock { |
| 2252 | const data = air.instructions.items(.data)[@intFromEnum(inst_index)]; | |
| 2253 | const tag = air.instructions.items(.tag)[@intFromEnum(inst_index)]; | |
| 2252 | const data = air.instructions.items(.data)[@backingInt(inst_index)]; | |
| 2253 | const tag = air.instructions.items(.tag)[@backingInt(inst_index)]; | |
| 2254 | 2254 | assert(tag == .dbg_inline_block); |
| 2255 | 2255 | const payload = data.ty_pl.payload; |
| 2256 | 2256 | const extra = air.extraData(Air.DbgInlineBlock, payload); |
| ... | ... | @@ -2267,8 +2267,8 @@ pub const UnwrappedBlock = struct { |
| 2267 | 2267 | }; |
| 2268 | 2268 | |
| 2269 | 2269 | pub fn unwrapBlock(air: *const Air, inst_index: Inst.Index) UnwrappedBlock { |
| 2270 | const data = air.instructions.items(.data)[@intFromEnum(inst_index)]; | |
| 2271 | const tag = air.instructions.items(.tag)[@intFromEnum(inst_index)]; | |
| 2270 | const data = air.instructions.items(.data)[@backingInt(inst_index)]; | |
| 2271 | const tag = air.instructions.items(.tag)[@backingInt(inst_index)]; | |
| 2272 | 2272 | const payload = switch (tag) { |
| 2273 | 2273 | .block, .loop => data.ty_pl.payload, |
| 2274 | 2274 | else => unreachable, |
| ... | ... | @@ -2286,8 +2286,8 @@ pub const UnwrappedCall = struct { |
| 2286 | 2286 | }; |
| 2287 | 2287 | |
| 2288 | 2288 | pub fn unwrapCall(air: *const Air, inst_index: Inst.Index) UnwrappedCall { |
| 2289 | const data = air.instructions.items(.data)[@intFromEnum(inst_index)]; | |
| 2290 | const tag = air.instructions.items(.tag)[@intFromEnum(inst_index)]; | |
| 2289 | const data = air.instructions.items(.data)[@backingInt(inst_index)]; | |
| 2290 | const tag = air.instructions.items(.tag)[@backingInt(inst_index)]; | |
| 2291 | 2291 | const payload = switch (tag) { |
| 2292 | 2292 | .call, .call_always_tail, .call_never_tail, .call_never_inline => data.pl_op.payload, |
| 2293 | 2293 | else => unreachable, |
| ... | ... | @@ -2305,8 +2305,8 @@ pub const UnwrappedCompilerRtCall = struct { |
| 2305 | 2305 | }; |
| 2306 | 2306 | |
| 2307 | 2307 | pub fn unwrapCompilerRtCall(air: *const Air, inst_index: Inst.Index) UnwrappedCompilerRtCall { |
| 2308 | const data = air.instructions.items(.data)[@intFromEnum(inst_index)]; | |
| 2309 | const tag = air.instructions.items(.tag)[@intFromEnum(inst_index)]; | |
| 2308 | const data = air.instructions.items(.data)[@backingInt(inst_index)]; | |
| 2309 | const tag = air.instructions.items(.tag)[@backingInt(inst_index)]; | |
| 2310 | 2310 | assert(tag == .legalize_compiler_rt_call); |
| 2311 | 2311 | const payload = data.legalize_compiler_rt_call.payload; |
| 2312 | 2312 | const extra = air.extraData(Air.Call, payload); |
| ... | ... | @@ -2324,8 +2324,8 @@ pub const UnwrappedCondBr = struct { |
| 2324 | 2324 | }; |
| 2325 | 2325 | |
| 2326 | 2326 | pub fn unwrapCondBr(air: *const Air, inst_index: Inst.Index) UnwrappedCondBr { |
| 2327 | const data = air.instructions.items(.data)[@intFromEnum(inst_index)]; | |
| 2328 | const tag = air.instructions.items(.tag)[@intFromEnum(inst_index)]; | |
| 2327 | const data = air.instructions.items(.data)[@backingInt(inst_index)]; | |
| 2328 | const tag = air.instructions.items(.tag)[@backingInt(inst_index)]; | |
| 2329 | 2329 | assert(tag == .cond_br); |
| 2330 | 2330 | const payload = data.pl_op.payload; |
| 2331 | 2331 | const extra = air.extraData(Air.CondBr, payload); |
| ... | ... | @@ -2343,8 +2343,8 @@ pub const UnwrappedTry = struct { |
| 2343 | 2343 | }; |
| 2344 | 2344 | |
| 2345 | 2345 | pub fn unwrapTry(air: *const Air, inst_index: Inst.Index) UnwrappedTry { |
| 2346 | const data = air.instructions.items(.data)[@intFromEnum(inst_index)]; | |
| 2347 | const tag = air.instructions.items(.tag)[@intFromEnum(inst_index)]; | |
| 2346 | const data = air.instructions.items(.data)[@backingInt(inst_index)]; | |
| 2347 | const tag = air.instructions.items(.tag)[@backingInt(inst_index)]; | |
| 2348 | 2348 | assert(tag == .@"try" or tag == .try_cold); |
| 2349 | 2349 | const payload = data.pl_op.payload; |
| 2350 | 2350 | const extra = air.extraData(Air.Try, payload); |
| ... | ... | @@ -2361,8 +2361,8 @@ pub const UnwrappedTryPtr = struct { |
| 2361 | 2361 | }; |
| 2362 | 2362 | |
| 2363 | 2363 | pub fn unwrapTryPtr(air: *const Air, inst_index: Inst.Index) UnwrappedTryPtr { |
| 2364 | const data = air.instructions.items(.data)[@intFromEnum(inst_index)]; | |
| 2365 | const tag = air.instructions.items(.tag)[@intFromEnum(inst_index)]; | |
| 2364 | const data = air.instructions.items(.data)[@backingInt(inst_index)]; | |
| 2365 | const tag = air.instructions.items(.tag)[@backingInt(inst_index)]; | |
| 2366 | 2366 | assert(tag == .try_ptr or tag == .try_ptr_cold); |
| 2367 | 2367 | const payload = data.ty_pl.payload; |
| 2368 | 2368 | const extra = air.extraData(Air.TryPtr, payload); |
| ... | ... | @@ -2430,8 +2430,8 @@ pub const UnwrappedAsm = struct { |
| 2430 | 2430 | }; |
| 2431 | 2431 | |
| 2432 | 2432 | pub fn unwrapAsm(air: *const Air, inst_index: Inst.Index) UnwrappedAsm { |
| 2433 | const data = air.instructions.items(.data)[@intFromEnum(inst_index)]; | |
| 2434 | const tag = air.instructions.items(.tag)[@intFromEnum(inst_index)]; | |
| 2433 | const data = air.instructions.items(.data)[@backingInt(inst_index)]; | |
| 2434 | const tag = air.instructions.items(.tag)[@backingInt(inst_index)]; | |
| 2435 | 2435 | assert(tag == .assembly); |
| 2436 | 2436 | const payload = data.ty_pl.payload; |
| 2437 | 2437 | const extra = air.extraData(Air.Asm, payload); |
| ... | ... | @@ -2465,7 +2465,7 @@ pub const UnwrappedShuffleOne = struct { |
| 2465 | 2465 | }; |
| 2466 | 2466 | |
| 2467 | 2467 | pub fn unwrapShuffleOne(air: *const Air, zcu: *const Zcu, inst_index: Inst.Index) UnwrappedShuffleOne { |
| 2468 | const inst = air.instructions.get(@intFromEnum(inst_index)); | |
| 2468 | const inst = air.instructions.get(@backingInt(inst_index)); | |
| 2469 | 2469 | switch (inst.tag) { |
| 2470 | 2470 | .shuffle_one => {}, |
| 2471 | 2471 | else => unreachable, // assertion failure |
| ... | ... | @@ -2475,7 +2475,7 @@ pub fn unwrapShuffleOne(air: *const Air, zcu: *const Zcu, inst_index: Inst.Index |
| 2475 | 2475 | const extra_idx = inst.data.ty_pl.payload; |
| 2476 | 2476 | return .{ |
| 2477 | 2477 | .result_ty = result_ty, |
| 2478 | .operand = @enumFromInt(air.extra.items[extra_idx + mask_len]), | |
| 2478 | .operand = @fromBackingInt(@intCast(air.extra.items[extra_idx + mask_len])), | |
| 2479 | 2479 | .mask = @ptrCast(air.extra.items[extra_idx..][0..mask_len]), |
| 2480 | 2480 | }; |
| 2481 | 2481 | } |
| ... | ... | @@ -2488,7 +2488,7 @@ pub const UnwrappedShuffleTwo = struct { |
| 2488 | 2488 | }; |
| 2489 | 2489 | |
| 2490 | 2490 | pub fn unwrapShuffleTwo(air: *const Air, zcu: *const Zcu, inst_index: Inst.Index) UnwrappedShuffleTwo { |
| 2491 | const inst = air.instructions.get(@intFromEnum(inst_index)); | |
| 2491 | const inst = air.instructions.get(@backingInt(inst_index)); | |
| 2492 | 2492 | switch (inst.tag) { |
| 2493 | 2493 | .shuffle_two => {}, |
| 2494 | 2494 | else => unreachable, // assertion failure |
| ... | ... | @@ -2498,8 +2498,8 @@ pub fn unwrapShuffleTwo(air: *const Air, zcu: *const Zcu, inst_index: Inst.Index |
| 2498 | 2498 | const extra_idx = inst.data.ty_pl.payload; |
| 2499 | 2499 | return .{ |
| 2500 | 2500 | .result_ty = result_ty, |
| 2501 | .operand_a = @enumFromInt(air.extra.items[extra_idx + mask_len + 0]), | |
| 2502 | .operand_b = @enumFromInt(air.extra.items[extra_idx + mask_len + 1]), | |
| 2501 | .operand_a = @fromBackingInt(@intCast(air.extra.items[extra_idx + mask_len + 0])), | |
| 2502 | .operand_b = @fromBackingInt(@intCast(air.extra.items[extra_idx + mask_len + 1])), | |
| 2503 | 2503 | .mask = @ptrCast(air.extra.items[extra_idx..][0..mask_len]), |
| 2504 | 2504 | }; |
| 2505 | 2505 | } |
src/Air/Legalize.zig+79-79| ... | ... | @@ -328,7 +328,7 @@ pub fn legalize(air: *Air, pt: Zcu.PerThread, features: *const Features) Error!v |
| 328 | 328 | .features = .init(features), |
| 329 | 329 | }; |
| 330 | 330 | defer air.* = l.getTmpAir(); |
| 331 | const main_extra = l.extraData(Air.Block, l.air_extra.items[@intFromEnum(Air.ExtraIndex.main_block)]); | |
| 331 | const main_extra = l.extraData(Air.Block, l.air_extra.items[@backingInt(Air.ExtraIndex.main_block)]); | |
| 332 | 332 | try l.legalizeBody(main_extra.end, main_extra.data.body_len); |
| 333 | 333 | } |
| 334 | 334 | |
| ... | ... | @@ -359,8 +359,8 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void { |
| 359 | 359 | const zcu = l.pt.zcu; |
| 360 | 360 | const ip = &zcu.intern_pool; |
| 361 | 361 | for (0..body_len) |body_index| { |
| 362 | const inst: Air.Inst.Index = @enumFromInt(l.air_extra.items[body_start + body_index]); | |
| 363 | inst: switch (l.air_instructions.items(.tag)[@intFromEnum(inst)]) { | |
| 362 | const inst: Air.Inst.Index = @fromBackingInt(@intCast(l.air_extra.items[body_start + body_index])); | |
| 363 | inst: switch (l.air_instructions.items(.tag)[@backingInt(inst)]) { | |
| 364 | 364 | .arg => {}, |
| 365 | 365 | inline .add, |
| 366 | 366 | .add_optimized, |
| ... | ... | @@ -377,7 +377,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void { |
| 377 | 377 | .min, |
| 378 | 378 | .max, |
| 379 | 379 | => |air_tag| { |
| 380 | const bin_op = l.air_instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 380 | const bin_op = l.air_instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 381 | 381 | const ty = l.typeOf(bin_op.lhs); |
| 382 | 382 | switch (l.wantScalarizeOrSoftFloat(air_tag, ty)) { |
| 383 | 383 | .none => {}, |
| ... | ... | @@ -395,7 +395,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void { |
| 395 | 395 | .div_floor, |
| 396 | 396 | .div_floor_optimized, |
| 397 | 397 | => |air_tag| { |
| 398 | const bin_op = l.air_instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 398 | const bin_op = l.air_instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 399 | 399 | switch (l.wantScalarizeOrSoftFloat(air_tag, l.typeOf(bin_op.lhs))) { |
| 400 | 400 | .none => {}, |
| 401 | 401 | .scalarize => continue :inst l.replaceInst(inst, .block, try l.scalarizeBlockPayload(inst, .bin_op)), |
| ... | ... | @@ -408,7 +408,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void { |
| 408 | 408 | } |
| 409 | 409 | }, |
| 410 | 410 | inline .mod, .mod_optimized => |air_tag| { |
| 411 | const bin_op = l.air_instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 411 | const bin_op = l.air_instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 412 | 412 | switch (l.wantScalarizeOrSoftFloat(air_tag, l.typeOf(bin_op.lhs))) { |
| 413 | 413 | .none => {}, |
| 414 | 414 | .scalarize => continue :inst l.replaceInst(inst, .block, try l.scalarizeBlockPayload(inst, .bin_op)), |
| ... | ... | @@ -429,7 +429,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void { |
| 429 | 429 | .bit_or, |
| 430 | 430 | .xor, |
| 431 | 431 | => |air_tag| if (l.features.has(comptime .scalarize(air_tag))) { |
| 432 | const bin_op = l.air_instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 432 | const bin_op = l.air_instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 433 | 433 | if (l.typeOf(bin_op.lhs).isVector(zcu)) { |
| 434 | 434 | continue :inst l.replaceInst(inst, .block, try l.scalarizeBlockPayload(inst, .bin_op)); |
| 435 | 435 | } |
| ... | ... | @@ -438,7 +438,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void { |
| 438 | 438 | assert(!l.features.has(.scalarize_add_safe)); // it doesn't make sense to do both |
| 439 | 439 | continue :inst l.replaceInst(inst, .block, try l.safeArithmeticBlockPayload(inst, .add_with_overflow)); |
| 440 | 440 | } else if (l.features.has(.scalarize_add_safe)) { |
| 441 | const bin_op = l.air_instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 441 | const bin_op = l.air_instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 442 | 442 | if (l.typeOf(bin_op.lhs).isVector(zcu)) { |
| 443 | 443 | continue :inst l.replaceInst(inst, .block, try l.scalarizeBlockPayload(inst, .bin_op)); |
| 444 | 444 | } |
| ... | ... | @@ -447,7 +447,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void { |
| 447 | 447 | assert(!l.features.has(.scalarize_sub_safe)); // it doesn't make sense to do both |
| 448 | 448 | continue :inst l.replaceInst(inst, .block, try l.safeArithmeticBlockPayload(inst, .sub_with_overflow)); |
| 449 | 449 | } else if (l.features.has(.scalarize_sub_safe)) { |
| 450 | const bin_op = l.air_instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 450 | const bin_op = l.air_instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 451 | 451 | if (l.typeOf(bin_op.lhs).isVector(zcu)) { |
| 452 | 452 | continue :inst l.replaceInst(inst, .block, try l.scalarizeBlockPayload(inst, .bin_op)); |
| 453 | 453 | } |
| ... | ... | @@ -456,7 +456,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void { |
| 456 | 456 | assert(!l.features.has(.scalarize_mul_safe)); // it doesn't make sense to do both |
| 457 | 457 | continue :inst l.replaceInst(inst, .block, try l.safeArithmeticBlockPayload(inst, .mul_with_overflow)); |
| 458 | 458 | } else if (l.features.has(.scalarize_mul_safe)) { |
| 459 | const bin_op = l.air_instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 459 | const bin_op = l.air_instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 460 | 460 | if (l.typeOf(bin_op.lhs).isVector(zcu)) { |
| 461 | 461 | continue :inst l.replaceInst(inst, .block, try l.scalarizeBlockPayload(inst, .bin_op)); |
| 462 | 462 | } |
| ... | ... | @@ -467,7 +467,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void { |
| 467 | 467 | .mul_with_overflow, |
| 468 | 468 | .shl_with_overflow, |
| 469 | 469 | => |air_tag| if (l.features.has(comptime .scalarize(air_tag))) { |
| 470 | const ty_pl = l.air_instructions.items(.data)[@intFromEnum(inst)].ty_pl; | |
| 470 | const ty_pl = l.air_instructions.items(.data)[@backingInt(inst)].ty_pl; | |
| 471 | 471 | if (ty_pl.ty.toType().fieldType(0, zcu).isVector(zcu)) { |
| 472 | 472 | continue :inst l.replaceInst(inst, .block, try l.scalarizeOverflowBlockPayload(inst)); |
| 473 | 473 | } |
| ... | ... | @@ -484,7 +484,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void { |
| 484 | 484 | .unsplat_shift_rhs, |
| 485 | 485 | .scalarize(air_tag), |
| 486 | 486 | })) { |
| 487 | const bin_op = l.air_instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 487 | const bin_op = l.air_instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 488 | 488 | if (l.typeOf(bin_op.rhs).isVector(zcu)) { |
| 489 | 489 | if (l.features.has(.unsplat_shift_rhs)) { |
| 490 | 490 | if (bin_op.rhs.toInterned()) |rhs_ip_index| switch (ip.indexToKey(rhs_ip_index)) { |
| ... | ... | @@ -498,11 +498,11 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void { |
| 498 | 498 | }, |
| 499 | 499 | } else { |
| 500 | 500 | const rhs_inst = bin_op.rhs.toIndex().?; |
| 501 | switch (l.air_instructions.items(.tag)[@intFromEnum(rhs_inst)]) { | |
| 501 | switch (l.air_instructions.items(.tag)[@backingInt(rhs_inst)]) { | |
| 502 | 502 | else => {}, |
| 503 | 503 | .splat => continue :inst l.replaceInst(inst, air_tag, .{ .bin_op = .{ |
| 504 | 504 | .lhs = bin_op.lhs, |
| 505 | .rhs = l.air_instructions.items(.data)[@intFromEnum(rhs_inst)].ty_op.operand, | |
| 505 | .rhs = l.air_instructions.items(.data)[@backingInt(rhs_inst)].ty_op.operand, | |
| 506 | 506 | } }), |
| 507 | 507 | } |
| 508 | 508 | } |
| ... | ... | @@ -524,13 +524,13 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void { |
| 524 | 524 | .int_from_ptr, |
| 525 | 525 | .trunc, |
| 526 | 526 | => |air_tag| if (l.features.has(comptime .scalarize(air_tag))) { |
| 527 | const ty_op = l.air_instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 527 | const ty_op = l.air_instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 528 | 528 | if (ty_op.ty.toType().isVector(zcu)) { |
| 529 | 529 | continue :inst l.replaceInst(inst, .block, try l.scalarizeBlockPayload(inst, .ty_op)); |
| 530 | 530 | } |
| 531 | 531 | }, |
| 532 | 532 | .abs => { |
| 533 | const ty_op = l.air_instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 533 | const ty_op = l.air_instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 534 | 534 | switch (l.wantScalarizeOrSoftFloat(.abs, ty_op.ty.toType())) { |
| 535 | 535 | .none => {}, |
| 536 | 536 | .scalarize => continue :inst l.replaceInst(inst, .block, try l.scalarizeBlockPayload(inst, .ty_op)), |
| ... | ... | @@ -543,7 +543,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void { |
| 543 | 543 | } |
| 544 | 544 | }, |
| 545 | 545 | .fptrunc => { |
| 546 | const ty_op = l.air_instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 546 | const ty_op = l.air_instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 547 | 547 | const src_ty = l.typeOf(ty_op.operand); |
| 548 | 548 | const dest_ty = ty_op.ty.toType(); |
| 549 | 549 | if (src_ty.zigTypeTag(zcu) == .vector) { |
| ... | ... | @@ -558,7 +558,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void { |
| 558 | 558 | } |
| 559 | 559 | }, |
| 560 | 560 | .fpext => { |
| 561 | const ty_op = l.air_instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 561 | const ty_op = l.air_instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 562 | 562 | const src_ty = l.typeOf(ty_op.operand); |
| 563 | 563 | const dest_ty = ty_op.ty.toType(); |
| 564 | 564 | if (src_ty.zigTypeTag(zcu) == .vector) { |
| ... | ... | @@ -573,7 +573,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void { |
| 573 | 573 | } |
| 574 | 574 | }, |
| 575 | 575 | inline .int_from_float, .int_from_float_optimized => |air_tag| { |
| 576 | const ty_op = l.air_instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 576 | const ty_op = l.air_instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 577 | 577 | switch (l.wantScalarizeOrSoftFloat(air_tag, l.typeOf(ty_op.operand))) { |
| 578 | 578 | .none => {}, |
| 579 | 579 | .scalarize => continue :inst l.replaceInst(inst, .block, try l.scalarizeBlockPayload(inst, .ty_op)), |
| ... | ... | @@ -584,7 +584,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void { |
| 584 | 584 | } |
| 585 | 585 | }, |
| 586 | 586 | .float_from_int => { |
| 587 | const ty_op = l.air_instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 587 | const ty_op = l.air_instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 588 | 588 | const dest_ty = ty_op.ty.toType(); |
| 589 | 589 | switch (l.wantScalarizeOrSoftFloat(.float_from_int, dest_ty)) { |
| 590 | 590 | .none => {}, |
| ... | ... | @@ -608,7 +608,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void { |
| 608 | 608 | if (try l.safeBitcastBlockPayload(inst)) |payload| { |
| 609 | 609 | continue :inst l.replaceInst(inst, .block, payload); |
| 610 | 610 | } |
| 611 | const ty_op = l.air_instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 611 | const ty_op = l.air_instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 612 | 612 | continue :inst l.replaceInst(inst, .bit_cast, .{ .ty_op = ty_op }); |
| 613 | 613 | } else if (l.features.hasAny(&.{ |
| 614 | 614 | .scalarize_bit_cast_array, |
| ... | ... | @@ -624,10 +624,10 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void { |
| 624 | 624 | if (try l.safeIntcastBlockPayload(inst)) |payload| { |
| 625 | 625 | continue :inst l.replaceInst(inst, .block, payload); |
| 626 | 626 | } |
| 627 | const ty_op = l.air_instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 627 | const ty_op = l.air_instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 628 | 628 | continue :inst l.replaceInst(inst, .int_cast, .{ .ty_op = ty_op }); |
| 629 | 629 | } else if (l.features.has(.scalarize_int_cast_safe)) { |
| 630 | const ty_op = l.air_instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 630 | const ty_op = l.air_instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 631 | 631 | if (ty_op.ty.toType().isVector(zcu)) { |
| 632 | 632 | continue :inst l.replaceInst(inst, .block, try l.scalarizeBlockPayload(inst, .ty_op)); |
| 633 | 633 | } |
| ... | ... | @@ -643,7 +643,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void { |
| 643 | 643 | assert(!l.features.has(.scalarize(air_tag))); // it doesn't make sense to do both |
| 644 | 644 | continue :inst l.replaceInst(inst, .block, try l.divCeilBlockPayload(inst, air_tag)); |
| 645 | 645 | } else { |
| 646 | const bin_op = l.air_instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 646 | const bin_op = l.air_instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 647 | 647 | switch (l.wantScalarizeOrSoftFloat(air_tag, l.typeOf(bin_op.lhs))) { |
| 648 | 648 | .none => {}, |
| 649 | 649 | .scalarize => continue :inst l.replaceInst(inst, .block, try l.scalarizeBlockPayload(inst, .bin_op)), |
| ... | ... | @@ -669,7 +669,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void { |
| 669 | 669 | assert(!l.features.has(.scalarize(air_tag))); |
| 670 | 670 | continue :inst l.replaceInst(inst, .block, try l.safeIntFromFloatBlockPayload(inst, optimized)); |
| 671 | 671 | } |
| 672 | const ty_op = l.air_instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 672 | const ty_op = l.air_instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 673 | 673 | switch (l.wantScalarizeOrSoftFloat(air_tag, l.typeOf(ty_op.operand))) { |
| 674 | 674 | .none => {}, |
| 675 | 675 | .scalarize => continue :inst l.replaceInst(inst, .block, try l.scalarizeBlockPayload(inst, .ty_op)), |
| ... | ... | @@ -678,7 +678,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void { |
| 678 | 678 | } |
| 679 | 679 | }, |
| 680 | 680 | .block, .loop => { |
| 681 | const ty_pl = l.air_instructions.items(.data)[@intFromEnum(inst)].ty_pl; | |
| 681 | const ty_pl = l.air_instructions.items(.data)[@backingInt(inst)].ty_pl; | |
| 682 | 682 | const extra = l.extraData(Air.Block, ty_pl.payload); |
| 683 | 683 | try l.legalizeBody(extra.end, extra.data.body_len); |
| 684 | 684 | }, |
| ... | ... | @@ -707,7 +707,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void { |
| 707 | 707 | .round, |
| 708 | 708 | .trunc_float, |
| 709 | 709 | => |air_tag| { |
| 710 | const operand = l.air_instructions.items(.data)[@intFromEnum(inst)].un_op; | |
| 710 | const operand = l.air_instructions.items(.data)[@backingInt(inst)].un_op; | |
| 711 | 711 | const ty = l.typeOf(operand); |
| 712 | 712 | switch (l.wantScalarizeOrSoftFloat(air_tag, ty)) { |
| 713 | 713 | .none => {}, |
| ... | ... | @@ -721,7 +721,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void { |
| 721 | 721 | } |
| 722 | 722 | }, |
| 723 | 723 | inline .neg, .neg_optimized => |air_tag| { |
| 724 | const operand = l.air_instructions.items(.data)[@intFromEnum(inst)].un_op; | |
| 724 | const operand = l.air_instructions.items(.data)[@backingInt(inst)].un_op; | |
| 725 | 725 | switch (l.wantScalarizeOrSoftFloat(air_tag, l.typeOf(operand))) { |
| 726 | 726 | .none => {}, |
| 727 | 727 | .scalarize => continue :inst l.replaceInst(inst, .block, try l.scalarizeBlockPayload(inst, .un_op)), |
| ... | ... | @@ -741,7 +741,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void { |
| 741 | 741 | .cmp_neq, |
| 742 | 742 | .cmp_neq_optimized, |
| 743 | 743 | => |air_tag| { |
| 744 | const bin_op = l.air_instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 744 | const bin_op = l.air_instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 745 | 745 | const ty = l.typeOf(bin_op.lhs); |
| 746 | 746 | if (l.wantSoftFloatScalar(ty)) { |
| 747 | 747 | continue :inst l.replaceInst( |
| ... | ... | @@ -752,7 +752,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void { |
| 752 | 752 | } |
| 753 | 753 | }, |
| 754 | 754 | inline .cmp_vector, .cmp_vector_optimized => |air_tag| { |
| 755 | const ty_pl = l.air_instructions.items(.data)[@intFromEnum(inst)].ty_pl; | |
| 755 | const ty_pl = l.air_instructions.items(.data)[@backingInt(inst)].ty_pl; | |
| 756 | 756 | const payload = l.extraData(Air.VectorCmp, ty_pl.payload).data; |
| 757 | 757 | switch (l.wantScalarizeOrSoftFloat(air_tag, l.typeOf(payload.lhs))) { |
| 758 | 758 | .none => {}, |
| ... | ... | @@ -761,13 +761,13 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void { |
| 761 | 761 | } |
| 762 | 762 | }, |
| 763 | 763 | .cond_br => { |
| 764 | const pl_op = l.air_instructions.items(.data)[@intFromEnum(inst)].pl_op; | |
| 764 | const pl_op = l.air_instructions.items(.data)[@backingInt(inst)].pl_op; | |
| 765 | 765 | const extra = l.extraData(Air.CondBr, pl_op.payload); |
| 766 | 766 | try l.legalizeBody(extra.end, extra.data.then_body_len); |
| 767 | 767 | try l.legalizeBody(extra.end + extra.data.then_body_len, extra.data.else_body_len); |
| 768 | 768 | }, |
| 769 | 769 | .switch_br, .loop_switch_br => { |
| 770 | const pl_op = l.air_instructions.items(.data)[@intFromEnum(inst)].pl_op; | |
| 770 | const pl_op = l.air_instructions.items(.data)[@backingInt(inst)].pl_op; | |
| 771 | 771 | const extra = l.extraData(Air.SwitchBr, pl_op.payload); |
| 772 | 772 | const hint_bag_count = @divCeil(extra.data.cases_len + 1, 10); |
| 773 | 773 | var extra_index = extra.end + hint_bag_count; |
| ... | ... | @@ -781,18 +781,18 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void { |
| 781 | 781 | }, |
| 782 | 782 | .switch_dispatch => {}, |
| 783 | 783 | .@"try", .try_cold => { |
| 784 | const pl_op = l.air_instructions.items(.data)[@intFromEnum(inst)].pl_op; | |
| 784 | const pl_op = l.air_instructions.items(.data)[@backingInt(inst)].pl_op; | |
| 785 | 785 | const extra = l.extraData(Air.Try, pl_op.payload); |
| 786 | 786 | try l.legalizeBody(extra.end, extra.data.body_len); |
| 787 | 787 | }, |
| 788 | 788 | .try_ptr, .try_ptr_cold => { |
| 789 | const ty_pl = l.air_instructions.items(.data)[@intFromEnum(inst)].ty_pl; | |
| 789 | const ty_pl = l.air_instructions.items(.data)[@backingInt(inst)].ty_pl; | |
| 790 | 790 | const extra = l.extraData(Air.TryPtr, ty_pl.payload); |
| 791 | 791 | try l.legalizeBody(extra.end, extra.data.body_len); |
| 792 | 792 | }, |
| 793 | 793 | .dbg_stmt, .dbg_empty_stmt => {}, |
| 794 | 794 | .dbg_inline_block => { |
| 795 | const ty_pl = l.air_instructions.items(.data)[@intFromEnum(inst)].ty_pl; | |
| 795 | const ty_pl = l.air_instructions.items(.data)[@backingInt(inst)].ty_pl; | |
| 796 | 796 | const extra = l.extraData(Air.DbgInlineBlock, ty_pl.payload); |
| 797 | 797 | try l.legalizeBody(extra.end, extra.data.body_len); |
| 798 | 798 | }, |
| ... | ... | @@ -809,7 +809,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void { |
| 809 | 809 | .is_non_err_ptr, |
| 810 | 810 | => {}, |
| 811 | 811 | .load => if (l.features.has(.expand_packed_load)) { |
| 812 | const ty_op = l.air_instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 812 | const ty_op = l.air_instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 813 | 813 | const ptr_info = l.typeOf(ty_op.operand).ptrInfo(zcu); |
| 814 | 814 | if (ptr_info.packed_offset.host_size > 0 and ptr_info.flags.vector_index == .none) { |
| 815 | 815 | continue :inst l.replaceInst(inst, .block, try l.packedLoadBlockPayload(inst)); |
| ... | ... | @@ -817,7 +817,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void { |
| 817 | 817 | }, |
| 818 | 818 | .ret, .ret_safe, .ret_load => {}, |
| 819 | 819 | .store, .store_safe => if (l.features.has(.expand_packed_store)) { |
| 820 | const bin_op = l.air_instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 820 | const bin_op = l.air_instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 821 | 821 | const ptr_info = l.typeOf(bin_op.lhs).ptrInfo(zcu); |
| 822 | 822 | if (ptr_info.packed_offset.host_size > 0 and ptr_info.flags.vector_index == .none) { |
| 823 | 823 | continue :inst l.replaceInst(inst, .block, try l.packedStoreBlockPayload(inst)); |
| ... | ... | @@ -842,7 +842,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void { |
| 842 | 842 | .struct_field_ptr_index_3, |
| 843 | 843 | => {}, |
| 844 | 844 | .agg_field_val => if (l.features.has(.expand_packed_agg_field_val)) { |
| 845 | const ty_pl = l.air_instructions.items(.data)[@intFromEnum(inst)].ty_pl; | |
| 845 | const ty_pl = l.air_instructions.items(.data)[@backingInt(inst)].ty_pl; | |
| 846 | 846 | const extra = l.extraData(Air.StructField, ty_pl.payload).data; |
| 847 | 847 | switch (l.typeOf(extra.struct_operand).containerLayout(zcu)) { |
| 848 | 848 | .auto, .@"extern" => {}, |
| ... | ... | @@ -864,7 +864,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void { |
| 864 | 864 | .array_to_slice, |
| 865 | 865 | => {}, |
| 866 | 866 | inline .reduce, .reduce_optimized => |air_tag| { |
| 867 | const reduce = l.air_instructions.items(.data)[@intFromEnum(inst)].reduce; | |
| 867 | const reduce = l.air_instructions.items(.data)[@backingInt(inst)].reduce; | |
| 868 | 868 | const vector_ty = l.typeOf(reduce.operand); |
| 869 | 869 | if (l.features.has(.reduce_one_elem_to_bit_cast)) { |
| 870 | 870 | switch (vector_ty.vectorLen(zcu)) { |
| ... | ... | @@ -887,7 +887,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void { |
| 887 | 887 | } |
| 888 | 888 | }, |
| 889 | 889 | .splat => if (l.features.has(.splat_one_elem_to_bit_cast)) { |
| 890 | const ty_op = l.air_instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 890 | const ty_op = l.air_instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 891 | 891 | switch (ty_op.ty.toType().vectorLen(zcu)) { |
| 892 | 892 | 0 => unreachable, |
| 893 | 893 | 1 => continue :inst l.replaceInst(inst, .bit_cast, .{ .ty_op = .{ |
| ... | ... | @@ -898,7 +898,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void { |
| 898 | 898 | } |
| 899 | 899 | }, |
| 900 | 900 | .shuffle_one => { |
| 901 | const ty_pl = l.air_instructions.items(.data)[@intFromEnum(inst)].ty_pl; | |
| 901 | const ty_pl = l.air_instructions.items(.data)[@backingInt(inst)].ty_pl; | |
| 902 | 902 | switch (l.wantScalarizeOrSoftFloat(.shuffle_one, ty_pl.ty.toType())) { |
| 903 | 903 | .none => {}, |
| 904 | 904 | .scalarize => continue :inst l.replaceInst(inst, .block, try l.scalarizeShuffleOneBlockPayload(inst)), |
| ... | ... | @@ -906,7 +906,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void { |
| 906 | 906 | } |
| 907 | 907 | }, |
| 908 | 908 | .shuffle_two => { |
| 909 | const ty_pl = l.air_instructions.items(.data)[@intFromEnum(inst)].ty_pl; | |
| 909 | const ty_pl = l.air_instructions.items(.data)[@backingInt(inst)].ty_pl; | |
| 910 | 910 | switch (l.wantScalarizeOrSoftFloat(.shuffle_two, ty_pl.ty.toType())) { |
| 911 | 911 | .none => {}, |
| 912 | 912 | .scalarize => continue :inst l.replaceInst(inst, .block, try l.scalarizeShuffleTwoBlockPayload(inst)), |
| ... | ... | @@ -914,7 +914,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void { |
| 914 | 914 | } |
| 915 | 915 | }, |
| 916 | 916 | .select => { |
| 917 | const pl_op = l.air_instructions.items(.data)[@intFromEnum(inst)].pl_op; | |
| 917 | const pl_op = l.air_instructions.items(.data)[@backingInt(inst)].pl_op; | |
| 918 | 918 | const bin = l.extraData(Air.Bin, pl_op.payload).data; |
| 919 | 919 | switch (l.wantScalarizeOrSoftFloat(.select, l.typeOf(bin.lhs))) { |
| 920 | 920 | .none => {}, |
| ... | ... | @@ -940,7 +940,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void { |
| 940 | 940 | .error_set_has_value, |
| 941 | 941 | => {}, |
| 942 | 942 | .aggregate_init => if (l.features.has(.expand_packed_aggregate_init)) { |
| 943 | const ty_pl = l.air_instructions.items(.data)[@intFromEnum(inst)].ty_pl; | |
| 943 | const ty_pl = l.air_instructions.items(.data)[@backingInt(inst)].ty_pl; | |
| 944 | 944 | const agg_ty = ty_pl.ty.toType(); |
| 945 | 945 | switch (agg_ty.zigTypeTag(zcu)) { |
| 946 | 946 | else => {}, |
| ... | ... | @@ -958,7 +958,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void { |
| 958 | 958 | // Just bitcast this field. |
| 959 | 959 | continue :inst l.replaceInst(inst, .bit_cast, .{ .ty_op = .{ |
| 960 | 960 | .ty = .fromType(agg_ty), |
| 961 | .operand = @enumFromInt(l.air_extra.items[ty_pl.payload + field_index]), | |
| 961 | .operand = @fromBackingInt(@intCast(l.air_extra.items[ty_pl.payload + field_index])), | |
| 962 | 962 | } }); |
| 963 | 963 | } |
| 964 | 964 | } |
| ... | ... | @@ -971,7 +971,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void { |
| 971 | 971 | }, |
| 972 | 972 | .union_init, .prefetch => {}, |
| 973 | 973 | .mul_add => { |
| 974 | const pl_op = l.air_instructions.items(.data)[@intFromEnum(inst)].pl_op; | |
| 974 | const pl_op = l.air_instructions.items(.data)[@backingInt(inst)].pl_op; | |
| 975 | 975 | const ty = l.typeOf(pl_op.operand); |
| 976 | 976 | switch (l.wantScalarizeOrSoftFloat(.mul_add, ty)) { |
| 977 | 977 | .none => {}, |
| ... | ... | @@ -1017,7 +1017,7 @@ fn scalarizeBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index, form: Scalariz |
| 1017 | 1017 | const pt = l.pt; |
| 1018 | 1018 | const zcu = pt.zcu; |
| 1019 | 1019 | |
| 1020 | const orig = l.air_instructions.get(@intFromEnum(orig_inst)); | |
| 1020 | const orig = l.air_instructions.get(@backingInt(orig_inst)); | |
| 1021 | 1021 | const res_ty = l.typeOfIndex(orig_inst); |
| 1022 | 1022 | const result_is_array = switch (res_ty.zigTypeTag(zcu)) { |
| 1023 | 1023 | .vector => false, |
| ... | ... | @@ -1167,7 +1167,7 @@ fn scalarizeBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index, form: Scalariz |
| 1167 | 1167 | try condbr.finish(l); |
| 1168 | 1168 | |
| 1169 | 1169 | const inst_data = l.air_instructions.items(.data); |
| 1170 | inst_data[@intFromEnum(elem_block_inst)].ty_pl.payload = try l.addBlockBody(elem_block.body()); | |
| 1170 | inst_data[@backingInt(elem_block_inst)].ty_pl.payload = try l.addBlockBody(elem_block.body()); | |
| 1171 | 1171 | |
| 1172 | 1172 | break :elem elem_block_inst.toRef(); |
| 1173 | 1173 | }, |
| ... | ... | @@ -1519,13 +1519,13 @@ fn addScalarizedShuffle( |
| 1519 | 1519 | try loop.finish(l); |
| 1520 | 1520 | |
| 1521 | 1521 | const inst_data = l.air_instructions.items(.data); |
| 1522 | inst_data[@intFromEnum(main_block_inst)].ty_pl.payload = try l.addBlockBody(main_block.body()); | |
| 1522 | inst_data[@backingInt(main_block_inst)].ty_pl.payload = try l.addBlockBody(main_block.body()); | |
| 1523 | 1523 | } |
| 1524 | 1524 | fn scalarizeBitcastBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error!?Air.Inst.Data { |
| 1525 | 1525 | const pt = l.pt; |
| 1526 | 1526 | const zcu = pt.zcu; |
| 1527 | 1527 | |
| 1528 | const ty_op = l.air_instructions.items(.data)[@intFromEnum(orig_inst)].ty_op; | |
| 1528 | const ty_op = l.air_instructions.items(.data)[@backingInt(orig_inst)].ty_op; | |
| 1529 | 1529 | |
| 1530 | 1530 | const dest_ty = ty_op.ty.toType(); |
| 1531 | 1531 | const operand_ty = l.typeOf(ty_op.operand); |
| ... | ... | @@ -1723,7 +1723,7 @@ fn scalarizeBitcastBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error!? |
| 1723 | 1723 | try loop.finish(l); |
| 1724 | 1724 | |
| 1725 | 1725 | const inst_data = l.air_instructions.items(.data); |
| 1726 | inst_data[@intFromEnum(uint_block_inst)].ty_pl.payload = try l.addBlockBody(uint_block.body()); | |
| 1726 | inst_data[@backingInt(uint_block_inst)].ty_pl.payload = try l.addBlockBody(uint_block.body()); | |
| 1727 | 1727 | |
| 1728 | 1728 | break :uint_val uint_block_inst.toRef(); |
| 1729 | 1729 | }; |
| ... | ... | @@ -1736,7 +1736,7 @@ fn scalarizeBitcastBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error!? |
| 1736 | 1736 | |
| 1737 | 1737 | if (int_to_dest_ok) { |
| 1738 | 1738 | _ = main_block.stealCapacity(17); |
| 1739 | const result = switch (l.air_instructions.items(.tag)[@intFromEnum(orig_inst)]) { | |
| 1739 | const result = switch (l.air_instructions.items(.tag)[@backingInt(orig_inst)]) { | |
| 1740 | 1740 | .bit_cast => main_block.addBitCast(l, dest_ty, uint_val), |
| 1741 | 1741 | .bit_cast_safe => main_block.add(l, .{ |
| 1742 | 1742 | .tag = .bit_cast_safe, |
| ... | ... | @@ -1752,7 +1752,7 @@ fn scalarizeBitcastBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error!? |
| 1752 | 1752 | _ = main_block.stealCapacity(16); |
| 1753 | 1753 | const elem = main_block.addBitCast(l, dest_ty.childType(zcu), uint_val); |
| 1754 | 1754 | const aggregate_init_payload_start = l.air_extra.items.len; |
| 1755 | try l.air_extra.append(zcu.gpa, @intFromEnum(elem)); | |
| 1755 | try l.air_extra.append(zcu.gpa, @backingInt(elem)); | |
| 1756 | 1756 | const result = main_block.add(l, .{ |
| 1757 | 1757 | .tag = .aggregate_init, |
| 1758 | 1758 | .data = .{ .ty_pl = .{ |
| ... | ... | @@ -1863,7 +1863,7 @@ fn scalarizeOverflowBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error! |
| 1863 | 1863 | const pt = l.pt; |
| 1864 | 1864 | const zcu = pt.zcu; |
| 1865 | 1865 | |
| 1866 | const orig = l.air_instructions.get(@intFromEnum(orig_inst)); | |
| 1866 | const orig = l.air_instructions.get(@backingInt(orig_inst)); | |
| 1867 | 1867 | const orig_operands = l.extraData(Air.Bin, orig.data.ty_pl.payload).data; |
| 1868 | 1868 | |
| 1869 | 1869 | const vec_tuple_ty = l.typeOfIndex(orig_inst); |
| ... | ... | @@ -2009,7 +2009,7 @@ fn scalarizeReduceBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index, optimize |
| 2009 | 2009 | const pt = l.pt; |
| 2010 | 2010 | const zcu = pt.zcu; |
| 2011 | 2011 | |
| 2012 | const reduce = l.air_instructions.items(.data)[@intFromEnum(orig_inst)].reduce; | |
| 2012 | const reduce = l.air_instructions.items(.data)[@backingInt(orig_inst)].reduce; | |
| 2013 | 2013 | |
| 2014 | 2014 | const vector_ty = l.typeOf(reduce.operand); |
| 2015 | 2015 | const scalar_ty = vector_ty.childType(zcu); |
| ... | ... | @@ -2136,7 +2136,7 @@ fn scalarizeReduceBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index, optimize |
| 2136 | 2136 | fn safeBitcastBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error!?Air.Inst.Data { |
| 2137 | 2137 | const pt = l.pt; |
| 2138 | 2138 | const zcu = pt.zcu; |
| 2139 | const ty_op = l.air_instructions.items(.data)[@intFromEnum(orig_inst)].ty_op; | |
| 2139 | const ty_op = l.air_instructions.items(.data)[@backingInt(orig_inst)].ty_op; | |
| 2140 | 2140 | |
| 2141 | 2141 | const operand_ref = ty_op.operand; |
| 2142 | 2142 | const dest_ty = ty_op.ty.toType(); |
| ... | ... | @@ -2191,7 +2191,7 @@ fn safeBitcastBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error!?Air.I |
| 2191 | 2191 | fn safeIntcastBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error!?Air.Inst.Data { |
| 2192 | 2192 | const pt = l.pt; |
| 2193 | 2193 | const zcu = pt.zcu; |
| 2194 | const ty_op = l.air_instructions.items(.data)[@intFromEnum(orig_inst)].ty_op; | |
| 2194 | const ty_op = l.air_instructions.items(.data)[@backingInt(orig_inst)].ty_op; | |
| 2195 | 2195 | |
| 2196 | 2196 | const operand_ref = ty_op.operand; |
| 2197 | 2197 | const operand_ty = l.typeOf(operand_ref); |
| ... | ... | @@ -2362,7 +2362,7 @@ fn safeIntFromFloatBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index, optimiz |
| 2362 | 2362 | const pt = l.pt; |
| 2363 | 2363 | const zcu = pt.zcu; |
| 2364 | 2364 | const gpa = zcu.gpa; |
| 2365 | const ty_op = l.air_instructions.items(.data)[@intFromEnum(orig_inst)].ty_op; | |
| 2365 | const ty_op = l.air_instructions.items(.data)[@backingInt(orig_inst)].ty_op; | |
| 2366 | 2366 | |
| 2367 | 2367 | const operand_ref = ty_op.operand; |
| 2368 | 2368 | const operand_ty = l.typeOf(operand_ref); |
| ... | ... | @@ -2470,7 +2470,7 @@ fn safeIntFromFloatBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index, optimiz |
| 2470 | 2470 | fn safeArithmeticBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index, overflow_op_tag: Air.Inst.Tag) Error!Air.Inst.Data { |
| 2471 | 2471 | const pt = l.pt; |
| 2472 | 2472 | const zcu = pt.zcu; |
| 2473 | const bin_op = l.air_instructions.items(.data)[@intFromEnum(orig_inst)].bin_op; | |
| 2473 | const bin_op = l.air_instructions.items(.data)[@backingInt(orig_inst)].bin_op; | |
| 2474 | 2474 | |
| 2475 | 2475 | const operand_ty = l.typeOf(bin_op.lhs); |
| 2476 | 2476 | assert(l.typeOf(bin_op.rhs).toIntern() == operand_ty.toIntern()); |
| ... | ... | @@ -2567,7 +2567,7 @@ fn divCeilBlockPayload( |
| 2567 | 2567 | const zcu = pt.zcu; |
| 2568 | 2568 | const gpa = zcu.gpa; |
| 2569 | 2569 | |
| 2570 | const bin_op = l.air_instructions.items(.data)[@intFromEnum(orig_inst)].bin_op; | |
| 2570 | const bin_op = l.air_instructions.items(.data)[@backingInt(orig_inst)].bin_op; | |
| 2571 | 2571 | const operand_ty = l.typeOf(bin_op.lhs); |
| 2572 | 2572 | assert(l.typeOf(bin_op.rhs).toIntern() == operand_ty.toIntern()); |
| 2573 | 2573 | |
| ... | ... | @@ -2715,7 +2715,7 @@ fn packedLoadBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error!Air.Ins |
| 2715 | 2715 | const pt = l.pt; |
| 2716 | 2716 | const zcu = pt.zcu; |
| 2717 | 2717 | |
| 2718 | const orig_ty_op = l.air_instructions.items(.data)[@intFromEnum(orig_inst)].ty_op; | |
| 2718 | const orig_ty_op = l.air_instructions.items(.data)[@backingInt(orig_inst)].ty_op; | |
| 2719 | 2719 | const res_ty = orig_ty_op.ty.toType(); |
| 2720 | 2720 | const res_int_ty = try pt.intType(.unsigned, @intCast(res_ty.bitSize(zcu))); |
| 2721 | 2721 | const ptr_ty = l.typeOf(orig_ty_op.operand); |
| ... | ... | @@ -2771,7 +2771,7 @@ fn packedStoreBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error!Air.In |
| 2771 | 2771 | const pt = l.pt; |
| 2772 | 2772 | const zcu = pt.zcu; |
| 2773 | 2773 | |
| 2774 | const orig_bin_op = l.air_instructions.items(.data)[@intFromEnum(orig_inst)].bin_op; | |
| 2774 | const orig_bin_op = l.air_instructions.items(.data)[@backingInt(orig_inst)].bin_op; | |
| 2775 | 2775 | const ptr_ty = l.typeOf(orig_bin_op.lhs); |
| 2776 | 2776 | const ptr_info = ptr_ty.ptrInfo(zcu); |
| 2777 | 2777 | const operand_ty = l.typeOf(orig_bin_op.rhs); |
| ... | ... | @@ -2869,7 +2869,7 @@ fn packedStructFieldValBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Err |
| 2869 | 2869 | const pt = l.pt; |
| 2870 | 2870 | const zcu = pt.zcu; |
| 2871 | 2871 | |
| 2872 | const orig_ty_pl = l.air_instructions.items(.data)[@intFromEnum(orig_inst)].ty_pl; | |
| 2872 | const orig_ty_pl = l.air_instructions.items(.data)[@backingInt(orig_inst)].ty_pl; | |
| 2873 | 2873 | const orig_extra = l.extraData(Air.StructField, orig_ty_pl.payload).data; |
| 2874 | 2874 | const field_ty = orig_ty_pl.ty.toType(); |
| 2875 | 2875 | const agg_ty = l.typeOf(orig_extra.struct_operand); |
| ... | ... | @@ -2903,7 +2903,7 @@ fn packedAggregateInitBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Erro |
| 2903 | 2903 | const zcu = pt.zcu; |
| 2904 | 2904 | const gpa = zcu.gpa; |
| 2905 | 2905 | |
| 2906 | const orig_ty_pl = l.air_instructions.items(.data)[@intFromEnum(orig_inst)].ty_pl; | |
| 2906 | const orig_ty_pl = l.air_instructions.items(.data)[@backingInt(orig_inst)].ty_pl; | |
| 2907 | 2907 | const agg_ty = orig_ty_pl.ty.toType(); |
| 2908 | 2908 | const agg_field_count = agg_ty.structFieldCount(zcu); |
| 2909 | 2909 | |
| ... | ... | @@ -2930,7 +2930,7 @@ fn packedAggregateInitBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Erro |
| 2930 | 2930 | assert(field_bits < num_bits); |
| 2931 | 2931 | const field_uint_ty = try pt.intType(.unsigned, field_bits); |
| 2932 | 2932 | const field_bit_size_ref: Air.Inst.Ref = .fromValue(try pt.intValue(shift_ty, field_bits)); |
| 2933 | const field_val: Air.Inst.Ref = @enumFromInt(l.air_extra.items[orig_ty_pl.payload + field_idx]); | |
| 2933 | const field_val: Air.Inst.Ref = @fromBackingInt(@intCast(l.air_extra.items[orig_ty_pl.payload + field_idx])); | |
| 2934 | 2934 | |
| 2935 | 2935 | const shifted = main_block.addBinOp(l, .shl_exact, cur_uint, field_bit_size_ref).toRef(); |
| 2936 | 2936 | const field_as_uint = main_block.addBitCast(l, field_uint_ty, field_val); |
| ... | ... | @@ -3298,7 +3298,7 @@ const Loop = struct { |
| 3298 | 3298 | } |
| 3299 | 3299 | |
| 3300 | 3300 | fn finish(loop: Loop, l: *Legalize) Error!void { |
| 3301 | const data = &l.air_instructions.items(.data)[@intFromEnum(loop.inst)]; | |
| 3301 | const data = &l.air_instructions.items(.data)[@backingInt(loop.inst)]; | |
| 3302 | 3302 | data.ty_pl.payload = try l.addBlockBody(loop.block.body()); |
| 3303 | 3303 | } |
| 3304 | 3304 | }; |
| ... | ... | @@ -3331,7 +3331,7 @@ const CondBr = struct { |
| 3331 | 3331 | const else_body = cond_br.else_block.body(); |
| 3332 | 3332 | try l.air_extra.ensureUnusedCapacity(l.pt.zcu.gpa, 3 + then_body.len + else_body.len); |
| 3333 | 3333 | |
| 3334 | const data = &l.air_instructions.items(.data)[@intFromEnum(cond_br.inst)]; | |
| 3334 | const data = &l.air_instructions.items(.data)[@backingInt(cond_br.inst)]; | |
| 3335 | 3335 | data.pl_op.payload = @intCast(l.air_extra.items.len); |
| 3336 | 3336 | l.air_extra.appendSliceAssumeCapacity(&.{ |
| 3337 | 3337 | @intCast(then_body.len), |
| ... | ... | @@ -3345,7 +3345,7 @@ const CondBr = struct { |
| 3345 | 3345 | |
| 3346 | 3346 | fn addInstAssumeCapacity(l: *Legalize, inst: Air.Inst) Air.Inst.Index { |
| 3347 | 3347 | defer l.air_instructions.appendAssumeCapacity(inst); |
| 3348 | return @enumFromInt(l.air_instructions.len); | |
| 3348 | return @fromBackingInt(@intCast(l.air_instructions.len)); | |
| 3349 | 3349 | } |
| 3350 | 3350 | |
| 3351 | 3351 | fn addExtra(l: *Legalize, comptime Extra: type, extra: Extra) Error!u32 { |
| ... | ... | @@ -3353,7 +3353,7 @@ fn addExtra(l: *Legalize, comptime Extra: type, extra: Extra) Error!u32 { |
| 3353 | 3353 | try l.air_extra.ensureUnusedCapacity(l.pt.zcu.gpa, extra_info.field_names.len); |
| 3354 | 3354 | defer inline for (extra_info.field_names, extra_info.field_types) |field_name, field_type| l.air_extra.appendAssumeCapacity(switch (field_type) { |
| 3355 | 3355 | u32 => @field(extra, field_name), |
| 3356 | Air.Inst.Ref => @intFromEnum(@field(extra, field_name)), | |
| 3356 | Air.Inst.Ref => @backingInt(@field(extra, field_name)), | |
| 3357 | 3357 | else => @compileError(@typeName(field_type)), |
| 3358 | 3358 | }); |
| 3359 | 3359 | return @intCast(l.air_extra.items.len); |
| ... | ... | @@ -3372,7 +3372,7 @@ fn addBlockBody(l: *Legalize, body: []const Air.Inst.Index) Error!u32 { |
| 3372 | 3372 | /// `inline` to propagate the comptime-known `tag` result. |
| 3373 | 3373 | inline fn replaceInst(l: *Legalize, inst: Air.Inst.Index, comptime tag: Air.Inst.Tag, data: Air.Inst.Data) Air.Inst.Tag { |
| 3374 | 3374 | const orig_ty = if (std.debug.runtime_safety) l.typeOfIndex(inst) else {}; |
| 3375 | l.air_instructions.set(@intFromEnum(inst), .{ .tag = tag, .data = data }); | |
| 3375 | l.air_instructions.set(@backingInt(inst), .{ .tag = tag, .data = data }); | |
| 3376 | 3376 | if (std.debug.runtime_safety) assert(l.typeOfIndex(inst).toIntern() == orig_ty.toIntern()); |
| 3377 | 3377 | return tag; |
| 3378 | 3378 | } |
| ... | ... | @@ -3436,7 +3436,7 @@ fn softFptruncFunc(l: *const Legalize, src_ty: Type, dst_ty: Type) Air.CompilerR |
| 3436 | 3436 | 80 => 3, |
| 3437 | 3437 | else => unreachable, |
| 3438 | 3438 | }; |
| 3439 | return @enumFromInt(@intFromEnum(to_f16_func) + offset); | |
| 3439 | return @fromBackingInt(@intCast(@backingInt(to_f16_func) + offset)); | |
| 3440 | 3440 | } |
| 3441 | 3441 | fn softFpextFunc(l: *const Legalize, src_ty: Type, dst_ty: Type) Air.CompilerRtFunc { |
| 3442 | 3442 | const target = l.pt.zcu.getTarget(); |
| ... | ... | @@ -3457,7 +3457,7 @@ fn softFpextFunc(l: *const Legalize, src_ty: Type, dst_ty: Type) Air.CompilerRtF |
| 3457 | 3457 | 32 => 3, |
| 3458 | 3458 | else => unreachable, |
| 3459 | 3459 | }; |
| 3460 | return @enumFromInt(@intFromEnum(to_f128_func) + offset); | |
| 3460 | return @fromBackingInt(@intCast(@backingInt(to_f128_func) + offset)); | |
| 3461 | 3461 | } |
| 3462 | 3462 | fn softFloatFromInt(l: *Legalize, orig_inst: Air.Inst.Index) Error!union(enum) { |
| 3463 | 3463 | call: Air.CompilerRtFunc, |
| ... | ... | @@ -3467,7 +3467,7 @@ fn softFloatFromInt(l: *Legalize, orig_inst: Air.Inst.Index) Error!union(enum) { |
| 3467 | 3467 | const zcu = pt.zcu; |
| 3468 | 3468 | const target = zcu.getTarget(); |
| 3469 | 3469 | |
| 3470 | const ty_op = l.air_instructions.items(.data)[@intFromEnum(orig_inst)].ty_op; | |
| 3470 | const ty_op = l.air_instructions.items(.data)[@backingInt(orig_inst)].ty_op; | |
| 3471 | 3471 | const dest_ty = ty_op.ty.toType(); |
| 3472 | 3472 | const src_ty = l.typeOf(ty_op.operand); |
| 3473 | 3473 | |
| ... | ... | @@ -3497,7 +3497,7 @@ fn softFloatFromInt(l: *Legalize, orig_inst: Air.Inst.Index) Error!union(enum) { |
| 3497 | 3497 | break :fixed; |
| 3498 | 3498 | } |
| 3499 | 3499 | |
| 3500 | const func: Air.CompilerRtFunc = @enumFromInt(@intFromEnum(base) + int_bits_off + float_off); | |
| 3500 | const func: Air.CompilerRtFunc = @fromBackingInt(@intCast(@backingInt(base) + int_bits_off + float_off)); | |
| 3501 | 3501 | if (extended_int_bits == src_info.bits) return .{ .call = func }; |
| 3502 | 3502 | |
| 3503 | 3503 | // We need to emit a block which first sign/zero-extends to the right type and *then* calls |
| ... | ... | @@ -3522,7 +3522,7 @@ fn softFloatFromInt(l: *Legalize, orig_inst: Air.Inst.Index) Error!union(enum) { |
| 3522 | 3522 | // We need to emit a block which puts the integer into an `alloc` (possibly sign/zero-extended) |
| 3523 | 3523 | // and calls an arbitrary-width conversion routine. |
| 3524 | 3524 | |
| 3525 | const func: Air.CompilerRtFunc = @enumFromInt(@intFromEnum(base) + 15 + float_off); | |
| 3525 | const func: Air.CompilerRtFunc = @fromBackingInt(@intCast(@backingInt(base) + 15 + float_off)); | |
| 3526 | 3526 | |
| 3527 | 3527 | // The extended integer routines expect the integer representation where the integer is |
| 3528 | 3528 | // effectively zero- or sign-extended to its ABI size. We represent that by intcasting to |
| ... | ... | @@ -3560,7 +3560,7 @@ fn softIntFromFloat(l: *Legalize, orig_inst: Air.Inst.Index) Error!union(enum) { |
| 3560 | 3560 | const zcu = pt.zcu; |
| 3561 | 3561 | const target = zcu.getTarget(); |
| 3562 | 3562 | |
| 3563 | const ty_op = l.air_instructions.items(.data)[@intFromEnum(orig_inst)].ty_op; | |
| 3563 | const ty_op = l.air_instructions.items(.data)[@backingInt(orig_inst)].ty_op; | |
| 3564 | 3564 | const src_ty = l.typeOf(ty_op.operand); |
| 3565 | 3565 | const dest_ty = ty_op.ty.toType(); |
| 3566 | 3566 | |
| ... | ... | @@ -3590,7 +3590,7 @@ fn softIntFromFloat(l: *Legalize, orig_inst: Air.Inst.Index) Error!union(enum) { |
| 3590 | 3590 | break :fixed; |
| 3591 | 3591 | } |
| 3592 | 3592 | |
| 3593 | const func: Air.CompilerRtFunc = @enumFromInt(@intFromEnum(base) + int_bits_off + float_off); | |
| 3593 | const func: Air.CompilerRtFunc = @fromBackingInt(@intCast(@backingInt(base) + int_bits_off + float_off)); | |
| 3594 | 3594 | if (extended_int_bits == dest_info.bits) return .{ .call = func }; |
| 3595 | 3595 | |
| 3596 | 3596 | // We need to emit a block which calls the routine and then casts to the required type. |
| ... | ... | @@ -3611,7 +3611,7 @@ fn softIntFromFloat(l: *Legalize, orig_inst: Air.Inst.Index) Error!union(enum) { |
| 3611 | 3611 | |
| 3612 | 3612 | // We need to emit a block which calls an arbitrary-width conversion routine, then loads the |
| 3613 | 3613 | // integer from an `alloc` and possibly truncates it. |
| 3614 | const func: Air.CompilerRtFunc = @enumFromInt(@intFromEnum(base) + 15 + float_off); | |
| 3614 | const func: Air.CompilerRtFunc = @fromBackingInt(@intCast(@backingInt(base) + 15 + float_off)); | |
| 3615 | 3615 | |
| 3616 | 3616 | const extended_ty = try pt.intType(dest_info.signedness, @intCast(dest_ty.abiSize(zcu) * 8)); |
| 3617 | 3617 | assert(extended_ty.abiSize(zcu) == dest_ty.abiSize(zcu)); |
| ... | ... | @@ -3678,7 +3678,7 @@ fn softFloatFunc(op: Air.Inst.Tag, float_ty: Type, zcu: *const Zcu) Air.Compiler |
| 3678 | 3678 | 128 => 4, |
| 3679 | 3679 | else => unreachable, |
| 3680 | 3680 | }; |
| 3681 | return @enumFromInt(@intFromEnum(f16_func) + offset); | |
| 3681 | return @fromBackingInt(@intCast(@backingInt(f16_func) + offset)); | |
| 3682 | 3682 | } |
| 3683 | 3683 | |
| 3684 | 3684 | fn softFloatNegBlockPayload( |
src/Air/Liveness.zig+36-36| ... | ... | @@ -188,23 +188,23 @@ pub fn analyze(zcu: *Zcu, air: Air, intern_pool: *InternPool) Allocator.Error!Li |
| 188 | 188 | } |
| 189 | 189 | |
| 190 | 190 | pub fn getTombBits(l: Liveness, inst: Air.Inst.Index) Bpi { |
| 191 | const usize_index = (@intFromEnum(inst) * bpi) / @bitSizeOf(usize); | |
| 191 | const usize_index = (@backingInt(inst) * bpi) / @bitSizeOf(usize); | |
| 192 | 192 | return @as(Bpi, @truncate(l.tomb_bits[usize_index] >> |
| 193 | @as(Log2Int(usize), @intCast((@intFromEnum(inst) % (@bitSizeOf(usize) / bpi)) * bpi)))); | |
| 193 | @as(Log2Int(usize), @intCast((@backingInt(inst) % (@bitSizeOf(usize) / bpi)) * bpi)))); | |
| 194 | 194 | } |
| 195 | 195 | |
| 196 | 196 | pub fn isUnused(l: Liveness, inst: Air.Inst.Index) bool { |
| 197 | const usize_index = (@intFromEnum(inst) * bpi) / @bitSizeOf(usize); | |
| 197 | const usize_index = (@backingInt(inst) * bpi) / @bitSizeOf(usize); | |
| 198 | 198 | const mask = @as(usize, 1) << |
| 199 | @as(Log2Int(usize), @intCast((@intFromEnum(inst) % (@bitSizeOf(usize) / bpi)) * bpi + (bpi - 1))); | |
| 199 | @as(Log2Int(usize), @intCast((@backingInt(inst) % (@bitSizeOf(usize) / bpi)) * bpi + (bpi - 1))); | |
| 200 | 200 | return (l.tomb_bits[usize_index] & mask) != 0; |
| 201 | 201 | } |
| 202 | 202 | |
| 203 | 203 | pub fn operandDies(l: Liveness, inst: Air.Inst.Index, operand: OperandInt) bool { |
| 204 | 204 | assert(operand < bpi - 1); |
| 205 | const usize_index = (@intFromEnum(inst) * bpi) / @bitSizeOf(usize); | |
| 205 | const usize_index = (@backingInt(inst) * bpi) / @bitSizeOf(usize); | |
| 206 | 206 | const mask = @as(usize, 1) << |
| 207 | @as(Log2Int(usize), @intCast((@intFromEnum(inst) % (@bitSizeOf(usize) / bpi)) * bpi + operand)); | |
| 207 | @as(Log2Int(usize), @intCast((@backingInt(inst) % (@bitSizeOf(usize) / bpi)) * bpi + operand)); | |
| 208 | 208 | return (l.tomb_bits[usize_index] & mask) != 0; |
| 209 | 209 | } |
| 210 | 210 | |
| ... | ... | @@ -393,7 +393,7 @@ fn analyzeInst( |
| 393 | 393 | const inst_tags = a.air.instructions.items(.tag); |
| 394 | 394 | const inst_datas = a.air.instructions.items(.data); |
| 395 | 395 | |
| 396 | switch (inst_tags[@intFromEnum(inst)]) { | |
| 396 | switch (inst_tags[@backingInt(inst)]) { | |
| 397 | 397 | .add, |
| 398 | 398 | .add_safe, |
| 399 | 399 | .add_optimized, |
| ... | ... | @@ -461,7 +461,7 @@ fn analyzeInst( |
| 461 | 461 | .memmove, |
| 462 | 462 | .legalize_vec_elem_val, |
| 463 | 463 | => { |
| 464 | const o = inst_datas[@intFromEnum(inst)].bin_op; | |
| 464 | const o = inst_datas[@backingInt(inst)].bin_op; | |
| 465 | 465 | return analyzeOperands(a, pass, data, inst, .{ o.lhs, o.rhs, .none }); |
| 466 | 466 | }, |
| 467 | 467 | |
| ... | ... | @@ -543,7 +543,7 @@ fn analyzeInst( |
| 543 | 543 | .c_va_copy, |
| 544 | 544 | .abs, |
| 545 | 545 | => { |
| 546 | const o = inst_datas[@intFromEnum(inst)].ty_op; | |
| 546 | const o = inst_datas[@backingInt(inst)].ty_op; | |
| 547 | 547 | return analyzeOperands(a, pass, data, inst, .{ o.operand, .none, .none }); |
| 548 | 548 | }, |
| 549 | 549 | |
| ... | ... | @@ -577,7 +577,7 @@ fn analyzeInst( |
| 577 | 577 | .set_err_return_trace, |
| 578 | 578 | .c_va_end, |
| 579 | 579 | => { |
| 580 | const operand = inst_datas[@intFromEnum(inst)].un_op; | |
| 580 | const operand = inst_datas[@backingInt(inst)].un_op; | |
| 581 | 581 | return analyzeOperands(a, pass, data, inst, .{ operand, .none, .none }); |
| 582 | 582 | }, |
| 583 | 583 | |
| ... | ... | @@ -585,7 +585,7 @@ fn analyzeInst( |
| 585 | 585 | .ret_safe, |
| 586 | 586 | .ret_load, |
| 587 | 587 | => { |
| 588 | const operand = inst_datas[@intFromEnum(inst)].un_op; | |
| 588 | const operand = inst_datas[@backingInt(inst)].un_op; | |
| 589 | 589 | return analyzeFuncEnd(a, pass, data, inst, .{ operand, .none, .none }); |
| 590 | 590 | }, |
| 591 | 591 | |
| ... | ... | @@ -599,7 +599,7 @@ fn analyzeInst( |
| 599 | 599 | .slice_elem_ptr, |
| 600 | 600 | .slice, |
| 601 | 601 | => { |
| 602 | const ty_pl = inst_datas[@intFromEnum(inst)].ty_pl; | |
| 602 | const ty_pl = inst_datas[@backingInt(inst)].ty_pl; | |
| 603 | 603 | const extra = a.air.extraData(Air.Bin, ty_pl.payload).data; |
| 604 | 604 | return analyzeOperands(a, pass, data, inst, .{ extra.lhs, extra.rhs, .none }); |
| 605 | 605 | }, |
| ... | ... | @@ -608,12 +608,12 @@ fn analyzeInst( |
| 608 | 608 | .dbg_var_val, |
| 609 | 609 | .dbg_arg_inline, |
| 610 | 610 | => { |
| 611 | const operand = inst_datas[@intFromEnum(inst)].pl_op.operand; | |
| 611 | const operand = inst_datas[@backingInt(inst)].pl_op.operand; | |
| 612 | 612 | return analyzeOperands(a, pass, data, inst, .{ operand, .none, .none }); |
| 613 | 613 | }, |
| 614 | 614 | |
| 615 | 615 | .prefetch => { |
| 616 | const prefetch = inst_datas[@intFromEnum(inst)].prefetch; | |
| 616 | const prefetch = inst_datas[@backingInt(inst)].prefetch; | |
| 617 | 617 | return analyzeOperands(a, pass, data, inst, .{ prefetch.ptr, .none, .none }); |
| 618 | 618 | }, |
| 619 | 619 | |
| ... | ... | @@ -638,7 +638,7 @@ fn analyzeInst( |
| 638 | 638 | return big.finish(); |
| 639 | 639 | }, |
| 640 | 640 | .select => { |
| 641 | const pl_op = inst_datas[@intFromEnum(inst)].pl_op; | |
| 641 | const pl_op = inst_datas[@backingInt(inst)].pl_op; | |
| 642 | 642 | const extra = a.air.extraData(Air.Bin, pl_op.payload).data; |
| 643 | 643 | return analyzeOperands(a, pass, data, inst, .{ pl_op.operand, extra.lhs, extra.rhs }); |
| 644 | 644 | }, |
| ... | ... | @@ -651,15 +651,15 @@ fn analyzeInst( |
| 651 | 651 | return analyzeOperands(a, pass, data, inst, .{ unwrapped.operand_a, unwrapped.operand_b, .none }); |
| 652 | 652 | }, |
| 653 | 653 | .reduce, .reduce_optimized => { |
| 654 | const reduce = inst_datas[@intFromEnum(inst)].reduce; | |
| 654 | const reduce = inst_datas[@backingInt(inst)].reduce; | |
| 655 | 655 | return analyzeOperands(a, pass, data, inst, .{ reduce.operand, .none, .none }); |
| 656 | 656 | }, |
| 657 | 657 | .cmp_vector, .cmp_vector_optimized => { |
| 658 | const extra = a.air.extraData(Air.VectorCmp, inst_datas[@intFromEnum(inst)].ty_pl.payload).data; | |
| 658 | const extra = a.air.extraData(Air.VectorCmp, inst_datas[@backingInt(inst)].ty_pl.payload).data; | |
| 659 | 659 | return analyzeOperands(a, pass, data, inst, .{ extra.lhs, extra.rhs, .none }); |
| 660 | 660 | }, |
| 661 | 661 | .aggregate_init => { |
| 662 | const ty_pl = inst_datas[@intFromEnum(inst)].ty_pl; | |
| 662 | const ty_pl = inst_datas[@backingInt(inst)].ty_pl; | |
| 663 | 663 | const aggregate_ty = ty_pl.ty.toType(); |
| 664 | 664 | const len = @as(usize, @intCast(aggregate_ty.arrayLenIp(ip))); |
| 665 | 665 | const elements = @as([]const Air.Inst.Ref, @ptrCast(a.air.extra.items[ty_pl.payload..][0..len])); |
| ... | ... | @@ -680,32 +680,32 @@ fn analyzeInst( |
| 680 | 680 | return big.finish(); |
| 681 | 681 | }, |
| 682 | 682 | .union_init => { |
| 683 | const extra = a.air.extraData(Air.UnionInit, inst_datas[@intFromEnum(inst)].ty_pl.payload).data; | |
| 683 | const extra = a.air.extraData(Air.UnionInit, inst_datas[@backingInt(inst)].ty_pl.payload).data; | |
| 684 | 684 | return analyzeOperands(a, pass, data, inst, .{ extra.init, .none, .none }); |
| 685 | 685 | }, |
| 686 | 686 | .struct_field_ptr, .agg_field_val, .spirv_runtime_array_len => { |
| 687 | const extra = a.air.extraData(Air.StructField, inst_datas[@intFromEnum(inst)].ty_pl.payload).data; | |
| 687 | const extra = a.air.extraData(Air.StructField, inst_datas[@backingInt(inst)].ty_pl.payload).data; | |
| 688 | 688 | return analyzeOperands(a, pass, data, inst, .{ extra.struct_operand, .none, .none }); |
| 689 | 689 | }, |
| 690 | 690 | .field_parent_ptr => { |
| 691 | const extra = a.air.extraData(Air.FieldParentPtr, inst_datas[@intFromEnum(inst)].ty_pl.payload).data; | |
| 691 | const extra = a.air.extraData(Air.FieldParentPtr, inst_datas[@backingInt(inst)].ty_pl.payload).data; | |
| 692 | 692 | return analyzeOperands(a, pass, data, inst, .{ extra.field_ptr, .none, .none }); |
| 693 | 693 | }, |
| 694 | 694 | .cmpxchg_strong, .cmpxchg_weak => { |
| 695 | const extra = a.air.extraData(Air.Cmpxchg, inst_datas[@intFromEnum(inst)].ty_pl.payload).data; | |
| 695 | const extra = a.air.extraData(Air.Cmpxchg, inst_datas[@backingInt(inst)].ty_pl.payload).data; | |
| 696 | 696 | return analyzeOperands(a, pass, data, inst, .{ extra.ptr, extra.expected_value, extra.new_value }); |
| 697 | 697 | }, |
| 698 | 698 | .mul_add => { |
| 699 | const pl_op = inst_datas[@intFromEnum(inst)].pl_op; | |
| 699 | const pl_op = inst_datas[@backingInt(inst)].pl_op; | |
| 700 | 700 | const extra = a.air.extraData(Air.Bin, pl_op.payload).data; |
| 701 | 701 | return analyzeOperands(a, pass, data, inst, .{ extra.lhs, extra.rhs, pl_op.operand }); |
| 702 | 702 | }, |
| 703 | 703 | .atomic_load => { |
| 704 | const ptr = inst_datas[@intFromEnum(inst)].atomic_load.ptr; | |
| 704 | const ptr = inst_datas[@backingInt(inst)].atomic_load.ptr; | |
| 705 | 705 | return analyzeOperands(a, pass, data, inst, .{ ptr, .none, .none }); |
| 706 | 706 | }, |
| 707 | 707 | .atomic_rmw => { |
| 708 | const pl_op = inst_datas[@intFromEnum(inst)].pl_op; | |
| 708 | const pl_op = inst_datas[@backingInt(inst)].pl_op; | |
| 709 | 709 | const extra = a.air.extraData(Air.AtomicRmw, pl_op.payload).data; |
| 710 | 710 | return analyzeOperands(a, pass, data, inst, .{ pl_op.operand, extra.operand, .none }); |
| 711 | 711 | }, |
| ... | ... | @@ -769,12 +769,12 @@ fn analyzeInst( |
| 769 | 769 | .loop_switch_br => return analyzeInstSwitchBr(a, pass, data, inst, true), |
| 770 | 770 | |
| 771 | 771 | .wasm_memory_grow => { |
| 772 | const pl_op = inst_datas[@intFromEnum(inst)].pl_op; | |
| 772 | const pl_op = inst_datas[@backingInt(inst)].pl_op; | |
| 773 | 773 | return analyzeOperands(a, pass, data, inst, .{ pl_op.operand, .none, .none }); |
| 774 | 774 | }, |
| 775 | 775 | |
| 776 | 776 | .legalize_vec_store_elem => { |
| 777 | const pl_op = inst_datas[@intFromEnum(inst)].pl_op; | |
| 777 | const pl_op = inst_datas[@backingInt(inst)].pl_op; | |
| 778 | 778 | const bin = a.air.extraData(Air.Bin, pl_op.payload).data; |
| 779 | 779 | return analyzeOperands(a, pass, data, inst, .{ pl_op.operand, bin.lhs, bin.rhs }); |
| 780 | 780 | }, |
| ... | ... | @@ -823,7 +823,7 @@ fn analyzeOperands( |
| 823 | 823 | }, |
| 824 | 824 | |
| 825 | 825 | .main_analysis => { |
| 826 | const usize_index = (@intFromEnum(inst) * bpi) / @bitSizeOf(usize); | |
| 826 | const usize_index = (@backingInt(inst) * bpi) / @bitSizeOf(usize); | |
| 827 | 827 | |
| 828 | 828 | // This logic must synchronize with `will_die_immediately` in `AnalyzeBigOperands.init`. |
| 829 | 829 | const immediate_death = if (data.live_set.remove(inst)) blk: { |
| ... | ... | @@ -858,7 +858,7 @@ fn analyzeOperands( |
| 858 | 858 | } |
| 859 | 859 | |
| 860 | 860 | a.tomb_bits[usize_index] |= @as(usize, tomb_bits) << |
| 861 | @as(Log2Int(usize), @intCast((@intFromEnum(inst) % (@bitSizeOf(usize) / bpi)) * bpi)); | |
| 861 | @as(Log2Int(usize), @intCast((@backingInt(inst) % (@bitSizeOf(usize) / bpi)) * bpi)); | |
| 862 | 862 | }, |
| 863 | 863 | } |
| 864 | 864 | } |
| ... | ... | @@ -893,7 +893,7 @@ fn analyzeInstBr( |
| 893 | 893 | inst: Air.Inst.Index, |
| 894 | 894 | ) !void { |
| 895 | 895 | const inst_datas = a.air.instructions.items(.data); |
| 896 | const br = inst_datas[@intFromEnum(inst)].br; | |
| 896 | const br = inst_datas[@backingInt(inst)].br; | |
| 897 | 897 | const gpa = a.gpa; |
| 898 | 898 | |
| 899 | 899 | switch (pass) { |
| ... | ... | @@ -920,7 +920,7 @@ fn analyzeInstRepeat( |
| 920 | 920 | inst: Air.Inst.Index, |
| 921 | 921 | ) !void { |
| 922 | 922 | const inst_datas = a.air.instructions.items(.data); |
| 923 | const repeat = inst_datas[@intFromEnum(inst)].repeat; | |
| 923 | const repeat = inst_datas[@backingInt(inst)].repeat; | |
| 924 | 924 | const gpa = a.gpa; |
| 925 | 925 | |
| 926 | 926 | switch (pass) { |
| ... | ... | @@ -949,7 +949,7 @@ fn analyzeInstSwitchDispatch( |
| 949 | 949 | // This happens to be identical to `analyzeInstBr`, but is separated anyway for clarity. |
| 950 | 950 | |
| 951 | 951 | const inst_datas = a.air.instructions.items(.data); |
| 952 | const br = inst_datas[@intFromEnum(inst)].br; | |
| 952 | const br = inst_datas[@backingInt(inst)].br; | |
| 953 | 953 | const gpa = a.gpa; |
| 954 | 954 | |
| 955 | 955 | switch (pass) { |
| ... | ... | @@ -1023,7 +1023,7 @@ fn analyzeInstBlock( |
| 1023 | 1023 | const alive = key.*; |
| 1024 | 1024 | if (!block_scope.live_set.contains(alive)) { |
| 1025 | 1025 | // Dies in block |
| 1026 | a.extra.appendAssumeCapacity(@intFromEnum(alive)); | |
| 1026 | a.extra.appendAssumeCapacity(@backingInt(alive)); | |
| 1027 | 1027 | measured_num += 1; |
| 1028 | 1028 | } |
| 1029 | 1029 | } |
| ... | ... | @@ -1064,7 +1064,7 @@ fn writeLoopInfo( |
| 1064 | 1064 | var it = data.breaks.keyIterator(); |
| 1065 | 1065 | while (it.next()) |key| { |
| 1066 | 1066 | const block_inst = key.*; |
| 1067 | a.extra.appendAssumeCapacity(@intFromEnum(block_inst)); | |
| 1067 | a.extra.appendAssumeCapacity(@backingInt(block_inst)); | |
| 1068 | 1068 | } |
| 1069 | 1069 | log.debug("[{t}] {f}: includes breaks to {f}", .{ LivenessPass.loop_analysis, inst, fmtInstSet(&data.breaks) }); |
| 1070 | 1070 | |
| ... | ... | @@ -1076,7 +1076,7 @@ fn writeLoopInfo( |
| 1076 | 1076 | it = data.live_set.keyIterator(); |
| 1077 | 1077 | while (it.next()) |key| { |
| 1078 | 1078 | const alive = key.*; |
| 1079 | a.extra.appendAssumeCapacity(@intFromEnum(alive)); | |
| 1079 | a.extra.appendAssumeCapacity(@backingInt(alive)); | |
| 1080 | 1080 | } |
| 1081 | 1081 | log.debug("[{t}] {f}: maintain liveness of {f}", .{ LivenessPass.loop_analysis, inst, fmtInstSet(&data.live_set) }); |
| 1082 | 1082 | |
| ... | ... | @@ -1297,7 +1297,7 @@ fn analyzeInstSwitchBr( |
| 1297 | 1297 | is_dispatch_loop: bool, |
| 1298 | 1298 | ) !void { |
| 1299 | 1299 | const inst_datas = a.air.instructions.items(.data); |
| 1300 | const pl_op = inst_datas[@intFromEnum(inst)].pl_op; | |
| 1300 | const pl_op = inst_datas[@backingInt(inst)].pl_op; | |
| 1301 | 1301 | const condition = pl_op.operand; |
| 1302 | 1302 | const switch_br = a.air.unwrapSwitch(inst); |
| 1303 | 1303 | const gpa = a.gpa; |
src/Air/Liveness/Verify.zig+24-24| ... | ... | @@ -48,7 +48,7 @@ fn verifyBody(self: *Verify, body: []const Air.Inst.Index) Error!void { |
| 48 | 48 | continue; |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | switch (tags[@intFromEnum(inst)]) { | |
| 51 | switch (tags[@backingInt(inst)]) { | |
| 52 | 52 | // no operands |
| 53 | 53 | .arg, |
| 54 | 54 | .alloc, |
| ... | ... | @@ -131,7 +131,7 @@ fn verifyBody(self: *Verify, body: []const Air.Inst.Index) Error!void { |
| 131 | 131 | .c_va_copy, |
| 132 | 132 | .abs, |
| 133 | 133 | => { |
| 134 | const ty_op = data[@intFromEnum(inst)].ty_op; | |
| 134 | const ty_op = data[@backingInt(inst)].ty_op; | |
| 135 | 135 | try self.verifyInstOperands(inst, .{ ty_op.operand, .none, .none }); |
| 136 | 136 | }, |
| 137 | 137 | .is_null, |
| ... | ... | @@ -164,14 +164,14 @@ fn verifyBody(self: *Verify, body: []const Air.Inst.Index) Error!void { |
| 164 | 164 | .set_err_return_trace, |
| 165 | 165 | .c_va_end, |
| 166 | 166 | => { |
| 167 | const un_op = data[@intFromEnum(inst)].un_op; | |
| 167 | const un_op = data[@backingInt(inst)].un_op; | |
| 168 | 168 | try self.verifyInstOperands(inst, .{ un_op, .none, .none }); |
| 169 | 169 | }, |
| 170 | 170 | .ret, |
| 171 | 171 | .ret_safe, |
| 172 | 172 | .ret_load, |
| 173 | 173 | => { |
| 174 | const un_op = data[@intFromEnum(inst)].un_op; | |
| 174 | const un_op = data[@backingInt(inst)].un_op; | |
| 175 | 175 | try self.verifyInstOperands(inst, .{ un_op, .none, .none }); |
| 176 | 176 | // This instruction terminates the function, so everything should be dead |
| 177 | 177 | if (self.live.count() > 0) return invalid("{f}: instructions still alive", .{inst}); |
| ... | ... | @@ -181,36 +181,36 @@ fn verifyBody(self: *Verify, body: []const Air.Inst.Index) Error!void { |
| 181 | 181 | .dbg_arg_inline, |
| 182 | 182 | .wasm_memory_grow, |
| 183 | 183 | => { |
| 184 | const pl_op = data[@intFromEnum(inst)].pl_op; | |
| 184 | const pl_op = data[@backingInt(inst)].pl_op; | |
| 185 | 185 | try self.verifyInstOperands(inst, .{ pl_op.operand, .none, .none }); |
| 186 | 186 | }, |
| 187 | 187 | .prefetch => { |
| 188 | const prefetch = data[@intFromEnum(inst)].prefetch; | |
| 188 | const prefetch = data[@backingInt(inst)].prefetch; | |
| 189 | 189 | try self.verifyInstOperands(inst, .{ prefetch.ptr, .none, .none }); |
| 190 | 190 | }, |
| 191 | 191 | .reduce, |
| 192 | 192 | .reduce_optimized, |
| 193 | 193 | => { |
| 194 | const reduce = data[@intFromEnum(inst)].reduce; | |
| 194 | const reduce = data[@backingInt(inst)].reduce; | |
| 195 | 195 | try self.verifyInstOperands(inst, .{ reduce.operand, .none, .none }); |
| 196 | 196 | }, |
| 197 | 197 | .union_init => { |
| 198 | const ty_pl = data[@intFromEnum(inst)].ty_pl; | |
| 198 | const ty_pl = data[@backingInt(inst)].ty_pl; | |
| 199 | 199 | const extra = self.air.extraData(Air.UnionInit, ty_pl.payload).data; |
| 200 | 200 | try self.verifyInstOperands(inst, .{ extra.init, .none, .none }); |
| 201 | 201 | }, |
| 202 | 202 | .struct_field_ptr, .agg_field_val, .spirv_runtime_array_len => { |
| 203 | const ty_pl = data[@intFromEnum(inst)].ty_pl; | |
| 203 | const ty_pl = data[@backingInt(inst)].ty_pl; | |
| 204 | 204 | const extra = self.air.extraData(Air.StructField, ty_pl.payload).data; |
| 205 | 205 | try self.verifyInstOperands(inst, .{ extra.struct_operand, .none, .none }); |
| 206 | 206 | }, |
| 207 | 207 | .field_parent_ptr => { |
| 208 | const ty_pl = data[@intFromEnum(inst)].ty_pl; | |
| 208 | const ty_pl = data[@backingInt(inst)].ty_pl; | |
| 209 | 209 | const extra = self.air.extraData(Air.FieldParentPtr, ty_pl.payload).data; |
| 210 | 210 | try self.verifyInstOperands(inst, .{ extra.field_ptr, .none, .none }); |
| 211 | 211 | }, |
| 212 | 212 | .atomic_load => { |
| 213 | const atomic_load = data[@intFromEnum(inst)].atomic_load; | |
| 213 | const atomic_load = data[@backingInt(inst)].atomic_load; | |
| 214 | 214 | try self.verifyInstOperands(inst, .{ atomic_load.ptr, .none, .none }); |
| 215 | 215 | }, |
| 216 | 216 | |
| ... | ... | @@ -282,7 +282,7 @@ fn verifyBody(self: *Verify, body: []const Air.Inst.Index) Error!void { |
| 282 | 282 | .memmove, |
| 283 | 283 | .legalize_vec_elem_val, |
| 284 | 284 | => { |
| 285 | const bin_op = data[@intFromEnum(inst)].bin_op; | |
| 285 | const bin_op = data[@backingInt(inst)].bin_op; | |
| 286 | 286 | try self.verifyInstOperands(inst, .{ bin_op.lhs, bin_op.rhs, .none }); |
| 287 | 287 | }, |
| 288 | 288 | .add_with_overflow, |
| ... | ... | @@ -295,7 +295,7 @@ fn verifyBody(self: *Verify, body: []const Air.Inst.Index) Error!void { |
| 295 | 295 | .slice_elem_ptr, |
| 296 | 296 | .slice, |
| 297 | 297 | => { |
| 298 | const ty_pl = data[@intFromEnum(inst)].ty_pl; | |
| 298 | const ty_pl = data[@backingInt(inst)].ty_pl; | |
| 299 | 299 | const extra = self.air.extraData(Air.Bin, ty_pl.payload).data; |
| 300 | 300 | try self.verifyInstOperands(inst, .{ extra.lhs, extra.rhs, .none }); |
| 301 | 301 | }, |
| ... | ... | @@ -310,38 +310,38 @@ fn verifyBody(self: *Verify, body: []const Air.Inst.Index) Error!void { |
| 310 | 310 | .cmp_vector, |
| 311 | 311 | .cmp_vector_optimized, |
| 312 | 312 | => { |
| 313 | const ty_pl = data[@intFromEnum(inst)].ty_pl; | |
| 313 | const ty_pl = data[@backingInt(inst)].ty_pl; | |
| 314 | 314 | const extra = self.air.extraData(Air.VectorCmp, ty_pl.payload).data; |
| 315 | 315 | try self.verifyInstOperands(inst, .{ extra.lhs, extra.rhs, .none }); |
| 316 | 316 | }, |
| 317 | 317 | .atomic_rmw => { |
| 318 | const pl_op = data[@intFromEnum(inst)].pl_op; | |
| 318 | const pl_op = data[@backingInt(inst)].pl_op; | |
| 319 | 319 | const extra = self.air.extraData(Air.AtomicRmw, pl_op.payload).data; |
| 320 | 320 | try self.verifyInstOperands(inst, .{ pl_op.operand, extra.operand, .none }); |
| 321 | 321 | }, |
| 322 | 322 | |
| 323 | 323 | // ternary |
| 324 | 324 | .select => { |
| 325 | const pl_op = data[@intFromEnum(inst)].pl_op; | |
| 325 | const pl_op = data[@backingInt(inst)].pl_op; | |
| 326 | 326 | const extra = self.air.extraData(Air.Bin, pl_op.payload).data; |
| 327 | 327 | try self.verifyInstOperands(inst, .{ pl_op.operand, extra.lhs, extra.rhs }); |
| 328 | 328 | }, |
| 329 | 329 | .mul_add => { |
| 330 | const pl_op = data[@intFromEnum(inst)].pl_op; | |
| 330 | const pl_op = data[@backingInt(inst)].pl_op; | |
| 331 | 331 | const extra = self.air.extraData(Air.Bin, pl_op.payload).data; |
| 332 | 332 | try self.verifyInstOperands(inst, .{ extra.lhs, extra.rhs, pl_op.operand }); |
| 333 | 333 | }, |
| 334 | 334 | .cmpxchg_strong, |
| 335 | 335 | .cmpxchg_weak, |
| 336 | 336 | => { |
| 337 | const ty_pl = data[@intFromEnum(inst)].ty_pl; | |
| 337 | const ty_pl = data[@backingInt(inst)].ty_pl; | |
| 338 | 338 | const extra = self.air.extraData(Air.Cmpxchg, ty_pl.payload).data; |
| 339 | 339 | try self.verifyInstOperands(inst, .{ extra.ptr, extra.expected_value, extra.new_value }); |
| 340 | 340 | }, |
| 341 | 341 | |
| 342 | 342 | // big tombs |
| 343 | 343 | .aggregate_init => { |
| 344 | const ty_pl = data[@intFromEnum(inst)].ty_pl; | |
| 344 | const ty_pl = data[@backingInt(inst)].ty_pl; | |
| 345 | 345 | const aggregate_ty = ty_pl.ty.toType(); |
| 346 | 346 | const len = @as(usize, @intCast(aggregate_ty.arrayLenIp(ip))); |
| 347 | 347 | const elements = @as([]const Air.Inst.Ref, @ptrCast(self.air.extra.items[ty_pl.payload..][0..len])); |
| ... | ... | @@ -422,7 +422,7 @@ fn verifyBody(self: *Verify, body: []const Air.Inst.Index) Error!void { |
| 422 | 422 | try self.verifyInst(inst); |
| 423 | 423 | }, |
| 424 | 424 | .br => { |
| 425 | const br = data[@intFromEnum(inst)].br; | |
| 425 | const br = data[@backingInt(inst)].br; | |
| 426 | 426 | const gop = try self.blocks.getOrPut(self.gpa, br.block_inst); |
| 427 | 427 | |
| 428 | 428 | try self.verifyOperand(inst, br.operand, self.liveness.operandDies(inst, 0)); |
| ... | ... | @@ -434,14 +434,14 @@ fn verifyBody(self: *Verify, body: []const Air.Inst.Index) Error!void { |
| 434 | 434 | try self.verifyInst(inst); |
| 435 | 435 | }, |
| 436 | 436 | .repeat => { |
| 437 | const repeat = data[@intFromEnum(inst)].repeat; | |
| 437 | const repeat = data[@backingInt(inst)].repeat; | |
| 438 | 438 | const expected_live = self.loops.get(repeat.loop_inst) orelse |
| 439 | 439 | return invalid("{f}: loop {f} not in scope", .{ inst, repeat.loop_inst }); |
| 440 | 440 | |
| 441 | 441 | try self.verifyMatchingLiveness(repeat.loop_inst, expected_live); |
| 442 | 442 | }, |
| 443 | 443 | .switch_dispatch => { |
| 444 | const br = data[@intFromEnum(inst)].br; | |
| 444 | const br = data[@backingInt(inst)].br; | |
| 445 | 445 | |
| 446 | 446 | try self.verifyOperand(inst, br.operand, self.liveness.operandDies(inst, 0)); |
| 447 | 447 | |
| ... | ... | @@ -451,7 +451,7 @@ fn verifyBody(self: *Verify, body: []const Air.Inst.Index) Error!void { |
| 451 | 451 | try self.verifyMatchingLiveness(br.block_inst, expected_live); |
| 452 | 452 | }, |
| 453 | 453 | .block, .dbg_inline_block => |tag| { |
| 454 | const ty_pl = data[@intFromEnum(inst)].ty_pl; | |
| 454 | const ty_pl = data[@backingInt(inst)].ty_pl; | |
| 455 | 455 | const block_ty = ty_pl.ty.toType(); |
| 456 | 456 | const block_body = switch (tag) { |
| 457 | 457 | .block => self.air.unwrapBlock(inst).body, |
| ... | ... | @@ -570,7 +570,7 @@ fn verifyBody(self: *Verify, body: []const Air.Inst.Index) Error!void { |
| 570 | 570 | try self.verifyInst(inst); |
| 571 | 571 | }, |
| 572 | 572 | .legalize_vec_store_elem => { |
| 573 | const pl_op = data[@intFromEnum(inst)].pl_op; | |
| 573 | const pl_op = data[@backingInt(inst)].pl_op; | |
| 574 | 574 | const bin = self.air.extraData(Air.Bin, pl_op.payload).data; |
| 575 | 575 | try self.verifyInstOperands(inst, .{ pl_op.operand, bin.lhs, bin.rhs }); |
| 576 | 576 | }, |
src/Air/Verify.zig+13-13| ... | ... | @@ -69,7 +69,7 @@ fn body(verify: *Verify, body_insts: []const Air.Inst.Index) Error!void { |
| 69 | 69 | const data = air.instructions.items(.data); |
| 70 | 70 | for (body_insts, 0..) |inst, body_index| { |
| 71 | 71 | verify.cur_inst = inst; |
| 72 | switch (tags[@intFromEnum(inst)]) { | |
| 72 | switch (tags[@backingInt(inst)]) { | |
| 73 | 73 | .block => { |
| 74 | 74 | const block = air.unwrapBlock(inst); |
| 75 | 75 | try verify.body(block.body); |
| ... | ... | @@ -107,11 +107,11 @@ fn body(verify: *Verify, body_insts: []const Air.Inst.Index) Error!void { |
| 107 | 107 | } |
| 108 | 108 | }, |
| 109 | 109 | .ret, .ret_safe => { |
| 110 | const operand = data[@intFromEnum(inst)].un_op; | |
| 110 | const operand = data[@backingInt(inst)].un_op; | |
| 111 | 111 | if (air.typeOf(operand, ip).toIntern() != verify.ret_ty.toIntern()) return verify.fail("bad return type"); |
| 112 | 112 | }, |
| 113 | 113 | .ret_load => { |
| 114 | const operand = data[@intFromEnum(inst)].un_op; | |
| 114 | const operand = data[@backingInt(inst)].un_op; | |
| 115 | 115 | const ptr_ty = air.typeOf(operand, ip); |
| 116 | 116 | if (ptr_ty.zigTypeTag(zcu) != .pointer) return verify.fail("operand is not a pointer"); |
| 117 | 117 | if (ptr_ty.ptrSize(zcu) != .one) return verify.fail("pointer size is not '.one'"); |
| ... | ... | @@ -119,7 +119,7 @@ fn body(verify: *Verify, body_insts: []const Air.Inst.Index) Error!void { |
| 119 | 119 | }, |
| 120 | 120 | |
| 121 | 121 | .bit_cast, .bit_cast_safe => { |
| 122 | const ty_op = data[@intFromEnum(inst)].ty_op; | |
| 122 | const ty_op = data[@backingInt(inst)].ty_op; | |
| 123 | 123 | const operand_ty = air.typeOf(ty_op.operand, ip); |
| 124 | 124 | const result_ty = ty_op.ty.toType(); |
| 125 | 125 | // Enums are allowed here even if their backing type is implicit. |
| ... | ... | @@ -134,7 +134,7 @@ fn body(verify: *Verify, body_insts: []const Air.Inst.Index) Error!void { |
| 134 | 134 | if (operand_ty.bitSize(zcu) != result_ty.bitSize(zcu)) return verify.fail("bit size mismatch"); |
| 135 | 135 | }, |
| 136 | 136 | .ptr_cast => { |
| 137 | const ty_op = data[@intFromEnum(inst)].ty_op; | |
| 137 | const ty_op = data[@backingInt(inst)].ty_op; | |
| 138 | 138 | const operand_ty = air.typeOf(ty_op.operand, ip); |
| 139 | 139 | const result_ty = ty_op.ty.toType(); |
| 140 | 140 | const operand_scalar_ty = operand_ty.scalarType(zcu); |
| ... | ... | @@ -152,7 +152,7 @@ fn body(verify: *Verify, body_insts: []const Air.Inst.Index) Error!void { |
| 152 | 152 | } |
| 153 | 153 | }, |
| 154 | 154 | .ptr_from_int => { |
| 155 | const ty_op = data[@intFromEnum(inst)].ty_op; | |
| 155 | const ty_op = data[@backingInt(inst)].ty_op; | |
| 156 | 156 | const operand_ty = air.typeOf(ty_op.operand, ip); |
| 157 | 157 | const result_ty = ty_op.ty.toType(); |
| 158 | 158 | const operand_scalar_ty = operand_ty.scalarType(zcu); |
| ... | ... | @@ -163,7 +163,7 @@ fn body(verify: *Verify, body_insts: []const Air.Inst.Index) Error!void { |
| 163 | 163 | if (!operand_ty.isVector(zcu) and result_ty.isVector(zcu)) return verify.fail("result is vector, but operand is not"); |
| 164 | 164 | }, |
| 165 | 165 | .int_from_ptr => { |
| 166 | const ty_op = data[@intFromEnum(inst)].ty_op; | |
| 166 | const ty_op = data[@backingInt(inst)].ty_op; | |
| 167 | 167 | const operand_ty = air.typeOf(ty_op.operand, ip); |
| 168 | 168 | const result_ty = ty_op.ty.toType(); |
| 169 | 169 | const operand_scalar_ty = operand_ty.scalarType(zcu); |
| ... | ... | @@ -174,7 +174,7 @@ fn body(verify: *Verify, body_insts: []const Air.Inst.Index) Error!void { |
| 174 | 174 | if (!operand_ty.isVector(zcu) and result_ty.isVector(zcu)) return verify.fail("result is vector, but operand is not"); |
| 175 | 175 | }, |
| 176 | 176 | .error_cast => { |
| 177 | const ty_op = data[@intFromEnum(inst)].ty_op; | |
| 177 | const ty_op = data[@backingInt(inst)].ty_op; | |
| 178 | 178 | const operand_ty = air.typeOf(ty_op.operand, ip); |
| 179 | 179 | const result_ty = ty_op.ty.toType(); |
| 180 | 180 | switch (operand_ty.zigTypeTag(zcu)) { |
| ... | ... | @@ -193,7 +193,7 @@ fn body(verify: *Verify, body_insts: []const Air.Inst.Index) Error!void { |
| 193 | 193 | } |
| 194 | 194 | }, |
| 195 | 195 | .error_from_int => { |
| 196 | const ty_op = data[@intFromEnum(inst)].ty_op; | |
| 196 | const ty_op = data[@backingInt(inst)].ty_op; | |
| 197 | 197 | const operand_ty = air.typeOf(ty_op.operand, ip); |
| 198 | 198 | const result_ty = ty_op.ty.toType(); |
| 199 | 199 | if (!operand_ty.isUnsignedInt(zcu)) return verify.fail("bad operand type"); |
| ... | ... | @@ -201,7 +201,7 @@ fn body(verify: *Verify, body_insts: []const Air.Inst.Index) Error!void { |
| 201 | 201 | if (result_ty.zigTypeTag(zcu) != .error_set) return verify.fail("bad result type"); |
| 202 | 202 | }, |
| 203 | 203 | .int_from_error => { |
| 204 | const ty_op = data[@intFromEnum(inst)].ty_op; | |
| 204 | const ty_op = data[@backingInt(inst)].ty_op; | |
| 205 | 205 | const operand_ty = air.typeOf(ty_op.operand, ip); |
| 206 | 206 | const result_ty = ty_op.ty.toType(); |
| 207 | 207 | if (operand_ty.zigTypeTag(zcu) != .error_set) return verify.fail("bad operand type"); |
| ... | ... | @@ -209,7 +209,7 @@ fn body(verify: *Verify, body_insts: []const Air.Inst.Index) Error!void { |
| 209 | 209 | if (result_ty.bitSize(zcu) != zcu.errorSetBits()) return verify.fail("bad result bit size"); |
| 210 | 210 | }, |
| 211 | 211 | .union_from_enum => { |
| 212 | const ty_op = data[@intFromEnum(inst)].ty_op; | |
| 212 | const ty_op = data[@backingInt(inst)].ty_op; | |
| 213 | 213 | const operand_ty = air.typeOf(ty_op.operand, ip); |
| 214 | 214 | const result_ty = ty_op.ty.toType(); |
| 215 | 215 | if (operand_ty.zigTypeTag(zcu) != .@"enum") return verify.fail("bad operand type"); |
| ... | ... | @@ -219,7 +219,7 @@ fn body(verify: *Verify, body_insts: []const Air.Inst.Index) Error!void { |
| 219 | 219 | }, |
| 220 | 220 | |
| 221 | 221 | .ptr_elem_ptr => { |
| 222 | const ty_pl = data[@intFromEnum(inst)].ty_pl; | |
| 222 | const ty_pl = data[@backingInt(inst)].ty_pl; | |
| 223 | 223 | const bin_op = air.extraData(Air.Bin, ty_pl.payload).data; |
| 224 | 224 | const ptr_ty = air.typeOf(bin_op.lhs, ip); |
| 225 | 225 | const result_ty = ty_pl.ty.toType(); |
| ... | ... | @@ -442,7 +442,7 @@ fn body(verify: *Verify, body_insts: []const Air.Inst.Index) Error!void { |
| 442 | 442 | // probably just needs to live exclusively in backends; putting AIR instructions after a |
| 443 | 443 | // call implies that we have e.g. a valid stack at that point, which we can't actually |
| 444 | 444 | // assume when the user has gotten a function's ABI wrong. |
| 445 | switch (tags[@intFromEnum(inst)]) { | |
| 445 | switch (tags[@backingInt(inst)]) { | |
| 446 | 446 | .call, |
| 447 | 447 | .call_always_tail, |
| 448 | 448 | .call_never_tail, |
src/Air/print.zig+33-33| ... | ... | @@ -106,7 +106,7 @@ const Writer = struct { |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | fn writeInst(w: *Writer, s: *std.Io.Writer, inst: Air.Inst.Index) Error!void { |
| 109 | const tag = w.air.instructions.items(.tag)[@intFromEnum(inst)]; | |
| 109 | const tag = w.air.instructions.items(.tag)[@backingInt(inst)]; | |
| 110 | 110 | try s.splatByteAll(' ', w.indent); |
| 111 | 111 | try s.print("{f}{c}= {s}(", .{ |
| 112 | 112 | inst, |
| ... | ... | @@ -357,14 +357,14 @@ const Writer = struct { |
| 357 | 357 | } |
| 358 | 358 | |
| 359 | 359 | fn writeBinOp(w: *Writer, s: *std.Io.Writer, inst: Air.Inst.Index) Error!void { |
| 360 | const bin_op = w.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 360 | const bin_op = w.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 361 | 361 | try w.writeOperand(s, inst, 0, bin_op.lhs); |
| 362 | 362 | try s.writeAll(", "); |
| 363 | 363 | try w.writeOperand(s, inst, 1, bin_op.rhs); |
| 364 | 364 | } |
| 365 | 365 | |
| 366 | 366 | fn writeUnOp(w: *Writer, s: *std.Io.Writer, inst: Air.Inst.Index) Error!void { |
| 367 | const un_op = w.air.instructions.items(.data)[@intFromEnum(inst)].un_op; | |
| 367 | const un_op = w.air.instructions.items(.data)[@backingInt(inst)].un_op; | |
| 368 | 368 | try w.writeOperand(s, inst, 0, un_op); |
| 369 | 369 | } |
| 370 | 370 | |
| ... | ... | @@ -380,25 +380,25 @@ const Writer = struct { |
| 380 | 380 | } |
| 381 | 381 | |
| 382 | 382 | fn writeTy(w: *Writer, s: *std.Io.Writer, inst: Air.Inst.Index) Error!void { |
| 383 | const ty = w.air.instructions.items(.data)[@intFromEnum(inst)].ty; | |
| 383 | const ty = w.air.instructions.items(.data)[@backingInt(inst)].ty; | |
| 384 | 384 | try w.writeType(s, ty); |
| 385 | 385 | } |
| 386 | 386 | |
| 387 | 387 | fn writeArg(w: *Writer, s: *std.Io.Writer, inst: Air.Inst.Index) Error!void { |
| 388 | const arg = w.air.instructions.items(.data)[@intFromEnum(inst)].arg; | |
| 388 | const arg = w.air.instructions.items(.data)[@backingInt(inst)].arg; | |
| 389 | 389 | try w.writeType(s, arg.ty.toType()); |
| 390 | 390 | try s.print(", {d}", .{arg.zir_param_index}); |
| 391 | 391 | } |
| 392 | 392 | |
| 393 | 393 | fn writeTyOp(w: *Writer, s: *std.Io.Writer, inst: Air.Inst.Index) Error!void { |
| 394 | const ty_op = w.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 394 | const ty_op = w.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 395 | 395 | try w.writeType(s, ty_op.ty.toType()); |
| 396 | 396 | try s.writeAll(", "); |
| 397 | 397 | try w.writeOperand(s, inst, 0, ty_op.operand); |
| 398 | 398 | } |
| 399 | 399 | |
| 400 | 400 | fn writeBlock(w: *Writer, s: *std.Io.Writer, tag: Air.Inst.Tag, inst: Air.Inst.Index) Error!void { |
| 401 | const ty_pl = w.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | |
| 401 | const ty_pl = w.air.instructions.items(.data)[@backingInt(inst)].ty_pl; | |
| 402 | 402 | try w.writeType(s, ty_pl.ty.toType()); |
| 403 | 403 | |
| 404 | 404 | const body = switch (tag) { |
| ... | ... | @@ -446,7 +446,7 @@ const Writer = struct { |
| 446 | 446 | |
| 447 | 447 | fn writeAggregateInit(w: *Writer, s: *std.Io.Writer, inst: Air.Inst.Index) Error!void { |
| 448 | 448 | const zcu = w.pt.zcu; |
| 449 | const ty_pl = w.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | |
| 449 | const ty_pl = w.air.instructions.items(.data)[@backingInt(inst)].ty_pl; | |
| 450 | 450 | const vector_ty = ty_pl.ty.toType(); |
| 451 | 451 | const len = @as(usize, @intCast(vector_ty.arrayLen(zcu))); |
| 452 | 452 | const elements = @as([]const Air.Inst.Ref, @ptrCast(w.air.extra.items[ty_pl.payload..][0..len])); |
| ... | ... | @@ -461,7 +461,7 @@ const Writer = struct { |
| 461 | 461 | } |
| 462 | 462 | |
| 463 | 463 | fn writeUnionInit(w: *Writer, s: *std.Io.Writer, inst: Air.Inst.Index) Error!void { |
| 464 | const ty_pl = w.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | |
| 464 | const ty_pl = w.air.instructions.items(.data)[@backingInt(inst)].ty_pl; | |
| 465 | 465 | const extra = w.air.extraData(Air.UnionInit, ty_pl.payload).data; |
| 466 | 466 | |
| 467 | 467 | try s.print("{d}, ", .{extra.field_index}); |
| ... | ... | @@ -469,7 +469,7 @@ const Writer = struct { |
| 469 | 469 | } |
| 470 | 470 | |
| 471 | 471 | fn writeStructField(w: *Writer, s: *std.Io.Writer, inst: Air.Inst.Index) Error!void { |
| 472 | const ty_pl = w.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | |
| 472 | const ty_pl = w.air.instructions.items(.data)[@backingInt(inst)].ty_pl; | |
| 473 | 473 | const extra = w.air.extraData(Air.StructField, ty_pl.payload).data; |
| 474 | 474 | |
| 475 | 475 | try w.writeOperand(s, inst, 0, extra.struct_operand); |
| ... | ... | @@ -478,10 +478,10 @@ const Writer = struct { |
| 478 | 478 | |
| 479 | 479 | fn writeTyPlBin(w: *Writer, s: *std.Io.Writer, inst: Air.Inst.Index) Error!void { |
| 480 | 480 | const data = w.air.instructions.items(.data); |
| 481 | const ty_pl = data[@intFromEnum(inst)].ty_pl; | |
| 481 | const ty_pl = data[@backingInt(inst)].ty_pl; | |
| 482 | 482 | const extra = w.air.extraData(Air.Bin, ty_pl.payload).data; |
| 483 | 483 | |
| 484 | const inst_ty = data[@intFromEnum(inst)].ty_pl.ty.toType(); | |
| 484 | const inst_ty = data[@backingInt(inst)].ty_pl.ty.toType(); | |
| 485 | 485 | try w.writeType(s, inst_ty); |
| 486 | 486 | try s.writeAll(", "); |
| 487 | 487 | try w.writeOperand(s, inst, 0, extra.lhs); |
| ... | ... | @@ -490,7 +490,7 @@ const Writer = struct { |
| 490 | 490 | } |
| 491 | 491 | |
| 492 | 492 | fn writeCmpxchg(w: *Writer, s: *std.Io.Writer, inst: Air.Inst.Index) Error!void { |
| 493 | const ty_pl = w.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | |
| 493 | const ty_pl = w.air.instructions.items(.data)[@backingInt(inst)].ty_pl; | |
| 494 | 494 | const extra = w.air.extraData(Air.Cmpxchg, ty_pl.payload).data; |
| 495 | 495 | |
| 496 | 496 | try w.writeOperand(s, inst, 0, extra.ptr); |
| ... | ... | @@ -504,7 +504,7 @@ const Writer = struct { |
| 504 | 504 | } |
| 505 | 505 | |
| 506 | 506 | fn writeMulAdd(w: *Writer, s: *std.Io.Writer, inst: Air.Inst.Index) Error!void { |
| 507 | const pl_op = w.air.instructions.items(.data)[@intFromEnum(inst)].pl_op; | |
| 507 | const pl_op = w.air.instructions.items(.data)[@backingInt(inst)].pl_op; | |
| 508 | 508 | const extra = w.air.extraData(Air.Bin, pl_op.payload).data; |
| 509 | 509 | |
| 510 | 510 | try w.writeOperand(s, inst, 0, extra.lhs); |
| ... | ... | @@ -515,7 +515,7 @@ const Writer = struct { |
| 515 | 515 | } |
| 516 | 516 | |
| 517 | 517 | fn writeLegalizeVecStoreElem(w: *Writer, s: *std.Io.Writer, inst: Air.Inst.Index) Error!void { |
| 518 | const pl_op = w.air.instructions.items(.data)[@intFromEnum(inst)].pl_op; | |
| 518 | const pl_op = w.air.instructions.items(.data)[@backingInt(inst)].pl_op; | |
| 519 | 519 | const bin = w.air.extraData(Air.Bin, pl_op.payload).data; |
| 520 | 520 | |
| 521 | 521 | try w.writeOperand(s, inst, 0, pl_op.operand); |
| ... | ... | @@ -574,7 +574,7 @@ const Writer = struct { |
| 574 | 574 | |
| 575 | 575 | fn writeSelect(w: *Writer, s: *std.Io.Writer, inst: Air.Inst.Index) Error!void { |
| 576 | 576 | const zcu = w.pt.zcu; |
| 577 | const pl_op = w.air.instructions.items(.data)[@intFromEnum(inst)].pl_op; | |
| 577 | const pl_op = w.air.instructions.items(.data)[@backingInt(inst)].pl_op; | |
| 578 | 578 | const extra = w.air.extraData(Air.Bin, pl_op.payload).data; |
| 579 | 579 | |
| 580 | 580 | const elem_ty = w.typeOfIndex(inst).childType(zcu); |
| ... | ... | @@ -588,14 +588,14 @@ const Writer = struct { |
| 588 | 588 | } |
| 589 | 589 | |
| 590 | 590 | fn writeReduce(w: *Writer, s: *std.Io.Writer, inst: Air.Inst.Index) Error!void { |
| 591 | const reduce = w.air.instructions.items(.data)[@intFromEnum(inst)].reduce; | |
| 591 | const reduce = w.air.instructions.items(.data)[@backingInt(inst)].reduce; | |
| 592 | 592 | |
| 593 | 593 | try w.writeOperand(s, inst, 0, reduce.operand); |
| 594 | 594 | try s.print(", {s}", .{@tagName(reduce.operation)}); |
| 595 | 595 | } |
| 596 | 596 | |
| 597 | 597 | fn writeCmpVector(w: *Writer, s: *std.Io.Writer, inst: Air.Inst.Index) Error!void { |
| 598 | const ty_pl = w.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | |
| 598 | const ty_pl = w.air.instructions.items(.data)[@backingInt(inst)].ty_pl; | |
| 599 | 599 | const extra = w.air.extraData(Air.VectorCmp, ty_pl.payload).data; |
| 600 | 600 | |
| 601 | 601 | try s.print("{s}, ", .{@tagName(extra.compareOperator())}); |
| ... | ... | @@ -606,20 +606,20 @@ const Writer = struct { |
| 606 | 606 | |
| 607 | 607 | fn writeRuntimeNavPtr(w: *Writer, s: *std.Io.Writer, inst: Air.Inst.Index) Error!void { |
| 608 | 608 | const ip = &w.pt.zcu.intern_pool; |
| 609 | const ty_nav = w.air.instructions.items(.data)[@intFromEnum(inst)].ty_nav; | |
| 609 | const ty_nav = w.air.instructions.items(.data)[@backingInt(inst)].ty_nav; | |
| 610 | 610 | try w.writeType(s, .fromInterned(ty_nav.ty)); |
| 611 | 611 | try s.print(", '{f}'", .{ip.getNav(ty_nav.nav).fqn.fmt(ip)}); |
| 612 | 612 | } |
| 613 | 613 | |
| 614 | 614 | fn writeAtomicLoad(w: *Writer, s: *std.Io.Writer, inst: Air.Inst.Index) Error!void { |
| 615 | const atomic_load = w.air.instructions.items(.data)[@intFromEnum(inst)].atomic_load; | |
| 615 | const atomic_load = w.air.instructions.items(.data)[@backingInt(inst)].atomic_load; | |
| 616 | 616 | |
| 617 | 617 | try w.writeOperand(s, inst, 0, atomic_load.ptr); |
| 618 | 618 | try s.print(", {s}", .{@tagName(atomic_load.order)}); |
| 619 | 619 | } |
| 620 | 620 | |
| 621 | 621 | fn writePrefetch(w: *Writer, s: *std.Io.Writer, inst: Air.Inst.Index) Error!void { |
| 622 | const prefetch = w.air.instructions.items(.data)[@intFromEnum(inst)].prefetch; | |
| 622 | const prefetch = w.air.instructions.items(.data)[@backingInt(inst)].prefetch; | |
| 623 | 623 | |
| 624 | 624 | try w.writeOperand(s, inst, 0, prefetch.ptr); |
| 625 | 625 | try s.print(", {s}, {d}, {s}", .{ |
| ... | ... | @@ -633,7 +633,7 @@ const Writer = struct { |
| 633 | 633 | inst: Air.Inst.Index, |
| 634 | 634 | order: std.lang.AtomicOrder, |
| 635 | 635 | ) Error!void { |
| 636 | const bin_op = w.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 636 | const bin_op = w.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 637 | 637 | try w.writeOperand(s, inst, 0, bin_op.lhs); |
| 638 | 638 | try s.writeAll(", "); |
| 639 | 639 | try w.writeOperand(s, inst, 1, bin_op.rhs); |
| ... | ... | @@ -641,7 +641,7 @@ const Writer = struct { |
| 641 | 641 | } |
| 642 | 642 | |
| 643 | 643 | fn writeAtomicRmw(w: *Writer, s: *std.Io.Writer, inst: Air.Inst.Index) Error!void { |
| 644 | const pl_op = w.air.instructions.items(.data)[@intFromEnum(inst)].pl_op; | |
| 644 | const pl_op = w.air.instructions.items(.data)[@backingInt(inst)].pl_op; | |
| 645 | 645 | const extra = w.air.extraData(Air.AtomicRmw, pl_op.payload).data; |
| 646 | 646 | |
| 647 | 647 | try w.writeOperand(s, inst, 0, pl_op.operand); |
| ... | ... | @@ -651,7 +651,7 @@ const Writer = struct { |
| 651 | 651 | } |
| 652 | 652 | |
| 653 | 653 | fn writeFieldParentPtr(w: *Writer, s: *std.Io.Writer, inst: Air.Inst.Index) Error!void { |
| 654 | const ty_pl = w.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | |
| 654 | const ty_pl = w.air.instructions.items(.data)[@backingInt(inst)].ty_pl; | |
| 655 | 655 | const extra = w.air.extraData(Air.FieldParentPtr, ty_pl.payload).data; |
| 656 | 656 | |
| 657 | 657 | try w.writeOperand(s, inst, 0, extra.field_ptr); |
| ... | ... | @@ -719,14 +719,14 @@ const Writer = struct { |
| 719 | 719 | } |
| 720 | 720 | |
| 721 | 721 | fn writeDbgStmt(w: *Writer, s: *std.Io.Writer, inst: Air.Inst.Index) Error!void { |
| 722 | const dbg_stmt = w.air.instructions.items(.data)[@intFromEnum(inst)].dbg_stmt; | |
| 722 | const dbg_stmt = w.air.instructions.items(.data)[@backingInt(inst)].dbg_stmt; | |
| 723 | 723 | try s.print("{d}:{d}", .{ dbg_stmt.line + 1, dbg_stmt.column + 1 }); |
| 724 | 724 | } |
| 725 | 725 | |
| 726 | 726 | fn writeDbgVar(w: *Writer, s: *std.Io.Writer, inst: Air.Inst.Index) Error!void { |
| 727 | const pl_op = w.air.instructions.items(.data)[@intFromEnum(inst)].pl_op; | |
| 727 | const pl_op = w.air.instructions.items(.data)[@backingInt(inst)].pl_op; | |
| 728 | 728 | try w.writeOperand(s, inst, 0, pl_op.operand); |
| 729 | const name: Air.NullTerminatedString = @enumFromInt(pl_op.payload); | |
| 729 | const name: Air.NullTerminatedString = @fromBackingInt(@intCast(pl_op.payload)); | |
| 730 | 730 | try s.print(", \"{f}\"", .{std.zig.fmtString(name.toSlice(w.air))}); |
| 731 | 731 | } |
| 732 | 732 | |
| ... | ... | @@ -743,14 +743,14 @@ const Writer = struct { |
| 743 | 743 | } |
| 744 | 744 | |
| 745 | 745 | fn writeBr(w: *Writer, s: *std.Io.Writer, inst: Air.Inst.Index) Error!void { |
| 746 | const br = w.air.instructions.items(.data)[@intFromEnum(inst)].br; | |
| 746 | const br = w.air.instructions.items(.data)[@backingInt(inst)].br; | |
| 747 | 747 | try w.writeInstIndex(s, br.block_inst, false); |
| 748 | 748 | try s.writeAll(", "); |
| 749 | 749 | try w.writeOperand(s, inst, 0, br.operand); |
| 750 | 750 | } |
| 751 | 751 | |
| 752 | 752 | fn writeRepeat(w: *Writer, s: *std.Io.Writer, inst: Air.Inst.Index) Error!void { |
| 753 | const repeat = w.air.instructions.items(.data)[@intFromEnum(inst)].repeat; | |
| 753 | const repeat = w.air.instructions.items(.data)[@backingInt(inst)].repeat; | |
| 754 | 754 | try w.writeInstIndex(s, repeat.loop_inst, false); |
| 755 | 755 | } |
| 756 | 756 | |
| ... | ... | @@ -968,18 +968,18 @@ const Writer = struct { |
| 968 | 968 | } |
| 969 | 969 | |
| 970 | 970 | fn writeWasmMemorySize(w: *Writer, s: *std.Io.Writer, inst: Air.Inst.Index) Error!void { |
| 971 | const pl_op = w.air.instructions.items(.data)[@intFromEnum(inst)].pl_op; | |
| 971 | const pl_op = w.air.instructions.items(.data)[@backingInt(inst)].pl_op; | |
| 972 | 972 | try s.print("{d}", .{pl_op.payload}); |
| 973 | 973 | } |
| 974 | 974 | |
| 975 | 975 | fn writeWasmMemoryGrow(w: *Writer, s: *std.Io.Writer, inst: Air.Inst.Index) Error!void { |
| 976 | const pl_op = w.air.instructions.items(.data)[@intFromEnum(inst)].pl_op; | |
| 976 | const pl_op = w.air.instructions.items(.data)[@backingInt(inst)].pl_op; | |
| 977 | 977 | try s.print("{d}, ", .{pl_op.payload}); |
| 978 | 978 | try w.writeOperand(s, inst, 0, pl_op.operand); |
| 979 | 979 | } |
| 980 | 980 | |
| 981 | 981 | fn writeWorkDimension(w: *Writer, s: *std.Io.Writer, inst: Air.Inst.Index) Error!void { |
| 982 | const pl_op = w.air.instructions.items(.data)[@intFromEnum(inst)].pl_op; | |
| 982 | const pl_op = w.air.instructions.items(.data)[@backingInt(inst)].pl_op; | |
| 983 | 983 | try s.print("{d}", .{pl_op.payload}); |
| 984 | 984 | } |
| 985 | 985 | |
| ... | ... | @@ -1015,7 +1015,7 @@ const Writer = struct { |
| 1015 | 1015 | operand: Air.Inst.Ref, |
| 1016 | 1016 | dies: bool, |
| 1017 | 1017 | ) Error!void { |
| 1018 | if (@intFromEnum(operand) < InternPool.static_len) { | |
| 1018 | if (@backingInt(operand) < InternPool.static_len) { | |
| 1019 | 1019 | return s.print("@{}", .{operand}); |
| 1020 | 1020 | } else if (operand.toInterned()) |ip_index| { |
| 1021 | 1021 | const pt = w.pt; |
src/Compilation.zig+39-39| ... | ... | @@ -418,7 +418,7 @@ pub const Path = struct { |
| 418 | 418 | /// The added data is relocatable across any compiler process using the same lib and cache |
| 419 | 419 | /// directories; it does not depend on cwd. |
| 420 | 420 | pub fn addToHasher(p: Path, h: *Cache.Hasher) void { |
| 421 | h.update(&.{@intFromEnum(p.root)}); | |
| 421 | h.update(&.{@backingInt(p.root)}); | |
| 422 | 422 | h.update(p.sub_path); |
| 423 | 423 | } |
| 424 | 424 | |
| ... | ... | @@ -843,7 +843,7 @@ pub const CObject = struct { |
| 843 | 843 | |
| 844 | 844 | pub fn addToErrorBundle(diag: *const Diag, io: Io, eb: *ErrorBundle.Wip, bundle: Bundle, note: *u32) !void { |
| 845 | 845 | const err_msg = try eb.addErrorMessage(try diag.toErrorMessage(io, eb, bundle, 0)); |
| 846 | eb.extra.items[note.*] = @intFromEnum(err_msg); | |
| 846 | eb.extra.items[note.*] = @backingInt(err_msg); | |
| 847 | 847 | note.* += 1; |
| 848 | 848 | for (diag.sub_diags) |sub_diag| try sub_diag.addToErrorBundle(io, eb, bundle, note); |
| 849 | 849 | } |
| ... | ... | @@ -976,12 +976,12 @@ pub const CObject = struct { |
| 976 | 976 | |
| 977 | 977 | try bc.checkMagic("DIAG"); |
| 978 | 978 | while (try bc.next()) |item| switch (item) { |
| 979 | .start_block => |block| switch (@as(BlockId, @enumFromInt(block.id))) { | |
| 979 | .start_block => |block| switch (@as(BlockId, @fromBackingInt(@intCast(block.id)))) { | |
| 980 | 980 | .Meta => if (stack.items.len > 0) try bc.skipBlock(block), |
| 981 | 981 | .Diag => try stack.append(gpa, .{}), |
| 982 | 982 | _ => try bc.skipBlock(block), |
| 983 | 983 | }, |
| 984 | .record => |record| switch (@as(RecordId, @enumFromInt(record.id))) { | |
| 984 | .record => |record| switch (@as(RecordId, @fromBackingInt(@intCast(record.id)))) { | |
| 985 | 985 | .Version => if (record.operands[0] != 2) return error.InvalidVersion, |
| 986 | 986 | .DiagInfo => { |
| 987 | 987 | const top = &stack.items[stack.items.len - 1]; |
| ... | ... | @@ -1027,7 +1027,7 @@ pub const CObject = struct { |
| 1027 | 1027 | .FixIt => {}, |
| 1028 | 1028 | _ => {}, |
| 1029 | 1029 | }, |
| 1030 | .end_block => |block| switch (@as(BlockId, @enumFromInt(block.id))) { | |
| 1030 | .end_block => |block| switch (@as(BlockId, @fromBackingInt(@intCast(block.id)))) { | |
| 1031 | 1031 | .Meta => {}, |
| 1032 | 1032 | .Diag => { |
| 1033 | 1033 | try stack.items[stack.items.len - 2].sub_diags.ensureUnusedCapacity(gpa, 1); |
| ... | ... | @@ -2401,26 +2401,26 @@ pub fn create(gpa: Allocator, arena: Allocator, io: Io, diag: *CreateDiagnostic, |
| 2401 | 2401 | if (!std.zig.target.canBuildLibC(target)) return diag.fail(.cross_libc_unavailable); |
| 2402 | 2402 | |
| 2403 | 2403 | if (musl.needsCrt0(comp.config.output_mode, comp.config.link_mode, comp.config.pie)) |f| { |
| 2404 | comp.queued_jobs.musl_crt_file[@intFromEnum(f)] = true; | |
| 2404 | comp.queued_jobs.musl_crt_file[@backingInt(f)] = true; | |
| 2405 | 2405 | } |
| 2406 | 2406 | switch (comp.config.link_mode) { |
| 2407 | .static => comp.queued_jobs.musl_crt_file[@intFromEnum(musl.CrtFile.libc_a)] = true, | |
| 2408 | .dynamic => comp.queued_jobs.musl_crt_file[@intFromEnum(musl.CrtFile.libc_so)] = true, | |
| 2407 | .static => comp.queued_jobs.musl_crt_file[@backingInt(musl.CrtFile.libc_a)] = true, | |
| 2408 | .dynamic => comp.queued_jobs.musl_crt_file[@backingInt(musl.CrtFile.libc_so)] = true, | |
| 2409 | 2409 | } |
| 2410 | 2410 | } else if (target.isGnuLibC()) { |
| 2411 | 2411 | if (!std.zig.target.canBuildLibC(target)) return diag.fail(.cross_libc_unavailable); |
| 2412 | 2412 | |
| 2413 | 2413 | if (glibc.needsCrt0(comp.config.output_mode)) |f| { |
| 2414 | comp.queued_jobs.glibc_crt_file[@intFromEnum(f)] = true; | |
| 2414 | comp.queued_jobs.glibc_crt_file[@backingInt(f)] = true; | |
| 2415 | 2415 | } |
| 2416 | 2416 | comp.queued_jobs.glibc_shared_objects = true; |
| 2417 | 2417 | |
| 2418 | comp.queued_jobs.glibc_crt_file[@intFromEnum(glibc.CrtFile.libc_nonshared_a)] = true; | |
| 2418 | comp.queued_jobs.glibc_crt_file[@backingInt(glibc.CrtFile.libc_nonshared_a)] = true; | |
| 2419 | 2419 | } else if (target.isFreeBSDLibC()) { |
| 2420 | 2420 | if (!std.zig.target.canBuildLibC(target)) return diag.fail(.cross_libc_unavailable); |
| 2421 | 2421 | |
| 2422 | 2422 | if (freebsd.needsCrt0(comp.config.output_mode)) |f| { |
| 2423 | comp.queued_jobs.freebsd_crt_file[@intFromEnum(f)] = true; | |
| 2423 | comp.queued_jobs.freebsd_crt_file[@backingInt(f)] = true; | |
| 2424 | 2424 | } |
| 2425 | 2425 | |
| 2426 | 2426 | comp.queued_jobs.freebsd_shared_objects = true; |
| ... | ... | @@ -2428,7 +2428,7 @@ pub fn create(gpa: Allocator, arena: Allocator, io: Io, diag: *CreateDiagnostic, |
| 2428 | 2428 | if (!std.zig.target.canBuildLibC(target)) return diag.fail(.cross_libc_unavailable); |
| 2429 | 2429 | |
| 2430 | 2430 | if (netbsd.needsCrt0(comp.config.output_mode)) |f| { |
| 2431 | comp.queued_jobs.netbsd_crt_file[@intFromEnum(f)] = true; | |
| 2431 | comp.queued_jobs.netbsd_crt_file[@backingInt(f)] = true; | |
| 2432 | 2432 | } |
| 2433 | 2433 | |
| 2434 | 2434 | comp.queued_jobs.netbsd_shared_objects = true; |
| ... | ... | @@ -2436,21 +2436,21 @@ pub fn create(gpa: Allocator, arena: Allocator, io: Io, diag: *CreateDiagnostic, |
| 2436 | 2436 | if (!std.zig.target.canBuildLibC(target)) return diag.fail(.cross_libc_unavailable); |
| 2437 | 2437 | |
| 2438 | 2438 | if (openbsd.needsCrt0(comp.config.output_mode)) |f| { |
| 2439 | comp.queued_jobs.openbsd_crt_file[@intFromEnum(f)] = true; | |
| 2439 | comp.queued_jobs.openbsd_crt_file[@backingInt(f)] = true; | |
| 2440 | 2440 | } |
| 2441 | 2441 | |
| 2442 | 2442 | comp.queued_jobs.openbsd_shared_objects = true; |
| 2443 | 2443 | } else if (target.isWasiLibC()) { |
| 2444 | 2444 | if (!std.zig.target.canBuildLibC(target)) return diag.fail(.cross_libc_unavailable); |
| 2445 | 2445 | |
| 2446 | comp.queued_jobs.wasi_libc_crt_file[@intFromEnum(wasi_libc.execModelCrtFile(comp.config.wasi_exec_model))] = true; | |
| 2447 | comp.queued_jobs.wasi_libc_crt_file[@intFromEnum(wasi_libc.CrtFile.libc_a)] = true; | |
| 2446 | comp.queued_jobs.wasi_libc_crt_file[@backingInt(wasi_libc.execModelCrtFile(comp.config.wasi_exec_model))] = true; | |
| 2447 | comp.queued_jobs.wasi_libc_crt_file[@backingInt(wasi_libc.CrtFile.libc_a)] = true; | |
| 2448 | 2448 | } else if (target.isMinGW()) { |
| 2449 | 2449 | if (!std.zig.target.canBuildLibC(target)) return diag.fail(.cross_libc_unavailable); |
| 2450 | 2450 | |
| 2451 | 2451 | const main_crt_file: mingw.CrtFile = if (is_dyn_lib) .dllcrt2_o else .crt2_o; |
| 2452 | comp.queued_jobs.mingw_crt_file[@intFromEnum(main_crt_file)] = true; | |
| 2453 | comp.queued_jobs.mingw_crt_file[@intFromEnum(mingw.CrtFile.libmingw32_lib)] = true; | |
| 2452 | comp.queued_jobs.mingw_crt_file[@backingInt(main_crt_file)] = true; | |
| 2453 | comp.queued_jobs.mingw_crt_file[@backingInt(mingw.CrtFile.libmingw32_lib)] = true; | |
| 2454 | 2454 | |
| 2455 | 2455 | // When linking mingw-w64 there are some import libs we always need. |
| 2456 | 2456 | try comp.windows_libs.ensureUnusedCapacity(gpa, mingw.always_link_libs.len); |
| ... | ... | @@ -3783,7 +3783,7 @@ pub fn getAllErrorsAlloc(comp: *Compilation) error{OutOfMemory}!ErrorBundle { |
| 3783 | 3783 | }); |
| 3784 | 3784 | const notes_start = try bundle.reserveNotes(notes_len); |
| 3785 | 3785 | for (notes_start.., lld_error.context_lines) |note, context_line| { |
| 3786 | bundle.extra.items[note] = @intFromEnum(bundle.addErrorMessageAssumeCapacity(.{ | |
| 3786 | bundle.extra.items[note] = @backingInt(bundle.addErrorMessageAssumeCapacity(.{ | |
| 3787 | 3787 | .msg = try bundle.addString(context_line), |
| 3788 | 3788 | })); |
| 3789 | 3789 | } |
| ... | ... | @@ -3845,7 +3845,7 @@ pub fn getAllErrorsAlloc(comp: *Compilation) error{OutOfMemory}!ErrorBundle { |
| 3845 | 3845 | pub fn lessThan(ctx: @This(), lhs_index: usize, rhs_index: usize) bool { |
| 3846 | 3846 | const lhs_path = ctx.zcu.fileByIndex(ctx.failed_files_keys[lhs_index]).path; |
| 3847 | 3847 | const rhs_path = ctx.zcu.fileByIndex(ctx.failed_files_keys[rhs_index]).path; |
| 3848 | if (lhs_path.root != rhs_path.root) return @intFromEnum(lhs_path.root) < @intFromEnum(rhs_path.root); | |
| 3848 | if (lhs_path.root != rhs_path.root) return @backingInt(lhs_path.root) < @backingInt(rhs_path.root); | |
| 3849 | 3849 | return std.mem.order(u8, lhs_path.sub_path, rhs_path.sub_path).compare(.lt); |
| 3850 | 3850 | } |
| 3851 | 3851 | }; |
| ... | ... | @@ -3946,7 +3946,7 @@ pub fn getAllErrorsAlloc(comp: *Compilation) error{OutOfMemory}!ErrorBundle { |
| 3946 | 3946 | .notes_len = 1, |
| 3947 | 3947 | }); |
| 3948 | 3948 | const notes_start = try bundle.reserveNotes(1); |
| 3949 | bundle.extra.items[notes_start] = @intFromEnum(bundle.addErrorMessageAssumeCapacity(.{ | |
| 3949 | bundle.extra.items[notes_start] = @backingInt(bundle.addErrorMessageAssumeCapacity(.{ | |
| 3950 | 3950 | .msg = try bundle.printString("use '--error-limit {d}' to increase limit", .{ |
| 3951 | 3951 | actual_error_count, |
| 3952 | 3952 | }), |
| ... | ... | @@ -3968,10 +3968,10 @@ pub fn getAllErrorsAlloc(comp: *Compilation) error{OutOfMemory}!ErrorBundle { |
| 3968 | 3968 | .notes_len = 2, |
| 3969 | 3969 | }); |
| 3970 | 3970 | const notes_start = try bundle.reserveNotes(2); |
| 3971 | bundle.extra.items[notes_start + 0] = @intFromEnum(bundle.addErrorMessageAssumeCapacity(.{ | |
| 3971 | bundle.extra.items[notes_start + 0] = @backingInt(bundle.addErrorMessageAssumeCapacity(.{ | |
| 3972 | 3972 | .msg = try bundle.addString("run 'zig libc -h' to learn about libc installations"), |
| 3973 | 3973 | })); |
| 3974 | bundle.extra.items[notes_start + 1] = @intFromEnum(bundle.addErrorMessageAssumeCapacity(.{ | |
| 3974 | bundle.extra.items[notes_start + 1] = @backingInt(bundle.addErrorMessageAssumeCapacity(.{ | |
| 3975 | 3975 | .msg = try bundle.addString("run 'zig targets' to see the targets for which zig can always provide libc"), |
| 3976 | 3976 | })); |
| 3977 | 3977 | } |
| ... | ... | @@ -4227,7 +4227,7 @@ pub fn addModuleErrorMsg( |
| 4227 | 4227 | const notes_start = try eb.reserveNotes(notes_len); |
| 4228 | 4228 | |
| 4229 | 4229 | for (notes_start.., notes.keys()) |i, note| { |
| 4230 | eb.extra.items[i] = @intFromEnum(eb.addErrorMessageAssumeCapacity(note)); | |
| 4230 | eb.extra.items[i] = @backingInt(eb.addErrorMessageAssumeCapacity(note)); | |
| 4231 | 4231 | } |
| 4232 | 4232 | } |
| 4233 | 4233 | |
| ... | ... | @@ -4260,7 +4260,7 @@ fn addWholeFileError( |
| 4260 | 4260 | }); |
| 4261 | 4261 | if (imported_note) |n| { |
| 4262 | 4262 | const note_idx = try eb.reserveNotes(1); |
| 4263 | eb.extra.items[note_idx] = @intFromEnum(n); | |
| 4263 | eb.extra.items[note_idx] = @backingInt(n); | |
| 4264 | 4264 | } |
| 4265 | 4265 | } |
| 4266 | 4266 | |
| ... | ... | @@ -4483,49 +4483,49 @@ fn dispatchPrelinkWork(comp: *Compilation, main_progress_node: std.Progress.Node |
| 4483 | 4483 | |
| 4484 | 4484 | for (0..@typeInfo(musl.CrtFile).@"enum".field_names.len) |i| { |
| 4485 | 4485 | if (comp.queued_jobs.musl_crt_file[i]) { |
| 4486 | const tag: musl.CrtFile = @enumFromInt(i); | |
| 4486 | const tag: musl.CrtFile = @fromBackingInt(@intCast(i)); | |
| 4487 | 4487 | prelink_group.async(io, buildMuslCrtFile, .{ comp, tag, main_progress_node }); |
| 4488 | 4488 | } |
| 4489 | 4489 | } |
| 4490 | 4490 | |
| 4491 | 4491 | for (0..@typeInfo(glibc.CrtFile).@"enum".field_names.len) |i| { |
| 4492 | 4492 | if (comp.queued_jobs.glibc_crt_file[i]) { |
| 4493 | const tag: glibc.CrtFile = @enumFromInt(i); | |
| 4493 | const tag: glibc.CrtFile = @fromBackingInt(@intCast(i)); | |
| 4494 | 4494 | prelink_group.async(io, buildGlibcCrtFile, .{ comp, tag, main_progress_node }); |
| 4495 | 4495 | } |
| 4496 | 4496 | } |
| 4497 | 4497 | |
| 4498 | 4498 | for (0..@typeInfo(freebsd.CrtFile).@"enum".field_names.len) |i| { |
| 4499 | 4499 | if (comp.queued_jobs.freebsd_crt_file[i]) { |
| 4500 | const tag: freebsd.CrtFile = @enumFromInt(i); | |
| 4500 | const tag: freebsd.CrtFile = @fromBackingInt(@intCast(i)); | |
| 4501 | 4501 | prelink_group.async(io, buildFreeBSDCrtFile, .{ comp, tag, main_progress_node }); |
| 4502 | 4502 | } |
| 4503 | 4503 | } |
| 4504 | 4504 | |
| 4505 | 4505 | for (0..@typeInfo(netbsd.CrtFile).@"enum".field_names.len) |i| { |
| 4506 | 4506 | if (comp.queued_jobs.netbsd_crt_file[i]) { |
| 4507 | const tag: netbsd.CrtFile = @enumFromInt(i); | |
| 4507 | const tag: netbsd.CrtFile = @fromBackingInt(@intCast(i)); | |
| 4508 | 4508 | prelink_group.async(io, buildNetBSDCrtFile, .{ comp, tag, main_progress_node }); |
| 4509 | 4509 | } |
| 4510 | 4510 | } |
| 4511 | 4511 | |
| 4512 | 4512 | for (0..@typeInfo(openbsd.CrtFile).@"enum".field_names.len) |i| { |
| 4513 | 4513 | if (comp.queued_jobs.openbsd_crt_file[i]) { |
| 4514 | const tag: openbsd.CrtFile = @enumFromInt(i); | |
| 4514 | const tag: openbsd.CrtFile = @fromBackingInt(@intCast(i)); | |
| 4515 | 4515 | prelink_group.async(io, buildOpenBSDCrtFile, .{ comp, tag, main_progress_node }); |
| 4516 | 4516 | } |
| 4517 | 4517 | } |
| 4518 | 4518 | |
| 4519 | 4519 | for (0..@typeInfo(wasi_libc.CrtFile).@"enum".field_names.len) |i| { |
| 4520 | 4520 | if (comp.queued_jobs.wasi_libc_crt_file[i]) { |
| 4521 | const tag: wasi_libc.CrtFile = @enumFromInt(i); | |
| 4521 | const tag: wasi_libc.CrtFile = @fromBackingInt(@intCast(i)); | |
| 4522 | 4522 | prelink_group.async(io, buildWasiLibcCrtFile, .{ comp, tag, main_progress_node }); |
| 4523 | 4523 | } |
| 4524 | 4524 | } |
| 4525 | 4525 | |
| 4526 | 4526 | for (0..@typeInfo(mingw.CrtFile).@"enum".field_names.len) |i| { |
| 4527 | 4527 | if (comp.queued_jobs.mingw_crt_file[i]) { |
| 4528 | const tag: mingw.CrtFile = @enumFromInt(i); | |
| 4528 | const tag: mingw.CrtFile = @fromBackingInt(@intCast(i)); | |
| 4529 | 4529 | prelink_group.async(io, buildMingwCrtFile, .{ comp, tag, main_progress_node }); |
| 4530 | 4530 | } |
| 4531 | 4531 | } |
| ... | ... | @@ -5127,7 +5127,7 @@ fn buildRt( |
| 5127 | 5127 | |
| 5128 | 5128 | fn buildMuslCrtFile(comp: *Compilation, crt_file: musl.CrtFile, prog_node: std.Progress.Node) void { |
| 5129 | 5129 | if (musl.buildCrtFile(comp, crt_file, prog_node)) |_| { |
| 5130 | comp.queued_jobs.musl_crt_file[@intFromEnum(crt_file)] = false; | |
| 5130 | comp.queued_jobs.musl_crt_file[@backingInt(crt_file)] = false; | |
| 5131 | 5131 | } else |err| switch (err) { |
| 5132 | 5132 | error.AlreadyReported => return, |
| 5133 | 5133 | else => comp.lockAndSetMiscFailure(.musl_crt_file, "unable to build musl {s}: {s}", .{ |
| ... | ... | @@ -5138,7 +5138,7 @@ fn buildMuslCrtFile(comp: *Compilation, crt_file: musl.CrtFile, prog_node: std.P |
| 5138 | 5138 | |
| 5139 | 5139 | fn buildGlibcCrtFile(comp: *Compilation, crt_file: glibc.CrtFile, prog_node: std.Progress.Node) void { |
| 5140 | 5140 | if (glibc.buildCrtFile(comp, crt_file, prog_node)) |_| { |
| 5141 | comp.queued_jobs.glibc_crt_file[@intFromEnum(crt_file)] = false; | |
| 5141 | comp.queued_jobs.glibc_crt_file[@backingInt(crt_file)] = false; | |
| 5142 | 5142 | } else |err| switch (err) { |
| 5143 | 5143 | error.AlreadyReported => return, |
| 5144 | 5144 | else => comp.lockAndSetMiscFailure(.glibc_crt_file, "unable to build glibc {s}: {s}", .{ |
| ... | ... | @@ -5159,7 +5159,7 @@ fn buildGlibcSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) voi |
| 5159 | 5159 | |
| 5160 | 5160 | fn buildFreeBSDCrtFile(comp: *Compilation, crt_file: freebsd.CrtFile, prog_node: std.Progress.Node) void { |
| 5161 | 5161 | if (freebsd.buildCrtFile(comp, crt_file, prog_node)) |_| { |
| 5162 | comp.queued_jobs.freebsd_crt_file[@intFromEnum(crt_file)] = false; | |
| 5162 | comp.queued_jobs.freebsd_crt_file[@backingInt(crt_file)] = false; | |
| 5163 | 5163 | } else |err| switch (err) { |
| 5164 | 5164 | error.AlreadyReported => return, |
| 5165 | 5165 | else => comp.lockAndSetMiscFailure(.freebsd_crt_file, "unable to build FreeBSD {s}: {s}", .{ |
| ... | ... | @@ -5182,7 +5182,7 @@ fn buildFreeBSDSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) v |
| 5182 | 5182 | |
| 5183 | 5183 | fn buildNetBSDCrtFile(comp: *Compilation, crt_file: netbsd.CrtFile, prog_node: std.Progress.Node) void { |
| 5184 | 5184 | if (netbsd.buildCrtFile(comp, crt_file, prog_node)) |_| { |
| 5185 | comp.queued_jobs.netbsd_crt_file[@intFromEnum(crt_file)] = false; | |
| 5185 | comp.queued_jobs.netbsd_crt_file[@backingInt(crt_file)] = false; | |
| 5186 | 5186 | } else |err| switch (err) { |
| 5187 | 5187 | error.AlreadyReported => return, |
| 5188 | 5188 | else => comp.lockAndSetMiscFailure(.netbsd_crt_file, "unable to build NetBSD {s}: {s}", .{ |
| ... | ... | @@ -5205,7 +5205,7 @@ fn buildNetBSDSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) vo |
| 5205 | 5205 | |
| 5206 | 5206 | fn buildOpenBSDCrtFile(comp: *Compilation, crt_file: openbsd.CrtFile, prog_node: std.Progress.Node) void { |
| 5207 | 5207 | if (openbsd.buildCrtFile(comp, crt_file, prog_node)) |_| { |
| 5208 | comp.queued_jobs.openbsd_crt_file[@intFromEnum(crt_file)] = false; | |
| 5208 | comp.queued_jobs.openbsd_crt_file[@backingInt(crt_file)] = false; | |
| 5209 | 5209 | } else |err| switch (err) { |
| 5210 | 5210 | error.AlreadyReported => return, |
| 5211 | 5211 | else => comp.lockAndSetMiscFailure(.openbsd_crt_file, "unable to build OpenBSD {s}: {s}", .{ |
| ... | ... | @@ -5228,7 +5228,7 @@ fn buildOpenBSDSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) v |
| 5228 | 5228 | |
| 5229 | 5229 | fn buildMingwCrtFile(comp: *Compilation, crt_file: mingw.CrtFile, prog_node: std.Progress.Node) void { |
| 5230 | 5230 | if (mingw.buildCrtFile(comp, crt_file, prog_node)) |_| { |
| 5231 | comp.queued_jobs.mingw_crt_file[@intFromEnum(crt_file)] = false; | |
| 5231 | comp.queued_jobs.mingw_crt_file[@backingInt(crt_file)] = false; | |
| 5232 | 5232 | } else |err| switch (err) { |
| 5233 | 5233 | error.AlreadyReported => return, |
| 5234 | 5234 | else => comp.lockAndSetMiscFailure(.mingw_crt_file, "unable to build mingw-w64 {s}: {s}", .{ |
| ... | ... | @@ -5272,7 +5272,7 @@ fn buildMingwImportLib(comp: *Compilation, lib_name: []const u8, is_prelink: boo |
| 5272 | 5272 | |
| 5273 | 5273 | fn buildWasiLibcCrtFile(comp: *Compilation, crt_file: wasi_libc.CrtFile, prog_node: std.Progress.Node) void { |
| 5274 | 5274 | if (wasi_libc.buildCrtFile(comp, crt_file, prog_node)) |_| { |
| 5275 | comp.queued_jobs.wasi_libc_crt_file[@intFromEnum(crt_file)] = false; | |
| 5275 | comp.queued_jobs.wasi_libc_crt_file[@backingInt(crt_file)] = false; | |
| 5276 | 5276 | } else |err| switch (err) { |
| 5277 | 5277 | error.AlreadyReported => return, |
| 5278 | 5278 | else => comp.lockAndSetMiscFailure(.wasi_libc_crt_file, "unable to build WASI libc {s}: {s}", .{ |
| ... | ... | @@ -6213,7 +6213,7 @@ fn addCommonCCArgs( |
| 6213 | 6213 | } else if (target.isMinGW()) { |
| 6214 | 6214 | try argv.append("-D__MSVCRT_VERSION__=0xE00"); // use ucrt |
| 6215 | 6215 | |
| 6216 | const minver: u16 = @truncate(@intFromEnum(target.os.versionRange().windows.min) >> 16); | |
| 6216 | const minver: u16 = @truncate(@backingInt(target.os.versionRange().windows.min) >> 16); | |
| 6217 | 6217 | try argv.append( |
| 6218 | 6218 | try std.fmt.allocPrint(arena, "-D_WIN32_WINNT=0x{x:0>4}", .{minver}), |
| 6219 | 6219 | ); |
src/IncrementalDebugServer.zig+19-19| ... | ... | @@ -208,7 +208,7 @@ fn handleCommand(zcu: *Zcu, w: *Io.Writer, cmd_str: []const u8, arg_str: []const |
| 208 | 208 | zcu.incremental_debug_state.units.count(), |
| 209 | 209 | }); |
| 210 | 210 | } else if (std.mem.eql(u8, cmd_str, "nav_info")) { |
| 211 | const nav_index: InternPool.Nav.Index = @enumFromInt(parseIndex(arg_str) orelse return w.writeAll("malformed nav index")); | |
| 211 | const nav_index: InternPool.Nav.Index = @fromBackingInt(@intCast(parseIndex(arg_str) orelse return w.writeAll("malformed nav index"))); | |
| 212 | 212 | const create_gen = zcu.incremental_debug_state.navs.get(nav_index) orelse return w.writeAll("unknown nav index"); |
| 213 | 213 | const nav = ip.getNav(nav_index); |
| 214 | 214 | try w.print( |
| ... | ... | @@ -251,7 +251,7 @@ fn handleCommand(zcu: *Zcu, w: *Io.Writer, cmd_str: []const u8, arg_str: []const |
| 251 | 251 | }; |
| 252 | 252 | if (success) { |
| 253 | 253 | num_results += 1; |
| 254 | try w.print("* type {d} ('{s}')\n", .{ @intFromEnum(type_ip_index), ty_name }); | |
| 254 | try w.print("* type {d} ('{s}')\n", .{ @backingInt(type_ip_index), ty_name }); | |
| 255 | 255 | } |
| 256 | 256 | } |
| 257 | 257 | try w.print("Found {d} results\n", .{num_results}); |
| ... | ... | @@ -272,7 +272,7 @@ fn handleCommand(zcu: *Zcu, w: *Io.Writer, cmd_str: []const u8, arg_str: []const |
| 272 | 272 | }; |
| 273 | 273 | if (success) { |
| 274 | 274 | num_results += 1; |
| 275 | try w.print("* nav {d} ('{s}')\n", .{ @intFromEnum(nav_index), nav_fqn }); | |
| 275 | try w.print("* nav {d} ('{s}')\n", .{ @backingInt(nav_index), nav_fqn }); | |
| 276 | 276 | } |
| 277 | 277 | } |
| 278 | 278 | try w.print("Found {d} results\n", .{num_results}); |
| ... | ... | @@ -308,8 +308,8 @@ fn handleCommand(zcu: *Zcu, w: *Io.Writer, cmd_str: []const u8, arg_str: []const |
| 308 | 308 | try w.print("[{d}] ", .{i}); |
| 309 | 309 | switch (dependee) { |
| 310 | 310 | .src_hash, .namespace, .namespace_name, .source_file, .embed_file => try w.print("{f}", .{zcu.fmtDependee(dependee)}), |
| 311 | .nav_val, .nav_ty => |nav| try w.print("{t} {d}", .{ dependee, @intFromEnum(nav) }), | |
| 312 | .type_layout, .struct_defaults, .func_ies => |ip_index| try w.print("{t} {d}", .{ dependee, @intFromEnum(ip_index) }), | |
| 311 | .nav_val, .nav_ty => |nav| try w.print("{t} {d}", .{ dependee, @backingInt(nav) }), | |
| 312 | .type_layout, .struct_defaults, .func_ies => |ip_index| try w.print("{t} {d}", .{ dependee, @backingInt(ip_index) }), | |
| 313 | 313 | .memoized_state => |stage| try w.print("memoized_state {s}", .{@tagName(stage)}), |
| 314 | 314 | } |
| 315 | 315 | try w.writeByte('\n'); |
| ... | ... | @@ -326,7 +326,7 @@ fn handleCommand(zcu: *Zcu, w: *Io.Writer, cmd_str: []const u8, arg_str: []const |
| 326 | 326 | opt_cur = if (refs.get(cur).?) |ref| ref.referencer else null; |
| 327 | 327 | } |
| 328 | 328 | } else if (std.mem.eql(u8, cmd_str, "type_info")) { |
| 329 | const ip_index: InternPool.Index = @enumFromInt(parseIndex(arg_str) orelse return w.writeAll("malformed ip index")); | |
| 329 | const ip_index: InternPool.Index = @fromBackingInt(@intCast(parseIndex(arg_str) orelse return w.writeAll("malformed ip index"))); | |
| 330 | 330 | const create_gen = zcu.incremental_debug_state.types.get(ip_index) orelse return w.writeAll("unknown type"); |
| 331 | 331 | try w.print( |
| 332 | 332 | \\name: '{f}' |
| ... | ... | @@ -337,24 +337,24 @@ fn handleCommand(zcu: *Zcu, w: *Io.Writer, cmd_str: []const u8, arg_str: []const |
| 337 | 337 | create_gen, |
| 338 | 338 | }); |
| 339 | 339 | } else if (std.mem.eql(u8, cmd_str, "type_namespace")) { |
| 340 | const ip_index: InternPool.Index = @enumFromInt(parseIndex(arg_str) orelse return w.writeAll("malformed ip index")); | |
| 340 | const ip_index: InternPool.Index = @fromBackingInt(@intCast(parseIndex(arg_str) orelse return w.writeAll("malformed ip index"))); | |
| 341 | 341 | if (!zcu.incremental_debug_state.types.contains(ip_index)) return w.writeAll("unknown type"); |
| 342 | 342 | const ns = zcu.namespacePtr(Type.fromInterned(ip_index).getNamespaceIndex(zcu)); |
| 343 | 343 | try w.print("{d} pub decls:\n", .{ns.pub_decls.count()}); |
| 344 | 344 | for (ns.pub_decls.keys()) |nav| { |
| 345 | try w.print("* nav {d}\n", .{@intFromEnum(nav)}); | |
| 345 | try w.print("* nav {d}\n", .{@backingInt(nav)}); | |
| 346 | 346 | } |
| 347 | 347 | try w.print("{d} non-pub decls:\n", .{ns.priv_decls.count()}); |
| 348 | 348 | for (ns.priv_decls.keys()) |nav| { |
| 349 | try w.print("* nav {d}\n", .{@intFromEnum(nav)}); | |
| 349 | try w.print("* nav {d}\n", .{@backingInt(nav)}); | |
| 350 | 350 | } |
| 351 | 351 | try w.print("{d} comptime decls:\n", .{ns.comptime_decls.items.len}); |
| 352 | 352 | for (ns.comptime_decls.items) |id| { |
| 353 | try w.print("* comptime {d}\n", .{@intFromEnum(id)}); | |
| 353 | try w.print("* comptime {d}\n", .{@backingInt(id)}); | |
| 354 | 354 | } |
| 355 | 355 | try w.print("{d} tests:\n", .{ns.test_decls.items.len}); |
| 356 | 356 | for (ns.test_decls.items) |nav| { |
| 357 | try w.print("* nav {d}\n", .{@intFromEnum(nav)}); | |
| 357 | try w.print("* nav {d}\n", .{@backingInt(nav)}); | |
| 358 | 358 | } |
| 359 | 359 | } else { |
| 360 | 360 | try w.writeAll("command not found; run 'help' for a command list"); |
| ... | ... | @@ -369,17 +369,17 @@ fn parseAnalUnit(str: []const u8) ?AnalUnit { |
| 369 | 369 | const kind = str[0..split_idx]; |
| 370 | 370 | const idx_str = str[split_idx + 1 ..]; |
| 371 | 371 | if (std.mem.eql(u8, kind, "comptime")) { |
| 372 | return .wrap(.{ .@"comptime" = @enumFromInt(parseIndex(idx_str) orelse return null) }); | |
| 372 | return .wrap(.{ .@"comptime" = @fromBackingInt(@intCast(parseIndex(idx_str) orelse return null)) }); | |
| 373 | 373 | } else if (std.mem.eql(u8, kind, "nav_val")) { |
| 374 | return .wrap(.{ .nav_val = @enumFromInt(parseIndex(idx_str) orelse return null) }); | |
| 374 | return .wrap(.{ .nav_val = @fromBackingInt(@intCast(parseIndex(idx_str) orelse return null)) }); | |
| 375 | 375 | } else if (std.mem.eql(u8, kind, "nav_ty")) { |
| 376 | return .wrap(.{ .nav_ty = @enumFromInt(parseIndex(idx_str) orelse return null) }); | |
| 376 | return .wrap(.{ .nav_ty = @fromBackingInt(@intCast(parseIndex(idx_str) orelse return null)) }); | |
| 377 | 377 | } else if (std.mem.eql(u8, kind, "type_layout")) { |
| 378 | return .wrap(.{ .type_layout = @enumFromInt(parseIndex(idx_str) orelse return null) }); | |
| 378 | return .wrap(.{ .type_layout = @fromBackingInt(@intCast(parseIndex(idx_str) orelse return null)) }); | |
| 379 | 379 | } else if (std.mem.eql(u8, kind, "struct_defaults")) { |
| 380 | return .wrap(.{ .struct_defaults = @enumFromInt(parseIndex(idx_str) orelse return null) }); | |
| 380 | return .wrap(.{ .struct_defaults = @fromBackingInt(@intCast(parseIndex(idx_str) orelse return null)) }); | |
| 381 | 381 | } else if (std.mem.eql(u8, kind, "func")) { |
| 382 | return .wrap(.{ .func = @enumFromInt(parseIndex(idx_str) orelse return null) }); | |
| 382 | return .wrap(.{ .func = @fromBackingInt(@intCast(parseIndex(idx_str) orelse return null)) }); | |
| 383 | 383 | } else if (std.mem.eql(u8, kind, "memoized_state")) { |
| 384 | 384 | return .wrap(.{ .memoized_state = std.meta.stringToEnum( |
| 385 | 385 | InternPool.MemoizedStateStage, |
| ... | ... | @@ -392,7 +392,7 @@ fn parseAnalUnit(str: []const u8) ?AnalUnit { |
| 392 | 392 | fn printAnalUnit(unit: AnalUnit, buf: *[32]u8) []const u8 { |
| 393 | 393 | const idx: u32 = switch (unit.unwrap()) { |
| 394 | 394 | .memoized_state => |stage| return std.fmt.bufPrint(buf, "memoized_state {s}", .{@tagName(stage)}) catch unreachable, |
| 395 | inline else => |i| @intFromEnum(i), | |
| 395 | inline else => |i| @backingInt(i), | |
| 396 | 396 | }; |
| 397 | 397 | return std.fmt.bufPrint(buf, "{s} {d}", .{ @tagName(unit.unwrap()), idx }) catch unreachable; |
| 398 | 398 | } |
| ... | ... | @@ -437,7 +437,7 @@ fn printType(ty: Type, zcu: *const Zcu, w: *Io.Writer) Io.Writer.Error!void { |
| 437 | 437 | .union_type, |
| 438 | 438 | .enum_type, |
| 439 | 439 | .opaque_type, |
| 440 | => try w.print("{f}[{d}]", .{ ty.containerTypeName(ip).fmt(ip), @intFromEnum(ty.toIntern()) }), | |
| 440 | => try w.print("{f}[{d}]", .{ ty.containerTypeName(ip).fmt(ip), @backingInt(ty.toIntern()) }), | |
| 441 | 441 | |
| 442 | 442 | else => unreachable, |
| 443 | 443 | } |
src/InternPool.zig+319-319| ... | ... | @@ -152,11 +152,11 @@ pub const TrackedInst = extern struct { |
| 152 | 152 | pub fn unwrap(inst: ZirIndex) ?Zir.Inst.Index { |
| 153 | 153 | return switch (inst) { |
| 154 | 154 | .lost => null, |
| 155 | _ => @enumFromInt(@intFromEnum(inst)), | |
| 155 | _ => @fromBackingInt(@intCast(@backingInt(inst))), | |
| 156 | 156 | }; |
| 157 | 157 | } |
| 158 | 158 | pub fn wrap(inst: Zir.Inst.Index) ZirIndex { |
| 159 | return @enumFromInt(@intFromEnum(inst)); | |
| 159 | return @fromBackingInt(@intCast(@backingInt(inst))); | |
| 160 | 160 | } |
| 161 | 161 | }; |
| 162 | 162 | comptime { |
| ... | ... | @@ -187,7 +187,7 @@ pub const TrackedInst = extern struct { |
| 187 | 187 | } |
| 188 | 188 | |
| 189 | 189 | pub fn toOptional(i: TrackedInst.Index) Optional { |
| 190 | return @enumFromInt(@intFromEnum(i)); | |
| 190 | return @fromBackingInt(@intCast(@backingInt(i))); | |
| 191 | 191 | } |
| 192 | 192 | pub const Optional = enum(u32) { |
| 193 | 193 | none = std.math.maxInt(u32), |
| ... | ... | @@ -195,7 +195,7 @@ pub const TrackedInst = extern struct { |
| 195 | 195 | pub fn unwrap(opt: Optional) ?TrackedInst.Index { |
| 196 | 196 | return switch (opt) { |
| 197 | 197 | .none => null, |
| 198 | _ => @enumFromInt(@intFromEnum(opt)), | |
| 198 | _ => @fromBackingInt(@intCast(@backingInt(opt))), | |
| 199 | 199 | }; |
| 200 | 200 | } |
| 201 | 201 | |
| ... | ... | @@ -207,16 +207,16 @@ pub const TrackedInst = extern struct { |
| 207 | 207 | index: u32, |
| 208 | 208 | |
| 209 | 209 | pub fn wrap(unwrapped: Unwrapped, ip: *const InternPool) TrackedInst.Index { |
| 210 | assert(@intFromEnum(unwrapped.tid) <= ip.getTidMask()); | |
| 210 | assert(@backingInt(unwrapped.tid) <= ip.getTidMask()); | |
| 211 | 211 | assert(unwrapped.index <= ip.getIndexMask(u32)); |
| 212 | return @enumFromInt(@shlExact(@as(u32, @intFromEnum(unwrapped.tid)), ip.tid_shift_32) | | |
| 213 | unwrapped.index); | |
| 212 | return @fromBackingInt(@intCast(@shlExact(@as(u32, @backingInt(unwrapped.tid)), ip.tid_shift_32) | | |
| 213 | unwrapped.index)); | |
| 214 | 214 | } |
| 215 | 215 | }; |
| 216 | 216 | pub fn unwrap(tracked_inst_index: TrackedInst.Index, ip: *const InternPool) Unwrapped { |
| 217 | 217 | return .{ |
| 218 | .tid = @enumFromInt(@intFromEnum(tracked_inst_index) >> ip.tid_shift_32 & ip.getTidMask()), | |
| 219 | .index = @intFromEnum(tracked_inst_index) & ip.getIndexMask(u32), | |
| 218 | .tid = @fromBackingInt(@intCast(@backingInt(tracked_inst_index) >> ip.tid_shift_32 & ip.getTidMask())), | |
| 219 | .index = @backingInt(tracked_inst_index) & ip.getIndexMask(u32), | |
| 220 | 220 | }; |
| 221 | 221 | } |
| 222 | 222 | |
| ... | ... | @@ -408,7 +408,7 @@ pub fn rehashTrackedInsts( |
| 408 | 408 | if (entry.acquire() == .none) break entry; |
| 409 | 409 | }; |
| 410 | 410 | const index = TrackedInst.Index.Unwrapped.wrap(.{ |
| 411 | .tid = @enumFromInt(local_tid), | |
| 411 | .tid = @fromBackingInt(@intCast(local_tid)), | |
| 412 | 412 | .index = @intCast(local_inst_index), |
| 413 | 413 | }, ip); |
| 414 | 414 | entry.hash = hash; |
| ... | ... | @@ -455,7 +455,7 @@ pub const AnalUnit = packed struct(u64) { |
| 455 | 455 | inline else => |tag| @unionInit( |
| 456 | 456 | Unwrapped, |
| 457 | 457 | @tagName(tag), |
| 458 | @enumFromInt(au.id), | |
| 458 | @fromBackingInt(@intCast(au.id)), | |
| 459 | 459 | ), |
| 460 | 460 | }; |
| 461 | 461 | } |
| ... | ... | @@ -463,13 +463,13 @@ pub const AnalUnit = packed struct(u64) { |
| 463 | 463 | return switch (raw) { |
| 464 | 464 | inline else => |id, tag| .{ |
| 465 | 465 | .kind = tag, |
| 466 | .id = @intFromEnum(id), | |
| 466 | .id = @backingInt(id), | |
| 467 | 467 | }, |
| 468 | 468 | }; |
| 469 | 469 | } |
| 470 | 470 | |
| 471 | 471 | pub fn toOptional(as: AnalUnit) Optional { |
| 472 | return @enumFromInt(@as(u64, @bitCast(as))); | |
| 472 | return @fromBackingInt(@intCast(@as(u64, @bitCast(as)))); | |
| 473 | 473 | } |
| 474 | 474 | pub const Optional = enum(u64) { |
| 475 | 475 | none = std.math.maxInt(u64), |
| ... | ... | @@ -477,7 +477,7 @@ pub const AnalUnit = packed struct(u64) { |
| 477 | 477 | pub fn unwrap(opt: Optional) ?AnalUnit { |
| 478 | 478 | return switch (opt) { |
| 479 | 479 | .none => null, |
| 480 | _ => @bitCast(@intFromEnum(opt)), | |
| 480 | _ => @bitCast(@backingInt(opt)), | |
| 481 | 481 | }; |
| 482 | 482 | } |
| 483 | 483 | }; |
| ... | ... | @@ -509,16 +509,16 @@ pub const ComptimeUnit = extern struct { |
| 509 | 509 | tid: Zcu.PerThread.Id, |
| 510 | 510 | index: u32, |
| 511 | 511 | fn wrap(unwrapped: Unwrapped, ip: *const InternPool) ComptimeUnit.Id { |
| 512 | assert(@intFromEnum(unwrapped.tid) <= ip.getTidMask()); | |
| 512 | assert(@backingInt(unwrapped.tid) <= ip.getTidMask()); | |
| 513 | 513 | assert(unwrapped.index <= ip.getIndexMask(u32)); |
| 514 | return @enumFromInt(@shlExact(@as(u32, @intFromEnum(unwrapped.tid)), ip.tid_shift_32) | | |
| 515 | unwrapped.index); | |
| 514 | return @fromBackingInt(@intCast(@shlExact(@as(u32, @backingInt(unwrapped.tid)), ip.tid_shift_32) | | |
| 515 | unwrapped.index)); | |
| 516 | 516 | } |
| 517 | 517 | }; |
| 518 | 518 | fn unwrap(id: Id, ip: *const InternPool) Unwrapped { |
| 519 | 519 | return .{ |
| 520 | .tid = @enumFromInt(@intFromEnum(id) >> ip.tid_shift_32 & ip.getTidMask()), | |
| 521 | .index = @intFromEnum(id) & ip.getIndexMask(u31), | |
| 520 | .tid = @fromBackingInt(@intCast(@backingInt(id) >> ip.tid_shift_32 & ip.getTidMask())), | |
| 521 | .index = @backingInt(id) & ip.getIndexMask(u31), | |
| 522 | 522 | }; |
| 523 | 523 | } |
| 524 | 524 | |
| ... | ... | @@ -633,30 +633,30 @@ pub const Nav = struct { |
| 633 | 633 | pub fn unwrap(opt: Optional) ?Nav.Index { |
| 634 | 634 | return switch (opt) { |
| 635 | 635 | .none => null, |
| 636 | _ => @enumFromInt(@intFromEnum(opt)), | |
| 636 | _ => @fromBackingInt(@intCast(@backingInt(opt))), | |
| 637 | 637 | }; |
| 638 | 638 | } |
| 639 | 639 | |
| 640 | 640 | const debug_state = InternPool.debug_state; |
| 641 | 641 | }; |
| 642 | 642 | pub fn toOptional(i: Nav.Index) Optional { |
| 643 | return @enumFromInt(@intFromEnum(i)); | |
| 643 | return @fromBackingInt(@intCast(@backingInt(i))); | |
| 644 | 644 | } |
| 645 | 645 | const Unwrapped = struct { |
| 646 | 646 | tid: Zcu.PerThread.Id, |
| 647 | 647 | index: u32, |
| 648 | 648 | |
| 649 | 649 | fn wrap(unwrapped: Unwrapped, ip: *const InternPool) Nav.Index { |
| 650 | assert(@intFromEnum(unwrapped.tid) <= ip.getTidMask()); | |
| 650 | assert(@backingInt(unwrapped.tid) <= ip.getTidMask()); | |
| 651 | 651 | assert(unwrapped.index <= ip.getIndexMask(u30)); |
| 652 | return @enumFromInt(@shlExact(@as(u32, @intFromEnum(unwrapped.tid)), ip.tid_shift_30) | | |
| 653 | unwrapped.index); | |
| 652 | return @fromBackingInt(@intCast(@shlExact(@as(u32, @backingInt(unwrapped.tid)), ip.tid_shift_30) | | |
| 653 | unwrapped.index)); | |
| 654 | 654 | } |
| 655 | 655 | }; |
| 656 | 656 | fn unwrap(nav_index: Nav.Index, ip: *const InternPool) Unwrapped { |
| 657 | 657 | return .{ |
| 658 | .tid = @enumFromInt(@intFromEnum(nav_index) >> ip.tid_shift_30 & ip.getTidMask()), | |
| 659 | .index = @intFromEnum(nav_index) & ip.getIndexMask(u30), | |
| 658 | .tid = @fromBackingInt(@intCast(@backingInt(nav_index) >> ip.tid_shift_30 & ip.getTidMask())), | |
| 659 | .index = @backingInt(nav_index) & ip.getIndexMask(u30), | |
| 660 | 660 | }; |
| 661 | 661 | } |
| 662 | 662 | |
| ... | ... | @@ -762,19 +762,19 @@ pub fn removeDependenciesForDepender(ip: *InternPool, gpa: Allocator, depender: |
| 762 | 762 | var opt_idx = (ip.first_dependency.fetchSwapRemove(depender) orelse return).value.toOptional(); |
| 763 | 763 | |
| 764 | 764 | while (opt_idx.unwrap()) |idx| { |
| 765 | const dep = ip.dep_entries.items[@intFromEnum(idx)]; | |
| 765 | const dep = ip.dep_entries.items[@backingInt(idx)]; | |
| 766 | 766 | opt_idx = dep.next_dependee; |
| 767 | 767 | |
| 768 | 768 | const prev_idx = dep.prev.unwrap() orelse { |
| 769 | 769 | // This entry is the start of a list in some `*_deps`. |
| 770 | 770 | // We cannot easily remove this mapping, so this must remain as a dummy entry. |
| 771 | ip.dep_entries.items[@intFromEnum(idx)].depender = .none; | |
| 771 | ip.dep_entries.items[@backingInt(idx)].depender = .none; | |
| 772 | 772 | continue; |
| 773 | 773 | }; |
| 774 | 774 | |
| 775 | ip.dep_entries.items[@intFromEnum(prev_idx)].next = dep.next; | |
| 775 | ip.dep_entries.items[@backingInt(prev_idx)].next = dep.next; | |
| 776 | 776 | if (dep.next.unwrap()) |next_idx| { |
| 777 | ip.dep_entries.items[@intFromEnum(next_idx)].prev = dep.prev; | |
| 777 | ip.dep_entries.items[@backingInt(next_idx)].prev = dep.prev; | |
| 778 | 778 | } |
| 779 | 779 | |
| 780 | 780 | ip.free_dep_entries.append(gpa, idx) catch { |
| ... | ... | @@ -790,7 +790,7 @@ pub const DependencyIterator = struct { |
| 790 | 790 | pub fn next(it: *DependencyIterator) ?AnalUnit { |
| 791 | 791 | while (true) { |
| 792 | 792 | const idx = it.next_entry.unwrap() orelse return null; |
| 793 | const entry = it.ip.dep_entries.items[@intFromEnum(idx)]; | |
| 793 | const entry = it.ip.dep_entries.items[@backingInt(idx)]; | |
| 794 | 794 | it.next_entry = entry.next; |
| 795 | 795 | if (entry.depender.unwrap()) |depender| return depender; |
| 796 | 796 | } |
| ... | ... | @@ -853,7 +853,7 @@ pub fn addDependency(ip: *InternPool, gpa: Allocator, depender: AnalUnit, depend |
| 853 | 853 | }; |
| 854 | 854 | |
| 855 | 855 | if (deps.unwrap()) |first| { |
| 856 | if (ip.dep_entries.items[@intFromEnum(first)].depender == .none) { | |
| 856 | if (ip.dep_entries.items[@backingInt(first)].depender == .none) { | |
| 857 | 857 | // Dummy entry, so we can reuse it rather than allocating a new one! |
| 858 | 858 | break :new_index first; |
| 859 | 859 | } |
| ... | ... | @@ -861,11 +861,11 @@ pub fn addDependency(ip: *InternPool, gpa: Allocator, depender: AnalUnit, depend |
| 861 | 861 | |
| 862 | 862 | // Prepend a new dependency. |
| 863 | 863 | const new_index: DepEntry.Index, const ptr = if (ip.free_dep_entries.pop()) |new_index| new: { |
| 864 | break :new .{ new_index, &ip.dep_entries.items[@intFromEnum(new_index)] }; | |
| 865 | } else .{ @enumFromInt(ip.dep_entries.items.len), ip.dep_entries.addOneAssumeCapacity() }; | |
| 864 | break :new .{ new_index, &ip.dep_entries.items[@backingInt(new_index)] }; | |
| 865 | } else .{ @fromBackingInt(@intCast(ip.dep_entries.items.len)), ip.dep_entries.addOneAssumeCapacity() }; | |
| 866 | 866 | if (deps.unwrap()) |old_first| { |
| 867 | 867 | ptr.next = old_first.toOptional(); |
| 868 | ip.dep_entries.items[@intFromEnum(old_first)].prev = new_index.toOptional(); | |
| 868 | ip.dep_entries.items[@backingInt(old_first)].prev = new_index.toOptional(); | |
| 869 | 869 | } else { |
| 870 | 870 | ptr.next = .none; |
| 871 | 871 | } |
| ... | ... | @@ -887,18 +887,18 @@ pub fn addDependency(ip: *InternPool, gpa: Allocator, depender: AnalUnit, depend |
| 887 | 887 | .memoized_state => comptime unreachable, |
| 888 | 888 | }.getOrPut(gpa, dependee_payload); |
| 889 | 889 | |
| 890 | if (gop.found_existing and ip.dep_entries.items[@intFromEnum(gop.value_ptr.*)].depender == .none) { | |
| 890 | if (gop.found_existing and ip.dep_entries.items[@backingInt(gop.value_ptr.*)].depender == .none) { | |
| 891 | 891 | // Dummy entry, so we can reuse it rather than allocating a new one! |
| 892 | 892 | break :new_index gop.value_ptr.*; |
| 893 | 893 | } |
| 894 | 894 | |
| 895 | 895 | // Prepend a new dependency. |
| 896 | 896 | const new_index: DepEntry.Index, const ptr = if (ip.free_dep_entries.pop()) |new_index| new: { |
| 897 | break :new .{ new_index, &ip.dep_entries.items[@intFromEnum(new_index)] }; | |
| 898 | } else .{ @enumFromInt(ip.dep_entries.items.len), ip.dep_entries.addOneAssumeCapacity() }; | |
| 897 | break :new .{ new_index, &ip.dep_entries.items[@backingInt(new_index)] }; | |
| 898 | } else .{ @fromBackingInt(@intCast(ip.dep_entries.items.len)), ip.dep_entries.addOneAssumeCapacity() }; | |
| 899 | 899 | if (gop.found_existing) { |
| 900 | 900 | ptr.next = gop.value_ptr.*.toOptional(); |
| 901 | ip.dep_entries.items[@intFromEnum(gop.value_ptr.*)].prev = new_index.toOptional(); | |
| 901 | ip.dep_entries.items[@backingInt(gop.value_ptr.*)].prev = new_index.toOptional(); | |
| 902 | 902 | } else { |
| 903 | 903 | ptr.next = .none; |
| 904 | 904 | } |
| ... | ... | @@ -907,9 +907,9 @@ pub fn addDependency(ip: *InternPool, gpa: Allocator, depender: AnalUnit, depend |
| 907 | 907 | }, |
| 908 | 908 | }; |
| 909 | 909 | |
| 910 | ip.dep_entries.items[@intFromEnum(new_index)].depender = depender.toOptional(); | |
| 911 | ip.dep_entries.items[@intFromEnum(new_index)].prev = .none; | |
| 912 | ip.dep_entries.items[@intFromEnum(new_index)].next_dependee = first_depender_dep; | |
| 910 | ip.dep_entries.items[@backingInt(new_index)].depender = depender.toOptional(); | |
| 911 | ip.dep_entries.items[@backingInt(new_index)].prev = .none; | |
| 912 | ip.dep_entries.items[@backingInt(new_index)].next_dependee = first_depender_dep; | |
| 913 | 913 | ip.first_dependency.putAssumeCapacity(depender, new_index); |
| 914 | 914 | } |
| 915 | 915 | |
| ... | ... | @@ -942,7 +942,7 @@ pub const DepEntry = extern struct { |
| 942 | 942 | pub const Index = enum(u32) { |
| 943 | 943 | _, |
| 944 | 944 | pub fn toOptional(dep: DepEntry.Index) Optional { |
| 945 | return @enumFromInt(@intFromEnum(dep)); | |
| 945 | return @fromBackingInt(@intCast(@backingInt(dep))); | |
| 946 | 946 | } |
| 947 | 947 | pub const Optional = enum(u32) { |
| 948 | 948 | none = std.math.maxInt(u32), |
| ... | ... | @@ -950,7 +950,7 @@ pub const DepEntry = extern struct { |
| 950 | 950 | pub fn unwrap(opt: Optional) ?DepEntry.Index { |
| 951 | 951 | return switch (opt) { |
| 952 | 952 | .none => null, |
| 953 | _ => @enumFromInt(@intFromEnum(opt)), | |
| 953 | _ => @fromBackingInt(@intCast(@backingInt(opt))), | |
| 954 | 954 | }; |
| 955 | 955 | } |
| 956 | 956 | }; |
| ... | ... | @@ -1439,11 +1439,11 @@ const Local = struct { |
| 1439 | 1439 | }; |
| 1440 | 1440 | |
| 1441 | 1441 | pub fn getLocal(ip: *InternPool, tid: Zcu.PerThread.Id) *Local { |
| 1442 | return &ip.locals[@intFromEnum(tid)]; | |
| 1442 | return &ip.locals[@backingInt(tid)]; | |
| 1443 | 1443 | } |
| 1444 | 1444 | |
| 1445 | 1445 | pub fn getLocalShared(ip: *const InternPool, tid: Zcu.PerThread.Id) *const Local.Shared { |
| 1446 | return &ip.locals[@intFromEnum(tid)].shared; | |
| 1446 | return &ip.locals[@backingInt(tid)].shared; | |
| 1447 | 1447 | } |
| 1448 | 1448 | |
| 1449 | 1449 | const Shard = struct { |
| ... | ... | @@ -1596,7 +1596,7 @@ pub const OptionalMapIndex = enum(u32) { |
| 1596 | 1596 | |
| 1597 | 1597 | pub fn unwrap(oi: OptionalMapIndex) ?MapIndex { |
| 1598 | 1598 | if (oi == .none) return null; |
| 1599 | return @enumFromInt(@intFromEnum(oi)); | |
| 1599 | return @fromBackingInt(@intCast(@backingInt(oi))); | |
| 1600 | 1600 | } |
| 1601 | 1601 | }; |
| 1602 | 1602 | |
| ... | ... | @@ -1611,7 +1611,7 @@ pub const MapIndex = enum(u32) { |
| 1611 | 1611 | } |
| 1612 | 1612 | |
| 1613 | 1613 | pub fn toOptional(i: MapIndex) OptionalMapIndex { |
| 1614 | return @enumFromInt(@intFromEnum(i)); | |
| 1614 | return @fromBackingInt(@intCast(@backingInt(i))); | |
| 1615 | 1615 | } |
| 1616 | 1616 | |
| 1617 | 1617 | const Unwrapped = struct { |
| ... | ... | @@ -1619,16 +1619,16 @@ pub const MapIndex = enum(u32) { |
| 1619 | 1619 | index: u32, |
| 1620 | 1620 | |
| 1621 | 1621 | fn wrap(unwrapped: Unwrapped, ip: *const InternPool) MapIndex { |
| 1622 | assert(@intFromEnum(unwrapped.tid) <= ip.getTidMask()); | |
| 1622 | assert(@backingInt(unwrapped.tid) <= ip.getTidMask()); | |
| 1623 | 1623 | assert(unwrapped.index <= ip.getIndexMask(u32)); |
| 1624 | return @enumFromInt(@shlExact(@as(u32, @intFromEnum(unwrapped.tid)), ip.tid_shift_32) | | |
| 1625 | unwrapped.index); | |
| 1624 | return @fromBackingInt(@intCast(@shlExact(@as(u32, @backingInt(unwrapped.tid)), ip.tid_shift_32) | | |
| 1625 | unwrapped.index)); | |
| 1626 | 1626 | } |
| 1627 | 1627 | }; |
| 1628 | 1628 | fn unwrap(map_index: MapIndex, ip: *const InternPool) Unwrapped { |
| 1629 | 1629 | return .{ |
| 1630 | .tid = @enumFromInt(@intFromEnum(map_index) >> ip.tid_shift_32 & ip.getTidMask()), | |
| 1631 | .index = @intFromEnum(map_index) & ip.getIndexMask(u32), | |
| 1630 | .tid = @fromBackingInt(@intCast(@backingInt(map_index) >> ip.tid_shift_32 & ip.getTidMask())), | |
| 1631 | .index = @backingInt(map_index) & ip.getIndexMask(u32), | |
| 1632 | 1632 | }; |
| 1633 | 1633 | } |
| 1634 | 1634 | }; |
| ... | ... | @@ -1644,25 +1644,25 @@ pub const NamespaceIndex = enum(u32) { |
| 1644 | 1644 | index: u32, |
| 1645 | 1645 | |
| 1646 | 1646 | fn wrap(unwrapped: Unwrapped, ip: *const InternPool) NamespaceIndex { |
| 1647 | assert(@intFromEnum(unwrapped.tid) <= ip.getTidMask()); | |
| 1647 | assert(@backingInt(unwrapped.tid) <= ip.getTidMask()); | |
| 1648 | 1648 | assert(unwrapped.bucket_index <= ip.getIndexMask(u32) >> Local.namespaces_bucket_width); |
| 1649 | 1649 | assert(unwrapped.index <= Local.namespaces_bucket_mask); |
| 1650 | return @enumFromInt(@shlExact(@as(u32, @intFromEnum(unwrapped.tid)), ip.tid_shift_32) | | |
| 1650 | return @fromBackingInt(@intCast(@shlExact(@as(u32, @backingInt(unwrapped.tid)), ip.tid_shift_32) | | |
| 1651 | 1651 | unwrapped.bucket_index << Local.namespaces_bucket_width | |
| 1652 | unwrapped.index); | |
| 1652 | unwrapped.index)); | |
| 1653 | 1653 | } |
| 1654 | 1654 | }; |
| 1655 | 1655 | fn unwrap(namespace_index: NamespaceIndex, ip: *const InternPool) Unwrapped { |
| 1656 | const index = @intFromEnum(namespace_index) & ip.getIndexMask(u32); | |
| 1656 | const index = @backingInt(namespace_index) & ip.getIndexMask(u32); | |
| 1657 | 1657 | return .{ |
| 1658 | .tid = @enumFromInt(@intFromEnum(namespace_index) >> ip.tid_shift_32 & ip.getTidMask()), | |
| 1658 | .tid = @fromBackingInt(@intCast(@backingInt(namespace_index) >> ip.tid_shift_32 & ip.getTidMask())), | |
| 1659 | 1659 | .bucket_index = index >> Local.namespaces_bucket_width, |
| 1660 | 1660 | .index = index & Local.namespaces_bucket_mask, |
| 1661 | 1661 | }; |
| 1662 | 1662 | } |
| 1663 | 1663 | |
| 1664 | 1664 | pub fn toOptional(i: NamespaceIndex) OptionalNamespaceIndex { |
| 1665 | return @enumFromInt(@intFromEnum(i)); | |
| 1665 | return @fromBackingInt(@intCast(@backingInt(i))); | |
| 1666 | 1666 | } |
| 1667 | 1667 | }; |
| 1668 | 1668 | |
| ... | ... | @@ -1671,12 +1671,12 @@ pub const OptionalNamespaceIndex = enum(u32) { |
| 1671 | 1671 | _, |
| 1672 | 1672 | |
| 1673 | 1673 | pub fn init(oi: ?NamespaceIndex) OptionalNamespaceIndex { |
| 1674 | return @enumFromInt(@intFromEnum(oi orelse return .none)); | |
| 1674 | return @fromBackingInt(@intCast(@backingInt(oi orelse return .none))); | |
| 1675 | 1675 | } |
| 1676 | 1676 | |
| 1677 | 1677 | pub fn unwrap(oi: OptionalNamespaceIndex) ?NamespaceIndex { |
| 1678 | 1678 | if (oi == .none) return null; |
| 1679 | return @enumFromInt(@intFromEnum(oi)); | |
| 1679 | return @fromBackingInt(@intCast(@backingInt(oi))); | |
| 1680 | 1680 | } |
| 1681 | 1681 | }; |
| 1682 | 1682 | |
| ... | ... | @@ -1688,20 +1688,20 @@ pub const FileIndex = enum(u32) { |
| 1688 | 1688 | index: u32, |
| 1689 | 1689 | |
| 1690 | 1690 | fn wrap(unwrapped: Unwrapped, ip: *const InternPool) FileIndex { |
| 1691 | assert(@intFromEnum(unwrapped.tid) <= ip.getTidMask()); | |
| 1691 | assert(@backingInt(unwrapped.tid) <= ip.getTidMask()); | |
| 1692 | 1692 | assert(unwrapped.index <= ip.getIndexMask(u32)); |
| 1693 | return @enumFromInt(@shlExact(@as(u32, @intFromEnum(unwrapped.tid)), ip.tid_shift_32) | | |
| 1694 | unwrapped.index); | |
| 1693 | return @fromBackingInt(@intCast(@shlExact(@as(u32, @backingInt(unwrapped.tid)), ip.tid_shift_32) | | |
| 1694 | unwrapped.index)); | |
| 1695 | 1695 | } |
| 1696 | 1696 | }; |
| 1697 | 1697 | pub fn unwrap(file_index: FileIndex, ip: *const InternPool) Unwrapped { |
| 1698 | 1698 | return .{ |
| 1699 | .tid = @enumFromInt(@intFromEnum(file_index) >> ip.tid_shift_32 & ip.getTidMask()), | |
| 1700 | .index = @intFromEnum(file_index) & ip.getIndexMask(u32), | |
| 1699 | .tid = @fromBackingInt(@intCast(@backingInt(file_index) >> ip.tid_shift_32 & ip.getTidMask())), | |
| 1700 | .index = @backingInt(file_index) & ip.getIndexMask(u32), | |
| 1701 | 1701 | }; |
| 1702 | 1702 | } |
| 1703 | 1703 | pub fn toOptional(i: FileIndex) Optional { |
| 1704 | return @enumFromInt(@intFromEnum(i)); | |
| 1704 | return @fromBackingInt(@intCast(@backingInt(i))); | |
| 1705 | 1705 | } |
| 1706 | 1706 | pub const Optional = enum(u32) { |
| 1707 | 1707 | none = std.math.maxInt(u32), |
| ... | ... | @@ -1709,7 +1709,7 @@ pub const FileIndex = enum(u32) { |
| 1709 | 1709 | pub fn unwrap(opt: Optional) ?FileIndex { |
| 1710 | 1710 | return switch (opt) { |
| 1711 | 1711 | .none => null, |
| 1712 | _ => @enumFromInt(@intFromEnum(opt)), | |
| 1712 | _ => @fromBackingInt(@intCast(@backingInt(opt))), | |
| 1713 | 1713 | }; |
| 1714 | 1714 | } |
| 1715 | 1715 | }; |
| ... | ... | @@ -1739,7 +1739,7 @@ pub const String = enum(u32) { |
| 1739 | 1739 | pub fn toNullTerminatedString(string: String, len: u64, ip: *const InternPool) NullTerminatedString { |
| 1740 | 1740 | assert(std.mem.indexOfScalar(u8, string.toSlice(len, ip), 0) == null); |
| 1741 | 1741 | assert(string.at(len, ip) == 0); |
| 1742 | return @enumFromInt(@intFromEnum(string)); | |
| 1742 | return @fromBackingInt(@intCast(@backingInt(string))); | |
| 1743 | 1743 | } |
| 1744 | 1744 | |
| 1745 | 1745 | const Unwrapped = struct { |
| ... | ... | @@ -1747,16 +1747,16 @@ pub const String = enum(u32) { |
| 1747 | 1747 | index: u32, |
| 1748 | 1748 | |
| 1749 | 1749 | fn wrap(unwrapped: Unwrapped, ip: *const InternPool) String { |
| 1750 | assert(@intFromEnum(unwrapped.tid) <= ip.getTidMask()); | |
| 1750 | assert(@backingInt(unwrapped.tid) <= ip.getTidMask()); | |
| 1751 | 1751 | assert(unwrapped.index <= ip.getIndexMask(u32)); |
| 1752 | return @enumFromInt(@shlExact(@as(u32, @intFromEnum(unwrapped.tid)), ip.tid_shift_32) | | |
| 1753 | unwrapped.index); | |
| 1752 | return @fromBackingInt(@intCast(@shlExact(@as(u32, @backingInt(unwrapped.tid)), ip.tid_shift_32) | | |
| 1753 | unwrapped.index)); | |
| 1754 | 1754 | } |
| 1755 | 1755 | }; |
| 1756 | 1756 | fn unwrap(string: String, ip: *const InternPool) Unwrapped { |
| 1757 | 1757 | return .{ |
| 1758 | .tid = @enumFromInt(@intFromEnum(string) >> ip.tid_shift_32 & ip.getTidMask()), | |
| 1759 | .index = @intFromEnum(string) & ip.getIndexMask(u32), | |
| 1758 | .tid = @fromBackingInt(@intCast(@backingInt(string) >> ip.tid_shift_32 & ip.getTidMask())), | |
| 1759 | .index = @backingInt(string) & ip.getIndexMask(u32), | |
| 1760 | 1760 | }; |
| 1761 | 1761 | } |
| 1762 | 1762 | |
| ... | ... | @@ -1779,7 +1779,7 @@ pub const OptionalString = enum(u32) { |
| 1779 | 1779 | _, |
| 1780 | 1780 | |
| 1781 | 1781 | pub fn unwrap(string: OptionalString) ?String { |
| 1782 | return if (string != .none) @enumFromInt(@intFromEnum(string)) else null; | |
| 1782 | return if (string != .none) @fromBackingInt(@intCast(@backingInt(string))) else null; | |
| 1783 | 1783 | } |
| 1784 | 1784 | |
| 1785 | 1785 | pub fn toSlice(string: OptionalString, len: u64, ip: *const InternPool) ?[]const u8 { |
| ... | ... | @@ -1812,11 +1812,11 @@ pub const NullTerminatedString = enum(u32) { |
| 1812 | 1812 | }; |
| 1813 | 1813 | |
| 1814 | 1814 | pub fn toString(self: NullTerminatedString) String { |
| 1815 | return @enumFromInt(@intFromEnum(self)); | |
| 1815 | return @fromBackingInt(@intCast(@backingInt(self))); | |
| 1816 | 1816 | } |
| 1817 | 1817 | |
| 1818 | 1818 | pub fn toOptional(self: NullTerminatedString) OptionalNullTerminatedString { |
| 1819 | return @enumFromInt(@intFromEnum(self)); | |
| 1819 | return @fromBackingInt(@intCast(@backingInt(self))); | |
| 1820 | 1820 | } |
| 1821 | 1821 | |
| 1822 | 1822 | pub fn toSlice(string: NullTerminatedString, ip: *const InternPool) [:0]const u8 { |
| ... | ... | @@ -1851,14 +1851,14 @@ pub const NullTerminatedString = enum(u32) { |
| 1851 | 1851 | |
| 1852 | 1852 | pub fn hash(ctx: @This(), a: NullTerminatedString) u32 { |
| 1853 | 1853 | _ = ctx; |
| 1854 | return std.hash.int(@intFromEnum(a)); | |
| 1854 | return std.hash.int(@backingInt(a)); | |
| 1855 | 1855 | } |
| 1856 | 1856 | }; |
| 1857 | 1857 | |
| 1858 | 1858 | /// Compare based on integer value alone, ignoring the string contents. |
| 1859 | 1859 | pub fn indexLessThan(ctx: void, a: NullTerminatedString, b: NullTerminatedString) bool { |
| 1860 | 1860 | _ = ctx; |
| 1861 | return @intFromEnum(a) < @intFromEnum(b); | |
| 1861 | return @backingInt(a) < @backingInt(b); | |
| 1862 | 1862 | } |
| 1863 | 1863 | |
| 1864 | 1864 | pub fn toUnsigned(string: NullTerminatedString, ip: *const InternPool) ?u32 { |
| ... | ... | @@ -1901,7 +1901,7 @@ pub const OptionalNullTerminatedString = enum(u32) { |
| 1901 | 1901 | _, |
| 1902 | 1902 | |
| 1903 | 1903 | pub fn unwrap(string: OptionalNullTerminatedString) ?NullTerminatedString { |
| 1904 | return if (string != .none) @enumFromInt(@intFromEnum(string)) else null; | |
| 1904 | return if (string != .none) @fromBackingInt(@intCast(@backingInt(string))) else null; | |
| 1905 | 1905 | } |
| 1906 | 1906 | |
| 1907 | 1907 | pub fn toSlice(string: OptionalNullTerminatedString, ip: *const InternPool) ?[:0]const u8 { |
| ... | ... | @@ -1923,18 +1923,18 @@ pub const CaptureValue = packed struct(u32) { |
| 1923 | 1923 | |
| 1924 | 1924 | pub fn wrap(val: Unwrapped) CaptureValue { |
| 1925 | 1925 | return switch (val) { |
| 1926 | .@"comptime" => |i| .{ .tag = .@"comptime", .idx = @intCast(@intFromEnum(i)) }, | |
| 1927 | .runtime => |i| .{ .tag = .runtime, .idx = @intCast(@intFromEnum(i)) }, | |
| 1928 | .nav_val => |i| .{ .tag = .nav_val, .idx = @intCast(@intFromEnum(i)) }, | |
| 1929 | .nav_ref => |i| .{ .tag = .nav_ref, .idx = @intCast(@intFromEnum(i)) }, | |
| 1926 | .@"comptime" => |i| .{ .tag = .@"comptime", .idx = @intCast(@backingInt(i)) }, | |
| 1927 | .runtime => |i| .{ .tag = .runtime, .idx = @intCast(@backingInt(i)) }, | |
| 1928 | .nav_val => |i| .{ .tag = .nav_val, .idx = @intCast(@backingInt(i)) }, | |
| 1929 | .nav_ref => |i| .{ .tag = .nav_ref, .idx = @intCast(@backingInt(i)) }, | |
| 1930 | 1930 | }; |
| 1931 | 1931 | } |
| 1932 | 1932 | pub fn unwrap(val: CaptureValue) Unwrapped { |
| 1933 | 1933 | return switch (val.tag) { |
| 1934 | .@"comptime" => .{ .@"comptime" = @enumFromInt(val.idx) }, | |
| 1935 | .runtime => .{ .runtime = @enumFromInt(val.idx) }, | |
| 1936 | .nav_val => .{ .nav_val = @enumFromInt(val.idx) }, | |
| 1937 | .nav_ref => .{ .nav_ref = @enumFromInt(val.idx) }, | |
| 1934 | .@"comptime" => .{ .@"comptime" = @fromBackingInt(@intCast(val.idx)) }, | |
| 1935 | .runtime => .{ .runtime = @fromBackingInt(@intCast(val.idx)) }, | |
| 1936 | .nav_val => .{ .nav_val = @fromBackingInt(@intCast(val.idx)) }, | |
| 1937 | .nav_ref => .{ .nav_ref = @fromBackingInt(@intCast(val.idx)) }, | |
| 1938 | 1938 | }; |
| 1939 | 1939 | } |
| 1940 | 1940 | |
| ... | ... | @@ -2605,7 +2605,7 @@ pub const Key = union(enum) { |
| 2605 | 2605 | pub fn hash64(key: Key, ip: *const InternPool) u64 { |
| 2606 | 2606 | const asBytes = std.mem.asBytes; |
| 2607 | 2607 | const KeyTag = @typeInfo(Key).@"union".tag_type.?; |
| 2608 | const seed = @intFromEnum(@as(KeyTag, key)); | |
| 2608 | const seed = @backingInt(@as(KeyTag, key)); | |
| 2609 | 2609 | return switch (key) { |
| 2610 | 2610 | inline .ptr_type, |
| 2611 | 2611 | .array_type, |
| ... | ... | @@ -2629,7 +2629,7 @@ pub const Key = union(enum) { |
| 2629 | 2629 | return Hash.hash(seed, asBytes(&x)); |
| 2630 | 2630 | }, |
| 2631 | 2631 | |
| 2632 | .int_type => |x| Hash.hash(seed + @intFromEnum(x.signedness), asBytes(&x.bits)), | |
| 2632 | .int_type => |x| Hash.hash(seed + @backingInt(x.signedness), asBytes(&x.bits)), | |
| 2633 | 2633 | |
| 2634 | 2634 | .error_union => |x| switch (x.val) { |
| 2635 | 2635 | .err_name => |y| Hash.hash(seed + 0, asBytes(&x.ty) ++ asBytes(&y)), |
| ... | ... | @@ -2695,7 +2695,7 @@ pub const Key = union(enum) { |
| 2695 | 2695 | // Int-to-ptr pointers are hashed separately than decl-referencing pointers. |
| 2696 | 2696 | // This is sound due to pointer provenance rules. |
| 2697 | 2697 | const addr_tag: Key.Ptr.BaseAddr.Tag = ptr.base_addr; |
| 2698 | const seed2 = seed + @intFromEnum(addr_tag); | |
| 2698 | const seed2 = seed + @backingInt(addr_tag); | |
| 2699 | 2699 | const big_offset: i128 = ptr.byte_offset; |
| 2700 | 2700 | const common = asBytes(&ptr.ty) ++ asBytes(&big_offset); |
| 2701 | 2701 | return switch (ptr.base_addr) { |
| ... | ... | @@ -2829,7 +2829,7 @@ pub const Key = union(enum) { |
| 2829 | 2829 | asBytes(&e.is_threadlocal) ++ asBytes(&e.is_dll_import) ++ |
| 2830 | 2830 | asBytes(&e.relocation) ++ |
| 2831 | 2831 | asBytes(&e.is_const) ++ asBytes(&e.alignment) ++ asBytes(&e.@"addrspace") ++ |
| 2832 | asBytes(&e.zir_index) ++ &[1]u8{@intFromEnum(e.source)}), | |
| 2832 | asBytes(&e.zir_index) ++ &[1]u8{@backingInt(e.source)}), | |
| 2833 | 2833 | |
| 2834 | 2834 | .bitpack => |bitpack| Hash.hash(seed, asBytes(&bitpack.ty) ++ asBytes(&bitpack.backing_int_val)), |
| 2835 | 2835 | }; |
| ... | ... | @@ -3304,7 +3304,7 @@ pub const LoadedStructType = struct { |
| 3304 | 3304 | return switch (i) { |
| 3305 | 3305 | .omitted => null, |
| 3306 | 3306 | .unresolved => unreachable, |
| 3307 | else => @intFromEnum(i), | |
| 3307 | else => @backingInt(i), | |
| 3308 | 3308 | }; |
| 3309 | 3309 | } |
| 3310 | 3310 | }; |
| ... | ... | @@ -3642,7 +3642,7 @@ pub fn loadStructType(ip: *const InternPool, index: Index) LoadedStructType { |
| 3642 | 3642 | _ => |n| .{ |
| 3643 | 3643 | .tid = unwrapped_index.tid, |
| 3644 | 3644 | .start = extra_index, |
| 3645 | .len = @intFromEnum(n), | |
| 3645 | .len = @backingInt(n), | |
| 3646 | 3646 | }, |
| 3647 | 3647 | }; |
| 3648 | 3648 | extra_index += captures.len; |
| ... | ... | @@ -3778,7 +3778,7 @@ pub fn loadUnionType(ip: *const InternPool, index: Index) LoadedUnionType { |
| 3778 | 3778 | _ => |n| .{ |
| 3779 | 3779 | .tid = unwrapped_index.tid, |
| 3780 | 3780 | .start = extra_index, |
| 3781 | .len = @intFromEnum(n), | |
| 3781 | .len = @backingInt(n), | |
| 3782 | 3782 | }, |
| 3783 | 3783 | }; |
| 3784 | 3784 | extra_index += captures.len; |
| ... | ... | @@ -3834,30 +3834,30 @@ pub fn loadEnumType(ip: *const InternPool, index: Index) LoadedEnumType { |
| 3834 | 3834 | var extra_index: u32 = @intCast(extra.end); |
| 3835 | 3835 | const zir_index: TrackedInst.Index.Optional, const captures: CaptureValue.Slice, const owner_union: Index = switch (extra.data.bits.captures_len) { |
| 3836 | 3836 | .reified => info: { |
| 3837 | const zir_index: TrackedInst.Index = @enumFromInt(extra_items[extra_index]); | |
| 3837 | const zir_index: TrackedInst.Index = @fromBackingInt(@intCast(extra_items[extra_index])); | |
| 3838 | 3838 | extra_index += 1; |
| 3839 | 3839 | extra_index += 2; // type_hash: PackedU64 |
| 3840 | 3840 | break :info .{ zir_index.toOptional(), .empty, .none }; |
| 3841 | 3841 | }, |
| 3842 | 3842 | .generated_union_tag => info: { |
| 3843 | const owner_union: Index = @enumFromInt(extra_items[extra_index]); | |
| 3843 | const owner_union: Index = @fromBackingInt(@intCast(extra_items[extra_index])); | |
| 3844 | 3844 | extra_index += 1; |
| 3845 | 3845 | break :info .{ .none, .empty, owner_union }; |
| 3846 | 3846 | }, |
| 3847 | 3847 | _ => |n| info: { |
| 3848 | const zir_index: TrackedInst.Index = @enumFromInt(extra_items[extra_index]); | |
| 3848 | const zir_index: TrackedInst.Index = @fromBackingInt(@intCast(extra_items[extra_index])); | |
| 3849 | 3849 | extra_index += 1; |
| 3850 | 3850 | const captures: CaptureValue.Slice = .{ |
| 3851 | 3851 | .tid = unwrapped_index.tid, |
| 3852 | 3852 | .start = extra_index, |
| 3853 | .len = @intFromEnum(n), | |
| 3853 | .len = @backingInt(n), | |
| 3854 | 3854 | }; |
| 3855 | 3855 | extra_index += captures.len; |
| 3856 | 3856 | break :info .{ zir_index.toOptional(), captures, .none }; |
| 3857 | 3857 | }, |
| 3858 | 3858 | }; |
| 3859 | 3859 | const field_value_map: OptionalMapIndex = if (explicit_int_tag) m: { |
| 3860 | const map: MapIndex = @enumFromInt(extra_items[extra_index]); | |
| 3860 | const map: MapIndex = @fromBackingInt(@intCast(extra_items[extra_index])); | |
| 3861 | 3861 | extra_index += 1; |
| 3862 | 3862 | break :m map.toOptional(); |
| 3863 | 3863 | } else .none; |
| ... | ... | @@ -4138,7 +4138,7 @@ pub const Index = enum(u32) { |
| 4138 | 4138 | |
| 4139 | 4139 | pub fn hash(ctx: @This(), a: Index) u32 { |
| 4140 | 4140 | _ = ctx; |
| 4141 | return std.hash.int(@intFromEnum(a)); | |
| 4141 | return std.hash.int(@backingInt(a)); | |
| 4142 | 4142 | } |
| 4143 | 4143 | }; |
| 4144 | 4144 | |
| ... | ... | @@ -4147,10 +4147,10 @@ pub const Index = enum(u32) { |
| 4147 | 4147 | index: u32, |
| 4148 | 4148 | |
| 4149 | 4149 | fn wrap(unwrapped: Unwrapped, ip: *const InternPool) Index { |
| 4150 | assert(@intFromEnum(unwrapped.tid) <= ip.getTidMask()); | |
| 4150 | assert(@backingInt(unwrapped.tid) <= ip.getTidMask()); | |
| 4151 | 4151 | assert(unwrapped.index <= ip.getIndexMask(u30)); |
| 4152 | return @enumFromInt(@shlExact(@as(u32, @intFromEnum(unwrapped.tid)), ip.tid_shift_30) | | |
| 4153 | unwrapped.index); | |
| 4152 | return @fromBackingInt(@intCast(@shlExact(@as(u32, @backingInt(unwrapped.tid)), ip.tid_shift_30) | | |
| 4153 | unwrapped.index)); | |
| 4154 | 4154 | } |
| 4155 | 4155 | |
| 4156 | 4156 | pub fn getExtra(unwrapped: Unwrapped, ip: *const InternPool) Local.Extra { |
| ... | ... | @@ -4188,8 +4188,8 @@ pub const Index = enum(u32) { |
| 4188 | 4188 | }; |
| 4189 | 4189 | pub fn unwrap(index: Index, ip: *const InternPool) Unwrapped { |
| 4190 | 4190 | return .{ |
| 4191 | .tid = @enumFromInt(@intFromEnum(index) >> ip.tid_shift_30 & ip.getTidMask()), | |
| 4192 | .index = @intFromEnum(index) & ip.getIndexMask(u30), | |
| 4191 | .tid = @fromBackingInt(@intCast(@backingInt(index) >> ip.tid_shift_30 & ip.getTidMask())), | |
| 4192 | .index = @backingInt(index) & ip.getIndexMask(u30), | |
| 4193 | 4193 | }; |
| 4194 | 4194 | } |
| 4195 | 4195 | |
| ... | ... | @@ -5794,46 +5794,46 @@ pub const TypeTuple = struct { |
| 5794 | 5794 | /// implement logic that only wants to deal with types because the logic can |
| 5795 | 5795 | /// ignore all simple values. Note that technically, types are values. |
| 5796 | 5796 | pub const SimpleType = enum(u32) { |
| 5797 | f16 = @intFromEnum(Index.f16_type), | |
| 5798 | f32 = @intFromEnum(Index.f32_type), | |
| 5799 | f64 = @intFromEnum(Index.f64_type), | |
| 5800 | f80 = @intFromEnum(Index.f80_type), | |
| 5801 | f128 = @intFromEnum(Index.f128_type), | |
| 5802 | usize = @intFromEnum(Index.usize_type), | |
| 5803 | isize = @intFromEnum(Index.isize_type), | |
| 5804 | c_char = @intFromEnum(Index.c_char_type), | |
| 5805 | c_short = @intFromEnum(Index.c_short_type), | |
| 5806 | c_ushort = @intFromEnum(Index.c_ushort_type), | |
| 5807 | c_int = @intFromEnum(Index.c_int_type), | |
| 5808 | c_uint = @intFromEnum(Index.c_uint_type), | |
| 5809 | c_long = @intFromEnum(Index.c_long_type), | |
| 5810 | c_ulong = @intFromEnum(Index.c_ulong_type), | |
| 5811 | c_longlong = @intFromEnum(Index.c_longlong_type), | |
| 5812 | c_ulonglong = @intFromEnum(Index.c_ulonglong_type), | |
| 5813 | c_longdouble = @intFromEnum(Index.c_longdouble_type), | |
| 5814 | anyopaque = @intFromEnum(Index.anyopaque_type), | |
| 5815 | bool = @intFromEnum(Index.bool_type), | |
| 5816 | void = @intFromEnum(Index.void_type), | |
| 5817 | type = @intFromEnum(Index.type_type), | |
| 5818 | anyerror = @intFromEnum(Index.anyerror_type), | |
| 5819 | comptime_int = @intFromEnum(Index.comptime_int_type), | |
| 5820 | comptime_float = @intFromEnum(Index.comptime_float_type), | |
| 5821 | noreturn = @intFromEnum(Index.noreturn_type), | |
| 5822 | null = @intFromEnum(Index.null_type), | |
| 5823 | undefined = @intFromEnum(Index.undefined_type), | |
| 5824 | enum_literal = @intFromEnum(Index.enum_literal_type), | |
| 5825 | ||
| 5826 | adhoc_inferred_error_set = @intFromEnum(Index.adhoc_inferred_error_set_type), | |
| 5827 | generic_poison = @intFromEnum(Index.generic_poison_type), | |
| 5797 | f16 = @backingInt(Index.f16_type), | |
| 5798 | f32 = @backingInt(Index.f32_type), | |
| 5799 | f64 = @backingInt(Index.f64_type), | |
| 5800 | f80 = @backingInt(Index.f80_type), | |
| 5801 | f128 = @backingInt(Index.f128_type), | |
| 5802 | usize = @backingInt(Index.usize_type), | |
| 5803 | isize = @backingInt(Index.isize_type), | |
| 5804 | c_char = @backingInt(Index.c_char_type), | |
| 5805 | c_short = @backingInt(Index.c_short_type), | |
| 5806 | c_ushort = @backingInt(Index.c_ushort_type), | |
| 5807 | c_int = @backingInt(Index.c_int_type), | |
| 5808 | c_uint = @backingInt(Index.c_uint_type), | |
| 5809 | c_long = @backingInt(Index.c_long_type), | |
| 5810 | c_ulong = @backingInt(Index.c_ulong_type), | |
| 5811 | c_longlong = @backingInt(Index.c_longlong_type), | |
| 5812 | c_ulonglong = @backingInt(Index.c_ulonglong_type), | |
| 5813 | c_longdouble = @backingInt(Index.c_longdouble_type), | |
| 5814 | anyopaque = @backingInt(Index.anyopaque_type), | |
| 5815 | bool = @backingInt(Index.bool_type), | |
| 5816 | void = @backingInt(Index.void_type), | |
| 5817 | type = @backingInt(Index.type_type), | |
| 5818 | anyerror = @backingInt(Index.anyerror_type), | |
| 5819 | comptime_int = @backingInt(Index.comptime_int_type), | |
| 5820 | comptime_float = @backingInt(Index.comptime_float_type), | |
| 5821 | noreturn = @backingInt(Index.noreturn_type), | |
| 5822 | null = @backingInt(Index.null_type), | |
| 5823 | undefined = @backingInt(Index.undefined_type), | |
| 5824 | enum_literal = @backingInt(Index.enum_literal_type), | |
| 5825 | ||
| 5826 | adhoc_inferred_error_set = @backingInt(Index.adhoc_inferred_error_set_type), | |
| 5827 | generic_poison = @backingInt(Index.generic_poison_type), | |
| 5828 | 5828 | }; |
| 5829 | 5829 | |
| 5830 | 5830 | pub const SimpleValue = enum(u32) { |
| 5831 | void = @intFromEnum(Index.void_value), | |
| 5831 | void = @backingInt(Index.void_value), | |
| 5832 | 5832 | /// This is untyped `null`. |
| 5833 | null = @intFromEnum(Index.null_value), | |
| 5834 | true = @intFromEnum(Index.bool_true), | |
| 5835 | false = @intFromEnum(Index.bool_false), | |
| 5836 | @"unreachable" = @intFromEnum(Index.unreachable_value), | |
| 5833 | null = @backingInt(Index.null_value), | |
| 5834 | true = @backingInt(Index.bool_true), | |
| 5835 | false = @backingInt(Index.bool_false), | |
| 5836 | @"unreachable" = @backingInt(Index.unreachable_value), | |
| 5837 | 5837 | }; |
| 5838 | 5838 | |
| 5839 | 5839 | /// Stored as a power-of-two, with one special value to indicate none. |
| ... | ... | @@ -5851,14 +5851,14 @@ pub const Alignment = enum(u6) { |
| 5851 | 5851 | pub fn toByteUnits(a: Alignment) ?u64 { |
| 5852 | 5852 | return switch (a) { |
| 5853 | 5853 | .none => null, |
| 5854 | else => @as(u64, 1) << @intFromEnum(a), | |
| 5854 | else => @as(u64, 1) << @backingInt(a), | |
| 5855 | 5855 | }; |
| 5856 | 5856 | } |
| 5857 | 5857 | |
| 5858 | 5858 | pub fn fromByteUnits(n: u64) Alignment { |
| 5859 | 5859 | if (n == 0) return .none; |
| 5860 | 5860 | assert(std.math.isPowerOfTwo(n)); |
| 5861 | return @enumFromInt(@ctz(n)); | |
| 5861 | return @fromBackingInt(@intCast(@ctz(n))); | |
| 5862 | 5862 | } |
| 5863 | 5863 | |
| 5864 | 5864 | pub fn fromNonzeroByteUnits(n: u64) Alignment { |
| ... | ... | @@ -5868,21 +5868,21 @@ pub const Alignment = enum(u6) { |
| 5868 | 5868 | |
| 5869 | 5869 | pub fn toLog2Units(a: Alignment) u6 { |
| 5870 | 5870 | assert(a != .none); |
| 5871 | return @intFromEnum(a); | |
| 5871 | return @backingInt(a); | |
| 5872 | 5872 | } |
| 5873 | 5873 | |
| 5874 | 5874 | /// This is just a glorified `@enumFromInt` but using it can help |
| 5875 | 5875 | /// document the intended conversion. |
| 5876 | 5876 | /// The parameter uses a u32 for convenience at the callsite. |
| 5877 | 5877 | pub fn fromLog2Units(a: u32) Alignment { |
| 5878 | assert(a != @intFromEnum(Alignment.none)); | |
| 5879 | return @enumFromInt(a); | |
| 5878 | assert(a != @backingInt(Alignment.none)); | |
| 5879 | return @fromBackingInt(@intCast(a)); | |
| 5880 | 5880 | } |
| 5881 | 5881 | |
| 5882 | 5882 | pub fn order(lhs: Alignment, rhs: Alignment) std.math.Order { |
| 5883 | 5883 | assert(lhs != .none); |
| 5884 | 5884 | assert(rhs != .none); |
| 5885 | return std.math.order(@intFromEnum(lhs), @intFromEnum(rhs)); | |
| 5885 | return std.math.order(@backingInt(lhs), @backingInt(rhs)); | |
| 5886 | 5886 | } |
| 5887 | 5887 | |
| 5888 | 5888 | /// Relaxed comparison. We have this as default because a lot of callsites |
| ... | ... | @@ -5896,7 +5896,7 @@ pub const Alignment = enum(u6) { |
| 5896 | 5896 | pub fn compareStrict(lhs: Alignment, op: std.math.CompareOperator, rhs: Alignment) bool { |
| 5897 | 5897 | assert(lhs != .none); |
| 5898 | 5898 | assert(rhs != .none); |
| 5899 | return std.math.compare(@intFromEnum(lhs), op, @intFromEnum(rhs)); | |
| 5899 | return std.math.compare(@backingInt(lhs), op, @backingInt(rhs)); | |
| 5900 | 5900 | } |
| 5901 | 5901 | |
| 5902 | 5902 | /// Treats `none` as zero. |
| ... | ... | @@ -5911,7 +5911,7 @@ pub const Alignment = enum(u6) { |
| 5911 | 5911 | pub fn maxStrict(lhs: Alignment, rhs: Alignment) Alignment { |
| 5912 | 5912 | assert(lhs != .none); |
| 5913 | 5913 | assert(rhs != .none); |
| 5914 | return @enumFromInt(@max(@intFromEnum(lhs), @intFromEnum(rhs))); | |
| 5914 | return @fromBackingInt(@intCast(@max(@backingInt(lhs), @backingInt(rhs)))); | |
| 5915 | 5915 | } |
| 5916 | 5916 | |
| 5917 | 5917 | /// Treats `none` as zero. |
| ... | ... | @@ -5926,7 +5926,7 @@ pub const Alignment = enum(u6) { |
| 5926 | 5926 | pub fn minStrict(lhs: Alignment, rhs: Alignment) Alignment { |
| 5927 | 5927 | assert(lhs != .none); |
| 5928 | 5928 | assert(rhs != .none); |
| 5929 | return @enumFromInt(@min(@intFromEnum(lhs), @intFromEnum(rhs))); | |
| 5929 | return @fromBackingInt(@intCast(@min(@backingInt(lhs), @backingInt(rhs)))); | |
| 5930 | 5930 | } |
| 5931 | 5931 | |
| 5932 | 5932 | /// Given a base address known to be aligned to `a`, |
| ... | ... | @@ -5938,21 +5938,21 @@ pub const Alignment = enum(u6) { |
| 5938 | 5938 | /// Align an address forwards to this alignment. |
| 5939 | 5939 | pub fn forward(a: Alignment, addr: u64) u64 { |
| 5940 | 5940 | assert(a != .none); |
| 5941 | const x = (@as(u64, 1) << @intFromEnum(a)) - 1; | |
| 5941 | const x = (@as(u64, 1) << @backingInt(a)) - 1; | |
| 5942 | 5942 | return (addr + x) & ~x; |
| 5943 | 5943 | } |
| 5944 | 5944 | |
| 5945 | 5945 | /// Align an address backwards to this alignment. |
| 5946 | 5946 | pub fn backward(a: Alignment, addr: u64) u64 { |
| 5947 | 5947 | assert(a != .none); |
| 5948 | const x = (@as(u64, 1) << @intFromEnum(a)) - 1; | |
| 5948 | const x = (@as(u64, 1) << @backingInt(a)) - 1; | |
| 5949 | 5949 | return addr & ~x; |
| 5950 | 5950 | } |
| 5951 | 5951 | |
| 5952 | 5952 | /// Check if an address is aligned to this amount. |
| 5953 | 5953 | pub fn check(a: Alignment, addr: u64) bool { |
| 5954 | 5954 | assert(a != .none); |
| 5955 | return @ctz(addr) >= @intFromEnum(a); | |
| 5955 | return @ctz(addr) >= @backingInt(a); | |
| 5956 | 5956 | } |
| 5957 | 5957 | |
| 5958 | 5958 | /// An array of `Alignment` objects existing within the `extra` array. |
| ... | ... | @@ -5981,25 +5981,25 @@ pub const Alignment = enum(u6) { |
| 5981 | 5981 | }; |
| 5982 | 5982 | |
| 5983 | 5983 | pub fn toRelaxedCompareUnits(a: Alignment) u8 { |
| 5984 | const n: u8 = @intFromEnum(a); | |
| 5985 | assert(n <= @intFromEnum(Alignment.none)); | |
| 5986 | if (n == @intFromEnum(Alignment.none)) return 0; | |
| 5984 | const n: u8 = @backingInt(a); | |
| 5985 | assert(n <= @backingInt(Alignment.none)); | |
| 5986 | if (n == @backingInt(Alignment.none)) return 0; | |
| 5987 | 5987 | return n + 1; |
| 5988 | 5988 | } |
| 5989 | 5989 | |
| 5990 | 5990 | pub fn toStdMem(a: Alignment) std.mem.Alignment { |
| 5991 | 5991 | assert(a != .none); |
| 5992 | return @enumFromInt(@intFromEnum(a)); | |
| 5992 | return @fromBackingInt(@intCast(@backingInt(a))); | |
| 5993 | 5993 | } |
| 5994 | 5994 | |
| 5995 | 5995 | pub fn fromStdMem(a: std.mem.Alignment) Alignment { |
| 5996 | const r: Alignment = @enumFromInt(@intFromEnum(a)); | |
| 5996 | const r: Alignment = @fromBackingInt(@intCast(@backingInt(a))); | |
| 5997 | 5997 | assert(r != .none); |
| 5998 | 5998 | return r; |
| 5999 | 5999 | } |
| 6000 | 6000 | |
| 6001 | 6001 | pub fn toLlvm(a: Alignment) std.zig.llvm.Builder.Alignment { |
| 6002 | return @enumFromInt(@intFromEnum(a)); | |
| 6002 | return @fromBackingInt(@intCast(@backingInt(a))); | |
| 6003 | 6003 | } |
| 6004 | 6004 | }; |
| 6005 | 6005 | |
| ... | ... | @@ -6349,7 +6349,7 @@ pub fn init(ip: *InternPool, gpa: Allocator, io: Io, available_threads: usize) ! |
| 6349 | 6349 | |
| 6350 | 6350 | // This inserts all the statically-known values into the intern pool in the |
| 6351 | 6351 | // order expected. |
| 6352 | for (&static_keys, 0..) |key, key_index| switch (@as(Index, @enumFromInt(key_index))) { | |
| 6352 | for (&static_keys, 0..) |key, key_index| switch (@as(Index, @fromBackingInt(@intCast(key_index)))) { | |
| 6353 | 6353 | .empty_tuple_type => assert(try ip.getTupleType(gpa, io, .main, .{ |
| 6354 | 6354 | .types = &.{}, |
| 6355 | 6355 | .values = &.{}, |
| ... | ... | @@ -6476,8 +6476,8 @@ pub fn indexToKey(ip: *const InternPool, index: Index) Key { |
| 6476 | 6476 | .sentinel = .none, |
| 6477 | 6477 | } }; |
| 6478 | 6478 | }, |
| 6479 | .simple_type => .{ .simple_type = @enumFromInt(@intFromEnum(index)) }, | |
| 6480 | .simple_value => .{ .simple_value = @enumFromInt(@intFromEnum(index)) }, | |
| 6479 | .simple_type => .{ .simple_type = @fromBackingInt(@intCast(@backingInt(index))) }, | |
| 6480 | .simple_value => .{ .simple_value = @fromBackingInt(@intCast(@backingInt(index))) }, | |
| 6481 | 6481 | |
| 6482 | 6482 | .type_vector => { |
| 6483 | 6483 | const vector_info = extraData(unwrapped_index.getExtra(ip), Vector, data); |
| ... | ... | @@ -6490,7 +6490,7 @@ pub fn indexToKey(ip: *const InternPool, index: Index) Key { |
| 6490 | 6490 | .type_pointer => .{ .ptr_type = extraData(unwrapped_index.getExtra(ip), Tag.TypePointer, data) }, |
| 6491 | 6491 | |
| 6492 | 6492 | .type_slice => { |
| 6493 | const many_ptr_index: Index = @enumFromInt(data); | |
| 6493 | const many_ptr_index: Index = @fromBackingInt(@intCast(data)); | |
| 6494 | 6494 | const many_ptr_unwrapped = many_ptr_index.unwrap(ip); |
| 6495 | 6495 | const many_ptr_item = many_ptr_unwrapped.getItem(ip); |
| 6496 | 6496 | assert(many_ptr_item.tag == .type_pointer); |
| ... | ... | @@ -6499,17 +6499,17 @@ pub fn indexToKey(ip: *const InternPool, index: Index) Key { |
| 6499 | 6499 | return .{ .ptr_type = ptr_info }; |
| 6500 | 6500 | }, |
| 6501 | 6501 | |
| 6502 | .type_optional => .{ .opt_type = @enumFromInt(data) }, | |
| 6503 | .type_anyframe => .{ .anyframe_type = @enumFromInt(data) }, | |
| 6502 | .type_optional => .{ .opt_type = @fromBackingInt(@intCast(data)) }, | |
| 6503 | .type_anyframe => .{ .anyframe_type = @fromBackingInt(@intCast(data)) }, | |
| 6504 | 6504 | |
| 6505 | 6505 | .type_error_union => .{ .error_union_type = extraData(unwrapped_index.getExtra(ip), Key.ErrorUnionType, data) }, |
| 6506 | 6506 | .type_anyerror_union => .{ .error_union_type = .{ |
| 6507 | 6507 | .error_set_type = .anyerror_type, |
| 6508 | .payload_type = @enumFromInt(data), | |
| 6508 | .payload_type = @fromBackingInt(@intCast(data)), | |
| 6509 | 6509 | } }, |
| 6510 | 6510 | .type_error_set => .{ .error_set_type = extraErrorSet(unwrapped_index.tid, unwrapped_index.getExtra(ip), data) }, |
| 6511 | 6511 | .type_inferred_error_set => .{ |
| 6512 | .inferred_error_set_type = @enumFromInt(data), | |
| 6512 | .inferred_error_set_type = @fromBackingInt(@intCast(data)), | |
| 6513 | 6513 | }, |
| 6514 | 6514 | .type_function => .{ .func_type = extraFuncType(unwrapped_index.tid, unwrapped_index.getExtra(ip), data) }, |
| 6515 | 6515 | .type_tuple => .{ .tuple_type = extraTypeTuple(unwrapped_index.tid, unwrapped_index.getExtra(ip), data) }, |
| ... | ... | @@ -6553,7 +6553,7 @@ pub fn indexToKey(ip: *const InternPool, index: Index) Key { |
| 6553 | 6553 | .captures = .{ .owned = .{ |
| 6554 | 6554 | .tid = unwrapped_index.tid, |
| 6555 | 6555 | .start = extra.end, |
| 6556 | .len = @intFromEnum(len), | |
| 6556 | .len = @backingInt(len), | |
| 6557 | 6557 | } }, |
| 6558 | 6558 | } }, |
| 6559 | 6559 | }; |
| ... | ... | @@ -6593,7 +6593,7 @@ pub fn indexToKey(ip: *const InternPool, index: Index) Key { |
| 6593 | 6593 | .captures = .{ .owned = .{ |
| 6594 | 6594 | .tid = unwrapped_index.tid, |
| 6595 | 6595 | .start = extra.end, |
| 6596 | .len = @intFromEnum(len), | |
| 6596 | .len = @backingInt(len), | |
| 6597 | 6597 | } }, |
| 6598 | 6598 | } }, |
| 6599 | 6599 | }; |
| ... | ... | @@ -6603,18 +6603,18 @@ pub fn indexToKey(ip: *const InternPool, index: Index) Key { |
| 6603 | 6603 | const extra = extraDataTrail(extra_list, Tag.TypeEnum, data); |
| 6604 | 6604 | break :ns switch (extra.data.bits.captures_len) { |
| 6605 | 6605 | .reified => .{ .reified = .{ |
| 6606 | .zir_index = @enumFromInt(extra_list.view().items(.@"0")[extra.end]), | |
| 6606 | .zir_index = @fromBackingInt(@intCast(extra_list.view().items(.@"0")[extra.end])), | |
| 6607 | 6607 | .type_hash = extraData(extra_list, PackedU64, extra.end + 1).get(), |
| 6608 | 6608 | } }, |
| 6609 | 6609 | .generated_union_tag => .{ .generated_union_tag = owner_union: { |
| 6610 | break :owner_union @enumFromInt(extra_list.view().items(.@"0")[extra.end]); | |
| 6610 | break :owner_union @fromBackingInt(@intCast(extra_list.view().items(.@"0")[extra.end])); | |
| 6611 | 6611 | } }, |
| 6612 | 6612 | _ => |len| .{ .declared = .{ |
| 6613 | .zir_index = @enumFromInt(extra_list.view().items(.@"0")[extra.end]), | |
| 6613 | .zir_index = @fromBackingInt(@intCast(extra_list.view().items(.@"0")[extra.end])), | |
| 6614 | 6614 | .captures = .{ .owned = .{ |
| 6615 | 6615 | .tid = unwrapped_index.tid, |
| 6616 | 6616 | .start = extra.end + 1, |
| 6617 | .len = @intFromEnum(len), | |
| 6617 | .len = @backingInt(len), | |
| 6618 | 6618 | } }, |
| 6619 | 6619 | } }, |
| 6620 | 6620 | }; |
| ... | ... | @@ -6638,9 +6638,9 @@ pub fn indexToKey(ip: *const InternPool, index: Index) Key { |
| 6638 | 6638 | } }; |
| 6639 | 6639 | } }, |
| 6640 | 6640 | |
| 6641 | .undef => .{ .undef = @enumFromInt(data) }, | |
| 6641 | .undef => .{ .undef = @fromBackingInt(@intCast(data)) }, | |
| 6642 | 6642 | .opt_null => .{ .opt = .{ |
| 6643 | .ty = @enumFromInt(data), | |
| 6643 | .ty = @fromBackingInt(@intCast(data)), | |
| 6644 | 6644 | .val = .none, |
| 6645 | 6645 | } }, |
| 6646 | 6646 | .opt_payload => { |
| ... | ... | @@ -6820,7 +6820,7 @@ pub fn indexToKey(ip: *const InternPool, index: Index) Key { |
| 6820 | 6820 | .func_decl => .{ .func = extraFuncDecl(unwrapped_index.tid, unwrapped_index.getExtra(ip), data) }, |
| 6821 | 6821 | .func_coerced => .{ .func = ip.extraFuncCoerced(unwrapped_index.getExtra(ip), data) }, |
| 6822 | 6822 | .only_possible_value => { |
| 6823 | const ty: Index = @enumFromInt(data); | |
| 6823 | const ty: Index = @fromBackingInt(@intCast(data)); | |
| 6824 | 6824 | const ty_unwrapped = ty.unwrap(ip); |
| 6825 | 6825 | const ty_extra = ty_unwrapped.getExtra(ip); |
| 6826 | 6826 | const ty_item = ty_unwrapped.getItem(ip); |
| ... | ... | @@ -6912,7 +6912,7 @@ pub fn indexToKey(ip: *const InternPool, index: Index) Key { |
| 6912 | 6912 | .val = .{ .payload = extra.val }, |
| 6913 | 6913 | } }; |
| 6914 | 6914 | }, |
| 6915 | .enum_literal => .{ .enum_literal = @enumFromInt(data) }, | |
| 6915 | .enum_literal => .{ .enum_literal = @fromBackingInt(@intCast(data)) }, | |
| 6916 | 6916 | .enum_tag => .{ .enum_tag = extraData(unwrapped_index.getExtra(ip), Tag.EnumTag, data) }, |
| 6917 | 6917 | .bitpack => .{ .bitpack = extraData(unwrapped_index.getExtra(ip), Key.Bitpack, data) }, |
| 6918 | 6918 | |
| ... | ... | @@ -7015,9 +7015,9 @@ fn extraFuncInstance(ip: *const InternPool, tid: Zcu.PerThread.Id, extra: Local. |
| 7015 | 7015 | const extra_items = extra.view().items(.@"0"); |
| 7016 | 7016 | const analysis_extra_index = extra_index + std.meta.fieldIndex(Tag.FuncInstance, "analysis").?; |
| 7017 | 7017 | const analysis: FuncAnalysis = @bitCast(@atomicLoad(u32, &extra_items[analysis_extra_index], .unordered)); |
| 7018 | const owner_nav: Nav.Index = @enumFromInt(extra_items[extra_index + std.meta.fieldIndex(Tag.FuncInstance, "owner_nav").?]); | |
| 7019 | const ty: Index = @enumFromInt(extra_items[extra_index + std.meta.fieldIndex(Tag.FuncInstance, "ty").?]); | |
| 7020 | const generic_owner: Index = @enumFromInt(extra_items[extra_index + std.meta.fieldIndex(Tag.FuncInstance, "generic_owner").?]); | |
| 7018 | const owner_nav: Nav.Index = @fromBackingInt(@intCast(extra_items[extra_index + std.meta.fieldIndex(Tag.FuncInstance, "owner_nav").?])); | |
| 7019 | const ty: Index = @fromBackingInt(@intCast(extra_items[extra_index + std.meta.fieldIndex(Tag.FuncInstance, "ty").?])); | |
| 7020 | const generic_owner: Index = @fromBackingInt(@intCast(extra_items[extra_index + std.meta.fieldIndex(Tag.FuncInstance, "generic_owner").?])); | |
| 7021 | 7021 | const func_decl = ip.funcDeclInfo(generic_owner); |
| 7022 | 7022 | const end_extra_index = extra_index + @as(u32, @typeInfo(Tag.FuncInstance).@"struct".field_names.len); |
| 7023 | 7023 | return .{ |
| ... | ... | @@ -7279,7 +7279,7 @@ pub fn get(ip: *InternPool, gpa: Allocator, io: Io, tid: Zcu.PerThread.Id, key: |
| 7279 | 7279 | try items.ensureUnusedCapacity(1); |
| 7280 | 7280 | items.appendAssumeCapacity(.{ |
| 7281 | 7281 | .tag = .type_slice, |
| 7282 | .data = @intFromEnum(ptr_type_index), | |
| 7282 | .data = @backingInt(ptr_type_index), | |
| 7283 | 7283 | }); |
| 7284 | 7284 | return gop.put(); |
| 7285 | 7285 | } |
| ... | ... | @@ -7333,20 +7333,20 @@ pub fn get(ip: *InternPool, gpa: Allocator, io: Io, tid: Zcu.PerThread.Id, key: |
| 7333 | 7333 | assert(payload_type != .none); |
| 7334 | 7334 | items.appendAssumeCapacity(.{ |
| 7335 | 7335 | .tag = .type_optional, |
| 7336 | .data = @intFromEnum(payload_type), | |
| 7336 | .data = @backingInt(payload_type), | |
| 7337 | 7337 | }); |
| 7338 | 7338 | }, |
| 7339 | 7339 | .anyframe_type => |payload_type| { |
| 7340 | 7340 | // payload_type might be none, indicating the type is `anyframe`. |
| 7341 | 7341 | items.appendAssumeCapacity(.{ |
| 7342 | 7342 | .tag = .type_anyframe, |
| 7343 | .data = @intFromEnum(payload_type), | |
| 7343 | .data = @backingInt(payload_type), | |
| 7344 | 7344 | }); |
| 7345 | 7345 | }, |
| 7346 | 7346 | .error_union_type => |error_union_type| { |
| 7347 | 7347 | items.appendAssumeCapacity(if (error_union_type.error_set_type == .anyerror_type) .{ |
| 7348 | 7348 | .tag = .type_anyerror_union, |
| 7349 | .data = @intFromEnum(error_union_type.payload_type), | |
| 7349 | .data = @backingInt(error_union_type.payload_type), | |
| 7350 | 7350 | } else .{ |
| 7351 | 7351 | .tag = .type_error_union, |
| 7352 | 7352 | .data = try addExtra(extra, error_union_type), |
| ... | ... | @@ -7372,18 +7372,18 @@ pub fn get(ip: *InternPool, gpa: Allocator, io: Io, tid: Zcu.PerThread.Id, key: |
| 7372 | 7372 | .inferred_error_set_type => |ies_index| { |
| 7373 | 7373 | items.appendAssumeCapacity(.{ |
| 7374 | 7374 | .tag = .type_inferred_error_set, |
| 7375 | .data = @intFromEnum(ies_index), | |
| 7375 | .data = @backingInt(ies_index), | |
| 7376 | 7376 | }); |
| 7377 | 7377 | }, |
| 7378 | 7378 | .simple_type => |simple_type| { |
| 7379 | assert(@intFromEnum(simple_type) == items.mutate.len); | |
| 7379 | assert(@backingInt(simple_type) == items.mutate.len); | |
| 7380 | 7380 | items.appendAssumeCapacity(.{ |
| 7381 | 7381 | .tag = .simple_type, |
| 7382 | 7382 | .data = 0, // avoid writing `undefined` bits to a file |
| 7383 | 7383 | }); |
| 7384 | 7384 | }, |
| 7385 | 7385 | .simple_value => |simple_value| { |
| 7386 | assert(@intFromEnum(simple_value) == items.mutate.len); | |
| 7386 | assert(@backingInt(simple_value) == items.mutate.len); | |
| 7387 | 7387 | items.appendAssumeCapacity(.{ |
| 7388 | 7388 | .tag = .simple_value, |
| 7389 | 7389 | .data = 0, // avoid writing `undefined` bits to a file |
| ... | ... | @@ -7393,7 +7393,7 @@ pub fn get(ip: *InternPool, gpa: Allocator, io: Io, tid: Zcu.PerThread.Id, key: |
| 7393 | 7393 | assert(ty != .none); |
| 7394 | 7394 | items.appendAssumeCapacity(.{ |
| 7395 | 7395 | .tag = .undef, |
| 7396 | .data = @intFromEnum(ty), | |
| 7396 | .data = @backingInt(ty), | |
| 7397 | 7397 | }); |
| 7398 | 7398 | }, |
| 7399 | 7399 | |
| ... | ... | @@ -7535,7 +7535,7 @@ pub fn get(ip: *InternPool, gpa: Allocator, io: Io, tid: Zcu.PerThread.Id, key: |
| 7535 | 7535 | assert(opt.val == .none or ip.indexToKey(opt.ty).opt_type == ip.typeOf(opt.val)); |
| 7536 | 7536 | items.appendAssumeCapacity(if (opt.val == .none) .{ |
| 7537 | 7537 | .tag = .opt_null, |
| 7538 | .data = @intFromEnum(opt.ty), | |
| 7538 | .data = @backingInt(opt.ty), | |
| 7539 | 7539 | } else .{ |
| 7540 | 7540 | .tag = .opt_payload, |
| 7541 | 7541 | .data = try addExtra(extra, Tag.TypeValue{ |
| ... | ... | @@ -7735,7 +7735,7 @@ pub fn get(ip: *InternPool, gpa: Allocator, io: Io, tid: Zcu.PerThread.Id, key: |
| 7735 | 7735 | |
| 7736 | 7736 | .enum_literal => |enum_literal| items.appendAssumeCapacity(.{ |
| 7737 | 7737 | .tag = .enum_literal, |
| 7738 | .data = @intFromEnum(enum_literal), | |
| 7738 | .data = @backingInt(enum_literal), | |
| 7739 | 7739 | }), |
| 7740 | 7740 | |
| 7741 | 7741 | .enum_tag => |enum_tag| { |
| ... | ... | @@ -7849,7 +7849,7 @@ pub fn get(ip: *InternPool, gpa: Allocator, io: Io, tid: Zcu.PerThread.Id, key: |
| 7849 | 7849 | if (len == 0) { |
| 7850 | 7850 | items.appendAssumeCapacity(.{ |
| 7851 | 7851 | .tag = .only_possible_value, |
| 7852 | .data = @intFromEnum(aggregate.ty), | |
| 7852 | .data = @backingInt(aggregate.ty), | |
| 7853 | 7853 | }); |
| 7854 | 7854 | return gop.put(); |
| 7855 | 7855 | } |
| ... | ... | @@ -7882,7 +7882,7 @@ pub fn get(ip: *InternPool, gpa: Allocator, io: Io, tid: Zcu.PerThread.Id, key: |
| 7882 | 7882 | // in the aggregate fields. |
| 7883 | 7883 | items.appendAssumeCapacity(.{ |
| 7884 | 7884 | .tag = .only_possible_value, |
| 7885 | .data = @intFromEnum(aggregate.ty), | |
| 7885 | .data = @backingInt(aggregate.ty), | |
| 7886 | 7886 | }); |
| 7887 | 7887 | return gop.put(); |
| 7888 | 7888 | }, |
| ... | ... | @@ -7977,7 +7977,7 @@ pub fn get(ip: *InternPool, gpa: Allocator, io: Io, tid: Zcu.PerThread.Id, key: |
| 7977 | 7977 | }), |
| 7978 | 7978 | }); |
| 7979 | 7979 | extra.appendSliceAssumeCapacity(.{@ptrCast(aggregate.storage.elems)}); |
| 7980 | if (sentinel != .none) extra.appendAssumeCapacity(.{@intFromEnum(sentinel)}); | |
| 7980 | if (sentinel != .none) extra.appendAssumeCapacity(.{@backingInt(sentinel)}); | |
| 7981 | 7981 | }, |
| 7982 | 7982 | .bitpack => |bitpack| { |
| 7983 | 7983 | switch (ip.zigTypeTag(bitpack.ty)) { |
| ... | ... | @@ -8066,7 +8066,7 @@ pub fn getDeclaredStructType( |
| 8066 | 8066 | const extra_index = addExtraAssumeCapacity(extra, Tag.TypeStructPacked{ |
| 8067 | 8067 | .zir_index = ini.zir_index, |
| 8068 | 8068 | .bits = .{ |
| 8069 | .captures_len = @enumFromInt(ini.captures.len), | |
| 8069 | .captures_len = @fromBackingInt(@intCast(ini.captures.len)), | |
| 8070 | 8070 | .want_layout = false, |
| 8071 | 8071 | }, |
| 8072 | 8072 | .name = undefined, // set by `finish` |
| ... | ... | @@ -8077,10 +8077,10 @@ pub fn getDeclaredStructType( |
| 8077 | 8077 | .field_name_map = field_name_map, |
| 8078 | 8078 | }); |
| 8079 | 8079 | extra.appendSliceAssumeCapacity(.{@ptrCast(ini.captures)}); // capture |
| 8080 | extra.appendNTimesAssumeCapacity(.{@intFromEnum(NullTerminatedString.empty)}, ini.fields_len); // field_name | |
| 8081 | extra.appendNTimesAssumeCapacity(.{@intFromEnum(Index.none)}, ini.fields_len); // field_type | |
| 8080 | extra.appendNTimesAssumeCapacity(.{@backingInt(NullTerminatedString.empty)}, ini.fields_len); // field_name | |
| 8081 | extra.appendNTimesAssumeCapacity(.{@backingInt(Index.none)}, ini.fields_len); // field_type | |
| 8082 | 8082 | if (ini.any_field_defaults) { |
| 8083 | extra.appendNTimesAssumeCapacity(.{@intFromEnum(Index.none)}, ini.fields_len); // field_default | |
| 8083 | extra.appendNTimesAssumeCapacity(.{@backingInt(Index.none)}, ini.fields_len); // field_default | |
| 8084 | 8084 | } |
| 8085 | 8085 | items.appendAssumeCapacity(.{ |
| 8086 | 8086 | .tag = switch (ini.packed_backing_mode) { |
| ... | ... | @@ -8138,10 +8138,10 @@ pub fn getDeclaredStructType( |
| 8138 | 8138 | extra.appendAssumeCapacity(.{@intCast(ini.captures.len)}); // captures_len |
| 8139 | 8139 | extra.appendSliceAssumeCapacity(.{@ptrCast(ini.captures)}); // capture |
| 8140 | 8140 | } |
| 8141 | extra.appendNTimesAssumeCapacity(.{@intFromEnum(NullTerminatedString.empty)}, ini.fields_len); // field_name | |
| 8142 | extra.appendNTimesAssumeCapacity(.{@intFromEnum(Index.none)}, ini.fields_len); // field_type | |
| 8141 | extra.appendNTimesAssumeCapacity(.{@backingInt(NullTerminatedString.empty)}, ini.fields_len); // field_name | |
| 8142 | extra.appendNTimesAssumeCapacity(.{@backingInt(Index.none)}, ini.fields_len); // field_type | |
| 8143 | 8143 | if (ini.any_field_defaults) { |
| 8144 | extra.appendNTimesAssumeCapacity(.{@intFromEnum(Index.none)}, ini.fields_len); // field_default | |
| 8144 | extra.appendNTimesAssumeCapacity(.{@backingInt(Index.none)}, ini.fields_len); // field_default | |
| 8145 | 8145 | } |
| 8146 | 8146 | if (ini.any_field_aligns) { |
| 8147 | 8147 | extra.appendNTimesAssumeCapacity(.{0}, (ini.fields_len + 3) / 4); // field_align |
| ... | ... | @@ -8150,7 +8150,7 @@ pub fn getDeclaredStructType( |
| 8150 | 8150 | extra.appendNTimesAssumeCapacity(.{0}, (ini.fields_len + 31) / 32); // field_is_comptime_bits |
| 8151 | 8151 | } |
| 8152 | 8152 | if (!is_extern) { |
| 8153 | extra.appendNTimesAssumeCapacity(.{@intFromEnum(LoadedStructType.RuntimeOrder.unresolved)}, ini.fields_len); // field_runtime_order | |
| 8153 | extra.appendNTimesAssumeCapacity(.{@backingInt(LoadedStructType.RuntimeOrder.unresolved)}, ini.fields_len); // field_runtime_order | |
| 8154 | 8154 | } |
| 8155 | 8155 | extra.appendNTimesAssumeCapacity(.{0}, ini.fields_len); // field_offset |
| 8156 | 8156 | items.appendAssumeCapacity(.{ |
| ... | ... | @@ -8222,12 +8222,12 @@ pub fn getReifiedStructType(ip: *InternPool, gpa: Allocator, io: Io, tid: Zcu.Pe |
| 8222 | 8222 | }); |
| 8223 | 8223 | _ = addExtraAssumeCapacity(extra, PackedU64.init(ini.type_hash)); // type_hash |
| 8224 | 8224 | const field_names_start = extra.mutate.len; |
| 8225 | extra.appendNTimesAssumeCapacity(.{@intFromEnum(NullTerminatedString.empty)}, ini.fields_len); // field_name | |
| 8225 | extra.appendNTimesAssumeCapacity(.{@backingInt(NullTerminatedString.empty)}, ini.fields_len); // field_name | |
| 8226 | 8226 | const field_types_start = extra.mutate.len; |
| 8227 | extra.appendNTimesAssumeCapacity(.{@intFromEnum(Index.none)}, ini.fields_len); // field_type | |
| 8227 | extra.appendNTimesAssumeCapacity(.{@backingInt(Index.none)}, ini.fields_len); // field_type | |
| 8228 | 8228 | const field_defaults_start = extra.mutate.len; |
| 8229 | 8229 | if (ini.any_field_defaults) { |
| 8230 | extra.appendNTimesAssumeCapacity(.{@intFromEnum(Index.none)}, ini.fields_len); // field_default | |
| 8230 | extra.appendNTimesAssumeCapacity(.{@backingInt(Index.none)}, ini.fields_len); // field_default | |
| 8231 | 8231 | } |
| 8232 | 8232 | items.appendAssumeCapacity(.{ |
| 8233 | 8233 | .tag = switch (ini.packed_backing_int_type) { |
| ... | ... | @@ -8285,12 +8285,12 @@ pub fn getReifiedStructType(ip: *InternPool, gpa: Allocator, io: Io, tid: Zcu.Pe |
| 8285 | 8285 | }); |
| 8286 | 8286 | _ = addExtraAssumeCapacity(extra, PackedU64.init(ini.type_hash)); // type_hash |
| 8287 | 8287 | const field_names_start = extra.mutate.len; |
| 8288 | extra.appendNTimesAssumeCapacity(.{@intFromEnum(NullTerminatedString.empty)}, ini.fields_len); // field_name | |
| 8288 | extra.appendNTimesAssumeCapacity(.{@backingInt(NullTerminatedString.empty)}, ini.fields_len); // field_name | |
| 8289 | 8289 | const field_types_start = extra.mutate.len; |
| 8290 | extra.appendNTimesAssumeCapacity(.{@intFromEnum(Index.none)}, ini.fields_len); // field_type | |
| 8290 | extra.appendNTimesAssumeCapacity(.{@backingInt(Index.none)}, ini.fields_len); // field_type | |
| 8291 | 8291 | const field_defaults_start = extra.mutate.len; |
| 8292 | 8292 | if (ini.any_field_defaults) { |
| 8293 | extra.appendNTimesAssumeCapacity(.{@intFromEnum(Index.none)}, ini.fields_len); // field_default | |
| 8293 | extra.appendNTimesAssumeCapacity(.{@backingInt(Index.none)}, ini.fields_len); // field_default | |
| 8294 | 8294 | } |
| 8295 | 8295 | const field_aligns_start = extra.mutate.len; |
| 8296 | 8296 | if (ini.any_field_aligns) { |
| ... | ... | @@ -8301,7 +8301,7 @@ pub fn getReifiedStructType(ip: *InternPool, gpa: Allocator, io: Io, tid: Zcu.Pe |
| 8301 | 8301 | extra.appendNTimesAssumeCapacity(.{0}, (ini.fields_len + 31) / 32); // field_is_comptime_bits |
| 8302 | 8302 | } |
| 8303 | 8303 | if (!is_extern) { |
| 8304 | extra.appendNTimesAssumeCapacity(.{@intFromEnum(LoadedStructType.RuntimeOrder.unresolved)}, ini.fields_len); // field_runtime_order | |
| 8304 | extra.appendNTimesAssumeCapacity(.{@backingInt(LoadedStructType.RuntimeOrder.unresolved)}, ini.fields_len); // field_runtime_order | |
| 8305 | 8305 | } |
| 8306 | 8306 | extra.appendNTimesAssumeCapacity(.{0}, ini.fields_len); // field_offset |
| 8307 | 8307 | items.appendAssumeCapacity(.{ |
| ... | ... | @@ -8381,7 +8381,7 @@ pub fn getDeclaredUnionType( |
| 8381 | 8381 | const extra_index = addExtraAssumeCapacity(extra, Tag.TypeUnionPacked{ |
| 8382 | 8382 | .zir_index = ini.zir_index, |
| 8383 | 8383 | .bits = .{ |
| 8384 | .captures_len = @enumFromInt(ini.captures.len), | |
| 8384 | .captures_len = @fromBackingInt(@intCast(ini.captures.len)), | |
| 8385 | 8385 | .want_layout = false, |
| 8386 | 8386 | }, |
| 8387 | 8387 | .name = undefined, // set by `finish` |
| ... | ... | @@ -8392,7 +8392,7 @@ pub fn getDeclaredUnionType( |
| 8392 | 8392 | .fields_len = ini.fields_len, |
| 8393 | 8393 | }); |
| 8394 | 8394 | extra.appendSliceAssumeCapacity(.{@ptrCast(ini.captures)}); // capture |
| 8395 | extra.appendNTimesAssumeCapacity(.{@intFromEnum(Index.none)}, ini.fields_len); // field_type | |
| 8395 | extra.appendNTimesAssumeCapacity(.{@backingInt(Index.none)}, ini.fields_len); // field_type | |
| 8396 | 8396 | items.appendAssumeCapacity(.{ |
| 8397 | 8397 | .tag = switch (ini.packed_backing_mode) { |
| 8398 | 8398 | .auto => .type_union_packed_auto, |
| ... | ... | @@ -8446,7 +8446,7 @@ pub fn getDeclaredUnionType( |
| 8446 | 8446 | extra.appendAssumeCapacity(.{@intCast(ini.captures.len)}); // captures_len |
| 8447 | 8447 | extra.appendSliceAssumeCapacity(.{@ptrCast(ini.captures)}); // capture |
| 8448 | 8448 | } |
| 8449 | extra.appendNTimesAssumeCapacity(.{@intFromEnum(Index.none)}, ini.fields_len); // field_type | |
| 8449 | extra.appendNTimesAssumeCapacity(.{@backingInt(Index.none)}, ini.fields_len); // field_type | |
| 8450 | 8450 | if (ini.any_field_aligns) { |
| 8451 | 8451 | extra.appendNTimesAssumeCapacity(.{0}, (ini.fields_len + 3) / 4); // field_align |
| 8452 | 8452 | } |
| ... | ... | @@ -8516,9 +8516,9 @@ pub fn getReifiedUnionType(ip: *InternPool, gpa: Allocator, io: Io, tid: Zcu.Per |
| 8516 | 8516 | }); |
| 8517 | 8517 | _ = addExtraAssumeCapacity(extra, PackedU64.init(ini.type_hash)); // type_hash |
| 8518 | 8518 | const field_names_start = extra.mutate.len; |
| 8519 | extra.appendNTimesAssumeCapacity(.{@intFromEnum(NullTerminatedString.empty)}, ini.fields_len); // reified_field_name | |
| 8519 | extra.appendNTimesAssumeCapacity(.{@backingInt(NullTerminatedString.empty)}, ini.fields_len); // reified_field_name | |
| 8520 | 8520 | const field_types_start = extra.mutate.len; |
| 8521 | extra.appendNTimesAssumeCapacity(.{@intFromEnum(Index.none)}, ini.fields_len); // field_type | |
| 8521 | extra.appendNTimesAssumeCapacity(.{@backingInt(Index.none)}, ini.fields_len); // field_type | |
| 8522 | 8522 | items.appendAssumeCapacity(.{ |
| 8523 | 8523 | .tag = switch (ini.packed_backing_int_type) { |
| 8524 | 8524 | .none => .type_union_packed_auto, |
| ... | ... | @@ -8570,9 +8570,9 @@ pub fn getReifiedUnionType(ip: *InternPool, gpa: Allocator, io: Io, tid: Zcu.Per |
| 8570 | 8570 | }); |
| 8571 | 8571 | _ = addExtraAssumeCapacity(extra, PackedU64.init(ini.type_hash)); |
| 8572 | 8572 | const field_names_start = extra.mutate.len; |
| 8573 | extra.appendNTimesAssumeCapacity(.{@intFromEnum(NullTerminatedString.empty)}, ini.fields_len); // reified_field_name | |
| 8573 | extra.appendNTimesAssumeCapacity(.{@backingInt(NullTerminatedString.empty)}, ini.fields_len); // reified_field_name | |
| 8574 | 8574 | const field_types_start = extra.mutate.len; |
| 8575 | extra.appendNTimesAssumeCapacity(.{@intFromEnum(Index.none)}, ini.fields_len); // field_type | |
| 8575 | extra.appendNTimesAssumeCapacity(.{@backingInt(Index.none)}, ini.fields_len); // field_type | |
| 8576 | 8576 | const field_aligns_start = extra.mutate.len; |
| 8577 | 8577 | if (ini.any_field_aligns) { |
| 8578 | 8578 | extra.appendNTimesAssumeCapacity(.{0}, (ini.fields_len + 3) / 4); // field_align |
| ... | ... | @@ -8657,7 +8657,7 @@ pub fn getDeclaredEnumType( |
| 8657 | 8657 | |
| 8658 | 8658 | const extra_index = addExtraAssumeCapacity(extra, Tag.TypeEnum{ |
| 8659 | 8659 | .bits = .{ |
| 8660 | .captures_len = @enumFromInt(ini.captures.len), | |
| 8660 | .captures_len = @fromBackingInt(@intCast(ini.captures.len)), | |
| 8661 | 8661 | .want_layout = false, |
| 8662 | 8662 | }, |
| 8663 | 8663 | .name = undefined, // set by `finish` |
| ... | ... | @@ -8667,11 +8667,11 @@ pub fn getDeclaredEnumType( |
| 8667 | 8667 | .fields_len = ini.fields_len, |
| 8668 | 8668 | .field_name_map = field_name_map, |
| 8669 | 8669 | }); |
| 8670 | extra.appendAssumeCapacity(.{@intFromEnum(ini.zir_index)}); // zir_index | |
| 8670 | extra.appendAssumeCapacity(.{@backingInt(ini.zir_index)}); // zir_index | |
| 8671 | 8671 | extra.appendSliceAssumeCapacity(.{@ptrCast(ini.captures)}); // capture |
| 8672 | if (have_values) extra.appendAssumeCapacity(.{@intFromEnum(field_value_map)}); // field_value_map | |
| 8673 | extra.appendNTimesAssumeCapacity(.{@intFromEnum(NullTerminatedString.empty)}, ini.fields_len); // field_name | |
| 8674 | if (have_values) extra.appendNTimesAssumeCapacity(.{@intFromEnum(Index.none)}, ini.fields_len); // field_value | |
| 8672 | if (have_values) extra.appendAssumeCapacity(.{@backingInt(field_value_map)}); // field_value_map | |
| 8673 | extra.appendNTimesAssumeCapacity(.{@backingInt(NullTerminatedString.empty)}, ini.fields_len); // field_name | |
| 8674 | if (have_values) extra.appendNTimesAssumeCapacity(.{@backingInt(Index.none)}, ini.fields_len); // field_value | |
| 8675 | 8675 | items.appendAssumeCapacity(.{ |
| 8676 | 8676 | .tag = tag, |
| 8677 | 8677 | .data = extra_index, |
| ... | ... | @@ -8742,13 +8742,13 @@ pub fn getReifiedEnumType(ip: *InternPool, gpa: Allocator, io: Io, tid: Zcu.PerT |
| 8742 | 8742 | .fields_len = ini.fields_len, |
| 8743 | 8743 | .field_name_map = field_name_map, |
| 8744 | 8744 | }); |
| 8745 | extra.appendAssumeCapacity(.{@intFromEnum(ini.zir_index)}); // zir_index | |
| 8745 | extra.appendAssumeCapacity(.{@backingInt(ini.zir_index)}); // zir_index | |
| 8746 | 8746 | _ = addExtraAssumeCapacity(extra, PackedU64.init(ini.type_hash)); // type_hash |
| 8747 | if (have_values) extra.appendAssumeCapacity(.{@intFromEnum(field_value_map)}); // field_value_map | |
| 8747 | if (have_values) extra.appendAssumeCapacity(.{@backingInt(field_value_map)}); // field_value_map | |
| 8748 | 8748 | const field_names_start = extra.mutate.len; |
| 8749 | extra.appendNTimesAssumeCapacity(.{@intFromEnum(NullTerminatedString.empty)}, ini.fields_len); // field_name | |
| 8749 | extra.appendNTimesAssumeCapacity(.{@backingInt(NullTerminatedString.empty)}, ini.fields_len); // field_name | |
| 8750 | 8750 | const field_values_start = extra.mutate.len; |
| 8751 | if (have_values) extra.appendNTimesAssumeCapacity(.{@intFromEnum(Index.none)}, ini.fields_len); // field_value | |
| 8751 | if (have_values) extra.appendNTimesAssumeCapacity(.{@backingInt(Index.none)}, ini.fields_len); // field_value | |
| 8752 | 8752 | items.appendAssumeCapacity(.{ |
| 8753 | 8753 | .tag = tag, |
| 8754 | 8754 | .data = extra_index, |
| ... | ... | @@ -8841,10 +8841,10 @@ pub fn getGeneratedEnumTagType(ip: *InternPool, gpa: Allocator, io: Io, tid: Zcu |
| 8841 | 8841 | .fields_len = ini.fields_len, |
| 8842 | 8842 | .field_name_map = field_name_map, |
| 8843 | 8843 | }); |
| 8844 | extra.appendAssumeCapacity(.{@intFromEnum(ini.union_type)}); // owner_union | |
| 8845 | if (have_values) extra.appendAssumeCapacity(.{@intFromEnum(field_value_map)}); | |
| 8846 | extra.appendNTimesAssumeCapacity(.{@intFromEnum(NullTerminatedString.empty)}, ini.fields_len); // field_name | |
| 8847 | if (have_values) extra.appendNTimesAssumeCapacity(.{@intFromEnum(Index.none)}, ini.fields_len); // field_value | |
| 8844 | extra.appendAssumeCapacity(.{@backingInt(ini.union_type)}); // owner_union | |
| 8845 | if (have_values) extra.appendAssumeCapacity(.{@backingInt(field_value_map)}); | |
| 8846 | extra.appendNTimesAssumeCapacity(.{@backingInt(NullTerminatedString.empty)}, ini.fields_len); // field_name | |
| 8847 | if (have_values) extra.appendNTimesAssumeCapacity(.{@backingInt(Index.none)}, ini.fields_len); // field_value | |
| 8848 | 8848 | items.appendAssumeCapacity(.{ |
| 8849 | 8849 | .tag = switch (ini.int_tag_mode) { |
| 8850 | 8850 | .auto => .type_enum_auto, |
| ... | ... | @@ -8936,8 +8936,8 @@ pub const WipContainerType = struct { |
| 8936 | 8936 | ) void { |
| 8937 | 8937 | const extra = ip.getLocalShared(wip.tid).extra.acquire(); |
| 8938 | 8938 | const extra_items = extra.view().items(.@"0"); |
| 8939 | extra_items[wip.type_name_index] = @intFromEnum(type_name); | |
| 8940 | extra_items[wip.name_nav_index] = @intFromEnum(name_nav); | |
| 8939 | extra_items[wip.type_name_index] = @backingInt(type_name); | |
| 8940 | extra_items[wip.name_nav_index] = @backingInt(name_nav); | |
| 8941 | 8941 | } |
| 8942 | 8942 | |
| 8943 | 8943 | pub fn finish( |
| ... | ... | @@ -8948,7 +8948,7 @@ pub const WipContainerType = struct { |
| 8948 | 8948 | const extra = ip.getLocalShared(wip.tid).extra.acquire(); |
| 8949 | 8949 | const extra_items = extra.view().items(.@"0"); |
| 8950 | 8950 | |
| 8951 | extra_items[wip.namespace_index] = @intFromEnum(namespace); | |
| 8951 | extra_items[wip.namespace_index] = @backingInt(namespace); | |
| 8952 | 8952 | |
| 8953 | 8953 | return wip.index; |
| 8954 | 8954 | } |
| ... | ... | @@ -9361,7 +9361,7 @@ pub fn getFuncDeclIes( |
| 9361 | 9361 | .lbrace_column = key.lbrace_column, |
| 9362 | 9362 | .rbrace_column = key.rbrace_column, |
| 9363 | 9363 | }); |
| 9364 | extra.appendAssumeCapacity(.{@intFromEnum(Index.none)}); | |
| 9364 | extra.appendAssumeCapacity(.{@backingInt(Index.none)}); | |
| 9365 | 9365 | |
| 9366 | 9366 | const func_type_extra_index = addExtraAssumeCapacity(extra, Tag.TypeFunction{ |
| 9367 | 9367 | .params_len = params_len, |
| ... | ... | @@ -9391,7 +9391,7 @@ pub fn getFuncDeclIes( |
| 9391 | 9391 | .error_set_type = error_set_type, |
| 9392 | 9392 | .payload_type = key.bare_return_type, |
| 9393 | 9393 | }), |
| 9394 | @intFromEnum(func_index), | |
| 9394 | @backingInt(func_index), | |
| 9395 | 9395 | func_type_extra_index, |
| 9396 | 9396 | }, |
| 9397 | 9397 | }); |
| ... | ... | @@ -9659,7 +9659,7 @@ fn getFuncInstanceIes( |
| 9659 | 9659 | .branch_quota = 0, |
| 9660 | 9660 | .generic_owner = generic_owner, |
| 9661 | 9661 | }); |
| 9662 | extra.appendAssumeCapacity(.{@intFromEnum(Index.none)}); // resolved error set | |
| 9662 | extra.appendAssumeCapacity(.{@backingInt(Index.none)}); // resolved error set | |
| 9663 | 9663 | extra.appendSliceAssumeCapacity(.{@ptrCast(arg.comptime_args)}); |
| 9664 | 9664 | |
| 9665 | 9665 | const func_type_extra_index = addExtraAssumeCapacity(extra, Tag.TypeFunction{ |
| ... | ... | @@ -9690,7 +9690,7 @@ fn getFuncInstanceIes( |
| 9690 | 9690 | .error_set_type = error_set_type, |
| 9691 | 9691 | .payload_type = arg.bare_return_type, |
| 9692 | 9692 | }), |
| 9693 | @intFromEnum(func_index), | |
| 9693 | @backingInt(func_index), | |
| 9694 | 9694 | func_type_extra_index, |
| 9695 | 9695 | }, |
| 9696 | 9696 | }); |
| ... | ... | @@ -9759,7 +9759,7 @@ fn finishFuncInstance( |
| 9759 | 9759 | |
| 9760 | 9760 | // TODO: improve this name |
| 9761 | 9761 | const nav_name = try ip.getOrPutStringFmt(gpa, io, tid, "{f}__anon_{d}", .{ |
| 9762 | fn_owner_nav.name.fmt(ip), @intFromEnum(func_index), | |
| 9762 | fn_owner_nav.name.fmt(ip), @backingInt(func_index), | |
| 9763 | 9763 | }, .no_embedded_nulls); |
| 9764 | 9764 | const nav_fqn = try ip.namespacePtr(fn_namespace).internFullyQualifiedName(ip, gpa, io, tid, nav_name); |
| 9765 | 9765 | const nav_index = try ip.createNav(gpa, io, tid, nav_name, nav_fqn, .{ |
| ... | ... | @@ -9776,7 +9776,7 @@ fn finishFuncInstance( |
| 9776 | 9776 | // Populate the owner_nav field which was left undefined until now. |
| 9777 | 9777 | extra.view().items(.@"0")[ |
| 9778 | 9778 | func_extra_index + std.meta.fieldIndex(Tag.FuncInstance, "owner_nav").? |
| 9779 | ] = @intFromEnum(nav_index); | |
| 9779 | ] = @backingInt(nav_index); | |
| 9780 | 9780 | } |
| 9781 | 9781 | |
| 9782 | 9782 | pub fn getIfExists(ip: *const InternPool, key: Key) ?Index { |
| ... | ... | @@ -9891,7 +9891,7 @@ fn addExtraAssumeCapacity(extra: Local.Extra.Mutable, item: anytype) u32 { |
| 9891 | 9891 | TrackedInst.Index, |
| 9892 | 9892 | TrackedInst.Index.Optional, |
| 9893 | 9893 | ComptimeAllocIndex, |
| 9894 | => @intFromEnum(@field(item, field_name)), | |
| 9894 | => @backingInt(@field(item, field_name)), | |
| 9895 | 9895 | |
| 9896 | 9896 | u32, |
| 9897 | 9897 | i32, |
| ... | ... | @@ -9925,7 +9925,7 @@ fn addLimbsExtraAssumeCapacity(ip: *InternPool, extra: anytype) u32 { |
| 9925 | 9925 | inline for (info.field_names, info.field_types, 0..) |field_name, field_type, i| { |
| 9926 | 9926 | const new: u32 = switch (field_type) { |
| 9927 | 9927 | u32 => @field(extra, field_name), |
| 9928 | Index => @intFromEnum(@field(extra, field_name)), | |
| 9928 | Index => @backingInt(@field(extra, field_name)), | |
| 9929 | 9929 | else => @compileError("bad field type: " ++ @typeName(field_type)), |
| 9930 | 9930 | }; |
| 9931 | 9931 | if (i % 2 == 0) { |
| ... | ... | @@ -9959,7 +9959,7 @@ fn extraDataTrail(extra: Local.Extra, comptime T: type, index: u32) struct { dat |
| 9959 | 9959 | TrackedInst.Index, |
| 9960 | 9960 | TrackedInst.Index.Optional, |
| 9961 | 9961 | ComptimeAllocIndex, |
| 9962 | => @enumFromInt(extra_item), | |
| 9962 | => @fromBackingInt(@intCast(extra_item)), | |
| 9963 | 9963 | |
| 9964 | 9964 | u32, |
| 9965 | 9965 | i32, |
| ... | ... | @@ -10047,7 +10047,7 @@ pub fn slicePtrType(ip: *const InternPool, index: Index) Index { |
| 10047 | 10047 | } |
| 10048 | 10048 | const item = index.unwrap(ip).getItem(ip); |
| 10049 | 10049 | switch (item.tag) { |
| 10050 | .type_slice => return @enumFromInt(item.data), | |
| 10050 | .type_slice => return @fromBackingInt(@intCast(item.data)), | |
| 10051 | 10051 | else => unreachable, // not a slice type |
| 10052 | 10052 | } |
| 10053 | 10053 | } |
| ... | ... | @@ -10135,9 +10135,9 @@ pub fn getCoerced( |
| 10135 | 10135 | .func_decl => return getCoercedFuncDecl(ip, gpa, io, tid, val, new_ty), |
| 10136 | 10136 | .func_instance => return getCoercedFuncInstance(ip, gpa, io, tid, val, new_ty), |
| 10137 | 10137 | .func_coerced => { |
| 10138 | const func: Index = @enumFromInt(unwrapped_val.getExtra(ip).view().items(.@"0")[ | |
| 10138 | const func: Index = @fromBackingInt(@intCast(unwrapped_val.getExtra(ip).view().items(.@"0")[ | |
| 10139 | 10139 | val_item.data + std.meta.fieldIndex(Tag.FuncCoerced, "func").? |
| 10140 | ]); | |
| 10140 | ])); | |
| 10141 | 10141 | switch (func.unwrap(ip).getTag(ip)) { |
| 10142 | 10142 | .func_decl => return getCoercedFuncDecl(ip, gpa, io, tid, func, new_ty), |
| 10143 | 10143 | .func_instance => return getCoercedFuncInstance(ip, gpa, io, tid, func, new_ty), |
| ... | ... | @@ -10378,9 +10378,9 @@ fn getCoercedFuncDecl( |
| 10378 | 10378 | new_ty: Index, |
| 10379 | 10379 | ) Allocator.Error!Index { |
| 10380 | 10380 | const unwrapped_val = val.unwrap(ip); |
| 10381 | const prev_ty: Index = @enumFromInt(unwrapped_val.getExtra(ip).view().items(.@"0")[ | |
| 10381 | const prev_ty: Index = @fromBackingInt(@intCast(unwrapped_val.getExtra(ip).view().items(.@"0")[ | |
| 10382 | 10382 | unwrapped_val.getData(ip) + std.meta.fieldIndex(Tag.FuncDecl, "ty").? |
| 10383 | ]); | |
| 10383 | ])); | |
| 10384 | 10384 | if (new_ty == prev_ty) return val; |
| 10385 | 10385 | return getCoercedFunc(ip, gpa, io, tid, val, new_ty); |
| 10386 | 10386 | } |
| ... | ... | @@ -10394,9 +10394,9 @@ fn getCoercedFuncInstance( |
| 10394 | 10394 | new_ty: Index, |
| 10395 | 10395 | ) Allocator.Error!Index { |
| 10396 | 10396 | const unwrapped_val = val.unwrap(ip); |
| 10397 | const prev_ty: Index = @enumFromInt(unwrapped_val.getExtra(ip).view().items(.@"0")[ | |
| 10397 | const prev_ty: Index = @fromBackingInt(@intCast(unwrapped_val.getExtra(ip).view().items(.@"0")[ | |
| 10398 | 10398 | unwrapped_val.getData(ip) + std.meta.fieldIndex(Tag.FuncInstance, "ty").? |
| 10399 | ]); | |
| 10399 | ])); | |
| 10400 | 10400 | if (new_ty == prev_ty) return val; |
| 10401 | 10401 | return getCoercedFunc(ip, gpa, io, tid, val, new_ty); |
| 10402 | 10402 | } |
| ... | ... | @@ -10739,7 +10739,7 @@ fn dumpStatsFallible(ip: *const InternPool, w: *Io.Writer, arena: Allocator) !vo |
| 10739 | 10739 | const extra = extraDataTrail(extra_list, Tag.TypeStructPacked, data); |
| 10740 | 10740 | switch (extra.data.bits.captures_len) { |
| 10741 | 10741 | .reified => n += 2, // type_hash: PackedU64 |
| 10742 | _ => |len| n += @intFromEnum(len), // capture: CaptureValue | |
| 10742 | _ => |len| n += @backingInt(len), // capture: CaptureValue | |
| 10743 | 10743 | } |
| 10744 | 10744 | n += extra.data.fields_len; // field_name: NullTerminatedString |
| 10745 | 10745 | n += extra.data.fields_len; // field_type: Index |
| ... | ... | @@ -10750,7 +10750,7 @@ fn dumpStatsFallible(ip: *const InternPool, w: *Io.Writer, arena: Allocator) !vo |
| 10750 | 10750 | const extra = extraDataTrail(extra_list, Tag.TypeStructPacked, data); |
| 10751 | 10751 | switch (extra.data.bits.captures_len) { |
| 10752 | 10752 | .reified => n += 2, // type_hash: PackedU64 |
| 10753 | _ => |len| n += @intFromEnum(len), // capture: CaptureValue | |
| 10753 | _ => |len| n += @backingInt(len), // capture: CaptureValue | |
| 10754 | 10754 | } |
| 10755 | 10755 | n += extra.data.fields_len; // field_name: NullTerminatedString |
| 10756 | 10756 | n += extra.data.fields_len; // field_type: Index |
| ... | ... | @@ -10779,7 +10779,7 @@ fn dumpStatsFallible(ip: *const InternPool, w: *Io.Writer, arena: Allocator) !vo |
| 10779 | 10779 | const extra = extraDataTrail(extra_list, Tag.TypeUnionPacked, data); |
| 10780 | 10780 | switch (extra.data.bits.captures_len) { |
| 10781 | 10781 | .reified => n += 2, // type_hash: PackedU64 |
| 10782 | _ => |len| n += @intFromEnum(len), // capture: CaptureValue | |
| 10782 | _ => |len| n += @backingInt(len), // capture: CaptureValue | |
| 10783 | 10783 | } |
| 10784 | 10784 | n += extra.data.fields_len; // field_type: Index |
| 10785 | 10785 | break :b n * @sizeOf(u32); |
| ... | ... | @@ -10795,7 +10795,7 @@ fn dumpStatsFallible(ip: *const InternPool, w: *Io.Writer, arena: Allocator) !vo |
| 10795 | 10795 | }, |
| 10796 | 10796 | _ => |len| { |
| 10797 | 10797 | n += 1; // zir_index: TrackedInst.Index, |
| 10798 | n += @intFromEnum(len); // capture: CaptureValue | |
| 10798 | n += @backingInt(len); // capture: CaptureValue | |
| 10799 | 10799 | }, |
| 10800 | 10800 | } |
| 10801 | 10801 | n += extra.fields_len; // field_name: NullTerminatedString |
| ... | ... | @@ -10812,7 +10812,7 @@ fn dumpStatsFallible(ip: *const InternPool, w: *Io.Writer, arena: Allocator) !vo |
| 10812 | 10812 | }, |
| 10813 | 10813 | _ => |len| { |
| 10814 | 10814 | n += 1; // zir_index: TrackedInst.Index, |
| 10815 | n += @intFromEnum(len); // capture: CaptureValue | |
| 10815 | n += @backingInt(len); // capture: CaptureValue | |
| 10816 | 10816 | }, |
| 10817 | 10817 | } |
| 10818 | 10818 | n += 1; // field_value_map: MapIndex |
| ... | ... | @@ -10931,13 +10931,13 @@ fn dumpAllFallible(ip: *const InternPool, w: *Io.Writer) anyerror!void { |
| 10931 | 10931 | items.items(.data)[0..local.mutate.items.len], |
| 10932 | 10932 | 0.., |
| 10933 | 10933 | ) |tag, data, index| { |
| 10934 | const i = Index.Unwrapped.wrap(.{ .tid = @enumFromInt(tid), .index = @intCast(index) }, ip); | |
| 10934 | const i = Index.Unwrapped.wrap(.{ .tid = @fromBackingInt(@intCast(tid)), .index = @intCast(index) }, ip); | |
| 10935 | 10935 | try w.print("${d} = {s}(", .{ i, @tagName(tag) }); |
| 10936 | 10936 | switch (tag) { |
| 10937 | 10937 | .removed => {}, |
| 10938 | 10938 | |
| 10939 | .simple_type => try w.print("{s}", .{@tagName(@as(SimpleType, @enumFromInt(@intFromEnum(i))))}), | |
| 10940 | .simple_value => try w.print("{s}", .{@tagName(@as(SimpleValue, @enumFromInt(@intFromEnum(i))))}), | |
| 10939 | .simple_type => try w.print("{s}", .{@tagName(@as(SimpleType, @fromBackingInt(@intCast(@backingInt(i)))))}), | |
| 10940 | .simple_value => try w.print("{s}", .{@tagName(@as(SimpleValue, @fromBackingInt(@intCast(@backingInt(i)))))}), | |
| 10941 | 10941 | |
| 10942 | 10942 | .type_int_signed, |
| 10943 | 10943 | .type_int_unsigned, |
| ... | ... | @@ -11054,7 +11054,7 @@ pub fn dumpGenericInstancesFallible(ip: *const InternPool, allocator: Allocator, |
| 11054 | 11054 | |
| 11055 | 11055 | try gop.value_ptr.append( |
| 11056 | 11056 | arena, |
| 11057 | Index.Unwrapped.wrap(.{ .tid = @enumFromInt(tid), .index = @intCast(index) }, ip), | |
| 11057 | Index.Unwrapped.wrap(.{ .tid = @fromBackingInt(@intCast(tid)), .index = @intCast(index) }, ip), | |
| 11058 | 11058 | ); |
| 11059 | 11059 | } |
| 11060 | 11060 | } |
| ... | ... | @@ -11272,10 +11272,10 @@ pub fn createNamespace( |
| 11272 | 11272 | const local = ip.getLocal(tid); |
| 11273 | 11273 | const free_list_next = local.mutate.namespaces.free_list; |
| 11274 | 11274 | if (free_list_next != Local.BucketListMutate.free_list_sentinel) { |
| 11275 | const reused_namespace_index: NamespaceIndex = @enumFromInt(free_list_next); | |
| 11275 | const reused_namespace_index: NamespaceIndex = @fromBackingInt(@intCast(free_list_next)); | |
| 11276 | 11276 | const reused_namespace = ip.namespacePtr(reused_namespace_index); |
| 11277 | 11277 | local.mutate.namespaces.free_list = |
| 11278 | @intFromEnum(@field(reused_namespace, Local.namespace_next_free_field)); | |
| 11278 | @backingInt(@field(reused_namespace, Local.namespace_next_free_field)); | |
| 11279 | 11279 | reused_namespace.* = initialization; |
| 11280 | 11280 | return reused_namespace_index; |
| 11281 | 11281 | } |
| ... | ... | @@ -11314,8 +11314,8 @@ pub fn destroyNamespace( |
| 11314 | 11314 | .generation = undefined, |
| 11315 | 11315 | }; |
| 11316 | 11316 | @field(namespace, Local.namespace_next_free_field) = |
| 11317 | @enumFromInt(local.mutate.namespaces.free_list); | |
| 11318 | local.mutate.namespaces.free_list = @intFromEnum(namespace_index); | |
| 11317 | @fromBackingInt(@intCast(local.mutate.namespaces.free_list)); | |
| 11318 | local.mutate.namespaces.free_list = @backingInt(namespace_index); | |
| 11319 | 11319 | } |
| 11320 | 11320 | |
| 11321 | 11321 | pub fn filePtr(ip: *const InternPool, file_index: FileIndex) *Zcu.File { |
| ... | ... | @@ -11424,10 +11424,10 @@ pub fn getOrPutTrailingString( |
| 11424 | 11424 | try string_bytes.ensureUnusedCapacity(1); |
| 11425 | 11425 | } |
| 11426 | 11426 | const key: []const u8 = string_bytes.view().items(.@"0")[start..]; |
| 11427 | const value: embedded_nulls.StringType() = @enumFromInt(@intFromEnum((String.Unwrapped{ | |
| 11427 | const value: embedded_nulls.StringType() = @fromBackingInt(@intCast(@backingInt((String.Unwrapped{ | |
| 11428 | 11428 | .tid = tid, |
| 11429 | 11429 | .index = strings.mutate.len - 1, |
| 11430 | }).wrap(ip))); | |
| 11430 | }).wrap(ip)))); | |
| 11431 | 11431 | const has_embedded_null = std.mem.indexOfScalar(u8, key, 0) != null; |
| 11432 | 11432 | switch (embedded_nulls) { |
| 11433 | 11433 | .no_embedded_nulls => assert(!has_embedded_null), |
| ... | ... | @@ -11452,7 +11452,7 @@ pub fn getOrPutTrailingString( |
| 11452 | 11452 | if (entry.hash != hash) continue; |
| 11453 | 11453 | if (!index.eqlSlice(key, ip)) continue; |
| 11454 | 11454 | string_bytes.shrinkRetainingCapacity(start); |
| 11455 | return @enumFromInt(@intFromEnum(index)); | |
| 11455 | return @fromBackingInt(@intCast(@backingInt(index))); | |
| 11456 | 11456 | } |
| 11457 | 11457 | shard.mutate.string_map.mutex.lock(io, tid); |
| 11458 | 11458 | defer shard.mutate.string_map.mutex.unlock(io); |
| ... | ... | @@ -11468,7 +11468,7 @@ pub fn getOrPutTrailingString( |
| 11468 | 11468 | if (entry.hash != hash) continue; |
| 11469 | 11469 | if (!index.eqlSlice(key, ip)) continue; |
| 11470 | 11470 | string_bytes.shrinkRetainingCapacity(start); |
| 11471 | return @enumFromInt(@intFromEnum(index)); | |
| 11471 | return @fromBackingInt(@intCast(@backingInt(index))); | |
| 11472 | 11472 | } |
| 11473 | 11473 | defer shard.mutate.string_map.len += 1; |
| 11474 | 11474 | const map_header = map.header().*; |
| ... | ... | @@ -11477,7 +11477,7 @@ pub fn getOrPutTrailingString( |
| 11477 | 11477 | strings.appendAssumeCapacity(.{string_bytes.mutate.len}); |
| 11478 | 11478 | const entry = &map.entries[map_index]; |
| 11479 | 11479 | entry.hash = hash; |
| 11480 | entry.release(@enumFromInt(@intFromEnum(value))); | |
| 11480 | entry.release(@fromBackingInt(@intCast(@backingInt(value)))); | |
| 11481 | 11481 | return value; |
| 11482 | 11482 | } |
| 11483 | 11483 | const arena_state = &local.mutate.arena; |
| ... | ... | @@ -11519,7 +11519,7 @@ pub fn getOrPutTrailingString( |
| 11519 | 11519 | string_bytes.appendAssumeCapacity(.{0}); |
| 11520 | 11520 | strings.appendAssumeCapacity(.{string_bytes.mutate.len}); |
| 11521 | 11521 | map.entries[map_index] = .{ |
| 11522 | .value = @enumFromInt(@intFromEnum(value)), | |
| 11522 | .value = @fromBackingInt(@intCast(@backingInt(value))), | |
| 11523 | 11523 | .hash = hash, |
| 11524 | 11524 | }; |
| 11525 | 11525 | shard.shared.string_map.release(new_map); |
| ... | ... | @@ -11710,7 +11710,7 @@ pub fn typeOf(ip: *const InternPool, index: Index) Index { |
| 11710 | 11710 | .undef, |
| 11711 | 11711 | .opt_null, |
| 11712 | 11712 | .only_possible_value, |
| 11713 | => @enumFromInt(item.data), | |
| 11713 | => @fromBackingInt(@intCast(item.data)), | |
| 11714 | 11714 | |
| 11715 | 11715 | .simple_type, .simple_value => unreachable, // handled via Index above |
| 11716 | 11716 | |
| ... | ... | @@ -11742,7 +11742,7 @@ pub fn typeOf(ip: *const InternPool, index: Index) Index { |
| 11742 | 11742 | .bitpack, |
| 11743 | 11743 | => |t| { |
| 11744 | 11744 | const extra_list = unwrapped_index.getExtra(ip); |
| 11745 | return @enumFromInt(extra_list.view().items(.@"0")[item.data + std.meta.fieldIndex(t.Payload(), "ty").?]); | |
| 11745 | return @fromBackingInt(@intCast(extra_list.view().items(.@"0")[item.data + std.meta.fieldIndex(t.Payload(), "ty").?])); | |
| 11746 | 11746 | }, |
| 11747 | 11747 | |
| 11748 | 11748 | .int_u8 => .u8_type, |
| ... | ... | @@ -11788,7 +11788,7 @@ pub fn typeOf(ip: *const InternPool, index: Index) Index { |
| 11788 | 11788 | /// Assumes that the enum's field indexes equal its value tags. |
| 11789 | 11789 | pub fn toEnum(ip: *const InternPool, comptime E: type, i: Index) E { |
| 11790 | 11790 | const int = ip.indexToKey(i).enum_tag.int; |
| 11791 | return @enumFromInt(ip.indexToKey(int).int.storage.u64); | |
| 11791 | return @fromBackingInt(@intCast(ip.indexToKey(int).int.storage.u64)); | |
| 11792 | 11792 | } |
| 11793 | 11793 | |
| 11794 | 11794 | pub fn toFunc(ip: *const InternPool, i: Index) Key.Func { |
| ... | ... | @@ -11821,9 +11821,9 @@ pub fn funcTypeReturnType(ip: *const InternPool, ty: Index) Index { |
| 11821 | 11821 | const ty_item = unwrapped_ty.getItem(ip); |
| 11822 | 11822 | const child_extra, const child_item = switch (ty_item.tag) { |
| 11823 | 11823 | .type_pointer => child: { |
| 11824 | const child_index: Index = @enumFromInt(ty_extra.view().items(.@"0")[ | |
| 11824 | const child_index: Index = @fromBackingInt(@intCast(ty_extra.view().items(.@"0")[ | |
| 11825 | 11825 | ty_item.data + std.meta.fieldIndex(Tag.TypePointer, "child").? |
| 11826 | ]); | |
| 11826 | ])); | |
| 11827 | 11827 | const unwrapped_child = child_index.unwrap(ip); |
| 11828 | 11828 | break :child .{ unwrapped_child.getExtra(ip), unwrapped_child.getItem(ip) }; |
| 11829 | 11829 | }, |
| ... | ... | @@ -11831,9 +11831,9 @@ pub fn funcTypeReturnType(ip: *const InternPool, ty: Index) Index { |
| 11831 | 11831 | else => unreachable, |
| 11832 | 11832 | }; |
| 11833 | 11833 | assert(child_item.tag == .type_function); |
| 11834 | return @enumFromInt(child_extra.view().items(.@"0")[ | |
| 11834 | return @fromBackingInt(@intCast(child_extra.view().items(.@"0")[ | |
| 11835 | 11835 | child_item.data + std.meta.fieldIndex(Tag.TypeFunction, "return_type").? |
| 11836 | ]); | |
| 11836 | ])); | |
| 11837 | 11837 | } |
| 11838 | 11838 | |
| 11839 | 11839 | pub fn isUndef(ip: *const InternPool, val: Index) bool { |
| ... | ... | @@ -11857,12 +11857,12 @@ pub fn getBackingAddrTag(ip: *const InternPool, val: Index) ?Key.Ptr.BaseAddr.Ta |
| 11857 | 11857 | .ptr_opt_payload, |
| 11858 | 11858 | .ptr_elem, |
| 11859 | 11859 | .ptr_field, |
| 11860 | => |tag| base = @enumFromInt(unwrapped_base.getExtra(ip).view().items(.@"0")[ | |
| 11860 | => |tag| base = @fromBackingInt(@intCast(unwrapped_base.getExtra(ip).view().items(.@"0")[ | |
| 11861 | 11861 | base_item.data + std.meta.fieldIndex(tag.Payload(), "base").? |
| 11862 | ]), | |
| 11863 | inline .ptr_slice => |tag| base = @enumFromInt(unwrapped_base.getExtra(ip).view().items(.@"0")[ | |
| 11862 | ])), | |
| 11863 | inline .ptr_slice => |tag| base = @fromBackingInt(@intCast(unwrapped_base.getExtra(ip).view().items(.@"0")[ | |
| 11864 | 11864 | base_item.data + std.meta.fieldIndex(tag.Payload(), "ptr").? |
| 11865 | ]), | |
| 11865 | ])), | |
| 11866 | 11866 | else => return null, |
| 11867 | 11867 | } |
| 11868 | 11868 | } |
| ... | ... | @@ -12139,7 +12139,7 @@ fn funcAnalysisPtr(ip: *const InternPool, func: Index) *FuncAnalysis { |
| 12139 | 12139 | .func_instance => item.data + std.meta.fieldIndex(Tag.FuncInstance, "analysis").?, |
| 12140 | 12140 | .func_coerced => { |
| 12141 | 12141 | const extra_index = item.data + std.meta.fieldIndex(Tag.FuncCoerced, "func").?; |
| 12142 | const coerced_func_index: Index = @enumFromInt(extra.view().items(.@"0")[extra_index]); | |
| 12142 | const coerced_func_index: Index = @fromBackingInt(@intCast(extra.view().items(.@"0")[extra_index])); | |
| 12143 | 12143 | const unwrapped_coerced_func = coerced_func_index.unwrap(ip); |
| 12144 | 12144 | const coerced_func_item = unwrapped_coerced_func.getItem(ip); |
| 12145 | 12145 | return @ptrCast(&unwrapped_coerced_func.getExtra(ip).view().items(.@"0")[ |
| ... | ... | @@ -12201,20 +12201,20 @@ pub fn funcZirBodyInst(ip: *const InternPool, func: Index) TrackedInst.Index { |
| 12201 | 12201 | const item_extra = unwrapped_func.getExtra(ip); |
| 12202 | 12202 | const zir_body_inst_field_index = std.meta.fieldIndex(Tag.FuncDecl, "zir_body_inst").?; |
| 12203 | 12203 | switch (item.tag) { |
| 12204 | .func_decl => return @enumFromInt(item_extra.view().items(.@"0")[item.data + zir_body_inst_field_index]), | |
| 12204 | .func_decl => return @fromBackingInt(@intCast(item_extra.view().items(.@"0")[item.data + zir_body_inst_field_index])), | |
| 12205 | 12205 | .func_instance => { |
| 12206 | 12206 | const generic_owner_field_index = std.meta.fieldIndex(Tag.FuncInstance, "generic_owner").?; |
| 12207 | const func_decl_index: Index = @enumFromInt(item_extra.view().items(.@"0")[item.data + generic_owner_field_index]); | |
| 12207 | const func_decl_index: Index = @fromBackingInt(@intCast(item_extra.view().items(.@"0")[item.data + generic_owner_field_index])); | |
| 12208 | 12208 | const unwrapped_func_decl = func_decl_index.unwrap(ip); |
| 12209 | 12209 | const func_decl_item = unwrapped_func_decl.getItem(ip); |
| 12210 | 12210 | const func_decl_extra = unwrapped_func_decl.getExtra(ip); |
| 12211 | 12211 | assert(func_decl_item.tag == .func_decl); |
| 12212 | return @enumFromInt(func_decl_extra.view().items(.@"0")[func_decl_item.data + zir_body_inst_field_index]); | |
| 12212 | return @fromBackingInt(@intCast(func_decl_extra.view().items(.@"0")[func_decl_item.data + zir_body_inst_field_index])); | |
| 12213 | 12213 | }, |
| 12214 | 12214 | .func_coerced => { |
| 12215 | const uncoerced_func_index: Index = @enumFromInt(item_extra.view().items(.@"0")[ | |
| 12215 | const uncoerced_func_index: Index = @fromBackingInt(@intCast(item_extra.view().items(.@"0")[ | |
| 12216 | 12216 | item.data + std.meta.fieldIndex(Tag.FuncCoerced, "func").? |
| 12217 | ]); | |
| 12217 | ])); | |
| 12218 | 12218 | return ip.funcZirBodyInst(uncoerced_func_index); |
| 12219 | 12219 | }, |
| 12220 | 12220 | else => unreachable, |
| ... | ... | @@ -12224,7 +12224,7 @@ pub fn funcZirBodyInst(ip: *const InternPool, func: Index) TrackedInst.Index { |
| 12224 | 12224 | pub fn iesFuncIndex(ip: *const InternPool, ies_index: Index) Index { |
| 12225 | 12225 | const item = ies_index.unwrap(ip).getItem(ip); |
| 12226 | 12226 | assert(item.tag == .type_inferred_error_set); |
| 12227 | const func_index: Index = @enumFromInt(item.data); | |
| 12227 | const func_index: Index = @fromBackingInt(@intCast(item.data)); | |
| 12228 | 12228 | switch (func_index.unwrap(ip).getTag(ip)) { |
| 12229 | 12229 | .func_decl, .func_instance => {}, |
| 12230 | 12230 | else => unreachable, // assertion failed |
| ... | ... | @@ -12244,9 +12244,9 @@ fn funcIesResolvedPtr(ip: *const InternPool, func_index: Index) *Index { |
| 12244 | 12244 | .func_decl => func_item.data + @typeInfo(Tag.FuncDecl).@"struct".field_names.len, |
| 12245 | 12245 | .func_instance => func_item.data + @typeInfo(Tag.FuncInstance).@"struct".field_names.len, |
| 12246 | 12246 | .func_coerced => { |
| 12247 | const uncoerced_func_index: Index = @enumFromInt(func_extra.view().items(.@"0")[ | |
| 12247 | const uncoerced_func_index: Index = @fromBackingInt(@intCast(func_extra.view().items(.@"0")[ | |
| 12248 | 12248 | func_item.data + std.meta.fieldIndex(Tag.FuncCoerced, "func").? |
| 12249 | ]); | |
| 12249 | ])); | |
| 12250 | 12250 | const unwrapped_uncoerced_func = uncoerced_func_index.unwrap(ip); |
| 12251 | 12251 | const uncoerced_func_item = unwrapped_uncoerced_func.getItem(ip); |
| 12252 | 12252 | return @ptrCast(&unwrapped_uncoerced_func.getExtra(ip).view().items(.@"0")[ |
| ... | ... | @@ -12294,9 +12294,9 @@ pub fn unwrapCoercedFunc(ip: *const InternPool, index: Index) Index { |
| 12294 | 12294 | const unwrapped_index = index.unwrap(ip); |
| 12295 | 12295 | const item = unwrapped_index.getItem(ip); |
| 12296 | 12296 | return switch (item.tag) { |
| 12297 | .func_coerced => @enumFromInt(unwrapped_index.getExtra(ip).view().items(.@"0")[ | |
| 12297 | .func_coerced => @fromBackingInt(@intCast(unwrapped_index.getExtra(ip).view().items(.@"0")[ | |
| 12298 | 12298 | item.data + std.meta.fieldIndex(Tag.FuncCoerced, "func").? |
| 12299 | ]), | |
| 12299 | ])), | |
| 12300 | 12300 | .func_instance, .func_decl => index, |
| 12301 | 12301 | else => unreachable, |
| 12302 | 12302 | }; |
| ... | ... | @@ -12392,7 +12392,7 @@ const GlobalErrorSet = struct { |
| 12392 | 12392 | name: NullTerminatedString, |
| 12393 | 12393 | ) Allocator.Error!GlobalErrorSet.Index { |
| 12394 | 12394 | if (name == .empty) return .none; |
| 12395 | const hash = std.hash.int(@intFromEnum(name)); | |
| 12395 | const hash = std.hash.int(@backingInt(name)); | |
| 12396 | 12396 | var map = ges.shared.map.acquire(); |
| 12397 | 12397 | const Map = @TypeOf(map); |
| 12398 | 12398 | var map_mask = map.header().mask(); |
| ... | ... | @@ -12404,7 +12404,7 @@ const GlobalErrorSet = struct { |
| 12404 | 12404 | const index = entry.acquire(); |
| 12405 | 12405 | if (index == .none) break; |
| 12406 | 12406 | if (entry.hash != hash) continue; |
| 12407 | if (names.view().items(.@"0")[@intFromEnum(index) - 1] == name) return index; | |
| 12407 | if (names.view().items(.@"0")[@backingInt(index) - 1] == name) return index; | |
| 12408 | 12408 | } |
| 12409 | 12409 | ges.mutate.map.mutex.lockUncancelable(io); |
| 12410 | 12410 | defer ges.mutate.map.mutex.unlock(io); |
| ... | ... | @@ -12419,7 +12419,7 @@ const GlobalErrorSet = struct { |
| 12419 | 12419 | const index = entry.value; |
| 12420 | 12420 | if (index == .none) break; |
| 12421 | 12421 | if (entry.hash != hash) continue; |
| 12422 | if (names.view().items(.@"0")[@intFromEnum(index) - 1] == name) return index; | |
| 12422 | if (names.view().items(.@"0")[@backingInt(index) - 1] == name) return index; | |
| 12423 | 12423 | } |
| 12424 | 12424 | const mutable_names: Names.Mutable = .{ |
| 12425 | 12425 | .gpa = gpa, |
| ... | ... | @@ -12432,7 +12432,7 @@ const GlobalErrorSet = struct { |
| 12432 | 12432 | const map_header = map.header().*; |
| 12433 | 12433 | if (ges.mutate.names.len < map_header.capacity * 3 / 5) { |
| 12434 | 12434 | mutable_names.appendAssumeCapacity(.{name}); |
| 12435 | const index: GlobalErrorSet.Index = @enumFromInt(mutable_names.mutate.len); | |
| 12435 | const index: GlobalErrorSet.Index = @fromBackingInt(@intCast(mutable_names.mutate.len)); | |
| 12436 | 12436 | const entry = &map.entries[map_index]; |
| 12437 | 12437 | entry.hash = hash; |
| 12438 | 12438 | entry.release(index); |
| ... | ... | @@ -12475,7 +12475,7 @@ const GlobalErrorSet = struct { |
| 12475 | 12475 | if (map.entries[map_index].value == .none) break; |
| 12476 | 12476 | } |
| 12477 | 12477 | mutable_names.appendAssumeCapacity(.{name}); |
| 12478 | const index: GlobalErrorSet.Index = @enumFromInt(mutable_names.mutate.len); | |
| 12478 | const index: GlobalErrorSet.Index = @fromBackingInt(@intCast(mutable_names.mutate.len)); | |
| 12479 | 12479 | map.entries[map_index] = .{ .value = index, .hash = hash }; |
| 12480 | 12480 | ges.shared.map.release(new_map); |
| 12481 | 12481 | return index; |
| ... | ... | @@ -12486,7 +12486,7 @@ const GlobalErrorSet = struct { |
| 12486 | 12486 | name: NullTerminatedString, |
| 12487 | 12487 | ) ?GlobalErrorSet.Index { |
| 12488 | 12488 | if (name == .empty) return .none; |
| 12489 | const hash = std.hash.int(@intFromEnum(name)); | |
| 12489 | const hash = std.hash.int(@backingInt(name)); | |
| 12490 | 12490 | const map = ges.shared.map.acquire(); |
| 12491 | 12491 | const map_mask = map.header().mask(); |
| 12492 | 12492 | const names_items = ges.shared.names.acquire().view().items(.@"0"); |
| ... | ... | @@ -12497,7 +12497,7 @@ const GlobalErrorSet = struct { |
| 12497 | 12497 | const index = entry.acquire(); |
| 12498 | 12498 | if (index == .none) return null; |
| 12499 | 12499 | if (entry.hash != hash) continue; |
| 12500 | if (names_items[@intFromEnum(index) - 1] == name) return index; | |
| 12500 | if (names_items[@backingInt(index) - 1] == name) return index; | |
| 12501 | 12501 | } |
| 12502 | 12502 | } |
| 12503 | 12503 | }; |
| ... | ... | @@ -12509,11 +12509,11 @@ pub fn getErrorValue( |
| 12509 | 12509 | tid: Zcu.PerThread.Id, |
| 12510 | 12510 | name: NullTerminatedString, |
| 12511 | 12511 | ) Allocator.Error!Zcu.ErrorInt { |
| 12512 | return @intFromEnum(try ip.global_error_set.getErrorValue(gpa, io, &ip.getLocal(tid).mutate.arena, name)); | |
| 12512 | return @backingInt(try ip.global_error_set.getErrorValue(gpa, io, &ip.getLocal(tid).mutate.arena, name)); | |
| 12513 | 12513 | } |
| 12514 | 12514 | |
| 12515 | 12515 | pub fn getErrorValueIfExists(ip: *const InternPool, name: NullTerminatedString) ?Zcu.ErrorInt { |
| 12516 | return @intFromEnum(ip.global_error_set.getErrorValueIfExists(name) orelse return null); | |
| 12516 | return @backingInt(ip.global_error_set.getErrorValueIfExists(name) orelse return null); | |
| 12517 | 12517 | } |
| 12518 | 12518 | |
| 12519 | 12519 | const PackedCallingConvention = packed struct(u18) { |
| ... | ... | @@ -12544,32 +12544,32 @@ const PackedCallingConvention = packed struct(u18) { |
| 12544 | 12544 | std.lang.CallingConvention.ArcInterruptOptions => .{ |
| 12545 | 12545 | .tag = tag, |
| 12546 | 12546 | .incoming_stack_alignment = .fromByteUnits(pl.incoming_stack_alignment orelse 0), |
| 12547 | .extra = @intFromEnum(pl.type), | |
| 12547 | .extra = @backingInt(pl.type), | |
| 12548 | 12548 | }, |
| 12549 | 12549 | std.lang.CallingConvention.ArmInterruptOptions => .{ |
| 12550 | 12550 | .tag = tag, |
| 12551 | 12551 | .incoming_stack_alignment = .fromByteUnits(pl.incoming_stack_alignment orelse 0), |
| 12552 | .extra = @intFromEnum(pl.type), | |
| 12552 | .extra = @backingInt(pl.type), | |
| 12553 | 12553 | }, |
| 12554 | 12554 | std.lang.CallingConvention.MicroblazeInterruptOptions => .{ |
| 12555 | 12555 | .tag = tag, |
| 12556 | 12556 | .incoming_stack_alignment = .fromByteUnits(pl.incoming_stack_alignment orelse 0), |
| 12557 | .extra = @intFromEnum(pl.type), | |
| 12557 | .extra = @backingInt(pl.type), | |
| 12558 | 12558 | }, |
| 12559 | 12559 | std.lang.CallingConvention.MipsInterruptOptions => .{ |
| 12560 | 12560 | .tag = tag, |
| 12561 | 12561 | .incoming_stack_alignment = .fromByteUnits(pl.incoming_stack_alignment orelse 0), |
| 12562 | .extra = @intFromEnum(pl.mode), | |
| 12562 | .extra = @backingInt(pl.mode), | |
| 12563 | 12563 | }, |
| 12564 | 12564 | std.lang.CallingConvention.RiscvInterruptOptions => .{ |
| 12565 | 12565 | .tag = tag, |
| 12566 | 12566 | .incoming_stack_alignment = .fromByteUnits(pl.incoming_stack_alignment orelse 0), |
| 12567 | .extra = @intFromEnum(pl.mode), | |
| 12567 | .extra = @backingInt(pl.mode), | |
| 12568 | 12568 | }, |
| 12569 | 12569 | std.lang.CallingConvention.ShInterruptOptions => .{ |
| 12570 | 12570 | .tag = tag, |
| 12571 | 12571 | .incoming_stack_alignment = .fromByteUnits(pl.incoming_stack_alignment orelse 0), |
| 12572 | .extra = @intFromEnum(pl.save), | |
| 12572 | .extra = @backingInt(pl.save), | |
| 12573 | 12573 | }, |
| 12574 | 12574 | std.lang.CallingConvention.SpirvKernelOptions => .{ |
| 12575 | 12575 | .tag = tag, |
| ... | ... | @@ -12579,12 +12579,12 @@ const PackedCallingConvention = packed struct(u18) { |
| 12579 | 12579 | std.lang.CallingConvention.SpirvFragmentOptions => .{ |
| 12580 | 12580 | .tag = tag, |
| 12581 | 12581 | .incoming_stack_alignment = .none, |
| 12582 | .extra = @as(u4, @intFromEnum(pl.depth_assumption)) << 1 | @intFromBool(pl.pixel_centered_integer), | |
| 12582 | .extra = @as(u4, @backingInt(pl.depth_assumption)) << 1 | @intFromBool(pl.pixel_centered_integer), | |
| 12583 | 12583 | }, |
| 12584 | 12584 | std.lang.CallingConvention.SpirvMeshOptions => .{ |
| 12585 | 12585 | .tag = tag, |
| 12586 | 12586 | .incoming_stack_alignment = .none, |
| 12587 | .extra = @intFromEnum(pl.stage_output), | |
| 12587 | .extra = @backingInt(pl.stage_output), | |
| 12588 | 12588 | }, |
| 12589 | 12589 | else => comptime unreachable, |
| 12590 | 12590 | }, |
| ... | ... | @@ -12615,27 +12615,27 @@ const PackedCallingConvention = packed struct(u18) { |
| 12615 | 12615 | }, |
| 12616 | 12616 | std.lang.CallingConvention.ArcInterruptOptions => .{ |
| 12617 | 12617 | .incoming_stack_alignment = cc.incoming_stack_alignment.toByteUnits(), |
| 12618 | .type = @enumFromInt(cc.extra), | |
| 12618 | .type = @fromBackingInt(@intCast(cc.extra)), | |
| 12619 | 12619 | }, |
| 12620 | 12620 | std.lang.CallingConvention.ArmInterruptOptions => .{ |
| 12621 | 12621 | .incoming_stack_alignment = cc.incoming_stack_alignment.toByteUnits(), |
| 12622 | .type = @enumFromInt(cc.extra), | |
| 12622 | .type = @fromBackingInt(@intCast(cc.extra)), | |
| 12623 | 12623 | }, |
| 12624 | 12624 | std.lang.CallingConvention.MicroblazeInterruptOptions => .{ |
| 12625 | 12625 | .incoming_stack_alignment = cc.incoming_stack_alignment.toByteUnits(), |
| 12626 | .type = @enumFromInt(cc.extra), | |
| 12626 | .type = @fromBackingInt(@intCast(cc.extra)), | |
| 12627 | 12627 | }, |
| 12628 | 12628 | std.lang.CallingConvention.MipsInterruptOptions => .{ |
| 12629 | 12629 | .incoming_stack_alignment = cc.incoming_stack_alignment.toByteUnits(), |
| 12630 | .mode = @enumFromInt(cc.extra), | |
| 12630 | .mode = @fromBackingInt(@intCast(cc.extra)), | |
| 12631 | 12631 | }, |
| 12632 | 12632 | std.lang.CallingConvention.RiscvInterruptOptions => .{ |
| 12633 | 12633 | .incoming_stack_alignment = cc.incoming_stack_alignment.toByteUnits(), |
| 12634 | .mode = @enumFromInt(cc.extra), | |
| 12634 | .mode = @fromBackingInt(@intCast(cc.extra)), | |
| 12635 | 12635 | }, |
| 12636 | 12636 | std.lang.CallingConvention.ShInterruptOptions => .{ |
| 12637 | 12637 | .incoming_stack_alignment = cc.incoming_stack_alignment.toByteUnits(), |
| 12638 | .save = @enumFromInt(cc.extra), | |
| 12638 | .save = @fromBackingInt(@intCast(cc.extra)), | |
| 12639 | 12639 | }, |
| 12640 | 12640 | std.lang.CallingConvention.SpirvKernelOptions => .{ |
| 12641 | 12641 | .x = trailing[0], |
| ... | ... | @@ -12644,10 +12644,10 @@ const PackedCallingConvention = packed struct(u18) { |
| 12644 | 12644 | }, |
| 12645 | 12645 | std.lang.CallingConvention.SpirvFragmentOptions => .{ |
| 12646 | 12646 | .pixel_centered_integer = @bitCast(@as(u1, @truncate(cc.extra))), |
| 12647 | .depth_assumption = @enumFromInt(@as(u2, @truncate(cc.extra >> 1))), | |
| 12647 | .depth_assumption = @fromBackingInt(@intCast(@as(u2, @truncate(cc.extra >> 1)))), | |
| 12648 | 12648 | }, |
| 12649 | 12649 | std.lang.CallingConvention.SpirvMeshOptions => .{ |
| 12650 | .stage_output = @enumFromInt(cc.extra), | |
| 12650 | .stage_output = @fromBackingInt(@intCast(cc.extra)), | |
| 12651 | 12651 | .max_primitives = trailing[0], |
| 12652 | 12652 | .max_vertices = trailing[1], |
| 12653 | 12653 | }, |
| ... | ... | @@ -12713,7 +12713,7 @@ pub fn resolveUnionLayout( |
| 12713 | 12713 | const item = unwrapped_index.getItem(ip); |
| 12714 | 12714 | assert(item.tag == .type_union); |
| 12715 | 12715 | |
| 12716 | extra_items[item.data + std.meta.fieldIndex(Tag.TypeUnion, "enum_tag_type").?] = @intFromEnum(enum_tag_type); | |
| 12716 | extra_items[item.data + std.meta.fieldIndex(Tag.TypeUnion, "enum_tag_type").?] = @backingInt(enum_tag_type); | |
| 12717 | 12717 | extra_items[item.data + std.meta.fieldIndex(Tag.TypeUnion, "size").?] = size; |
| 12718 | 12718 | extra_items[item.data + std.meta.fieldIndex(Tag.TypeUnion, "padding").?] = padding; |
| 12719 | 12719 | const flags: *Tag.TypeUnion.Flags = @ptrCast(&extra_items[item.data + std.meta.fieldIndex(Tag.TypeUnion, "flags").?]); |
| ... | ... | @@ -12746,7 +12746,7 @@ pub fn resolvePackedStructLayout( |
| 12746 | 12746 | else => unreachable, |
| 12747 | 12747 | } |
| 12748 | 12748 | |
| 12749 | extra_items[item.data + std.meta.fieldIndex(Tag.TypeStructPacked, "backing_int_type").?] = @intFromEnum(backing_int_type); | |
| 12749 | extra_items[item.data + std.meta.fieldIndex(Tag.TypeStructPacked, "backing_int_type").?] = @backingInt(backing_int_type); | |
| 12750 | 12750 | } |
| 12751 | 12751 | |
| 12752 | 12752 | /// Asserts that `union_type` is a packed union type. |
| ... | ... | @@ -12772,8 +12772,8 @@ pub fn resolvePackedUnionLayout( |
| 12772 | 12772 | else => unreachable, |
| 12773 | 12773 | } |
| 12774 | 12774 | |
| 12775 | extra_items[item.data + std.meta.fieldIndex(Tag.TypeUnionPacked, "enum_tag_type").?] = @intFromEnum(enum_tag_type); | |
| 12776 | extra_items[item.data + std.meta.fieldIndex(Tag.TypeUnionPacked, "backing_int_type").?] = @intFromEnum(backing_int_type); | |
| 12775 | extra_items[item.data + std.meta.fieldIndex(Tag.TypeUnionPacked, "enum_tag_type").?] = @backingInt(enum_tag_type); | |
| 12776 | extra_items[item.data + std.meta.fieldIndex(Tag.TypeUnionPacked, "backing_int_type").?] = @backingInt(backing_int_type); | |
| 12777 | 12777 | } |
| 12778 | 12778 | |
| 12779 | 12779 | /// Asserts that `enum_type` is an enum type. |
| ... | ... | @@ -12799,7 +12799,7 @@ pub fn resolveEnumLayout( |
| 12799 | 12799 | else => unreachable, |
| 12800 | 12800 | } |
| 12801 | 12801 | |
| 12802 | extra_items[item.data + std.meta.fieldIndex(Tag.TypeEnum, "int_tag_type").?] = @intFromEnum(int_tag_type); | |
| 12802 | extra_items[item.data + std.meta.fieldIndex(Tag.TypeEnum, "int_tag_type").?] = @backingInt(int_tag_type); | |
| 12803 | 12803 | } |
| 12804 | 12804 | |
| 12805 | 12805 | /// Sets the "want_layout" flag on the given struct, union, or enum type. Returns true if the flag |
src/Module.zig+3-3| ... | ... | @@ -353,11 +353,11 @@ pub fn create(arena: Allocator, options: CreateOptions) !*Module { |
| 353 | 353 | // See https://github.com/ziglang/zig/issues/23539 |
| 354 | 354 | if (target_util.isDynamicAMDGCNFeature(target, feature)) continue; |
| 355 | 355 | |
| 356 | if (target.cpu.arch.isPowerPC() and @as(std.Target.powerpc.Feature, @enumFromInt(feature.index)) == .@"64bit") continue; | |
| 357 | if (target.cpu.arch.isX86() and @as(std.Target.x86.Feature, @enumFromInt(feature.index)) == .x32) continue; | |
| 356 | if (target.cpu.arch.isPowerPC() and @as(std.Target.powerpc.Feature, @fromBackingInt(@intCast(feature.index))) == .@"64bit") continue; | |
| 357 | if (target.cpu.arch.isX86() and @as(std.Target.x86.Feature, @fromBackingInt(@intCast(feature.index))) == .x32) continue; | |
| 358 | 358 | |
| 359 | 359 | var is_enabled = target.cpu.features.isEnabled(feature.index); |
| 360 | if (target.cpu.arch == .s390x and @as(std.Target.s390x.Feature, @enumFromInt(feature.index)) == .backchain) { | |
| 360 | if (target.cpu.arch == .s390x and @as(std.Target.s390x.Feature, @fromBackingInt(@intCast(feature.index))) == .backchain) { | |
| 361 | 361 | is_enabled = !omit_frame_pointer; |
| 362 | 362 | } |
| 363 | 363 |
src/Sema.zig+433-433| ... | ... | @@ -142,7 +142,7 @@ const RuntimeIndex = enum(u32) { |
| 142 | 142 | _, |
| 143 | 143 | |
| 144 | 144 | pub fn increment(ri: *RuntimeIndex) void { |
| 145 | ri.* = @enumFromInt(@intFromEnum(ri.*) + 1); | |
| 145 | ri.* = @fromBackingInt(@intCast(@backingInt(ri.*) + 1)); | |
| 146 | 146 | } |
| 147 | 147 | }; |
| 148 | 148 | |
| ... | ... | @@ -191,11 +191,11 @@ fn newComptimeAlloc(sema: *Sema, block: *Block, src: LazySrcLoc, ty: Type, align |
| 191 | 191 | .alignment = alignment, |
| 192 | 192 | .runtime_index = block.runtime_index, |
| 193 | 193 | }); |
| 194 | return @enumFromInt(idx); | |
| 194 | return @fromBackingInt(@intCast(idx)); | |
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | pub fn getComptimeAlloc(sema: *Sema, idx: ComptimeAllocIndex) *ComptimeAlloc { |
| 198 | return &sema.comptime_allocs.items[@intFromEnum(idx)]; | |
| 198 | return &sema.comptime_allocs.items[@backingInt(idx)]; | |
| 199 | 199 | } |
| 200 | 200 | |
| 201 | 201 | pub const default_branch_quota = 1000; |
| ... | ... | @@ -253,7 +253,7 @@ pub const InferredErrorSet = struct { |
| 253 | 253 | /// be called safely for any of the instructions passed in. |
| 254 | 254 | pub const InstMap = struct { |
| 255 | 255 | items: []Air.Inst.Ref = &[_]Air.Inst.Ref{}, |
| 256 | start: Zir.Inst.Index = @enumFromInt(0), | |
| 256 | start: Zir.Inst.Index = @fromBackingInt(@intCast(0)), | |
| 257 | 257 | |
| 258 | 258 | pub fn deinit(map: InstMap, allocator: mem.Allocator) void { |
| 259 | 259 | allocator.free(map.items); |
| ... | ... | @@ -261,7 +261,7 @@ pub const InstMap = struct { |
| 261 | 261 | |
| 262 | 262 | pub fn get(map: InstMap, key: Zir.Inst.Index) ?Air.Inst.Ref { |
| 263 | 263 | if (!map.contains(key)) return null; |
| 264 | return map.items[@intFromEnum(key) - @intFromEnum(map.start)]; | |
| 264 | return map.items[@backingInt(key) - @backingInt(map.start)]; | |
| 265 | 265 | } |
| 266 | 266 | |
| 267 | 267 | pub fn putAssumeCapacity( |
| ... | ... | @@ -269,7 +269,7 @@ pub const InstMap = struct { |
| 269 | 269 | key: Zir.Inst.Index, |
| 270 | 270 | ref: Air.Inst.Ref, |
| 271 | 271 | ) void { |
| 272 | map.items[@intFromEnum(key) - @intFromEnum(map.start)] = ref; | |
| 272 | map.items[@backingInt(key) - @backingInt(map.start)] = ref; | |
| 273 | 273 | } |
| 274 | 274 | |
| 275 | 275 | pub fn putAssumeCapacityNoClobber( |
| ... | ... | @@ -290,7 +290,7 @@ pub const InstMap = struct { |
| 290 | 290 | map: *InstMap, |
| 291 | 291 | key: Zir.Inst.Index, |
| 292 | 292 | ) GetOrPutResult { |
| 293 | const index = @intFromEnum(key) - @intFromEnum(map.start); | |
| 293 | const index = @backingInt(key) - @backingInt(map.start); | |
| 294 | 294 | return GetOrPutResult{ |
| 295 | 295 | .value_ptr = &map.items[index], |
| 296 | 296 | .found_existing = map.items[index] != .none, |
| ... | ... | @@ -299,12 +299,12 @@ pub const InstMap = struct { |
| 299 | 299 | |
| 300 | 300 | pub fn remove(map: InstMap, key: Zir.Inst.Index) bool { |
| 301 | 301 | if (!map.contains(key)) return false; |
| 302 | map.items[@intFromEnum(key) - @intFromEnum(map.start)] = .none; | |
| 302 | map.items[@backingInt(key) - @backingInt(map.start)] = .none; | |
| 303 | 303 | return true; |
| 304 | 304 | } |
| 305 | 305 | |
| 306 | 306 | pub fn contains(map: InstMap, key: Zir.Inst.Index) bool { |
| 307 | return map.items[@intFromEnum(key) - @intFromEnum(map.start)] != .none; | |
| 307 | return map.items[@backingInt(key) - @backingInt(map.start)] != .none; | |
| 308 | 308 | } |
| 309 | 309 | |
| 310 | 310 | pub fn ensureSpaceForInstructions( |
| ... | ... | @@ -313,7 +313,7 @@ pub const InstMap = struct { |
| 313 | 313 | insts: []const Zir.Inst.Index, |
| 314 | 314 | ) !void { |
| 315 | 315 | const start, const end = mem.minMax(u32, @ptrCast(insts)); |
| 316 | const map_start = @intFromEnum(map.start); | |
| 316 | const map_start = @backingInt(map.start); | |
| 317 | 317 | if (map_start <= start and end < map.items.len + map_start) |
| 318 | 318 | return; |
| 319 | 319 | |
| ... | ... | @@ -336,7 +336,7 @@ pub const InstMap = struct { |
| 336 | 336 | |
| 337 | 337 | allocator.free(map.items); |
| 338 | 338 | map.items = new_items; |
| 339 | map.start = @enumFromInt(better_start); | |
| 339 | map.start = @fromBackingInt(@intCast(better_start)); | |
| 340 | 340 | } |
| 341 | 341 | }; |
| 342 | 342 | |
| ... | ... | @@ -814,7 +814,7 @@ pub const Block = struct { |
| 814 | 814 | try sema.air_instructions.ensureUnusedCapacity(gpa, 1); |
| 815 | 815 | try block.instructions.ensureUnusedCapacity(gpa, 1); |
| 816 | 816 | |
| 817 | const result_index: Air.Inst.Index = @enumFromInt(sema.air_instructions.len); | |
| 817 | const result_index: Air.Inst.Index = @fromBackingInt(@intCast(sema.air_instructions.len)); | |
| 818 | 818 | sema.air_instructions.appendAssumeCapacity(inst); |
| 819 | 819 | block.instructions.appendAssumeCapacity(result_index); |
| 820 | 820 | return result_index; |
| ... | ... | @@ -832,10 +832,10 @@ pub const Block = struct { |
| 832 | 832 | |
| 833 | 833 | try sema.air_instructions.ensureUnusedCapacity(gpa, 1); |
| 834 | 834 | |
| 835 | const result_index: Air.Inst.Index = @enumFromInt(sema.air_instructions.len); | |
| 835 | const result_index: Air.Inst.Index = @fromBackingInt(@intCast(sema.air_instructions.len)); | |
| 836 | 836 | sema.air_instructions.appendAssumeCapacity(inst); |
| 837 | 837 | |
| 838 | try block.instructions.insert(gpa, @intFromEnum(index), result_index); | |
| 838 | try block.instructions.insert(gpa, @backingInt(index), result_index); | |
| 839 | 839 | return result_index; |
| 840 | 840 | } |
| 841 | 841 | |
| ... | ... | @@ -1020,7 +1020,7 @@ fn analyzeBodyRuntimeBreak(sema: *Sema, block: *Block, body: []const Zir.Inst.In |
| 1020 | 1020 | sema.analyzeBodyInner(block, body) catch |err| switch (err) { |
| 1021 | 1021 | error.ComptimeBreak => { |
| 1022 | 1022 | const zir_datas = sema.code.instructions.items(.data); |
| 1023 | const break_data = zir_datas[@intFromEnum(sema.comptime_break_inst)].@"break"; | |
| 1023 | const break_data = zir_datas[@backingInt(sema.comptime_break_inst)].@"break"; | |
| 1024 | 1024 | const extra = sema.code.extraData(Zir.Inst.Break, break_data.payload_index).data; |
| 1025 | 1025 | try sema.addRuntimeBreak(block, extra.block_inst, break_data.operand); |
| 1026 | 1026 | }, |
| ... | ... | @@ -1061,7 +1061,7 @@ fn analyzeInlineBody( |
| 1061 | 1061 | error.ComptimeBreak => {}, |
| 1062 | 1062 | else => |e| return e, |
| 1063 | 1063 | } |
| 1064 | const break_inst = sema.code.instructions.get(@intFromEnum(sema.comptime_break_inst)); | |
| 1064 | const break_inst = sema.code.instructions.get(@backingInt(sema.comptime_break_inst)); | |
| 1065 | 1065 | switch (break_inst.tag) { |
| 1066 | 1066 | .switch_continue => { |
| 1067 | 1067 | // This is handled by separate logic. |
| ... | ... | @@ -1145,7 +1145,7 @@ fn analyzeBodyInner( |
| 1145 | 1145 | }, inst }); |
| 1146 | 1146 | } |
| 1147 | 1147 | |
| 1148 | const air_ref: Air.Inst.Ref = inst: switch (tags[@intFromEnum(inst)]) { | |
| 1148 | const air_ref: Air.Inst.Ref = inst: switch (tags[@backingInt(inst)]) { | |
| 1149 | 1149 | // zig fmt: off |
| 1150 | 1150 | .alloc => try sema.zirAlloc(block, inst), |
| 1151 | 1151 | .alloc_inferred => try sema.zirAllocInferred(block, true), |
| ... | ... | @@ -1373,7 +1373,7 @@ fn analyzeBodyInner( |
| 1373 | 1373 | .declaration => unreachable, |
| 1374 | 1374 | |
| 1375 | 1375 | .extended => ext: { |
| 1376 | const extended = datas[@intFromEnum(inst)].extended; | |
| 1376 | const extended = datas[@backingInt(inst)].extended; | |
| 1377 | 1377 | break :ext switch (extended.opcode) { |
| 1378 | 1378 | // zig fmt: off |
| 1379 | 1379 | .struct_decl => try sema.zirStructDecl( block, inst), |
| ... | ... | @@ -1624,7 +1624,7 @@ fn analyzeBodyInner( |
| 1624 | 1624 | }, |
| 1625 | 1625 | .check_comptime_control_flow => { |
| 1626 | 1626 | if (!block.isComptime()) { |
| 1627 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].un_node; | |
| 1627 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].un_node; | |
| 1628 | 1628 | const src = block.nodeOffset(inst_data.src_node); |
| 1629 | 1629 | const inline_block = inst_data.operand.toIndex().?; |
| 1630 | 1630 | |
| ... | ... | @@ -1636,7 +1636,7 @@ fn analyzeBodyInner( |
| 1636 | 1636 | check_block = check_block.parent.?; |
| 1637 | 1637 | }; |
| 1638 | 1638 | |
| 1639 | if (@intFromEnum(target_runtime_index) < @intFromEnum(block.runtime_index)) { | |
| 1639 | if (@backingInt(target_runtime_index) < @backingInt(block.runtime_index)) { | |
| 1640 | 1640 | const runtime_src = block.runtime_cond orelse block.runtime_loop.?; |
| 1641 | 1641 | const msg = msg: { |
| 1642 | 1642 | const msg = try sema.errMsg(src, "comptime control flow inside runtime block", .{}); |
| ... | ... | @@ -1656,13 +1656,13 @@ fn analyzeBodyInner( |
| 1656 | 1656 | continue; |
| 1657 | 1657 | }, |
| 1658 | 1658 | .restore_err_ret_index_unconditional => { |
| 1659 | const un_node = datas[@intFromEnum(inst)].un_node; | |
| 1659 | const un_node = datas[@backingInt(inst)].un_node; | |
| 1660 | 1660 | try sema.restoreErrRetIndex(block, block.nodeOffset(un_node.src_node), un_node.operand, .none); |
| 1661 | 1661 | i += 1; |
| 1662 | 1662 | continue; |
| 1663 | 1663 | }, |
| 1664 | 1664 | .restore_err_ret_index_fn_entry => { |
| 1665 | const un_node = datas[@intFromEnum(inst)].un_node; | |
| 1665 | const un_node = datas[@backingInt(inst)].un_node; | |
| 1666 | 1666 | try sema.restoreErrRetIndex(block, block.nodeOffset(un_node.src_node), .none, un_node.operand); |
| 1667 | 1667 | i += 1; |
| 1668 | 1668 | continue; |
| ... | ... | @@ -1685,7 +1685,7 @@ fn analyzeBodyInner( |
| 1685 | 1685 | .repeat => { |
| 1686 | 1686 | if (block.isComptime()) { |
| 1687 | 1687 | // Send comptime control flow back to the beginning of this block. |
| 1688 | const src = block.nodeOffset(datas[@intFromEnum(inst)].node); | |
| 1688 | const src = block.nodeOffset(datas[@backingInt(inst)].node); | |
| 1689 | 1689 | try sema.emitBackwardBranch(block, src); |
| 1690 | 1690 | i = 0; |
| 1691 | 1691 | continue; |
| ... | ... | @@ -1700,7 +1700,7 @@ fn analyzeBodyInner( |
| 1700 | 1700 | }, |
| 1701 | 1701 | .repeat_inline => { |
| 1702 | 1702 | // Send comptime control flow back to the beginning of this block. |
| 1703 | const src = block.nodeOffset(datas[@intFromEnum(inst)].node); | |
| 1703 | const src = block.nodeOffset(datas[@backingInt(inst)].node); | |
| 1704 | 1704 | try sema.emitBackwardBranch(block, src); |
| 1705 | 1705 | i = 0; |
| 1706 | 1706 | continue; |
| ... | ... | @@ -1722,7 +1722,7 @@ fn analyzeBodyInner( |
| 1722 | 1722 | } else try sema.zirBlock(block, inst), |
| 1723 | 1723 | |
| 1724 | 1724 | .block_comptime => { |
| 1725 | const pl_node = datas[@intFromEnum(inst)].pl_node; | |
| 1725 | const pl_node = datas[@backingInt(inst)].pl_node; | |
| 1726 | 1726 | const src = block.nodeOffset(pl_node.src_node); |
| 1727 | 1727 | const extra = sema.code.extraData(Zir.Inst.BlockComptime, pl_node.payload_index); |
| 1728 | 1728 | const block_body = sema.code.bodySlice(extra.end, extra.data.body_len); |
| ... | ... | @@ -1760,7 +1760,7 @@ fn analyzeBodyInner( |
| 1760 | 1760 | // through a runtime conditional branch, we must retroactively emit |
| 1761 | 1761 | // a block, so we remember the block index here just in case. |
| 1762 | 1762 | const block_index = block.instructions.items.len; |
| 1763 | const inst_data = datas[@intFromEnum(inst)].pl_node; | |
| 1763 | const inst_data = datas[@backingInt(inst)].pl_node; | |
| 1764 | 1764 | const extra = sema.code.extraData(Zir.Inst.Block, inst_data.payload_index); |
| 1765 | 1765 | const inline_body = sema.code.bodySlice(extra.end, extra.data.body_len); |
| 1766 | 1766 | const gpa = sema.gpa; |
| ... | ... | @@ -1780,7 +1780,7 @@ fn analyzeBodyInner( |
| 1780 | 1780 | // If this block contains a function prototype, we need to reset the |
| 1781 | 1781 | // current list of parameters and restore it later. |
| 1782 | 1782 | // Note: this probably needs to be resolved in a more general manner. |
| 1783 | const tag_index = @intFromEnum(inline_body[inline_body.len - 1]); | |
| 1783 | const tag_index = @backingInt(inline_body[inline_body.len - 1]); | |
| 1784 | 1784 | child_block.inline_block = (if (tags[tag_index] == .repeat_inline) |
| 1785 | 1785 | inline_body[0] |
| 1786 | 1786 | else |
| ... | ... | @@ -1801,7 +1801,7 @@ fn analyzeBodyInner( |
| 1801 | 1801 | } else |err| switch (err) { |
| 1802 | 1802 | error.ComptimeBreak => brk_res: { |
| 1803 | 1803 | const break_inst = sema.comptime_break_inst; |
| 1804 | const break_data = sema.code.instructions.items(.data)[@intFromEnum(break_inst)].@"break"; | |
| 1804 | const break_data = sema.code.instructions.items(.data)[@backingInt(break_inst)].@"break"; | |
| 1805 | 1805 | const break_extra = sema.code.extraData(Zir.Inst.Break, break_data.payload_index).data; |
| 1806 | 1806 | break :brk_res .{ |
| 1807 | 1807 | .block_inst = break_extra.block_inst, |
| ... | ... | @@ -1869,7 +1869,7 @@ fn analyzeBodyInner( |
| 1869 | 1869 | break; |
| 1870 | 1870 | }, |
| 1871 | 1871 | .condbr_inline => { |
| 1872 | const inst_data = datas[@intFromEnum(inst)].pl_node; | |
| 1872 | const inst_data = datas[@backingInt(inst)].pl_node; | |
| 1873 | 1873 | const cond_src = block.src(.{ .node_offset_if_cond = inst_data.src_node }); |
| 1874 | 1874 | const extra = sema.code.extraData(Zir.Inst.CondBr, inst_data.payload_index); |
| 1875 | 1875 | const then_body = sema.code.bodySlice(extra.end, extra.data.then_body_len); |
| ... | ... | @@ -1898,7 +1898,7 @@ fn analyzeBodyInner( |
| 1898 | 1898 | }, |
| 1899 | 1899 | .@"try" => blk: { |
| 1900 | 1900 | if (!block.isComptime()) break :blk try sema.zirTry(block, inst); |
| 1901 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 1901 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 1902 | 1902 | const src = block.nodeOffset(inst_data.src_node); |
| 1903 | 1903 | const operand_src = block.src(.{ .node_offset_try_operand = inst_data.src_node }); |
| 1904 | 1904 | const extra = sema.code.extraData(Zir.Inst.Try, inst_data.payload_index); |
| ... | ... | @@ -1924,7 +1924,7 @@ fn analyzeBodyInner( |
| 1924 | 1924 | }, |
| 1925 | 1925 | .try_ptr => blk: { |
| 1926 | 1926 | if (!block.isComptime()) break :blk try sema.zirTryPtr(block, inst); |
| 1927 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 1927 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 1928 | 1928 | const src = block.nodeOffset(inst_data.src_node); |
| 1929 | 1929 | const operand_src = block.src(.{ .node_offset_try_operand = inst_data.src_node }); |
| 1930 | 1930 | const extra = sema.code.extraData(Zir.Inst.Try, inst_data.payload_index); |
| ... | ... | @@ -1940,7 +1940,7 @@ fn analyzeBodyInner( |
| 1940 | 1940 | break :blk result; |
| 1941 | 1941 | }, |
| 1942 | 1942 | .@"defer" => blk: { |
| 1943 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].@"defer"; | |
| 1943 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].@"defer"; | |
| 1944 | 1944 | const defer_body = sema.code.bodySlice(inst_data.index, inst_data.len); |
| 1945 | 1945 | if (sema.analyzeBodyInner(block, defer_body)) { |
| 1946 | 1946 | // The defer terminated noreturn - no more analysis needed. |
| ... | ... | @@ -1956,7 +1956,7 @@ fn analyzeBodyInner( |
| 1956 | 1956 | }, |
| 1957 | 1957 | }; |
| 1958 | 1958 | |
| 1959 | const is_inferred_alloc = if (air_ref.toIndex()) |air_inst| switch (sema.air_instructions.items(.tag)[@intFromEnum(air_inst)]) { | |
| 1959 | const is_inferred_alloc = if (air_ref.toIndex()) |air_inst| switch (sema.air_instructions.items(.tag)[@backingInt(air_inst)]) { | |
| 1960 | 1960 | .inferred_alloc, .inferred_alloc_comptime => true, |
| 1961 | 1961 | else => false, |
| 1962 | 1962 | } else false; |
| ... | ... | @@ -1998,7 +1998,7 @@ fn resolveInst(sema: *Sema, zir_ref: Zir.Inst.Ref) Air.Inst.Ref { |
| 1998 | 1998 | } |
| 1999 | 1999 | // First section of indexes correspond to a set number of constant values. |
| 2000 | 2000 | // We intentionally map the same indexes to the same values between ZIR and AIR. |
| 2001 | return @enumFromInt(@intFromEnum(zir_ref)); | |
| 2001 | return @fromBackingInt(@intCast(@backingInt(zir_ref))); | |
| 2002 | 2002 | } |
| 2003 | 2003 | |
| 2004 | 2004 | fn resolveConstBool( |
| ... | ... | @@ -2130,29 +2130,29 @@ fn genericPoisonReason(sema: *Sema, block: *Block, ref: Zir.Inst.Ref) GenericPoi |
| 2130 | 2130 | var cur = ref; |
| 2131 | 2131 | while (true) { |
| 2132 | 2132 | const inst = cur.toIndex() orelse return .unknown; |
| 2133 | switch (sema.code.instructions.items(.tag)[@intFromEnum(inst)]) { | |
| 2133 | switch (sema.code.instructions.items(.tag)[@backingInt(inst)]) { | |
| 2134 | 2134 | .validate_array_init_ref_ty => { |
| 2135 | const pl_node = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 2135 | const pl_node = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 2136 | 2136 | const extra = sema.code.extraData(Zir.Inst.ArrayInitRefTy, pl_node.payload_index).data; |
| 2137 | 2137 | cur = extra.ptr_ty; |
| 2138 | 2138 | }, |
| 2139 | 2139 | .array_init_elem_type => { |
| 2140 | const bin = sema.code.instructions.items(.data)[@intFromEnum(inst)].bin; | |
| 2140 | const bin = sema.code.instructions.items(.data)[@backingInt(inst)].bin; | |
| 2141 | 2141 | cur = bin.lhs; |
| 2142 | 2142 | }, |
| 2143 | 2143 | .indexable_ptr_elem_type, .splat_op_result_ty => { |
| 2144 | const un_node = sema.code.instructions.items(.data)[@intFromEnum(inst)].un_node; | |
| 2144 | const un_node = sema.code.instructions.items(.data)[@backingInt(inst)].un_node; | |
| 2145 | 2145 | cur = un_node.operand; |
| 2146 | 2146 | }, |
| 2147 | 2147 | .struct_init_field_type => { |
| 2148 | const pl_node = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 2148 | const pl_node = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 2149 | 2149 | const extra = sema.code.extraData(Zir.Inst.FieldType, pl_node.payload_index).data; |
| 2150 | 2150 | cur = extra.container_type; |
| 2151 | 2151 | }, |
| 2152 | 2152 | .elem_type => { |
| 2153 | 2153 | // There are two cases here: the pointer type may already have been |
| 2154 | 2154 | // generic poison, or it may have been an anyopaque pointer. |
| 2155 | const un_node = sema.code.instructions.items(.data)[@intFromEnum(inst)].un_node; | |
| 2155 | const un_node = sema.code.instructions.items(.data)[@backingInt(inst)].un_node; | |
| 2156 | 2156 | const operand_ref = sema.resolveInst(un_node.operand); |
| 2157 | 2157 | const operand_val = operand_ref.toInterned() orelse return .unknown; |
| 2158 | 2158 | if (operand_val == .generic_poison_type) { |
| ... | ... | @@ -2167,7 +2167,7 @@ fn genericPoisonReason(sema: *Sema, block: *Block, ref: Zir.Inst.Ref) GenericPoi |
| 2167 | 2167 | // A function call can never return generic poison, so we must be |
| 2168 | 2168 | // evaluating an `anytype` function parameter. |
| 2169 | 2169 | // TODO: better source location - function decl rather than call |
| 2170 | const pl_node = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 2170 | const pl_node = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 2171 | 2171 | return .{ .anytype_param = block.nodeOffset(pl_node.src_node) }; |
| 2172 | 2172 | }, |
| 2173 | 2173 | else => return .unknown, |
| ... | ... | @@ -2242,7 +2242,7 @@ fn resolveValue(sema: *Sema, inst: Air.Inst.Ref) ?Value { |
| 2242 | 2242 | |
| 2243 | 2243 | // Runtime-known value. We'll be returning `null`, but first, some assertions. |
| 2244 | 2244 | const air_tags = sema.air_instructions.items(.tag); |
| 2245 | switch (air_tags[@intFromEnum(inst.toIndex().?)]) { | |
| 2245 | switch (air_tags[@backingInt(inst.toIndex().?)]) { | |
| 2246 | 2246 | .inferred_alloc => unreachable, // assertion failure |
| 2247 | 2247 | .inferred_alloc_comptime => unreachable, // assertion failure |
| 2248 | 2248 | else => {}, |
| ... | ... | @@ -3043,7 +3043,7 @@ fn zirErrorSetDecl( |
| 3043 | 3043 | const gpa = comp.gpa; |
| 3044 | 3044 | const io = comp.io; |
| 3045 | 3045 | |
| 3046 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 3046 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 3047 | 3047 | const extra = sema.code.extraData(Zir.Inst.ErrorSetDecl, inst_data.payload_index); |
| 3048 | 3048 | |
| 3049 | 3049 | var names: InferredErrorSet.NameMap = .{}; |
| ... | ... | @@ -3052,7 +3052,7 @@ fn zirErrorSetDecl( |
| 3052 | 3052 | var extra_index: u32 = @intCast(extra.end); |
| 3053 | 3053 | const extra_index_end = extra_index + extra.data.fields_len; |
| 3054 | 3054 | while (extra_index < extra_index_end) : (extra_index += 1) { |
| 3055 | const name_index: Zir.NullTerminatedString = @enumFromInt(sema.code.extra[extra_index]); | |
| 3055 | const name_index: Zir.NullTerminatedString = @fromBackingInt(@intCast(sema.code.extra[extra_index])); | |
| 3056 | 3056 | const name = sema.code.nullTerminatedString(name_index); |
| 3057 | 3057 | const name_ip = try zcu.intern_pool.getOrPutString(gpa, io, pt.tid, name, .no_embedded_nulls); |
| 3058 | 3058 | _ = try pt.getErrorValue(name_ip); |
| ... | ... | @@ -3067,7 +3067,7 @@ fn zirRetPtr(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air. |
| 3067 | 3067 | const pt = sema.pt; |
| 3068 | 3068 | const zcu = pt.zcu; |
| 3069 | 3069 | |
| 3070 | const src = block.nodeOffset(sema.code.instructions.items(.data)[@intFromEnum(inst)].node); | |
| 3070 | const src = block.nodeOffset(sema.code.instructions.items(.data)[@backingInt(inst)].node); | |
| 3071 | 3071 | |
| 3072 | 3072 | if (block.isComptime() or sema.fn_ret_ty.comptimeOnly(zcu)) { |
| 3073 | 3073 | return sema.analyzeComptimeAlloc(block, src, sema.fn_ret_ty, .none); |
| ... | ... | @@ -3090,13 +3090,13 @@ fn zirRetPtr(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air. |
| 3090 | 3090 | } |
| 3091 | 3091 | |
| 3092 | 3092 | fn zirRef(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 3093 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].un_tok; | |
| 3093 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].un_tok; | |
| 3094 | 3094 | const operand = sema.resolveInst(inst_data.operand); |
| 3095 | 3095 | return sema.analyzeRef(block, block.tokenOffset(inst_data.src_tok), operand, .none); |
| 3096 | 3096 | } |
| 3097 | 3097 | |
| 3098 | 3098 | fn zirDeref(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 3099 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].un_node; | |
| 3099 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].un_node; | |
| 3100 | 3100 | const src = block.nodeOffset(inst_data.src_node); |
| 3101 | 3101 | const ptr_src = block.src(.{ .node_offset_deref_ptr = inst_data.src_node }); |
| 3102 | 3102 | const operand = sema.resolveInst(inst_data.operand); |
| ... | ... | @@ -3109,7 +3109,7 @@ fn zirDeref(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.I |
| 3109 | 3109 | fn zirRefDeref(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 3110 | 3110 | const pt = sema.pt; |
| 3111 | 3111 | const zcu = pt.zcu; |
| 3112 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].un_node; | |
| 3112 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].un_node; | |
| 3113 | 3113 | const src = block.nodeOffset(inst_data.src_node); |
| 3114 | 3114 | const operand = sema.resolveInst(inst_data.operand); |
| 3115 | 3115 | const operand_ty = sema.typeOf(operand); |
| ... | ... | @@ -3169,7 +3169,7 @@ fn validateDeref( |
| 3169 | 3169 | } |
| 3170 | 3170 | |
| 3171 | 3171 | fn zirEnsureResultUsed(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void { |
| 3172 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].un_node; | |
| 3172 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].un_node; | |
| 3173 | 3173 | const operand = sema.resolveInst(inst_data.operand); |
| 3174 | 3174 | const src = block.nodeOffset(inst_data.src_node); |
| 3175 | 3175 | |
| ... | ... | @@ -3212,7 +3212,7 @@ fn ensureResultUsed( |
| 3212 | 3212 | fn zirEnsureResultNonError(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void { |
| 3213 | 3213 | const pt = sema.pt; |
| 3214 | 3214 | const zcu = pt.zcu; |
| 3215 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].un_node; | |
| 3215 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].un_node; | |
| 3216 | 3216 | const operand = sema.resolveInst(inst_data.operand); |
| 3217 | 3217 | const src = block.nodeOffset(inst_data.src_node); |
| 3218 | 3218 | const operand_ty = sema.typeOf(operand); |
| ... | ... | @@ -3234,7 +3234,7 @@ fn zirEnsureResultNonError(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Com |
| 3234 | 3234 | fn zirEnsureErrUnionPayloadVoid(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void { |
| 3235 | 3235 | const pt = sema.pt; |
| 3236 | 3236 | const zcu = pt.zcu; |
| 3237 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].un_node; | |
| 3237 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].un_node; | |
| 3238 | 3238 | const src = block.nodeOffset(inst_data.src_node); |
| 3239 | 3239 | const operand = sema.resolveInst(inst_data.operand); |
| 3240 | 3240 | const operand_ty = sema.typeOf(operand); |
| ... | ... | @@ -3256,7 +3256,7 @@ fn zirEnsureErrUnionPayloadVoid(sema: *Sema, block: *Block, inst: Zir.Inst.Index |
| 3256 | 3256 | } |
| 3257 | 3257 | |
| 3258 | 3258 | fn zirIndexablePtrLen(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 3259 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].un_node; | |
| 3259 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].un_node; | |
| 3260 | 3260 | const src = block.nodeOffset(inst_data.src_node); |
| 3261 | 3261 | const object = sema.resolveInst(inst_data.operand); |
| 3262 | 3262 | |
| ... | ... | @@ -3320,13 +3320,13 @@ fn zirAllocExtended( |
| 3320 | 3320 | var extra_index: usize = extra.end; |
| 3321 | 3321 | |
| 3322 | 3322 | const var_ty: Type = if (small.has_type) blk: { |
| 3323 | const type_ref: Zir.Inst.Ref = @enumFromInt(sema.code.extra[extra_index]); | |
| 3323 | const type_ref: Zir.Inst.Ref = @fromBackingInt(@intCast(sema.code.extra[extra_index])); | |
| 3324 | 3324 | extra_index += 1; |
| 3325 | 3325 | break :blk try sema.resolveType(block, ty_src, type_ref); |
| 3326 | 3326 | } else undefined; |
| 3327 | 3327 | |
| 3328 | 3328 | const alignment = if (small.has_align) blk: { |
| 3329 | const align_ref: Zir.Inst.Ref = @enumFromInt(sema.code.extra[extra_index]); | |
| 3329 | const align_ref: Zir.Inst.Ref = @fromBackingInt(@intCast(sema.code.extra[extra_index])); | |
| 3330 | 3330 | extra_index += 1; |
| 3331 | 3331 | break :blk try sema.resolveAlign(block, align_src, align_ref); |
| 3332 | 3332 | } else .none; |
| ... | ... | @@ -3361,7 +3361,7 @@ fn zirAllocExtended( |
| 3361 | 3361 | } |
| 3362 | 3362 | |
| 3363 | 3363 | if (block.isComptime() or small.is_comptime) { |
| 3364 | const iac_index: Air.Inst.Index = @enumFromInt(sema.air_instructions.len); | |
| 3364 | const iac_index: Air.Inst.Index = @fromBackingInt(@intCast(sema.air_instructions.len)); | |
| 3365 | 3365 | try sema.air_instructions.append(gpa, .{ |
| 3366 | 3366 | .tag = .inferred_alloc_comptime, |
| 3367 | 3367 | .data = .{ .inferred_alloc_comptime = .{ |
| ... | ... | @@ -3389,7 +3389,7 @@ fn zirAllocExtended( |
| 3389 | 3389 | } |
| 3390 | 3390 | |
| 3391 | 3391 | fn zirAllocComptime(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 3392 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].un_node; | |
| 3392 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].un_node; | |
| 3393 | 3393 | const ty_src = block.src(.{ .node_offset_var_decl_ty = inst_data.src_node }); |
| 3394 | 3394 | const var_src = block.nodeOffset(inst_data.src_node); |
| 3395 | 3395 | const var_ty = try sema.resolveType(block, ty_src, inst_data.operand); |
| ... | ... | @@ -3400,7 +3400,7 @@ fn zirAllocComptime(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileErr |
| 3400 | 3400 | fn zirMakePtrConst(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 3401 | 3401 | const pt = sema.pt; |
| 3402 | 3402 | const zcu = pt.zcu; |
| 3403 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].un_node; | |
| 3403 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].un_node; | |
| 3404 | 3404 | const alloc = sema.resolveInst(inst_data.operand); |
| 3405 | 3405 | const alloc_ty = sema.typeOf(alloc); |
| 3406 | 3406 | const ptr_info = alloc_ty.ptrInfo(zcu); |
| ... | ... | @@ -3502,7 +3502,7 @@ fn resolveComptimeKnownAllocPtr(sema: *Sema, block: *Block, alloc: Air.Inst.Ref, |
| 3502 | 3502 | |
| 3503 | 3503 | simple: { |
| 3504 | 3504 | if (stores.len != 1) break :simple; |
| 3505 | const store_inst = sema.air_instructions.get(@intFromEnum(stores[0])); | |
| 3505 | const store_inst = sema.air_instructions.get(@backingInt(stores[0])); | |
| 3506 | 3506 | switch (store_inst.tag) { |
| 3507 | 3507 | .store, .store_safe => {}, |
| 3508 | 3508 | .set_union_tag, .optional_payload_ptr_set, .errunion_payload_ptr_set => break :simple, // there's OPV stuff going on! |
| ... | ... | @@ -3536,7 +3536,7 @@ fn resolveComptimeKnownAllocPtr(sema: *Sema, block: *Block, alloc: Air.Inst.Ref, |
| 3536 | 3536 | var to_map = try std.array_list.Managed(Air.Inst.Index).initCapacity(sema.arena, stores.len); |
| 3537 | 3537 | |
| 3538 | 3538 | for (stores) |store_inst_idx| { |
| 3539 | const store_inst = sema.air_instructions.get(@intFromEnum(store_inst_idx)); | |
| 3539 | const store_inst = sema.air_instructions.get(@backingInt(store_inst_idx)); | |
| 3540 | 3540 | const ptr_to_map = switch (store_inst.tag) { |
| 3541 | 3541 | .store, .store_safe => store_inst.data.bin_op.lhs.toIndex().?, // Map the pointer being stored to. |
| 3542 | 3542 | .set_union_tag => store_inst.data.bin_op.lhs.toIndex().?, // Map the union pointer. |
| ... | ... | @@ -3557,12 +3557,12 @@ fn resolveComptimeKnownAllocPtr(sema: *Sema, block: *Block, alloc: Air.Inst.Ref, |
| 3557 | 3557 | field: u32, |
| 3558 | 3558 | elem: u64, |
| 3559 | 3559 | }; |
| 3560 | const inst_tag = tmp_air.instructions.items(.tag)[@intFromEnum(air_ptr)]; | |
| 3560 | const inst_tag = tmp_air.instructions.items(.tag)[@backingInt(air_ptr)]; | |
| 3561 | 3561 | const air_parent_ptr: Air.Inst.Ref, const method: PointerMethod = switch (inst_tag) { |
| 3562 | 3562 | .struct_field_ptr => blk: { |
| 3563 | 3563 | const data = tmp_air.extraData( |
| 3564 | 3564 | Air.StructField, |
| 3565 | tmp_air.instructions.items(.data)[@intFromEnum(air_ptr)].ty_pl.payload, | |
| 3565 | tmp_air.instructions.items(.data)[@backingInt(air_ptr)].ty_pl.payload, | |
| 3566 | 3566 | ).data; |
| 3567 | 3567 | break :blk .{ |
| 3568 | 3568 | data.struct_operand, |
| ... | ... | @@ -3574,7 +3574,7 @@ fn resolveComptimeKnownAllocPtr(sema: *Sema, block: *Block, alloc: Air.Inst.Ref, |
| 3574 | 3574 | .struct_field_ptr_index_2, |
| 3575 | 3575 | .struct_field_ptr_index_3, |
| 3576 | 3576 | => .{ |
| 3577 | tmp_air.instructions.items(.data)[@intFromEnum(air_ptr)].ty_op.operand, | |
| 3577 | tmp_air.instructions.items(.data)[@backingInt(air_ptr)].ty_op.operand, | |
| 3578 | 3578 | .{ .field = switch (inst_tag) { |
| 3579 | 3579 | .struct_field_ptr_index_0 => 0, |
| 3580 | 3580 | .struct_field_ptr_index_1 => 1, |
| ... | ... | @@ -3584,17 +3584,17 @@ fn resolveComptimeKnownAllocPtr(sema: *Sema, block: *Block, alloc: Air.Inst.Ref, |
| 3584 | 3584 | } }, |
| 3585 | 3585 | }, |
| 3586 | 3586 | .ptr_slice_ptr_ptr => .{ |
| 3587 | tmp_air.instructions.items(.data)[@intFromEnum(air_ptr)].ty_op.operand, | |
| 3587 | tmp_air.instructions.items(.data)[@backingInt(air_ptr)].ty_op.operand, | |
| 3588 | 3588 | .{ .field = Value.slice_ptr_index }, |
| 3589 | 3589 | }, |
| 3590 | 3590 | .ptr_slice_len_ptr => .{ |
| 3591 | tmp_air.instructions.items(.data)[@intFromEnum(air_ptr)].ty_op.operand, | |
| 3591 | tmp_air.instructions.items(.data)[@backingInt(air_ptr)].ty_op.operand, | |
| 3592 | 3592 | .{ .field = Value.slice_len_index }, |
| 3593 | 3593 | }, |
| 3594 | 3594 | .ptr_elem_ptr => blk: { |
| 3595 | 3595 | const data = tmp_air.extraData( |
| 3596 | 3596 | Air.Bin, |
| 3597 | tmp_air.instructions.items(.data)[@intFromEnum(air_ptr)].ty_pl.payload, | |
| 3597 | tmp_air.instructions.items(.data)[@backingInt(air_ptr)].ty_pl.payload, | |
| 3598 | 3598 | ).data; |
| 3599 | 3599 | const idx_val = sema.resolveValue(data.rhs).?; |
| 3600 | 3600 | break :blk .{ |
| ... | ... | @@ -3603,15 +3603,15 @@ fn resolveComptimeKnownAllocPtr(sema: *Sema, block: *Block, alloc: Air.Inst.Ref, |
| 3603 | 3603 | }; |
| 3604 | 3604 | }, |
| 3605 | 3605 | .ptr_cast => .{ |
| 3606 | tmp_air.instructions.items(.data)[@intFromEnum(air_ptr)].ty_op.operand, | |
| 3606 | tmp_air.instructions.items(.data)[@backingInt(air_ptr)].ty_op.operand, | |
| 3607 | 3607 | .same_addr, |
| 3608 | 3608 | }, |
| 3609 | 3609 | .optional_payload_ptr_set => .{ |
| 3610 | tmp_air.instructions.items(.data)[@intFromEnum(air_ptr)].ty_op.operand, | |
| 3610 | tmp_air.instructions.items(.data)[@backingInt(air_ptr)].ty_op.operand, | |
| 3611 | 3611 | .opt_payload, |
| 3612 | 3612 | }, |
| 3613 | 3613 | .errunion_payload_ptr_set => .{ |
| 3614 | tmp_air.instructions.items(.data)[@intFromEnum(air_ptr)].ty_op.operand, | |
| 3614 | tmp_air.instructions.items(.data)[@backingInt(air_ptr)].ty_op.operand, | |
| 3615 | 3615 | .eu_payload, |
| 3616 | 3616 | }, |
| 3617 | 3617 | else => unreachable, |
| ... | ... | @@ -3688,7 +3688,7 @@ fn resolveComptimeKnownAllocPtr(sema: *Sema, block: *Block, alloc: Air.Inst.Ref, |
| 3688 | 3688 | // instructions were already done above. |
| 3689 | 3689 | |
| 3690 | 3690 | for (stores) |store_inst_idx| { |
| 3691 | const store_inst = sema.air_instructions.get(@intFromEnum(store_inst_idx)); | |
| 3691 | const store_inst = sema.air_instructions.get(@backingInt(store_inst_idx)); | |
| 3692 | 3692 | switch (store_inst.tag) { |
| 3693 | 3693 | .optional_payload_ptr_set, .errunion_payload_ptr_set => {}, // Handled explicitly above |
| 3694 | 3694 | .set_union_tag => { |
| ... | ... | @@ -3750,9 +3750,9 @@ fn finishResolveComptimeKnownAllocPtr( |
| 3750 | 3750 | .operand = .zero_usize, |
| 3751 | 3751 | } } }; |
| 3752 | 3752 | |
| 3753 | sema.air_instructions.set(@intFromEnum(alloc_inst), nop_inst); | |
| 3753 | sema.air_instructions.set(@backingInt(alloc_inst), nop_inst); | |
| 3754 | 3754 | for (comptime_info.stores.items(.inst)) |store_inst| { |
| 3755 | sema.air_instructions.set(@intFromEnum(store_inst), nop_inst); | |
| 3755 | sema.air_instructions.set(@backingInt(store_inst), nop_inst); | |
| 3756 | 3756 | } |
| 3757 | 3757 | |
| 3758 | 3758 | if (Value.fromInterned(result_val).canMutateComptimeVarState(zcu)) { |
| ... | ... | @@ -3812,14 +3812,14 @@ fn zirAllocInferredComptime( |
| 3812 | 3812 | .ptr = undefined, |
| 3813 | 3813 | } }, |
| 3814 | 3814 | }); |
| 3815 | return @as(Air.Inst.Index, @enumFromInt(sema.air_instructions.len - 1)).toRef(); | |
| 3815 | return @as(Air.Inst.Index, @fromBackingInt(@intCast(sema.air_instructions.len - 1))).toRef(); | |
| 3816 | 3816 | } |
| 3817 | 3817 | |
| 3818 | 3818 | fn zirAlloc(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 3819 | 3819 | const pt = sema.pt; |
| 3820 | 3820 | const zcu = pt.zcu; |
| 3821 | 3821 | |
| 3822 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].un_node; | |
| 3822 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].un_node; | |
| 3823 | 3823 | const ty_src = block.src(.{ .node_offset_var_decl_ty = inst_data.src_node }); |
| 3824 | 3824 | const var_src = block.nodeOffset(inst_data.src_node); |
| 3825 | 3825 | |
| ... | ... | @@ -3848,7 +3848,7 @@ fn zirAllocMut(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 3848 | 3848 | const pt = sema.pt; |
| 3849 | 3849 | const zcu = pt.zcu; |
| 3850 | 3850 | |
| 3851 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].un_node; | |
| 3851 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].un_node; | |
| 3852 | 3852 | const ty_src = block.src(.{ .node_offset_var_decl_ty = inst_data.src_node }); |
| 3853 | 3853 | const var_src = block.nodeOffset(inst_data.src_node); |
| 3854 | 3854 | |
| ... | ... | @@ -3886,7 +3886,7 @@ fn zirAllocInferred( |
| 3886 | 3886 | .ptr = undefined, |
| 3887 | 3887 | } }, |
| 3888 | 3888 | }); |
| 3889 | return @as(Air.Inst.Index, @enumFromInt(sema.air_instructions.len - 1)).toRef(); | |
| 3889 | return @as(Air.Inst.Index, @fromBackingInt(@intCast(sema.air_instructions.len - 1))).toRef(); | |
| 3890 | 3890 | } |
| 3891 | 3891 | |
| 3892 | 3892 | const result_index = try block.addInstAsIndex(.{ |
| ... | ... | @@ -3908,24 +3908,24 @@ fn zirResolveInferredAlloc(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Com |
| 3908 | 3908 | const pt = sema.pt; |
| 3909 | 3909 | const zcu = pt.zcu; |
| 3910 | 3910 | const gpa = sema.gpa; |
| 3911 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].un_node; | |
| 3911 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].un_node; | |
| 3912 | 3912 | const src = block.nodeOffset(inst_data.src_node); |
| 3913 | 3913 | const ty_src = block.src(.{ .node_offset_var_decl_ty = inst_data.src_node }); |
| 3914 | 3914 | const ptr = sema.resolveInst(inst_data.operand); |
| 3915 | 3915 | const ptr_inst = ptr.toIndex().?; |
| 3916 | 3916 | const target = zcu.getTarget(); |
| 3917 | 3917 | |
| 3918 | switch (sema.air_instructions.items(.tag)[@intFromEnum(ptr_inst)]) { | |
| 3918 | switch (sema.air_instructions.items(.tag)[@backingInt(ptr_inst)]) { | |
| 3919 | 3919 | .inferred_alloc_comptime => { |
| 3920 | 3920 | // The work was already done for us by `Sema.storeToInferredAllocComptime`. Also, since |
| 3921 | 3921 | // we had a value of the exact correct type to store, the result type's layout must be |
| 3922 | 3922 | // already resolved. So all we need to do here is return the pointer. |
| 3923 | const iac = sema.air_instructions.items(.data)[@intFromEnum(ptr_inst)].inferred_alloc_comptime; | |
| 3923 | const iac = sema.air_instructions.items(.data)[@backingInt(ptr_inst)].inferred_alloc_comptime; | |
| 3924 | 3924 | const resolved_ptr = iac.ptr; |
| 3925 | 3925 | |
| 3926 | 3926 | if (std.debug.runtime_safety) { |
| 3927 | 3927 | // The inferred_alloc_comptime should never be referenced again |
| 3928 | sema.air_instructions.set(@intFromEnum(ptr_inst), .{ .tag = undefined, .data = undefined }); | |
| 3928 | sema.air_instructions.set(@backingInt(ptr_inst), .{ .tag = undefined, .data = undefined }); | |
| 3929 | 3929 | } |
| 3930 | 3930 | |
| 3931 | 3931 | const val = switch (zcu.intern_pool.indexToKey(resolved_ptr).ptr.base_addr) { |
| ... | ... | @@ -3948,12 +3948,12 @@ fn zirResolveInferredAlloc(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Com |
| 3948 | 3948 | return Air.internedToRef(resolved_ptr); |
| 3949 | 3949 | }, |
| 3950 | 3950 | .inferred_alloc => { |
| 3951 | const ia1 = sema.air_instructions.items(.data)[@intFromEnum(ptr_inst)].inferred_alloc; | |
| 3951 | const ia1 = sema.air_instructions.items(.data)[@backingInt(ptr_inst)].inferred_alloc; | |
| 3952 | 3952 | const ia2 = sema.unresolved_inferred_allocs.fetchSwapRemove(ptr_inst).?.value; |
| 3953 | 3953 | const peer_vals = try sema.arena.alloc(Air.Inst.Ref, ia2.prongs.items.len); |
| 3954 | 3954 | for (peer_vals, ia2.prongs.items) |*peer_val, store_inst| { |
| 3955 | assert(sema.air_instructions.items(.tag)[@intFromEnum(store_inst)] == .store); | |
| 3956 | const bin_op = sema.air_instructions.items(.data)[@intFromEnum(store_inst)].bin_op; | |
| 3955 | assert(sema.air_instructions.items(.tag)[@backingInt(store_inst)] == .store); | |
| 3956 | const bin_op = sema.air_instructions.items(.data)[@backingInt(store_inst)].bin_op; | |
| 3957 | 3957 | peer_val.* = bin_op.rhs; |
| 3958 | 3958 | } |
| 3959 | 3959 | const final_elem_ty = try sema.resolvePeerTypes(block, ty_src, peer_vals, .none); |
| ... | ... | @@ -3988,7 +3988,7 @@ fn zirResolveInferredAlloc(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Com |
| 3988 | 3988 | return sema.fail(block, mut_src, "local variable in naked function", .{}); |
| 3989 | 3989 | } |
| 3990 | 3990 | // Change it to a normal alloc. |
| 3991 | sema.air_instructions.set(@intFromEnum(ptr_inst), .{ | |
| 3991 | sema.air_instructions.set(@backingInt(ptr_inst), .{ | |
| 3992 | 3992 | .tag = .alloc, |
| 3993 | 3993 | .data = .{ .ty = final_ptr_ty }, |
| 3994 | 3994 | }); |
| ... | ... | @@ -4000,15 +4000,15 @@ fn zirResolveInferredAlloc(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Com |
| 4000 | 4000 | var replacement_block = block.makeSubBlock(); |
| 4001 | 4001 | defer replacement_block.instructions.deinit(gpa); |
| 4002 | 4002 | |
| 4003 | assert(sema.air_instructions.items(.tag)[@intFromEnum(placeholder_inst)] == .store); | |
| 4004 | const bin_op = sema.air_instructions.items(.data)[@intFromEnum(placeholder_inst)].bin_op; | |
| 4003 | assert(sema.air_instructions.items(.tag)[@backingInt(placeholder_inst)] == .store); | |
| 4004 | const bin_op = sema.air_instructions.items(.data)[@backingInt(placeholder_inst)].bin_op; | |
| 4005 | 4005 | try sema.storePtr2(&replacement_block, src, bin_op.lhs, src, bin_op.rhs, src, .store); |
| 4006 | 4006 | |
| 4007 | 4007 | // If only one instruction is produced then we can replace the store |
| 4008 | 4008 | // placeholder instruction with this instruction; no need for an entire block. |
| 4009 | 4009 | if (replacement_block.instructions.items.len == 1) { |
| 4010 | 4010 | const only_inst = replacement_block.instructions.items[0]; |
| 4011 | sema.air_instructions.set(@intFromEnum(placeholder_inst), sema.air_instructions.get(@intFromEnum(only_inst))); | |
| 4011 | sema.air_instructions.set(@backingInt(placeholder_inst), sema.air_instructions.get(@backingInt(only_inst))); | |
| 4012 | 4012 | continue; |
| 4013 | 4013 | } |
| 4014 | 4014 | |
| ... | ... | @@ -4019,7 +4019,7 @@ fn zirResolveInferredAlloc(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Com |
| 4019 | 4019 | gpa, |
| 4020 | 4020 | @typeInfo(Air.Block).@"struct".field_names.len + replacement_block.instructions.items.len, |
| 4021 | 4021 | ); |
| 4022 | sema.air_instructions.set(@intFromEnum(placeholder_inst), .{ | |
| 4022 | sema.air_instructions.set(@backingInt(placeholder_inst), .{ | |
| 4023 | 4023 | .tag = .block, |
| 4024 | 4024 | .data = .{ .ty_pl = .{ |
| 4025 | 4025 | .ty = .void_type, |
| ... | ... | @@ -4049,7 +4049,7 @@ fn zirForLen(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air. |
| 4049 | 4049 | const io = comp.io; |
| 4050 | 4050 | const ip = &zcu.intern_pool; |
| 4051 | 4051 | |
| 4052 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 4052 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 4053 | 4053 | const extra = sema.code.extraData(Zir.Inst.MultiOp, inst_data.payload_index); |
| 4054 | 4054 | const all_args = sema.code.refSlice(extra.end, extra.data.operands_len); |
| 4055 | 4055 | const arg_pairs: []const [2]Zir.Inst.Ref = @as([*]const [2]Zir.Inst.Ref, @ptrCast(all_args))[0..@divExact(all_args.len, 2)]; |
| ... | ... | @@ -4202,7 +4202,7 @@ fn optEuBasePtrInit(sema: *Sema, block: *Block, ptr: Air.Inst.Ref, src: LazySrcL |
| 4202 | 4202 | } |
| 4203 | 4203 | |
| 4204 | 4204 | fn zirOptEuBasePtrInit(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 4205 | const un_node = sema.code.instructions.items(.data)[@intFromEnum(inst)].un_node; | |
| 4205 | const un_node = sema.code.instructions.items(.data)[@backingInt(inst)].un_node; | |
| 4206 | 4206 | const ptr = sema.resolveInst(un_node.operand); |
| 4207 | 4207 | const src = block.nodeOffset(un_node.src_node); |
| 4208 | 4208 | try sema.ensureLayoutResolved(sema.typeOf(ptr).childType(sema.pt.zcu), src, .init); |
| ... | ... | @@ -4212,7 +4212,7 @@ fn zirOptEuBasePtrInit(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Compile |
| 4212 | 4212 | fn zirCoercePtrElemTy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 4213 | 4213 | const pt = sema.pt; |
| 4214 | 4214 | const zcu = pt.zcu; |
| 4215 | const pl_node = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 4215 | const pl_node = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 4216 | 4216 | const src = block.nodeOffset(pl_node.src_node); |
| 4217 | 4217 | const extra = sema.code.extraData(Zir.Inst.Bin, pl_node.payload_index).data; |
| 4218 | 4218 | const uncoerced_val = sema.resolveInst(extra.rhs); |
| ... | ... | @@ -4265,7 +4265,7 @@ fn zirTryOperandTy(sema: *Sema, block: *Block, inst: Zir.Inst.Index, is_ref: boo |
| 4265 | 4265 | const gpa = comp.gpa; |
| 4266 | 4266 | const io = comp.io; |
| 4267 | 4267 | |
| 4268 | const un_node = sema.code.instructions.items(.data)[@intFromEnum(inst)].un_node; | |
| 4268 | const un_node = sema.code.instructions.items(.data)[@backingInt(inst)].un_node; | |
| 4269 | 4269 | const src = block.nodeOffset(un_node.src_node); |
| 4270 | 4270 | |
| 4271 | 4271 | const operand_ty = try sema.resolveTypeOrPoison(block, src, un_node.operand) orelse return .generic_poison_type; |
| ... | ... | @@ -4311,7 +4311,7 @@ fn zirTryOperandTy(sema: *Sema, block: *Block, inst: Zir.Inst.Index, is_ref: boo |
| 4311 | 4311 | fn zirValidateRefTy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void { |
| 4312 | 4312 | const pt = sema.pt; |
| 4313 | 4313 | const zcu = pt.zcu; |
| 4314 | const un_tok = sema.code.instructions.items(.data)[@intFromEnum(inst)].un_tok; | |
| 4314 | const un_tok = sema.code.instructions.items(.data)[@backingInt(inst)].un_tok; | |
| 4315 | 4315 | const src = block.tokenOffset(un_tok.src_tok); |
| 4316 | 4316 | // In case of GenericPoison, we don't actually have a type, so this will be |
| 4317 | 4317 | // treated as an untyped address-of operator. |
| ... | ... | @@ -4329,7 +4329,7 @@ fn zirValidateRefTy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileErr |
| 4329 | 4329 | fn zirValidateConst(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void { |
| 4330 | 4330 | if (!block.isComptime()) return; |
| 4331 | 4331 | |
| 4332 | const un_node = sema.code.instructions.items(.data)[@intFromEnum(inst)].un_node; | |
| 4332 | const un_node = sema.code.instructions.items(.data)[@backingInt(inst)].un_node; | |
| 4333 | 4333 | const src = block.nodeOffset(un_node.src_node); |
| 4334 | 4334 | const init_ref = sema.resolveInst(un_node.operand); |
| 4335 | 4335 | if (!try sema.isComptimeKnown(init_ref)) { |
| ... | ... | @@ -4344,7 +4344,7 @@ fn zirValidateArrayInitRefTy( |
| 4344 | 4344 | ) CompileError!Air.Inst.Ref { |
| 4345 | 4345 | const pt = sema.pt; |
| 4346 | 4346 | const zcu = pt.zcu; |
| 4347 | const pl_node = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 4347 | const pl_node = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 4348 | 4348 | const src = block.nodeOffset(pl_node.src_node); |
| 4349 | 4349 | const extra = sema.code.extraData(Zir.Inst.ArrayInitRefTy, pl_node.payload_index).data; |
| 4350 | 4350 | const maybe_wrapped_ptr_ty = try sema.resolveTypeOrPoison(block, LazySrcLoc.unneeded, extra.ptr_ty) orelse return .generic_poison_type; |
| ... | ... | @@ -4384,7 +4384,7 @@ fn zirValidateArrayInitTy( |
| 4384 | 4384 | ) CompileError!void { |
| 4385 | 4385 | const pt = sema.pt; |
| 4386 | 4386 | const zcu = pt.zcu; |
| 4387 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 4387 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 4388 | 4388 | const src = block.nodeOffset(inst_data.src_node); |
| 4389 | 4389 | const ty_src: LazySrcLoc = if (is_result_ty) src else block.src(.{ .node_offset_init_ty = inst_data.src_node }); |
| 4390 | 4390 | const extra = sema.code.extraData(Zir.Inst.ArrayInit, inst_data.payload_index).data; |
| ... | ... | @@ -4445,7 +4445,7 @@ fn zirValidateStructInitTy( |
| 4445 | 4445 | ) CompileError!void { |
| 4446 | 4446 | const pt = sema.pt; |
| 4447 | 4447 | const zcu = pt.zcu; |
| 4448 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].un_node; | |
| 4448 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].un_node; | |
| 4449 | 4449 | const src = block.nodeOffset(inst_data.src_node); |
| 4450 | 4450 | // It's okay for the type to be poison: this will result in an anonymous struct init. |
| 4451 | 4451 | const ty = try sema.resolveTypeOrPoison(block, src, inst_data.operand) orelse return; |
| ... | ... | @@ -4465,11 +4465,11 @@ fn zirValidatePtrStructInit( |
| 4465 | 4465 | ) CompileError!void { |
| 4466 | 4466 | const pt = sema.pt; |
| 4467 | 4467 | const zcu = pt.zcu; |
| 4468 | const validate_inst = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 4468 | const validate_inst = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 4469 | 4469 | const init_src = block.nodeOffset(validate_inst.src_node); |
| 4470 | 4470 | const validate_extra = sema.code.extraData(Zir.Inst.Block, validate_inst.payload_index); |
| 4471 | 4471 | const instrs = sema.code.bodySlice(validate_extra.end, validate_extra.data.body_len); |
| 4472 | const field_ptr_data = sema.code.instructions.items(.data)[@intFromEnum(instrs[0])].pl_node; | |
| 4472 | const field_ptr_data = sema.code.instructions.items(.data)[@backingInt(instrs[0])].pl_node; | |
| 4473 | 4473 | const field_ptr_extra = sema.code.extraData(Zir.Inst.Field, field_ptr_data.payload_index).data; |
| 4474 | 4474 | const object_ptr = sema.resolveInst(field_ptr_extra.lhs); |
| 4475 | 4475 | const agg_ty = sema.typeOf(object_ptr).childType(zcu).optEuBaseType(zcu); |
| ... | ... | @@ -4511,7 +4511,7 @@ fn validateUnionInit( |
| 4511 | 4511 | errdefer msg.destroy(sema.gpa); |
| 4512 | 4512 | |
| 4513 | 4513 | for (instrs[1..]) |inst| { |
| 4514 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 4514 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 4515 | 4515 | const inst_src = block.src(.{ .node_offset_initializer = inst_data.src_node }); |
| 4516 | 4516 | try sema.errNote(inst_src, msg, "additional initializer here", .{}); |
| 4517 | 4517 | } |
| ... | ... | @@ -4542,7 +4542,7 @@ fn validateStructInit( |
| 4542 | 4542 | @memset(found_fields, false); |
| 4543 | 4543 | |
| 4544 | 4544 | for (instrs) |field_ptr| { |
| 4545 | const field_ptr_data = sema.code.instructions.items(.data)[@intFromEnum(field_ptr)].pl_node; | |
| 4545 | const field_ptr_data = sema.code.instructions.items(.data)[@backingInt(field_ptr)].pl_node; | |
| 4546 | 4546 | const field_src = block.src(.{ .node_offset_initializer = field_ptr_data.src_node }); |
| 4547 | 4547 | const field_ptr_extra = sema.code.extraData(Zir.Inst.Field, field_ptr_data.payload_index).data; |
| 4548 | 4548 | const field_name = try ip.getOrPutString( |
| ... | ... | @@ -4631,11 +4631,11 @@ fn zirValidatePtrArrayInit( |
| 4631 | 4631 | ) CompileError!void { |
| 4632 | 4632 | const pt = sema.pt; |
| 4633 | 4633 | const zcu = pt.zcu; |
| 4634 | const validate_inst = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 4634 | const validate_inst = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 4635 | 4635 | const init_src = block.nodeOffset(validate_inst.src_node); |
| 4636 | 4636 | const validate_extra = sema.code.extraData(Zir.Inst.Block, validate_inst.payload_index); |
| 4637 | 4637 | const instrs = sema.code.bodySlice(validate_extra.end, validate_extra.data.body_len); |
| 4638 | const first_elem_ptr_data = sema.code.instructions.items(.data)[@intFromEnum(instrs[0])].pl_node; | |
| 4638 | const first_elem_ptr_data = sema.code.instructions.items(.data)[@backingInt(instrs[0])].pl_node; | |
| 4639 | 4639 | const elem_ptr_extra = sema.code.extraData(Zir.Inst.ElemPtrImm, first_elem_ptr_data.payload_index).data; |
| 4640 | 4640 | const array_ptr = sema.resolveInst(elem_ptr_extra.ptr); |
| 4641 | 4641 | const array_ty = sema.typeOf(array_ptr).childType(zcu).optEuBaseType(zcu); |
| ... | ... | @@ -4695,7 +4695,7 @@ fn zirValidatePtrArrayInit( |
| 4695 | 4695 | fn zirValidateDestructure(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void { |
| 4696 | 4696 | const pt = sema.pt; |
| 4697 | 4697 | const zcu = pt.zcu; |
| 4698 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 4698 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 4699 | 4699 | const extra = sema.code.extraData(Zir.Inst.ValidateDestructure, inst_data.payload_index).data; |
| 4700 | 4700 | const src = block.nodeOffset(inst_data.src_node); |
| 4701 | 4701 | const destructure_src = block.nodeOffset(extra.destructure_node); |
| ... | ... | @@ -4821,7 +4821,7 @@ pub fn addDeclaredHereNote(sema: *Sema, parent: *Zcu.ErrorMsg, decl_ty: Type) Al |
| 4821 | 4821 | } |
| 4822 | 4822 | |
| 4823 | 4823 | fn zirStoreToInferredPtr(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void { |
| 4824 | const pl_node = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 4824 | const pl_node = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 4825 | 4825 | const src = block.nodeOffset(pl_node.src_node); |
| 4826 | 4826 | const bin = sema.code.extraData(Zir.Inst.Bin, pl_node.payload_index).data; |
| 4827 | 4827 | const ptr = sema.resolveInst(bin.lhs); |
| ... | ... | @@ -4829,9 +4829,9 @@ fn zirStoreToInferredPtr(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Compi |
| 4829 | 4829 | const ptr_inst = ptr.toIndex().?; |
| 4830 | 4830 | const air_datas = sema.air_instructions.items(.data); |
| 4831 | 4831 | |
| 4832 | switch (sema.air_instructions.items(.tag)[@intFromEnum(ptr_inst)]) { | |
| 4832 | switch (sema.air_instructions.items(.tag)[@backingInt(ptr_inst)]) { | |
| 4833 | 4833 | .inferred_alloc_comptime => { |
| 4834 | const iac = &air_datas[@intFromEnum(ptr_inst)].inferred_alloc_comptime; | |
| 4834 | const iac = &air_datas[@backingInt(ptr_inst)].inferred_alloc_comptime; | |
| 4835 | 4835 | return sema.storeToInferredAllocComptime(block, src, operand, iac); |
| 4836 | 4836 | }, |
| 4837 | 4837 | .inferred_alloc => { |
| ... | ... | @@ -4904,7 +4904,7 @@ fn storeToInferredAllocComptime( |
| 4904 | 4904 | } |
| 4905 | 4905 | |
| 4906 | 4906 | fn zirSetEvalBranchQuota(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void { |
| 4907 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].un_node; | |
| 4907 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].un_node; | |
| 4908 | 4908 | const src = block.nodeOffset(inst_data.src_node); |
| 4909 | 4909 | const quota: u32 = @intCast(try sema.resolveInt(block, src, inst_data.operand, .u32, .{ .simple = .operand_setEvalBranchQuota })); |
| 4910 | 4910 | sema.branch_quota = @max(sema.branch_quota, quota); |
| ... | ... | @@ -4914,14 +4914,14 @@ fn zirSetEvalBranchQuota(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Compi |
| 4914 | 4914 | fn zirStoreNode(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void { |
| 4915 | 4915 | const zir_tags = sema.code.instructions.items(.tag); |
| 4916 | 4916 | const zir_datas = sema.code.instructions.items(.data); |
| 4917 | const inst_data = zir_datas[@intFromEnum(inst)].pl_node; | |
| 4917 | const inst_data = zir_datas[@backingInt(inst)].pl_node; | |
| 4918 | 4918 | const src = block.nodeOffset(inst_data.src_node); |
| 4919 | 4919 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; |
| 4920 | 4920 | const ptr = sema.resolveInst(extra.lhs); |
| 4921 | 4921 | const operand = sema.resolveInst(extra.rhs); |
| 4922 | 4922 | |
| 4923 | 4923 | const is_ret = if (extra.lhs.toIndex()) |ptr_index| |
| 4924 | zir_tags[@intFromEnum(ptr_index)] == .ret_ptr | |
| 4924 | zir_tags[@backingInt(ptr_index)] == .ret_ptr | |
| 4925 | 4925 | else |
| 4926 | 4926 | false; |
| 4927 | 4927 | |
| ... | ... | @@ -4943,7 +4943,7 @@ fn zirStr(sema: *Sema, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 4943 | 4943 | const gpa = comp.gpa; |
| 4944 | 4944 | const io = comp.io; |
| 4945 | 4945 | const ip = &zcu.intern_pool; |
| 4946 | const bytes = sema.code.instructions.items(.data)[@intFromEnum(inst)].str.get(sema.code); | |
| 4946 | const bytes = sema.code.instructions.items(.data)[@backingInt(inst)].str.get(sema.code); | |
| 4947 | 4947 | return sema.addStrLit( |
| 4948 | 4948 | try ip.getOrPutString(gpa, io, pt.tid, bytes, .maybe_embedded_nulls), |
| 4949 | 4949 | bytes.len, |
| ... | ... | @@ -4975,16 +4975,16 @@ fn uavRef(sema: *Sema, val: Value) CompileError!Air.Inst.Ref { |
| 4975 | 4975 | fn zirInt(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 4976 | 4976 | _ = block; |
| 4977 | 4977 | |
| 4978 | const int = sema.code.instructions.items(.data)[@intFromEnum(inst)].int; | |
| 4978 | const int = sema.code.instructions.items(.data)[@backingInt(inst)].int; | |
| 4979 | 4979 | return sema.pt.intRef(.comptime_int, int); |
| 4980 | 4980 | } |
| 4981 | 4981 | |
| 4982 | 4982 | fn zirIntBig(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 4983 | 4983 | _ = block; |
| 4984 | 4984 | |
| 4985 | const int = sema.code.instructions.items(.data)[@intFromEnum(inst)].str; | |
| 4985 | const int = sema.code.instructions.items(.data)[@backingInt(inst)].str; | |
| 4986 | 4986 | const byte_count = int.len * @sizeOf(std.math.big.Limb); |
| 4987 | const limb_bytes = sema.code.string_bytes[@intFromEnum(int.start)..][0..byte_count]; | |
| 4987 | const limb_bytes = sema.code.string_bytes[@backingInt(int.start)..][0..byte_count]; | |
| 4988 | 4988 | |
| 4989 | 4989 | // TODO: this allocation and copy is only needed because the limbs may be unaligned. |
| 4990 | 4990 | // If ZIR is adjusted so that big int limbs are guaranteed to be aligned, these |
| ... | ... | @@ -5000,7 +5000,7 @@ fn zirIntBig(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air. |
| 5000 | 5000 | |
| 5001 | 5001 | fn zirFloat(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 5002 | 5002 | _ = block; |
| 5003 | const number = sema.code.instructions.items(.data)[@intFromEnum(inst)].float; | |
| 5003 | const number = sema.code.instructions.items(.data)[@backingInt(inst)].float; | |
| 5004 | 5004 | return Air.internedToRef((try sema.pt.floatValue( |
| 5005 | 5005 | .comptime_float, |
| 5006 | 5006 | number, |
| ... | ... | @@ -5009,14 +5009,14 @@ fn zirFloat(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.I |
| 5009 | 5009 | |
| 5010 | 5010 | fn zirFloat128(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 5011 | 5011 | _ = block; |
| 5012 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 5012 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 5013 | 5013 | const extra = sema.code.extraData(Zir.Inst.Float128, inst_data.payload_index).data; |
| 5014 | 5014 | const number = extra.get(); |
| 5015 | 5015 | return Air.internedToRef((try sema.pt.floatValue(.comptime_float, number)).toIntern()); |
| 5016 | 5016 | } |
| 5017 | 5017 | |
| 5018 | 5018 | fn zirCompileError(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void { |
| 5019 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].un_node; | |
| 5019 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].un_node; | |
| 5020 | 5020 | const src = block.nodeOffset(inst_data.src_node); |
| 5021 | 5021 | const operand_src = block.builtinCallArgSrc(inst_data.src_node, 0); |
| 5022 | 5022 | const msg = try sema.resolveConstString(block, operand_src, inst_data.operand, .{ .simple = .compile_error_string }); |
| ... | ... | @@ -5059,7 +5059,7 @@ fn zirCompileLog( |
| 5059 | 5059 | const line_data = try zcu.intern_pool.getOrPutString(gpa, io, pt.tid, aw.written(), .no_embedded_nulls); |
| 5060 | 5060 | |
| 5061 | 5061 | const line_idx: Zcu.CompileLogLine.Index = if (zcu.free_compile_log_lines.pop()) |idx| idx: { |
| 5062 | zcu.compile_log_lines.items[@intFromEnum(idx)] = .{ | |
| 5062 | zcu.compile_log_lines.items[@backingInt(idx)] = .{ | |
| 5063 | 5063 | .next = .none, |
| 5064 | 5064 | .data = line_data, |
| 5065 | 5065 | }; |
| ... | ... | @@ -5069,7 +5069,7 @@ fn zirCompileLog( |
| 5069 | 5069 | .next = .none, |
| 5070 | 5070 | .data = line_data, |
| 5071 | 5071 | }); |
| 5072 | break :idx @enumFromInt(zcu.compile_log_lines.items.len - 1); | |
| 5072 | break :idx @fromBackingInt(@intCast(zcu.compile_log_lines.items.len - 1)); | |
| 5073 | 5073 | }; |
| 5074 | 5074 | |
| 5075 | 5075 | const gop = try zcu.compile_logs.getOrPut(gpa, sema.owner); |
| ... | ... | @@ -5093,7 +5093,7 @@ fn zirPanic(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void |
| 5093 | 5093 | const pt = sema.pt; |
| 5094 | 5094 | const zcu = pt.zcu; |
| 5095 | 5095 | |
| 5096 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].un_node; | |
| 5096 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].un_node; | |
| 5097 | 5097 | const src = block.nodeOffset(inst_data.src_node); |
| 5098 | 5098 | const msg_inst = sema.resolveInst(inst_data.operand); |
| 5099 | 5099 | |
| ... | ... | @@ -5135,7 +5135,7 @@ fn zirPanic(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void |
| 5135 | 5135 | } |
| 5136 | 5136 | |
| 5137 | 5137 | fn zirTrap(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void { |
| 5138 | const src_node = sema.code.instructions.items(.data)[@intFromEnum(inst)].node; | |
| 5138 | const src_node = sema.code.instructions.items(.data)[@backingInt(inst)].node; | |
| 5139 | 5139 | const src = block.nodeOffset(src_node); |
| 5140 | 5140 | if (block.isComptime()) |
| 5141 | 5141 | return sema.fail(block, src, "encountered @trap at comptime", .{}); |
| ... | ... | @@ -5143,7 +5143,7 @@ fn zirTrap(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void { |
| 5143 | 5143 | } |
| 5144 | 5144 | |
| 5145 | 5145 | fn zirBreakpoint(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstData) CompileError!void { |
| 5146 | const src_node: std.zig.Ast.Node.Offset = @enumFromInt(@as(i32, @bitCast(extended.operand))); | |
| 5146 | const src_node: std.zig.Ast.Node.Offset = @fromBackingInt(@intCast(@as(i32, @bitCast(extended.operand)))); | |
| 5147 | 5147 | const src = block.nodeOffset(src_node); |
| 5148 | 5148 | if (block.isComptime()) |
| 5149 | 5149 | return sema.fail(block, src, "encountered @breakpoint at comptime", .{}); |
| ... | ... | @@ -5153,7 +5153,7 @@ fn zirBreakpoint(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstDat |
| 5153 | 5153 | fn zirLoop(sema: *Sema, parent_block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 5154 | 5154 | const pt = sema.pt; |
| 5155 | 5155 | const zcu = pt.zcu; |
| 5156 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 5156 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 5157 | 5157 | const src = parent_block.nodeOffset(inst_data.src_node); |
| 5158 | 5158 | const extra = sema.code.extraData(Zir.Inst.Block, inst_data.payload_index); |
| 5159 | 5159 | const body = sema.code.bodySlice(extra.end, extra.data.body_len); |
| ... | ... | @@ -5163,8 +5163,8 @@ fn zirLoop(sema: *Sema, parent_block: *Block, inst: Zir.Inst.Index) CompileError |
| 5163 | 5163 | // Reserve space for a Loop instruction so that generated Break instructions can |
| 5164 | 5164 | // point to it, even if it doesn't end up getting used because the code ends up being |
| 5165 | 5165 | // comptime evaluated. |
| 5166 | const block_inst: Air.Inst.Index = @enumFromInt(sema.air_instructions.len); | |
| 5167 | const loop_inst: Air.Inst.Index = @enumFromInt(@intFromEnum(block_inst) + 1); | |
| 5166 | const block_inst: Air.Inst.Index = @fromBackingInt(@intCast(sema.air_instructions.len)); | |
| 5167 | const loop_inst: Air.Inst.Index = @fromBackingInt(@intCast(@backingInt(block_inst) + 1)); | |
| 5168 | 5168 | try sema.air_instructions.ensureUnusedCapacity(gpa, 2); |
| 5169 | 5169 | sema.air_instructions.appendAssumeCapacity(.{ |
| 5170 | 5170 | .tag = .block, |
| ... | ... | @@ -5224,7 +5224,7 @@ fn zirLoop(sema: *Sema, parent_block: *Block, inst: Zir.Inst.Index) CompileError |
| 5224 | 5224 | try child_block.instructions.append(gpa, loop_inst); |
| 5225 | 5225 | |
| 5226 | 5226 | try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.Block).@"struct".field_names.len + loop_block_len + 1); |
| 5227 | sema.air_instructions.items(.data)[@intFromEnum(loop_inst)].ty_pl.payload = sema.addExtraAssumeCapacity( | |
| 5227 | sema.air_instructions.items(.data)[@backingInt(loop_inst)].ty_pl.payload = sema.addExtraAssumeCapacity( | |
| 5228 | 5228 | Air.Block{ .body_len = @intCast(loop_block_len + 1) }, |
| 5229 | 5229 | ); |
| 5230 | 5230 | sema.air_extra.appendSliceAssumeCapacity(@ptrCast(loop_block.instructions.items)); |
| ... | ... | @@ -5233,13 +5233,13 @@ fn zirLoop(sema: *Sema, parent_block: *Block, inst: Zir.Inst.Index) CompileError |
| 5233 | 5233 | } |
| 5234 | 5234 | |
| 5235 | 5235 | fn zirSuspendBlock(sema: *Sema, parent_block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 5236 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 5236 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 5237 | 5237 | const src = parent_block.nodeOffset(inst_data.src_node); |
| 5238 | 5238 | return sema.failWithUseOfAsync(parent_block, src); |
| 5239 | 5239 | } |
| 5240 | 5240 | |
| 5241 | 5241 | fn zirBlock(sema: *Sema, parent_block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 5242 | const pl_node = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 5242 | const pl_node = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 5243 | 5243 | const src = parent_block.nodeOffset(pl_node.src_node); |
| 5244 | 5244 | const extra = sema.code.extraData(Zir.Inst.Block, pl_node.payload_index); |
| 5245 | 5245 | const body = sema.code.bodySlice(extra.end, extra.data.body_len); |
| ... | ... | @@ -5248,7 +5248,7 @@ fn zirBlock(sema: *Sema, parent_block: *Block, inst: Zir.Inst.Index) CompileErro |
| 5248 | 5248 | // Reserve space for a Block instruction so that generated Break instructions can |
| 5249 | 5249 | // point to it, even if it doesn't end up getting used because the code ends up being |
| 5250 | 5250 | // comptime evaluated or is an unlabeled block. |
| 5251 | const block_inst: Air.Inst.Index = @enumFromInt(sema.air_instructions.len); | |
| 5251 | const block_inst: Air.Inst.Index = @fromBackingInt(@intCast(sema.air_instructions.len)); | |
| 5252 | 5252 | try sema.air_instructions.append(gpa, .{ |
| 5253 | 5253 | .tag = .block, |
| 5254 | 5254 | .data = undefined, |
| ... | ... | @@ -5306,7 +5306,7 @@ fn resolveBlockBody( |
| 5306 | 5306 | if (child_block.isComptime()) { |
| 5307 | 5307 | return sema.resolveInlineBody(child_block, body, body_inst); |
| 5308 | 5308 | } else { |
| 5309 | assert(sema.air_instructions.items(.tag)[@intFromEnum(merges.block_inst)] == .block); | |
| 5309 | assert(sema.air_instructions.items(.tag)[@backingInt(merges.block_inst)] == .block); | |
| 5310 | 5310 | var need_debug_scope = false; |
| 5311 | 5311 | child_block.need_debug_scope = &need_debug_scope; |
| 5312 | 5312 | if (sema.analyzeBodyInner(child_block, body)) { |
| ... | ... | @@ -5314,7 +5314,7 @@ fn resolveBlockBody( |
| 5314 | 5314 | } else |err| switch (err) { |
| 5315 | 5315 | error.ComptimeBreak => { |
| 5316 | 5316 | const break_inst = sema.comptime_break_inst; |
| 5317 | const break_data = sema.code.instructions.items(.data)[@intFromEnum(break_inst)].@"break"; | |
| 5317 | const break_data = sema.code.instructions.items(.data)[@backingInt(break_inst)].@"break"; | |
| 5318 | 5318 | const extra = sema.code.extraData(Zir.Inst.Break, break_data.payload_index).data; |
| 5319 | 5319 | const breaks_to_body = extra.block_inst == body_inst; |
| 5320 | 5320 | |
| ... | ... | @@ -5330,7 +5330,7 @@ fn resolveBlockBody( |
| 5330 | 5330 | try parent_block.instructions.append(sema.gpa, merges.block_inst); |
| 5331 | 5331 | try sema.air_extra.ensureUnusedCapacity(sema.gpa, @typeInfo(Air.Block).@"struct".field_names.len + |
| 5332 | 5332 | child_block.instructions.items.len); |
| 5333 | sema.air_instructions.items(.data)[@intFromEnum(merges.block_inst)] = .{ .ty_pl = .{ | |
| 5333 | sema.air_instructions.items(.data)[@backingInt(merges.block_inst)] = .{ .ty_pl = .{ | |
| 5334 | 5334 | .ty = Air.internedToRef(operand_ty.toIntern()), |
| 5335 | 5335 | .payload = sema.addExtraAssumeCapacity(Air.Block{ |
| 5336 | 5336 | .body_len = @intCast(child_block.instructions.items.len), |
| ... | ... | @@ -5386,7 +5386,7 @@ fn resolveAnalyzedBlock( |
| 5386 | 5386 | assert(child_block.instructions.items.len != 0); |
| 5387 | 5387 | assert(sema.typeOf(child_block.instructions.items[child_block.instructions.items.len - 1].toRef()).isNoReturn(zcu)); |
| 5388 | 5388 | |
| 5389 | const block_tag = sema.air_instructions.items(.tag)[@intFromEnum(merges.block_inst)]; | |
| 5389 | const block_tag = sema.air_instructions.items(.tag)[@backingInt(merges.block_inst)]; | |
| 5390 | 5390 | switch (block_tag) { |
| 5391 | 5391 | .block => {}, |
| 5392 | 5392 | .dbg_inline_block => assert(need_debug_scope), |
| ... | ... | @@ -5412,7 +5412,7 @@ fn resolveAnalyzedBlock( |
| 5412 | 5412 | try parent_block.instructions.append(gpa, merges.block_inst); |
| 5413 | 5413 | try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.DbgInlineBlock).@"struct".field_names.len + |
| 5414 | 5414 | child_block.instructions.items.len); |
| 5415 | sema.air_instructions.items(.data)[@intFromEnum(merges.block_inst)] = .{ .ty_pl = .{ | |
| 5415 | sema.air_instructions.items(.data)[@backingInt(merges.block_inst)] = .{ .ty_pl = .{ | |
| 5416 | 5416 | .ty = .noreturn_type, |
| 5417 | 5417 | .payload = sema.addExtraAssumeCapacity(Air.DbgInlineBlock{ |
| 5418 | 5418 | .func = child_block.inlining.?.func, |
| ... | ... | @@ -5450,7 +5450,7 @@ fn resolveAnalyzedBlock( |
| 5450 | 5450 | .block => { |
| 5451 | 5451 | try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.Block).@"struct".field_names.len + |
| 5452 | 5452 | child_block.instructions.items.len); |
| 5453 | sema.air_instructions.items(.data)[@intFromEnum(merges.block_inst)] = .{ .ty_pl = .{ | |
| 5453 | sema.air_instructions.items(.data)[@backingInt(merges.block_inst)] = .{ .ty_pl = .{ | |
| 5454 | 5454 | .ty = .void_type, |
| 5455 | 5455 | .payload = sema.addExtraAssumeCapacity(Air.Block{ |
| 5456 | 5456 | .body_len = @intCast(child_block.instructions.items.len), |
| ... | ... | @@ -5460,7 +5460,7 @@ fn resolveAnalyzedBlock( |
| 5460 | 5460 | .dbg_inline_block => { |
| 5461 | 5461 | try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.DbgInlineBlock).@"struct".field_names.len + |
| 5462 | 5462 | child_block.instructions.items.len); |
| 5463 | sema.air_instructions.items(.data)[@intFromEnum(merges.block_inst)] = .{ .ty_pl = .{ | |
| 5463 | sema.air_instructions.items(.data)[@backingInt(merges.block_inst)] = .{ .ty_pl = .{ | |
| 5464 | 5464 | .ty = .void_type, |
| 5465 | 5465 | .payload = sema.addExtraAssumeCapacity(Air.DbgInlineBlock{ |
| 5466 | 5466 | .func = child_block.inlining.?.func, |
| ... | ... | @@ -5473,7 +5473,7 @@ fn resolveAnalyzedBlock( |
| 5473 | 5473 | sema.air_extra.appendSliceAssumeCapacity(@ptrCast(child_block.instructions.items)); |
| 5474 | 5474 | // Rewrite the break to just give value {}; the value is |
| 5475 | 5475 | // comptime-known and will be returned directly. |
| 5476 | sema.air_instructions.items(.data)[@intFromEnum(merges.br_list.items[0])].br.operand = .void_value; | |
| 5476 | sema.air_instructions.items(.data)[@backingInt(merges.br_list.items[0])].br.operand = .void_value; | |
| 5477 | 5477 | return Air.internedToRef(result_val.toIntern()); |
| 5478 | 5478 | } |
| 5479 | 5479 | } |
| ... | ... | @@ -5515,7 +5515,7 @@ fn resolveAnalyzedBlock( |
| 5515 | 5515 | .block => { |
| 5516 | 5516 | try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.Block).@"struct".field_names.len + |
| 5517 | 5517 | child_block.instructions.items.len); |
| 5518 | sema.air_instructions.items(.data)[@intFromEnum(merges.block_inst)] = .{ .ty_pl = .{ | |
| 5518 | sema.air_instructions.items(.data)[@backingInt(merges.block_inst)] = .{ .ty_pl = .{ | |
| 5519 | 5519 | .ty = ty_inst, |
| 5520 | 5520 | .payload = sema.addExtraAssumeCapacity(Air.Block{ |
| 5521 | 5521 | .body_len = @intCast(child_block.instructions.items.len), |
| ... | ... | @@ -5525,7 +5525,7 @@ fn resolveAnalyzedBlock( |
| 5525 | 5525 | .dbg_inline_block => { |
| 5526 | 5526 | try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.DbgInlineBlock).@"struct".field_names.len + |
| 5527 | 5527 | child_block.instructions.items.len); |
| 5528 | sema.air_instructions.items(.data)[@intFromEnum(merges.block_inst)] = .{ .ty_pl = .{ | |
| 5528 | sema.air_instructions.items(.data)[@backingInt(merges.block_inst)] = .{ .ty_pl = .{ | |
| 5529 | 5529 | .ty = ty_inst, |
| 5530 | 5530 | .payload = sema.addExtraAssumeCapacity(Air.DbgInlineBlock{ |
| 5531 | 5531 | .func = child_block.inlining.?.func, |
| ... | ... | @@ -5539,7 +5539,7 @@ fn resolveAnalyzedBlock( |
| 5539 | 5539 | // Now that the block has its type resolved, we need to go back into all the break |
| 5540 | 5540 | // instructions, and insert type coercion on the operands. |
| 5541 | 5541 | for (merges.br_list.items) |br| { |
| 5542 | const br_operand = sema.air_instructions.items(.data)[@intFromEnum(br)].br.operand; | |
| 5542 | const br_operand = sema.air_instructions.items(.data)[@backingInt(br)].br.operand; | |
| 5543 | 5543 | const br_operand_src = src; |
| 5544 | 5544 | const br_operand_ty = sema.typeOf(br_operand); |
| 5545 | 5545 | if (br_operand_ty.eql(resolved_ty)) { |
| ... | ... | @@ -5552,7 +5552,7 @@ fn resolveAnalyzedBlock( |
| 5552 | 5552 | // If no instructions were produced, such as in the case of a coercion of a |
| 5553 | 5553 | // constant value to a new type, we can simply point the br operand to it. |
| 5554 | 5554 | if (coerce_block.instructions.items.len == 0) { |
| 5555 | sema.air_instructions.items(.data)[@intFromEnum(br)].br.operand = coerced_operand; | |
| 5555 | sema.air_instructions.items(.data)[@backingInt(br)].br.operand = coerced_operand; | |
| 5556 | 5556 | continue; |
| 5557 | 5557 | } |
| 5558 | 5558 | assert(coerce_block.instructions.items[coerce_block.instructions.items.len - 1].toRef() == coerced_operand); |
| ... | ... | @@ -5563,17 +5563,17 @@ fn resolveAnalyzedBlock( |
| 5563 | 5563 | try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.Block).@"struct".field_names.len + |
| 5564 | 5564 | sub_block_len); |
| 5565 | 5565 | try sema.air_instructions.ensureUnusedCapacity(gpa, 1); |
| 5566 | const sub_br_inst: Air.Inst.Index = @enumFromInt(sema.air_instructions.len); | |
| 5566 | const sub_br_inst: Air.Inst.Index = @fromBackingInt(@intCast(sema.air_instructions.len)); | |
| 5567 | 5567 | |
| 5568 | sema.air_instructions.items(.tag)[@intFromEnum(br)] = .block; | |
| 5569 | sema.air_instructions.items(.data)[@intFromEnum(br)] = .{ .ty_pl = .{ | |
| 5568 | sema.air_instructions.items(.tag)[@backingInt(br)] = .block; | |
| 5569 | sema.air_instructions.items(.data)[@backingInt(br)] = .{ .ty_pl = .{ | |
| 5570 | 5570 | .ty = .noreturn_type, |
| 5571 | 5571 | .payload = sema.addExtraAssumeCapacity(Air.Block{ |
| 5572 | 5572 | .body_len = sub_block_len, |
| 5573 | 5573 | }), |
| 5574 | 5574 | } }; |
| 5575 | 5575 | sema.air_extra.appendSliceAssumeCapacity(@ptrCast(coerce_block.instructions.items)); |
| 5576 | sema.air_extra.appendAssumeCapacity(@intFromEnum(sub_br_inst)); | |
| 5576 | sema.air_extra.appendAssumeCapacity(@backingInt(sub_br_inst)); | |
| 5577 | 5577 | |
| 5578 | 5578 | sema.air_instructions.appendAssumeCapacity(.{ |
| 5579 | 5579 | .tag = .br, |
| ... | ... | @@ -5592,7 +5592,7 @@ fn zirExport(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void |
| 5592 | 5592 | const pt = sema.pt; |
| 5593 | 5593 | const zcu = pt.zcu; |
| 5594 | 5594 | const ip = &zcu.intern_pool; |
| 5595 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 5595 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 5596 | 5596 | const extra = sema.code.extraData(Zir.Inst.Export, inst_data.payload_index).data; |
| 5597 | 5597 | |
| 5598 | 5598 | const src = block.nodeOffset(inst_data.src_node); |
| ... | ... | @@ -5753,13 +5753,13 @@ fn zirSetFloatMode(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstD |
| 5753 | 5753 | } |
| 5754 | 5754 | |
| 5755 | 5755 | fn zirSetRuntimeSafety(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void { |
| 5756 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].un_node; | |
| 5756 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].un_node; | |
| 5757 | 5757 | const operand_src = block.builtinCallArgSrc(inst_data.src_node, 0); |
| 5758 | 5758 | block.want_safety = try sema.resolveConstBool(block, operand_src, inst_data.operand, .{ .simple = .operand_setRuntimeSafety }); |
| 5759 | 5759 | } |
| 5760 | 5760 | |
| 5761 | 5761 | fn zirBreak(sema: *Sema, start_block: *Block, inst: Zir.Inst.Index) CompileError!void { |
| 5762 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].@"break"; | |
| 5762 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].@"break"; | |
| 5763 | 5763 | const extra = sema.code.extraData(Zir.Inst.Break, inst_data.payload_index).data; |
| 5764 | 5764 | const operand = sema.resolveInst(inst_data.operand); |
| 5765 | 5765 | const zir_block = extra.block_inst; |
| ... | ... | @@ -5789,13 +5789,13 @@ fn zirBreak(sema: *Sema, start_block: *Block, inst: Zir.Inst.Index) CompileError |
| 5789 | 5789 | } |
| 5790 | 5790 | |
| 5791 | 5791 | fn zirSwitchContinue(sema: *Sema, start_block: *Block, inst: Zir.Inst.Index) CompileError!void { |
| 5792 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].@"break"; | |
| 5792 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].@"break"; | |
| 5793 | 5793 | const extra = sema.code.extraData(Zir.Inst.Break, inst_data.payload_index).data; |
| 5794 | 5794 | const operand_src = start_block.nodeOffset(extra.operand_src_node.unwrap().?); |
| 5795 | 5795 | const uncoerced_operand = sema.resolveInst(inst_data.operand); |
| 5796 | 5796 | const switch_inst = extra.block_inst; |
| 5797 | 5797 | |
| 5798 | switch (sema.code.instructions.items(.tag)[@intFromEnum(switch_inst)]) { | |
| 5798 | switch (sema.code.instructions.items(.tag)[@backingInt(switch_inst)]) { | |
| 5799 | 5799 | .switch_block, .switch_block_ref => {}, |
| 5800 | 5800 | .switch_block_err_union => unreachable, // wrong code path! |
| 5801 | 5801 | else => unreachable, // assertion failure |
| ... | ... | @@ -5833,13 +5833,13 @@ fn zirSwitchContinue(sema: *Sema, start_block: *Block, inst: Zir.Inst.Index) Com |
| 5833 | 5833 | fn zirDbgStmt(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void { |
| 5834 | 5834 | if (block.isComptime() or block.ownerModule().strip) return; |
| 5835 | 5835 | |
| 5836 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].dbg_stmt; | |
| 5836 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].dbg_stmt; | |
| 5837 | 5837 | |
| 5838 | 5838 | if (block.instructions.items.len != 0) { |
| 5839 | 5839 | const idx = block.instructions.items[block.instructions.items.len - 1]; |
| 5840 | if (sema.air_instructions.items(.tag)[@intFromEnum(idx)] == .dbg_stmt) { | |
| 5840 | if (sema.air_instructions.items(.tag)[@backingInt(idx)] == .dbg_stmt) { | |
| 5841 | 5841 | // The previous dbg_stmt didn't correspond to any actual code, so replace it. |
| 5842 | sema.air_instructions.items(.data)[@intFromEnum(idx)].dbg_stmt = .{ | |
| 5842 | sema.air_instructions.items(.data)[@backingInt(idx)].dbg_stmt = .{ | |
| 5843 | 5843 | .line = inst_data.line, |
| 5844 | 5844 | .column = inst_data.column, |
| 5845 | 5845 | }; |
| ... | ... | @@ -5867,7 +5867,7 @@ fn zirDbgVar( |
| 5867 | 5867 | inst: Zir.Inst.Index, |
| 5868 | 5868 | air_tag: Air.Inst.Tag, |
| 5869 | 5869 | ) CompileError!void { |
| 5870 | const str_op = sema.code.instructions.items(.data)[@intFromEnum(inst)].str_op; | |
| 5870 | const str_op = sema.code.instructions.items(.data)[@backingInt(inst)].str_op; | |
| 5871 | 5871 | const operand = sema.resolveInst(str_op.operand); |
| 5872 | 5872 | const name = str_op.getStr(sema.code); |
| 5873 | 5873 | try sema.addDbgVar(block, operand, air_tag, name); |
| ... | ... | @@ -5911,7 +5911,7 @@ fn addDbgVar( |
| 5911 | 5911 | _ = try block.addInst(.{ |
| 5912 | 5912 | .tag = air_tag, |
| 5913 | 5913 | .data = .{ .pl_op = .{ |
| 5914 | .payload = @intFromEnum(name_nts), | |
| 5914 | .payload = @backingInt(name_nts), | |
| 5915 | 5915 | .operand = operand, |
| 5916 | 5916 | } }, |
| 5917 | 5917 | }); |
| ... | ... | @@ -5919,7 +5919,7 @@ fn addDbgVar( |
| 5919 | 5919 | |
| 5920 | 5920 | pub fn appendAirString(sema: *Sema, str: []const u8) Allocator.Error!Air.NullTerminatedString { |
| 5921 | 5921 | if (str.len == 0) return .none; |
| 5922 | const nts: Air.NullTerminatedString = @enumFromInt(sema.air_extra.items.len); | |
| 5922 | const nts: Air.NullTerminatedString = @fromBackingInt(@intCast(sema.air_extra.items.len)); | |
| 5923 | 5923 | const elements_used = str.len / 4 + 1; |
| 5924 | 5924 | const elements = try sema.air_extra.addManyAsSlice(sema.gpa, elements_used); |
| 5925 | 5925 | const buffer = mem.sliceAsBytes(elements); |
| ... | ... | @@ -5935,7 +5935,7 @@ fn zirDeclRef(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air |
| 5935 | 5935 | const gpa = comp.gpa; |
| 5936 | 5936 | const io = comp.io; |
| 5937 | 5937 | |
| 5938 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].str_tok; | |
| 5938 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].str_tok; | |
| 5939 | 5939 | const src = block.tokenOffset(inst_data.src_tok); |
| 5940 | 5940 | const decl_name = try zcu.intern_pool.getOrPutString( |
| 5941 | 5941 | gpa, |
| ... | ... | @@ -5955,7 +5955,7 @@ fn zirDeclVal(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air |
| 5955 | 5955 | const gpa = comp.gpa; |
| 5956 | 5956 | const io = comp.io; |
| 5957 | 5957 | |
| 5958 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].str_tok; | |
| 5958 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].str_tok; | |
| 5959 | 5959 | const src = block.tokenOffset(inst_data.src_tok); |
| 5960 | 5960 | const decl_name = try zcu.intern_pool.getOrPutString( |
| 5961 | 5961 | gpa, |
| ... | ... | @@ -6144,7 +6144,7 @@ fn popErrorReturnTrace( |
| 6144 | 6144 | then_block.instructions.items.len + else_block.instructions.items.len + |
| 6145 | 6145 | @typeInfo(Air.Block).@"struct".field_names.len + 1); // +1 for the sole .cond_br instruction in the .block |
| 6146 | 6146 | |
| 6147 | const cond_br_inst: Air.Inst.Index = @enumFromInt(sema.air_instructions.len); | |
| 6147 | const cond_br_inst: Air.Inst.Index = @fromBackingInt(@intCast(sema.air_instructions.len)); | |
| 6148 | 6148 | try sema.air_instructions.append(gpa, .{ |
| 6149 | 6149 | .tag = .cond_br, |
| 6150 | 6150 | .data = .{ |
| ... | ... | @@ -6168,8 +6168,8 @@ fn popErrorReturnTrace( |
| 6168 | 6168 | sema.air_extra.appendSliceAssumeCapacity(@ptrCast(then_block.instructions.items)); |
| 6169 | 6169 | sema.air_extra.appendSliceAssumeCapacity(@ptrCast(else_block.instructions.items)); |
| 6170 | 6170 | |
| 6171 | sema.air_instructions.items(.data)[@intFromEnum(cond_block_inst)].ty_pl.payload = sema.addExtraAssumeCapacity(Air.Block{ .body_len = 1 }); | |
| 6172 | sema.air_extra.appendAssumeCapacity(@intFromEnum(cond_br_inst)); | |
| 6171 | sema.air_instructions.items(.data)[@backingInt(cond_block_inst)].ty_pl.payload = sema.addExtraAssumeCapacity(Air.Block{ .body_len = 1 }); | |
| 6172 | sema.air_extra.appendAssumeCapacity(@backingInt(cond_br_inst)); | |
| 6173 | 6173 | } |
| 6174 | 6174 | } |
| 6175 | 6175 | |
| ... | ... | @@ -6185,7 +6185,7 @@ fn zirCall( |
| 6185 | 6185 | const gpa = comp.gpa; |
| 6186 | 6186 | const io = comp.io; |
| 6187 | 6187 | |
| 6188 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 6188 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 6189 | 6189 | const callee_src = block.src(.{ .node_offset_call_func = inst_data.src_node }); |
| 6190 | 6190 | const call_src = block.nodeOffset(inst_data.src_node); |
| 6191 | 6191 | const ExtraType = switch (kind) { |
| ... | ... | @@ -6195,7 +6195,7 @@ fn zirCall( |
| 6195 | 6195 | const extra = sema.code.extraData(ExtraType, inst_data.payload_index); |
| 6196 | 6196 | const args_len = extra.data.flags.args_len; |
| 6197 | 6197 | |
| 6198 | const modifier: std.lang.CallModifier = @enumFromInt(extra.data.flags.packed_modifier); | |
| 6198 | const modifier: std.lang.CallModifier = @fromBackingInt(@intCast(extra.data.flags.packed_modifier)); | |
| 6199 | 6199 | const ensure_result_used = extra.data.flags.ensure_result_used; |
| 6200 | 6200 | const pop_error_return_trace = extra.data.flags.pop_error_return_trace; |
| 6201 | 6201 | |
| ... | ... | @@ -6224,7 +6224,7 @@ fn zirCall( |
| 6224 | 6224 | const func_ty = try sema.checkCallArgumentCount(block, func, callee_src, callee_ty, total_args, callee == .method); |
| 6225 | 6225 | |
| 6226 | 6226 | // The block index before the call, so we can potentially insert an error trace save here later. |
| 6227 | const block_index: Air.Inst.Index = @enumFromInt(block.instructions.items.len); | |
| 6227 | const block_index: Air.Inst.Index = @fromBackingInt(@intCast(block.instructions.items.len)); | |
| 6228 | 6228 | |
| 6229 | 6229 | // This will be set by `analyzeCall` to indicate whether any parameter was an error (making the |
| 6230 | 6230 | // error trace potentially dirty). |
| ... | ... | @@ -6244,7 +6244,7 @@ fn zirCall( |
| 6244 | 6244 | } }; |
| 6245 | 6245 | |
| 6246 | 6246 | // AstGen ensures that a call instruction is always preceded by a dbg_stmt instruction. |
| 6247 | const call_dbg_node: Zir.Inst.Index = @enumFromInt(@intFromEnum(inst) - 1); | |
| 6247 | const call_dbg_node: Zir.Inst.Index = @fromBackingInt(@intCast(@backingInt(inst) - 1)); | |
| 6248 | 6248 | const call_inst = try sema.analyzeCall(block, func, func_ty, callee_src, call_src, modifier, ensure_result_used, args_info, call_dbg_node, .call); |
| 6249 | 6249 | |
| 6250 | 6250 | if (block.ownerModule().error_tracing and |
| ... | ... | @@ -6530,11 +6530,11 @@ const CallArgsInfo = union(enum) { |
| 6530 | 6530 | |
| 6531 | 6531 | const arg_body = if (real_arg_idx == 0) blk: { |
| 6532 | 6532 | const start = zir_call.num_args; |
| 6533 | const end = @intFromEnum(zir_call.args_body[0]); | |
| 6533 | const end = @backingInt(zir_call.args_body[0]); | |
| 6534 | 6534 | break :blk zir_call.args_body[start..end]; |
| 6535 | 6535 | } else blk: { |
| 6536 | const start = @intFromEnum(zir_call.args_body[real_arg_idx - 1]); | |
| 6537 | const end = @intFromEnum(zir_call.args_body[real_arg_idx]); | |
| 6536 | const start = @backingInt(zir_call.args_body[real_arg_idx - 1]); | |
| 6537 | const end = @backingInt(zir_call.args_body[real_arg_idx]); | |
| 6538 | 6538 | break :blk zir_call.args_body[start..end]; |
| 6539 | 6539 | }; |
| 6540 | 6540 | |
| ... | ... | @@ -6777,7 +6777,7 @@ fn analyzeCall( |
| 6777 | 6777 | // We must discover the generic parameter type. |
| 6778 | 6778 | assert(any_generic_types); |
| 6779 | 6779 | const param_inst_idx = fn_zir_info.param_body[arg_idx]; |
| 6780 | const param_inst = fn_zir.instructions.get(@intFromEnum(param_inst_idx)); | |
| 6780 | const param_inst = fn_zir.instructions.get(@backingInt(param_inst_idx)); | |
| 6781 | 6781 | switch (param_inst.tag) { |
| 6782 | 6782 | .param_anytype, .param_anytype_comptime => break :ty .generic_poison, |
| 6783 | 6783 | .param, .param_comptime => {}, |
| ... | ... | @@ -6853,7 +6853,7 @@ fn analyzeCall( |
| 6853 | 6853 | } else { |
| 6854 | 6854 | // We need a dummy instruction with this type. It doesn't actually need to be in any block, |
| 6855 | 6855 | // since it will never be referenced at runtime! |
| 6856 | const dummy: Air.Inst.Index = @enumFromInt(sema.air_instructions.len); | |
| 6856 | const dummy: Air.Inst.Index = @fromBackingInt(@intCast(sema.air_instructions.len)); | |
| 6857 | 6857 | try sema.air_instructions.append(gpa, .{ .tag = .alloc, .data = .{ .ty = arg_ty } }); |
| 6858 | 6858 | generic_inst_map.putAssumeCapacityNoClobber(param_inst_idx, dummy.toRef()); |
| 6859 | 6859 | } |
| ... | ... | @@ -7256,7 +7256,7 @@ fn analyzeCall( |
| 7256 | 7256 | } |
| 7257 | 7257 | |
| 7258 | 7258 | const need_debug_scope = !block.isComptime() and !block.is_typeof and !block.ownerModule().strip; |
| 7259 | const block_inst: Air.Inst.Index = @enumFromInt(sema.air_instructions.len); | |
| 7259 | const block_inst: Air.Inst.Index = @fromBackingInt(@intCast(sema.air_instructions.len)); | |
| 7260 | 7260 | try sema.air_instructions.append(gpa, .{ |
| 7261 | 7261 | .tag = if (need_debug_scope) .dbg_inline_block else .block, |
| 7262 | 7262 | .data = undefined, |
| ... | ... | @@ -7313,15 +7313,15 @@ fn analyzeCall( |
| 7313 | 7313 | if (!block.isComptime() and !block.is_typeof) { |
| 7314 | 7314 | const zir_tags = sema.code.instructions.items(.tag); |
| 7315 | 7315 | const zir_datas = sema.code.instructions.items(.data); |
| 7316 | for (fn_zir_info.param_body) |inst| switch (zir_tags[@intFromEnum(inst)]) { | |
| 7316 | for (fn_zir_info.param_body) |inst| switch (zir_tags[@backingInt(inst)]) { | |
| 7317 | 7317 | .param, .param_comptime => { |
| 7318 | const extra = sema.code.extraData(Zir.Inst.Param, zir_datas[@intFromEnum(inst)].pl_tok.payload_index); | |
| 7318 | const extra = sema.code.extraData(Zir.Inst.Param, zir_datas[@backingInt(inst)].pl_tok.payload_index); | |
| 7319 | 7319 | const param_name = sema.code.nullTerminatedString(extra.data.name); |
| 7320 | 7320 | const air_inst = sema.inst_map.get(inst).?; |
| 7321 | 7321 | try sema.addDbgVar(&child_block, air_inst, .dbg_arg_inline, param_name); |
| 7322 | 7322 | }, |
| 7323 | 7323 | .param_anytype, .param_anytype_comptime => { |
| 7324 | const param_name = zir_datas[@intFromEnum(inst)].str_tok.get(sema.code); | |
| 7324 | const param_name = zir_datas[@backingInt(inst)].str_tok.get(sema.code); | |
| 7325 | 7325 | const air_inst = sema.inst_map.get(inst).?; |
| 7326 | 7326 | try sema.addDbgVar(&child_block, air_inst, .dbg_arg_inline, param_name); |
| 7327 | 7327 | }, |
| ... | ... | @@ -7410,7 +7410,7 @@ fn handleTailCall(sema: *Sema, block: *Block, call_src: LazySrcLoc, func_ty: Typ |
| 7410 | 7410 | } |
| 7411 | 7411 | |
| 7412 | 7412 | fn zirIntType(sema: *Sema, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 7413 | const int_type = sema.code.instructions.items(.data)[@intFromEnum(inst)].int_type; | |
| 7413 | const int_type = sema.code.instructions.items(.data)[@backingInt(inst)].int_type; | |
| 7414 | 7414 | const ty = try sema.pt.intType(int_type.signedness, int_type.bit_count); |
| 7415 | 7415 | return Air.internedToRef(ty.toIntern()); |
| 7416 | 7416 | } |
| ... | ... | @@ -7418,7 +7418,7 @@ fn zirIntType(sema: *Sema, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 7418 | 7418 | fn zirOptionalType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 7419 | 7419 | const pt = sema.pt; |
| 7420 | 7420 | const zcu = pt.zcu; |
| 7421 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].un_node; | |
| 7421 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].un_node; | |
| 7422 | 7422 | const operand_src = block.src(.{ .node_offset_un_op = inst_data.src_node }); |
| 7423 | 7423 | const child_type = try sema.resolveType(block, operand_src, inst_data.operand); |
| 7424 | 7424 | if (child_type.zigTypeTag(zcu) == .@"opaque") { |
| ... | ... | @@ -7434,12 +7434,12 @@ fn zirOptionalType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileErro |
| 7434 | 7434 | fn zirArrayInitElemType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 7435 | 7435 | const pt = sema.pt; |
| 7436 | 7436 | const zcu = pt.zcu; |
| 7437 | const bin = sema.code.instructions.items(.data)[@intFromEnum(inst)].bin; | |
| 7437 | const bin = sema.code.instructions.items(.data)[@backingInt(inst)].bin; | |
| 7438 | 7438 | const maybe_wrapped_indexable_ty = try sema.resolveTypeOrPoison(block, LazySrcLoc.unneeded, bin.lhs) orelse return .generic_poison_type; |
| 7439 | 7439 | const indexable_ty = maybe_wrapped_indexable_ty.optEuBaseType(zcu); |
| 7440 | 7440 | assert(indexable_ty.isIndexable(zcu)); // validated by a previous instruction |
| 7441 | 7441 | const elem_ty = switch (indexable_ty.zigTypeTag(zcu)) { |
| 7442 | .@"struct" => indexable_ty.fieldType(@intFromEnum(bin.rhs), zcu), | |
| 7442 | .@"struct" => indexable_ty.fieldType(@backingInt(bin.rhs), zcu), | |
| 7443 | 7443 | else => indexable_ty.indexableElem(zcu), |
| 7444 | 7444 | }; |
| 7445 | 7445 | return .fromType(elem_ty); |
| ... | ... | @@ -7448,7 +7448,7 @@ fn zirArrayInitElemType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Compil |
| 7448 | 7448 | fn zirElemType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 7449 | 7449 | const pt = sema.pt; |
| 7450 | 7450 | const zcu = pt.zcu; |
| 7451 | const un_node = sema.code.instructions.items(.data)[@intFromEnum(inst)].un_node; | |
| 7451 | const un_node = sema.code.instructions.items(.data)[@backingInt(inst)].un_node; | |
| 7452 | 7452 | const maybe_wrapped_ptr_ty = try sema.resolveTypeOrPoison(block, LazySrcLoc.unneeded, un_node.operand) orelse return .generic_poison_type; |
| 7453 | 7453 | const ptr_ty = maybe_wrapped_ptr_ty.optEuBaseType(zcu); |
| 7454 | 7454 | assert(ptr_ty.zigTypeTag(zcu) == .pointer); // validated by a previous instruction |
| ... | ... | @@ -7464,7 +7464,7 @@ fn zirElemType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 7464 | 7464 | fn zirIndexablePtrElemType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 7465 | 7465 | const pt = sema.pt; |
| 7466 | 7466 | const zcu = pt.zcu; |
| 7467 | const un_node = sema.code.instructions.items(.data)[@intFromEnum(inst)].un_node; | |
| 7467 | const un_node = sema.code.instructions.items(.data)[@backingInt(inst)].un_node; | |
| 7468 | 7468 | const src = block.nodeOffset(un_node.src_node); |
| 7469 | 7469 | const ptr_ty = try sema.resolveTypeOrPoison(block, src, un_node.operand) orelse return .generic_poison_type; |
| 7470 | 7470 | try sema.checkMemOperand(block, src, ptr_ty); |
| ... | ... | @@ -7478,7 +7478,7 @@ fn zirIndexablePtrElemType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Com |
| 7478 | 7478 | fn zirSplatOpResultType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 7479 | 7479 | const pt = sema.pt; |
| 7480 | 7480 | const zcu = pt.zcu; |
| 7481 | const un_node = sema.code.instructions.items(.data)[@intFromEnum(inst)].un_node; | |
| 7481 | const un_node = sema.code.instructions.items(.data)[@backingInt(inst)].un_node; | |
| 7482 | 7482 | |
| 7483 | 7483 | const raw_ty = try sema.resolveTypeOrPoison(block, LazySrcLoc.unneeded, un_node.operand) orelse return .generic_poison_type; |
| 7484 | 7484 | const vec_ty = raw_ty.optEuBaseType(zcu); |
| ... | ... | @@ -7491,7 +7491,7 @@ fn zirSplatOpResultType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Compil |
| 7491 | 7491 | } |
| 7492 | 7492 | |
| 7493 | 7493 | fn zirVectorType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 7494 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 7494 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 7495 | 7495 | const len_src = block.builtinCallArgSrc(inst_data.src_node, 0); |
| 7496 | 7496 | const elem_type_src = block.builtinCallArgSrc(inst_data.src_node, 1); |
| 7497 | 7497 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; |
| ... | ... | @@ -7506,7 +7506,7 @@ fn zirVectorType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError! |
| 7506 | 7506 | } |
| 7507 | 7507 | |
| 7508 | 7508 | fn zirArrayType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 7509 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 7509 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 7510 | 7510 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; |
| 7511 | 7511 | const len_src = block.src(.{ .node_offset_array_type_len = inst_data.src_node }); |
| 7512 | 7512 | const elem_src = block.src(.{ .node_offset_array_type_elem = inst_data.src_node }); |
| ... | ... | @@ -7529,7 +7529,7 @@ fn zirArrayTypeSentinel(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Compil |
| 7529 | 7529 | const io = comp.io; |
| 7530 | 7530 | const ip = &zcu.intern_pool; |
| 7531 | 7531 | |
| 7532 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 7532 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 7533 | 7533 | const extra = sema.code.extraData(Zir.Inst.ArrayTypeSentinel, inst_data.payload_index).data; |
| 7534 | 7534 | const len_src = block.src(.{ .node_offset_array_type_len = inst_data.src_node }); |
| 7535 | 7535 | const sentinel_src = block.src(.{ .node_offset_array_type_sentinel = inst_data.src_node }); |
| ... | ... | @@ -7565,7 +7565,7 @@ fn validateArrayElemType(sema: *Sema, block: *Block, elem_type: Type, elem_src: |
| 7565 | 7565 | } |
| 7566 | 7566 | |
| 7567 | 7567 | fn zirAnyframeType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 7568 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].un_node; | |
| 7568 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].un_node; | |
| 7569 | 7569 | if (true) { |
| 7570 | 7570 | return sema.failWithUseOfAsync(block, block.nodeOffset(inst_data.src_node)); |
| 7571 | 7571 | } |
| ... | ... | @@ -7580,7 +7580,7 @@ fn zirAnyframeType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileErro |
| 7580 | 7580 | fn zirErrorUnionType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 7581 | 7581 | const pt = sema.pt; |
| 7582 | 7582 | const zcu = pt.zcu; |
| 7583 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 7583 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 7584 | 7584 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; |
| 7585 | 7585 | const lhs_src = block.src(.{ .node_offset_bin_lhs = inst_data.src_node }); |
| 7586 | 7586 | const rhs_src = block.src(.{ .node_offset_bin_rhs = inst_data.src_node }); |
| ... | ... | @@ -7620,7 +7620,7 @@ fn zirErrorValue(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError! |
| 7620 | 7620 | const gpa = comp.gpa; |
| 7621 | 7621 | const io = comp.io; |
| 7622 | 7622 | |
| 7623 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].str_tok; | |
| 7623 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].str_tok; | |
| 7624 | 7624 | const name = try pt.zcu.intern_pool.getOrPutString( |
| 7625 | 7625 | gpa, |
| 7626 | 7626 | io, |
| ... | ... | @@ -7718,7 +7718,7 @@ fn zirMergeErrorSets(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileEr |
| 7718 | 7718 | const pt = sema.pt; |
| 7719 | 7719 | const zcu = pt.zcu; |
| 7720 | 7720 | const ip = &zcu.intern_pool; |
| 7721 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 7721 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 7722 | 7722 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; |
| 7723 | 7723 | const src = block.src(.{ .node_offset_bin_op = inst_data.src_node }); |
| 7724 | 7724 | const lhs_src = block.src(.{ .node_offset_bin_lhs = inst_data.src_node }); |
| ... | ... | @@ -7776,7 +7776,7 @@ fn zirEnumLiteral(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError |
| 7776 | 7776 | const gpa = comp.gpa; |
| 7777 | 7777 | const io = comp.io; |
| 7778 | 7778 | |
| 7779 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].str_tok; | |
| 7779 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].str_tok; | |
| 7780 | 7780 | const name = inst_data.get(sema.code); |
| 7781 | 7781 | return Air.internedToRef((try pt.intern(.{ |
| 7782 | 7782 | .enum_literal = try zcu.intern_pool.getOrPutString(gpa, io, pt.tid, name, .no_embedded_nulls), |
| ... | ... | @@ -7790,7 +7790,7 @@ fn zirDeclLiteral(sema: *Sema, block: *Block, inst: Zir.Inst.Index, do_coerce: b |
| 7790 | 7790 | const gpa = comp.gpa; |
| 7791 | 7791 | const io = comp.io; |
| 7792 | 7792 | |
| 7793 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 7793 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 7794 | 7794 | const src = block.nodeOffset(inst_data.src_node); |
| 7795 | 7795 | const extra = sema.code.extraData(Zir.Inst.Field, inst_data.payload_index).data; |
| 7796 | 7796 | const name = try zcu.intern_pool.getOrPutString( |
| ... | ... | @@ -7851,7 +7851,7 @@ fn analyzeDeclLiteral( |
| 7851 | 7851 | fn zirIntFromEnum(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 7852 | 7852 | const pt = sema.pt; |
| 7853 | 7853 | const zcu = pt.zcu; |
| 7854 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].un_node; | |
| 7854 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].un_node; | |
| 7855 | 7855 | const src = block.nodeOffset(inst_data.src_node); |
| 7856 | 7856 | const operand_src = block.builtinCallArgSrc(inst_data.src_node, 0); |
| 7857 | 7857 | const operand = sema.resolveInst(inst_data.operand); |
| ... | ... | @@ -7893,7 +7893,7 @@ fn zirIntFromEnum(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError |
| 7893 | 7893 | fn zirEnumFromInt(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 7894 | 7894 | const pt = sema.pt; |
| 7895 | 7895 | const zcu = pt.zcu; |
| 7896 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 7896 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 7897 | 7897 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; |
| 7898 | 7898 | const src = block.nodeOffset(inst_data.src_node); |
| 7899 | 7899 | const operand_src = block.builtinCallArgSrc(inst_data.src_node, 0); |
| ... | ... | @@ -7954,7 +7954,7 @@ fn zirOptionalPayloadPtr( |
| 7954 | 7954 | inst: Zir.Inst.Index, |
| 7955 | 7955 | safety_check: bool, |
| 7956 | 7956 | ) CompileError!Air.Inst.Ref { |
| 7957 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].un_node; | |
| 7957 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].un_node; | |
| 7958 | 7958 | const optional_ptr = sema.resolveInst(inst_data.operand); |
| 7959 | 7959 | const src = block.nodeOffset(inst_data.src_node); |
| 7960 | 7960 | |
| ... | ... | @@ -8042,7 +8042,7 @@ fn zirOptionalPayload( |
| 8042 | 8042 | ) CompileError!Air.Inst.Ref { |
| 8043 | 8043 | const pt = sema.pt; |
| 8044 | 8044 | const zcu = pt.zcu; |
| 8045 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].un_node; | |
| 8045 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].un_node; | |
| 8046 | 8046 | const src = block.nodeOffset(inst_data.src_node); |
| 8047 | 8047 | const operand = sema.resolveInst(inst_data.operand); |
| 8048 | 8048 | const operand_ty = sema.typeOf(operand); |
| ... | ... | @@ -8093,7 +8093,7 @@ fn zirErrUnionPayload( |
| 8093 | 8093 | ) CompileError!Air.Inst.Ref { |
| 8094 | 8094 | const pt = sema.pt; |
| 8095 | 8095 | const zcu = pt.zcu; |
| 8096 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].un_node; | |
| 8096 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].un_node; | |
| 8097 | 8097 | const src = block.nodeOffset(inst_data.src_node); |
| 8098 | 8098 | const operand = sema.resolveInst(inst_data.operand); |
| 8099 | 8099 | const operand_src = src; |
| ... | ... | @@ -8147,7 +8147,7 @@ fn zirErrUnionPayloadPtr( |
| 8147 | 8147 | block: *Block, |
| 8148 | 8148 | inst: Zir.Inst.Index, |
| 8149 | 8149 | ) CompileError!Air.Inst.Ref { |
| 8150 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].un_node; | |
| 8150 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].un_node; | |
| 8151 | 8151 | const operand = sema.resolveInst(inst_data.operand); |
| 8152 | 8152 | const src = block.nodeOffset(inst_data.src_node); |
| 8153 | 8153 | |
| ... | ... | @@ -8236,7 +8236,7 @@ fn analyzeErrUnionPayloadPtr( |
| 8236 | 8236 | |
| 8237 | 8237 | /// Value in, value out |
| 8238 | 8238 | fn zirErrUnionCode(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 8239 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].un_node; | |
| 8239 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].un_node; | |
| 8240 | 8240 | const src = block.nodeOffset(inst_data.src_node); |
| 8241 | 8241 | const operand = sema.resolveInst(inst_data.operand); |
| 8242 | 8242 | return sema.analyzeErrUnionCode(block, src, operand); |
| ... | ... | @@ -8269,7 +8269,7 @@ fn analyzeErrUnionCode(sema: *Sema, block: *Block, src: LazySrcLoc, operand: Air |
| 8269 | 8269 | |
| 8270 | 8270 | /// Pointer in, value out |
| 8271 | 8271 | fn zirErrUnionCodePtr(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 8272 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].un_node; | |
| 8272 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].un_node; | |
| 8273 | 8273 | const src = block.nodeOffset(inst_data.src_node); |
| 8274 | 8274 | const operand = sema.resolveInst(inst_data.operand); |
| 8275 | 8275 | return sema.analyzeErrUnionCodePtr(block, src, operand); |
| ... | ... | @@ -8316,7 +8316,7 @@ fn zirFunc( |
| 8316 | 8316 | const io = comp.io; |
| 8317 | 8317 | const ip = &zcu.intern_pool; |
| 8318 | 8318 | |
| 8319 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 8319 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 8320 | 8320 | const extra = sema.code.extraData(Zir.Inst.Func, inst_data.payload_index); |
| 8321 | 8321 | const target = zcu.getTarget(); |
| 8322 | 8322 | const ret_ty_src = block.src(.{ .node_offset_fn_type_ret_ty = inst_data.src_node }); |
| ... | ... | @@ -8329,7 +8329,7 @@ fn zirFunc( |
| 8329 | 8329 | else switch (extra.data.ret_ty.body_len) { |
| 8330 | 8330 | 0 => .void, |
| 8331 | 8331 | 1 => blk: { |
| 8332 | const ret_ty_ref: Zir.Inst.Ref = @enumFromInt(sema.code.extra[extra_index]); | |
| 8332 | const ret_ty_ref: Zir.Inst.Ref = @fromBackingInt(@intCast(sema.code.extra[extra_index])); | |
| 8333 | 8333 | extra_index += 1; |
| 8334 | 8334 | break :blk try sema.resolveType(block, ret_ty_src, ret_ty_ref); |
| 8335 | 8335 | }, |
| ... | ... | @@ -9063,7 +9063,7 @@ fn zirParam( |
| 9063 | 9063 | inst: Zir.Inst.Index, |
| 9064 | 9064 | comptime_syntax: bool, |
| 9065 | 9065 | ) CompileError!void { |
| 9066 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_tok; | |
| 9066 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].pl_tok; | |
| 9067 | 9067 | const src = block.tokenOffset(inst_data.src_tok); |
| 9068 | 9068 | const extra = sema.code.extraData(Zir.Inst.Param, inst_data.payload_index); |
| 9069 | 9069 | const param_name: Zir.NullTerminatedString = extra.data.name; |
| ... | ... | @@ -9094,7 +9094,7 @@ fn zirParamAnytype( |
| 9094 | 9094 | inst: Zir.Inst.Index, |
| 9095 | 9095 | comptime_syntax: bool, |
| 9096 | 9096 | ) CompileError!void { |
| 9097 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].str_tok; | |
| 9097 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].str_tok; | |
| 9098 | 9098 | const param_name: Zir.NullTerminatedString = inst_data.start; |
| 9099 | 9099 | |
| 9100 | 9100 | try block.params.append(sema.arena, .{ |
| ... | ... | @@ -9105,14 +9105,14 @@ fn zirParamAnytype( |
| 9105 | 9105 | } |
| 9106 | 9106 | |
| 9107 | 9107 | fn zirAsNode(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 9108 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 9108 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 9109 | 9109 | const src = block.nodeOffset(inst_data.src_node); |
| 9110 | 9110 | const extra = sema.code.extraData(Zir.Inst.As, inst_data.payload_index).data; |
| 9111 | 9111 | return sema.analyzeAs(block, src, extra.dest_type, extra.operand, false); |
| 9112 | 9112 | } |
| 9113 | 9113 | |
| 9114 | 9114 | fn zirAsShiftOperand(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 9115 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 9115 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 9116 | 9116 | const src = block.nodeOffset(inst_data.src_node); |
| 9117 | 9117 | const extra = sema.code.extraData(Zir.Inst.As, inst_data.payload_index).data; |
| 9118 | 9118 | return sema.analyzeAs(block, src, extra.dest_type, extra.operand, true); |
| ... | ... | @@ -9137,7 +9137,7 @@ fn analyzeAs( |
| 9137 | 9137 | } |
| 9138 | 9138 | |
| 9139 | 9139 | const is_ret = if (zir_dest_type.toIndex()) |ptr_index| |
| 9140 | sema.code.instructions.items(.tag)[@intFromEnum(ptr_index)] == .ret_type | |
| 9140 | sema.code.instructions.items(.tag)[@backingInt(ptr_index)] == .ret_type | |
| 9141 | 9141 | else |
| 9142 | 9142 | false; |
| 9143 | 9143 | return sema.coerceExtra(block, dest_ty, operand, src, .{ .is_ret = is_ret, .no_cast_to_comptime_int = no_cast_to_comptime_int }) catch |err| switch (err) { |
| ... | ... | @@ -9149,7 +9149,7 @@ fn analyzeAs( |
| 9149 | 9149 | fn zirIntFromPtr(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 9150 | 9150 | const pt = sema.pt; |
| 9151 | 9151 | const zcu = pt.zcu; |
| 9152 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].un_node; | |
| 9152 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].un_node; | |
| 9153 | 9153 | const ptr_src = block.builtinCallArgSrc(inst_data.src_node, 0); |
| 9154 | 9154 | const operand = sema.resolveInst(inst_data.operand); |
| 9155 | 9155 | const operand_ty = sema.typeOf(operand); |
| ... | ... | @@ -9207,7 +9207,7 @@ fn zirFieldPtrLoad(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileErro |
| 9207 | 9207 | const gpa = comp.gpa; |
| 9208 | 9208 | const io = comp.io; |
| 9209 | 9209 | |
| 9210 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 9210 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 9211 | 9211 | const src = block.nodeOffset(inst_data.src_node); |
| 9212 | 9212 | const field_name_src = block.src(.{ .node_offset_field_name = inst_data.src_node }); |
| 9213 | 9213 | const extra = sema.code.extraData(Zir.Inst.Field, inst_data.payload_index).data; |
| ... | ... | @@ -9229,7 +9229,7 @@ fn zirFieldPtr(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 9229 | 9229 | const gpa = comp.gpa; |
| 9230 | 9230 | const io = comp.io; |
| 9231 | 9231 | |
| 9232 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 9232 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 9233 | 9233 | const src = block.nodeOffset(inst_data.src_node); |
| 9234 | 9234 | const field_name_src = block.src(.{ .node_offset_field_name = inst_data.src_node }); |
| 9235 | 9235 | const extra = sema.code.extraData(Zir.Inst.Field, inst_data.payload_index).data; |
| ... | ... | @@ -9251,7 +9251,7 @@ fn zirStructInitFieldPtr(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Compi |
| 9251 | 9251 | const gpa = comp.gpa; |
| 9252 | 9252 | const io = comp.io; |
| 9253 | 9253 | |
| 9254 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 9254 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 9255 | 9255 | const src = block.nodeOffset(inst_data.src_node); |
| 9256 | 9256 | const field_name_src = block.src(.{ .node_offset_field_name_init = inst_data.src_node }); |
| 9257 | 9257 | const extra = sema.code.extraData(Zir.Inst.Field, inst_data.payload_index).data; |
| ... | ... | @@ -9275,7 +9275,7 @@ fn zirStructInitFieldPtr(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Compi |
| 9275 | 9275 | } |
| 9276 | 9276 | |
| 9277 | 9277 | fn zirFieldPtrNamedLoad(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 9278 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 9278 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 9279 | 9279 | const src = block.nodeOffset(inst_data.src_node); |
| 9280 | 9280 | const field_name_src = block.builtinCallArgSrc(inst_data.src_node, 1); |
| 9281 | 9281 | const extra = sema.code.extraData(Zir.Inst.FieldNamed, inst_data.payload_index).data; |
| ... | ... | @@ -9285,7 +9285,7 @@ fn zirFieldPtrNamedLoad(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Compil |
| 9285 | 9285 | } |
| 9286 | 9286 | |
| 9287 | 9287 | fn zirFieldPtrNamed(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 9288 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 9288 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 9289 | 9289 | const src = block.nodeOffset(inst_data.src_node); |
| 9290 | 9290 | const field_name_src = block.builtinCallArgSrc(inst_data.src_node, 1); |
| 9291 | 9291 | const extra = sema.code.extraData(Zir.Inst.FieldNamed, inst_data.payload_index).data; |
| ... | ... | @@ -9295,7 +9295,7 @@ fn zirFieldPtrNamed(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileErr |
| 9295 | 9295 | } |
| 9296 | 9296 | |
| 9297 | 9297 | fn zirIntCast(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 9298 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 9298 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 9299 | 9299 | const src = block.nodeOffset(inst_data.src_node); |
| 9300 | 9300 | const operand_src = block.builtinCallArgSrc(inst_data.src_node, 0); |
| 9301 | 9301 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; |
| ... | ... | @@ -9367,7 +9367,7 @@ fn intCast( |
| 9367 | 9367 | fn zirBitcast(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 9368 | 9368 | const pt = sema.pt; |
| 9369 | 9369 | const zcu = pt.zcu; |
| 9370 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 9370 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 9371 | 9371 | const src = block.nodeOffset(inst_data.src_node); |
| 9372 | 9372 | const operand_src = block.builtinCallArgSrc(inst_data.src_node, 0); |
| 9373 | 9373 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; |
| ... | ... | @@ -9467,7 +9467,7 @@ fn zirBackingInt(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError! |
| 9467 | 9467 | const pt = sema.pt; |
| 9468 | 9468 | const zcu = pt.zcu; |
| 9469 | 9469 | const gpa = zcu.comp.gpa; |
| 9470 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].un_node; | |
| 9470 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].un_node; | |
| 9471 | 9471 | const operand_src = block.builtinCallArgSrc(inst_data.src_node, 0); |
| 9472 | 9472 | |
| 9473 | 9473 | const operand = sema.resolveInst(inst_data.operand); |
| ... | ... | @@ -9524,7 +9524,7 @@ fn zirBackingInt(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError! |
| 9524 | 9524 | fn zirFromBackingIntArgTy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 9525 | 9525 | const pt = sema.pt; |
| 9526 | 9526 | const zcu = pt.zcu; |
| 9527 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].un_node; | |
| 9527 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].un_node; | |
| 9528 | 9528 | const src = block.nodeOffset(inst_data.src_node); |
| 9529 | 9529 | |
| 9530 | 9530 | const dest_ty = try sema.resolveDestType(block, src, inst_data.operand, .remove_eu_opt, "@fromBackingInt"); |
| ... | ... | @@ -9552,7 +9552,7 @@ fn zirFromBackingInt(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileEr |
| 9552 | 9552 | const zcu = pt.zcu; |
| 9553 | 9553 | const ip = &zcu.intern_pool; |
| 9554 | 9554 | |
| 9555 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 9555 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 9556 | 9556 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; |
| 9557 | 9557 | const src = block.nodeOffset(inst_data.src_node); |
| 9558 | 9558 | const operand_src = block.builtinCallArgSrc(inst_data.src_node, 0); |
| ... | ... | @@ -9602,7 +9602,7 @@ fn zirFromBackingInt(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileEr |
| 9602 | 9602 | fn zirFloatCast(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 9603 | 9603 | const pt = sema.pt; |
| 9604 | 9604 | const zcu = pt.zcu; |
| 9605 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 9605 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 9606 | 9606 | const src = block.nodeOffset(inst_data.src_node); |
| 9607 | 9607 | const operand_src = block.builtinCallArgSrc(inst_data.src_node, 0); |
| 9608 | 9608 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; |
| ... | ... | @@ -9665,7 +9665,7 @@ fn zirFloatCast(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A |
| 9665 | 9665 | } |
| 9666 | 9666 | |
| 9667 | 9667 | fn zirElemVal(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 9668 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 9668 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 9669 | 9669 | const src = block.nodeOffset(inst_data.src_node); |
| 9670 | 9670 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; |
| 9671 | 9671 | const array = sema.resolveInst(extra.lhs); |
| ... | ... | @@ -9674,7 +9674,7 @@ fn zirElemVal(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air |
| 9674 | 9674 | } |
| 9675 | 9675 | |
| 9676 | 9676 | fn zirElemPtrLoad(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 9677 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 9677 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 9678 | 9678 | const src = block.nodeOffset(inst_data.src_node); |
| 9679 | 9679 | const elem_index_src = block.src(.{ .node_offset_array_access_index = inst_data.src_node }); |
| 9680 | 9680 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; |
| ... | ... | @@ -9693,7 +9693,7 @@ fn zirElemPtrLoad(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError |
| 9693 | 9693 | } |
| 9694 | 9694 | |
| 9695 | 9695 | fn zirElemValImm(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 9696 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].elem_val_imm; | |
| 9696 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].elem_val_imm; | |
| 9697 | 9697 | const array = sema.resolveInst(inst_data.operand); |
| 9698 | 9698 | const elem_index = try sema.pt.intRef(.usize, inst_data.idx); |
| 9699 | 9699 | return sema.elemVal(block, LazySrcLoc.unneeded, array, elem_index, LazySrcLoc.unneeded, false); |
| ... | ... | @@ -9702,7 +9702,7 @@ fn zirElemValImm(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError! |
| 9702 | 9702 | fn zirElemPtr(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 9703 | 9703 | const pt = sema.pt; |
| 9704 | 9704 | const zcu = pt.zcu; |
| 9705 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 9705 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 9706 | 9706 | const src = block.nodeOffset(inst_data.src_node); |
| 9707 | 9707 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; |
| 9708 | 9708 | const array_ptr = sema.resolveInst(extra.lhs); |
| ... | ... | @@ -9728,7 +9728,7 @@ fn zirElemPtr(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air |
| 9728 | 9728 | } |
| 9729 | 9729 | |
| 9730 | 9730 | fn zirElemPtrNode(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 9731 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 9731 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 9732 | 9732 | const src = block.nodeOffset(inst_data.src_node); |
| 9733 | 9733 | const elem_index_src = block.src(.{ .node_offset_array_access_index = inst_data.src_node }); |
| 9734 | 9734 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; |
| ... | ... | @@ -9741,7 +9741,7 @@ fn zirElemPtrNode(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError |
| 9741 | 9741 | fn zirArrayInitElemPtr(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 9742 | 9742 | const pt = sema.pt; |
| 9743 | 9743 | const zcu = pt.zcu; |
| 9744 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 9744 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 9745 | 9745 | const src = block.nodeOffset(inst_data.src_node); |
| 9746 | 9746 | const extra = sema.code.extraData(Zir.Inst.ElemPtrImm, inst_data.payload_index).data; |
| 9747 | 9747 | const array_ptr = sema.resolveInst(extra.ptr); |
| ... | ... | @@ -9757,7 +9757,7 @@ fn zirArrayInitElemPtr(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Compile |
| 9757 | 9757 | } |
| 9758 | 9758 | |
| 9759 | 9759 | fn zirSliceStart(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 9760 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 9760 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 9761 | 9761 | const src = block.nodeOffset(inst_data.src_node); |
| 9762 | 9762 | const extra = sema.code.extraData(Zir.Inst.SliceStart, inst_data.payload_index).data; |
| 9763 | 9763 | const array_ptr = sema.resolveInst(extra.lhs); |
| ... | ... | @@ -9770,7 +9770,7 @@ fn zirSliceStart(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError! |
| 9770 | 9770 | } |
| 9771 | 9771 | |
| 9772 | 9772 | fn zirSliceEnd(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 9773 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 9773 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 9774 | 9774 | const src = block.nodeOffset(inst_data.src_node); |
| 9775 | 9775 | const extra = sema.code.extraData(Zir.Inst.SliceEnd, inst_data.payload_index).data; |
| 9776 | 9776 | const array_ptr = sema.resolveInst(extra.lhs); |
| ... | ... | @@ -9784,7 +9784,7 @@ fn zirSliceEnd(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 9784 | 9784 | } |
| 9785 | 9785 | |
| 9786 | 9786 | fn zirSliceSentinel(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 9787 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 9787 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 9788 | 9788 | const src = block.nodeOffset(inst_data.src_node); |
| 9789 | 9789 | const sentinel_src = block.src(.{ .node_offset_slice_sentinel = inst_data.src_node }); |
| 9790 | 9790 | const extra = sema.code.extraData(Zir.Inst.SliceSentinel, inst_data.payload_index).data; |
| ... | ... | @@ -9800,7 +9800,7 @@ fn zirSliceSentinel(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileErr |
| 9800 | 9800 | } |
| 9801 | 9801 | |
| 9802 | 9802 | fn zirSliceLength(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 9803 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 9803 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 9804 | 9804 | const src = block.nodeOffset(inst_data.src_node); |
| 9805 | 9805 | const extra = sema.code.extraData(Zir.Inst.SliceLength, inst_data.payload_index).data; |
| 9806 | 9806 | const array_ptr = sema.resolveInst(extra.lhs); |
| ... | ... | @@ -9822,7 +9822,7 @@ fn zirSliceSentinelTy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileE |
| 9822 | 9822 | const pt = sema.pt; |
| 9823 | 9823 | const zcu = pt.zcu; |
| 9824 | 9824 | |
| 9825 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].un_node; | |
| 9825 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].un_node; | |
| 9826 | 9826 | |
| 9827 | 9827 | const src = block.nodeOffset(inst_data.src_node); |
| 9828 | 9828 | const ptr_src = block.src(.{ .node_offset_slice_ptr = inst_data.src_node }); |
| ... | ... | @@ -9867,7 +9867,7 @@ fn zirSwitchBlockErrUnion(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Comp |
| 9867 | 9867 | |
| 9868 | 9868 | assert(!zir_switch.has_continue); // wrong codepath! |
| 9869 | 9869 | |
| 9870 | const block_inst: Air.Inst.Index = @enumFromInt(sema.air_instructions.len); | |
| 9870 | const block_inst: Air.Inst.Index = @fromBackingInt(@intCast(sema.air_instructions.len)); | |
| 9871 | 9871 | try sema.air_instructions.append(gpa, .{ |
| 9872 | 9872 | .tag = .block, |
| 9873 | 9873 | .data = undefined, |
| ... | ... | @@ -10021,7 +10021,7 @@ fn zirSwitchBlock( |
| 10021 | 10021 | ) CompileError!Air.Inst.Ref { |
| 10022 | 10022 | const zir_switch = sema.code.getSwitchBlock(inst); |
| 10023 | 10023 | |
| 10024 | const block_inst: Air.Inst.Index = @enumFromInt(sema.air_instructions.len); | |
| 10024 | const block_inst: Air.Inst.Index = @fromBackingInt(@intCast(sema.air_instructions.len)); | |
| 10025 | 10025 | try sema.air_instructions.append(sema.gpa, .{ |
| 10026 | 10026 | .tag = .block, |
| 10027 | 10027 | .data = undefined, |
| ... | ... | @@ -10161,7 +10161,7 @@ fn analyzeSwitchBlock( |
| 10161 | 10161 | return result; |
| 10162 | 10162 | } else |err| switch (err) { |
| 10163 | 10163 | error.ComptimeBreak => { |
| 10164 | const break_inst = sema.code.instructions.get(@intFromEnum(sema.comptime_break_inst)); | |
| 10164 | const break_inst = sema.code.instructions.get(@backingInt(sema.comptime_break_inst)); | |
| 10165 | 10165 | if (break_inst.tag != .switch_continue) return error.ComptimeBreak; |
| 10166 | 10166 | const extra = sema.code.extraData(Zir.Inst.Break, break_inst.data.@"break".payload_index).data; |
| 10167 | 10167 | if (extra.block_inst != switch_inst) return error.ComptimeBreak; |
| ... | ... | @@ -10342,7 +10342,7 @@ fn analyzeSwitchBlock( |
| 10342 | 10342 | break :switch_ref .{ air_ref, true }; |
| 10343 | 10343 | }; |
| 10344 | 10344 | |
| 10345 | const air_tag = sema.air_instructions.items(.tag)[@intFromEnum(switch_ref.toIndex().?)]; | |
| 10345 | const air_tag = sema.air_instructions.items(.tag)[@backingInt(switch_ref.toIndex().?)]; | |
| 10346 | 10346 | switch (air_tag) { |
| 10347 | 10347 | .loop_switch_br, .switch_br => assert(!item_has_opv), |
| 10348 | 10348 | .loop, .block => assert(item_has_opv), |
| ... | ... | @@ -10362,8 +10362,8 @@ fn analyzeSwitchBlock( |
| 10362 | 10362 | var replacement_block = block.makeSubBlock(); |
| 10363 | 10363 | defer replacement_block.instructions.deinit(gpa); |
| 10364 | 10364 | |
| 10365 | assert(sema.air_instructions.items(.tag)[@intFromEnum(placeholder_inst)] == .br); | |
| 10366 | const new_operand_maybe_ref = sema.air_instructions.items(.data)[@intFromEnum(placeholder_inst)].br.operand; | |
| 10365 | assert(sema.air_instructions.items(.tag)[@backingInt(placeholder_inst)] == .br); | |
| 10366 | const new_operand_maybe_ref = sema.air_instructions.items(.data)[@backingInt(placeholder_inst)].br.operand; | |
| 10367 | 10367 | |
| 10368 | 10368 | if (zir_switch.any_maybe_runtime_capture and !item_has_opv) { |
| 10369 | 10369 | _ = try replacement_block.addBinOp(.store, operand.loop.operand_alloc, new_operand_maybe_ref); |
| ... | ... | @@ -10404,8 +10404,8 @@ fn analyzeSwitchBlock( |
| 10404 | 10404 | if (replacement_block.instructions.items.len == 1) { |
| 10405 | 10405 | // Optimization: we don't need a block! |
| 10406 | 10406 | sema.air_instructions.set( |
| 10407 | @intFromEnum(placeholder_inst), | |
| 10408 | sema.air_instructions.get(@intFromEnum(replacement_block.instructions.items[0])), | |
| 10407 | @backingInt(placeholder_inst), | |
| 10408 | sema.air_instructions.get(@backingInt(replacement_block.instructions.items[0])), | |
| 10409 | 10409 | ); |
| 10410 | 10410 | continue; |
| 10411 | 10411 | } |
| ... | ... | @@ -10414,7 +10414,7 @@ fn analyzeSwitchBlock( |
| 10414 | 10414 | // No `br` is needed as the block is a switch dispatch so necessarily `noreturn`. |
| 10415 | 10415 | try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.Block).@"struct".field_names.len + |
| 10416 | 10416 | replacement_block.instructions.items.len); |
| 10417 | sema.air_instructions.set(@intFromEnum(placeholder_inst), .{ | |
| 10417 | sema.air_instructions.set(@backingInt(placeholder_inst), .{ | |
| 10418 | 10418 | .tag = .block, |
| 10419 | 10419 | .data = .{ .ty_pl = .{ |
| 10420 | 10420 | .ty = .noreturn_type, |
| ... | ... | @@ -10470,7 +10470,7 @@ fn finishSwitchBr( |
| 10470 | 10470 | |
| 10471 | 10471 | // AstGen guarantees that the instruction immediately preceding |
| 10472 | 10472 | // switch_block[_ref]/switch_block_err_union is a dbg_stmt. |
| 10473 | const cond_dbg_node_index: Zir.Inst.Index = @enumFromInt(@intFromEnum(switch_inst) - 1); | |
| 10473 | const cond_dbg_node_index: Zir.Inst.Index = @fromBackingInt(@intCast(@backingInt(switch_inst) - 1)); | |
| 10474 | 10474 | |
| 10475 | 10475 | const else_is_named_only = has_else and has_under; |
| 10476 | 10476 | |
| ... | ... | @@ -10499,7 +10499,7 @@ fn finishSwitchBr( |
| 10499 | 10499 | fn appendAssumeCapacity(hints: *@This(), hint: std.lang.BranchHint) void { |
| 10500 | 10500 | const idx_in_bag = hints.count % hints_per_bag; |
| 10501 | 10501 | var bag: u32 = if (idx_in_bag > 0) hints.bags.pop().? else 0; |
| 10502 | bag |= @as(u32, @intFromEnum(hint)) << @intCast(@bitSizeOf(std.lang.BranchHint) * idx_in_bag); | |
| 10502 | bag |= @as(u32, @backingInt(hint)) << @intCast(@bitSizeOf(std.lang.BranchHint) * idx_in_bag); | |
| 10503 | 10503 | hints.count += 1; |
| 10504 | 10504 | return hints.bags.appendAssumeCapacity(bag); |
| 10505 | 10505 | } |
| ... | ... | @@ -10613,7 +10613,7 @@ fn finishSwitchBr( |
| 10613 | 10613 | .ranges_len = 0, |
| 10614 | 10614 | .body_len = @intCast(case_block.instructions.items.len), |
| 10615 | 10615 | })); |
| 10616 | cases_extra.appendAssumeCapacity(@intFromEnum(item_ref)); | |
| 10616 | cases_extra.appendAssumeCapacity(@backingInt(item_ref)); | |
| 10617 | 10617 | cases_extra.appendSliceAssumeCapacity(@ptrCast(case_block.instructions.items)); |
| 10618 | 10618 | } |
| 10619 | 10619 | } |
| ... | ... | @@ -10685,7 +10685,7 @@ fn finishSwitchBr( |
| 10685 | 10685 | .ranges_len = 0, |
| 10686 | 10686 | .body_len = @intCast(case_block.instructions.items.len), |
| 10687 | 10687 | })); |
| 10688 | cases_extra.appendAssumeCapacity(@intFromEnum(item_ref)); | |
| 10688 | cases_extra.appendAssumeCapacity(@backingInt(item_ref)); | |
| 10689 | 10689 | cases_extra.appendSliceAssumeCapacity(@ptrCast(case_block.instructions.items)); |
| 10690 | 10690 | } |
| 10691 | 10691 | } |
| ... | ... | @@ -10828,7 +10828,7 @@ fn finishSwitchBr( |
| 10828 | 10828 | .ranges_len = 0, |
| 10829 | 10829 | .body_len = @intCast(case_block.instructions.items.len), |
| 10830 | 10830 | })); |
| 10831 | cases_extra.appendAssumeCapacity(@intFromEnum(item_ref)); | |
| 10831 | cases_extra.appendAssumeCapacity(@backingInt(item_ref)); | |
| 10832 | 10832 | cases_extra.appendSliceAssumeCapacity(@ptrCast(case_block.instructions.items)); |
| 10833 | 10833 | } |
| 10834 | 10834 | } |
| ... | ... | @@ -10891,7 +10891,7 @@ fn finishSwitchBr( |
| 10891 | 10891 | if (seen_field != null) continue; |
| 10892 | 10892 | const item_val = try pt.enumValueFieldIndex(item_ty, @intCast(field_i)); |
| 10893 | 10893 | const item_ref: Air.Inst.Ref = .fromValue(item_val); |
| 10894 | cases_extra.appendAssumeCapacity(@intFromEnum(item_ref)); | |
| 10894 | cases_extra.appendAssumeCapacity(@backingInt(item_ref)); | |
| 10895 | 10895 | items_len += 1; |
| 10896 | 10896 | } |
| 10897 | 10897 | assert(items_len > 0); // `else` must be reachable at this point |
| ... | ... | @@ -12370,7 +12370,7 @@ fn analyzeSwitchPayloadCaptureTaggedUnion( |
| 12370 | 12370 | |
| 12371 | 12371 | { |
| 12372 | 12372 | // All branch hints are `.none`, so just add zero elems. |
| 12373 | comptime assert(@intFromEnum(std.lang.BranchHint.none) == 0); | |
| 12373 | comptime assert(@backingInt(std.lang.BranchHint.none) == 0); | |
| 12374 | 12374 | const need_elems = @divCeil(field_indices.len + 1, 10); |
| 12375 | 12375 | try cases_extra.appendNTimes(gpa, 0, need_elems); |
| 12376 | 12376 | } |
| ... | ... | @@ -12402,15 +12402,15 @@ fn analyzeSwitchPayloadCaptureTaggedUnion( |
| 12402 | 12402 | .ranges_len = 0, |
| 12403 | 12403 | .body_len = @intCast(coerce_block.instructions.items.len), |
| 12404 | 12404 | })); |
| 12405 | cases_extra.appendAssumeCapacity(@intFromEnum(item)); // item | |
| 12405 | cases_extra.appendAssumeCapacity(@backingInt(item)); // item | |
| 12406 | 12406 | cases_extra.appendSliceAssumeCapacity(@ptrCast(coerce_block.instructions.items)); // body |
| 12407 | 12407 | } |
| 12408 | 12408 | } |
| 12409 | 12409 | const else_body_len = len: { |
| 12410 | 12410 | // 'else' prong is unreachable |
| 12411 | const result_index: Air.Inst.Index = @enumFromInt(sema.air_instructions.len); | |
| 12411 | const result_index: Air.Inst.Index = @fromBackingInt(@intCast(sema.air_instructions.len)); | |
| 12412 | 12412 | try sema.air_instructions.append(gpa, .{ .tag = .unreach, .data = .{ .no_op = {} } }); |
| 12413 | try cases_extra.append(gpa, @intFromEnum(result_index)); | |
| 12413 | try cases_extra.append(gpa, @backingInt(result_index)); | |
| 12414 | 12414 | break :len 1; |
| 12415 | 12415 | }; |
| 12416 | 12416 | |
| ... | ... | @@ -12439,13 +12439,13 @@ fn analyzeSwitchPayloadCaptureTaggedUnion( |
| 12439 | 12439 | .simple => |s| { |
| 12440 | 12440 | const air_datas = sema.air_instructions.items(.data); |
| 12441 | 12441 | air_datas[switch_br_inst].pl_op.operand = s.cond; |
| 12442 | air_datas[@intFromEnum(capture_block_inst)].ty_pl.payload = | |
| 12442 | air_datas[@backingInt(capture_block_inst)].ty_pl.payload = | |
| 12443 | 12443 | sema.addExtraAssumeCapacity(Air.Block{ .body_len = 1 }); |
| 12444 | 12444 | sema.air_extra.appendAssumeCapacity(switch_br_inst); |
| 12445 | 12445 | }, |
| 12446 | 12446 | .loop => { |
| 12447 | 12447 | // The block must first extract the tag from the loaded union. |
| 12448 | const tag_inst: Air.Inst.Index = @enumFromInt(sema.air_instructions.len); | |
| 12448 | const tag_inst: Air.Inst.Index = @fromBackingInt(@intCast(sema.air_instructions.len)); | |
| 12449 | 12449 | try sema.air_instructions.append(sema.gpa, .{ |
| 12450 | 12450 | .tag = .get_union_tag, |
| 12451 | 12451 | .data = .{ .ty_op = .{ |
| ... | ... | @@ -12455,9 +12455,9 @@ fn analyzeSwitchPayloadCaptureTaggedUnion( |
| 12455 | 12455 | }); |
| 12456 | 12456 | const air_datas = sema.air_instructions.items(.data); |
| 12457 | 12457 | air_datas[switch_br_inst].pl_op.operand = tag_inst.toRef(); |
| 12458 | air_datas[@intFromEnum(capture_block_inst)].ty_pl.payload = | |
| 12458 | air_datas[@backingInt(capture_block_inst)].ty_pl.payload = | |
| 12459 | 12459 | sema.addExtraAssumeCapacity(Air.Block{ .body_len = 2 }); |
| 12460 | sema.air_extra.appendAssumeCapacity(@intFromEnum(tag_inst)); | |
| 12460 | sema.air_extra.appendAssumeCapacity(@backingInt(tag_inst)); | |
| 12461 | 12461 | sema.air_extra.appendAssumeCapacity(switch_br_inst); |
| 12462 | 12462 | }, |
| 12463 | 12463 | } |
| ... | ... | @@ -12674,7 +12674,7 @@ fn maybeErrorUnwrap( |
| 12674 | 12674 | |
| 12675 | 12675 | const tags = sema.code.instructions.items(.tag); |
| 12676 | 12676 | for (body) |inst| { |
| 12677 | switch (tags[@intFromEnum(inst)]) { | |
| 12677 | switch (tags[@backingInt(inst)]) { | |
| 12678 | 12678 | .@"unreachable" => if (!block.wantSafety()) return false, |
| 12679 | 12679 | .err_union_code => if (!allow_err_code_inst) return false, |
| 12680 | 12680 | .save_err_ret_index, |
| ... | ... | @@ -12688,7 +12688,7 @@ fn maybeErrorUnwrap( |
| 12688 | 12688 | } |
| 12689 | 12689 | |
| 12690 | 12690 | for (body) |inst| { |
| 12691 | const air_inst = switch (tags[@intFromEnum(inst)]) { | |
| 12691 | const air_inst = switch (tags[@backingInt(inst)]) { | |
| 12692 | 12692 | .err_union_code => continue, |
| 12693 | 12693 | .dbg_stmt => { |
| 12694 | 12694 | try sema.zirDbgStmt(block, inst); |
| ... | ... | @@ -12705,7 +12705,7 @@ fn maybeErrorUnwrap( |
| 12705 | 12705 | return true; |
| 12706 | 12706 | }, |
| 12707 | 12707 | .panic => { |
| 12708 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].un_node; | |
| 12708 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].un_node; | |
| 12709 | 12709 | const msg_inst = sema.resolveInst(inst_data.operand); |
| 12710 | 12710 | |
| 12711 | 12711 | const panic_fn = try getStdLangValue(sema, operand_src, .@"panic.call"); |
| ... | ... | @@ -12726,9 +12726,9 @@ fn maybeErrorUnwrapCondbr(sema: *Sema, block: *Block, body: []const Zir.Inst.Ind |
| 12726 | 12726 | const pt = sema.pt; |
| 12727 | 12727 | const zcu = pt.zcu; |
| 12728 | 12728 | const index = cond.toIndex() orelse return; |
| 12729 | if (sema.code.instructions.items(.tag)[@intFromEnum(index)] != .is_non_err) return; | |
| 12729 | if (sema.code.instructions.items(.tag)[@backingInt(index)] != .is_non_err) return; | |
| 12730 | 12730 | |
| 12731 | const err_inst_data = sema.code.instructions.items(.data)[@intFromEnum(index)].un_node; | |
| 12731 | const err_inst_data = sema.code.instructions.items(.data)[@backingInt(index)].un_node; | |
| 12732 | 12732 | const err_operand = sema.resolveInst(err_inst_data.operand); |
| 12733 | 12733 | const operand_ty = sema.typeOf(err_operand); |
| 12734 | 12734 | if (operand_ty.zigTypeTag(zcu) == .error_set) { |
| ... | ... | @@ -12745,7 +12745,7 @@ fn maybeErrorUnwrapCondbr(sema: *Sema, block: *Block, body: []const Zir.Inst.Ind |
| 12745 | 12745 | fn maybeErrorUnwrapComptime(sema: *Sema, block: *Block, body: []const Zir.Inst.Index, operand: Air.Inst.Ref) !void { |
| 12746 | 12746 | const tags = sema.code.instructions.items(.tag); |
| 12747 | 12747 | const inst = for (body) |inst| { |
| 12748 | switch (tags[@intFromEnum(inst)]) { | |
| 12748 | switch (tags[@backingInt(inst)]) { | |
| 12749 | 12749 | .dbg_stmt, |
| 12750 | 12750 | .save_err_ret_index, |
| 12751 | 12751 | => {}, |
| ... | ... | @@ -12753,7 +12753,7 @@ fn maybeErrorUnwrapComptime(sema: *Sema, block: *Block, body: []const Zir.Inst.I |
| 12753 | 12753 | else => return, |
| 12754 | 12754 | } |
| 12755 | 12755 | } else return; |
| 12756 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].@"unreachable"; | |
| 12756 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].@"unreachable"; | |
| 12757 | 12757 | const src = block.nodeOffset(inst_data.src_node); |
| 12758 | 12758 | |
| 12759 | 12759 | if (try sema.resolveDefinedValue(block, src, operand)) |val| { |
| ... | ... | @@ -12766,7 +12766,7 @@ fn maybeErrorUnwrapComptime(sema: *Sema, block: *Block, body: []const Zir.Inst.I |
| 12766 | 12766 | fn zirHasField(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 12767 | 12767 | const pt = sema.pt; |
| 12768 | 12768 | const zcu = pt.zcu; |
| 12769 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 12769 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 12770 | 12770 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; |
| 12771 | 12771 | const ty_src = block.builtinCallArgSrc(inst_data.src_node, 0); |
| 12772 | 12772 | const name_src = block.builtinCallArgSrc(inst_data.src_node, 1); |
| ... | ... | @@ -12813,7 +12813,7 @@ fn zirHasField(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 12813 | 12813 | fn zirHasDecl(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 12814 | 12814 | const pt = sema.pt; |
| 12815 | 12815 | const zcu = pt.zcu; |
| 12816 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 12816 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 12817 | 12817 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; |
| 12818 | 12818 | const lhs_src = block.builtinCallArgSrc(inst_data.src_node, 0); |
| 12819 | 12819 | const rhs_src = block.builtinCallArgSrc(inst_data.src_node, 1); |
| ... | ... | @@ -12834,7 +12834,7 @@ fn zirHasDecl(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air |
| 12834 | 12834 | fn zirImport(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 12835 | 12835 | const pt = sema.pt; |
| 12836 | 12836 | const zcu = pt.zcu; |
| 12837 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_tok; | |
| 12837 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].pl_tok; | |
| 12838 | 12838 | const extra = sema.code.extraData(Zir.Inst.Import, inst_data.payload_index).data; |
| 12839 | 12839 | const operand_src = block.tokenOffset(inst_data.src_tok); |
| 12840 | 12840 | const operand = sema.code.nullTerminatedString(extra.path); |
| ... | ... | @@ -12883,7 +12883,7 @@ fn zirEmbedFile(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A |
| 12883 | 12883 | const pt = sema.pt; |
| 12884 | 12884 | const zcu = pt.zcu; |
| 12885 | 12885 | |
| 12886 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].un_node; | |
| 12886 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].un_node; | |
| 12887 | 12887 | const operand_src = block.builtinCallArgSrc(inst_data.src_node, 0); |
| 12888 | 12888 | const name = try sema.resolveConstString(block, operand_src, inst_data.operand, .{ .simple = .operand_embedFile }); |
| 12889 | 12889 | |
| ... | ... | @@ -12916,7 +12916,7 @@ fn zirShl( |
| 12916 | 12916 | ) CompileError!Air.Inst.Ref { |
| 12917 | 12917 | const pt = sema.pt; |
| 12918 | 12918 | const zcu = pt.zcu; |
| 12919 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 12919 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 12920 | 12920 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; |
| 12921 | 12921 | const lhs = sema.resolveInst(extra.lhs); |
| 12922 | 12922 | const rhs = sema.resolveInst(extra.rhs); |
| ... | ... | @@ -13103,7 +13103,7 @@ fn zirShr( |
| 13103 | 13103 | ) CompileError!Air.Inst.Ref { |
| 13104 | 13104 | const pt = sema.pt; |
| 13105 | 13105 | const zcu = pt.zcu; |
| 13106 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 13106 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 13107 | 13107 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; |
| 13108 | 13108 | const lhs = sema.resolveInst(extra.lhs); |
| 13109 | 13109 | const rhs = sema.resolveInst(extra.rhs); |
| ... | ... | @@ -13230,7 +13230,7 @@ fn zirBitwise( |
| 13230 | 13230 | ) CompileError!Air.Inst.Ref { |
| 13231 | 13231 | const pt = sema.pt; |
| 13232 | 13232 | const zcu = pt.zcu; |
| 13233 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 13233 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 13234 | 13234 | const src = block.src(.{ .node_offset_bin_op = inst_data.src_node }); |
| 13235 | 13235 | const lhs_src = block.src(.{ .node_offset_bin_lhs = inst_data.src_node }); |
| 13236 | 13236 | const rhs_src = block.src(.{ .node_offset_bin_rhs = inst_data.src_node }); |
| ... | ... | @@ -13284,7 +13284,7 @@ fn zirBitwise( |
| 13284 | 13284 | fn zirBitNot(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 13285 | 13285 | const pt = sema.pt; |
| 13286 | 13286 | const zcu = pt.zcu; |
| 13287 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].un_node; | |
| 13287 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].un_node; | |
| 13288 | 13288 | const operand_src = block.src(.{ .node_offset_un_op = inst_data.src_node }); |
| 13289 | 13289 | const src = block.nodeOffset(inst_data.src_node); |
| 13290 | 13290 | const operand = sema.resolveInst(inst_data.operand); |
| ... | ... | @@ -13410,7 +13410,7 @@ fn analyzeTupleCat( |
| 13410 | 13410 | fn zirArrayCat(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 13411 | 13411 | const pt = sema.pt; |
| 13412 | 13412 | const zcu = pt.zcu; |
| 13413 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 13413 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 13414 | 13414 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; |
| 13415 | 13415 | const lhs = sema.resolveInst(extra.lhs); |
| 13416 | 13416 | const rhs = sema.resolveInst(extra.rhs); |
| ... | ... | @@ -13844,7 +13844,7 @@ fn analyzeTupleMul( |
| 13844 | 13844 | fn zirNegate(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 13845 | 13845 | const pt = sema.pt; |
| 13846 | 13846 | const zcu = pt.zcu; |
| 13847 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].un_node; | |
| 13847 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].un_node; | |
| 13848 | 13848 | const src = block.nodeOffset(inst_data.src_node); |
| 13849 | 13849 | const lhs_src = src; |
| 13850 | 13850 | const rhs_src = block.src(.{ .node_offset_un_op = inst_data.src_node }); |
| ... | ... | @@ -13877,7 +13877,7 @@ fn zirNegate(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air. |
| 13877 | 13877 | fn zirNegateWrap(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 13878 | 13878 | const pt = sema.pt; |
| 13879 | 13879 | const zcu = pt.zcu; |
| 13880 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].un_node; | |
| 13880 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].un_node; | |
| 13881 | 13881 | const src = block.nodeOffset(inst_data.src_node); |
| 13882 | 13882 | const lhs_src = src; |
| 13883 | 13883 | const rhs_src = block.src(.{ .node_offset_un_op = inst_data.src_node }); |
| ... | ... | @@ -13902,7 +13902,7 @@ fn zirArithmetic( |
| 13902 | 13902 | zir_tag: Zir.Inst.Tag, |
| 13903 | 13903 | safety: bool, |
| 13904 | 13904 | ) CompileError!Air.Inst.Ref { |
| 13905 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 13905 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 13906 | 13906 | const src = block.src(.{ .node_offset_bin_op = inst_data.src_node }); |
| 13907 | 13907 | const lhs_src = block.src(.{ .node_offset_bin_lhs = inst_data.src_node }); |
| 13908 | 13908 | const rhs_src = block.src(.{ .node_offset_bin_rhs = inst_data.src_node }); |
| ... | ... | @@ -13916,7 +13916,7 @@ fn zirArithmetic( |
| 13916 | 13916 | fn zirDiv(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 13917 | 13917 | const pt = sema.pt; |
| 13918 | 13918 | const zcu = pt.zcu; |
| 13919 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 13919 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 13920 | 13920 | const src = block.src(.{ .node_offset_bin_op = inst_data.src_node }); |
| 13921 | 13921 | const lhs_src = block.src(.{ .node_offset_bin_lhs = inst_data.src_node }); |
| 13922 | 13922 | const rhs_src = block.src(.{ .node_offset_bin_rhs = inst_data.src_node }); |
| ... | ... | @@ -14025,7 +14025,7 @@ fn zirDiv(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Ins |
| 14025 | 14025 | fn zirDivExact(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 14026 | 14026 | const pt = sema.pt; |
| 14027 | 14027 | const zcu = pt.zcu; |
| 14028 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 14028 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 14029 | 14029 | const src = block.src(.{ .node_offset_bin_op = inst_data.src_node }); |
| 14030 | 14030 | const lhs_src = block.builtinCallArgSrc(inst_data.src_node, 0); |
| 14031 | 14031 | const rhs_src = block.builtinCallArgSrc(inst_data.src_node, 1); |
| ... | ... | @@ -14121,7 +14121,7 @@ fn zirDivExact(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 14121 | 14121 | fn zirDivFloor(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 14122 | 14122 | const pt = sema.pt; |
| 14123 | 14123 | const zcu = pt.zcu; |
| 14124 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 14124 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 14125 | 14125 | const src = block.src(.{ .node_offset_bin_op = inst_data.src_node }); |
| 14126 | 14126 | const lhs_src = block.builtinCallArgSrc(inst_data.src_node, 0); |
| 14127 | 14127 | const rhs_src = block.builtinCallArgSrc(inst_data.src_node, 1); |
| ... | ... | @@ -14186,7 +14186,7 @@ fn zirDivFloor(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 14186 | 14186 | fn zirDivCeil(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 14187 | 14187 | const pt = sema.pt; |
| 14188 | 14188 | const zcu = pt.zcu; |
| 14189 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 14189 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 14190 | 14190 | const src = block.src(.{ .node_offset_bin_op = inst_data.src_node }); |
| 14191 | 14191 | const lhs_src = block.builtinCallArgSrc(inst_data.src_node, 0); |
| 14192 | 14192 | const rhs_src = block.builtinCallArgSrc(inst_data.src_node, 1); |
| ... | ... | @@ -14251,7 +14251,7 @@ fn zirDivCeil(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air |
| 14251 | 14251 | fn zirDivTrunc(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 14252 | 14252 | const pt = sema.pt; |
| 14253 | 14253 | const zcu = pt.zcu; |
| 14254 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 14254 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 14255 | 14255 | const src = block.src(.{ .node_offset_bin_op = inst_data.src_node }); |
| 14256 | 14256 | const lhs_src = block.builtinCallArgSrc(inst_data.src_node, 0); |
| 14257 | 14257 | const rhs_src = block.builtinCallArgSrc(inst_data.src_node, 1); |
| ... | ... | @@ -14462,7 +14462,7 @@ fn airTag(block: *Block, is_int: bool, normal: Air.Inst.Tag, optimized: Air.Inst |
| 14462 | 14462 | fn zirModRem(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 14463 | 14463 | const pt = sema.pt; |
| 14464 | 14464 | const zcu = pt.zcu; |
| 14465 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 14465 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 14466 | 14466 | const src = block.src(.{ .node_offset_bin_op = inst_data.src_node }); |
| 14467 | 14467 | const lhs_src = block.src(.{ .node_offset_bin_lhs = inst_data.src_node }); |
| 14468 | 14468 | const rhs_src = block.src(.{ .node_offset_bin_rhs = inst_data.src_node }); |
| ... | ... | @@ -14563,7 +14563,7 @@ fn zirModRem(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air. |
| 14563 | 14563 | fn zirMod(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 14564 | 14564 | const pt = sema.pt; |
| 14565 | 14565 | const zcu = pt.zcu; |
| 14566 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 14566 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 14567 | 14567 | const src = block.src(.{ .node_offset_bin_op = inst_data.src_node }); |
| 14568 | 14568 | const lhs_src = block.builtinCallArgSrc(inst_data.src_node, 0); |
| 14569 | 14569 | const rhs_src = block.builtinCallArgSrc(inst_data.src_node, 1); |
| ... | ... | @@ -14627,7 +14627,7 @@ fn zirMod(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Ins |
| 14627 | 14627 | fn zirRem(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 14628 | 14628 | const pt = sema.pt; |
| 14629 | 14629 | const zcu = pt.zcu; |
| 14630 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 14630 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 14631 | 14631 | const src = block.src(.{ .node_offset_bin_op = inst_data.src_node }); |
| 14632 | 14632 | const lhs_src = block.builtinCallArgSrc(inst_data.src_node, 0); |
| 14633 | 14633 | const rhs_src = block.builtinCallArgSrc(inst_data.src_node, 1); |
| ... | ... | @@ -15211,7 +15211,7 @@ fn analyzePtrArithmetic( |
| 15211 | 15211 | } |
| 15212 | 15212 | |
| 15213 | 15213 | fn zirLoad(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 15214 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].un_node; | |
| 15214 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].un_node; | |
| 15215 | 15215 | const src = block.nodeOffset(inst_data.src_node); |
| 15216 | 15216 | const ptr_src = src; // TODO better source location |
| 15217 | 15217 | const ptr = sema.resolveInst(inst_data.operand); |
| ... | ... | @@ -15241,7 +15241,7 @@ fn zirAsm( |
| 15241 | 15241 | const is_global_assembly = sema.func_index == .none; |
| 15242 | 15242 | |
| 15243 | 15243 | const asm_source: []const u8 = if (tmpl_is_expr) s: { |
| 15244 | const tmpl: Zir.Inst.Ref = @enumFromInt(@intFromEnum(extra.data.asm_source)); | |
| 15244 | const tmpl: Zir.Inst.Ref = @fromBackingInt(@intCast(@backingInt(extra.data.asm_source))); | |
| 15245 | 15245 | break :s try sema.resolveConstString(block, src, tmpl, .{ .simple = .inline_assembly_code }); |
| 15246 | 15246 | } else sema.code.nullTerminatedString(extra.data.asm_source); |
| 15247 | 15247 | |
| ... | ... | @@ -15495,7 +15495,7 @@ fn zirCmpEq( |
| 15495 | 15495 | ) CompileError!Air.Inst.Ref { |
| 15496 | 15496 | const pt = sema.pt; |
| 15497 | 15497 | const zcu = pt.zcu; |
| 15498 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 15498 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 15499 | 15499 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; |
| 15500 | 15500 | const src: LazySrcLoc = block.nodeOffset(inst_data.src_node); |
| 15501 | 15501 | const lhs_src = block.src(.{ .node_offset_bin_lhs = inst_data.src_node }); |
| ... | ... | @@ -15606,7 +15606,7 @@ fn zirCmp( |
| 15606 | 15606 | inst: Zir.Inst.Index, |
| 15607 | 15607 | op: std.math.CompareOperator, |
| 15608 | 15608 | ) CompileError!Air.Inst.Ref { |
| 15609 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 15609 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 15610 | 15610 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; |
| 15611 | 15611 | const src: LazySrcLoc = block.nodeOffset(inst_data.src_node); |
| 15612 | 15612 | const lhs_src = block.src(.{ .node_offset_bin_lhs = inst_data.src_node }); |
| ... | ... | @@ -15762,7 +15762,7 @@ fn runtimeBoolCmp( |
| 15762 | 15762 | fn zirSizeOf(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 15763 | 15763 | const pt = sema.pt; |
| 15764 | 15764 | const zcu = pt.zcu; |
| 15765 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].un_node; | |
| 15765 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].un_node; | |
| 15766 | 15766 | const operand_src = block.builtinCallArgSrc(inst_data.src_node, 0); |
| 15767 | 15767 | const ty = try sema.resolveType(block, operand_src, inst_data.operand); |
| 15768 | 15768 | try sema.ensureLayoutResolved(ty, operand_src, .size_of); |
| ... | ... | @@ -15786,7 +15786,7 @@ fn zirSizeOf(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air. |
| 15786 | 15786 | fn zirBitSizeOf(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 15787 | 15787 | const pt = sema.pt; |
| 15788 | 15788 | const zcu = pt.zcu; |
| 15789 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].un_node; | |
| 15789 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].un_node; | |
| 15790 | 15790 | const operand_src = block.builtinCallArgSrc(inst_data.src_node, 0); |
| 15791 | 15791 | const operand_ty = try sema.resolveType(block, operand_src, inst_data.operand); |
| 15792 | 15792 | if (!operand_ty.hasBitRepresentation(zcu) and |
| ... | ... | @@ -15816,7 +15816,7 @@ fn zirClosureGet(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstDat |
| 15816 | 15816 | const ip = &zcu.intern_pool; |
| 15817 | 15817 | const captures = Type.fromInterned(zcu.namespacePtr(block.namespace).owner_type).getCaptures(zcu); |
| 15818 | 15818 | |
| 15819 | const src_node: std.zig.Ast.Node.Offset = @enumFromInt(@as(i32, @bitCast(extended.operand))); | |
| 15819 | const src_node: std.zig.Ast.Node.Offset = @fromBackingInt(@intCast(@as(i32, @bitCast(extended.operand)))); | |
| 15820 | 15820 | const src = block.nodeOffset(src_node); |
| 15821 | 15821 | |
| 15822 | 15822 | const capture_ty = switch (captures.get(ip)[extended.small].unwrap()) { |
| ... | ... | @@ -15912,7 +15912,7 @@ fn zirFrameAddress( |
| 15912 | 15912 | block: *Block, |
| 15913 | 15913 | extended: Zir.Inst.Extended.InstData, |
| 15914 | 15914 | ) CompileError!Air.Inst.Ref { |
| 15915 | const src_node: std.zig.Ast.Node.Offset = @enumFromInt(@as(i32, @bitCast(extended.operand))); | |
| 15915 | const src_node: std.zig.Ast.Node.Offset = @fromBackingInt(@intCast(@as(i32, @bitCast(extended.operand)))); | |
| 15916 | 15916 | const src = block.nodeOffset(src_node); |
| 15917 | 15917 | try sema.requireRuntimeBlock(block, src, null); |
| 15918 | 15918 | return try block.addNoOp(.frame_addr); |
| ... | ... | @@ -16034,7 +16034,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 16034 | 16034 | const io = comp.io; |
| 16035 | 16035 | const ip = &zcu.intern_pool; |
| 16036 | 16036 | |
| 16037 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].un_node; | |
| 16037 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].un_node; | |
| 16038 | 16038 | const src = block.nodeOffset(inst_data.src_node); |
| 16039 | 16039 | const ty = try sema.resolveType(block, src, inst_data.operand); |
| 16040 | 16040 | const type_info_ty = try sema.getStdLangType(src, .Type); |
| ... | ... | @@ -16207,7 +16207,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 16207 | 16207 | }; |
| 16208 | 16208 | return Air.internedToRef((try pt.internUnion(.{ |
| 16209 | 16209 | .ty = type_info_ty.toIntern(), |
| 16210 | .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.lang.TypeId.@"fn"))).toIntern(), | |
| 16210 | .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @backingInt(std.lang.TypeId.@"fn"))).toIntern(), | |
| 16211 | 16211 | .val = (try pt.aggregateValue(fn_info_ty, &field_values)).toIntern(), |
| 16212 | 16212 | }))); |
| 16213 | 16213 | }, |
| ... | ... | @@ -16217,13 +16217,13 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 16217 | 16217 | const info = ty.intInfo(zcu); |
| 16218 | 16218 | const field_values = .{ |
| 16219 | 16219 | // signedness: Signedness, |
| 16220 | (try pt.enumValueFieldIndex(signedness_ty, @intFromEnum(info.signedness))).toIntern(), | |
| 16220 | (try pt.enumValueFieldIndex(signedness_ty, @backingInt(info.signedness))).toIntern(), | |
| 16221 | 16221 | // bits: u16, |
| 16222 | 16222 | (try pt.intValue(.u16, info.bits)).toIntern(), |
| 16223 | 16223 | }; |
| 16224 | 16224 | return Air.internedToRef((try pt.internUnion(.{ |
| 16225 | 16225 | .ty = type_info_ty.toIntern(), |
| 16226 | .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.lang.TypeId.int))).toIntern(), | |
| 16226 | .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @backingInt(std.lang.TypeId.int))).toIntern(), | |
| 16227 | 16227 | .val = (try pt.aggregateValue(int_info_ty, &field_values)).toIntern(), |
| 16228 | 16228 | }))); |
| 16229 | 16229 | }, |
| ... | ... | @@ -16236,7 +16236,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 16236 | 16236 | }; |
| 16237 | 16237 | return Air.internedToRef((try pt.internUnion(.{ |
| 16238 | 16238 | .ty = type_info_ty.toIntern(), |
| 16239 | .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.lang.TypeId.float))).toIntern(), | |
| 16239 | .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @backingInt(std.lang.TypeId.float))).toIntern(), | |
| 16240 | 16240 | .val = (try pt.aggregateValue(float_info_ty, &field_vals)).toIntern(), |
| 16241 | 16241 | }))); |
| 16242 | 16242 | }, |
| ... | ... | @@ -16279,7 +16279,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 16279 | 16279 | |
| 16280 | 16280 | const field_values = .{ |
| 16281 | 16281 | // size: Size, |
| 16282 | (try pt.enumValueFieldIndex(ptr_size_ty, @intFromEnum(info.flags.size))).toIntern(), | |
| 16282 | (try pt.enumValueFieldIndex(ptr_size_ty, @backingInt(info.flags.size))).toIntern(), | |
| 16283 | 16283 | // attrs: Attributes |
| 16284 | 16284 | (try pt.aggregateValue(ptr_attrs_ty, &attributes)).toIntern(), |
| 16285 | 16285 | // child: type, |
| ... | ... | @@ -16292,7 +16292,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 16292 | 16292 | }; |
| 16293 | 16293 | return Air.internedToRef((try pt.internUnion(.{ |
| 16294 | 16294 | .ty = type_info_ty.toIntern(), |
| 16295 | .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.lang.TypeId.pointer))).toIntern(), | |
| 16295 | .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @backingInt(std.lang.TypeId.pointer))).toIntern(), | |
| 16296 | 16296 | .val = (try pt.aggregateValue(pointer_ty, &field_values)).toIntern(), |
| 16297 | 16297 | }))); |
| 16298 | 16298 | }, |
| ... | ... | @@ -16310,7 +16310,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 16310 | 16310 | }; |
| 16311 | 16311 | return Air.internedToRef((try pt.internUnion(.{ |
| 16312 | 16312 | .ty = type_info_ty.toIntern(), |
| 16313 | .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.lang.TypeId.array))).toIntern(), | |
| 16313 | .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @backingInt(std.lang.TypeId.array))).toIntern(), | |
| 16314 | 16314 | .val = (try pt.aggregateValue(array_field_ty, &field_values)).toIntern(), |
| 16315 | 16315 | }))); |
| 16316 | 16316 | }, |
| ... | ... | @@ -16326,7 +16326,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 16326 | 16326 | }; |
| 16327 | 16327 | return Air.internedToRef((try pt.internUnion(.{ |
| 16328 | 16328 | .ty = type_info_ty.toIntern(), |
| 16329 | .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.lang.TypeId.vector))).toIntern(), | |
| 16329 | .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @backingInt(std.lang.TypeId.vector))).toIntern(), | |
| 16330 | 16330 | .val = (try pt.aggregateValue(vector_field_ty, &field_values)).toIntern(), |
| 16331 | 16331 | }))); |
| 16332 | 16332 | }, |
| ... | ... | @@ -16339,7 +16339,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 16339 | 16339 | }; |
| 16340 | 16340 | return Air.internedToRef((try pt.internUnion(.{ |
| 16341 | 16341 | .ty = type_info_ty.toIntern(), |
| 16342 | .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.lang.TypeId.optional))).toIntern(), | |
| 16342 | .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @backingInt(std.lang.TypeId.optional))).toIntern(), | |
| 16343 | 16343 | .val = (try pt.aggregateValue(optional_field_ty, &field_values)).toIntern(), |
| 16344 | 16344 | }))); |
| 16345 | 16345 | }, |
| ... | ... | @@ -16430,7 +16430,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 16430 | 16430 | // Construct Type{ .error_set = errors_val } |
| 16431 | 16431 | return Air.internedToRef((try pt.internUnion(.{ |
| 16432 | 16432 | .ty = type_info_ty.toIntern(), |
| 16433 | .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.lang.TypeId.error_set))).toIntern(), | |
| 16433 | .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @backingInt(std.lang.TypeId.error_set))).toIntern(), | |
| 16434 | 16434 | .val = (try pt.aggregateValue(error_set_ty, &field_values)).toIntern(), |
| 16435 | 16435 | }))); |
| 16436 | 16436 | }, |
| ... | ... | @@ -16445,7 +16445,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 16445 | 16445 | }; |
| 16446 | 16446 | return Air.internedToRef((try pt.internUnion(.{ |
| 16447 | 16447 | .ty = type_info_ty.toIntern(), |
| 16448 | .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.lang.TypeId.error_union))).toIntern(), | |
| 16448 | .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @backingInt(std.lang.TypeId.error_union))).toIntern(), | |
| 16449 | 16449 | .val = (try pt.aggregateValue(error_union_field_ty, &field_values)).toIntern(), |
| 16450 | 16450 | }))); |
| 16451 | 16451 | }, |
| ... | ... | @@ -16583,7 +16583,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 16583 | 16583 | }; |
| 16584 | 16584 | return Air.internedToRef((try pt.internUnion(.{ |
| 16585 | 16585 | .ty = type_info_ty.toIntern(), |
| 16586 | .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.lang.TypeId.@"enum"))).toIntern(), | |
| 16586 | .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @backingInt(std.lang.TypeId.@"enum"))).toIntern(), | |
| 16587 | 16587 | .val = (try pt.aggregateValue(type_enum_ty, &field_values)).toIntern(), |
| 16588 | 16588 | }))); |
| 16589 | 16589 | }, |
| ... | ... | @@ -16763,7 +16763,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 16763 | 16763 | |
| 16764 | 16764 | const field_values = .{ |
| 16765 | 16765 | // layout: ContainerLayout, |
| 16766 | (try pt.enumValueFieldIndex(container_layout_ty, @intFromEnum(layout))).toIntern(), | |
| 16766 | (try pt.enumValueFieldIndex(container_layout_ty, @backingInt(layout))).toIntern(), | |
| 16767 | 16767 | |
| 16768 | 16768 | // tag_type: ?type, |
| 16769 | 16769 | enum_tag_ty_val, |
| ... | ... | @@ -16782,7 +16782,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 16782 | 16782 | }; |
| 16783 | 16783 | return Air.internedToRef((try pt.internUnion(.{ |
| 16784 | 16784 | .ty = type_info_ty.toIntern(), |
| 16785 | .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.lang.TypeId.@"union"))).toIntern(), | |
| 16785 | .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @backingInt(std.lang.TypeId.@"union"))).toIntern(), | |
| 16786 | 16786 | .val = (try pt.aggregateValue(type_union_ty, &field_values)).toIntern(), |
| 16787 | 16787 | }))); |
| 16788 | 16788 | }, |
| ... | ... | @@ -17040,7 +17040,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 17040 | 17040 | // is_tuple: bool, |
| 17041 | 17041 | Value.makeBool(ty.isTuple(zcu)).toIntern(), |
| 17042 | 17042 | // layout: ContainerLayout, |
| 17043 | (try pt.enumValueFieldIndex(container_layout_ty, @intFromEnum(layout))).toIntern(), | |
| 17043 | (try pt.enumValueFieldIndex(container_layout_ty, @backingInt(layout))).toIntern(), | |
| 17044 | 17044 | // backing_integer: ?type, |
| 17045 | 17045 | backing_integer_val, |
| 17046 | 17046 | |
| ... | ... | @@ -17056,7 +17056,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 17056 | 17056 | }; |
| 17057 | 17057 | return Air.internedToRef((try pt.internUnion(.{ |
| 17058 | 17058 | .ty = type_info_ty.toIntern(), |
| 17059 | .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.lang.TypeId.@"struct"))).toIntern(), | |
| 17059 | .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @backingInt(std.lang.TypeId.@"struct"))).toIntern(), | |
| 17060 | 17060 | .val = (try pt.aggregateValue(type_struct_ty, &field_values)).toIntern(), |
| 17061 | 17061 | }))); |
| 17062 | 17062 | }, |
| ... | ... | @@ -17071,7 +17071,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 17071 | 17071 | }; |
| 17072 | 17072 | return Air.internedToRef((try pt.internUnion(.{ |
| 17073 | 17073 | .ty = type_info_ty.toIntern(), |
| 17074 | .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.lang.TypeId.@"opaque"))).toIntern(), | |
| 17074 | .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @backingInt(std.lang.TypeId.@"opaque"))).toIntern(), | |
| 17075 | 17075 | .val = (try pt.aggregateValue(type_opaque_ty, &field_values)).toIntern(), |
| 17076 | 17076 | }))); |
| 17077 | 17077 | }, |
| ... | ... | @@ -17079,7 +17079,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 17079 | 17079 | const spirv_info = ip.loadSpirvType(ty.toIntern()); |
| 17080 | 17080 | const spirv_union_ty = try sema.getStdLangType(src, .@"Type.Spirv"); |
| 17081 | 17081 | const spirv_tag_ty = spirv_union_ty.unionTagType(zcu).?; |
| 17082 | const spirv_tag_val = try pt.enumValueFieldIndex(spirv_tag_ty, @intFromEnum(spirv_info.flags.tag)); | |
| 17082 | const spirv_tag_val = try pt.enumValueFieldIndex(spirv_tag_ty, @backingInt(spirv_info.flags.tag)); | |
| 17083 | 17083 | const spirv_payload_val: Value = switch (spirv_info.flags.tag) { |
| 17084 | 17084 | .sampler => .void, |
| 17085 | 17085 | .sampled_image, .runtime_array => .fromInterned(spirv_info.ty), |
| ... | ... | @@ -17091,14 +17091,14 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 17091 | 17091 | const depth_ty = try sema.getStdLangType(src, .@"Type.Spirv.Image.Depth"); |
| 17092 | 17092 | const access_ty = try sema.getStdLangType(src, .@"Type.Spirv.Image.Access"); |
| 17093 | 17093 | const usage_tag_ty = usage_union_ty.unionTagType(zcu).?; |
| 17094 | const usage_tag_val = try pt.enumValueFieldIndex(usage_tag_ty, @intFromEnum(spirv_info.flags.usage)); | |
| 17094 | const usage_tag_val = try pt.enumValueFieldIndex(usage_tag_ty, @backingInt(spirv_info.flags.usage)); | |
| 17095 | 17095 | const usage_val = try pt.unionValue(usage_union_ty, usage_tag_val, .fromInterned(spirv_info.ty)); |
| 17096 | 17096 | const image_field_vals = [_]InternPool.Index{ |
| 17097 | 17097 | usage_val.toIntern(), |
| 17098 | (try pt.enumValueFieldIndex(format_ty, @intFromEnum(spirv_info.flags.format))).toIntern(), | |
| 17099 | (try pt.enumValueFieldIndex(dim_ty, @intFromEnum(spirv_info.flags.dim))).toIntern(), | |
| 17100 | (try pt.enumValueFieldIndex(depth_ty, @intFromEnum(spirv_info.flags.depth))).toIntern(), | |
| 17101 | (try pt.enumValueFieldIndex(access_ty, @intFromEnum(spirv_info.flags.access))).toIntern(), | |
| 17098 | (try pt.enumValueFieldIndex(format_ty, @backingInt(spirv_info.flags.format))).toIntern(), | |
| 17099 | (try pt.enumValueFieldIndex(dim_ty, @backingInt(spirv_info.flags.dim))).toIntern(), | |
| 17100 | (try pt.enumValueFieldIndex(depth_ty, @backingInt(spirv_info.flags.depth))).toIntern(), | |
| 17101 | (try pt.enumValueFieldIndex(access_ty, @backingInt(spirv_info.flags.access))).toIntern(), | |
| 17102 | 17102 | Value.makeBool(spirv_info.flags.is_arrayed).toIntern(), |
| 17103 | 17103 | Value.makeBool(spirv_info.flags.is_multisampled).toIntern(), |
| 17104 | 17104 | }; |
| ... | ... | @@ -17108,7 +17108,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 17108 | 17108 | const spirv_val = try pt.unionValue(spirv_union_ty, spirv_tag_val, spirv_payload_val); |
| 17109 | 17109 | return Air.internedToRef((try pt.internUnion(.{ |
| 17110 | 17110 | .ty = type_info_ty.toIntern(), |
| 17111 | .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.lang.TypeId.spirv))).toIntern(), | |
| 17111 | .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @backingInt(std.lang.TypeId.spirv))).toIntern(), | |
| 17112 | 17112 | .val = spirv_val.toIntern(), |
| 17113 | 17113 | }))); |
| 17114 | 17114 | }, |
| ... | ... | @@ -17214,14 +17214,14 @@ fn typeInfoNamespaceDecls( |
| 17214 | 17214 | fn zirTypeof(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 17215 | 17215 | _ = block; |
| 17216 | 17216 | const zir_datas = sema.code.instructions.items(.data); |
| 17217 | const inst_data = zir_datas[@intFromEnum(inst)].un_node; | |
| 17217 | const inst_data = zir_datas[@backingInt(inst)].un_node; | |
| 17218 | 17218 | const operand = sema.resolveInst(inst_data.operand); |
| 17219 | 17219 | const operand_ty = sema.typeOf(operand); |
| 17220 | 17220 | return Air.internedToRef(operand_ty.toIntern()); |
| 17221 | 17221 | } |
| 17222 | 17222 | |
| 17223 | 17223 | fn zirTypeofBuiltin(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 17224 | const pl_node = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 17224 | const pl_node = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 17225 | 17225 | const extra = sema.code.extraData(Zir.Inst.Block, pl_node.payload_index); |
| 17226 | 17226 | const body = sema.code.bodySlice(extra.end, extra.data.body_len); |
| 17227 | 17227 | |
| ... | ... | @@ -17245,7 +17245,7 @@ fn zirTypeofBuiltin(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileErr |
| 17245 | 17245 | } |
| 17246 | 17246 | |
| 17247 | 17247 | fn zirTypeofLog2IntType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 17248 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].un_node; | |
| 17248 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].un_node; | |
| 17249 | 17249 | const src = block.nodeOffset(inst_data.src_node); |
| 17250 | 17250 | const operand = sema.resolveInst(inst_data.operand); |
| 17251 | 17251 | const operand_ty = sema.typeOf(operand); |
| ... | ... | @@ -17324,7 +17324,7 @@ fn zirTypeofPeer( |
| 17324 | 17324 | fn zirBoolNot(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 17325 | 17325 | const pt = sema.pt; |
| 17326 | 17326 | const zcu = pt.zcu; |
| 17327 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].un_node; | |
| 17327 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].un_node; | |
| 17328 | 17328 | const src = block.nodeOffset(inst_data.src_node); |
| 17329 | 17329 | const operand_src = block.src(.{ .node_offset_un_op = inst_data.src_node }); |
| 17330 | 17330 | const uncasted_operand = sema.resolveInst(inst_data.operand); |
| ... | ... | @@ -17356,7 +17356,7 @@ fn zirBoolBr( |
| 17356 | 17356 | const gpa = sema.gpa; |
| 17357 | 17357 | |
| 17358 | 17358 | const datas = sema.code.instructions.items(.data); |
| 17359 | const inst_data = datas[@intFromEnum(inst)].pl_node; | |
| 17359 | const inst_data = datas[@backingInt(inst)].pl_node; | |
| 17360 | 17360 | const extra = sema.code.extraData(Zir.Inst.BoolBr, inst_data.payload_index); |
| 17361 | 17361 | |
| 17362 | 17362 | const uncoerced_lhs = sema.resolveInst(extra.data.lhs); |
| ... | ... | @@ -17382,7 +17382,7 @@ fn zirBoolBr( |
| 17382 | 17382 | return sema.coerce(parent_block, .bool, rhs_result, rhs_src); |
| 17383 | 17383 | } |
| 17384 | 17384 | |
| 17385 | const block_inst: Air.Inst.Index = @enumFromInt(sema.air_instructions.len); | |
| 17385 | const block_inst: Air.Inst.Index = @fromBackingInt(@intCast(sema.air_instructions.len)); | |
| 17386 | 17386 | try sema.air_instructions.append(gpa, .{ |
| 17387 | 17387 | .tag = .block, |
| 17388 | 17388 | .data = .{ .ty_pl = .{ |
| ... | ... | @@ -17484,7 +17484,7 @@ fn finishCondBr( |
| 17484 | 17484 | .payload = cond_br_payload, |
| 17485 | 17485 | } } }); |
| 17486 | 17486 | |
| 17487 | sema.air_instructions.items(.data)[@intFromEnum(block_inst)].ty_pl.payload = sema.addExtraAssumeCapacity( | |
| 17487 | sema.air_instructions.items(.data)[@backingInt(block_inst)].ty_pl.payload = sema.addExtraAssumeCapacity( | |
| 17488 | 17488 | Air.Block{ .body_len = @intCast(child_block.instructions.items.len) }, |
| 17489 | 17489 | ); |
| 17490 | 17490 | sema.air_extra.appendSliceAssumeCapacity(@ptrCast(child_block.instructions.items)); |
| ... | ... | @@ -17517,7 +17517,7 @@ fn zirIsNonNull( |
| 17517 | 17517 | block: *Block, |
| 17518 | 17518 | inst: Zir.Inst.Index, |
| 17519 | 17519 | ) CompileError!Air.Inst.Ref { |
| 17520 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].un_node; | |
| 17520 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].un_node; | |
| 17521 | 17521 | const src = block.nodeOffset(inst_data.src_node); |
| 17522 | 17522 | const operand = sema.resolveInst(inst_data.operand); |
| 17523 | 17523 | try sema.checkNullableType(block, src, sema.typeOf(operand)); |
| ... | ... | @@ -17531,7 +17531,7 @@ fn zirIsNonNullPtr( |
| 17531 | 17531 | ) CompileError!Air.Inst.Ref { |
| 17532 | 17532 | const pt = sema.pt; |
| 17533 | 17533 | const zcu = pt.zcu; |
| 17534 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].un_node; | |
| 17534 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].un_node; | |
| 17535 | 17535 | const src = block.nodeOffset(inst_data.src_node); |
| 17536 | 17536 | const ptr = sema.resolveInst(inst_data.operand); |
| 17537 | 17537 | const ptr_ty = sema.typeOf(ptr); |
| ... | ... | @@ -17565,7 +17565,7 @@ fn checkErrorType(sema: *Sema, block: *Block, src: LazySrcLoc, ty: Type) !void { |
| 17565 | 17565 | } |
| 17566 | 17566 | |
| 17567 | 17567 | fn zirIsNonErr(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 17568 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].un_node; | |
| 17568 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].un_node; | |
| 17569 | 17569 | const src = block.nodeOffset(inst_data.src_node); |
| 17570 | 17570 | const operand = sema.resolveInst(inst_data.operand); |
| 17571 | 17571 | try sema.checkErrorType(block, src, sema.typeOf(operand)); |
| ... | ... | @@ -17575,7 +17575,7 @@ fn zirIsNonErr(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 17575 | 17575 | fn zirIsNonErrPtr(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 17576 | 17576 | const pt = sema.pt; |
| 17577 | 17577 | const zcu = pt.zcu; |
| 17578 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].un_node; | |
| 17578 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].un_node; | |
| 17579 | 17579 | const src = block.nodeOffset(inst_data.src_node); |
| 17580 | 17580 | const ptr = sema.resolveInst(inst_data.operand); |
| 17581 | 17581 | const ptr_ty = sema.typeOf(ptr); |
| ... | ... | @@ -17587,7 +17587,7 @@ fn zirIsNonErrPtr(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError |
| 17587 | 17587 | } |
| 17588 | 17588 | |
| 17589 | 17589 | fn zirRetIsNonErr(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 17590 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].un_node; | |
| 17590 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].un_node; | |
| 17591 | 17591 | const src = block.nodeOffset(inst_data.src_node); |
| 17592 | 17592 | const operand = sema.resolveInst(inst_data.operand); |
| 17593 | 17593 | return sema.analyzeIsNonErr(block, src, operand); |
| ... | ... | @@ -17600,7 +17600,7 @@ fn zirCondbr( |
| 17600 | 17600 | ) CompileError!void { |
| 17601 | 17601 | const pt = sema.pt; |
| 17602 | 17602 | const zcu = pt.zcu; |
| 17603 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 17603 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 17604 | 17604 | const cond_src = parent_block.src(.{ .node_offset_if_cond = inst_data.src_node }); |
| 17605 | 17605 | const extra = sema.code.extraData(Zir.Inst.CondBr, inst_data.payload_index); |
| 17606 | 17606 | |
| ... | ... | @@ -17640,9 +17640,9 @@ fn zirCondbr( |
| 17640 | 17640 | |
| 17641 | 17641 | const err_cond = blk: { |
| 17642 | 17642 | const index = extra.data.condition.toIndex() orelse break :blk null; |
| 17643 | if (sema.code.instructions.items(.tag)[@intFromEnum(index)] != .is_non_err) break :blk null; | |
| 17643 | if (sema.code.instructions.items(.tag)[@backingInt(index)] != .is_non_err) break :blk null; | |
| 17644 | 17644 | |
| 17645 | const err_inst_data = sema.code.instructions.items(.data)[@intFromEnum(index)].un_node; | |
| 17645 | const err_inst_data = sema.code.instructions.items(.data)[@backingInt(index)].un_node; | |
| 17646 | 17646 | const err_operand = sema.resolveInst(err_inst_data.operand); |
| 17647 | 17647 | const operand_ty = sema.typeOf(err_operand); |
| 17648 | 17648 | assert(operand_ty.zigTypeTag(zcu) == .error_union); |
| ... | ... | @@ -17686,7 +17686,7 @@ fn zirCondbr( |
| 17686 | 17686 | } |
| 17687 | 17687 | |
| 17688 | 17688 | fn zirTry(sema: *Sema, parent_block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 17689 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 17689 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 17690 | 17690 | const src = parent_block.nodeOffset(inst_data.src_node); |
| 17691 | 17691 | const operand_src = parent_block.src(.{ .node_offset_try_operand = inst_data.src_node }); |
| 17692 | 17692 | const extra = sema.code.extraData(Zir.Inst.Try, inst_data.payload_index); |
| ... | ... | @@ -17753,7 +17753,7 @@ fn zirTry(sema: *Sema, parent_block: *Block, inst: Zir.Inst.Index) CompileError! |
| 17753 | 17753 | } |
| 17754 | 17754 | |
| 17755 | 17755 | fn zirTryPtr(sema: *Sema, parent_block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 17756 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 17756 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 17757 | 17757 | const src = parent_block.nodeOffset(inst_data.src_node); |
| 17758 | 17758 | const operand_src = parent_block.src(.{ .node_offset_try_operand = inst_data.src_node }); |
| 17759 | 17759 | const extra = sema.code.extraData(Zir.Inst.Try, inst_data.payload_index); |
| ... | ... | @@ -17835,7 +17835,7 @@ fn ensurePostHoc(sema: *Sema, block: *Block, dest_block: Zir.Inst.Index) !*Label |
| 17835 | 17835 | |
| 17836 | 17836 | try sema.post_hoc_blocks.ensureUnusedCapacity(sema.gpa, 1); |
| 17837 | 17837 | |
| 17838 | const new_block_inst: Air.Inst.Index = @enumFromInt(sema.air_instructions.len); | |
| 17838 | const new_block_inst: Air.Inst.Index = @fromBackingInt(@intCast(sema.air_instructions.len)); | |
| 17839 | 17839 | gop.value_ptr.* = new_block_inst.toRef(); |
| 17840 | 17840 | try sema.air_instructions.append(sema.gpa, .{ |
| 17841 | 17841 | .tag = .block, |
| ... | ... | @@ -17889,7 +17889,7 @@ fn addRuntimeBreak(sema: *Sema, child_block: *Block, block_inst: Zir.Inst.Index, |
| 17889 | 17889 | } |
| 17890 | 17890 | |
| 17891 | 17891 | fn zirUnreachable(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void { |
| 17892 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].@"unreachable"; | |
| 17892 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].@"unreachable"; | |
| 17893 | 17893 | const src = block.nodeOffset(inst_data.src_node); |
| 17894 | 17894 | |
| 17895 | 17895 | if (block.isComptime()) { |
| ... | ... | @@ -17918,7 +17918,7 @@ fn zirRetErrValue( |
| 17918 | 17918 | const gpa = comp.gpa; |
| 17919 | 17919 | const io = comp.io; |
| 17920 | 17920 | |
| 17921 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].str_tok; | |
| 17921 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].str_tok; | |
| 17922 | 17922 | const src = block.tokenOffset(inst_data.src_tok); |
| 17923 | 17923 | const err_name = try zcu.intern_pool.getOrPutString( |
| 17924 | 17924 | gpa, |
| ... | ... | @@ -17944,7 +17944,7 @@ fn zirRetImplicit( |
| 17944 | 17944 | ) CompileError!void { |
| 17945 | 17945 | const pt = sema.pt; |
| 17946 | 17946 | const zcu = pt.zcu; |
| 17947 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].un_tok; | |
| 17947 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].un_tok; | |
| 17948 | 17948 | const r_brace_src = block.tokenOffset(inst_data.src_tok); |
| 17949 | 17949 | if (block.inlining == null and sema.func_is_naked) { |
| 17950 | 17950 | assert(!block.isComptime()); |
| ... | ... | @@ -17986,7 +17986,7 @@ fn zirRetImplicit( |
| 17986 | 17986 | } |
| 17987 | 17987 | |
| 17988 | 17988 | fn zirRetNode(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void { |
| 17989 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].un_node; | |
| 17989 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].un_node; | |
| 17990 | 17990 | const operand = sema.resolveInst(inst_data.operand); |
| 17991 | 17991 | const src = block.nodeOffset(inst_data.src_node); |
| 17992 | 17992 | |
| ... | ... | @@ -17994,7 +17994,7 @@ fn zirRetNode(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!voi |
| 17994 | 17994 | } |
| 17995 | 17995 | |
| 17996 | 17996 | fn zirRetLoad(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void { |
| 17997 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].un_node; | |
| 17997 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].un_node; | |
| 17998 | 17998 | const src = block.nodeOffset(inst_data.src_node); |
| 17999 | 17999 | const ret_ptr = sema.resolveInst(inst_data.operand); |
| 18000 | 18000 | |
| ... | ... | @@ -18053,13 +18053,13 @@ fn maybePushErrorTrace( |
| 18053 | 18053 | err_block.instructions.items.len + 1, // the error branch contains the `returnError` call and a `br` |
| 18054 | 18054 | ); |
| 18055 | 18055 | |
| 18056 | const block_inst: Air.Inst.Index = @enumFromInt(sema.air_instructions.len); | |
| 18057 | const cond_br_inst: Air.Inst.Index = @enumFromInt(sema.air_instructions.len + 1); | |
| 18058 | const then_br_inst: Air.Inst.Index = @enumFromInt(sema.air_instructions.len + 2); | |
| 18059 | const else_br_inst: Air.Inst.Index = @enumFromInt(sema.air_instructions.len + 3); | |
| 18056 | const block_inst: Air.Inst.Index = @fromBackingInt(@intCast(sema.air_instructions.len)); | |
| 18057 | const cond_br_inst: Air.Inst.Index = @fromBackingInt(@intCast(sema.air_instructions.len + 1)); | |
| 18058 | const then_br_inst: Air.Inst.Index = @fromBackingInt(@intCast(sema.air_instructions.len + 2)); | |
| 18059 | const else_br_inst: Air.Inst.Index = @fromBackingInt(@intCast(sema.air_instructions.len + 3)); | |
| 18060 | 18060 | |
| 18061 | 18061 | const block_payload = sema.addExtraAssumeCapacity(Air.Block{ .body_len = 1 }); |
| 18062 | sema.air_extra.appendAssumeCapacity(@intFromEnum(cond_br_inst)); | |
| 18062 | sema.air_extra.appendAssumeCapacity(@backingInt(cond_br_inst)); | |
| 18063 | 18063 | sema.air_instructions.appendAssumeCapacity(.{ |
| 18064 | 18064 | .tag = .block, |
| 18065 | 18065 | .data = .{ .ty_pl = .{ |
| ... | ... | @@ -18080,9 +18080,9 @@ fn maybePushErrorTrace( |
| 18080 | 18080 | .else_cov = .none, |
| 18081 | 18081 | }, |
| 18082 | 18082 | }); |
| 18083 | sema.air_extra.appendAssumeCapacity(@intFromEnum(then_br_inst)); | |
| 18083 | sema.air_extra.appendAssumeCapacity(@backingInt(then_br_inst)); | |
| 18084 | 18084 | sema.air_extra.appendSliceAssumeCapacity(@ptrCast(err_block.instructions.items)); |
| 18085 | sema.air_extra.appendAssumeCapacity(@intFromEnum(else_br_inst)); | |
| 18085 | sema.air_extra.appendAssumeCapacity(@backingInt(else_br_inst)); | |
| 18086 | 18086 | sema.air_instructions.appendAssumeCapacity(.{ |
| 18087 | 18087 | .tag = .cond_br, |
| 18088 | 18088 | .data = .{ .pl_op = .{ |
| ... | ... | @@ -18112,7 +18112,7 @@ fn wantErrorReturnTracing(sema: *Sema) bool { |
| 18112 | 18112 | fn zirSaveErrRetIndex(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void { |
| 18113 | 18113 | const pt = sema.pt; |
| 18114 | 18114 | const zcu = pt.zcu; |
| 18115 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].save_err_ret_index; | |
| 18115 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].save_err_ret_index; | |
| 18116 | 18116 | |
| 18117 | 18117 | if (!block.ownerModule().error_tracing) return; |
| 18118 | 18118 | |
| ... | ... | @@ -18306,7 +18306,7 @@ fn zirPtrType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air |
| 18306 | 18306 | const io = comp.io; |
| 18307 | 18307 | const ip = &zcu.intern_pool; |
| 18308 | 18308 | |
| 18309 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].ptr_type; | |
| 18309 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].ptr_type; | |
| 18310 | 18310 | const extra = sema.code.extraData(Zir.Inst.PtrType, inst_data.payload_index); |
| 18311 | 18311 | const elem_ty_src = block.src(.{ .node_offset_ptr_elem = extra.data.src_node }); |
| 18312 | 18312 | const sentinel_src = block.src(.{ .node_offset_ptr_sentinel = extra.data.src_node }); |
| ... | ... | @@ -18335,7 +18335,7 @@ fn zirPtrType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air |
| 18335 | 18335 | var extra_i = extra.end; |
| 18336 | 18336 | |
| 18337 | 18337 | const sentinel = if (inst_data.flags.has_sentinel) blk: { |
| 18338 | const ref: Zir.Inst.Ref = @enumFromInt(sema.code.extra[extra_i]); | |
| 18338 | const ref: Zir.Inst.Ref = @fromBackingInt(@intCast(sema.code.extra[extra_i])); | |
| 18339 | 18339 | extra_i += 1; |
| 18340 | 18340 | const coerced = try sema.coerce(block, elem_ty, sema.resolveInst(ref), sentinel_src); |
| 18341 | 18341 | const val = try sema.resolveConstDefinedValue(block, sentinel_src, coerced, .{ .simple = .pointer_sentinel }); |
| ... | ... | @@ -18348,7 +18348,7 @@ fn zirPtrType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air |
| 18348 | 18348 | } else .none; |
| 18349 | 18349 | |
| 18350 | 18350 | const abi_align: Alignment = if (inst_data.flags.has_align) blk: { |
| 18351 | const ref: Zir.Inst.Ref = @enumFromInt(sema.code.extra[extra_i]); | |
| 18351 | const ref: Zir.Inst.Ref = @fromBackingInt(@intCast(sema.code.extra[extra_i])); | |
| 18352 | 18352 | extra_i += 1; |
| 18353 | 18353 | const coerced = try sema.coerce(block, align_ty, sema.resolveInst(ref), align_src); |
| 18354 | 18354 | const val = try sema.resolveConstDefinedValue(block, align_src, coerced, .{ .simple = .@"align" }); |
| ... | ... | @@ -18357,20 +18357,20 @@ fn zirPtrType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air |
| 18357 | 18357 | } else .none; |
| 18358 | 18358 | |
| 18359 | 18359 | const address_space: std.lang.AddressSpace = if (inst_data.flags.has_addrspace) blk: { |
| 18360 | const ref: Zir.Inst.Ref = @enumFromInt(sema.code.extra[extra_i]); | |
| 18360 | const ref: Zir.Inst.Ref = @fromBackingInt(@intCast(sema.code.extra[extra_i])); | |
| 18361 | 18361 | extra_i += 1; |
| 18362 | 18362 | break :blk try sema.resolveAddressSpace(block, addrspace_src, ref, .pointer); |
| 18363 | 18363 | } else if (elem_ty.zigTypeTag(zcu) == .@"fn" and target.cpu.arch == .avr) .flash else .generic; |
| 18364 | 18364 | |
| 18365 | 18365 | const bit_offset: u16 = if (inst_data.flags.has_bit_range) blk: { |
| 18366 | const ref: Zir.Inst.Ref = @enumFromInt(sema.code.extra[extra_i]); | |
| 18366 | const ref: Zir.Inst.Ref = @fromBackingInt(@intCast(sema.code.extra[extra_i])); | |
| 18367 | 18367 | extra_i += 1; |
| 18368 | 18368 | const bit_offset = try sema.resolveInt(block, bitoffset_src, ref, .u16, .{ .simple = .type }); |
| 18369 | 18369 | break :blk @intCast(bit_offset); |
| 18370 | 18370 | } else 0; |
| 18371 | 18371 | |
| 18372 | 18372 | const host_size: u16 = if (inst_data.flags.has_bit_range) blk: { |
| 18373 | const ref: Zir.Inst.Ref = @enumFromInt(sema.code.extra[extra_i]); | |
| 18373 | const ref: Zir.Inst.Ref = @fromBackingInt(@intCast(sema.code.extra[extra_i])); | |
| 18374 | 18374 | extra_i += 1; |
| 18375 | 18375 | const host_size = try sema.resolveInt(block, hostsize_src, ref, .u16, .{ .simple = .type }); |
| 18376 | 18376 | break :blk @intCast(host_size); |
| ... | ... | @@ -18425,7 +18425,7 @@ fn zirPtrType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air |
| 18425 | 18425 | } |
| 18426 | 18426 | |
| 18427 | 18427 | fn zirStructInitEmpty(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 18428 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].un_node; | |
| 18428 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].un_node; | |
| 18429 | 18429 | const src = block.nodeOffset(inst_data.src_node); |
| 18430 | 18430 | const ty_src = block.src(.{ .node_offset_init_ty = inst_data.src_node }); |
| 18431 | 18431 | const obj_ty = try sema.resolveType(block, ty_src, inst_data.operand); |
| ... | ... | @@ -18445,7 +18445,7 @@ fn zirStructInitEmpty(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileE |
| 18445 | 18445 | fn zirStructInitEmptyResult(sema: *Sema, block: *Block, inst: Zir.Inst.Index, is_byref: bool) CompileError!Air.Inst.Ref { |
| 18446 | 18446 | const pt = sema.pt; |
| 18447 | 18447 | const zcu = pt.zcu; |
| 18448 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].un_node; | |
| 18448 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].un_node; | |
| 18449 | 18449 | const src = block.nodeOffset(inst_data.src_node); |
| 18450 | 18450 | |
| 18451 | 18451 | // Generic poison means this is an untyped anonymous empty struct/array init |
| ... | ... | @@ -18557,7 +18557,7 @@ fn zirUnionInit(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A |
| 18557 | 18557 | const pt = sema.pt; |
| 18558 | 18558 | const zcu = pt.zcu; |
| 18559 | 18559 | const ip = &zcu.intern_pool; |
| 18560 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 18560 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 18561 | 18561 | const ty_src = block.builtinCallArgSrc(inst_data.src_node, 0); |
| 18562 | 18562 | const field_src = block.builtinCallArgSrc(inst_data.src_node, 1); |
| 18563 | 18563 | const payload_src = block.builtinCallArgSrc(inst_data.src_node, 2); |
| ... | ... | @@ -18601,12 +18601,12 @@ fn zirStructInit( |
| 18601 | 18601 | const ip = &zcu.intern_pool; |
| 18602 | 18602 | |
| 18603 | 18603 | const zir_datas = sema.code.instructions.items(.data); |
| 18604 | const inst_data = zir_datas[@intFromEnum(inst)].pl_node; | |
| 18604 | const inst_data = zir_datas[@backingInt(inst)].pl_node; | |
| 18605 | 18605 | const extra = sema.code.extraData(Zir.Inst.StructInit, inst_data.payload_index); |
| 18606 | 18606 | const src = block.nodeOffset(inst_data.src_node); |
| 18607 | 18607 | |
| 18608 | 18608 | const first_item = sema.code.extraData(Zir.Inst.StructInit.Item, extra.end).data; |
| 18609 | const first_field_type_data = zir_datas[@intFromEnum(first_item.field_type)].pl_node; | |
| 18609 | const first_field_type_data = zir_datas[@backingInt(first_item.field_type)].pl_node; | |
| 18610 | 18610 | const first_field_type_extra = sema.code.extraData(Zir.Inst.FieldType, first_field_type_data.payload_index).data; |
| 18611 | 18611 | const result_ty = try sema.resolveTypeOrPoison(block, src, first_field_type_extra.container_type) orelse { |
| 18612 | 18612 | // The type wasn't actually known, so treat this as an anon struct init. |
| ... | ... | @@ -18640,7 +18640,7 @@ fn zirStructInit( |
| 18640 | 18640 | const item = sema.code.extraData(Zir.Inst.StructInit.Item, extra_index); |
| 18641 | 18641 | extra_index = item.end; |
| 18642 | 18642 | |
| 18643 | const field_type_data = zir_datas[@intFromEnum(item.data.field_type)].pl_node; | |
| 18643 | const field_type_data = zir_datas[@backingInt(item.data.field_type)].pl_node; | |
| 18644 | 18644 | const field_src = block.src(.{ .node_offset_initializer = field_type_data.src_node }); |
| 18645 | 18645 | const field_type_extra = sema.code.extraData(Zir.Inst.FieldType, field_type_data.payload_index).data; |
| 18646 | 18646 | const field_name = try ip.getOrPutString( |
| ... | ... | @@ -18679,7 +18679,7 @@ fn zirStructInit( |
| 18679 | 18679 | |
| 18680 | 18680 | const item = sema.code.extraData(Zir.Inst.StructInit.Item, extra.end); |
| 18681 | 18681 | |
| 18682 | const field_type_data = zir_datas[@intFromEnum(item.data.field_type)].pl_node; | |
| 18682 | const field_type_data = zir_datas[@backingInt(item.data.field_type)].pl_node; | |
| 18683 | 18683 | const field_src = block.src(.{ .node_offset_initializer = field_type_data.src_node }); |
| 18684 | 18684 | const field_type_extra = sema.code.extraData(Zir.Inst.FieldType, field_type_data.payload_index).data; |
| 18685 | 18685 | const field_name = try ip.getOrPutString( |
| ... | ... | @@ -18933,7 +18933,7 @@ fn zirStructInitAnon( |
| 18933 | 18933 | block: *Block, |
| 18934 | 18934 | inst: Zir.Inst.Index, |
| 18935 | 18935 | ) CompileError!Air.Inst.Ref { |
| 18936 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 18936 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 18937 | 18937 | const src = block.nodeOffset(inst_data.src_node); |
| 18938 | 18938 | const extra = sema.code.extraData(Zir.Inst.StructInitAnon, inst_data.payload_index); |
| 18939 | 18939 | return sema.structInitAnon(block, src, inst, .anon_init, extra.data, extra.end, false); |
| ... | ... | @@ -18984,7 +18984,7 @@ fn structInitAnon( |
| 18984 | 18984 | .anon_init => sema.code.nullTerminatedString(item.data.field_name), |
| 18985 | 18985 | .typed_init => name: { |
| 18986 | 18986 | // `item.data.field_type` references a `field_type` instruction |
| 18987 | const field_type_data = zir_datas[@intFromEnum(item.data.field_type)].pl_node; | |
| 18987 | const field_type_data = zir_datas[@backingInt(item.data.field_type)].pl_node; | |
| 18988 | 18988 | const field_type_extra = sema.code.extraData(Zir.Inst.FieldType, field_type_data.payload_index); |
| 18989 | 18989 | break :name sema.code.nullTerminatedString(field_type_extra.data.name_start); |
| 18990 | 18990 | }, |
| ... | ... | @@ -19155,7 +19155,7 @@ fn zirArrayInit( |
| 19155 | 19155 | const pt = sema.pt; |
| 19156 | 19156 | const zcu = pt.zcu; |
| 19157 | 19157 | const gpa = sema.gpa; |
| 19158 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 19158 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 19159 | 19159 | const src = block.nodeOffset(inst_data.src_node); |
| 19160 | 19160 | |
| 19161 | 19161 | const extra = sema.code.extraData(Zir.Inst.MultiOp, inst_data.payload_index); |
| ... | ... | @@ -19286,7 +19286,7 @@ fn zirArrayInitAnon( |
| 19286 | 19286 | block: *Block, |
| 19287 | 19287 | inst: Zir.Inst.Index, |
| 19288 | 19288 | ) CompileError!Air.Inst.Ref { |
| 19289 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 19289 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 19290 | 19290 | const src = block.nodeOffset(inst_data.src_node); |
| 19291 | 19291 | const extra = sema.code.extraData(Zir.Inst.MultiOp, inst_data.payload_index); |
| 19292 | 19292 | const operands = sema.code.refSlice(extra.end, extra.data.operands_len); |
| ... | ... | @@ -19406,7 +19406,7 @@ fn addConstantMaybeRef(sema: *Sema, val: Value, is_ref: bool) !Air.Inst.Ref { |
| 19406 | 19406 | } |
| 19407 | 19407 | |
| 19408 | 19408 | fn zirFieldTypeRef(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 19409 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 19409 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 19410 | 19410 | const extra = sema.code.extraData(Zir.Inst.FieldTypeRef, inst_data.payload_index).data; |
| 19411 | 19411 | const ty_src = block.builtinCallArgSrc(inst_data.src_node, 0); |
| 19412 | 19412 | const field_src = block.builtinCallArgSrc(inst_data.src_node, 1); |
| ... | ... | @@ -19424,7 +19424,7 @@ fn zirStructInitFieldType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Comp |
| 19424 | 19424 | const io = comp.io; |
| 19425 | 19425 | const ip = &zcu.intern_pool; |
| 19426 | 19426 | |
| 19427 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 19427 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 19428 | 19428 | const extra = sema.code.extraData(Zir.Inst.FieldType, inst_data.payload_index).data; |
| 19429 | 19429 | const ty_src = block.nodeOffset(inst_data.src_node); |
| 19430 | 19430 | const field_name_src = block.src(.{ .node_offset_field_name_init = inst_data.src_node }); |
| ... | ... | @@ -19528,7 +19528,7 @@ fn zirFrame( |
| 19528 | 19528 | block: *Block, |
| 19529 | 19529 | extended: Zir.Inst.Extended.InstData, |
| 19530 | 19530 | ) CompileError!Air.Inst.Ref { |
| 19531 | const src_node: std.zig.Ast.Node.Offset = @enumFromInt(@as(i32, @bitCast(extended.operand))); | |
| 19531 | const src_node: std.zig.Ast.Node.Offset = @fromBackingInt(@intCast(@as(i32, @bitCast(extended.operand)))); | |
| 19532 | 19532 | const src = block.nodeOffset(src_node); |
| 19533 | 19533 | return sema.failWithUseOfAsync(block, src); |
| 19534 | 19534 | } |
| ... | ... | @@ -19536,7 +19536,7 @@ fn zirFrame( |
| 19536 | 19536 | fn zirAlignOf(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 19537 | 19537 | const pt = sema.pt; |
| 19538 | 19538 | const zcu = pt.zcu; |
| 19539 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].un_node; | |
| 19539 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].un_node; | |
| 19540 | 19540 | const operand_src = block.builtinCallArgSrc(inst_data.src_node, 0); |
| 19541 | 19541 | const ty = try sema.resolveType(block, operand_src, inst_data.operand); |
| 19542 | 19542 | try sema.ensureLayoutResolved(ty, operand_src, .align_of); |
| ... | ... | @@ -19549,7 +19549,7 @@ fn zirAlignOf(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air |
| 19549 | 19549 | fn zirIntFromBool(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 19550 | 19550 | const pt = sema.pt; |
| 19551 | 19551 | const zcu = pt.zcu; |
| 19552 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].un_node; | |
| 19552 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].un_node; | |
| 19553 | 19553 | const src = block.nodeOffset(inst_data.src_node); |
| 19554 | 19554 | const operand = sema.resolveInst(inst_data.operand); |
| 19555 | 19555 | const operand_ty = sema.typeOf(operand); |
| ... | ... | @@ -19581,7 +19581,7 @@ fn zirIntFromBool(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError |
| 19581 | 19581 | } |
| 19582 | 19582 | |
| 19583 | 19583 | fn zirErrorName(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 19584 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].un_node; | |
| 19584 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].un_node; | |
| 19585 | 19585 | const operand_src = block.builtinCallArgSrc(inst_data.src_node, 0); |
| 19586 | 19586 | const uncoerced_operand = sema.resolveInst(inst_data.operand); |
| 19587 | 19587 | const operand = try sema.coerce(block, .anyerror, uncoerced_operand, operand_src); |
| ... | ... | @@ -19603,7 +19603,7 @@ fn zirAbs( |
| 19603 | 19603 | ) CompileError!Air.Inst.Ref { |
| 19604 | 19604 | const pt = sema.pt; |
| 19605 | 19605 | const zcu = pt.zcu; |
| 19606 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].un_node; | |
| 19606 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].un_node; | |
| 19607 | 19607 | const operand = sema.resolveInst(inst_data.operand); |
| 19608 | 19608 | const operand_src = block.builtinCallArgSrc(inst_data.src_node, 0); |
| 19609 | 19609 | const operand_ty = sema.typeOf(operand); |
| ... | ... | @@ -19694,7 +19694,7 @@ fn zirUnaryMath( |
| 19694 | 19694 | air_tag: Air.Inst.Tag, |
| 19695 | 19695 | comptime eval: fn (Value, Type, Allocator, Zcu.PerThread) Allocator.Error!Value, |
| 19696 | 19696 | ) CompileError!Air.Inst.Ref { |
| 19697 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].un_node; | |
| 19697 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].un_node; | |
| 19698 | 19698 | const operand = sema.resolveInst(inst_data.operand); |
| 19699 | 19699 | const operand_src = block.builtinCallArgSrc(inst_data.src_node, 0); |
| 19700 | 19700 | |
| ... | ... | @@ -19702,7 +19702,7 @@ fn zirUnaryMath( |
| 19702 | 19702 | } |
| 19703 | 19703 | |
| 19704 | 19704 | fn zirTagName(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 19705 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].un_node; | |
| 19705 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].un_node; | |
| 19706 | 19706 | const operand_src = block.builtinCallArgSrc(inst_data.src_node, 0); |
| 19707 | 19707 | const src = block.nodeOffset(inst_data.src_node); |
| 19708 | 19708 | const operand = sema.resolveInst(inst_data.operand); |
| ... | ... | @@ -19752,7 +19752,7 @@ fn zirTagName(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air |
| 19752 | 19752 | } |
| 19753 | 19753 | |
| 19754 | 19754 | fn zirReifyInt(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 19755 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 19755 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 19756 | 19756 | const signedness_src = block.builtinCallArgSrc(inst_data.src_node, 0); |
| 19757 | 19757 | const bits_src = block.builtinCallArgSrc(inst_data.src_node, 1); |
| 19758 | 19758 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; |
| ... | ... | @@ -19773,7 +19773,7 @@ fn zirReifySliceArgTy( |
| 19773 | 19773 | const zcu = pt.zcu; |
| 19774 | 19774 | |
| 19775 | 19775 | const extra = sema.code.extraData(Zir.Inst.UnNode, extended.operand).data; |
| 19776 | const info: Zir.Inst.ReifySliceArgInfo = @enumFromInt(extended.small); | |
| 19776 | const info: Zir.Inst.ReifySliceArgInfo = @fromBackingInt(@intCast(extended.small)); | |
| 19777 | 19777 | |
| 19778 | 19778 | const src = block.nodeOffset(extra.node); |
| 19779 | 19779 | |
| ... | ... | @@ -20090,7 +20090,7 @@ fn zirReifyStruct( |
| 20090 | 20090 | const io = comp.io; |
| 20091 | 20091 | const ip = &zcu.intern_pool; |
| 20092 | 20092 | |
| 20093 | const name_strategy: Zir.Inst.NameStrategy = @enumFromInt(extended.small); | |
| 20093 | const name_strategy: Zir.Inst.NameStrategy = @fromBackingInt(@intCast(extended.small)); | |
| 20094 | 20094 | const extra = sema.code.extraData(Zir.Inst.ReifyStruct, extended.operand).data; |
| 20095 | 20095 | const tracked_inst = try block.trackZir(inst); |
| 20096 | 20096 | |
| ... | ... | @@ -20371,7 +20371,7 @@ fn zirReifyUnion( |
| 20371 | 20371 | const io = comp.io; |
| 20372 | 20372 | const ip = &zcu.intern_pool; |
| 20373 | 20373 | |
| 20374 | const name_strategy: Zir.Inst.NameStrategy = @enumFromInt(extended.small); | |
| 20374 | const name_strategy: Zir.Inst.NameStrategy = @fromBackingInt(@intCast(extended.small)); | |
| 20375 | 20375 | const extra = sema.code.extraData(Zir.Inst.ReifyUnion, extended.operand).data; |
| 20376 | 20376 | const tracked_inst = try block.trackZir(inst); |
| 20377 | 20377 | const src: LazySrcLoc = .{ |
| ... | ... | @@ -20592,7 +20592,7 @@ fn zirReifyEnum( |
| 20592 | 20592 | const io = comp.io; |
| 20593 | 20593 | const ip = &zcu.intern_pool; |
| 20594 | 20594 | |
| 20595 | const name_strategy: Zir.Inst.NameStrategy = @enumFromInt(extended.small); | |
| 20595 | const name_strategy: Zir.Inst.NameStrategy = @fromBackingInt(@intCast(extended.small)); | |
| 20596 | 20596 | const extra = sema.code.extraData(Zir.Inst.ReifyEnum, extended.operand).data; |
| 20597 | 20597 | const tracked_inst = try block.trackZir(inst); |
| 20598 | 20598 | const src: LazySrcLoc = .{ |
| ... | ... | @@ -21053,7 +21053,7 @@ fn zirCVaEnd(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstData) C |
| 21053 | 21053 | } |
| 21054 | 21054 | |
| 21055 | 21055 | fn zirCVaStart(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstData) CompileError!Air.Inst.Ref { |
| 21056 | const src_node: std.zig.Ast.Node.Offset = @enumFromInt(@as(i32, @bitCast(extended.operand))); | |
| 21056 | const src_node: std.zig.Ast.Node.Offset = @fromBackingInt(@intCast(@as(i32, @bitCast(extended.operand)))); | |
| 21057 | 21057 | const src = block.nodeOffset(src_node); |
| 21058 | 21058 | |
| 21059 | 21059 | const va_list_ty = try sema.getStdLangType(src, .VaList); |
| ... | ... | @@ -21072,7 +21072,7 @@ fn zirTypeName(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 21072 | 21072 | const io = comp.io; |
| 21073 | 21073 | const ip = &zcu.intern_pool; |
| 21074 | 21074 | |
| 21075 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].un_node; | |
| 21075 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].un_node; | |
| 21076 | 21076 | const ty_src = block.builtinCallArgSrc(inst_data.src_node, 0); |
| 21077 | 21077 | const ty = try sema.resolveType(block, ty_src, inst_data.operand); |
| 21078 | 21078 | |
| ... | ... | @@ -21081,7 +21081,7 @@ fn zirTypeName(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 21081 | 21081 | } |
| 21082 | 21082 | |
| 21083 | 21083 | fn zirFrameType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 21084 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].un_node; | |
| 21084 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].un_node; | |
| 21085 | 21085 | const src = block.nodeOffset(inst_data.src_node); |
| 21086 | 21086 | return sema.failWithUseOfAsync(block, src); |
| 21087 | 21087 | } |
| ... | ... | @@ -21089,7 +21089,7 @@ fn zirFrameType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A |
| 21089 | 21089 | fn zirIntFromFloat(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 21090 | 21090 | const pt = sema.pt; |
| 21091 | 21091 | const zcu = pt.zcu; |
| 21092 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 21092 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 21093 | 21093 | const src = block.nodeOffset(inst_data.src_node); |
| 21094 | 21094 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; |
| 21095 | 21095 | const operand_src = block.builtinCallArgSrc(inst_data.src_node, 0); |
| ... | ... | @@ -21152,7 +21152,7 @@ fn zirRoundCast( |
| 21152 | 21152 | |
| 21153 | 21153 | const operand = sema.resolveInst(extra.rhs); |
| 21154 | 21154 | |
| 21155 | const round_op: Zir.Inst.RoundOp = @enumFromInt(extended.small); | |
| 21155 | const round_op: Zir.Inst.RoundOp = @fromBackingInt(@intCast(extended.small)); | |
| 21156 | 21156 | const mode: IntFromFloatMode = switch (round_op) { |
| 21157 | 21157 | .round => .round, |
| 21158 | 21158 | .floor => .floor, |
| ... | ... | @@ -21266,7 +21266,7 @@ fn zirRoundCast( |
| 21266 | 21266 | fn zirFloatFromInt(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 21267 | 21267 | const pt = sema.pt; |
| 21268 | 21268 | const zcu = pt.zcu; |
| 21269 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 21269 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 21270 | 21270 | const src = block.nodeOffset(inst_data.src_node); |
| 21271 | 21271 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; |
| 21272 | 21272 | const operand_src = block.builtinCallArgSrc(inst_data.src_node, 0); |
| ... | ... | @@ -21308,7 +21308,7 @@ fn zirFloatFromInt(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileErro |
| 21308 | 21308 | fn zirPtrFromInt(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 21309 | 21309 | const pt = sema.pt; |
| 21310 | 21310 | const zcu = pt.zcu; |
| 21311 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 21311 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 21312 | 21312 | const src = block.nodeOffset(inst_data.src_node); |
| 21313 | 21313 | |
| 21314 | 21314 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; |
| ... | ... | @@ -21635,7 +21635,7 @@ fn zirPtrCastFull(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstDa |
| 21635 | 21635 | } |
| 21636 | 21636 | |
| 21637 | 21637 | fn zirPtrCast(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 21638 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 21638 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 21639 | 21639 | const src = block.nodeOffset(inst_data.src_node); |
| 21640 | 21640 | const operand_src = block.builtinCallArgSrc(inst_data.src_node, 0); |
| 21641 | 21641 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; |
| ... | ... | @@ -22336,7 +22336,7 @@ fn zirPtrCastNoDest(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.Inst |
| 22336 | 22336 | fn zirTruncate(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 22337 | 22337 | const pt = sema.pt; |
| 22338 | 22338 | const zcu = pt.zcu; |
| 22339 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 22339 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 22340 | 22340 | const src = block.nodeOffset(inst_data.src_node); |
| 22341 | 22341 | const operand_src = block.builtinCallArgSrc(inst_data.src_node, 0); |
| 22342 | 22342 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; |
| ... | ... | @@ -22391,7 +22391,7 @@ fn zirBitCount( |
| 22391 | 22391 | ) CompileError!Air.Inst.Ref { |
| 22392 | 22392 | const pt = sema.pt; |
| 22393 | 22393 | const zcu = pt.zcu; |
| 22394 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].un_node; | |
| 22394 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].un_node; | |
| 22395 | 22395 | const src = block.nodeOffset(inst_data.src_node); |
| 22396 | 22396 | const operand_src = block.builtinCallArgSrc(inst_data.src_node, 0); |
| 22397 | 22397 | const operand = sema.resolveInst(inst_data.operand); |
| ... | ... | @@ -22439,7 +22439,7 @@ fn zirBitCount( |
| 22439 | 22439 | fn zirByteSwap(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 22440 | 22440 | const pt = sema.pt; |
| 22441 | 22441 | const zcu = pt.zcu; |
| 22442 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].un_node; | |
| 22442 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].un_node; | |
| 22443 | 22443 | const operand_src = block.builtinCallArgSrc(inst_data.src_node, 0); |
| 22444 | 22444 | const operand = sema.resolveInst(inst_data.operand); |
| 22445 | 22445 | const operand_ty = sema.typeOf(operand); |
| ... | ... | @@ -22460,7 +22460,7 @@ fn zirByteSwap(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 22460 | 22460 | } |
| 22461 | 22461 | |
| 22462 | 22462 | fn zirBitReverse(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 22463 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].un_node; | |
| 22463 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].un_node; | |
| 22464 | 22464 | const operand_src = block.builtinCallArgSrc(inst_data.src_node, 0); |
| 22465 | 22465 | const operand = sema.resolveInst(inst_data.operand); |
| 22466 | 22466 | const operand_ty = sema.typeOf(operand); |
| ... | ... | @@ -22484,7 +22484,7 @@ fn zirOffsetOf(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 22484 | 22484 | } |
| 22485 | 22485 | |
| 22486 | 22486 | fn bitOffsetOf(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!u64 { |
| 22487 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 22487 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 22488 | 22488 | const src = block.src(.{ .node_offset_bin_op = inst_data.src_node }); |
| 22489 | 22489 | const ty_src = block.builtinCallArgSrc(inst_data.src_node, 0); |
| 22490 | 22490 | const field_name_src = block.builtinCallArgSrc(inst_data.src_node, 1); |
| ... | ... | @@ -23099,13 +23099,13 @@ fn zirCmpxchg( |
| 23099 | 23099 | const success_order = try sema.resolveAtomicOrder(block, success_order_src, extra.success_order, .{ .simple = .atomic_order }); |
| 23100 | 23100 | const failure_order = try sema.resolveAtomicOrder(block, failure_order_src, extra.failure_order, .{ .simple = .atomic_order }); |
| 23101 | 23101 | |
| 23102 | if (@intFromEnum(success_order) < @intFromEnum(std.lang.AtomicOrder.monotonic)) { | |
| 23102 | if (@backingInt(success_order) < @backingInt(std.lang.AtomicOrder.monotonic)) { | |
| 23103 | 23103 | return sema.fail(block, success_order_src, "success atomic ordering must be monotonic or stricter", .{}); |
| 23104 | 23104 | } |
| 23105 | if (@intFromEnum(failure_order) < @intFromEnum(std.lang.AtomicOrder.monotonic)) { | |
| 23105 | if (@backingInt(failure_order) < @backingInt(std.lang.AtomicOrder.monotonic)) { | |
| 23106 | 23106 | return sema.fail(block, failure_order_src, "failure atomic ordering must be monotonic or stricter", .{}); |
| 23107 | 23107 | } |
| 23108 | if (@intFromEnum(failure_order) > @intFromEnum(success_order)) { | |
| 23108 | if (@backingInt(failure_order) > @backingInt(success_order)) { | |
| 23109 | 23109 | return sema.fail(block, failure_order_src, "failure atomic ordering must be no stricter than success", .{}); |
| 23110 | 23110 | } |
| 23111 | 23111 | if (failure_order == .release or failure_order == .acq_rel) { |
| ... | ... | @@ -23141,8 +23141,8 @@ fn zirCmpxchg( |
| 23141 | 23141 | } else break :rs expected_src; |
| 23142 | 23142 | } else ptr_src; |
| 23143 | 23143 | |
| 23144 | const flags: u32 = @as(u32, @intFromEnum(success_order)) | | |
| 23145 | (@as(u32, @intFromEnum(failure_order)) << 3); | |
| 23144 | const flags: u32 = @as(u32, @backingInt(success_order)) | | |
| 23145 | (@as(u32, @backingInt(failure_order)) << 3); | |
| 23146 | 23146 | |
| 23147 | 23147 | try sema.requireRuntimeBlock(block, src, runtime_src); |
| 23148 | 23148 | return block.addInst(.{ |
| ... | ... | @@ -23162,7 +23162,7 @@ fn zirCmpxchg( |
| 23162 | 23162 | fn zirSplat(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 23163 | 23163 | const pt = sema.pt; |
| 23164 | 23164 | const zcu = pt.zcu; |
| 23165 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 23165 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 23166 | 23166 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; |
| 23167 | 23167 | const src = block.nodeOffset(inst_data.src_node); |
| 23168 | 23168 | const scalar_src = block.builtinCallArgSrc(inst_data.src_node, 0); |
| ... | ... | @@ -23214,7 +23214,7 @@ fn zirSplat(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.I |
| 23214 | 23214 | } |
| 23215 | 23215 | |
| 23216 | 23216 | fn zirReduce(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 23217 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 23217 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 23218 | 23218 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; |
| 23219 | 23219 | const op_src = block.builtinCallArgSrc(inst_data.src_node, 0); |
| 23220 | 23220 | const operand_src = block.builtinCallArgSrc(inst_data.src_node, 1); |
| ... | ... | @@ -23282,7 +23282,7 @@ fn zirReduce(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air. |
| 23282 | 23282 | fn zirShuffle(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 23283 | 23283 | const pt = sema.pt; |
| 23284 | 23284 | const zcu = pt.zcu; |
| 23285 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 23285 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 23286 | 23286 | const extra = sema.code.extraData(Zir.Inst.Shuffle, inst_data.payload_index).data; |
| 23287 | 23287 | const elem_ty_src = block.builtinCallArgSrc(inst_data.src_node, 0); |
| 23288 | 23288 | const mask_src = block.builtinCallArgSrc(inst_data.src_node, 3); |
| ... | ... | @@ -23564,7 +23564,7 @@ fn zirSelect(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstData) C |
| 23564 | 23564 | } |
| 23565 | 23565 | |
| 23566 | 23566 | fn zirAtomicLoad(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 23567 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 23567 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 23568 | 23568 | const extra = sema.code.extraData(Zir.Inst.AtomicLoad, inst_data.payload_index).data; |
| 23569 | 23569 | // zig fmt: off |
| 23570 | 23570 | const elem_ty_src = block.builtinCallArgSrc(inst_data.src_node, 0); |
| ... | ... | @@ -23611,7 +23611,7 @@ fn zirAtomicLoad(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError! |
| 23611 | 23611 | fn zirAtomicRmw(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 23612 | 23612 | const pt = sema.pt; |
| 23613 | 23613 | const zcu = pt.zcu; |
| 23614 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 23614 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 23615 | 23615 | const extra = sema.code.extraData(Zir.Inst.AtomicRmw, inst_data.payload_index).data; |
| 23616 | 23616 | const src = block.nodeOffset(inst_data.src_node); |
| 23617 | 23617 | // zig fmt: off |
| ... | ... | @@ -23676,7 +23676,7 @@ fn zirAtomicRmw(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A |
| 23676 | 23676 | } else break :rs ptr_src; |
| 23677 | 23677 | } else ptr_src; |
| 23678 | 23678 | |
| 23679 | const flags: u32 = @as(u32, @intFromEnum(order)) | (@as(u32, @intFromEnum(op)) << 3); | |
| 23679 | const flags: u32 = @as(u32, @backingInt(order)) | (@as(u32, @backingInt(op)) << 3); | |
| 23680 | 23680 | |
| 23681 | 23681 | try sema.requireRuntimeBlock(block, src, runtime_src); |
| 23682 | 23682 | return block.addInst(.{ |
| ... | ... | @@ -23692,7 +23692,7 @@ fn zirAtomicRmw(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A |
| 23692 | 23692 | } |
| 23693 | 23693 | |
| 23694 | 23694 | fn zirAtomicStore(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void { |
| 23695 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 23695 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 23696 | 23696 | const extra = sema.code.extraData(Zir.Inst.AtomicStore, inst_data.payload_index).data; |
| 23697 | 23697 | const src = block.nodeOffset(inst_data.src_node); |
| 23698 | 23698 | // zig fmt: off |
| ... | ... | @@ -23726,7 +23726,7 @@ fn zirAtomicStore(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError |
| 23726 | 23726 | } |
| 23727 | 23727 | |
| 23728 | 23728 | fn zirMulAdd(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 23729 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 23729 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 23730 | 23730 | const extra = sema.code.extraData(Zir.Inst.MulAdd, inst_data.payload_index).data; |
| 23731 | 23731 | const src = block.nodeOffset(inst_data.src_node); |
| 23732 | 23732 | |
| ... | ... | @@ -23793,7 +23793,7 @@ fn zirMulAdd(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air. |
| 23793 | 23793 | fn zirBuiltinCall(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 23794 | 23794 | const pt = sema.pt; |
| 23795 | 23795 | const zcu = pt.zcu; |
| 23796 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 23796 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 23797 | 23797 | const modifier_src = block.builtinCallArgSrc(inst_data.src_node, 0); |
| 23798 | 23798 | const func_src = block.builtinCallArgSrc(inst_data.src_node, 1); |
| 23799 | 23799 | const args_src = block.builtinCallArgSrc(inst_data.src_node, 2); |
| ... | ... | @@ -24081,7 +24081,7 @@ fn zirMinMax( |
| 24081 | 24081 | inst: Zir.Inst.Index, |
| 24082 | 24082 | comptime air_tag: Air.Inst.Tag, |
| 24083 | 24083 | ) CompileError!Air.Inst.Ref { |
| 24084 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 24084 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 24085 | 24085 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; |
| 24086 | 24086 | const src = block.nodeOffset(inst_data.src_node); |
| 24087 | 24087 | const lhs_src = block.builtinCallArgSrc(inst_data.src_node, 0); |
| ... | ... | @@ -24262,10 +24262,10 @@ fn analyzeMinMax( |
| 24262 | 24262 | }, |
| 24263 | 24263 | else => unreachable, |
| 24264 | 24264 | }; |
| 24265 | if (@intFromEnum(want_strat) < @intFromEnum(cur_strat)) { | |
| 24265 | if (@backingInt(want_strat) < @backingInt(cur_strat)) { | |
| 24266 | 24266 | // `want_strat` overrides `cur_strat`. |
| 24267 | 24267 | cur_strat = want_strat; |
| 24268 | } else if (@intFromEnum(want_strat) == @intFromEnum(cur_strat)) { | |
| 24268 | } else if (@backingInt(want_strat) == @backingInt(cur_strat)) { | |
| 24269 | 24269 | // The behavior depends on the tag. |
| 24270 | 24270 | switch (cur_strat) { |
| 24271 | 24271 | .none, .comptime_float => {}, // no payload, so nop |
| ... | ... | @@ -24470,7 +24470,7 @@ fn zirMemcpy( |
| 24470 | 24470 | air_tag: Air.Inst.Tag, |
| 24471 | 24471 | check_aliasing: bool, |
| 24472 | 24472 | ) CompileError!void { |
| 24473 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 24473 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 24474 | 24474 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; |
| 24475 | 24475 | const src = block.nodeOffset(inst_data.src_node); |
| 24476 | 24476 | const dest_src = block.builtinCallArgSrc(inst_data.src_node, 0); |
| ... | ... | @@ -24734,7 +24734,7 @@ fn zirMemset(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void |
| 24734 | 24734 | const io = comp.io; |
| 24735 | 24735 | const ip = &zcu.intern_pool; |
| 24736 | 24736 | |
| 24737 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 24737 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 24738 | 24738 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; |
| 24739 | 24739 | const src = block.nodeOffset(inst_data.src_node); |
| 24740 | 24740 | const dest_src = block.builtinCallArgSrc(inst_data.src_node, 0); |
| ... | ... | @@ -24830,7 +24830,7 @@ fn zirMemset(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void |
| 24830 | 24830 | } |
| 24831 | 24831 | |
| 24832 | 24832 | fn zirResume(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 24833 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].un_node; | |
| 24833 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].un_node; | |
| 24834 | 24834 | const src = block.nodeOffset(inst_data.src_node); |
| 24835 | 24835 | return sema.failWithUseOfAsync(block, src); |
| 24836 | 24836 | } |
| ... | ... | @@ -24843,7 +24843,7 @@ fn zirFuncFancy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A |
| 24843 | 24843 | const io = comp.io; |
| 24844 | 24844 | const ip = &zcu.intern_pool; |
| 24845 | 24845 | |
| 24846 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 24846 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 24847 | 24847 | const extra = sema.code.extraData(Zir.Inst.FuncFancy, inst_data.payload_index); |
| 24848 | 24848 | const target = zcu.getTarget(); |
| 24849 | 24849 | |
| ... | ... | @@ -24863,7 +24863,7 @@ fn zirFuncFancy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A |
| 24863 | 24863 | const val = try sema.resolveGenericBody(block, cc_src, body, inst, cc_ty, .{ .simple = .@"callconv" }); |
| 24864 | 24864 | break :blk try sema.analyzeValueAsCallconv(block, cc_src, val); |
| 24865 | 24865 | } else if (extra.data.bits.has_cc_ref) blk: { |
| 24866 | const cc_ref: Zir.Inst.Ref = @enumFromInt(sema.code.extra[extra_index]); | |
| 24866 | const cc_ref: Zir.Inst.Ref = @fromBackingInt(@intCast(sema.code.extra[extra_index])); | |
| 24867 | 24867 | extra_index += 1; |
| 24868 | 24868 | const cc_ty = try sema.getStdLangType(cc_src, .CallingConvention); |
| 24869 | 24869 | const uncoerced_cc = sema.resolveInst(cc_ref); |
| ... | ... | @@ -24907,7 +24907,7 @@ fn zirFuncFancy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A |
| 24907 | 24907 | const ty = val.toType(); |
| 24908 | 24908 | break :blk ty; |
| 24909 | 24909 | } else if (extra.data.bits.has_ret_ty_ref) blk: { |
| 24910 | const ret_ty_ref: Zir.Inst.Ref = @enumFromInt(sema.code.extra[extra_index]); | |
| 24910 | const ret_ty_ref: Zir.Inst.Ref = @fromBackingInt(@intCast(sema.code.extra[extra_index])); | |
| 24911 | 24911 | extra_index += 1; |
| 24912 | 24912 | if (extra.data.bits.ret_ty_is_generic) break :blk .generic_poison; |
| 24913 | 24913 | |
| ... | ... | @@ -25330,9 +25330,9 @@ fn zirStdLangValue(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstD |
| 25330 | 25330 | const io = comp.io; |
| 25331 | 25331 | const ip = &zcu.intern_pool; |
| 25332 | 25332 | |
| 25333 | const src_node: std.zig.Ast.Node.Offset = @enumFromInt(@as(i32, @bitCast(extended.operand))); | |
| 25333 | const src_node: std.zig.Ast.Node.Offset = @fromBackingInt(@intCast(@as(i32, @bitCast(extended.operand)))); | |
| 25334 | 25334 | const src = block.nodeOffset(src_node); |
| 25335 | const value: Zir.Inst.StdLangValue = @enumFromInt(extended.small); | |
| 25335 | const value: Zir.Inst.StdLangValue = @fromBackingInt(@intCast(extended.small)); | |
| 25336 | 25336 | |
| 25337 | 25337 | const std_lang_type: Zcu.StdLangDecl = switch (value) { |
| 25338 | 25338 | // zig fmt: off |
| ... | ... | @@ -25387,10 +25387,10 @@ fn zirInplaceArithResultTy(sema: *Sema, extended: Zir.Inst.Extended.InstData) Co |
| 25387 | 25387 | const pt = sema.pt; |
| 25388 | 25388 | const zcu = pt.zcu; |
| 25389 | 25389 | |
| 25390 | const lhs = sema.resolveInst(@enumFromInt(extended.operand)); | |
| 25390 | const lhs = sema.resolveInst(@fromBackingInt(@intCast(extended.operand))); | |
| 25391 | 25391 | const lhs_ty = sema.typeOf(lhs); |
| 25392 | 25392 | |
| 25393 | const op: Zir.Inst.InplaceOp = @enumFromInt(extended.small); | |
| 25393 | const op: Zir.Inst.InplaceOp = @fromBackingInt(@intCast(extended.small)); | |
| 25394 | 25394 | const ty: Type = switch (op) { |
| 25395 | 25395 | .add_eq => ty: { |
| 25396 | 25396 | const ptr_size = lhs_ty.ptrSizeOrNull(zcu) orelse break :ty lhs_ty; |
| ... | ... | @@ -25840,9 +25840,9 @@ fn addSafetyCheckExtra( |
| 25840 | 25840 | fail_block.instructions.items.len); |
| 25841 | 25841 | |
| 25842 | 25842 | try sema.air_instructions.ensureUnusedCapacity(gpa, 3); |
| 25843 | const block_inst: Air.Inst.Index = @enumFromInt(sema.air_instructions.len); | |
| 25844 | const cond_br_inst: Air.Inst.Index = @enumFromInt(@intFromEnum(block_inst) + 1); | |
| 25845 | const br_inst: Air.Inst.Index = @enumFromInt(@intFromEnum(cond_br_inst) + 1); | |
| 25843 | const block_inst: Air.Inst.Index = @fromBackingInt(@intCast(sema.air_instructions.len)); | |
| 25844 | const cond_br_inst: Air.Inst.Index = @fromBackingInt(@intCast(@backingInt(block_inst) + 1)); | |
| 25845 | const br_inst: Air.Inst.Index = @fromBackingInt(@intCast(@backingInt(cond_br_inst) + 1)); | |
| 25846 | 25846 | sema.air_instructions.appendAssumeCapacity(.{ |
| 25847 | 25847 | .tag = .block, |
| 25848 | 25848 | .data = .{ .ty_pl = .{ |
| ... | ... | @@ -25852,7 +25852,7 @@ fn addSafetyCheckExtra( |
| 25852 | 25852 | }), |
| 25853 | 25853 | } }, |
| 25854 | 25854 | }); |
| 25855 | sema.air_extra.appendAssumeCapacity(@intFromEnum(cond_br_inst)); | |
| 25855 | sema.air_extra.appendAssumeCapacity(@backingInt(cond_br_inst)); | |
| 25856 | 25856 | |
| 25857 | 25857 | sema.air_instructions.appendAssumeCapacity(.{ |
| 25858 | 25858 | .tag = .cond_br, |
| ... | ... | @@ -25874,7 +25874,7 @@ fn addSafetyCheckExtra( |
| 25874 | 25874 | }, |
| 25875 | 25875 | }, |
| 25876 | 25876 | }); |
| 25877 | sema.air_extra.appendAssumeCapacity(@intFromEnum(br_inst)); | |
| 25877 | sema.air_extra.appendAssumeCapacity(@backingInt(br_inst)); | |
| 25878 | 25878 | sema.air_extra.appendSliceAssumeCapacity(@ptrCast(fail_block.instructions.items)); |
| 25879 | 25879 | |
| 25880 | 25880 | sema.air_instructions.appendAssumeCapacity(.{ |
| ... | ... | @@ -26313,8 +26313,8 @@ fn analyzeSpirvRuntimeArrayLen( |
| 26313 | 26313 | |
| 26314 | 26314 | const struct_operand: Air.Inst.Ref, const field_index: u32 = sf: { |
| 26315 | 26315 | if (runtime_array_ptr.toIndex()) |inst| { |
| 26316 | const tag = sema.air_instructions.items(.tag)[@intFromEnum(inst)]; | |
| 26317 | const data = sema.air_instructions.items(.data)[@intFromEnum(inst)]; | |
| 26316 | const tag = sema.air_instructions.items(.tag)[@backingInt(inst)]; | |
| 26317 | const data = sema.air_instructions.items(.data)[@backingInt(inst)]; | |
| 26318 | 26318 | switch (tag) { |
| 26319 | 26319 | .struct_field_ptr => { |
| 26320 | 26320 | const extra = sema.getTmpAir().extraData(Air.StructField, data.ty_pl.payload).data; |
| ... | ... | @@ -27592,7 +27592,7 @@ fn elemPtrVector( |
| 27592 | 27592 | .is_volatile = vector_ptr_info.flags.is_volatile, |
| 27593 | 27593 | .is_allowzero = vector_ptr_info.flags.is_allowzero, |
| 27594 | 27594 | .address_space = vector_ptr_info.flags.address_space, |
| 27595 | .vector_index = @enumFromInt(index), | |
| 27595 | .vector_index = @fromBackingInt(@intCast(index)), | |
| 27596 | 27596 | }, |
| 27597 | 27597 | .packed_offset = .{ |
| 27598 | 27598 | .host_size = @intCast(vector_len), |
| ... | ... | @@ -29754,7 +29754,7 @@ fn storePtr2( |
| 29754 | 29754 | /// Handles calling `validateRuntimeValue` if the store is runtime for any reason. |
| 29755 | 29755 | fn checkComptimeKnownStore(sema: *Sema, block: *Block, store_inst_ref: Air.Inst.Ref, store_src: LazySrcLoc) !void { |
| 29756 | 29756 | const store_inst = store_inst_ref.toIndex().?; |
| 29757 | const inst_data = sema.air_instructions.items(.data)[@intFromEnum(store_inst)].bin_op; | |
| 29757 | const inst_data = sema.air_instructions.items(.data)[@backingInt(store_inst)].bin_op; | |
| 29758 | 29758 | const ptr = inst_data.lhs.toIndex() orelse return; |
| 29759 | 29759 | const operand = inst_data.rhs; |
| 29760 | 29760 | |
| ... | ... | @@ -29788,7 +29788,7 @@ fn checkKnownAllocPtr(sema: *Sema, block: *Block, base_ptr: Air.Inst.Ref, new_pt |
| 29788 | 29788 | const alloc_inst = sema.base_allocs.get(base_ptr_inst) orelse return; |
| 29789 | 29789 | try sema.base_allocs.put(sema.gpa, new_ptr_inst, alloc_inst); |
| 29790 | 29790 | |
| 29791 | switch (sema.air_instructions.items(.tag)[@intFromEnum(new_ptr_inst)]) { | |
| 29791 | switch (sema.air_instructions.items(.tag)[@backingInt(new_ptr_inst)]) { | |
| 29792 | 29792 | .optional_payload_ptr_set, .errunion_payload_ptr_set => { |
| 29793 | 29793 | const maybe_comptime_alloc = sema.maybe_comptime_allocs.getPtr(alloc_inst) orelse return; |
| 29794 | 29794 | |
| ... | ... | @@ -29805,7 +29805,7 @@ fn checkKnownAllocPtr(sema: *Sema, block: *Block, base_ptr: Air.Inst.Ref, new_pt |
| 29805 | 29805 | }, |
| 29806 | 29806 | .ptr_elem_ptr => { |
| 29807 | 29807 | const tmp_air = sema.getTmpAir(); |
| 29808 | const pl_idx = tmp_air.instructions.items(.data)[@intFromEnum(new_ptr_inst)].ty_pl.payload; | |
| 29808 | const pl_idx = tmp_air.instructions.items(.data)[@backingInt(new_ptr_inst)].ty_pl.payload; | |
| 29809 | 29809 | const bin = tmp_air.extraData(Air.Bin, pl_idx).data; |
| 29810 | 29810 | const index_ref = bin.rhs; |
| 29811 | 29811 | |
| ... | ... | @@ -29826,12 +29826,12 @@ fn markMaybeComptimeAllocRuntime(sema: *Sema, block: *Block, alloc_inst: Air.Ins |
| 29826 | 29826 | const slice = maybe_comptime_alloc.stores.slice(); |
| 29827 | 29827 | for (slice.items(.inst), slice.items(.src)) |other_inst, other_src| { |
| 29828 | 29828 | if (other_src.offset == .unneeded) { |
| 29829 | switch (sema.air_instructions.items(.tag)[@intFromEnum(other_inst)]) { | |
| 29829 | switch (sema.air_instructions.items(.tag)[@backingInt(other_inst)]) { | |
| 29830 | 29830 | .set_union_tag, .optional_payload_ptr_set, .errunion_payload_ptr_set => continue, |
| 29831 | 29831 | else => unreachable, // assertion failure |
| 29832 | 29832 | } |
| 29833 | 29833 | } |
| 29834 | const other_data = sema.air_instructions.items(.data)[@intFromEnum(other_inst)].bin_op; | |
| 29834 | const other_data = sema.air_instructions.items(.data)[@backingInt(other_inst)].bin_op; | |
| 29835 | 29835 | const other_operand = other_data.rhs; |
| 29836 | 29836 | try sema.validateRuntimeValue(block, other_src, other_operand); |
| 29837 | 29837 | } |
| ... | ... | @@ -32174,7 +32174,7 @@ const PeerResolveStrategy = enum { |
| 32174 | 32174 | // Our merging should be order-independent. Thus, even though the union order is arbitrary, |
| 32175 | 32175 | // by sorting the tags and switching first on the smaller, we have half as many cases to |
| 32176 | 32176 | // worry about (since we avoid the duplicates). |
| 32177 | const s0_is_a = @intFromEnum(a) <= @intFromEnum(b); | |
| 32177 | const s0_is_a = @backingInt(a) <= @backingInt(b); | |
| 32178 | 32178 | const s0 = if (s0_is_a) a else b; |
| 32179 | 32179 | const s1 = if (s0_is_a) b else a; |
| 32180 | 32180 | |
| ... | ... | @@ -33839,7 +33839,7 @@ fn payloadToExtraItems(data: anytype) [@typeInfo(@TypeOf(data)).@"struct".field_ |
| 33839 | 33839 | val.* = switch (field_type) { |
| 33840 | 33840 | u32 => @field(data, field_name), |
| 33841 | 33841 | i32, Air.CondBr.BranchHints, Air.Asm.Flags => @bitCast(@field(data, field_name)), |
| 33842 | Air.Inst.Ref, InternPool.Index => @intFromEnum(@field(data, field_name)), | |
| 33842 | Air.Inst.Ref, InternPool.Index => @backingInt(@field(data, field_name)), | |
| 33843 | 33843 | else => @compileError("bad field type: " ++ @typeName(field_type)), |
| 33844 | 33844 | }; |
| 33845 | 33845 | } |
| ... | ... | @@ -33853,8 +33853,8 @@ fn appendRefsAssumeCapacity(sema: *Sema, refs: []const Air.Inst.Ref) void { |
| 33853 | 33853 | fn getBreakBlock(sema: *Sema, inst_index: Air.Inst.Index) ?Air.Inst.Index { |
| 33854 | 33854 | const air_datas = sema.air_instructions.items(.data); |
| 33855 | 33855 | const air_tags = sema.air_instructions.items(.tag); |
| 33856 | switch (air_tags[@intFromEnum(inst_index)]) { | |
| 33857 | .br => return air_datas[@intFromEnum(inst_index)].br.block_inst, | |
| 33856 | switch (air_tags[@backingInt(inst_index)]) { | |
| 33857 | .br => return air_datas[@backingInt(inst_index)].br.block_inst, | |
| 33858 | 33858 | else => return null, |
| 33859 | 33859 | } |
| 33860 | 33860 | } |
| ... | ... | @@ -34596,7 +34596,7 @@ pub fn flushExports(sema: *Sema) !void { |
| 34596 | 34596 | try zcu.single_exports.ensureUnusedCapacity(gpa, 1); |
| 34597 | 34597 | const export_idx: Zcu.Export.Index = zcu.free_exports.pop() orelse idx: { |
| 34598 | 34598 | _ = try zcu.all_exports.addOne(gpa); |
| 34599 | break :idx @enumFromInt(zcu.all_exports.items.len - 1); | |
| 34599 | break :idx @fromBackingInt(@intCast(zcu.all_exports.items.len - 1)); | |
| 34600 | 34600 | }; |
| 34601 | 34601 | export_idx.ptr(zcu).* = sema.exports.items[0]; |
| 34602 | 34602 | zcu.single_exports.putAssumeCapacityNoClobber(sema.owner, export_idx); |
| ... | ... | @@ -34920,7 +34920,7 @@ pub fn setTypeName( |
| 34920 | 34920 | io, |
| 34921 | 34921 | pt.tid, |
| 34922 | 34922 | "{f}__{s}_{d}", |
| 34923 | .{ block.type_name_ctx.fmt(ip), anon_prefix, @intFromEnum(wip.index) }, | |
| 34923 | .{ block.type_name_ctx.fmt(ip), anon_prefix, @backingInt(wip.index) }, | |
| 34924 | 34924 | .no_embedded_nulls, |
| 34925 | 34925 | ), .none); |
| 34926 | 34926 | }, |
| ... | ... | @@ -34935,7 +34935,7 @@ pub fn setTypeName( |
| 34935 | 34935 | w.print("{f}(", .{block.type_name_ctx.fmt(ip)}) catch return error.OutOfMemory; |
| 34936 | 34936 | |
| 34937 | 34937 | var arg_i: usize = 0; |
| 34938 | for (fn_info.param_body) |zir_inst| switch (zir_tags[@intFromEnum(zir_inst)]) { | |
| 34938 | for (fn_info.param_body) |zir_inst| switch (zir_tags[@backingInt(zir_inst)]) { | |
| 34939 | 34939 | .param, .param_comptime, .param_anytype, .param_anytype_comptime => { |
| 34940 | 34940 | const arg = sema.inst_map.get(zir_inst).?; |
| 34941 | 34941 | // If this is being called in a generic function then analyzeCall will |
| ... | ... | @@ -34975,7 +34975,7 @@ pub fn setTypeName( |
| 34975 | 34975 | const ref = inst.toRef(); |
| 34976 | 34976 | const zir_tags = sema.code.instructions.items(.tag); |
| 34977 | 34977 | const zir_data = sema.code.instructions.items(.data); |
| 34978 | const var_name = for (@intFromEnum(inst)..zir_tags.len) |i| switch (zir_tags[i]) { | |
| 34978 | const var_name = for (@backingInt(inst)..zir_tags.len) |i| switch (zir_tags[i]) { | |
| 34979 | 34979 | .dbg_var_ptr, .dbg_var_val => if (zir_data[i].str_op.operand == ref) { |
| 34980 | 34980 | break zir_data[i].str_op.getStr(sema.code); |
| 34981 | 34981 | }, |
src/Sema/comptime_ptr_access.zig+5-5| ... | ... | @@ -40,7 +40,7 @@ pub fn loadComptimePtr(sema: *Sema, block: *Block, src: LazySrcLoc, ptr: Value) |
| 40 | 40 | const result_val: Value = try .readFromPackedMemory(elem_ty, pt, buf, ptr_info.packed_offset.bit_offset); |
| 41 | 41 | return .{ .success = .{ .interned = result_val.toIntern() } }; |
| 42 | 42 | } |
| 43 | if (@intFromEnum(ptr_info.flags.vector_index) >= host_size) { | |
| 43 | if (@backingInt(ptr_info.flags.vector_index) >= host_size) { | |
| 44 | 44 | return .exceeds_host_size; |
| 45 | 45 | } |
| 46 | 46 | const load_ty: Type = try pt.vectorType(.{ |
| ... | ... | @@ -52,7 +52,7 @@ pub fn loadComptimePtr(sema: *Sema, block: *Block, src: LazySrcLoc, ptr: Value) |
| 52 | 52 | .success => |mv| mv, |
| 53 | 53 | }; |
| 54 | 54 | const vector_val = try vector_mv.intern(pt, sema.arena); |
| 55 | const result_val = try vector_val.elemValue(pt, @intFromEnum(ptr_info.flags.vector_index)); | |
| 55 | const result_val = try vector_val.elemValue(pt, @backingInt(ptr_info.flags.vector_index)); | |
| 56 | 56 | return .{ .success = .{ .interned = result_val.toIntern() } }; |
| 57 | 57 | } |
| 58 | 58 | |
| ... | ... | @@ -115,7 +115,7 @@ pub fn storeComptimePtr( |
| 115 | 115 | return storeComptimePtrInner(sema, block, src, ptr, new_backing_int_val); |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | if (@intFromEnum(ptr_info.flags.vector_index) >= host_size) { | |
| 118 | if (@backingInt(ptr_info.flags.vector_index) >= host_size) { | |
| 119 | 119 | return .exceeds_host_size; |
| 120 | 120 | } |
| 121 | 121 | const vec_ty: Type = try pt.vectorType(.{ |
| ... | ... | @@ -133,7 +133,7 @@ pub fn storeComptimePtr( |
| 133 | 133 | const elem_val = try old_vector_val.elemValue(pt, elem_index); |
| 134 | 134 | elem.* = elem_val.toIntern(); |
| 135 | 135 | } |
| 136 | elems_buf[@intFromEnum(ptr_info.flags.vector_index)] = store_val.toIntern(); | |
| 136 | elems_buf[@backingInt(ptr_info.flags.vector_index)] = store_val.toIntern(); | |
| 137 | 137 | const new_vector_val = try pt.aggregateValue(vec_ty, elems_buf); |
| 138 | 138 | return storeComptimePtrInner(sema, block, src, ptr, new_vector_val); |
| 139 | 139 | } |
| ... | ... | @@ -1076,7 +1076,7 @@ fn checkComptimeVarStore( |
| 1076 | 1076 | alloc_index: ComptimeAllocIndex, |
| 1077 | 1077 | ) !void { |
| 1078 | 1078 | const runtime_index = sema.getComptimeAlloc(alloc_index).runtime_index; |
| 1079 | if (@intFromEnum(runtime_index) < @intFromEnum(block.runtime_index)) { | |
| 1079 | if (@backingInt(runtime_index) < @backingInt(block.runtime_index)) { | |
| 1080 | 1080 | if (block.runtime_cond) |cond_src| { |
| 1081 | 1081 | const msg = msg: { |
| 1082 | 1082 | const msg = try sema.errMsg(src, "store to comptime variable depends on runtime condition", .{}); |
src/Sema/type_resolution.zig+3-3| ... | ... | @@ -375,7 +375,7 @@ pub fn resolveStructLayout(sema: *Sema, struct_ty: Type) CompileError!void { |
| 375 | 375 | } |
| 376 | 376 | struct_align = struct_align.maxStrict(field_align); |
| 377 | 377 | if (struct_obj.layout == .auto) { |
| 378 | struct_obj.field_runtime_order.get(ip)[field_idx] = @enumFromInt(field_idx); | |
| 378 | struct_obj.field_runtime_order.get(ip)[field_idx] = @fromBackingInt(@intCast(field_idx)); | |
| 379 | 379 | } |
| 380 | 380 | switch (field_ty.classify(zcu)) { |
| 381 | 381 | .one_possible_value => {}, |
| ... | ... | @@ -428,8 +428,8 @@ pub fn resolveStructLayout(sema: *Sema, struct_ty: Type) CompileError!void { |
| 428 | 428 | assert(b != .unresolved); |
| 429 | 429 | if (a == .omitted) return false; |
| 430 | 430 | if (b == .omitted) return true; |
| 431 | const a_align = ctx.aligns[@intFromEnum(a)]; | |
| 432 | const b_align = ctx.aligns[@intFromEnum(b)]; | |
| 431 | const a_align = ctx.aligns[@backingInt(a)]; | |
| 432 | const b_align = ctx.aligns[@backingInt(b)]; | |
| 433 | 433 | return a_align.compare(.gt, b_align); |
| 434 | 434 | } |
| 435 | 435 | }; |
src/Type.zig+2-2| ... | ... | @@ -476,7 +476,7 @@ pub fn print(ty: Type, writer: *std.Io.Writer, pt: Zcu.PerThread, ctx: ?*Compari |
| 476 | 476 | }); |
| 477 | 477 | } |
| 478 | 478 | if (info.flags.vector_index != .none) { |
| 479 | try writer.print(":{d}", .{@intFromEnum(info.flags.vector_index)}); | |
| 479 | try writer.print(":{d}", .{@backingInt(info.flags.vector_index)}); | |
| 480 | 480 | } |
| 481 | 481 | try writer.writeAll(") "); |
| 482 | 482 | } |
| ... | ... | @@ -2660,7 +2660,7 @@ pub fn typeDeclSrcLine(ty: Type, zcu: *Zcu) ?u32 { |
| 2660 | 2660 | .zig => file.zir.?, |
| 2661 | 2661 | .zon => return 0, |
| 2662 | 2662 | }; |
| 2663 | const inst = zir.instructions.get(@intFromEnum(info.inst)); | |
| 2663 | const inst = zir.instructions.get(@backingInt(info.inst)); | |
| 2664 | 2664 | return switch (inst.tag) { |
| 2665 | 2665 | .struct_init, .struct_init_ref => zir.extraData(Zir.Inst.StructInit, inst.data.pl_node.payload_index).data.abs_line, |
| 2666 | 2666 | .struct_init_anon => zir.extraData(Zir.Inst.StructInitAnon, inst.data.pl_node.payload_index).data.abs_line, |
src/Value.zig+1-1| ... | ... | @@ -2373,7 +2373,7 @@ pub fn uninterpret(val: anytype, ty: Type, pt: Zcu.PerThread) error{ OutOfMemory |
| 2373 | 2373 | try pt.nullValue(ty), |
| 2374 | 2374 | |
| 2375 | 2375 | .@"enum" => switch (interpret_mode) { |
| 2376 | .direct => try pt.enumValue(ty, try uninterpret(@intFromEnum(val), ty.backingIntType(zcu), pt)), | |
| 2376 | .direct => try pt.enumValue(ty, try uninterpret(@backingInt(val), ty.backingIntType(zcu), pt)), | |
| 2377 | 2377 | .by_name => { |
| 2378 | 2378 | const field_name_ip = try ip.getOrPutString(zcu.gpa, io, pt.tid, @tagName(val), .no_embedded_nulls); |
| 2379 | 2379 | const field_idx = ty.enumFieldIndex(field_name_ip, zcu) orelse return error.TypeMismatch; |
src/Zcu.zig+49-49| ... | ... | @@ -402,7 +402,7 @@ pub const ImportTableAdapter = struct { |
| 402 | 402 | zcu: *const Zcu, |
| 403 | 403 | pub fn hash(ctx: ImportTableAdapter, path: Compilation.Path) u32 { |
| 404 | 404 | _ = ctx; |
| 405 | return @truncate(std.hash.Wyhash.hash(@intFromEnum(path.root), path.sub_path)); | |
| 405 | return @truncate(std.hash.Wyhash.hash(@backingInt(path.root), path.sub_path)); | |
| 406 | 406 | } |
| 407 | 407 | pub fn eql(ctx: ImportTableAdapter, a_path: Compilation.Path, b_file: File.Index, b_index: usize) bool { |
| 408 | 408 | _ = b_index; |
| ... | ... | @@ -414,7 +414,7 @@ pub const ImportTableAdapter = struct { |
| 414 | 414 | pub const EmbedTableAdapter = struct { |
| 415 | 415 | pub fn hash(ctx: EmbedTableAdapter, path: Compilation.Path) u32 { |
| 416 | 416 | _ = ctx; |
| 417 | return @truncate(std.hash.Wyhash.hash(@intFromEnum(path.root), path.sub_path)); | |
| 417 | return @truncate(std.hash.Wyhash.hash(@backingInt(path.root), path.sub_path)); | |
| 418 | 418 | } |
| 419 | 419 | pub fn eql(ctx: EmbedTableAdapter, a_path: Compilation.Path, b_file: *EmbedFile, b_index: usize) bool { |
| 420 | 420 | _ = ctx; |
| ... | ... | @@ -614,7 +614,7 @@ pub const StdLangDecl = enum { |
| 614 | 614 | .VaList => .va_list, |
| 615 | 615 | .assembly, .@"assembly.Clobbers" => .assembly, |
| 616 | 616 | else => { |
| 617 | if (@intFromEnum(decl) <= @intFromEnum(StdLangDecl.@"Type.Spirv.Image.Access")) { | |
| 617 | if (@backingInt(decl) <= @backingInt(StdLangDecl.@"Type.Spirv.Image.Access")) { | |
| 618 | 618 | return .main; |
| 619 | 619 | } else { |
| 620 | 620 | return .panic; |
| ... | ... | @@ -635,7 +635,7 @@ pub const StdLangDecl = enum { |
| 635 | 635 | const name = @tagName(tag); |
| 636 | 636 | const split = (comptime std.mem.lastIndexOfScalar(u8, name, '.')) orelse return .{ .direct = name }; |
| 637 | 637 | const parent = @field(StdLangDecl, name[0..split]); |
| 638 | comptime assert(@intFromEnum(parent) < @intFromEnum(tag)); // dependencies ordered correctly | |
| 638 | comptime assert(@backingInt(parent) < @backingInt(tag)); // dependencies ordered correctly | |
| 639 | 639 | return .{ .nested = .{ parent, name[split + 1 ..] } }; |
| 640 | 640 | }, |
| 641 | 641 | }; |
| ... | ... | @@ -757,7 +757,7 @@ pub const Export = struct { |
| 757 | 757 | _, |
| 758 | 758 | |
| 759 | 759 | pub fn ptr(i: Index, zcu: *const Zcu) *Export { |
| 760 | return &zcu.all_exports.items[@intFromEnum(i)]; | |
| 760 | return &zcu.all_exports.items[@backingInt(i)]; | |
| 761 | 761 | } |
| 762 | 762 | }; |
| 763 | 763 | }; |
| ... | ... | @@ -769,10 +769,10 @@ pub const CompileLogLine = struct { |
| 769 | 769 | pub const Index = enum(u32) { |
| 770 | 770 | _, |
| 771 | 771 | pub fn get(idx: Index, zcu: *Zcu) *CompileLogLine { |
| 772 | return &zcu.compile_log_lines.items[@intFromEnum(idx)]; | |
| 772 | return &zcu.compile_log_lines.items[@backingInt(idx)]; | |
| 773 | 773 | } |
| 774 | 774 | pub fn toOptional(idx: Index) Optional { |
| 775 | return @enumFromInt(@intFromEnum(idx)); | |
| 775 | return @fromBackingInt(@intCast(@backingInt(idx))); | |
| 776 | 776 | } |
| 777 | 777 | pub const Optional = enum(u32) { |
| 778 | 778 | none = std.math.maxInt(u32), |
| ... | ... | @@ -780,7 +780,7 @@ pub const CompileLogLine = struct { |
| 780 | 780 | pub fn unwrap(opt: Optional) ?Index { |
| 781 | 781 | return switch (opt) { |
| 782 | 782 | .none => null, |
| 783 | _ => @enumFromInt(@intFromEnum(opt)), | |
| 783 | _ => @fromBackingInt(@intCast(@backingInt(opt))), | |
| 784 | 784 | }; |
| 785 | 785 | } |
| 786 | 786 | }; |
| ... | ... | @@ -815,10 +815,10 @@ pub const InlineReferenceFrame = struct { |
| 815 | 815 | pub const Index = enum(u32) { |
| 816 | 816 | _, |
| 817 | 817 | pub fn ptr(idx: Index, zcu: *Zcu) *InlineReferenceFrame { |
| 818 | return &zcu.inline_reference_frames.items[@intFromEnum(idx)]; | |
| 818 | return &zcu.inline_reference_frames.items[@backingInt(idx)]; | |
| 819 | 819 | } |
| 820 | 820 | pub fn toOptional(idx: Index) Optional { |
| 821 | return @enumFromInt(@intFromEnum(idx)); | |
| 821 | return @fromBackingInt(@intCast(@backingInt(idx))); | |
| 822 | 822 | } |
| 823 | 823 | pub const Optional = enum(u32) { |
| 824 | 824 | none = std.math.maxInt(u32), |
| ... | ... | @@ -826,7 +826,7 @@ pub const InlineReferenceFrame = struct { |
| 826 | 826 | pub fn unwrap(opt: Optional) ?Index { |
| 827 | 827 | return switch (opt) { |
| 828 | 828 | .none => null, |
| 829 | _ => @enumFromInt(@intFromEnum(opt)), | |
| 829 | _ => @fromBackingInt(@intCast(@backingInt(opt))), | |
| 830 | 830 | }; |
| 831 | 831 | } |
| 832 | 832 | }; |
| ... | ... | @@ -869,7 +869,7 @@ pub const Namespace = struct { |
| 869 | 869 | |
| 870 | 870 | pub fn hash(ctx: NavNameContext, nav: InternPool.Nav.Index) u32 { |
| 871 | 871 | const name = ctx.zcu.intern_pool.getNav(nav).name; |
| 872 | return std.hash.int(@intFromEnum(name)); | |
| 872 | return std.hash.int(@backingInt(name)); | |
| 873 | 873 | } |
| 874 | 874 | |
| 875 | 875 | pub fn eql(ctx: NavNameContext, a_nav: InternPool.Nav.Index, b_nav: InternPool.Nav.Index, b_index: usize) bool { |
| ... | ... | @@ -885,7 +885,7 @@ pub const Namespace = struct { |
| 885 | 885 | |
| 886 | 886 | pub fn hash(ctx: NameAdapter, s: InternPool.NullTerminatedString) u32 { |
| 887 | 887 | _ = ctx; |
| 888 | return std.hash.int(@intFromEnum(s)); | |
| 888 | return std.hash.int(@backingInt(s)); | |
| 889 | 889 | } |
| 890 | 890 | |
| 891 | 891 | pub fn eql(ctx: NameAdapter, a: InternPool.NullTerminatedString, b_nav: InternPool.Nav.Index, b_index: usize) bool { |
| ... | ... | @@ -1235,7 +1235,7 @@ pub const EmbedFile = struct { |
| 1235 | 1235 | pub const Index = enum(u32) { |
| 1236 | 1236 | _, |
| 1237 | 1237 | pub fn get(idx: Index, zcu: *const Zcu) *EmbedFile { |
| 1238 | return zcu.embed_table.keys()[@intFromEnum(idx)]; | |
| 1238 | return zcu.embed_table.keys()[@backingInt(idx)]; | |
| 1239 | 1239 | } |
| 1240 | 1240 | }; |
| 1241 | 1241 | }; |
| ... | ... | @@ -1625,7 +1625,7 @@ pub const SrcLoc = struct { |
| 1625 | 1625 | // that contains this input. |
| 1626 | 1626 | const node_tags = tree.nodes.items(.tag); |
| 1627 | 1627 | for (node_tags, 0..) |node_tag, node_usize| { |
| 1628 | const node: Ast.Node.Index = @enumFromInt(node_usize); | |
| 1628 | const node: Ast.Node.Index = @fromBackingInt(@intCast(node_usize)); | |
| 1629 | 1629 | switch (node_tag) { |
| 1630 | 1630 | .for_simple, .@"for" => { |
| 1631 | 1631 | const for_full = tree.fullFor(node).?; |
| ... | ... | @@ -1665,7 +1665,7 @@ pub const SrcLoc = struct { |
| 1665 | 1665 | var buf: [2]Ast.Node.Index = undefined; |
| 1666 | 1666 | const call_full = tree.fullCall(buf[0..1], node) orelse { |
| 1667 | 1667 | assert(tree.nodeTag(node) == .builtin_call); |
| 1668 | const call_args_node: Ast.Node.Index = @enumFromInt(tree.extra_data[@intFromEnum(tree.nodeData(node).extra_range.end) - 1]); | |
| 1668 | const call_args_node: Ast.Node.Index = @fromBackingInt(@intCast(tree.extra_data[@backingInt(tree.nodeData(node).extra_range.end) - 1])); | |
| 1669 | 1669 | switch (tree.nodeTag(call_args_node)) { |
| 1670 | 1670 | .array_init_one, |
| 1671 | 1671 | .array_init_one_comma, |
| ... | ... | @@ -2740,7 +2740,7 @@ pub const LazySrcLoc = struct { |
| 2740 | 2740 | // Otherwise, make sure ZIR is loaded. |
| 2741 | 2741 | const zir = file.zir.?; |
| 2742 | 2742 | |
| 2743 | const inst = zir.instructions.get(@intFromEnum(zir_inst)); | |
| 2743 | const inst = zir.instructions.get(@backingInt(zir_inst)); | |
| 2744 | 2744 | const base_node: Ast.Node.Index = switch (inst.tag) { |
| 2745 | 2745 | .declaration => inst.data.declaration.src_node, |
| 2746 | 2746 | .struct_init, .struct_init_ref => zir.extraData(Zir.Inst.StructInit, inst.data.pl_node.payload_index).data.abs_node, |
| ... | ... | @@ -2789,7 +2789,7 @@ pub const LazySrcLoc = struct { |
| 2789 | 2789 | if (lhs_resolved.file_scope != rhs_resolved.file_scope) { |
| 2790 | 2790 | const lhs_path = lhs_resolved.file_scope.path; |
| 2791 | 2791 | const rhs_path = rhs_resolved.file_scope.path; |
| 2792 | return std.math.order(@intFromEnum(lhs_path.root), @intFromEnum(rhs_path.root)).differ() orelse | |
| 2792 | return std.math.order(@backingInt(lhs_path.root), @backingInt(rhs_path.root)).differ() orelse | |
| 2793 | 2793 | std.mem.order(u8, lhs_path.sub_path, rhs_path.sub_path).differ().?; |
| 2794 | 2794 | } |
| 2795 | 2795 | const prev_prot = zcu.comp.io.swapCancelProtection(.blocked); |
| ... | ... | @@ -3009,10 +3009,10 @@ pub fn loadZirCacheBody(gpa: Allocator, header: Zir.Header, cache_br: *Io.Reader |
| 3009 | 3009 | if (data_has_safety_tag) { |
| 3010 | 3010 | const tags = zir.instructions.items(.tag); |
| 3011 | 3011 | for (zir.instructions.items(.data), 0..) |*data, i| { |
| 3012 | const union_tag = Zir.Inst.Tag.data_tags[@intFromEnum(tags[i])]; | |
| 3012 | const union_tag = Zir.Inst.Tag.data_tags[@backingInt(tags[i])]; | |
| 3013 | 3013 | const as_struct = @as(*HackDataLayout, @ptrCast(data)); |
| 3014 | 3014 | as_struct.* = .{ |
| 3015 | .safety_tag = @intFromEnum(union_tag), | |
| 3015 | .safety_tag = @backingInt(union_tag), | |
| 3016 | 3016 | .data = safety_buffer[i], |
| 3017 | 3017 | }; |
| 3018 | 3018 | } |
| ... | ... | @@ -3408,8 +3408,8 @@ pub fn mapOldZirToNew( |
| 3408 | 3408 | // updates. If they have, we need to ignore this mapping. These properties are essentially |
| 3409 | 3409 | // everything passed into `InternPool.getDeclaredStructType` (likewise for unions, enums, |
| 3410 | 3410 | // and opaques). |
| 3411 | const old_tag = old_zir.instructions.items(.data)[@intFromEnum(match_item.old_inst)].extended.opcode; | |
| 3412 | const new_tag = new_zir.instructions.items(.data)[@intFromEnum(match_item.new_inst)].extended.opcode; | |
| 3411 | const old_tag = old_zir.instructions.items(.data)[@backingInt(match_item.old_inst)].extended.opcode; | |
| 3412 | const new_tag = new_zir.instructions.items(.data)[@backingInt(match_item.new_inst)].extended.opcode; | |
| 3413 | 3413 | if (old_tag != new_tag) continue; |
| 3414 | 3414 | switch (old_tag) { |
| 3415 | 3415 | .struct_decl => { |
| ... | ... | @@ -3756,7 +3756,7 @@ pub fn resetUnit(zcu: *Zcu, unit: AnalUnit) void { |
| 3756 | 3756 | exports: { |
| 3757 | 3757 | const base: u32, const len: u32 = index: { |
| 3758 | 3758 | if (zcu.single_exports.fetchSwapRemove(unit)) |kv| { |
| 3759 | break :index .{ @intFromEnum(kv.value), 1 }; | |
| 3759 | break :index .{ @backingInt(kv.value), 1 }; | |
| 3760 | 3760 | } |
| 3761 | 3761 | if (zcu.multi_exports.fetchSwapRemove(unit)) |kv| { |
| 3762 | 3762 | break :index .{ kv.value.index, kv.value.len }; |
| ... | ... | @@ -3764,7 +3764,7 @@ pub fn resetUnit(zcu: *Zcu, unit: AnalUnit) void { |
| 3764 | 3764 | break :exports; |
| 3765 | 3765 | }; |
| 3766 | 3766 | for (zcu.all_exports.items[base..][0..len], base..) |exp, exp_index_usize| { |
| 3767 | const exp_index: Export.Index = @enumFromInt(exp_index_usize); | |
| 3767 | const exp_index: Export.Index = @fromBackingInt(@intCast(exp_index_usize)); | |
| 3768 | 3768 | if (zcu.llvm_object) |llvm_object| { |
| 3769 | 3769 | _ = llvm_object; // TODO: delete exports from LLVM |
| 3770 | 3770 | } else if (zcu.comp.bin_file) |lf| { |
| ... | ... | @@ -3780,7 +3780,7 @@ pub fn resetUnit(zcu: *Zcu, unit: AnalUnit) void { |
| 3780 | 3780 | break :exports; |
| 3781 | 3781 | }; |
| 3782 | 3782 | for (base..base + len) |exp_index| { |
| 3783 | zcu.free_exports.appendAssumeCapacity(@enumFromInt(exp_index)); | |
| 3783 | zcu.free_exports.appendAssumeCapacity(@fromBackingInt(@intCast(exp_index))); | |
| 3784 | 3784 | } |
| 3785 | 3785 | } |
| 3786 | 3786 | |
| ... | ... | @@ -3836,7 +3836,7 @@ pub fn resetUnit(zcu: *Zcu, unit: AnalUnit) void { |
| 3836 | 3836 | pub fn addInlineReferenceFrame(zcu: *Zcu, frame: InlineReferenceFrame) Allocator.Error!Zcu.InlineReferenceFrame.Index { |
| 3837 | 3837 | const frame_idx: InlineReferenceFrame.Index = zcu.free_inline_reference_frames.pop() orelse idx: { |
| 3838 | 3838 | _ = try zcu.inline_reference_frames.addOne(zcu.gpa); |
| 3839 | break :idx @enumFromInt(zcu.inline_reference_frames.items.len - 1); | |
| 3839 | break :idx @fromBackingInt(@intCast(zcu.inline_reference_frames.items.len - 1)); | |
| 3840 | 3840 | }; |
| 3841 | 3841 | frame_idx.ptr(zcu).* = frame; |
| 3842 | 3842 | return frame_idx; |
| ... | ... | @@ -4251,7 +4251,7 @@ fn resolveReferencesInner(zcu: *Zcu) Allocator.Error!std.array_hash_map.Auto(Ana |
| 4251 | 4251 | if (!gop.found_existing) { |
| 4252 | 4252 | refs_log.debug("type '{f}': ref comptime %{}", .{ |
| 4253 | 4253 | Type.fromInterned(ty).containerTypeName(ip).fmt(ip), |
| 4254 | @intFromEnum(ip.getComptimeUnit(cu).zir_index.resolve(ip) orelse continue), | |
| 4254 | @backingInt(ip.getComptimeUnit(cu).zir_index.resolve(ip) orelse continue), | |
| 4255 | 4255 | }); |
| 4256 | 4256 | gop.value_ptr.* = referencer; |
| 4257 | 4257 | } |
| ... | ... | @@ -4285,7 +4285,7 @@ fn resolveReferencesInner(zcu: *Zcu) Allocator.Error!std.array_hash_map.Auto(Ana |
| 4285 | 4285 | if (!gop.found_existing) { |
| 4286 | 4286 | refs_log.debug("type '{f}': ref test %{}", .{ |
| 4287 | 4287 | Type.fromInterned(ty).containerTypeName(ip).fmt(ip), |
| 4288 | @intFromEnum(inst_info.inst), | |
| 4288 | @backingInt(inst_info.inst), | |
| 4289 | 4289 | }); |
| 4290 | 4290 | gop.value_ptr.* = referencer; |
| 4291 | 4291 | } |
| ... | ... | @@ -4308,7 +4308,7 @@ fn resolveReferencesInner(zcu: *Zcu) Allocator.Error!std.array_hash_map.Auto(Ana |
| 4308 | 4308 | if (!gop.found_existing) { |
| 4309 | 4309 | refs_log.debug("type '{f}': ref named %{}", .{ |
| 4310 | 4310 | Type.fromInterned(ty).containerTypeName(ip).fmt(ip), |
| 4311 | @intFromEnum(inst_info.inst), | |
| 4311 | @backingInt(inst_info.inst), | |
| 4312 | 4312 | }); |
| 4313 | 4313 | gop.value_ptr.* = referencer; |
| 4314 | 4314 | } |
| ... | ... | @@ -4325,7 +4325,7 @@ fn resolveReferencesInner(zcu: *Zcu) Allocator.Error!std.array_hash_map.Auto(Ana |
| 4325 | 4325 | if (!gop.found_existing) { |
| 4326 | 4326 | refs_log.debug("type '{f}': ref named %{}", .{ |
| 4327 | 4327 | Type.fromInterned(ty).containerTypeName(ip).fmt(ip), |
| 4328 | @intFromEnum(inst_info.inst), | |
| 4328 | @backingInt(inst_info.inst), | |
| 4329 | 4329 | }); |
| 4330 | 4330 | gop.value_ptr.* = referencer; |
| 4331 | 4331 | } |
| ... | ... | @@ -4494,16 +4494,16 @@ fn formatAnalUnit(data: FormatAnalUnit, writer: *Io.Writer) Io.Writer.Error!void |
| 4494 | 4494 | const cu = ip.getComptimeUnit(cu_id); |
| 4495 | 4495 | if (cu.zir_index.resolveFull(ip)) |resolved| { |
| 4496 | 4496 | const file_path = zcu.fileByIndex(resolved.file).path; |
| 4497 | return writer.print("comptime(inst=('{f}', %{}) [{}])", .{ file_path.fmt(zcu.comp), @intFromEnum(resolved.inst), @intFromEnum(cu_id) }); | |
| 4497 | return writer.print("comptime(inst=('{f}', %{}) [{}])", .{ file_path.fmt(zcu.comp), @backingInt(resolved.inst), @backingInt(cu_id) }); | |
| 4498 | 4498 | } else { |
| 4499 | return writer.print("comptime(inst=<lost> [{}])", .{@intFromEnum(cu_id)}); | |
| 4499 | return writer.print("comptime(inst=<lost> [{}])", .{@backingInt(cu_id)}); | |
| 4500 | 4500 | } |
| 4501 | 4501 | }, |
| 4502 | .nav_val, .nav_ty => |nav, tag| return writer.print("{t}('{f}' [{}])", .{ tag, ip.getNav(nav).fqn.fmt(ip), @intFromEnum(nav) }), | |
| 4503 | .type_layout, .struct_defaults => |ty, tag| return writer.print("{t}('{f}' [{}])", .{ tag, Type.fromInterned(ty).containerTypeName(ip).fmt(ip), @intFromEnum(ty) }), | |
| 4502 | .nav_val, .nav_ty => |nav, tag| return writer.print("{t}('{f}' [{}])", .{ tag, ip.getNav(nav).fqn.fmt(ip), @backingInt(nav) }), | |
| 4503 | .type_layout, .struct_defaults => |ty, tag| return writer.print("{t}('{f}' [{}])", .{ tag, Type.fromInterned(ty).containerTypeName(ip).fmt(ip), @backingInt(ty) }), | |
| 4504 | 4504 | .func => |func| { |
| 4505 | 4505 | const nav = zcu.funcInfo(func).owner_nav; |
| 4506 | return writer.print("func('{f}' [{}])", .{ ip.getNav(nav).fqn.fmt(ip), @intFromEnum(func) }); | |
| 4506 | return writer.print("func('{f}' [{}])", .{ ip.getNav(nav).fqn.fmt(ip), @backingInt(func) }); | |
| 4507 | 4507 | }, |
| 4508 | 4508 | .memoized_state => return writer.writeAll("memoized_state"), |
| 4509 | 4509 | } |
| ... | ... | @@ -4519,7 +4519,7 @@ fn formatDependee(data: FormatDependee, writer: *Io.Writer) Io.Writer.Error!void |
| 4519 | 4519 | return writer.writeAll("inst(<lost>)"); |
| 4520 | 4520 | }; |
| 4521 | 4521 | const file_path = zcu.fileByIndex(info.file).path; |
| 4522 | return writer.print("inst('{f}', %{d})", .{ file_path.fmt(zcu.comp), @intFromEnum(info.inst) }); | |
| 4522 | return writer.print("inst('{f}', %{d})", .{ file_path.fmt(zcu.comp), @backingInt(info.inst) }); | |
| 4523 | 4523 | }, |
| 4524 | 4524 | .nav_val, .nav_ty => |nav, tag| { |
| 4525 | 4525 | const fqn = ip.getNav(nav).fqn; |
| ... | ... | @@ -4546,14 +4546,14 @@ fn formatDependee(data: FormatDependee, writer: *Io.Writer) Io.Writer.Error!void |
| 4546 | 4546 | return writer.writeAll("namespace(<lost>)"); |
| 4547 | 4547 | }; |
| 4548 | 4548 | const file_path = zcu.fileByIndex(info.file).path; |
| 4549 | return writer.print("namespace('{f}', %{d})", .{ file_path.fmt(zcu.comp), @intFromEnum(info.inst) }); | |
| 4549 | return writer.print("namespace('{f}', %{d})", .{ file_path.fmt(zcu.comp), @backingInt(info.inst) }); | |
| 4550 | 4550 | }, |
| 4551 | 4551 | .namespace_name => |k| { |
| 4552 | 4552 | const info = k.namespace.resolveFull(ip) orelse { |
| 4553 | 4553 | return writer.print("namespace(<lost>, '{f}')", .{k.name.fmt(ip)}); |
| 4554 | 4554 | }; |
| 4555 | 4555 | const file_path = zcu.fileByIndex(info.file).path; |
| 4556 | return writer.print("namespace('{f}', %{d}, '{f}')", .{ file_path.fmt(zcu.comp), @intFromEnum(info.inst), k.name.fmt(ip) }); | |
| 4556 | return writer.print("namespace('{f}', %{d}, '{f}')", .{ file_path.fmt(zcu.comp), @backingInt(info.inst), k.name.fmt(ip) }); | |
| 4557 | 4557 | }, |
| 4558 | 4558 | .memoized_state => return writer.writeAll("memoized_state"), |
| 4559 | 4559 | } |
| ... | ... | @@ -5276,7 +5276,7 @@ pub const CodegenTaskPool = struct { |
| 5276 | 5276 | @memset(task_funcs, .none); |
| 5277 | 5277 | |
| 5278 | 5278 | var free: std.ArrayList(Index) = try .initCapacity(arena, max_funcs_in_flight); |
| 5279 | for (0..max_funcs_in_flight) |index| free.appendAssumeCapacity(@enumFromInt(index)); | |
| 5279 | for (0..max_funcs_in_flight) |index| free.appendAssumeCapacity(@fromBackingInt(@intCast(index))); | |
| 5280 | 5280 | |
| 5281 | 5281 | return .{ |
| 5282 | 5282 | .available_air_bytes = max_air_bytes_in_flight, |
| ... | ... | @@ -5349,10 +5349,10 @@ pub const CodegenTaskPool = struct { |
| 5349 | 5349 | errdefer comptime unreachable; |
| 5350 | 5350 | |
| 5351 | 5351 | assert(zcu.pending_codegen_jobs.fetchAdd(1, .monotonic) > 0); // the "Code Generation" node is still active |
| 5352 | assert(pool.task_funcs[@intFromEnum(index)] == .none); | |
| 5353 | pool.task_funcs[@intFromEnum(index)] = func_index; | |
| 5354 | pool.task_air_bytes[@intFromEnum(index)] = actual_air_bytes; | |
| 5355 | pool.task_futures[@intFromEnum(index)] = if (move_air) io.async( | |
| 5352 | assert(pool.task_funcs[@backingInt(index)] == .none); | |
| 5353 | pool.task_funcs[@backingInt(index)] = func_index; | |
| 5354 | pool.task_air_bytes[@backingInt(index)] = actual_air_bytes; | |
| 5355 | pool.task_futures[@backingInt(index)] = if (move_air) io.async( | |
| 5356 | 5356 | workerCodegenOwnedAir, |
| 5357 | 5357 | .{ zcu, func_index, air.* }, |
| 5358 | 5358 | ) else io.async( |
| ... | ... | @@ -5373,14 +5373,14 @@ pub const CodegenTaskPool = struct { |
| 5373 | 5373 | zcu: *const Zcu, |
| 5374 | 5374 | ) PerThread.RunCodegenError!struct { InternPool.Index, codegen.AnyMir } { |
| 5375 | 5375 | const io = zcu.comp.io; |
| 5376 | const func = pool.task_funcs[@intFromEnum(index)]; | |
| 5376 | const func = pool.task_funcs[@backingInt(index)]; | |
| 5377 | 5377 | assert(func != .none); |
| 5378 | const effective_air_bytes = pool.task_air_bytes[@intFromEnum(index)]; | |
| 5379 | const result = pool.task_futures[@intFromEnum(index)].await(io); | |
| 5378 | const effective_air_bytes = pool.task_air_bytes[@backingInt(index)]; | |
| 5379 | const result = pool.task_futures[@backingInt(index)].await(io); | |
| 5380 | 5380 | |
| 5381 | pool.task_funcs[@intFromEnum(index)] = .none; | |
| 5382 | pool.task_air_bytes[@intFromEnum(index)] = undefined; | |
| 5383 | pool.task_futures[@intFromEnum(index)] = undefined; | |
| 5381 | pool.task_funcs[@backingInt(index)] = .none; | |
| 5382 | pool.task_air_bytes[@backingInt(index)] = undefined; | |
| 5383 | pool.task_futures[@backingInt(index)] = undefined; | |
| 5384 | 5384 | |
| 5385 | 5385 | { |
| 5386 | 5386 | pool.mutex.lockUncancelable(io); |
src/Zcu/PerThread.zig+18-18| ... | ... | @@ -73,7 +73,7 @@ pub const Id = if (InternPool.single_threaded) enum { |
| 73 | 73 | pub fn allocate(arena: Allocator, n: usize) Allocator.Error!void { |
| 74 | 74 | assert(available_tids.items.len == 0); |
| 75 | 75 | try available_tids.ensureTotalCapacityPrecise(arena, n - 1); |
| 76 | for (1..n) |tid| available_tids.appendAssumeCapacity(@enumFromInt(tid)); | |
| 76 | for (1..n) |tid| available_tids.appendAssumeCapacity(@fromBackingInt(@intCast(tid))); | |
| 77 | 77 | switch (build_options.io_mode) { |
| 78 | 78 | .threaded => { |
| 79 | 79 | // Called from the main thread, so mark ourselves as such. |
| ... | ... | @@ -194,7 +194,7 @@ pub fn update( |
| 194 | 194 | // because `workerUpdateEmbedFile` can't invalidate it. The different here is that one |
| 195 | 195 | // `@embedFile` can't trigger analysis of a new `@embedFile`! |
| 196 | 196 | for (0.., zcu.embed_table.keys()) |ef_index_usize, ef| { |
| 197 | const ef_index: Zcu.EmbedFile.Index = @enumFromInt(ef_index_usize); | |
| 197 | const ef_index: Zcu.EmbedFile.Index = @fromBackingInt(@intCast(ef_index_usize)); | |
| 198 | 198 | astgen_group.async(io, workerUpdateEmbedFile, .{ |
| 199 | 199 | comp, ef_index, ef, |
| 200 | 200 | }); |
| ... | ... | @@ -390,7 +390,7 @@ fn workerUpdateFile( |
| 390 | 390 | // Discover all imports in the file. Imports of modules we ignore for now since we don't |
| 391 | 391 | // know which module we're in, but imports of file paths might need us to queue up other |
| 392 | 392 | // AstGen jobs. |
| 393 | const imports_index = file.zir.?.extra[@intFromEnum(Zir.ExtraIndex.imports)]; | |
| 393 | const imports_index = file.zir.?.extra[@backingInt(Zir.ExtraIndex.imports)]; | |
| 394 | 394 | if (imports_index != 0) { |
| 395 | 395 | const extra = file.zir.?.extraData(Zir.Inst.Imports, imports_index); |
| 396 | 396 | var import_i: u32 = 0; |
| ... | ... | @@ -853,7 +853,7 @@ fn updateZirRefs(pt: Zcu.PerThread) (Io.Cancelable || Allocator.Error)!void { |
| 853 | 853 | |
| 854 | 854 | const old_inst = tracked_inst.inst.unwrap() orelse continue; // we can't continue tracking lost insts |
| 855 | 855 | const tracked_inst_index = (InternPool.TrackedInst.Index.Unwrapped{ |
| 856 | .tid = @enumFromInt(tid), | |
| 856 | .tid = @fromBackingInt(@intCast(tid)), | |
| 857 | 857 | .index = @intCast(tracked_inst_unwrapped_index), |
| 858 | 858 | }).wrap(ip); |
| 859 | 859 | const new_inst = updated_file.inst_map.get(old_inst) orelse { |
| ... | ... | @@ -868,8 +868,8 @@ fn updateZirRefs(pt: Zcu.PerThread) (Io.Cancelable || Allocator.Error)!void { |
| 868 | 868 | |
| 869 | 869 | const old_zir = file.prev_zir.?.*; |
| 870 | 870 | const new_zir = file.zir.?; |
| 871 | const old_tag = old_zir.instructions.items(.tag)[@intFromEnum(old_inst)]; | |
| 872 | const old_data = old_zir.instructions.items(.data)[@intFromEnum(old_inst)]; | |
| 871 | const old_tag = old_zir.instructions.items(.tag)[@backingInt(old_inst)]; | |
| 872 | const old_data = old_zir.instructions.items(.data)[@backingInt(old_inst)]; | |
| 873 | 873 | |
| 874 | 874 | switch (old_tag) { |
| 875 | 875 | .declaration => { |
| ... | ... | @@ -1882,7 +1882,7 @@ fn analyzeNavVal( |
| 1882 | 1882 | }); |
| 1883 | 1883 | |
| 1884 | 1884 | if (zir_decl.linkage == .@"export") { |
| 1885 | const export_src = block.src(.{ .token_offset = @enumFromInt(@intFromBool(zir_decl.is_pub)) }); | |
| 1885 | const export_src = block.src(.{ .token_offset = @fromBackingInt(@intCast(@intFromBool(zir_decl.is_pub))) }); | |
| 1886 | 1886 | const name_slice = zir.nullTerminatedString(zir_decl.name); |
| 1887 | 1887 | const name_ip = try ip.getOrPutString(gpa, io, pt.tid, name_slice, .no_embedded_nulls); |
| 1888 | 1888 | try sema.analyzeExportSelfNav(&block, export_src, name_ip); |
| ... | ... | @@ -2623,7 +2623,7 @@ fn computeAliveFiles(pt: Zcu.PerThread) Allocator.Error!bool { |
| 2623 | 2623 | if (file.status != .success) continue; // ZIR not valid if there was a file failure |
| 2624 | 2624 | |
| 2625 | 2625 | const zir = file.zir.?; |
| 2626 | const imports_index = zir.extra[@intFromEnum(Zir.ExtraIndex.imports)]; | |
| 2626 | const imports_index = zir.extra[@backingInt(Zir.ExtraIndex.imports)]; | |
| 2627 | 2627 | if (imports_index == 0) continue; // this Zig file has no imports |
| 2628 | 2628 | const extra = zir.extraData(Zir.Inst.Imports, imports_index); |
| 2629 | 2629 | var extra_index = extra.end; |
| ... | ... | @@ -2794,7 +2794,7 @@ pub fn updateBuiltinModule(pt: Zcu.PerThread, opts: Builtin) Allocator.Error!voi |
| 2794 | 2794 | assert(!file.zir.?.hasCompileErrors()); |
| 2795 | 2795 | { |
| 2796 | 2796 | // Check that it has only one import, which is 'std'. |
| 2797 | const imports_idx = file.zir.?.extra[@intFromEnum(Zir.ExtraIndex.imports)]; | |
| 2797 | const imports_idx = file.zir.?.extra[@backingInt(Zir.ExtraIndex.imports)]; | |
| 2798 | 2798 | assert(imports_idx != 0); // there is an import |
| 2799 | 2799 | const extra = file.zir.?.extraData(Zir.Inst.Imports, imports_idx); |
| 2800 | 2800 | assert(extra.data.imports_len == 1); // there is exactly one import |
| ... | ... | @@ -2838,11 +2838,11 @@ pub fn embedFile( |
| 2838 | 2838 | const gop = try zcu.embed_table.getOrPutAdapted(gpa, path, Zcu.EmbedTableAdapter{}); |
| 2839 | 2839 | if (gop.found_existing) { |
| 2840 | 2840 | path.deinit(gpa); // we're not using this key |
| 2841 | return @enumFromInt(gop.index); | |
| 2841 | return @fromBackingInt(@intCast(gop.index)); | |
| 2842 | 2842 | } |
| 2843 | 2843 | errdefer _ = zcu.embed_table.pop(); |
| 2844 | 2844 | gop.key_ptr.* = try pt.newEmbedFile(path); |
| 2845 | return @enumFromInt(gop.index); | |
| 2845 | return @fromBackingInt(@intCast(gop.index)); | |
| 2846 | 2846 | } |
| 2847 | 2847 | |
| 2848 | 2848 | const embed_file: *Zcu.EmbedFile, const embed_file_idx: Zcu.EmbedFile.Index = ef: { |
| ... | ... | @@ -2851,11 +2851,11 @@ pub fn embedFile( |
| 2851 | 2851 | const gop = try zcu.embed_table.getOrPutAdapted(gpa, path, Zcu.EmbedTableAdapter{}); |
| 2852 | 2852 | if (gop.found_existing) { |
| 2853 | 2853 | path.deinit(gpa); // we're not using this key |
| 2854 | break :ef .{ gop.key_ptr.*, @enumFromInt(gop.index) }; | |
| 2854 | break :ef .{ gop.key_ptr.*, @fromBackingInt(@intCast(gop.index)) }; | |
| 2855 | 2855 | } else { |
| 2856 | 2856 | errdefer _ = zcu.embed_table.pop(); |
| 2857 | 2857 | gop.key_ptr.* = try pt.newEmbedFile(path); |
| 2858 | break :ef .{ gop.key_ptr.*, @enumFromInt(gop.index) }; | |
| 2858 | break :ef .{ gop.key_ptr.*, @fromBackingInt(@intCast(gop.index)) }; | |
| 2859 | 2859 | } |
| 2860 | 2860 | }; |
| 2861 | 2861 | |
| ... | ... | @@ -3394,7 +3394,7 @@ fn analyzeFuncBodyInner( |
| 3394 | 3394 | gop.value_ptr.* = .fromValue(opv); |
| 3395 | 3395 | continue; |
| 3396 | 3396 | } |
| 3397 | const arg_index: Air.Inst.Index = @enumFromInt(sema.air_instructions.len); | |
| 3397 | const arg_index: Air.Inst.Index = @fromBackingInt(@intCast(sema.air_instructions.len)); | |
| 3398 | 3398 | gop.value_ptr.* = arg_index.toRef(); |
| 3399 | 3399 | inner_block.instructions.appendAssumeCapacity(arg_index); |
| 3400 | 3400 | sema.air_instructions.appendAssumeCapacity(.{ |
| ... | ... | @@ -3441,7 +3441,7 @@ fn analyzeFuncBodyInner( |
| 3441 | 3441 | for (sema.unresolved_inferred_allocs.keys()) |ptr_inst| { |
| 3442 | 3442 | // The lack of a resolve_inferred_alloc means that this instruction |
| 3443 | 3443 | // is unused so it just has to be a no-op. |
| 3444 | sema.air_instructions.set(@intFromEnum(ptr_inst), .{ | |
| 3444 | sema.air_instructions.set(@backingInt(ptr_inst), .{ | |
| 3445 | 3445 | .tag = .alloc, |
| 3446 | 3446 | .data = .{ .ty = .ptr_const_comptime_int }, |
| 3447 | 3447 | }); |
| ... | ... | @@ -3466,7 +3466,7 @@ fn analyzeFuncBodyInner( |
| 3466 | 3466 | .body_len = @intCast(inner_block.instructions.items.len), |
| 3467 | 3467 | }); |
| 3468 | 3468 | sema.air_extra.appendSliceAssumeCapacity(@ptrCast(inner_block.instructions.items)); |
| 3469 | sema.air_extra.items[@intFromEnum(Air.ExtraIndex.main_block)] = main_block_index; | |
| 3469 | sema.air_extra.items[@backingInt(Air.ExtraIndex.main_block)] = main_block_index; | |
| 3470 | 3470 | |
| 3471 | 3471 | // Resolving inferred error sets is done *before* setting the function |
| 3472 | 3472 | // state to success, so that "unable to resolve inferred error set" errors |
| ... | ... | @@ -3640,7 +3640,7 @@ pub fn processExports(pt: Zcu.PerThread) !void { |
| 3640 | 3640 | }, |
| 3641 | 3641 | }; |
| 3642 | 3642 | if (!found_existing) value_ptr.* = .empty; |
| 3643 | try value_ptr.append(gpa, @enumFromInt(export_idx)); | |
| 3643 | try value_ptr.append(gpa, @fromBackingInt(@intCast(export_idx))); | |
| 3644 | 3644 | } |
| 3645 | 3645 | } |
| 3646 | 3646 | |
| ... | ... | @@ -3994,7 +3994,7 @@ pub fn ptrType(pt: Zcu.PerThread, info: InternPool.Key.PtrType) Allocator.Error! |
| 3994 | 3994 | canon_info.packed_offset.host_size = 0; |
| 3995 | 3995 | } |
| 3996 | 3996 | }, |
| 3997 | _ => assert(@intFromEnum(info.flags.vector_index) < info.packed_offset.host_size), | |
| 3997 | _ => assert(@backingInt(info.flags.vector_index) < info.packed_offset.host_size), | |
| 3998 | 3998 | } |
| 3999 | 3999 | |
| 4000 | 4000 | return .fromInterned(try pt.intern(.{ .ptr_type = canon_info })); |
src/codegen.zig+6-6| ... | ... | @@ -793,7 +793,7 @@ fn lowerNavRef( |
| 793 | 793 | @panic("TODO add out_reloc for this"); |
| 794 | 794 | } else { |
| 795 | 795 | try wasm.func_table_fixups.append(gpa, .{ |
| 796 | .table_index = @enumFromInt(gop.index), | |
| 796 | .table_index = @fromBackingInt(@intCast(gop.index)), | |
| 797 | 797 | .offset = @intCast(w.end), |
| 798 | 798 | }); |
| 799 | 799 | } |
| ... | ... | @@ -855,7 +855,7 @@ pub fn genNavRef( |
| 855 | 855 | .internal => { |
| 856 | 856 | const sym_index = try zo.getOrCreateMetadataForNav(zcu, nav_index); |
| 857 | 857 | if (is_threadlocal) zo.symbol(sym_index).flags.is_tls = true; |
| 858 | return @enumFromInt(sym_index); | |
| 858 | return @fromBackingInt(@intCast(sym_index)); | |
| 859 | 859 | }, |
| 860 | 860 | .strong, .weak => { |
| 861 | 861 | const sym_index = try elf_file.getGlobalSymbol(nav.name.toSlice(ip), lib_name.toSlice(ip)); |
| ... | ... | @@ -866,7 +866,7 @@ pub fn genNavRef( |
| 866 | 866 | .link_once => unreachable, |
| 867 | 867 | } |
| 868 | 868 | if (is_threadlocal) zo.symbol(sym_index).flags.is_tls = true; |
| 869 | return @enumFromInt(sym_index); | |
| 869 | return @fromBackingInt(@intCast(sym_index)); | |
| 870 | 870 | }, |
| 871 | 871 | .link_once => unreachable, |
| 872 | 872 | } |
| ... | ... | @@ -878,7 +878,7 @@ pub fn genNavRef( |
| 878 | 878 | .internal => { |
| 879 | 879 | const sym_index = try zo.getOrCreateMetadataForNav(macho_file, nav_index); |
| 880 | 880 | if (is_threadlocal) zo.symbols.items[sym_index].flags.tlv = true; |
| 881 | return @enumFromInt(sym_index); | |
| 881 | return @fromBackingInt(@intCast(sym_index)); | |
| 882 | 882 | }, |
| 883 | 883 | .strong, .weak => { |
| 884 | 884 | const sym_index = try macho_file.getGlobalSymbol(nav.name.toSlice(ip), lib_name.toSlice(ip)); |
| ... | ... | @@ -889,12 +889,12 @@ pub fn genNavRef( |
| 889 | 889 | .link_once => unreachable, |
| 890 | 890 | } |
| 891 | 891 | if (is_threadlocal) zo.symbols.items[sym_index].flags.tlv = true; |
| 892 | return @enumFromInt(sym_index); | |
| 892 | return @fromBackingInt(@intCast(sym_index)); | |
| 893 | 893 | }, |
| 894 | 894 | .link_once => unreachable, |
| 895 | 895 | } |
| 896 | 896 | } else if (lf.cast(.coff2)) |coff| { |
| 897 | return @enumFromInt(@intFromEnum(try coff.navSymbol(zcu, nav_index))); | |
| 897 | return @fromBackingInt(@intCast(@backingInt(try coff.navSymbol(zcu, nav_index)))); | |
| 898 | 898 | } else { |
| 899 | 899 | std.debug.panic("TODO genNavRef for '{t}'", .{lf.tag}); |
| 900 | 900 | } |
src/codegen/aarch64.zig+11-11| ... | ... | @@ -72,8 +72,8 @@ pub fn generate( |
| 72 | 72 | const air_main_body = air.getMainBody(); |
| 73 | 73 | var param_it: Select.CallAbiIterator = .init; |
| 74 | 74 | const air_args = for (air_main_body, 0..) |air_inst_index, body_index| { |
| 75 | if (air.instructions.items(.tag)[@intFromEnum(air_inst_index)] != .arg) break air_main_body[0..body_index]; | |
| 76 | const arg = air.instructions.items(.data)[@intFromEnum(air_inst_index)].arg; | |
| 75 | if (air.instructions.items(.tag)[@backingInt(air_inst_index)] != .arg) break air_main_body[0..body_index]; | |
| 76 | const arg = air.instructions.items(.data)[@backingInt(air_inst_index)].arg; | |
| 77 | 77 | const param_ty = arg.ty.toType(); |
| 78 | 78 | const param_vi = param_vi: { |
| 79 | 79 | if (arg.zir_param_index >= named_params_len) { |
| ... | ... | @@ -82,17 +82,17 @@ pub fn generate( |
| 82 | 82 | } |
| 83 | 83 | break :param_vi try param_it.param(&isel, param_ty); |
| 84 | 84 | }; |
| 85 | tracking_log.debug("${d} <- %{d}", .{ @intFromEnum(param_vi.?), @intFromEnum(air_inst_index) }); | |
| 85 | tracking_log.debug("${d} <- %{d}", .{ @backingInt(param_vi.?), @backingInt(air_inst_index) }); | |
| 86 | 86 | try isel.live_values.putNoClobber(gpa, air_inst_index, param_vi.?); |
| 87 | 87 | } else unreachable; |
| 88 | 88 | |
| 89 | 89 | const saved_gra_start = if (mod.strip) param_it.ngrn else Select.CallAbiIterator.ngrn_start; |
| 90 | 90 | const saved_gra_end = if (is_sysv_var_args) Select.CallAbiIterator.ngrn_end else param_it.ngrn; |
| 91 | const saved_gra_len = @intFromEnum(saved_gra_end) - @intFromEnum(saved_gra_start); | |
| 91 | const saved_gra_len = @backingInt(saved_gra_end) - @backingInt(saved_gra_start); | |
| 92 | 92 | |
| 93 | 93 | const saved_vra_start = if (mod.strip) param_it.nsrn else Select.CallAbiIterator.nsrn_start; |
| 94 | 94 | const saved_vra_end = if (is_sysv_var_args) Select.CallAbiIterator.nsrn_end else param_it.nsrn; |
| 95 | const saved_vra_len = @intFromEnum(saved_vra_end) - @intFromEnum(saved_vra_start); | |
| 95 | const saved_vra_len = @backingInt(saved_vra_end) - @backingInt(saved_vra_start); | |
| 96 | 96 | |
| 97 | 97 | const frame_record = 2; |
| 98 | 98 | const named_stack_args: Select.Value.Indirect = .{ |
| ... | ... | @@ -106,13 +106,13 @@ pub fn generate( |
| 106 | 106 | .__stack = stack_var_args, |
| 107 | 107 | .__gr_top = gr_top, |
| 108 | 108 | .__vr_top = vr_top, |
| 109 | .__gr_offs = @as(i32, @intFromEnum(Select.CallAbiIterator.ngrn_end) - @intFromEnum(param_it.ngrn)) * -8, | |
| 110 | .__vr_offs = @as(i32, @intFromEnum(Select.CallAbiIterator.nsrn_end) - @intFromEnum(param_it.nsrn)) * -16, | |
| 109 | .__gr_offs = @as(i32, @backingInt(Select.CallAbiIterator.ngrn_end) - @backingInt(param_it.ngrn)) * -8, | |
| 110 | .__vr_offs = @as(i32, @backingInt(Select.CallAbiIterator.nsrn_end) - @backingInt(param_it.nsrn)) * -16, | |
| 111 | 111 | } } else .{ .other = stack_var_args }; |
| 112 | 112 | |
| 113 | 113 | // translate arg locations from caller-based to callee-based |
| 114 | 114 | for (air_args) |air_inst_index| { |
| 115 | assert(air.instructions.items(.tag)[@intFromEnum(air_inst_index)] == .arg); | |
| 115 | assert(air.instructions.items(.tag)[@backingInt(air_inst_index)] == .arg); | |
| 116 | 116 | const arg_vi = isel.live_values.get(air_inst_index).?; |
| 117 | 117 | const passed_vi = switch (arg_vi.parent(&isel)) { |
| 118 | 118 | .unallocated, .stack_slot => arg_vi, |
| ... | ... | @@ -125,9 +125,9 @@ pub fn generate( |
| 125 | 125 | const first_passed_part_vi = part_it.next().?; |
| 126 | 126 | const hint_ra = first_passed_part_vi.hint(&isel).?; |
| 127 | 127 | passed_vi.setParent(&isel, .{ .stack_slot = if (hint_ra.isVector()) |
| 128 | vr_top.withOffset(@as(i8, -16) * (@intFromEnum(saved_vra_end) - @intFromEnum(hint_ra))) | |
| 128 | vr_top.withOffset(@as(i8, -16) * (@backingInt(saved_vra_end) - @backingInt(hint_ra))) | |
| 129 | 129 | else |
| 130 | gr_top.withOffset(@as(i8, -8) * (@intFromEnum(saved_gra_end) - @intFromEnum(hint_ra))) }); | |
| 130 | gr_top.withOffset(@as(i8, -8) * (@backingInt(saved_gra_end) - @backingInt(hint_ra))) }); | |
| 131 | 131 | }, |
| 132 | 132 | .stack_slot => |stack_slot| { |
| 133 | 133 | assert(stack_slot.base == .sp); |
| ... | ... | @@ -140,7 +140,7 @@ pub fn generate( |
| 140 | 140 | ret: { |
| 141 | 141 | var ret_it: Select.CallAbiIterator = .init; |
| 142 | 142 | const ret_vi = try ret_it.ret(&isel, .fromInterned(func_type.return_type)) orelse break :ret; |
| 143 | tracking_log.debug("${d} <- %main", .{@intFromEnum(ret_vi)}); | |
| 143 | tracking_log.debug("${d} <- %main", .{@backingInt(ret_vi)}); | |
| 144 | 144 | try isel.live_values.putNoClobber(gpa, Select.Block.main, ret_vi); |
| 145 | 145 | } |
| 146 | 146 |
src/codegen/aarch64/Disassemble.zig+23-23| ... | ... | @@ -363,7 +363,7 @@ pub fn printInstruction(dis: Disassemble, inst: aarch64.encoding.Instruction, wr |
| 363 | 363 | return writer.print("{f}{s}{f}{s}#0x{d}{s}.{c}0x{x}", .{ |
| 364 | 364 | fmtCase(group.op, dis.case), |
| 365 | 365 | dis.mnemonic_operands_separator, |
| 366 | group.Rt.decode(.{}).general(@enumFromInt(group.b5)).fmtCase(dis.case), | |
| 366 | group.Rt.decode(.{}).general(@fromBackingInt(@intCast(group.b5))).fmtCase(dis.case), | |
| 367 | 367 | dis.operands_separator, |
| 368 | 368 | @as(u6, group.b5) << 5 | |
| 369 | 369 | @as(u6, group.b40) << 0, |
| ... | ... | @@ -383,7 +383,7 @@ pub fn printInstruction(dis: Disassemble, inst: aarch64.encoding.Instruction, wr |
| 383 | 383 | const decoded = integer.decode(); |
| 384 | 384 | if (decoded == .unallocated) break :unallocated; |
| 385 | 385 | const group = integer.group; |
| 386 | const sf: aarch64.encoding.Register.GeneralSize = @enumFromInt(group.opc >> 1); | |
| 386 | const sf: aarch64.encoding.Register.GeneralSize = @fromBackingInt(@intCast(group.opc >> 1)); | |
| 387 | 387 | return writer.print("{f}{s}{f}{s}{f}{s}[{f}]{s}#{s}0x{x}", .{ |
| 388 | 388 | fmtCase(decoded, dis.case), |
| 389 | 389 | dis.mnemonic_operands_separator, |
| ... | ... | @@ -394,7 +394,7 @@ pub fn printInstruction(dis: Disassemble, inst: aarch64.encoding.Instruction, wr |
| 394 | 394 | group.Rn.decode(.{ .sp = true }).x().fmtCase(dis.case), |
| 395 | 395 | dis.operands_separator, |
| 396 | 396 | if (group.imm7 < 0) "-" else "", |
| 397 | @as(u10, @abs(group.imm7)) << (@as(u2, 2) + @intFromEnum(sf)), | |
| 397 | @as(u10, @abs(group.imm7)) << (@as(u2, 2) + @backingInt(sf)), | |
| 398 | 398 | }); |
| 399 | 399 | }, |
| 400 | 400 | .vector => |vector| { |
| ... | ... | @@ -412,7 +412,7 @@ pub fn printInstruction(dis: Disassemble, inst: aarch64.encoding.Instruction, wr |
| 412 | 412 | group.Rn.decode(.{ .sp = true }).x().fmtCase(dis.case), |
| 413 | 413 | dis.operands_separator, |
| 414 | 414 | if (group.imm7 < 0) "-" else "", |
| 415 | @as(u11, @abs(group.imm7)) << (@as(u3, 2) + @intFromEnum(vs)), | |
| 415 | @as(u11, @abs(group.imm7)) << (@as(u3, 2) + @backingInt(vs)), | |
| 416 | 416 | }); |
| 417 | 417 | }, |
| 418 | 418 | }, |
| ... | ... | @@ -421,7 +421,7 @@ pub fn printInstruction(dis: Disassemble, inst: aarch64.encoding.Instruction, wr |
| 421 | 421 | const decoded = integer.decode(); |
| 422 | 422 | if (decoded == .unallocated) break :unallocated; |
| 423 | 423 | const group = integer.group; |
| 424 | const sf: aarch64.encoding.Register.GeneralSize = @enumFromInt(group.opc >> 1); | |
| 424 | const sf: aarch64.encoding.Register.GeneralSize = @fromBackingInt(@intCast(group.opc >> 1)); | |
| 425 | 425 | try writer.print("{f}{s}{f}{s}{f}{s}[{f}", .{ |
| 426 | 426 | fmtCase(decoded, dis.case), |
| 427 | 427 | dis.mnemonic_operands_separator, |
| ... | ... | @@ -434,7 +434,7 @@ pub fn printInstruction(dis: Disassemble, inst: aarch64.encoding.Instruction, wr |
| 434 | 434 | if (group.imm7 != 0) try writer.print("{s}#{s}0x{x}", .{ |
| 435 | 435 | dis.operands_separator, |
| 436 | 436 | if (group.imm7 < 0) "-" else "", |
| 437 | @as(u10, @abs(group.imm7)) << (@as(u2, 2) + @intFromEnum(sf)), | |
| 437 | @as(u10, @abs(group.imm7)) << (@as(u2, 2) + @backingInt(sf)), | |
| 438 | 438 | }); |
| 439 | 439 | return writer.writeByte(']'); |
| 440 | 440 | }, |
| ... | ... | @@ -455,7 +455,7 @@ pub fn printInstruction(dis: Disassemble, inst: aarch64.encoding.Instruction, wr |
| 455 | 455 | if (group.imm7 != 0) try writer.print("{s}#{s}0x{x}", .{ |
| 456 | 456 | dis.operands_separator, |
| 457 | 457 | if (group.imm7 < 0) "-" else "", |
| 458 | @as(u11, @abs(group.imm7)) << (@as(u3, 2) + @intFromEnum(vs)), | |
| 458 | @as(u11, @abs(group.imm7)) << (@as(u3, 2) + @backingInt(vs)), | |
| 459 | 459 | }); |
| 460 | 460 | return writer.writeByte(']'); |
| 461 | 461 | }, |
| ... | ... | @@ -465,7 +465,7 @@ pub fn printInstruction(dis: Disassemble, inst: aarch64.encoding.Instruction, wr |
| 465 | 465 | const decoded = integer.decode(); |
| 466 | 466 | if (decoded == .unallocated) break :unallocated; |
| 467 | 467 | const group = integer.group; |
| 468 | const sf: aarch64.encoding.Register.GeneralSize = @enumFromInt(group.opc >> 1); | |
| 468 | const sf: aarch64.encoding.Register.GeneralSize = @fromBackingInt(@intCast(group.opc >> 1)); | |
| 469 | 469 | return writer.print("{f}{s}{f}{s}{f}{s}[{f}{s}#{s}0x{x}]!", .{ |
| 470 | 470 | fmtCase(decoded, dis.case), |
| 471 | 471 | dis.mnemonic_operands_separator, |
| ... | ... | @@ -476,7 +476,7 @@ pub fn printInstruction(dis: Disassemble, inst: aarch64.encoding.Instruction, wr |
| 476 | 476 | group.Rn.decode(.{ .sp = true }).x().fmtCase(dis.case), |
| 477 | 477 | dis.operands_separator, |
| 478 | 478 | if (group.imm7 < 0) "-" else "", |
| 479 | @as(u10, @abs(group.imm7)) << (@as(u2, 2) + @intFromEnum(sf)), | |
| 479 | @as(u10, @abs(group.imm7)) << (@as(u2, 2) + @backingInt(sf)), | |
| 480 | 480 | }); |
| 481 | 481 | }, |
| 482 | 482 | .vector => |vector| { |
| ... | ... | @@ -494,7 +494,7 @@ pub fn printInstruction(dis: Disassemble, inst: aarch64.encoding.Instruction, wr |
| 494 | 494 | group.Rn.decode(.{ .sp = true }).x().fmtCase(dis.case), |
| 495 | 495 | dis.operands_separator, |
| 496 | 496 | if (group.imm7 < 0) "-" else "", |
| 497 | @as(u11, @abs(group.imm7)) << (@as(u3, 2) + @intFromEnum(vs)), | |
| 497 | @as(u11, @abs(group.imm7)) << (@as(u3, 2) + @backingInt(vs)), | |
| 498 | 498 | }); |
| 499 | 499 | }, |
| 500 | 500 | }, |
| ... | ... | @@ -597,7 +597,7 @@ pub fn printInstruction(dis: Disassemble, inst: aarch64.encoding.Instruction, wr |
| 597 | 597 | fmtCase(group.option, dis.case), |
| 598 | 598 | }); |
| 599 | 599 | if (group.S) try writer.print(" #{d}", .{ |
| 600 | @intFromEnum(group.size), | |
| 600 | @backingInt(group.size), | |
| 601 | 601 | }); |
| 602 | 602 | } |
| 603 | 603 | return writer.writeByte(']'); |
| ... | ... | @@ -627,7 +627,7 @@ pub fn printInstruction(dis: Disassemble, inst: aarch64.encoding.Instruction, wr |
| 627 | 627 | }); |
| 628 | 628 | if (group.imm12 > 0) try writer.print("{s}#0x{x}", .{ |
| 629 | 629 | dis.operands_separator, |
| 630 | @as(u15, group.imm12) << @intFromEnum(group.size), | |
| 630 | @as(u15, group.imm12) << @backingInt(group.size), | |
| 631 | 631 | }); |
| 632 | 632 | return writer.writeByte(']'); |
| 633 | 633 | }, |
| ... | ... | @@ -969,10 +969,10 @@ pub fn printInstruction(dis: Disassemble, inst: aarch64.encoding.Instruction, wr |
| 969 | 969 | else |
| 970 | 970 | fmtCase(decoded, dis.case), |
| 971 | 971 | dis.mnemonic_operands_separator, |
| 972 | group.Rd.decode(.{ .V = true }).scalar(@enumFromInt(elem_size)).fmtCase(dis.case), | |
| 972 | group.Rd.decode(.{ .V = true }).scalar(@fromBackingInt(@intCast(elem_size))).fmtCase(dis.case), | |
| 973 | 973 | dis.operands_separator, |
| 974 | 974 | group.Rn.decode(.{ .V = true }).element( |
| 975 | @enumFromInt(elem_size), | |
| 975 | @fromBackingInt(@intCast(elem_size)), | |
| 976 | 976 | @intCast(group.imm5 >> (elem_size + 1)), |
| 977 | 977 | ).fmtCase(dis.case), |
| 978 | 978 | }); |
| ... | ... | @@ -1066,11 +1066,11 @@ pub fn printInstruction(dis: Disassemble, inst: aarch64.encoding.Instruction, wr |
| 1066 | 1066 | .unallocated => unreachable, |
| 1067 | 1067 | .dup => |dup| group.Rd.decode(.{ .V = true }).vector(.wrap(.{ |
| 1068 | 1068 | .size = dup.Q, |
| 1069 | .elem_size = @enumFromInt(elem_size), | |
| 1069 | .elem_size = @fromBackingInt(@intCast(elem_size)), | |
| 1070 | 1070 | })), |
| 1071 | 1071 | inline .smov, .umov => |mov| group.Rd.decode(.{}).general(mov.Q), |
| 1072 | 1072 | .ins => group.Rd.decode(.{ .V = true }).element( |
| 1073 | @enumFromInt(elem_size), | |
| 1073 | @fromBackingInt(@intCast(elem_size)), | |
| 1074 | 1074 | @intCast(group.imm5 >> (elem_size + 1)), |
| 1075 | 1075 | ), |
| 1076 | 1076 | }.fmtCase(dis.case), |
| ... | ... | @@ -1079,7 +1079,7 @@ pub fn printInstruction(dis: Disassemble, inst: aarch64.encoding.Instruction, wr |
| 1079 | 1079 | .unallocated => unreachable, |
| 1080 | 1080 | .dup => |dup| switch (dup.imm4) { |
| 1081 | 1081 | .element => group.Rn.decode(.{ .V = true }).element( |
| 1082 | @enumFromInt(elem_size), | |
| 1082 | @fromBackingInt(@intCast(elem_size)), | |
| 1083 | 1083 | @intCast(group.imm5 >> (elem_size + 1)), |
| 1084 | 1084 | ), |
| 1085 | 1085 | .general => group.Rn.decode(.{}).general(switch (elem_size) { |
| ... | ... | @@ -1090,12 +1090,12 @@ pub fn printInstruction(dis: Disassemble, inst: aarch64.encoding.Instruction, wr |
| 1090 | 1090 | _ => unreachable, |
| 1091 | 1091 | }, |
| 1092 | 1092 | .smov, .umov => group.Rn.decode(.{ .V = true }).element( |
| 1093 | @enumFromInt(elem_size), | |
| 1093 | @fromBackingInt(@intCast(elem_size)), | |
| 1094 | 1094 | @intCast(group.imm5 >> (elem_size + 1)), |
| 1095 | 1095 | ), |
| 1096 | 1096 | .ins => |ins| switch (ins.op) { |
| 1097 | 1097 | .element => group.Rn.decode(.{ .V = true }).element( |
| 1098 | @enumFromInt(elem_size), | |
| 1098 | @fromBackingInt(@intCast(elem_size)), | |
| 1099 | 1099 | @intCast(group.imm4 >> @intCast(elem_size)), |
| 1100 | 1100 | ), |
| 1101 | 1101 | .general => group.Rn.decode(.{}).general(switch (elem_size) { |
| ... | ... | @@ -1263,7 +1263,7 @@ pub fn printInstruction(dis: Disassemble, inst: aarch64.encoding.Instruction, wr |
| 1263 | 1263 | .size = group.Q, |
| 1264 | 1264 | .elem_size = switch (group.o2) { |
| 1265 | 1265 | 0b1 => .half, |
| 1266 | 0b0 => DataProcessingVector.Sz.toSize(@enumFromInt(group.op)), | |
| 1266 | 0b0 => DataProcessingVector.Sz.toSize(@fromBackingInt(@intCast(group.op))), | |
| 1267 | 1267 | }, |
| 1268 | 1268 | })).fmtCase(dis.case), |
| 1269 | 1269 | }); |
| ... | ... | @@ -1404,7 +1404,7 @@ pub const RegisterFormatter = struct { |
| 1404 | 1404 | .r30, |
| 1405 | 1405 | => |alias| try writer.print("{c}{d}", .{ |
| 1406 | 1406 | data.case.convert(size.prefix()), |
| 1407 | @intFromEnum(alias.encode(.{})), | |
| 1407 | @backingInt(alias.encode(.{})), | |
| 1408 | 1408 | }), |
| 1409 | 1409 | .zr => try writer.print("{c}{f}", .{ |
| 1410 | 1410 | data.case.convert(size.prefix()), |
| ... | ... | @@ -1420,7 +1420,7 @@ pub const RegisterFormatter = struct { |
| 1420 | 1420 | }, |
| 1421 | 1421 | .scalar => |size| try writer.print("{c}{d}", .{ |
| 1422 | 1422 | data.case.convert(size.prefix()), |
| 1423 | @intFromEnum(data.reg.alias.encode(.{ .V = true })), | |
| 1423 | @backingInt(data.reg.alias.encode(.{ .V = true })), | |
| 1424 | 1424 | }), |
| 1425 | 1425 | .vector => |arrangement| try writer.print("{f}.{f}", .{ |
| 1426 | 1426 | fmtCase(data.reg.alias, data.case), |
| ... | ... | @@ -1433,7 +1433,7 @@ pub const RegisterFormatter = struct { |
| 1433 | 1433 | }), |
| 1434 | 1434 | .scalable => try writer.print("{c}{d}", .{ |
| 1435 | 1435 | data.case.convert('z'), |
| 1436 | @intFromEnum(data.reg.alias.encode(.{ .V = true })), | |
| 1436 | @backingInt(data.reg.alias.encode(.{ .V = true })), | |
| 1437 | 1437 | }), |
| 1438 | 1438 | } |
| 1439 | 1439 | } |
src/codegen/aarch64/Mir.zig+23-23| ... | ... | @@ -122,11 +122,11 @@ pub fn emit( |
| 122 | 122 | zcu, |
| 123 | 123 | atom_index, |
| 124 | 124 | if (lf.cast(.elf)) |ef| |
| 125 | @enumFromInt(ef.zigObjectPtr().?.getOrCreateMetadataForLazySymbol(ef, pt, lazy_reloc.symbol) catch |err| | |
| 126 | return zcu.codegenFail(func.owner_nav, "{s} creating lazy symbol", .{@errorName(err)})) | |
| 125 | @fromBackingInt(@intCast(ef.zigObjectPtr().?.getOrCreateMetadataForLazySymbol(ef, pt, lazy_reloc.symbol) catch |err| | |
| 126 | return zcu.codegenFail(func.owner_nav, "{s} creating lazy symbol", .{@errorName(err)}))) | |
| 127 | 127 | else if (lf.cast(.macho)) |mf| |
| 128 | @enumFromInt(mf.getZigObject().?.getOrCreateMetadataForLazySymbol(mf, pt, lazy_reloc.symbol) catch |err| | |
| 129 | return zcu.codegenFail(func.owner_nav, "{s} creating lazy symbol", .{@errorName(err)})) | |
| 128 | @fromBackingInt(@intCast(mf.getZigObject().?.getOrCreateMetadataForLazySymbol(mf, pt, lazy_reloc.symbol) catch |err| | |
| 129 | return zcu.codegenFail(func.owner_nav, "{s} creating lazy symbol", .{@errorName(err)}))) | |
| 130 | 130 | else |
| 131 | 131 | return zcu.codegenFail(func.owner_nav, "external symbols unimplemented for {t}", .{lf.tag}), |
| 132 | 132 | mir.body[lazy_reloc.reloc.label], |
| ... | ... | @@ -139,9 +139,9 @@ pub fn emit( |
| 139 | 139 | zcu, |
| 140 | 140 | atom_index, |
| 141 | 141 | if (lf.cast(.elf)) |ef| |
| 142 | @enumFromInt(try ef.getGlobalSymbol(std.mem.span(global_reloc.name), null)) | |
| 142 | @fromBackingInt(@intCast(try ef.getGlobalSymbol(std.mem.span(global_reloc.name), null))) | |
| 143 | 143 | else if (lf.cast(.macho)) |mf| |
| 144 | @enumFromInt(try mf.getGlobalSymbol(std.mem.span(global_reloc.name), null)) | |
| 144 | @fromBackingInt(@intCast(try mf.getGlobalSymbol(std.mem.span(global_reloc.name), null))) | |
| 145 | 145 | else |
| 146 | 146 | return zcu.codegenFail(func.owner_nav, "external symbols unimplemented for {t}", .{lf.tag}), |
| 147 | 147 | mir.body[global_reloc.reloc.label], |
| ... | ... | @@ -189,7 +189,7 @@ fn emitReloc( |
| 189 | 189 | else => unreachable, |
| 190 | 190 | .data_processing_immediate => |decoded| if (lf.cast(.elf)) |ef| { |
| 191 | 191 | const zo = ef.zigObjectPtr().?; |
| 192 | const atom = zo.symbol(@intFromEnum(atom_index)).atom(ef).?; | |
| 192 | const atom = zo.symbol(@backingInt(atom_index)).atom(ef).?; | |
| 193 | 193 | const r_type: std.elf.R_AARCH64 = switch (decoded.decode()) { |
| 194 | 194 | else => unreachable, |
| 195 | 195 | .pc_relative_addressing => |pc_relative_addressing| switch (pc_relative_addressing.group.op) { |
| ... | ... | @@ -212,12 +212,12 @@ fn emitReloc( |
| 212 | 212 | }; |
| 213 | 213 | try atom.addReloc(gpa, .{ |
| 214 | 214 | .r_offset = offset, |
| 215 | .r_info = @as(u64, @intFromEnum(sym_index)) << 32 | @intFromEnum(r_type), | |
| 215 | .r_info = @as(u64, @backingInt(sym_index)) << 32 | @backingInt(r_type), | |
| 216 | 216 | .r_addend = @bitCast(addend), |
| 217 | 217 | }, zo); |
| 218 | 218 | } else if (lf.cast(.macho)) |mf| { |
| 219 | 219 | const zo = mf.getZigObject().?; |
| 220 | const atom = zo.symbols.items[@intFromEnum(atom_index)].getAtom(mf).?; | |
| 220 | const atom = zo.symbols.items[@backingInt(atom_index)].getAtom(mf).?; | |
| 221 | 221 | switch (decoded.decode()) { |
| 222 | 222 | else => unreachable, |
| 223 | 223 | .pc_relative_addressing => |pc_relative_addressing| switch (pc_relative_addressing.group.op) { |
| ... | ... | @@ -225,7 +225,7 @@ fn emitReloc( |
| 225 | 225 | .adrp => try atom.addReloc(mf, .{ |
| 226 | 226 | .tag = .@"extern", |
| 227 | 227 | .offset = offset, |
| 228 | .target = @intFromEnum(sym_index), | |
| 228 | .target = @backingInt(sym_index), | |
| 229 | 229 | .addend = @bitCast(addend), |
| 230 | 230 | .type = switch (kind) { |
| 231 | 231 | .direct => .page, |
| ... | ... | @@ -235,7 +235,7 @@ fn emitReloc( |
| 235 | 235 | .pcrel = true, |
| 236 | 236 | .has_subtractor = false, |
| 237 | 237 | .length = 2, |
| 238 | .symbolnum = @intCast(@intFromEnum(sym_index)), | |
| 238 | .symbolnum = @intCast(@backingInt(sym_index)), | |
| 239 | 239 | }, |
| 240 | 240 | }), |
| 241 | 241 | }, |
| ... | ... | @@ -243,7 +243,7 @@ fn emitReloc( |
| 243 | 243 | .add => try atom.addReloc(mf, .{ |
| 244 | 244 | .tag = .@"extern", |
| 245 | 245 | .offset = offset, |
| 246 | .target = @intFromEnum(sym_index), | |
| 246 | .target = @backingInt(sym_index), | |
| 247 | 247 | .addend = @bitCast(addend), |
| 248 | 248 | .type = switch (kind) { |
| 249 | 249 | .direct => .pageoff, |
| ... | ... | @@ -253,7 +253,7 @@ fn emitReloc( |
| 253 | 253 | .pcrel = false, |
| 254 | 254 | .has_subtractor = false, |
| 255 | 255 | .length = 2, |
| 256 | .symbolnum = @intCast(@intFromEnum(sym_index)), | |
| 256 | .symbolnum = @intCast(@backingInt(sym_index)), | |
| 257 | 257 | }, |
| 258 | 258 | }), |
| 259 | 259 | .sub => unreachable, |
| ... | ... | @@ -262,36 +262,36 @@ fn emitReloc( |
| 262 | 262 | }, |
| 263 | 263 | .branch_exception_generating_system => |decoded| if (lf.cast(.elf)) |ef| { |
| 264 | 264 | const zo = ef.zigObjectPtr().?; |
| 265 | const atom = zo.symbol(@intFromEnum(atom_index)).atom(ef).?; | |
| 265 | const atom = zo.symbol(@backingInt(atom_index)).atom(ef).?; | |
| 266 | 266 | const r_type: std.elf.R_AARCH64 = switch (decoded.decode().unconditional_branch_immediate.group.op) { |
| 267 | 267 | .b => .JUMP26, |
| 268 | 268 | .bl => .CALL26, |
| 269 | 269 | }; |
| 270 | 270 | try atom.addReloc(gpa, .{ |
| 271 | 271 | .r_offset = offset, |
| 272 | .r_info = @as(u64, @intFromEnum(sym_index)) << 32 | @intFromEnum(r_type), | |
| 272 | .r_info = @as(u64, @backingInt(sym_index)) << 32 | @backingInt(r_type), | |
| 273 | 273 | .r_addend = @bitCast(addend), |
| 274 | 274 | }, zo); |
| 275 | 275 | } else if (lf.cast(.macho)) |mf| { |
| 276 | 276 | const zo = mf.getZigObject().?; |
| 277 | const atom = zo.symbols.items[@intFromEnum(atom_index)].getAtom(mf).?; | |
| 277 | const atom = zo.symbols.items[@backingInt(atom_index)].getAtom(mf).?; | |
| 278 | 278 | try atom.addReloc(mf, .{ |
| 279 | 279 | .tag = .@"extern", |
| 280 | 280 | .offset = offset, |
| 281 | .target = @intFromEnum(sym_index), | |
| 281 | .target = @backingInt(sym_index), | |
| 282 | 282 | .addend = @bitCast(addend), |
| 283 | 283 | .type = .branch, |
| 284 | 284 | .meta = .{ |
| 285 | 285 | .pcrel = true, |
| 286 | 286 | .has_subtractor = false, |
| 287 | 287 | .length = 2, |
| 288 | .symbolnum = @intCast(@intFromEnum(sym_index)), | |
| 288 | .symbolnum = @intCast(@backingInt(sym_index)), | |
| 289 | 289 | }, |
| 290 | 290 | }); |
| 291 | 291 | }, |
| 292 | 292 | .load_store => |decoded| if (lf.cast(.elf)) |ef| { |
| 293 | 293 | const zo = ef.zigObjectPtr().?; |
| 294 | const atom = zo.symbol(@intFromEnum(atom_index)).atom(ef).?; | |
| 294 | const atom = zo.symbol(@backingInt(atom_index)).atom(ef).?; | |
| 295 | 295 | const r_type: std.elf.R_AARCH64 = switch (decoded.decode().register_unsigned_immediate.decode()) { |
| 296 | 296 | .integer => |integer| switch (integer.decode()) { |
| 297 | 297 | .unallocated, .prfm => unreachable, |
| ... | ... | @@ -332,16 +332,16 @@ fn emitReloc( |
| 332 | 332 | }; |
| 333 | 333 | try atom.addReloc(gpa, .{ |
| 334 | 334 | .r_offset = offset, |
| 335 | .r_info = @as(u64, @intFromEnum(sym_index)) << 32 | @intFromEnum(r_type), | |
| 335 | .r_info = @as(u64, @backingInt(sym_index)) << 32 | @backingInt(r_type), | |
| 336 | 336 | .r_addend = @bitCast(addend), |
| 337 | 337 | }, zo); |
| 338 | 338 | } else if (lf.cast(.macho)) |mf| { |
| 339 | 339 | const zo = mf.getZigObject().?; |
| 340 | const atom = zo.symbols.items[@intFromEnum(atom_index)].getAtom(mf).?; | |
| 340 | const atom = zo.symbols.items[@backingInt(atom_index)].getAtom(mf).?; | |
| 341 | 341 | try atom.addReloc(mf, .{ |
| 342 | 342 | .tag = .@"extern", |
| 343 | 343 | .offset = offset, |
| 344 | .target = @intFromEnum(sym_index), | |
| 344 | .target = @backingInt(sym_index), | |
| 345 | 345 | .addend = @bitCast(addend), |
| 346 | 346 | .type = switch (kind) { |
| 347 | 347 | .direct => .pageoff, |
| ... | ... | @@ -351,7 +351,7 @@ fn emitReloc( |
| 351 | 351 | .pcrel = false, |
| 352 | 352 | .has_subtractor = false, |
| 353 | 353 | .length = 2, |
| 354 | .symbolnum = @intCast(@intFromEnum(sym_index)), | |
| 354 | .symbolnum = @intCast(@backingInt(sym_index)), | |
| 355 | 355 | }, |
| 356 | 356 | }); |
| 357 | 357 | }, |
src/codegen/aarch64/Select.zig+111-111| ... | ... | @@ -52,9 +52,9 @@ pub const Block = struct { |
| 52 | 52 | live_registers: LiveRegisters, |
| 53 | 53 | target_label: u32, |
| 54 | 54 | |
| 55 | pub const main: Air.Inst.Index = @enumFromInt( | |
| 55 | pub const main: Air.Inst.Index = @fromBackingInt(@intCast( | |
| 56 | 56 | std.math.maxInt(@typeInfo(Air.Inst.Index).@"enum".tag_type), |
| 57 | ); | |
| 57 | )); | |
| 58 | 58 | |
| 59 | 59 | fn branch(target_block: *const Block, isel: *Select) !void { |
| 60 | 60 | if (isel.instructions.items.len > target_block.target_label) { |
| ... | ... | @@ -72,19 +72,19 @@ pub const Loop = struct { |
| 72 | 72 | live_registers: LiveRegisters, |
| 73 | 73 | repeat_list: u32, |
| 74 | 74 | |
| 75 | pub const invalid: Air.Inst.Index = @enumFromInt( | |
| 75 | pub const invalid: Air.Inst.Index = @fromBackingInt(@intCast( | |
| 76 | 76 | std.math.maxInt(@typeInfo(Air.Inst.Index).@"enum".tag_type), |
| 77 | ); | |
| 77 | )); | |
| 78 | 78 | |
| 79 | 79 | pub const Index = enum(u32) { |
| 80 | 80 | _, |
| 81 | 81 | |
| 82 | 82 | fn inst(li: Loop.Index, isel: *Select) Air.Inst.Index { |
| 83 | return isel.loops.keys()[@intFromEnum(li)]; | |
| 83 | return isel.loops.keys()[@backingInt(li)]; | |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | fn get(li: Loop.Index, isel: *Select) *Loop { |
| 87 | return &isel.loops.values()[@intFromEnum(li)]; | |
| 87 | return &isel.loops.values()[@backingInt(li)]; | |
| 88 | 88 | } |
| 89 | 89 | }; |
| 90 | 90 | |
| ... | ... | @@ -133,7 +133,7 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { |
| 133 | 133 | var air_body_index: usize = 0; |
| 134 | 134 | var air_inst_index = air_body[air_body_index]; |
| 135 | 135 | const initial_def_order_len = isel.def_order.count(); |
| 136 | air_tag: switch (air_tags[@intFromEnum(air_inst_index)]) { | |
| 136 | air_tag: switch (air_tags[@backingInt(air_inst_index)]) { | |
| 137 | 137 | // No "scalarize" legalizations are enabled, so these instructions never appear. |
| 138 | 138 | .legalize_vec_elem_val => unreachable, |
| 139 | 139 | .legalize_vec_store_elem => unreachable, |
| ... | ... | @@ -152,7 +152,7 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { |
| 152 | 152 | |
| 153 | 153 | air_body_index += 1; |
| 154 | 154 | air_inst_index = air_body[air_body_index]; |
| 155 | continue :air_tag air_tags[@intFromEnum(air_inst_index)]; | |
| 155 | continue :air_tag air_tags[@backingInt(air_inst_index)]; | |
| 156 | 156 | }, |
| 157 | 157 | .add, |
| 158 | 158 | .add_safe, |
| ... | ... | @@ -209,7 +209,7 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { |
| 209 | 209 | .slice_elem_val, |
| 210 | 210 | .ptr_elem_val, |
| 211 | 211 | => { |
| 212 | const bin_op = air_data[@intFromEnum(air_inst_index)].bin_op; | |
| 212 | const bin_op = air_data[@backingInt(air_inst_index)].bin_op; | |
| 213 | 213 | |
| 214 | 214 | try isel.analyzeUse(bin_op.lhs); |
| 215 | 215 | try isel.analyzeUse(bin_op.rhs); |
| ... | ... | @@ -217,7 +217,7 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { |
| 217 | 217 | |
| 218 | 218 | air_body_index += 1; |
| 219 | 219 | air_inst_index = air_body[air_body_index]; |
| 220 | continue :air_tag air_tags[@intFromEnum(air_inst_index)]; | |
| 220 | continue :air_tag air_tags[@backingInt(air_inst_index)]; | |
| 221 | 221 | }, |
| 222 | 222 | .ptr_add, |
| 223 | 223 | .ptr_sub, |
| ... | ... | @@ -229,7 +229,7 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { |
| 229 | 229 | .slice_elem_ptr, |
| 230 | 230 | .ptr_elem_ptr, |
| 231 | 231 | => { |
| 232 | const ty_pl = air_data[@intFromEnum(air_inst_index)].ty_pl; | |
| 232 | const ty_pl = air_data[@backingInt(air_inst_index)].ty_pl; | |
| 233 | 233 | const bin_op = isel.air.extraData(Air.Bin, ty_pl.payload).data; |
| 234 | 234 | |
| 235 | 235 | try isel.analyzeUse(bin_op.lhs); |
| ... | ... | @@ -238,17 +238,17 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { |
| 238 | 238 | |
| 239 | 239 | air_body_index += 1; |
| 240 | 240 | air_inst_index = air_body[air_body_index]; |
| 241 | continue :air_tag air_tags[@intFromEnum(air_inst_index)]; | |
| 241 | continue :air_tag air_tags[@backingInt(air_inst_index)]; | |
| 242 | 242 | }, |
| 243 | 243 | .alloc => { |
| 244 | const ty = air_data[@intFromEnum(air_inst_index)].ty; | |
| 244 | const ty = air_data[@backingInt(air_inst_index)].ty; | |
| 245 | 245 | |
| 246 | 246 | isel.stack_align = isel.stack_align.maxStrict(ty.ptrAlignment(zcu)); |
| 247 | 247 | try isel.def_order.putNoClobber(gpa, air_inst_index, {}); |
| 248 | 248 | |
| 249 | 249 | air_body_index += 1; |
| 250 | 250 | air_inst_index = air_body[air_body_index]; |
| 251 | continue :air_tag air_tags[@intFromEnum(air_inst_index)]; | |
| 251 | continue :air_tag air_tags[@backingInt(air_inst_index)]; | |
| 252 | 252 | }, |
| 253 | 253 | .inferred_alloc, |
| 254 | 254 | .inferred_alloc_comptime, |
| ... | ... | @@ -260,7 +260,7 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { |
| 260 | 260 | .spirv_runtime_array_len, |
| 261 | 261 | => unreachable, |
| 262 | 262 | .ret_ptr => { |
| 263 | const ty = air_data[@intFromEnum(air_inst_index)].ty; | |
| 263 | const ty = air_data[@backingInt(air_inst_index)].ty; | |
| 264 | 264 | |
| 265 | 265 | if (isel.live_values.get(Block.main)) |ret_vi| switch (ret_vi.parent(isel)) { |
| 266 | 266 | .unallocated, .stack_slot => isel.stack_align = isel.stack_align.maxStrict(ty.ptrAlignment(zcu)), |
| ... | ... | @@ -271,10 +271,10 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { |
| 271 | 271 | |
| 272 | 272 | air_body_index += 1; |
| 273 | 273 | air_inst_index = air_body[air_body_index]; |
| 274 | continue :air_tag air_tags[@intFromEnum(air_inst_index)]; | |
| 274 | continue :air_tag air_tags[@backingInt(air_inst_index)]; | |
| 275 | 275 | }, |
| 276 | 276 | .assembly => { |
| 277 | const ty_pl = air_data[@intFromEnum(air_inst_index)].ty_pl; | |
| 277 | const ty_pl = air_data[@backingInt(air_inst_index)].ty_pl; | |
| 278 | 278 | const unwrapped_asm = isel.air.unwrapAsm(air_inst_index); |
| 279 | 279 | |
| 280 | 280 | for (unwrapped_asm.outputs) |operand| if (operand != .none) try isel.analyzeUse(operand); |
| ... | ... | @@ -282,7 +282,7 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { |
| 282 | 282 | |
| 283 | 283 | air_body_index += 1; |
| 284 | 284 | air_inst_index = air_body[air_body_index]; |
| 285 | continue :air_tag air_tags[@intFromEnum(air_inst_index)]; | |
| 285 | continue :air_tag air_tags[@backingInt(air_inst_index)]; | |
| 286 | 286 | }, |
| 287 | 287 | .not, |
| 288 | 288 | .clz, |
| ... | ... | @@ -327,14 +327,14 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { |
| 327 | 327 | .c_va_arg, |
| 328 | 328 | .c_va_copy, |
| 329 | 329 | => { |
| 330 | const ty_op = air_data[@intFromEnum(air_inst_index)].ty_op; | |
| 330 | const ty_op = air_data[@backingInt(air_inst_index)].ty_op; | |
| 331 | 331 | |
| 332 | 332 | try isel.analyzeUse(ty_op.operand); |
| 333 | 333 | try isel.def_order.putNoClobber(gpa, air_inst_index, {}); |
| 334 | 334 | |
| 335 | 335 | air_body_index += 1; |
| 336 | 336 | air_inst_index = air_body[air_body_index]; |
| 337 | continue :air_tag air_tags[@intFromEnum(air_inst_index)]; | |
| 337 | continue :air_tag air_tags[@backingInt(air_inst_index)]; | |
| 338 | 338 | }, |
| 339 | 339 | .bit_cast, |
| 340 | 340 | .ptr_cast, |
| ... | ... | @@ -345,7 +345,7 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { |
| 345 | 345 | .int_from_error, |
| 346 | 346 | .union_from_enum, |
| 347 | 347 | => { |
| 348 | const ty_op = air_data[@intFromEnum(air_inst_index)].ty_op; | |
| 348 | const ty_op = air_data[@backingInt(air_inst_index)].ty_op; | |
| 349 | 349 | maybe_noop: { |
| 350 | 350 | if (ty_op.ty.toInterned().? != isel.air.typeOf(ty_op.operand, ip).toIntern()) break :maybe_noop; |
| 351 | 351 | if (true) break :maybe_noop; |
| ... | ... | @@ -360,7 +360,7 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { |
| 360 | 360 | |
| 361 | 361 | air_body_index += 1; |
| 362 | 362 | air_inst_index = air_body[air_body_index]; |
| 363 | continue :air_tag air_tags[@intFromEnum(air_inst_index)]; | |
| 363 | continue :air_tag air_tags[@backingInt(air_inst_index)]; | |
| 364 | 364 | }, |
| 365 | 365 | .bit_cast_safe => unreachable, // legalized |
| 366 | 366 | inline .block, .dbg_inline_block => |air_tag| { |
| ... | ... | @@ -388,7 +388,7 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { |
| 388 | 388 | |
| 389 | 389 | air_body_index += 1; |
| 390 | 390 | air_inst_index = air_body[air_body_index]; |
| 391 | continue :air_tag air_tags[@intFromEnum(air_inst_index)]; | |
| 391 | continue :air_tag air_tags[@backingInt(air_inst_index)]; | |
| 392 | 392 | }, |
| 393 | 393 | .loop => { |
| 394 | 394 | const air_body_block = isel.air.unwrapBlock(air_inst_index); |
| ... | ... | @@ -397,7 +397,7 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { |
| 397 | 397 | const initial_dom_len = isel.dom_len; |
| 398 | 398 | isel.dom_start = @intCast(isel.dom.items.len); |
| 399 | 399 | isel.dom_len = @intCast(isel.blocks.count()); |
| 400 | try isel.active_loops.append(gpa, @enumFromInt(isel.loops.count())); | |
| 400 | try isel.active_loops.append(gpa, @fromBackingInt(@intCast(isel.loops.count()))); | |
| 401 | 401 | try isel.loops.putNoClobber(gpa, air_inst_index, .{ |
| 402 | 402 | .def_order = @intCast(isel.def_order.count()), |
| 403 | 403 | .dom = isel.dom_start, |
| ... | ... | @@ -420,7 +420,7 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { |
| 420 | 420 | }, |
| 421 | 421 | .repeat, .trap, .unreach => air_body_index += 1, |
| 422 | 422 | .br => { |
| 423 | const br = air_data[@intFromEnum(air_inst_index)].br; | |
| 423 | const br = air_data[@backingInt(air_inst_index)].br; | |
| 424 | 424 | const block_index = isel.blocks.getIndex(br.block_inst).?; |
| 425 | 425 | if (block_index < isel.dom_len) isel.dom.items[isel.dom_start + block_index / @bitSizeOf(DomInt)] |= @as(DomInt, 1) << @truncate(block_index); |
| 426 | 426 | try isel.analyzeUse(br.operand); |
| ... | ... | @@ -430,7 +430,7 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { |
| 430 | 430 | .breakpoint, .dbg_stmt, .dbg_empty_stmt, .dbg_var_ptr, .dbg_var_val, .dbg_arg_inline, .c_va_end => { |
| 431 | 431 | air_body_index += 1; |
| 432 | 432 | air_inst_index = air_body[air_body_index]; |
| 433 | continue :air_tag air_tags[@intFromEnum(air_inst_index)]; | |
| 433 | continue :air_tag air_tags[@backingInt(air_inst_index)]; | |
| 434 | 434 | }, |
| 435 | 435 | .call, |
| 436 | 436 | .call_always_tail, |
| ... | ... | @@ -486,7 +486,7 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { |
| 486 | 486 | |
| 487 | 487 | var ret_it: CallAbiIterator = .init; |
| 488 | 488 | if (try ret_it.ret(isel, isel.air.typeOfIndex(air_inst_index, ip))) |ret_vi| { |
| 489 | tracking_log.debug("${d} <- %{d}", .{ @intFromEnum(ret_vi), @intFromEnum(air_inst_index) }); | |
| 489 | tracking_log.debug("${d} <- %{d}", .{ @backingInt(ret_vi), @backingInt(air_inst_index) }); | |
| 490 | 490 | switch (ret_vi.parent(isel)) { |
| 491 | 491 | .unallocated, .stack_slot => {}, |
| 492 | 492 | .value, .constant => unreachable, |
| ... | ... | @@ -504,7 +504,7 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { |
| 504 | 504 | |
| 505 | 505 | air_body_index += 1; |
| 506 | 506 | air_inst_index = air_body[air_body_index]; |
| 507 | continue :air_tag air_tags[@intFromEnum(air_inst_index)]; | |
| 507 | continue :air_tag air_tags[@backingInt(air_inst_index)]; | |
| 508 | 508 | }, |
| 509 | 509 | .sqrt, |
| 510 | 510 | .sin, |
| ... | ... | @@ -534,17 +534,17 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { |
| 534 | 534 | .error_name, |
| 535 | 535 | .cmp_lte_errors_len, |
| 536 | 536 | => { |
| 537 | const un_op = air_data[@intFromEnum(air_inst_index)].un_op; | |
| 537 | const un_op = air_data[@backingInt(air_inst_index)].un_op; | |
| 538 | 538 | |
| 539 | 539 | try isel.analyzeUse(un_op); |
| 540 | 540 | try isel.def_order.putNoClobber(gpa, air_inst_index, {}); |
| 541 | 541 | |
| 542 | 542 | air_body_index += 1; |
| 543 | 543 | air_inst_index = air_body[air_body_index]; |
| 544 | continue :air_tag air_tags[@intFromEnum(air_inst_index)]; | |
| 544 | continue :air_tag air_tags[@backingInt(air_inst_index)]; | |
| 545 | 545 | }, |
| 546 | 546 | .cmp_vector, .cmp_vector_optimized => { |
| 547 | const ty_pl = air_data[@intFromEnum(air_inst_index)].ty_pl; | |
| 547 | const ty_pl = air_data[@backingInt(air_inst_index)].ty_pl; | |
| 548 | 548 | const extra = isel.air.extraData(Air.VectorCmp, ty_pl.payload).data; |
| 549 | 549 | |
| 550 | 550 | try isel.analyzeUse(extra.lhs); |
| ... | ... | @@ -553,7 +553,7 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { |
| 553 | 553 | |
| 554 | 554 | air_body_index += 1; |
| 555 | 555 | air_inst_index = air_body[air_body_index]; |
| 556 | continue :air_tag air_tags[@intFromEnum(air_inst_index)]; | |
| 556 | continue :air_tag air_tags[@backingInt(air_inst_index)]; | |
| 557 | 557 | }, |
| 558 | 558 | .cond_br => { |
| 559 | 559 | const cond_br = isel.air.unwrapCondBr(air_inst_index); |
| ... | ... | @@ -583,7 +583,7 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { |
| 583 | 583 | const initial_dom_len = isel.dom_len; |
| 584 | 584 | isel.dom_start = @intCast(isel.dom.items.len); |
| 585 | 585 | isel.dom_len = @intCast(isel.blocks.count()); |
| 586 | try isel.active_loops.append(gpa, @enumFromInt(isel.loops.count())); | |
| 586 | try isel.active_loops.append(gpa, @fromBackingInt(@intCast(isel.loops.count()))); | |
| 587 | 587 | try isel.loops.putNoClobber(gpa, air_inst_index, .{ |
| 588 | 588 | .def_order = @intCast(isel.def_order.count()), |
| 589 | 589 | .dom = isel.dom_start, |
| ... | ... | @@ -609,7 +609,7 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { |
| 609 | 609 | air_body_index += 1; |
| 610 | 610 | }, |
| 611 | 611 | .switch_dispatch => { |
| 612 | const br = air_data[@intFromEnum(air_inst_index)].br; | |
| 612 | const br = air_data[@backingInt(air_inst_index)].br; | |
| 613 | 613 | |
| 614 | 614 | try isel.analyzeUse(br.operand); |
| 615 | 615 | |
| ... | ... | @@ -624,7 +624,7 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { |
| 624 | 624 | |
| 625 | 625 | air_body_index += 1; |
| 626 | 626 | air_inst_index = air_body[air_body_index]; |
| 627 | continue :air_tag air_tags[@intFromEnum(air_inst_index)]; | |
| 627 | continue :air_tag air_tags[@backingInt(air_inst_index)]; | |
| 628 | 628 | }, |
| 629 | 629 | .try_ptr, .try_ptr_cold => { |
| 630 | 630 | const unwrapped_try = isel.air.unwrapTryPtr(air_inst_index); |
| ... | ... | @@ -635,10 +635,10 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { |
| 635 | 635 | |
| 636 | 636 | air_body_index += 1; |
| 637 | 637 | air_inst_index = air_body[air_body_index]; |
| 638 | continue :air_tag air_tags[@intFromEnum(air_inst_index)]; | |
| 638 | continue :air_tag air_tags[@backingInt(air_inst_index)]; | |
| 639 | 639 | }, |
| 640 | 640 | .ret, .ret_safe, .ret_load => { |
| 641 | const un_op = air_data[@intFromEnum(air_inst_index)].un_op; | |
| 641 | const un_op = air_data[@backingInt(air_inst_index)].un_op; | |
| 642 | 642 | isel.returns = true; |
| 643 | 643 | |
| 644 | 644 | const block_index = 0; |
| ... | ... | @@ -661,17 +661,17 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { |
| 661 | 661 | .atomic_store_release, |
| 662 | 662 | .atomic_store_seq_cst, |
| 663 | 663 | => { |
| 664 | const bin_op = air_data[@intFromEnum(air_inst_index)].bin_op; | |
| 664 | const bin_op = air_data[@backingInt(air_inst_index)].bin_op; | |
| 665 | 665 | |
| 666 | 666 | try isel.analyzeUse(bin_op.lhs); |
| 667 | 667 | try isel.analyzeUse(bin_op.rhs); |
| 668 | 668 | |
| 669 | 669 | air_body_index += 1; |
| 670 | 670 | air_inst_index = air_body[air_body_index]; |
| 671 | continue :air_tag air_tags[@intFromEnum(air_inst_index)]; | |
| 671 | continue :air_tag air_tags[@backingInt(air_inst_index)]; | |
| 672 | 672 | }, |
| 673 | 673 | .struct_field_ptr, .agg_field_val => { |
| 674 | const ty_pl = air_data[@intFromEnum(air_inst_index)].ty_pl; | |
| 674 | const ty_pl = air_data[@backingInt(air_inst_index)].ty_pl; | |
| 675 | 675 | const extra = isel.air.extraData(Air.StructField, ty_pl.payload).data; |
| 676 | 676 | |
| 677 | 677 | try isel.analyzeUse(extra.struct_operand); |
| ... | ... | @@ -679,10 +679,10 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { |
| 679 | 679 | |
| 680 | 680 | air_body_index += 1; |
| 681 | 681 | air_inst_index = air_body[air_body_index]; |
| 682 | continue :air_tag air_tags[@intFromEnum(air_inst_index)]; | |
| 682 | continue :air_tag air_tags[@backingInt(air_inst_index)]; | |
| 683 | 683 | }, |
| 684 | 684 | .slice_len => { |
| 685 | const ty_op = air_data[@intFromEnum(air_inst_index)].ty_op; | |
| 685 | const ty_op = air_data[@backingInt(air_inst_index)].ty_op; | |
| 686 | 686 | |
| 687 | 687 | try isel.analyzeUse(ty_op.operand); |
| 688 | 688 | try isel.def_order.putNoClobber(gpa, air_inst_index, {}); |
| ... | ... | @@ -694,10 +694,10 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { |
| 694 | 694 | |
| 695 | 695 | air_body_index += 1; |
| 696 | 696 | air_inst_index = air_body[air_body_index]; |
| 697 | continue :air_tag air_tags[@intFromEnum(air_inst_index)]; | |
| 697 | continue :air_tag air_tags[@backingInt(air_inst_index)]; | |
| 698 | 698 | }, |
| 699 | 699 | .slice_ptr => { |
| 700 | const ty_op = air_data[@intFromEnum(air_inst_index)].ty_op; | |
| 700 | const ty_op = air_data[@backingInt(air_inst_index)].ty_op; | |
| 701 | 701 | |
| 702 | 702 | try isel.analyzeUse(ty_op.operand); |
| 703 | 703 | try isel.def_order.putNoClobber(gpa, air_inst_index, {}); |
| ... | ... | @@ -709,17 +709,17 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { |
| 709 | 709 | |
| 710 | 710 | air_body_index += 1; |
| 711 | 711 | air_inst_index = air_body[air_body_index]; |
| 712 | continue :air_tag air_tags[@intFromEnum(air_inst_index)]; | |
| 712 | continue :air_tag air_tags[@backingInt(air_inst_index)]; | |
| 713 | 713 | }, |
| 714 | 714 | .reduce, .reduce_optimized => { |
| 715 | const reduce = air_data[@intFromEnum(air_inst_index)].reduce; | |
| 715 | const reduce = air_data[@backingInt(air_inst_index)].reduce; | |
| 716 | 716 | |
| 717 | 717 | try isel.analyzeUse(reduce.operand); |
| 718 | 718 | try isel.def_order.putNoClobber(gpa, air_inst_index, {}); |
| 719 | 719 | |
| 720 | 720 | air_body_index += 1; |
| 721 | 721 | air_inst_index = air_body[air_body_index]; |
| 722 | continue :air_tag air_tags[@intFromEnum(air_inst_index)]; | |
| 722 | continue :air_tag air_tags[@backingInt(air_inst_index)]; | |
| 723 | 723 | }, |
| 724 | 724 | .shuffle_one => { |
| 725 | 725 | const extra = isel.air.unwrapShuffleOne(zcu, air_inst_index); |
| ... | ... | @@ -729,7 +729,7 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { |
| 729 | 729 | |
| 730 | 730 | air_body_index += 1; |
| 731 | 731 | air_inst_index = air_body[air_body_index]; |
| 732 | continue :air_tag air_tags[@intFromEnum(air_inst_index)]; | |
| 732 | continue :air_tag air_tags[@backingInt(air_inst_index)]; | |
| 733 | 733 | }, |
| 734 | 734 | .shuffle_two => { |
| 735 | 735 | const extra = isel.air.unwrapShuffleTwo(zcu, air_inst_index); |
| ... | ... | @@ -740,10 +740,10 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { |
| 740 | 740 | |
| 741 | 741 | air_body_index += 1; |
| 742 | 742 | air_inst_index = air_body[air_body_index]; |
| 743 | continue :air_tag air_tags[@intFromEnum(air_inst_index)]; | |
| 743 | continue :air_tag air_tags[@backingInt(air_inst_index)]; | |
| 744 | 744 | }, |
| 745 | 745 | .select, .mul_add => { |
| 746 | const pl_op = air_data[@intFromEnum(air_inst_index)].pl_op; | |
| 746 | const pl_op = air_data[@backingInt(air_inst_index)].pl_op; | |
| 747 | 747 | const bin_op = isel.air.extraData(Air.Bin, pl_op.payload).data; |
| 748 | 748 | |
| 749 | 749 | try isel.analyzeUse(pl_op.operand); |
| ... | ... | @@ -753,10 +753,10 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { |
| 753 | 753 | |
| 754 | 754 | air_body_index += 1; |
| 755 | 755 | air_inst_index = air_body[air_body_index]; |
| 756 | continue :air_tag air_tags[@intFromEnum(air_inst_index)]; | |
| 756 | continue :air_tag air_tags[@backingInt(air_inst_index)]; | |
| 757 | 757 | }, |
| 758 | 758 | .cmpxchg_weak, .cmpxchg_strong => { |
| 759 | const ty_pl = air_data[@intFromEnum(air_inst_index)].ty_pl; | |
| 759 | const ty_pl = air_data[@backingInt(air_inst_index)].ty_pl; | |
| 760 | 760 | const extra = isel.air.extraData(Air.Cmpxchg, ty_pl.payload).data; |
| 761 | 761 | |
| 762 | 762 | try isel.analyzeUse(extra.ptr); |
| ... | ... | @@ -766,20 +766,20 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { |
| 766 | 766 | |
| 767 | 767 | air_body_index += 1; |
| 768 | 768 | air_inst_index = air_body[air_body_index]; |
| 769 | continue :air_tag air_tags[@intFromEnum(air_inst_index)]; | |
| 769 | continue :air_tag air_tags[@backingInt(air_inst_index)]; | |
| 770 | 770 | }, |
| 771 | 771 | .atomic_load => { |
| 772 | const atomic_load = air_data[@intFromEnum(air_inst_index)].atomic_load; | |
| 772 | const atomic_load = air_data[@backingInt(air_inst_index)].atomic_load; | |
| 773 | 773 | |
| 774 | 774 | try isel.analyzeUse(atomic_load.ptr); |
| 775 | 775 | try isel.def_order.putNoClobber(gpa, air_inst_index, {}); |
| 776 | 776 | |
| 777 | 777 | air_body_index += 1; |
| 778 | 778 | air_inst_index = air_body[air_body_index]; |
| 779 | continue :air_tag air_tags[@intFromEnum(air_inst_index)]; | |
| 779 | continue :air_tag air_tags[@backingInt(air_inst_index)]; | |
| 780 | 780 | }, |
| 781 | 781 | .atomic_rmw => { |
| 782 | const pl_op = air_data[@intFromEnum(air_inst_index)].pl_op; | |
| 782 | const pl_op = air_data[@backingInt(air_inst_index)].pl_op; | |
| 783 | 783 | const extra = isel.air.extraData(Air.AtomicRmw, pl_op.payload).data; |
| 784 | 784 | |
| 785 | 785 | try isel.analyzeUse(extra.operand); |
| ... | ... | @@ -787,10 +787,10 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { |
| 787 | 787 | |
| 788 | 788 | air_body_index += 1; |
| 789 | 789 | air_inst_index = air_body[air_body_index]; |
| 790 | continue :air_tag air_tags[@intFromEnum(air_inst_index)]; | |
| 790 | continue :air_tag air_tags[@backingInt(air_inst_index)]; | |
| 791 | 791 | }, |
| 792 | 792 | .aggregate_init => { |
| 793 | const ty_pl = air_data[@intFromEnum(air_inst_index)].ty_pl; | |
| 793 | const ty_pl = air_data[@backingInt(air_inst_index)].ty_pl; | |
| 794 | 794 | const elements: []const Air.Inst.Ref = @ptrCast(isel.air.extra.items[ty_pl.payload..][0..@intCast(ty_pl.ty.toType().arrayLen(zcu))]); |
| 795 | 795 | |
| 796 | 796 | for (elements) |element| try isel.analyzeUse(element); |
| ... | ... | @@ -798,10 +798,10 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { |
| 798 | 798 | |
| 799 | 799 | air_body_index += 1; |
| 800 | 800 | air_inst_index = air_body[air_body_index]; |
| 801 | continue :air_tag air_tags[@intFromEnum(air_inst_index)]; | |
| 801 | continue :air_tag air_tags[@backingInt(air_inst_index)]; | |
| 802 | 802 | }, |
| 803 | 803 | .union_init => { |
| 804 | const ty_pl = air_data[@intFromEnum(air_inst_index)].ty_pl; | |
| 804 | const ty_pl = air_data[@backingInt(air_inst_index)].ty_pl; | |
| 805 | 805 | const extra = isel.air.extraData(Air.UnionInit, ty_pl.payload).data; |
| 806 | 806 | |
| 807 | 807 | try isel.analyzeUse(extra.init); |
| ... | ... | @@ -809,19 +809,19 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { |
| 809 | 809 | |
| 810 | 810 | air_body_index += 1; |
| 811 | 811 | air_inst_index = air_body[air_body_index]; |
| 812 | continue :air_tag air_tags[@intFromEnum(air_inst_index)]; | |
| 812 | continue :air_tag air_tags[@backingInt(air_inst_index)]; | |
| 813 | 813 | }, |
| 814 | 814 | .prefetch => { |
| 815 | const prefetch = air_data[@intFromEnum(air_inst_index)].prefetch; | |
| 815 | const prefetch = air_data[@backingInt(air_inst_index)].prefetch; | |
| 816 | 816 | |
| 817 | 817 | try isel.analyzeUse(prefetch.ptr); |
| 818 | 818 | |
| 819 | 819 | air_body_index += 1; |
| 820 | 820 | air_inst_index = air_body[air_body_index]; |
| 821 | continue :air_tag air_tags[@intFromEnum(air_inst_index)]; | |
| 821 | continue :air_tag air_tags[@backingInt(air_inst_index)]; | |
| 822 | 822 | }, |
| 823 | 823 | .field_parent_ptr => { |
| 824 | const ty_pl = air_data[@intFromEnum(air_inst_index)].ty_pl; | |
| 824 | const ty_pl = air_data[@backingInt(air_inst_index)].ty_pl; | |
| 825 | 825 | const extra = isel.air.extraData(Air.FieldParentPtr, ty_pl.payload).data; |
| 826 | 826 | |
| 827 | 827 | try isel.analyzeUse(extra.field_ptr); |
| ... | ... | @@ -829,16 +829,16 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { |
| 829 | 829 | |
| 830 | 830 | air_body_index += 1; |
| 831 | 831 | air_inst_index = air_body[air_body_index]; |
| 832 | continue :air_tag air_tags[@intFromEnum(air_inst_index)]; | |
| 832 | continue :air_tag air_tags[@backingInt(air_inst_index)]; | |
| 833 | 833 | }, |
| 834 | 834 | .set_err_return_trace => { |
| 835 | const un_op = air_data[@intFromEnum(air_inst_index)].un_op; | |
| 835 | const un_op = air_data[@backingInt(air_inst_index)].un_op; | |
| 836 | 836 | |
| 837 | 837 | try isel.analyzeUse(un_op); |
| 838 | 838 | |
| 839 | 839 | air_body_index += 1; |
| 840 | 840 | air_inst_index = air_body[air_body_index]; |
| 841 | continue :air_tag air_tags[@intFromEnum(air_inst_index)]; | |
| 841 | continue :air_tag air_tags[@backingInt(air_inst_index)]; | |
| 842 | 842 | }, |
| 843 | 843 | } |
| 844 | 844 | assert(air_body_index == air_body.len); |
| ... | ... | @@ -923,11 +923,11 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory, |
| 923 | 923 | inst_index: Air.Inst.Index, |
| 924 | 924 | |
| 925 | 925 | fn tag(it: *@This(), inst_index: Air.Inst.Index) Air.Inst.Tag { |
| 926 | return it.tag_items[@intFromEnum(inst_index)]; | |
| 926 | return it.tag_items[@backingInt(inst_index)]; | |
| 927 | 927 | } |
| 928 | 928 | |
| 929 | 929 | fn data(it: *@This(), inst_index: Air.Inst.Index) Air.Inst.Data { |
| 930 | return it.data_items[@intFromEnum(inst_index)]; | |
| 930 | return it.data_items[@backingInt(inst_index)]; | |
| 931 | 931 | } |
| 932 | 932 | |
| 933 | 933 | fn next(it: *@This()) ?Air.Inst.Tag { |
| ... | ... | @@ -7619,7 +7619,7 @@ pub fn layout( |
| 7619 | 7619 | |
| 7620 | 7620 | // callee saved gr area |
| 7621 | 7621 | save_ra = .r19; |
| 7622 | while (save_ra != .r29) : (save_ra = @enumFromInt(@intFromEnum(save_ra) + 1)) { | |
| 7622 | while (save_ra != .r29) : (save_ra = @fromBackingInt(@intCast(@backingInt(save_ra) + 1))) { | |
| 7623 | 7623 | if (!isel.saved_registers.contains(save_ra)) continue; |
| 7624 | 7624 | saves_size = std.mem.alignForward(u10, saves_size, 8); |
| 7625 | 7625 | saves_buf[saves_len] = .{ |
| ... | ... | @@ -7641,7 +7641,7 @@ pub fn layout( |
| 7641 | 7641 | |
| 7642 | 7642 | // callee saved vr area |
| 7643 | 7643 | save_ra = .v8; |
| 7644 | while (save_ra != .v16) : (save_ra = @enumFromInt(@intFromEnum(save_ra) + 1)) { | |
| 7644 | while (save_ra != .v16) : (save_ra = @fromBackingInt(@intCast(@backingInt(save_ra) + 1))) { | |
| 7645 | 7645 | if (!isel.saved_registers.contains(save_ra)) continue; |
| 7646 | 7646 | saves_size = std.mem.alignForward(u10, saves_size, 8); |
| 7647 | 7647 | saves_buf[saves_len] = .{ |
| ... | ... | @@ -7681,7 +7681,7 @@ pub fn layout( |
| 7681 | 7681 | |
| 7682 | 7682 | // incoming vr arguments |
| 7683 | 7683 | save_ra = if (mod.strip) incoming.nsrn else CallAbiIterator.nsrn_start; |
| 7684 | while (save_ra != if (is_sysv_var_args) CallAbiIterator.nsrn_end else incoming.nsrn) : (save_ra = @enumFromInt(@intFromEnum(save_ra) + 1)) { | |
| 7684 | while (save_ra != if (is_sysv_var_args) CallAbiIterator.nsrn_end else incoming.nsrn) : (save_ra = @fromBackingInt(@intCast(@backingInt(save_ra) + 1))) { | |
| 7685 | 7685 | saves_size = std.mem.alignForward(u10, saves_size, 16); |
| 7686 | 7686 | saves_buf[saves_len] = .{ |
| 7687 | 7687 | .class = .vector, |
| ... | ... | @@ -7736,7 +7736,7 @@ pub fn layout( |
| 7736 | 7736 | 1 => saves_size += 8, |
| 7737 | 7737 | } |
| 7738 | 7738 | save_ra = if (mod.strip) incoming.ngrn else CallAbiIterator.ngrn_start; |
| 7739 | while (save_ra != if (is_sysv_var_args) CallAbiIterator.ngrn_end else incoming.ngrn) : (save_ra = @enumFromInt(@intFromEnum(save_ra) + 1)) { | |
| 7739 | while (save_ra != if (is_sysv_var_args) CallAbiIterator.ngrn_end else incoming.ngrn) : (save_ra = @fromBackingInt(@intCast(@backingInt(save_ra) + 1))) { | |
| 7740 | 7740 | saves_size = std.mem.alignForward(u10, saves_size, 8); |
| 7741 | 7741 | saves_buf[saves_len] = .{ |
| 7742 | 7742 | .class = .integer, |
| ... | ... | @@ -7917,7 +7917,7 @@ fn fmtDom(isel: *Select, inst: Air.Inst.Index, start: u32, len: u32) struct { |
| 7917 | 7917 | start: u32, |
| 7918 | 7918 | len: u32, |
| 7919 | 7919 | pub fn format(data: @This(), writer: *std.Io.Writer) std.Io.Writer.Error!void { |
| 7920 | try writer.print("%{d} -> {{", .{@intFromEnum(data.inst)}); | |
| 7920 | try writer.print("%{d} -> {{", .{@backingInt(data.inst)}); | |
| 7921 | 7921 | var first = true; |
| 7922 | 7922 | for (data.isel.blocks.keys()[0..data.len], 0..) |block_inst_index, dom_index| { |
| 7923 | 7923 | if (@as(u1, @truncate(data.isel.dom.items[ |
| ... | ... | @@ -7930,7 +7930,7 @@ fn fmtDom(isel: *Select, inst: Air.Inst.Index, start: u32, len: u32) struct { |
| 7930 | 7930 | } |
| 7931 | 7931 | switch (block_inst_index) { |
| 7932 | 7932 | Block.main => try writer.writeAll(" %main"), |
| 7933 | else => try writer.print(" %{d}", .{@intFromEnum(block_inst_index)}), | |
| 7933 | else => try writer.print(" %{d}", .{@backingInt(block_inst_index)}), | |
| 7934 | 7934 | } |
| 7935 | 7935 | } |
| 7936 | 7936 | if (!first) try writer.writeByte(' '); |
| ... | ... | @@ -7949,7 +7949,7 @@ fn fmtLoopLive(isel: *Select, loop_inst: Air.Inst.Index) struct { |
| 7949 | 7949 | const live_insts = |
| 7950 | 7950 | data.isel.loop_live.list.items[loops[loop_index].live..loops[loop_index + 1].live]; |
| 7951 | 7951 | |
| 7952 | try writer.print("%{d} <- {{", .{@intFromEnum(data.inst)}); | |
| 7952 | try writer.print("%{d} <- {{", .{@backingInt(data.inst)}); | |
| 7953 | 7953 | var first = true; |
| 7954 | 7954 | for (live_insts) |live_inst| { |
| 7955 | 7955 | if (first) { |
| ... | ... | @@ -7957,7 +7957,7 @@ fn fmtLoopLive(isel: *Select, loop_inst: Air.Inst.Index) struct { |
| 7957 | 7957 | } else { |
| 7958 | 7958 | try writer.writeByte(','); |
| 7959 | 7959 | } |
| 7960 | try writer.print(" %{d}", .{@intFromEnum(live_inst)}); | |
| 7960 | try writer.print(" %{d}", .{@backingInt(live_inst)}); | |
| 7961 | 7961 | } |
| 7962 | 7962 | if (!first) try writer.writeByte(' '); |
| 7963 | 7963 | try writer.writeByte('}'); |
| ... | ... | @@ -8090,7 +8090,7 @@ fn movImmediate(isel: *Select, dst_reg: Register, src_imm: u64) !void { |
| 8090 | 8090 | .doubleword => .xzr, |
| 8091 | 8091 | }, |
| 8092 | 8092 | .{ .immediate = .{ |
| 8093 | .N = @enumFromInt(elem_width >> 6), | |
| 8093 | .N = @fromBackingInt(@intCast(elem_width >> 6)), | |
| 8094 | 8094 | .immr = hi + mid_masked, |
| 8095 | 8095 | .imms = ((((lo + hi) & smask) | mid_masked) - 1) | -%@as(u6, @truncate(elem_width)) << 1, |
| 8096 | 8096 | } }, |
| ... | ... | @@ -8107,18 +8107,18 @@ fn movImmediate(isel: *Select, dst_reg: Register, src_imm: u64) !void { |
| 8107 | 8107 | try isel.emit(if (remaining_parts > 0) .movk( |
| 8108 | 8108 | dst_reg, |
| 8109 | 8109 | parts[part_index], |
| 8110 | .{ .lsl = @enumFromInt(part_index) }, | |
| 8110 | .{ .lsl = @fromBackingInt(@intCast(part_index)) }, | |
| 8111 | 8111 | ) else switch (fill_part) { |
| 8112 | 8112 | else => unreachable, |
| 8113 | 8113 | min_part => .movz( |
| 8114 | 8114 | dst_reg, |
| 8115 | 8115 | parts[part_index], |
| 8116 | .{ .lsl = @enumFromInt(part_index) }, | |
| 8116 | .{ .lsl = @fromBackingInt(@intCast(part_index)) }, | |
| 8117 | 8117 | ), |
| 8118 | 8118 | max_part => .movn( |
| 8119 | 8119 | dst_reg, |
| 8120 | 8120 | ~parts[part_index], |
| 8121 | .{ .lsl = @enumFromInt(part_index) }, | |
| 8121 | .{ .lsl = @fromBackingInt(@intCast(part_index)) }, | |
| 8122 | 8122 | ), |
| 8123 | 8123 | }); |
| 8124 | 8124 | } |
| ... | ... | @@ -8954,7 +8954,7 @@ pub const Value = struct { |
| 8954 | 8954 | _, |
| 8955 | 8955 | |
| 8956 | 8956 | fn get(vi: Value.Index, isel: *Select) *Value { |
| 8957 | return &isel.values.items[@intFromEnum(vi)]; | |
| 8957 | return &isel.values.items[@backingInt(vi)]; | |
| 8958 | 8958 | } |
| 8959 | 8959 | |
| 8960 | 8960 | fn setAlignment(vi: Value.Index, isel: *Select, new_alignment: InternPool.Alignment) void { |
| ... | ... | @@ -9099,15 +9099,15 @@ pub const Value = struct { |
| 9099 | 9099 | assert(parts_len > 1); |
| 9100 | 9100 | const value = vi.get(isel); |
| 9101 | 9101 | assert(value.flags.parts_len_minus_one == 0); |
| 9102 | value.parts = @enumFromInt(isel.values.items.len); | |
| 9102 | value.parts = @fromBackingInt(@intCast(isel.values.items.len)); | |
| 9103 | 9103 | value.flags.parts_len_minus_one = @intCast(parts_len - 1); |
| 9104 | 9104 | } |
| 9105 | 9105 | |
| 9106 | 9106 | fn addPart(vi: Value.Index, isel: *Select, part_offset: u64, part_size: u64) Value.Index { |
| 9107 | 9107 | const part_vi = isel.initValueAdvanced(vi.alignment(isel), part_offset, part_size); |
| 9108 | 9108 | tracking_log.debug("${d} <- ${d}[{d}]", .{ |
| 9109 | @intFromEnum(part_vi), | |
| 9110 | @intFromEnum(vi), | |
| 9109 | @backingInt(part_vi), | |
| 9110 | @backingInt(vi), | |
| 9111 | 9111 | part_offset, |
| 9112 | 9112 | }); |
| 9113 | 9113 | part_vi.setParent(isel, .{ .value = vi }); |
| ... | ... | @@ -9132,7 +9132,7 @@ pub const Value = struct { |
| 9132 | 9132 | const end_vi = vi.partAtOffset(isel, part_size - 1 + part_offset); |
| 9133 | 9133 | return .{ |
| 9134 | 9134 | .vi = start_vi, |
| 9135 | .remaining = @intCast(@intFromEnum(end_vi) - @intFromEnum(start_vi) + 1), | |
| 9135 | .remaining = @intCast(@backingInt(end_vi) - @backingInt(start_vi) + 1), | |
| 9136 | 9136 | }; |
| 9137 | 9137 | } |
| 9138 | 9138 | comptime { |
| ... | ... | @@ -9148,7 +9148,7 @@ pub const Value = struct { |
| 9148 | 9148 | last += 1; |
| 9149 | 9149 | while (true) { |
| 9150 | 9150 | const mid = (first + last) / 2; |
| 9151 | const mid_vi: Value.Index = @enumFromInt(@intFromEnum(value.parts) + mid); | |
| 9151 | const mid_vi: Value.Index = @fromBackingInt(@intCast(@backingInt(value.parts) + mid)); | |
| 9152 | 9152 | if (mid == first) return mid_vi; |
| 9153 | 9153 | if (offset < mid_vi.get(isel).offset_from_parent) last = mid else first = mid; |
| 9154 | 9154 | } |
| ... | ... | @@ -10042,7 +10042,7 @@ pub const Value = struct { |
| 10042 | 10042 | fn allocStackSlot(vi: Value.Index, isel: *Select) Value.Indirect { |
| 10043 | 10043 | const offset = vi.alignment(isel).forward(isel.stack_size); |
| 10044 | 10044 | isel.stack_size = @intCast(offset + vi.size(isel)); |
| 10045 | tracking_log.debug("${d} -> [sp, #0x{x}]", .{ @intFromEnum(vi), @abs(offset) }); | |
| 10045 | tracking_log.debug("${d} -> [sp, #0x{x}]", .{ @backingInt(vi), @abs(offset) }); | |
| 10046 | 10046 | return .{ |
| 10047 | 10047 | .base = .sp, |
| 10048 | 10048 | .offset = @intCast(offset), |
| ... | ... | @@ -10145,7 +10145,7 @@ pub const Value = struct { |
| 10145 | 10145 | pub fn next(it: *PartIterator) ?Value.Index { |
| 10146 | 10146 | if (it.remaining == 0) return null; |
| 10147 | 10147 | it.remaining -= 1; |
| 10148 | defer it.vi = @enumFromInt(@intFromEnum(it.vi) + 1); | |
| 10148 | defer it.vi = @fromBackingInt(@intCast(@backingInt(it.vi) + 1)); | |
| 10149 | 10149 | return it.vi; |
| 10150 | 10150 | } |
| 10151 | 10151 | |
| ... | ... | @@ -11229,7 +11229,7 @@ fn initValueAdvanced( |
| 11229 | 11229 | } }, |
| 11230 | 11230 | .parts = undefined, |
| 11231 | 11231 | }; |
| 11232 | return @enumFromInt(isel.values.items.len); | |
| 11232 | return @fromBackingInt(@intCast(isel.values.items.len)); | |
| 11233 | 11233 | } |
| 11234 | 11234 | const WhichValues = enum { only_referenced, all }; |
| 11235 | 11235 | pub fn dumpValues(isel: *Select, which: WhichValues) void { |
| ... | ... | @@ -11278,9 +11278,9 @@ fn dumpValuesInner(isel: *Select, which: WhichValues) !void { |
| 11278 | 11278 | defer roots.deinit(gpa); |
| 11279 | 11279 | { |
| 11280 | 11280 | try roots.ensureTotalCapacity(gpa, isel.values.items.len); |
| 11281 | var vi: Value.Index = @enumFromInt(isel.values.items.len); | |
| 11282 | while (@intFromEnum(vi) > 0) { | |
| 11283 | vi = @enumFromInt(@intFromEnum(vi) - 1); | |
| 11281 | var vi: Value.Index = @fromBackingInt(@intCast(isel.values.items.len)); | |
| 11282 | while (@backingInt(vi) > 0) { | |
| 11283 | vi = @fromBackingInt(@intCast(@backingInt(vi) - 1)); | |
| 11284 | 11284 | if (which == .only_referenced and vi.get(isel).refs == 0) continue; |
| 11285 | 11285 | while (true) switch (vi.parent(isel)) { |
| 11286 | 11286 | .unallocated, .stack_slot, .constant => break, |
| ... | ... | @@ -11296,14 +11296,14 @@ fn dumpValuesInner(isel: *Select, which: WhichValues) !void { |
| 11296 | 11296 | const vi = root_entry.key; |
| 11297 | 11297 | const value = vi.get(isel); |
| 11298 | 11298 | try stderr.splatByteAll(' ', 2 * (@as(usize, 1) + root_entry.value)); |
| 11299 | try stderr.print("${d}", .{@intFromEnum(vi)}); | |
| 11299 | try stderr.print("${d}", .{@backingInt(vi)}); | |
| 11300 | 11300 | { |
| 11301 | 11301 | var first = true; |
| 11302 | 11302 | if (reverse_live_values.get(vi)) |aiis| for (aiis.items) |aii| { |
| 11303 | 11303 | if (aii == Block.main) { |
| 11304 | 11304 | try stderr.print("{s}%main", .{if (first) " <- " else ", "}); |
| 11305 | 11305 | } else { |
| 11306 | try stderr.print("{s}%{d}", .{ if (first) " <- " else ", ", @intFromEnum(aii) }); | |
| 11306 | try stderr.print("{s}%{d}", .{ if (first) " <- " else ", ", @backingInt(aii) }); | |
| 11307 | 11307 | } |
| 11308 | 11308 | first = false; |
| 11309 | 11309 | }; |
| ... | ... | @@ -11324,8 +11324,8 @@ fn dumpValuesInner(isel: *Select, which: WhichValues) !void { |
| 11324 | 11324 | if (value.offset_from_parent != 0) try stderr.print("+0x{x}", .{value.offset_from_parent}); |
| 11325 | 11325 | try stderr.writeByte(']'); |
| 11326 | 11326 | }, |
| 11327 | .value => try stderr.print(" ${d}+0x{x}", .{ @intFromEnum(value.parent_payload.value), value.offset_from_parent }), | |
| 11328 | .address => try stderr.print(" ${d}[0x{x}]", .{ @intFromEnum(value.parent_payload.address), value.offset_from_parent }), | |
| 11327 | .value => try stderr.print(" ${d}+0x{x}", .{ @backingInt(value.parent_payload.value), value.offset_from_parent }), | |
| 11328 | .address => try stderr.print(" ${d}[0x{x}]", .{ @backingInt(value.parent_payload.address), value.offset_from_parent }), | |
| 11329 | 11329 | .constant => try stderr.print(" <{f}, {f}>", .{ |
| 11330 | 11330 | isel.fmtType(value.parent_payload.constant.typeOf(zcu)), |
| 11331 | 11331 | isel.fmtConstant(value.parent_payload.constant), |
| ... | ... | @@ -11350,7 +11350,7 @@ fn dumpValuesInner(isel: *Select, which: WhichValues) !void { |
| 11350 | 11350 | var part_index = value.flags.parts_len_minus_one; |
| 11351 | 11351 | if (part_index > 0) while (true) : (part_index -= 1) { |
| 11352 | 11352 | roots.putAssumeCapacityNoClobber( |
| 11353 | @enumFromInt(@intFromEnum(value.parts) + part_index), | |
| 11353 | @fromBackingInt(@intCast(@backingInt(value.parts) + part_index)), | |
| 11354 | 11354 | root_entry.value + 1, |
| 11355 | 11355 | ); |
| 11356 | 11356 | if (part_index == 0) break; |
| ... | ... | @@ -11517,7 +11517,7 @@ const TryAllocRegResult = union(enum) { |
| 11517 | 11517 | fn tryAllocIntReg(isel: *Select) TryAllocRegResult { |
| 11518 | 11518 | var failed_result: TryAllocRegResult = .out_of_registers; |
| 11519 | 11519 | var ra: Register.Alias = .r0; |
| 11520 | while (true) : (ra = @enumFromInt(@intFromEnum(ra) + 1)) { | |
| 11520 | while (true) : (ra = @fromBackingInt(@intCast(@backingInt(ra) + 1))) { | |
| 11521 | 11521 | if (ra == .r18) continue; // The Platform Register |
| 11522 | 11522 | if (ra == Register.Alias.fp) continue; |
| 11523 | 11523 | const live_vi = isel.live_registers.getPtr(ra); |
| ... | ... | @@ -11555,7 +11555,7 @@ fn allocIntReg(isel: *Select) !Register.Alias { |
| 11555 | 11555 | fn tryAllocVecReg(isel: *Select) TryAllocRegResult { |
| 11556 | 11556 | var failed_result: TryAllocRegResult = .out_of_registers; |
| 11557 | 11557 | var ra: Register.Alias = .v0; |
| 11558 | while (true) : (ra = @enumFromInt(@intFromEnum(ra) + 1)) { | |
| 11558 | while (true) : (ra = @fromBackingInt(@intCast(@backingInt(ra) + 1))) { | |
| 11559 | 11559 | const live_vi = isel.live_registers.getPtr(ra); |
| 11560 | 11560 | switch (live_vi.*) { |
| 11561 | 11561 | _ => switch (failed_result) { |
| ... | ... | @@ -11632,8 +11632,8 @@ fn use(isel: *Select, air_ref: Air.Inst.Ref) !Value.Index { |
| 11632 | 11632 | const ty = isel.air.typeOf(air_ref, ip); |
| 11633 | 11633 | const vi = isel.initValue(ty); |
| 11634 | 11634 | tracking_log.debug("${d} <- %{d}", .{ |
| 11635 | @intFromEnum(vi), | |
| 11636 | @intFromEnum(air_inst_index), | |
| 11635 | @backingInt(vi), | |
| 11636 | @backingInt(air_inst_index), | |
| 11637 | 11637 | }); |
| 11638 | 11638 | live_gop.value_ptr.* = vi.ref(isel); |
| 11639 | 11639 | break :vi_ty .{ vi, ty }; |
| ... | ... | @@ -11642,7 +11642,7 @@ fn use(isel: *Select, air_ref: Air.Inst.Ref) !Value.Index { |
| 11642 | 11642 | const ty = constant.typeOf(zcu); |
| 11643 | 11643 | const vi = isel.initValue(ty); |
| 11644 | 11644 | tracking_log.debug("${d} <- <{f}, {f}>", .{ |
| 11645 | @intFromEnum(vi), | |
| 11645 | @backingInt(vi), | |
| 11646 | 11646 | isel.fmtType(ty), |
| 11647 | 11647 | isel.fmtConstant(constant), |
| 11648 | 11648 | }); |
| ... | ... | @@ -11857,8 +11857,8 @@ fn merge( |
| 11857 | 11857 | } |
| 11858 | 11858 | |
| 11859 | 11859 | const call = struct { |
| 11860 | const param_reg: Value.Index = @enumFromInt(@intFromEnum(Value.Index.allocating) - 2); | |
| 11861 | const callee_clobbered_reg: Value.Index = @enumFromInt(@intFromEnum(Value.Index.allocating) - 1); | |
| 11860 | const param_reg: Value.Index = @fromBackingInt(@intCast(@backingInt(Value.Index.allocating) - 2)); | |
| 11861 | const callee_clobbered_reg: Value.Index = @fromBackingInt(@intCast(@backingInt(Value.Index.allocating) - 1)); | |
| 11862 | 11862 | const caller_saved_regs: LiveRegisters = .init(.{ |
| 11863 | 11863 | .r0 = param_reg, |
| 11864 | 11864 | .r1 = param_reg, |
| ... | ... | @@ -12454,7 +12454,7 @@ pub const CallAbiIterator = struct { |
| 12454 | 12454 | wip_vi.setAlignment(isel, natural_alignment.maxStrict(.@"8")); |
| 12455 | 12455 | if (it.ngrn == ngrn_end) return it.stack(isel, wip_vi); |
| 12456 | 12456 | wip_vi.setHint(isel, it.ngrn); |
| 12457 | it.ngrn = @enumFromInt(@intFromEnum(it.ngrn) + 1); | |
| 12457 | it.ngrn = @fromBackingInt(@intCast(@backingInt(it.ngrn) + 1)); | |
| 12458 | 12458 | } |
| 12459 | 12459 | |
| 12460 | 12460 | fn integers(it: *CallAbiIterator, isel: *Select, wip_vi: Value.Index, part_sizes: [2]u64) void { |
| ... | ... | @@ -12463,11 +12463,11 @@ pub const CallAbiIterator = struct { |
| 12463 | 12463 | assert(natural_alignment.order(.@"16").compare(.lte)); |
| 12464 | 12464 | wip_vi.setAlignment(isel, natural_alignment.maxStrict(.@"8")); |
| 12465 | 12465 | // C.8 |
| 12466 | if (natural_alignment == .@"16") it.ngrn = @enumFromInt(std.mem.alignForward( | |
| 12466 | if (natural_alignment == .@"16") it.ngrn = @fromBackingInt(@intCast(std.mem.alignForward( | |
| 12467 | 12467 | @typeInfo(Register.Alias).@"enum".tag_type, |
| 12468 | @intFromEnum(it.ngrn), | |
| 12468 | @backingInt(it.ngrn), | |
| 12469 | 12469 | 2, |
| 12470 | )); | |
| 12470 | ))); | |
| 12471 | 12471 | if (it.ngrn == ngrn_end) return it.stack(isel, wip_vi); |
| 12472 | 12472 | wip_vi.setParts(isel, part_sizes.len); |
| 12473 | 12473 | for (0.., part_sizes) |part_index, part_size| |
| ... | ... | @@ -12482,7 +12482,7 @@ pub const CallAbiIterator = struct { |
| 12482 | 12482 | wip_vi.setIsVector(isel); |
| 12483 | 12483 | if (it.nsrn == nsrn_end) return it.stack(isel, wip_vi); |
| 12484 | 12484 | wip_vi.setHint(isel, it.nsrn); |
| 12485 | it.nsrn = @enumFromInt(@intFromEnum(it.nsrn) + 1); | |
| 12485 | it.nsrn = @fromBackingInt(@intCast(@backingInt(it.nsrn) + 1)); | |
| 12486 | 12486 | } |
| 12487 | 12487 | |
| 12488 | 12488 | fn vectors( |
| ... | ... | @@ -12497,7 +12497,7 @@ pub const CallAbiIterator = struct { |
| 12497 | 12497 | const natural_alignment = wip_vi.alignment(isel); |
| 12498 | 12498 | assert(natural_alignment.order(.@"16").compare(.lte)); |
| 12499 | 12499 | wip_vi.setAlignment(isel, natural_alignment.maxStrict(.@"8")); |
| 12500 | if (@intFromEnum(it.nsrn) > @intFromEnum(nsrn_end) - parts_len) return it.stack(isel, wip_vi); | |
| 12500 | if (@backingInt(it.nsrn) > @backingInt(nsrn_end) - parts_len) return it.stack(isel, wip_vi); | |
| 12501 | 12501 | if (parts_len == 1) return it.vector(isel, wip_vi); |
| 12502 | 12502 | wip_vi.setParts(isel, parts_len); |
| 12503 | 12503 | const fdt_size = @as(u64, 1) << fdt_log2_size; |
src/codegen/aarch64/encoding.zig+68-68| ... | ... | @@ -34,11 +34,11 @@ pub const Register = struct { |
| 34 | 34 | quad = 4, |
| 35 | 35 | |
| 36 | 36 | pub fn n(ss: ScalarSize) ScalarSize { |
| 37 | return @enumFromInt(@intFromEnum(ss) - 1); | |
| 37 | return @fromBackingInt(@intCast(@backingInt(ss) - 1)); | |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | pub fn w(ss: ScalarSize) ScalarSize { |
| 41 | return @enumFromInt(@intFromEnum(ss) + 1); | |
| 41 | return @fromBackingInt(@intCast(@backingInt(ss) + 1)); | |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | pub fn prefix(ss: ScalarSize) u8 { |
| ... | ... | @@ -68,10 +68,10 @@ pub const Register = struct { |
| 68 | 68 | elem_size: Instruction.DataProcessingVector.Size, |
| 69 | 69 | }; |
| 70 | 70 | pub fn wrap(unwrapped: Unwrapped) Arrangement { |
| 71 | return @enumFromInt(@as(@typeInfo(Arrangement).@"enum".tag_type, @bitCast(unwrapped))); | |
| 71 | return @fromBackingInt(@intCast(@as(@typeInfo(Arrangement).@"enum".tag_type, @bitCast(unwrapped)))); | |
| 72 | 72 | } |
| 73 | 73 | pub fn unwrap(arrangement: Arrangement) Unwrapped { |
| 74 | return @bitCast(@intFromEnum(arrangement)); | |
| 74 | return @bitCast(@backingInt(arrangement)); | |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | pub fn len(arrangement: Arrangement) u5 { |
| ... | ... | @@ -395,9 +395,9 @@ pub const Register = struct { |
| 395 | 395 | |
| 396 | 396 | pub fn decode(enc: Encoded, opts: struct { sp: bool = false, V: bool = false }) Alias { |
| 397 | 397 | return switch (opts.V) { |
| 398 | false => @enumFromInt(@intFromEnum(Alias.r0) + @intFromEnum(enc) + | |
| 399 | @intFromBool(opts.sp and enc == comptime Alias.sp.encode(.{ .sp = true }))), | |
| 400 | true => @enumFromInt(@intFromEnum(Alias.v0) + @intFromEnum(enc)), | |
| 398 | false => @fromBackingInt(@intCast(@backingInt(Alias.r0) + @backingInt(enc) + | |
| 399 | @intFromBool(opts.sp and enc == comptime Alias.sp.encode(.{ .sp = true })))), | |
| 400 | true => @fromBackingInt(@intCast(@backingInt(Alias.v0) + @backingInt(enc))), | |
| 401 | 401 | }; |
| 402 | 402 | } |
| 403 | 403 | }; |
| ... | ... | @@ -503,38 +503,38 @@ pub const Register = struct { |
| 503 | 503 | |
| 504 | 504 | pub fn alias(ra: Alias, fa: Format.Alias) Register { |
| 505 | 505 | switch (fa) { |
| 506 | .general => assert(@intFromEnum(ra) >= @intFromEnum(Alias.r0) and @intFromEnum(ra) <= @intFromEnum(Alias.sp)), | |
| 506 | .general => assert(@backingInt(ra) >= @backingInt(Alias.r0) and @backingInt(ra) <= @backingInt(Alias.sp)), | |
| 507 | 507 | .other => switch (ra) { |
| 508 | 508 | else => unreachable, |
| 509 | 509 | .pc, .fpcr, .fpsr, .ffr => {}, |
| 510 | 510 | }, |
| 511 | .vector => assert(@intFromEnum(ra) >= @intFromEnum(Alias.v0) and @intFromEnum(ra) <= @intFromEnum(Alias.v31)), | |
| 512 | .predicate => assert(@intFromEnum(ra) >= @intFromEnum(Alias.p0) and @intFromEnum(ra) <= @intFromEnum(Alias.p15)), | |
| 511 | .vector => assert(@backingInt(ra) >= @backingInt(Alias.v0) and @backingInt(ra) <= @backingInt(Alias.v31)), | |
| 512 | .predicate => assert(@backingInt(ra) >= @backingInt(Alias.p0) and @backingInt(ra) <= @backingInt(Alias.p15)), | |
| 513 | 513 | } |
| 514 | 514 | return .{ .alias = ra, .format = .{ .alias = fa } }; |
| 515 | 515 | } |
| 516 | 516 | pub fn general(ra: Alias, gs: GeneralSize) Register { |
| 517 | assert(@intFromEnum(ra) >= @intFromEnum(Alias.r0) and @intFromEnum(ra) <= @intFromEnum(Alias.sp)); | |
| 517 | assert(@backingInt(ra) >= @backingInt(Alias.r0) and @backingInt(ra) <= @backingInt(Alias.sp)); | |
| 518 | 518 | return .{ .alias = ra, .format = .{ .general = gs } }; |
| 519 | 519 | } |
| 520 | 520 | pub fn scalar(ra: Alias, ss: ScalarSize) Register { |
| 521 | assert(@intFromEnum(ra) >= @intFromEnum(Alias.v0) and @intFromEnum(ra) <= @intFromEnum(Alias.v31)); | |
| 521 | assert(@backingInt(ra) >= @backingInt(Alias.v0) and @backingInt(ra) <= @backingInt(Alias.v31)); | |
| 522 | 522 | return .{ .alias = ra, .format = .{ .scalar = ss } }; |
| 523 | 523 | } |
| 524 | 524 | pub fn vector(ra: Alias, arrangement: Arrangement) Register { |
| 525 | assert(@intFromEnum(ra) >= @intFromEnum(Alias.v0) and @intFromEnum(ra) <= @intFromEnum(Alias.v31)); | |
| 525 | assert(@backingInt(ra) >= @backingInt(Alias.v0) and @backingInt(ra) <= @backingInt(Alias.v31)); | |
| 526 | 526 | return .{ .alias = ra, .format = .{ .vector = arrangement } }; |
| 527 | 527 | } |
| 528 | 528 | pub fn element(ra: Alias, ss: ScalarSize, index: u4) Register { |
| 529 | assert(@intFromEnum(ra) >= @intFromEnum(Alias.v0) and @intFromEnum(ra) <= @intFromEnum(Alias.v31)); | |
| 529 | assert(@backingInt(ra) >= @backingInt(Alias.v0) and @backingInt(ra) <= @backingInt(Alias.v31)); | |
| 530 | 530 | return .{ .alias = ra, .format = .{ .element = .{ .size = ss, .index = index } } }; |
| 531 | 531 | } |
| 532 | 532 | pub fn z(ra: Alias) Register { |
| 533 | assert(@intFromEnum(ra) >= @intFromEnum(Alias.v0) and @intFromEnum(ra) <= @intFromEnum(Alias.v31)); | |
| 533 | assert(@backingInt(ra) >= @backingInt(Alias.v0) and @backingInt(ra) <= @backingInt(Alias.v31)); | |
| 534 | 534 | return .{ .alias = ra, .format = .scalable }; |
| 535 | 535 | } |
| 536 | 536 | pub fn p(ra: Alias) Register { |
| 537 | assert(@intFromEnum(ra) >= @intFromEnum(Alias.p0) and @intFromEnum(ra) <= @intFromEnum(Alias.p15)); | |
| 537 | assert(@backingInt(ra) >= @backingInt(Alias.p0) and @backingInt(ra) <= @backingInt(Alias.p15)); | |
| 538 | 538 | return .{ .alias = ra, .format = .{ .scalar = .predicate } }; |
| 539 | 539 | } |
| 540 | 540 | |
| ... | ... | @@ -700,7 +700,7 @@ pub const Register = struct { |
| 700 | 700 | } |
| 701 | 701 | |
| 702 | 702 | pub fn encode(ra: Alias, comptime opts: struct { sp: bool = false, V: bool = false }) Encoded { |
| 703 | return @enumFromInt(@as(u5, switch (ra) { | |
| 703 | return @fromBackingInt(@intCast(@as(u5, switch (ra) { | |
| 704 | 704 | .r0 => if (opts.V) unreachable else 0, |
| 705 | 705 | .r1 => if (opts.V) unreachable else 1, |
| 706 | 706 | .r2 => if (opts.V) unreachable else 2, |
| ... | ... | @@ -770,7 +770,7 @@ pub const Register = struct { |
| 770 | 770 | .fpcr, .fpsr => unreachable, |
| 771 | 771 | .p0, .p1, .p2, .p3, .p4, .p5, .p6, .p7, .p8, .p9, .p10, .p11, .p12, .p13, .p14, .p15 => unreachable, |
| 772 | 772 | .ffr => unreachable, |
| 773 | })); | |
| 773 | }))); | |
| 774 | 774 | } |
| 775 | 775 | }; |
| 776 | 776 | |
| ... | ... | @@ -806,21 +806,21 @@ pub const Register = struct { |
| 806 | 806 | else => null, |
| 807 | 807 | 'r' => if (std.fmt.parseInt(u5, reg[1..], 10)) |n| switch (n) { |
| 808 | 808 | 0...30 => .{ |
| 809 | .alias = @enumFromInt(@intFromEnum(Alias.r0) + n), | |
| 809 | .alias = @fromBackingInt(@intCast(@backingInt(Alias.r0) + n)), | |
| 810 | 810 | .format = .{ .alias = .general }, |
| 811 | 811 | }, |
| 812 | 812 | 31 => null, |
| 813 | 813 | } else |_| null, |
| 814 | 814 | 'x' => if (std.fmt.parseInt(u5, reg[1..], 10)) |n| switch (n) { |
| 815 | 815 | 0...30 => .{ |
| 816 | .alias = @enumFromInt(@intFromEnum(Alias.r0) + n), | |
| 816 | .alias = @fromBackingInt(@intCast(@backingInt(Alias.r0) + n)), | |
| 817 | 817 | .format = .{ .general = .doubleword }, |
| 818 | 818 | }, |
| 819 | 819 | 31 => null, |
| 820 | 820 | } else |_| if (toLowerEqlAssertLower(reg, "xzr")) .xzr else null, |
| 821 | 821 | 'w' => if (std.fmt.parseInt(u5, reg[1..], 10)) |n| switch (n) { |
| 822 | 822 | 0...30 => .{ |
| 823 | .alias = @enumFromInt(@intFromEnum(Alias.r0) + n), | |
| 823 | .alias = @fromBackingInt(@intCast(@backingInt(Alias.r0) + n)), | |
| 824 | 824 | .format = .{ .general = .word }, |
| 825 | 825 | }, |
| 826 | 826 | 31 => null, |
| ... | ... | @@ -839,27 +839,27 @@ pub const Register = struct { |
| 839 | 839 | 'f' => return if (toLowerEqlAssertLower(reg, "fp")) .fp else null, |
| 840 | 840 | 'p' => return if (toLowerEqlAssertLower(reg, "pc")) .pc else null, |
| 841 | 841 | 'v' => if (std.fmt.parseInt(u5, reg[1..], 10)) |n| .{ |
| 842 | .alias = @enumFromInt(@intFromEnum(Alias.v0) + n), | |
| 842 | .alias = @fromBackingInt(@intCast(@backingInt(Alias.v0) + n)), | |
| 843 | 843 | .format = .{ .alias = .vector }, |
| 844 | 844 | } else |_| null, |
| 845 | 845 | 'q' => if (std.fmt.parseInt(u5, reg[1..], 10)) |n| .{ |
| 846 | .alias = @enumFromInt(@intFromEnum(Alias.v0) + n), | |
| 846 | .alias = @fromBackingInt(@intCast(@backingInt(Alias.v0) + n)), | |
| 847 | 847 | .format = .{ .scalar = .quad }, |
| 848 | 848 | } else |_| null, |
| 849 | 849 | 'd' => if (std.fmt.parseInt(u5, reg[1..], 10)) |n| .{ |
| 850 | .alias = @enumFromInt(@intFromEnum(Alias.v0) + n), | |
| 850 | .alias = @fromBackingInt(@intCast(@backingInt(Alias.v0) + n)), | |
| 851 | 851 | .format = .{ .scalar = .double }, |
| 852 | 852 | } else |_| null, |
| 853 | 853 | 's' => if (std.fmt.parseInt(u5, reg[1..], 10)) |n| .{ |
| 854 | .alias = @enumFromInt(@intFromEnum(Alias.v0) + n), | |
| 854 | .alias = @fromBackingInt(@intCast(@backingInt(Alias.v0) + n)), | |
| 855 | 855 | .format = .{ .scalar = .single }, |
| 856 | 856 | } else |_| if (toLowerEqlAssertLower(reg, "sp")) .sp else null, |
| 857 | 857 | 'h' => if (std.fmt.parseInt(u5, reg[1..], 10)) |n| .{ |
| 858 | .alias = @enumFromInt(@intFromEnum(Alias.v0) + n), | |
| 858 | .alias = @fromBackingInt(@intCast(@backingInt(Alias.v0) + n)), | |
| 859 | 859 | .format = .{ .scalar = .half }, |
| 860 | 860 | } else |_| null, |
| 861 | 861 | 'b' => if (std.fmt.parseInt(u5, reg[1..], 10)) |n| .{ |
| 862 | .alias = @enumFromInt(@intFromEnum(Alias.v0) + n), | |
| 862 | .alias = @fromBackingInt(@intCast(@backingInt(Alias.v0) + n)), | |
| 863 | 863 | .format = .{ .scalar = .byte }, |
| 864 | 864 | } else |_| null, |
| 865 | 865 | }; |
| ... | ... | @@ -1363,7 +1363,7 @@ pub const ConditionCode = enum(u4) { |
| 1363 | 1363 | pub const cc: ConditionCode = .lo; |
| 1364 | 1364 | |
| 1365 | 1365 | pub fn invert(cond: ConditionCode) ConditionCode { |
| 1366 | return @enumFromInt(@intFromEnum(cond) ^ 0b0001); | |
| 1366 | return @fromBackingInt(@intCast(@backingInt(cond) ^ 0b0001)); | |
| 1367 | 1367 | } |
| 1368 | 1368 | }; |
| 1369 | 1369 | |
| ... | ... | @@ -2772,7 +2772,7 @@ pub const Instruction = packed union { |
| 2772 | 2772 | |
| 2773 | 2773 | /// C6.2.37 BR |
| 2774 | 2774 | pub const Br = packed struct { |
| 2775 | Rm: Register.Encoded = @enumFromInt(0), | |
| 2775 | Rm: Register.Encoded = @fromBackingInt(@intCast(0)), | |
| 2776 | 2776 | Rn: Register.Encoded, |
| 2777 | 2777 | M: bool = false, |
| 2778 | 2778 | A: bool = false, |
| ... | ... | @@ -2786,7 +2786,7 @@ pub const Instruction = packed union { |
| 2786 | 2786 | |
| 2787 | 2787 | /// C6.2.35 BLR |
| 2788 | 2788 | pub const Blr = packed struct { |
| 2789 | Rm: Register.Encoded = @enumFromInt(0), | |
| 2789 | Rm: Register.Encoded = @fromBackingInt(@intCast(0)), | |
| 2790 | 2790 | Rn: Register.Encoded, |
| 2791 | 2791 | M: bool = false, |
| 2792 | 2792 | A: bool = false, |
| ... | ... | @@ -2800,7 +2800,7 @@ pub const Instruction = packed union { |
| 2800 | 2800 | |
| 2801 | 2801 | /// C6.2.254 RET |
| 2802 | 2802 | pub const Ret = packed struct { |
| 2803 | Rm: Register.Encoded = @enumFromInt(0), | |
| 2803 | Rm: Register.Encoded = @fromBackingInt(@intCast(0)), | |
| 2804 | 2804 | Rn: Register.Encoded, |
| 2805 | 2805 | M: bool = false, |
| 2806 | 2806 | A: bool = false, |
| ... | ... | @@ -11131,11 +11131,11 @@ pub const Instruction = packed union { |
| 11131 | 11131 | double = 0b11, |
| 11132 | 11132 | |
| 11133 | 11133 | pub fn n(s: Size) Size { |
| 11134 | return @enumFromInt(@intFromEnum(s) - 1); | |
| 11134 | return @fromBackingInt(@intCast(@backingInt(s) - 1)); | |
| 11135 | 11135 | } |
| 11136 | 11136 | |
| 11137 | 11137 | pub fn w(s: Size) Size { |
| 11138 | return @enumFromInt(@intFromEnum(s) + 1); | |
| 11138 | return @fromBackingInt(@intCast(@backingInt(s) + 1)); | |
| 11139 | 11139 | } |
| 11140 | 11140 | |
| 11141 | 11141 | pub fn toScalarSize(s: Size) Register.ScalarSize { |
| ... | ... | @@ -12379,12 +12379,12 @@ pub const Instruction = packed union { |
| 12379 | 12379 | switch (d.format) { |
| 12380 | 12380 | else => unreachable, |
| 12381 | 12381 | .scalar => |elem_size| { |
| 12382 | assert(@intFromEnum(elem_size) <= @intFromEnum(Register.ScalarSize.double) and elem_size == n.format.element.size); | |
| 12382 | assert(@backingInt(elem_size) <= @backingInt(Register.ScalarSize.double) and elem_size == n.format.element.size); | |
| 12383 | 12383 | return .{ .data_processing_vector = .{ .simd_scalar_copy = .{ |
| 12384 | 12384 | .dup = .{ |
| 12385 | 12385 | .Rd = d.alias.encode(.{ .V = true }), |
| 12386 | 12386 | .Rn = n.alias.encode(.{ .V = true }), |
| 12387 | .imm5 = @shlExact(@as(u5, n.format.element.index) << 1 | @as(u5, 0b1), @intFromEnum(elem_size)), | |
| 12387 | .imm5 = @shlExact(@as(u5, n.format.element.index) << 1 | @as(u5, 0b1), @backingInt(elem_size)), | |
| 12388 | 12388 | }, |
| 12389 | 12389 | } } }; |
| 12390 | 12390 | }, |
| ... | ... | @@ -12400,7 +12400,7 @@ pub const Instruction = packed union { |
| 12400 | 12400 | .Rd = d.alias.encode(.{ .V = true }), |
| 12401 | 12401 | .Rn = n.alias.encode(.{ .V = true }), |
| 12402 | 12402 | .imm4 = .element, |
| 12403 | .imm5 = @shlExact(@as(u5, element.index) << 1 | @as(u5, 0b1), @intFromEnum(elem_size)), | |
| 12403 | .imm5 = @shlExact(@as(u5, element.index) << 1 | @as(u5, 0b1), @backingInt(elem_size)), | |
| 12404 | 12404 | .Q = arrangement.size(), |
| 12405 | 12405 | }, |
| 12406 | 12406 | } } }; |
| ... | ... | @@ -12415,7 +12415,7 @@ pub const Instruction = packed union { |
| 12415 | 12415 | .Rd = d.alias.encode(.{ .V = true }), |
| 12416 | 12416 | .Rn = n.alias.encode(.{}), |
| 12417 | 12417 | .imm4 = .general, |
| 12418 | .imm5 = @shlExact(@as(u5, 0b1), @intFromEnum(elem_size)), | |
| 12418 | .imm5 = @shlExact(@as(u5, 0b1), @backingInt(elem_size)), | |
| 12419 | 12419 | .Q = arrangement.size(), |
| 12420 | 12420 | }, |
| 12421 | 12421 | } } }; |
| ... | ... | @@ -12867,7 +12867,7 @@ pub const Instruction = packed union { |
| 12867 | 12867 | .fcmp = .{ |
| 12868 | 12868 | .opc0 = .register, |
| 12869 | 12869 | .Rn = n.alias.encode(.{ .V = true }), |
| 12870 | .Rm = @enumFromInt(0b00000), | |
| 12870 | .Rm = @fromBackingInt(@intCast(0b00000)), | |
| 12871 | 12871 | .ftype = .fromScalarSize(ftype), |
| 12872 | 12872 | }, |
| 12873 | 12873 | } } }, |
| ... | ... | @@ -12892,7 +12892,7 @@ pub const Instruction = packed union { |
| 12892 | 12892 | .fcmpe = .{ |
| 12893 | 12893 | .opc0 = .zero, |
| 12894 | 12894 | .Rn = n.alias.encode(.{ .V = true }), |
| 12895 | .Rm = @enumFromInt(0b00000), | |
| 12895 | .Rm = @fromBackingInt(@intCast(0b00000)), | |
| 12896 | 12896 | .ftype = .fromScalarSize(ftype), |
| 12897 | 12897 | }, |
| 12898 | 12898 | } } }, |
| ... | ... | @@ -14194,8 +14194,8 @@ pub const Instruction = packed union { |
| 14194 | 14194 | .ins = .{ |
| 14195 | 14195 | .Rd = d.alias.encode(.{ .V = true }), |
| 14196 | 14196 | .Rn = n.alias.encode(.{ .V = true }), |
| 14197 | .imm4 = .{ .element = element.index << @intCast(@intFromEnum(elem_size)) }, | |
| 14198 | .imm5 = (@as(u5, d.format.element.index) << 1 | @as(u5, 0b1) << 0) << @intFromEnum(elem_size), | |
| 14197 | .imm4 = .{ .element = element.index << @intCast(@backingInt(elem_size)) }, | |
| 14198 | .imm5 = (@as(u5, d.format.element.index) << 1 | @as(u5, 0b1) << 0) << @backingInt(elem_size), | |
| 14199 | 14199 | .op = .element, |
| 14200 | 14200 | }, |
| 14201 | 14201 | } } }; |
| ... | ... | @@ -14211,7 +14211,7 @@ pub const Instruction = packed union { |
| 14211 | 14211 | .Rd = d.alias.encode(.{ .V = true }), |
| 14212 | 14212 | .Rn = n.alias.encode(.{}), |
| 14213 | 14213 | .imm4 = .{ .general = .general }, |
| 14214 | .imm5 = (@as(u5, d.format.element.index) << 1 | @as(u5, 0b1) << 0) << @intFromEnum(elem_size), | |
| 14214 | .imm5 = (@as(u5, d.format.element.index) << 1 | @as(u5, 0b1) << 0) << @backingInt(elem_size), | |
| 14215 | 14215 | .op = .general, |
| 14216 | 14216 | }, |
| 14217 | 14217 | } } }; |
| ... | ... | @@ -14246,7 +14246,7 @@ pub const Instruction = packed union { |
| 14246 | 14246 | .Rt = t1.alias.encode(.{}), |
| 14247 | 14247 | .Rn = post_index.base.alias.encode(.{ .sp = true }), |
| 14248 | 14248 | .Rt2 = t2.alias.encode(.{}), |
| 14249 | .imm7 = @intCast(@shrExact(post_index.index, @as(u2, 2) + @intFromEnum(sf))), | |
| 14249 | .imm7 = @intCast(@shrExact(post_index.index, @as(u2, 2) + @backingInt(sf))), | |
| 14250 | 14250 | .sf = sf, |
| 14251 | 14251 | }, |
| 14252 | 14252 | } } } }; |
| ... | ... | @@ -14258,7 +14258,7 @@ pub const Instruction = packed union { |
| 14258 | 14258 | .Rt = t1.alias.encode(.{}), |
| 14259 | 14259 | .Rn = pre_index.base.alias.encode(.{ .sp = true }), |
| 14260 | 14260 | .Rt2 = t2.alias.encode(.{}), |
| 14261 | .imm7 = @intCast(@shrExact(pre_index.index, @as(u2, 2) + @intFromEnum(sf))), | |
| 14261 | .imm7 = @intCast(@shrExact(pre_index.index, @as(u2, 2) + @backingInt(sf))), | |
| 14262 | 14262 | .sf = sf, |
| 14263 | 14263 | }, |
| 14264 | 14264 | } } } }; |
| ... | ... | @@ -14270,7 +14270,7 @@ pub const Instruction = packed union { |
| 14270 | 14270 | .Rt = t1.alias.encode(.{}), |
| 14271 | 14271 | .Rn = signed_offset.base.alias.encode(.{ .sp = true }), |
| 14272 | 14272 | .Rt2 = t2.alias.encode(.{}), |
| 14273 | .imm7 = @intCast(@shrExact(signed_offset.offset, @as(u2, 2) + @intFromEnum(sf))), | |
| 14273 | .imm7 = @intCast(@shrExact(signed_offset.offset, @as(u2, 2) + @backingInt(sf))), | |
| 14274 | 14274 | .sf = sf, |
| 14275 | 14275 | }, |
| 14276 | 14276 | } } } }; |
| ... | ... | @@ -14288,7 +14288,7 @@ pub const Instruction = packed union { |
| 14288 | 14288 | .Rt = t1.alias.encode(.{ .V = true }), |
| 14289 | 14289 | .Rn = post_index.base.alias.encode(.{ .sp = true }), |
| 14290 | 14290 | .Rt2 = t2.alias.encode(.{ .V = true }), |
| 14291 | .imm7 = @intCast(@shrExact(post_index.index, @intFromEnum(vs))), | |
| 14291 | .imm7 = @intCast(@shrExact(post_index.index, @backingInt(vs))), | |
| 14292 | 14292 | .opc = .encode(vs), |
| 14293 | 14293 | }, |
| 14294 | 14294 | } } } }; |
| ... | ... | @@ -14300,7 +14300,7 @@ pub const Instruction = packed union { |
| 14300 | 14300 | .Rt = t1.alias.encode(.{ .V = true }), |
| 14301 | 14301 | .Rn = signed_offset.base.alias.encode(.{ .sp = true }), |
| 14302 | 14302 | .Rt2 = t2.alias.encode(.{ .V = true }), |
| 14303 | .imm7 = @intCast(@shrExact(signed_offset.offset, @intFromEnum(vs))), | |
| 14303 | .imm7 = @intCast(@shrExact(signed_offset.offset, @backingInt(vs))), | |
| 14304 | 14304 | .opc = .encode(vs), |
| 14305 | 14305 | }, |
| 14306 | 14306 | } } } }; |
| ... | ... | @@ -14312,7 +14312,7 @@ pub const Instruction = packed union { |
| 14312 | 14312 | .Rt = t1.alias.encode(.{ .V = true }), |
| 14313 | 14313 | .Rn = pre_index.base.alias.encode(.{ .sp = true }), |
| 14314 | 14314 | .Rt2 = t2.alias.encode(.{ .V = true }), |
| 14315 | .imm7 = @intCast(@shrExact(pre_index.index, @intFromEnum(vs))), | |
| 14315 | .imm7 = @intCast(@shrExact(pre_index.index, @backingInt(vs))), | |
| 14316 | 14316 | .opc = .encode(vs), |
| 14317 | 14317 | }, |
| 14318 | 14318 | } } } }; |
| ... | ... | @@ -14377,7 +14377,7 @@ pub const Instruction = packed union { |
| 14377 | 14377 | .ldr = .{ |
| 14378 | 14378 | .Rt = t.alias.encode(.{}), |
| 14379 | 14379 | .Rn = unsigned_offset.base.alias.encode(.{ .sp = true }), |
| 14380 | .imm12 = @intCast(@shrExact(unsigned_offset.offset, @as(u2, 2) + @intFromEnum(sf))), | |
| 14380 | .imm12 = @intCast(@shrExact(unsigned_offset.offset, @as(u2, 2) + @backingInt(sf))), | |
| 14381 | 14381 | .sf = sf, |
| 14382 | 14382 | }, |
| 14383 | 14383 | } } } }; |
| ... | ... | @@ -14455,7 +14455,7 @@ pub const Instruction = packed union { |
| 14455 | 14455 | .ldr = .{ |
| 14456 | 14456 | .Rt = t.alias.encode(.{ .V = true }), |
| 14457 | 14457 | .Rn = unsigned_offset.base.alias.encode(.{ .sp = true }), |
| 14458 | .imm12 = @intCast(@shrExact(unsigned_offset.offset, @intFromEnum(vs))), | |
| 14458 | .imm12 = @intCast(@shrExact(unsigned_offset.offset, @backingInt(vs))), | |
| 14459 | 14459 | .opc1 = .encode(vs), |
| 14460 | 14460 | .size = .encode(vs), |
| 14461 | 14461 | }, |
| ... | ... | @@ -14705,7 +14705,7 @@ pub const Instruction = packed union { |
| 14705 | 14705 | .Rt = t.alias.encode(.{}), |
| 14706 | 14706 | .Rn = post_index.base.alias.encode(.{ .sp = true }), |
| 14707 | 14707 | .imm9 = post_index.index, |
| 14708 | .opc0 = ~@intFromEnum(sf), | |
| 14708 | .opc0 = ~@backingInt(sf), | |
| 14709 | 14709 | }, |
| 14710 | 14710 | } } } }; |
| 14711 | 14711 | }, |
| ... | ... | @@ -14716,7 +14716,7 @@ pub const Instruction = packed union { |
| 14716 | 14716 | .Rt = t.alias.encode(.{}), |
| 14717 | 14717 | .Rn = pre_index.base.alias.encode(.{ .sp = true }), |
| 14718 | 14718 | .imm9 = pre_index.index, |
| 14719 | .opc0 = ~@intFromEnum(sf), | |
| 14719 | .opc0 = ~@backingInt(sf), | |
| 14720 | 14720 | }, |
| 14721 | 14721 | } } } }; |
| 14722 | 14722 | }, |
| ... | ... | @@ -14727,7 +14727,7 @@ pub const Instruction = packed union { |
| 14727 | 14727 | .Rt = t.alias.encode(.{}), |
| 14728 | 14728 | .Rn = unsigned_offset.base.alias.encode(.{ .sp = true }), |
| 14729 | 14729 | .imm12 = unsigned_offset.offset, |
| 14730 | .opc0 = ~@intFromEnum(sf), | |
| 14730 | .opc0 = ~@backingInt(sf), | |
| 14731 | 14731 | }, |
| 14732 | 14732 | } } } }; |
| 14733 | 14733 | }, |
| ... | ... | @@ -14745,7 +14745,7 @@ pub const Instruction = packed union { |
| 14745 | 14745 | }, |
| 14746 | 14746 | .option = extended_register_explicit.option, |
| 14747 | 14747 | .Rm = extended_register_explicit.index.alias.encode(.{}), |
| 14748 | .opc0 = ~@intFromEnum(sf), | |
| 14748 | .opc0 = ~@backingInt(sf), | |
| 14749 | 14749 | }, |
| 14750 | 14750 | } } } }; |
| 14751 | 14751 | }, |
| ... | ... | @@ -14787,7 +14787,7 @@ pub const Instruction = packed union { |
| 14787 | 14787 | .Rt = t.alias.encode(.{}), |
| 14788 | 14788 | .Rn = post_index.base.alias.encode(.{ .sp = true }), |
| 14789 | 14789 | .imm9 = post_index.index, |
| 14790 | .opc0 = ~@intFromEnum(sf), | |
| 14790 | .opc0 = ~@backingInt(sf), | |
| 14791 | 14791 | }, |
| 14792 | 14792 | } } } }; |
| 14793 | 14793 | }, |
| ... | ... | @@ -14798,7 +14798,7 @@ pub const Instruction = packed union { |
| 14798 | 14798 | .Rt = t.alias.encode(.{}), |
| 14799 | 14799 | .Rn = pre_index.base.alias.encode(.{ .sp = true }), |
| 14800 | 14800 | .imm9 = pre_index.index, |
| 14801 | .opc0 = ~@intFromEnum(sf), | |
| 14801 | .opc0 = ~@backingInt(sf), | |
| 14802 | 14802 | }, |
| 14803 | 14803 | } } } }; |
| 14804 | 14804 | }, |
| ... | ... | @@ -14809,7 +14809,7 @@ pub const Instruction = packed union { |
| 14809 | 14809 | .Rt = t.alias.encode(.{}), |
| 14810 | 14810 | .Rn = unsigned_offset.base.alias.encode(.{ .sp = true }), |
| 14811 | 14811 | .imm12 = @intCast(@shrExact(unsigned_offset.offset, 1)), |
| 14812 | .opc0 = ~@intFromEnum(sf), | |
| 14812 | .opc0 = ~@backingInt(sf), | |
| 14813 | 14813 | }, |
| 14814 | 14814 | } } } }; |
| 14815 | 14815 | }, |
| ... | ... | @@ -14828,7 +14828,7 @@ pub const Instruction = packed union { |
| 14828 | 14828 | }, |
| 14829 | 14829 | .option = extended_register_explicit.option, |
| 14830 | 14830 | .Rm = extended_register_explicit.index.alias.encode(.{}), |
| 14831 | .opc0 = ~@intFromEnum(sf), | |
| 14831 | .opc0 = ~@backingInt(sf), | |
| 14832 | 14832 | }, |
| 14833 | 14833 | } } } }; |
| 14834 | 14834 | }, |
| ... | ... | @@ -14984,7 +14984,7 @@ pub const Instruction = packed union { |
| 14984 | 14984 | .Rt = t.alias.encode(.{}), |
| 14985 | 14985 | .Rn = n.alias.encode(.{ .sp = true }), |
| 14986 | 14986 | .imm9 = simm, |
| 14987 | .opc0 = ~@intFromEnum(t.format.general), | |
| 14987 | .opc0 = ~@backingInt(t.format.general), | |
| 14988 | 14988 | }, |
| 14989 | 14989 | } } } }; |
| 14990 | 14990 | } |
| ... | ... | @@ -14996,7 +14996,7 @@ pub const Instruction = packed union { |
| 14996 | 14996 | .Rt = t.alias.encode(.{}), |
| 14997 | 14997 | .Rn = n.alias.encode(.{ .sp = true }), |
| 14998 | 14998 | .imm9 = simm, |
| 14999 | .opc0 = ~@intFromEnum(t.format.general), | |
| 14999 | .opc0 = ~@backingInt(t.format.general), | |
| 15000 | 15000 | }, |
| 15001 | 15001 | } } } }; |
| 15002 | 15002 | } |
| ... | ... | @@ -15778,7 +15778,7 @@ pub const Instruction = packed union { |
| 15778 | 15778 | .Rt = t1.alias.encode(.{}), |
| 15779 | 15779 | .Rn = post_index.base.alias.encode(.{ .sp = true }), |
| 15780 | 15780 | .Rt2 = t2.alias.encode(.{}), |
| 15781 | .imm7 = @intCast(@shrExact(post_index.index, @as(u2, 2) + @intFromEnum(sf))), | |
| 15781 | .imm7 = @intCast(@shrExact(post_index.index, @as(u2, 2) + @backingInt(sf))), | |
| 15782 | 15782 | .sf = sf, |
| 15783 | 15783 | }, |
| 15784 | 15784 | } } } }; |
| ... | ... | @@ -15790,7 +15790,7 @@ pub const Instruction = packed union { |
| 15790 | 15790 | .Rt = t1.alias.encode(.{}), |
| 15791 | 15791 | .Rn = pre_index.base.alias.encode(.{ .sp = true }), |
| 15792 | 15792 | .Rt2 = t2.alias.encode(.{}), |
| 15793 | .imm7 = @intCast(@shrExact(pre_index.index, @as(u2, 2) + @intFromEnum(sf))), | |
| 15793 | .imm7 = @intCast(@shrExact(pre_index.index, @as(u2, 2) + @backingInt(sf))), | |
| 15794 | 15794 | .sf = sf, |
| 15795 | 15795 | }, |
| 15796 | 15796 | } } } }; |
| ... | ... | @@ -15802,7 +15802,7 @@ pub const Instruction = packed union { |
| 15802 | 15802 | .Rt = t1.alias.encode(.{}), |
| 15803 | 15803 | .Rn = signed_offset.base.alias.encode(.{ .sp = true }), |
| 15804 | 15804 | .Rt2 = t2.alias.encode(.{}), |
| 15805 | .imm7 = @intCast(@shrExact(signed_offset.offset, @as(u2, 2) + @intFromEnum(sf))), | |
| 15805 | .imm7 = @intCast(@shrExact(signed_offset.offset, @as(u2, 2) + @backingInt(sf))), | |
| 15806 | 15806 | .sf = sf, |
| 15807 | 15807 | }, |
| 15808 | 15808 | } } } }; |
| ... | ... | @@ -15820,7 +15820,7 @@ pub const Instruction = packed union { |
| 15820 | 15820 | .Rt = t1.alias.encode(.{ .V = true }), |
| 15821 | 15821 | .Rn = post_index.base.alias.encode(.{ .sp = true }), |
| 15822 | 15822 | .Rt2 = t2.alias.encode(.{ .V = true }), |
| 15823 | .imm7 = @intCast(@shrExact(post_index.index, @intFromEnum(vs))), | |
| 15823 | .imm7 = @intCast(@shrExact(post_index.index, @backingInt(vs))), | |
| 15824 | 15824 | .opc = .encode(vs), |
| 15825 | 15825 | }, |
| 15826 | 15826 | } } } }; |
| ... | ... | @@ -15832,7 +15832,7 @@ pub const Instruction = packed union { |
| 15832 | 15832 | .Rt = t1.alias.encode(.{ .V = true }), |
| 15833 | 15833 | .Rn = signed_offset.base.alias.encode(.{ .sp = true }), |
| 15834 | 15834 | .Rt2 = t2.alias.encode(.{ .V = true }), |
| 15835 | .imm7 = @intCast(@shrExact(signed_offset.offset, @intFromEnum(vs))), | |
| 15835 | .imm7 = @intCast(@shrExact(signed_offset.offset, @backingInt(vs))), | |
| 15836 | 15836 | .opc = .encode(vs), |
| 15837 | 15837 | }, |
| 15838 | 15838 | } } } }; |
| ... | ... | @@ -15844,7 +15844,7 @@ pub const Instruction = packed union { |
| 15844 | 15844 | .Rt = t1.alias.encode(.{ .V = true }), |
| 15845 | 15845 | .Rn = pre_index.base.alias.encode(.{ .sp = true }), |
| 15846 | 15846 | .Rt2 = t2.alias.encode(.{ .V = true }), |
| 15847 | .imm7 = @intCast(@shrExact(pre_index.index, @intFromEnum(vs))), | |
| 15847 | .imm7 = @intCast(@shrExact(pre_index.index, @backingInt(vs))), | |
| 15848 | 15848 | .opc = .encode(vs), |
| 15849 | 15849 | }, |
| 15850 | 15850 | } } } }; |
| ... | ... | @@ -15893,7 +15893,7 @@ pub const Instruction = packed union { |
| 15893 | 15893 | .str = .{ |
| 15894 | 15894 | .Rt = t.alias.encode(.{}), |
| 15895 | 15895 | .Rn = unsigned_offset.base.alias.encode(.{ .sp = true }), |
| 15896 | .imm12 = @intCast(@shrExact(unsigned_offset.offset, @as(u2, 2) + @intFromEnum(sf))), | |
| 15896 | .imm12 = @intCast(@shrExact(unsigned_offset.offset, @as(u2, 2) + @backingInt(sf))), | |
| 15897 | 15897 | .sf = sf, |
| 15898 | 15898 | }, |
| 15899 | 15899 | } } } }; |
| ... | ... | @@ -15931,7 +15931,7 @@ pub const Instruction = packed union { |
| 15931 | 15931 | .str = .{ |
| 15932 | 15932 | .Rt = t.alias.encode(.{ .V = true }), |
| 15933 | 15933 | .Rn = unsigned_offset.base.alias.encode(.{ .sp = true }), |
| 15934 | .imm12 = @intCast(@shrExact(unsigned_offset.offset, @intFromEnum(vs))), | |
| 15934 | .imm12 = @intCast(@shrExact(unsigned_offset.offset, @backingInt(vs))), | |
| 15935 | 15935 | .opc1 = .encode(vs), |
| 15936 | 15936 | .size = .encode(vs), |
| 15937 | 15937 | }, |
src/codegen/c.zig+98-98| ... | ... | @@ -1657,10 +1657,10 @@ pub const DeclGen = struct { |
| 1657 | 1657 | switch (name) { |
| 1658 | 1658 | .nav => |nav| try renderNavName(w, nav, ip), |
| 1659 | 1659 | .nav_never_tail => |nav| try w.print("zig_never_tail_{f}__{d}", .{ |
| 1660 | fmtIdentUnsolo(ip.getNav(nav).name.toSlice(ip)), @intFromEnum(nav), | |
| 1660 | fmtIdentUnsolo(ip.getNav(nav).name.toSlice(ip)), @backingInt(nav), | |
| 1661 | 1661 | }), |
| 1662 | 1662 | .nav_never_inline => |nav| try w.print("zig_never_inline_{f}__{d}", .{ |
| 1663 | fmtIdentUnsolo(ip.getNav(nav).name.toSlice(ip)), @intFromEnum(nav), | |
| 1663 | fmtIdentUnsolo(ip.getNav(nav).name.toSlice(ip)), @backingInt(nav), | |
| 1664 | 1664 | }), |
| 1665 | 1665 | .@"export" => |@"export"| try w.print("{f}", .{fmtIdentSolo(@"export".extern_name.toSlice(ip))}), |
| 1666 | 1666 | } |
| ... | ... | @@ -2121,7 +2121,7 @@ pub fn genTagNameFn( |
| 2121 | 2121 | try w.print("static {s} zig_tagName_{f}__{d}({s} tag) {{\n", .{ |
| 2122 | 2122 | slice_const_u8_sentinel_0_type_name, |
| 2123 | 2123 | fmtIdentUnsolo(loaded_enum.name.toSlice(ip)), |
| 2124 | @intFromEnum(enum_ty.toIntern()), | |
| 2124 | @backingInt(enum_ty.toIntern()), | |
| 2125 | 2125 | enum_type_name, |
| 2126 | 2126 | }); |
| 2127 | 2127 | for (loaded_enum.field_names.get(ip), 0..) |field_name, field_index| { |
| ... | ... | @@ -2636,7 +2636,7 @@ fn genBodyInner(f: *Function, body: []const Air.Inst.Index) Error!void { |
| 2636 | 2636 | if (f.liveness.isUnused(inst) and !f.air.mustLower(inst, ip)) |
| 2637 | 2637 | continue; |
| 2638 | 2638 | |
| 2639 | const result_value = switch (air_tags[@intFromEnum(inst)]) { | |
| 2639 | const result_value = switch (air_tags[@backingInt(inst)]) { | |
| 2640 | 2640 | // zig fmt: off |
| 2641 | 2641 | .inferred_alloc, .inferred_alloc_comptime => unreachable, |
| 2642 | 2642 | |
| ... | ... | @@ -2948,7 +2948,7 @@ fn genBodyInner(f: *Function, body: []const Air.Inst.Index) Error!void { |
| 2948 | 2948 | } |
| 2949 | 2949 | |
| 2950 | 2950 | fn airSliceField(f: *Function, inst: Air.Inst.Index, is_ptr: bool, field_name: []const u8) !CValue { |
| 2951 | const ty_op = f.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 2951 | const ty_op = f.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 2952 | 2952 | |
| 2953 | 2953 | const inst_ty = f.typeOfIndex(inst); |
| 2954 | 2954 | const operand = try f.resolveInst(ty_op.operand); |
| ... | ... | @@ -2970,7 +2970,7 @@ fn airSliceField(f: *Function, inst: Air.Inst.Index, is_ptr: bool, field_name: [ |
| 2970 | 2970 | fn airPtrElemVal(f: *Function, inst: Air.Inst.Index) !CValue { |
| 2971 | 2971 | const zcu = f.dg.pt.zcu; |
| 2972 | 2972 | const inst_ty = f.typeOfIndex(inst); |
| 2973 | const bin_op = f.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 2973 | const bin_op = f.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 2974 | 2974 | assert(inst_ty.hasRuntimeBits(zcu)); |
| 2975 | 2975 | |
| 2976 | 2976 | const ptr = try f.resolveInst(bin_op.lhs); |
| ... | ... | @@ -2996,7 +2996,7 @@ fn airPtrElemVal(f: *Function, inst: Air.Inst.Index) !CValue { |
| 2996 | 2996 | fn airPtrElemPtr(f: *Function, inst: Air.Inst.Index) !CValue { |
| 2997 | 2997 | const pt = f.dg.pt; |
| 2998 | 2998 | const zcu = pt.zcu; |
| 2999 | const ty_pl = f.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | |
| 2999 | const ty_pl = f.air.instructions.items(.data)[@backingInt(inst)].ty_pl; | |
| 3000 | 3000 | const bin_op = f.air.extraData(Air.Bin, ty_pl.payload).data; |
| 3001 | 3001 | |
| 3002 | 3002 | const inst_ty = f.typeOfIndex(inst); |
| ... | ... | @@ -3028,7 +3028,7 @@ fn airPtrElemPtr(f: *Function, inst: Air.Inst.Index) !CValue { |
| 3028 | 3028 | fn airSliceElemVal(f: *Function, inst: Air.Inst.Index) !CValue { |
| 3029 | 3029 | const zcu = f.dg.pt.zcu; |
| 3030 | 3030 | const inst_ty = f.typeOfIndex(inst); |
| 3031 | const bin_op = f.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 3031 | const bin_op = f.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 3032 | 3032 | assert(inst_ty.hasRuntimeBits(zcu)); |
| 3033 | 3033 | |
| 3034 | 3034 | const slice = try f.resolveInst(bin_op.lhs); |
| ... | ... | @@ -3050,7 +3050,7 @@ fn airSliceElemVal(f: *Function, inst: Air.Inst.Index) !CValue { |
| 3050 | 3050 | fn airSliceElemPtr(f: *Function, inst: Air.Inst.Index) !CValue { |
| 3051 | 3051 | const pt = f.dg.pt; |
| 3052 | 3052 | const zcu = pt.zcu; |
| 3053 | const ty_pl = f.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | |
| 3053 | const ty_pl = f.air.instructions.items(.data)[@backingInt(inst)].ty_pl; | |
| 3054 | 3054 | const bin_op = f.air.extraData(Air.Bin, ty_pl.payload).data; |
| 3055 | 3055 | |
| 3056 | 3056 | const inst_ty = f.typeOfIndex(inst); |
| ... | ... | @@ -3077,7 +3077,7 @@ fn airSliceElemPtr(f: *Function, inst: Air.Inst.Index) !CValue { |
| 3077 | 3077 | |
| 3078 | 3078 | fn airArrayElemVal(f: *Function, inst: Air.Inst.Index) !CValue { |
| 3079 | 3079 | const zcu = f.dg.pt.zcu; |
| 3080 | const bin_op = f.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 3080 | const bin_op = f.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 3081 | 3081 | const inst_ty = f.typeOfIndex(inst); |
| 3082 | 3082 | assert(inst_ty.hasRuntimeBits(zcu)); |
| 3083 | 3083 | |
| ... | ... | @@ -3098,7 +3098,7 @@ fn airArrayElemVal(f: *Function, inst: Air.Inst.Index) !CValue { |
| 3098 | 3098 | } |
| 3099 | 3099 | |
| 3100 | 3100 | fn airLegalizeVecStoreElem(f: *Function, inst: Air.Inst.Index) !CValue { |
| 3101 | const pl_op = f.air.instructions.items(.data)[@intFromEnum(inst)].pl_op; | |
| 3101 | const pl_op = f.air.instructions.items(.data)[@backingInt(inst)].pl_op; | |
| 3102 | 3102 | const extra = f.air.extraData(Air.Bin, pl_op.payload).data; |
| 3103 | 3103 | |
| 3104 | 3104 | const vec_ptr = try f.resolveInst(pl_op.operand); |
| ... | ... | @@ -3209,7 +3209,7 @@ fn airArg(f: *Function, inst: Air.Inst.Index) !CValue { |
| 3209 | 3209 | fn airLoad(f: *Function, inst: Air.Inst.Index) !CValue { |
| 3210 | 3210 | const pt = f.dg.pt; |
| 3211 | 3211 | const zcu = pt.zcu; |
| 3212 | const ty_op = f.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 3212 | const ty_op = f.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 3213 | 3213 | |
| 3214 | 3214 | const ptr_ty = f.typeOf(ty_op.operand); |
| 3215 | 3215 | const ptr_scalar_ty = ptr_ty.scalarType(zcu); |
| ... | ... | @@ -3243,7 +3243,7 @@ fn airLoad(f: *Function, inst: Air.Inst.Index) !CValue { |
| 3243 | 3243 | else => |index| { |
| 3244 | 3244 | try w.writeByte('&'); |
| 3245 | 3245 | try f.writeCValue(w, operand, .other); |
| 3246 | try w.print("[{d}]", .{@intFromEnum(index)}); | |
| 3246 | try w.print("[{d}]", .{@backingInt(index)}); | |
| 3247 | 3247 | }, |
| 3248 | 3248 | } |
| 3249 | 3249 | try w.writeAll(", sizeof("); |
| ... | ... | @@ -3256,7 +3256,7 @@ fn airLoad(f: *Function, inst: Air.Inst.Index) !CValue { |
| 3256 | 3256 | .none => try f.writeCValueDeref(w, operand), |
| 3257 | 3257 | else => |index| { |
| 3258 | 3258 | try f.writeCValue(w, operand, .other); |
| 3259 | try w.print("[{d}]", .{@intFromEnum(index)}); | |
| 3259 | try w.print("[{d}]", .{@backingInt(index)}); | |
| 3260 | 3260 | }, |
| 3261 | 3261 | } |
| 3262 | 3262 | } |
| ... | ... | @@ -3269,13 +3269,13 @@ fn airLoad(f: *Function, inst: Air.Inst.Index) !CValue { |
| 3269 | 3269 | fn airRet(f: *Function, inst: Air.Inst.Index, is_ptr: bool) !void { |
| 3270 | 3270 | const pt = f.dg.pt; |
| 3271 | 3271 | const zcu = pt.zcu; |
| 3272 | const un_op = f.air.instructions.items(.data)[@intFromEnum(inst)].un_op; | |
| 3272 | const un_op = f.air.instructions.items(.data)[@backingInt(inst)].un_op; | |
| 3273 | 3273 | const w = &f.code.writer; |
| 3274 | 3274 | const op_inst = un_op.toIndex(); |
| 3275 | 3275 | const op_ty = f.typeOf(un_op); |
| 3276 | 3276 | const ret_ty = if (is_ptr) op_ty.childType(zcu) else op_ty; |
| 3277 | 3277 | |
| 3278 | if (op_inst != null and f.air.instructions.items(.tag)[@intFromEnum(op_inst.?)] == .call_always_tail) { | |
| 3278 | if (op_inst != null and f.air.instructions.items(.tag)[@backingInt(op_inst.?)] == .call_always_tail) { | |
| 3279 | 3279 | try reap(f, inst, &.{un_op}); |
| 3280 | 3280 | _ = try airCall(f, op_inst.?, .always_tail); |
| 3281 | 3281 | } else if (ret_ty.hasRuntimeBits(zcu)) { |
| ... | ... | @@ -3301,7 +3301,7 @@ fn airRet(f: *Function, inst: Air.Inst.Index, is_ptr: bool) !void { |
| 3301 | 3301 | fn airIntCast(f: *Function, inst: Air.Inst.Index) !CValue { |
| 3302 | 3302 | const pt = f.dg.pt; |
| 3303 | 3303 | const zcu = pt.zcu; |
| 3304 | const ty_op = f.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 3304 | const ty_op = f.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 3305 | 3305 | |
| 3306 | 3306 | const operand = try f.resolveInst(ty_op.operand); |
| 3307 | 3307 | try reap(f, inst, &.{ty_op.operand}); |
| ... | ... | @@ -3332,7 +3332,7 @@ fn airIntCast(f: *Function, inst: Air.Inst.Index) !CValue { |
| 3332 | 3332 | fn airTrunc(f: *Function, inst: Air.Inst.Index) !CValue { |
| 3333 | 3333 | const pt = f.dg.pt; |
| 3334 | 3334 | const zcu = pt.zcu; |
| 3335 | const ty_op = f.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 3335 | const ty_op = f.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 3336 | 3336 | |
| 3337 | 3337 | const operand = try f.resolveInst(ty_op.operand); |
| 3338 | 3338 | try reap(f, inst, &.{ty_op.operand}); |
| ... | ... | @@ -3419,7 +3419,7 @@ fn airStore(f: *Function, inst: Air.Inst.Index, safety: bool) !CValue { |
| 3419 | 3419 | const pt = f.dg.pt; |
| 3420 | 3420 | const zcu = pt.zcu; |
| 3421 | 3421 | // *a = b; |
| 3422 | const bin_op = f.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 3422 | const bin_op = f.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 3423 | 3423 | |
| 3424 | 3424 | const ptr_ty = f.typeOf(bin_op.lhs); |
| 3425 | 3425 | const ptr_scalar_ty = ptr_ty.scalarType(zcu); |
| ... | ... | @@ -3482,7 +3482,7 @@ fn airStore(f: *Function, inst: Air.Inst.Index, safety: bool) !CValue { |
| 3482 | 3482 | else => |index| { |
| 3483 | 3483 | try w.writeByte('&'); |
| 3484 | 3484 | try f.writeCValue(w, ptr_val, .other); |
| 3485 | try w.print("[{d}]", .{@intFromEnum(index)}); | |
| 3485 | try w.print("[{d}]", .{@backingInt(index)}); | |
| 3486 | 3486 | }, |
| 3487 | 3487 | } |
| 3488 | 3488 | try w.writeAll(", &"); |
| ... | ... | @@ -3508,7 +3508,7 @@ fn airStore(f: *Function, inst: Air.Inst.Index, safety: bool) !CValue { |
| 3508 | 3508 | .none => try f.writeCValueDeref(w, ptr_val), |
| 3509 | 3509 | else => |index| { |
| 3510 | 3510 | try f.writeCValue(w, ptr_val, .other); |
| 3511 | try w.print("[{d}]", .{@intFromEnum(index)}); | |
| 3511 | try w.print("[{d}]", .{@backingInt(index)}); | |
| 3512 | 3512 | }, |
| 3513 | 3513 | } |
| 3514 | 3514 | try w.writeAll(" = "); |
| ... | ... | @@ -3522,7 +3522,7 @@ fn airStore(f: *Function, inst: Air.Inst.Index, safety: bool) !CValue { |
| 3522 | 3522 | fn airOverflow(f: *Function, inst: Air.Inst.Index, operation: []const u8, info: BuiltinInfo) !CValue { |
| 3523 | 3523 | const pt = f.dg.pt; |
| 3524 | 3524 | const zcu = pt.zcu; |
| 3525 | const ty_pl = f.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | |
| 3525 | const ty_pl = f.air.instructions.items(.data)[@backingInt(inst)].ty_pl; | |
| 3526 | 3526 | const bin_op = f.air.extraData(Air.Bin, ty_pl.payload).data; |
| 3527 | 3527 | |
| 3528 | 3528 | const lhs = try f.resolveInst(bin_op.lhs); |
| ... | ... | @@ -3584,7 +3584,7 @@ fn airOverflow(f: *Function, inst: Air.Inst.Index, operation: []const u8, info: |
| 3584 | 3584 | fn airNot(f: *Function, inst: Air.Inst.Index) !CValue { |
| 3585 | 3585 | const pt = f.dg.pt; |
| 3586 | 3586 | const zcu = pt.zcu; |
| 3587 | const ty_op = f.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 3587 | const ty_op = f.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 3588 | 3588 | const operand_ty = f.typeOf(ty_op.operand); |
| 3589 | 3589 | const scalar_ty = operand_ty.scalarType(zcu); |
| 3590 | 3590 | if (scalar_ty.toIntern() != .bool_type) return try airUnBuiltinCall(f, inst, ty_op.operand, "not", .bits); |
| ... | ... | @@ -3619,7 +3619,7 @@ fn airBinOp( |
| 3619 | 3619 | ) !CValue { |
| 3620 | 3620 | const pt = f.dg.pt; |
| 3621 | 3621 | const zcu = pt.zcu; |
| 3622 | const bin_op = f.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 3622 | const bin_op = f.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 3623 | 3623 | const operand_ty = f.typeOf(bin_op.lhs); |
| 3624 | 3624 | const scalar_ty = operand_ty.scalarType(zcu); |
| 3625 | 3625 | if ((scalar_ty.isInt(zcu) and scalar_ty.bitSize(zcu) > 64) or scalar_ty.isRuntimeFloat()) |
| ... | ... | @@ -3715,7 +3715,7 @@ fn airEquality( |
| 3715 | 3715 | ) !CValue { |
| 3716 | 3716 | const pt = f.dg.pt; |
| 3717 | 3717 | const zcu = pt.zcu; |
| 3718 | const bin_op = f.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 3718 | const bin_op = f.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 3719 | 3719 | |
| 3720 | 3720 | const operand_ty = f.typeOf(bin_op.lhs); |
| 3721 | 3721 | if (operand_ty.isAbiInt(zcu)) { |
| ... | ... | @@ -3799,7 +3799,7 @@ fn airEquality( |
| 3799 | 3799 | } |
| 3800 | 3800 | |
| 3801 | 3801 | fn airCmpLteErrorsLen(f: *Function, inst: Air.Inst.Index) !CValue { |
| 3802 | const un_op = f.air.instructions.items(.data)[@intFromEnum(inst)].un_op; | |
| 3802 | const un_op = f.air.instructions.items(.data)[@backingInt(inst)].un_op; | |
| 3803 | 3803 | |
| 3804 | 3804 | const operand = try f.resolveInst(un_op); |
| 3805 | 3805 | try reap(f, inst, &.{un_op}); |
| ... | ... | @@ -3817,7 +3817,7 @@ fn airCmpLteErrorsLen(f: *Function, inst: Air.Inst.Index) !CValue { |
| 3817 | 3817 | fn airPtrAddSub(f: *Function, inst: Air.Inst.Index, operator: u8) !CValue { |
| 3818 | 3818 | const pt = f.dg.pt; |
| 3819 | 3819 | const zcu = pt.zcu; |
| 3820 | const ty_pl = f.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | |
| 3820 | const ty_pl = f.air.instructions.items(.data)[@backingInt(inst)].ty_pl; | |
| 3821 | 3821 | const bin_op = f.air.extraData(Air.Bin, ty_pl.payload).data; |
| 3822 | 3822 | |
| 3823 | 3823 | const lhs = try f.resolveInst(bin_op.lhs); |
| ... | ... | @@ -3857,7 +3857,7 @@ fn airPtrAddSub(f: *Function, inst: Air.Inst.Index, operator: u8) !CValue { |
| 3857 | 3857 | fn airMinMax(f: *Function, inst: Air.Inst.Index, operator: u8, operation: []const u8) !CValue { |
| 3858 | 3858 | const pt = f.dg.pt; |
| 3859 | 3859 | const zcu = pt.zcu; |
| 3860 | const bin_op = f.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 3860 | const bin_op = f.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 3861 | 3861 | |
| 3862 | 3862 | const inst_ty = f.typeOfIndex(inst); |
| 3863 | 3863 | const inst_scalar_ty = inst_ty.scalarType(zcu); |
| ... | ... | @@ -3897,7 +3897,7 @@ fn airMinMax(f: *Function, inst: Air.Inst.Index, operator: u8, operation: []cons |
| 3897 | 3897 | } |
| 3898 | 3898 | |
| 3899 | 3899 | fn airSlice(f: *Function, inst: Air.Inst.Index) !CValue { |
| 3900 | const ty_pl = f.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | |
| 3900 | const ty_pl = f.air.instructions.items(.data)[@backingInt(inst)].ty_pl; | |
| 3901 | 3901 | const bin_op = f.air.extraData(Air.Bin, ty_pl.payload).data; |
| 3902 | 3902 | |
| 3903 | 3903 | const ptr = try f.resolveInst(bin_op.lhs); |
| ... | ... | @@ -4014,13 +4014,13 @@ fn airCall( |
| 4014 | 4014 | .never_tail => { |
| 4015 | 4015 | try f.need_never_tail_funcs.put(gpa, fn_nav, {}); |
| 4016 | 4016 | try w.print("zig_never_tail_{f}__{d}", .{ |
| 4017 | fmtIdentUnsolo(ip.getNav(fn_nav).name.toSlice(ip)), @intFromEnum(fn_nav), | |
| 4017 | fmtIdentUnsolo(ip.getNav(fn_nav).name.toSlice(ip)), @backingInt(fn_nav), | |
| 4018 | 4018 | }); |
| 4019 | 4019 | }, |
| 4020 | 4020 | .never_inline => { |
| 4021 | 4021 | try f.need_never_inline_funcs.put(gpa, fn_nav, {}); |
| 4022 | 4022 | try w.print("zig_never_inline_{f}__{d}", .{ |
| 4023 | fmtIdentUnsolo(ip.getNav(fn_nav).name.toSlice(ip)), @intFromEnum(fn_nav), | |
| 4023 | fmtIdentUnsolo(ip.getNav(fn_nav).name.toSlice(ip)), @backingInt(fn_nav), | |
| 4024 | 4024 | }); |
| 4025 | 4025 | }, |
| 4026 | 4026 | else => unreachable, |
| ... | ... | @@ -4056,7 +4056,7 @@ fn airCall( |
| 4056 | 4056 | } |
| 4057 | 4057 | |
| 4058 | 4058 | fn airDbgStmt(f: *Function, inst: Air.Inst.Index) !CValue { |
| 4059 | const dbg_stmt = f.air.instructions.items(.data)[@intFromEnum(inst)].dbg_stmt; | |
| 4059 | const dbg_stmt = f.air.instructions.items(.data)[@backingInt(inst)].dbg_stmt; | |
| 4060 | 4060 | const w = &f.code.writer; |
| 4061 | 4061 | // TODO re-evaluate whether to emit these or not. If we naively emit |
| 4062 | 4062 | // these directives, the output file will report bogus line numbers because |
| ... | ... | @@ -4093,9 +4093,9 @@ fn airDbgInlineBlock(f: *Function, inst: Air.Inst.Index) !CValue { |
| 4093 | 4093 | fn airDbgVar(f: *Function, inst: Air.Inst.Index) !CValue { |
| 4094 | 4094 | const pt = f.dg.pt; |
| 4095 | 4095 | const zcu = pt.zcu; |
| 4096 | const tag = f.air.instructions.items(.tag)[@intFromEnum(inst)]; | |
| 4097 | const pl_op = f.air.instructions.items(.data)[@intFromEnum(inst)].pl_op; | |
| 4098 | const name: Air.NullTerminatedString = @enumFromInt(pl_op.payload); | |
| 4096 | const tag = f.air.instructions.items(.tag)[@backingInt(inst)]; | |
| 4097 | const pl_op = f.air.instructions.items(.data)[@backingInt(inst)].pl_op; | |
| 4098 | const name: Air.NullTerminatedString = @fromBackingInt(@intCast(pl_op.payload)); | |
| 4099 | 4099 | const operand_is_undef = if (pl_op.operand.toInterned()) |ip_index| Value.fromInterned(ip_index).isUndef(zcu) else false; |
| 4100 | 4100 | if (!operand_is_undef) _ = try f.resolveInst(pl_op.operand); |
| 4101 | 4101 | |
| ... | ... | @@ -4236,7 +4236,7 @@ fn lowerTry( |
| 4236 | 4236 | } |
| 4237 | 4237 | |
| 4238 | 4238 | fn airBr(f: *Function, inst: Air.Inst.Index) !void { |
| 4239 | const branch = f.air.instructions.items(.data)[@intFromEnum(inst)].br; | |
| 4239 | const branch = f.air.instructions.items(.data)[@backingInt(inst)].br; | |
| 4240 | 4240 | const block = f.blocks.get(branch.block_inst).?; |
| 4241 | 4241 | const result = block.result; |
| 4242 | 4242 | const w = &f.code.writer; |
| ... | ... | @@ -4263,14 +4263,14 @@ fn airBr(f: *Function, inst: Air.Inst.Index) !void { |
| 4263 | 4263 | } |
| 4264 | 4264 | |
| 4265 | 4265 | fn airRepeat(f: *Function, inst: Air.Inst.Index) !void { |
| 4266 | const repeat = f.air.instructions.items(.data)[@intFromEnum(inst)].repeat; | |
| 4267 | try f.code.writer.print("goto zig_loop_{d};\n", .{@intFromEnum(repeat.loop_inst)}); | |
| 4266 | const repeat = f.air.instructions.items(.data)[@backingInt(inst)].repeat; | |
| 4267 | try f.code.writer.print("goto zig_loop_{d};\n", .{@backingInt(repeat.loop_inst)}); | |
| 4268 | 4268 | } |
| 4269 | 4269 | |
| 4270 | 4270 | fn airSwitchDispatch(f: *Function, inst: Air.Inst.Index) !void { |
| 4271 | 4271 | const pt = f.dg.pt; |
| 4272 | 4272 | const zcu = pt.zcu; |
| 4273 | const br = f.air.instructions.items(.data)[@intFromEnum(inst)].br; | |
| 4273 | const br = f.air.instructions.items(.data)[@backingInt(inst)].br; | |
| 4274 | 4274 | const w = &f.code.writer; |
| 4275 | 4275 | |
| 4276 | 4276 | if (br.operand.toInterned()) |cond_ip_index| { |
| ... | ... | @@ -4294,7 +4294,7 @@ fn airSwitchDispatch(f: *Function, inst: Air.Inst.Index) !void { |
| 4294 | 4294 | } |
| 4295 | 4295 | } |
| 4296 | 4296 | } else switch_br.cases_len; |
| 4297 | try w.print("goto zig_switch_{d}_dispatch_{d};\n", .{ @intFromEnum(br.block_inst), target_case_idx }); | |
| 4297 | try w.print("goto zig_switch_{d}_dispatch_{d};\n", .{ @backingInt(br.block_inst), target_case_idx }); | |
| 4298 | 4298 | return; |
| 4299 | 4299 | } |
| 4300 | 4300 | |
| ... | ... | @@ -4306,7 +4306,7 @@ fn airSwitchDispatch(f: *Function, inst: Air.Inst.Index) !void { |
| 4306 | 4306 | try f.writeCValue(w, cond, .other); |
| 4307 | 4307 | try w.writeByte(';'); |
| 4308 | 4308 | try f.newline(); |
| 4309 | try w.print("goto zig_switch_{d}_loop;\n", .{@intFromEnum(br.block_inst)}); | |
| 4309 | try w.print("goto zig_switch_{d}_loop;\n", .{@backingInt(br.block_inst)}); | |
| 4310 | 4310 | } |
| 4311 | 4311 | |
| 4312 | 4312 | fn airPtrCast(f: *Function, inst: Air.Inst.Index) Error!CValue { |
| ... | ... | @@ -4325,7 +4325,7 @@ fn airPtrCast(f: *Function, inst: Air.Inst.Index) Error!CValue { |
| 4325 | 4325 | |
| 4326 | 4326 | // For slice casts we need to assign both fields. |
| 4327 | 4327 | |
| 4328 | const ty_op = f.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 4328 | const ty_op = f.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 4329 | 4329 | const operand = try f.resolveInst(ty_op.operand); |
| 4330 | 4330 | |
| 4331 | 4331 | const w = &f.code.writer; |
| ... | ... | @@ -4352,7 +4352,7 @@ fn airPtrCast(f: *Function, inst: Air.Inst.Index) Error!CValue { |
| 4352 | 4352 | fn airSimpleCast(f: *Function, inst: Air.Inst.Index) Error!CValue { |
| 4353 | 4353 | const zcu = f.dg.pt.zcu; |
| 4354 | 4354 | |
| 4355 | const ty_op = f.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 4355 | const ty_op = f.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 4356 | 4356 | const dest_ty = f.typeOfIndex(inst); |
| 4357 | 4357 | const operand_ty = f.typeOf(ty_op.operand); |
| 4358 | 4358 | const operand = try f.resolveInst(ty_op.operand); |
| ... | ... | @@ -4378,7 +4378,7 @@ fn airSimpleCast(f: *Function, inst: Air.Inst.Index) Error!CValue { |
| 4378 | 4378 | fn airNopCast(f: *Function, inst: Air.Inst.Index) Error!CValue { |
| 4379 | 4379 | const zcu = f.dg.pt.zcu; |
| 4380 | 4380 | |
| 4381 | const ty_op = f.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 4381 | const ty_op = f.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 4382 | 4382 | const dest_ty = f.typeOfIndex(inst); |
| 4383 | 4383 | const operand_ty = f.typeOf(ty_op.operand); |
| 4384 | 4384 | const operand = try f.resolveInst(ty_op.operand); |
| ... | ... | @@ -4393,7 +4393,7 @@ fn airNopCast(f: *Function, inst: Air.Inst.Index) Error!CValue { |
| 4393 | 4393 | fn airUnionFromEnum(f: *Function, inst: Air.Inst.Index) Error!CValue { |
| 4394 | 4394 | const zcu = f.dg.pt.zcu; |
| 4395 | 4395 | |
| 4396 | const ty_op = f.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 4396 | const ty_op = f.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 4397 | 4397 | const dest_ty = f.typeOfIndex(inst); |
| 4398 | 4398 | const operand_ty = f.typeOf(ty_op.operand); |
| 4399 | 4399 | const operand = try f.resolveInst(ty_op.operand); |
| ... | ... | @@ -4418,7 +4418,7 @@ fn airBitCast(f: *Function, inst: Air.Inst.Index) Error!CValue { |
| 4418 | 4418 | const zcu = pt.zcu; |
| 4419 | 4419 | const w = &f.code.writer; |
| 4420 | 4420 | |
| 4421 | const ty_op = f.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 4421 | const ty_op = f.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 4422 | 4422 | const dest_ty = f.typeOfIndex(inst); |
| 4423 | 4423 | |
| 4424 | 4424 | const operand = try f.resolveInst(ty_op.operand); |
| ... | ... | @@ -4594,7 +4594,7 @@ fn airLoop(f: *Function, inst: Air.Inst.Index) !void { |
| 4594 | 4594 | // this label. Since we need a label for arbitrary `repeat` |
| 4595 | 4595 | // anyway, there's actually no need to use a "real" looping |
| 4596 | 4596 | // construct at all! |
| 4597 | try w.print("zig_loop_{d}:", .{@intFromEnum(inst)}); | |
| 4597 | try w.print("zig_loop_{d}:", .{@backingInt(inst)}); | |
| 4598 | 4598 | try f.newline(); |
| 4599 | 4599 | try genBodyInner(f, block.body); // no need to restore state, we're noreturn |
| 4600 | 4600 | } |
| ... | ... | @@ -4647,7 +4647,7 @@ fn airSwitchBr(f: *Function, inst: Air.Inst.Index, is_dispatch_loop: bool) !void |
| 4647 | 4647 | const cond_val = if (is_dispatch_loop) cond: { |
| 4648 | 4648 | const new_local = try f.allocLocal(inst, cond_ty); |
| 4649 | 4649 | try f.copyCValue(new_local, init_condition); |
| 4650 | try w.print("zig_switch_{d}_loop:", .{@intFromEnum(inst)}); | |
| 4650 | try w.print("zig_switch_{d}_loop:", .{@backingInt(inst)}); | |
| 4651 | 4651 | try f.newline(); |
| 4652 | 4652 | try f.loop_switch_conds.put(gpa, inst, new_local.new_local); |
| 4653 | 4653 | break :cond new_local; |
| ... | ... | @@ -4757,7 +4757,7 @@ fn airSwitchBr(f: *Function, inst: Air.Inst.Index, is_dispatch_loop: bool) !void |
| 4757 | 4757 | f.indent(); |
| 4758 | 4758 | try f.newline(); |
| 4759 | 4759 | if (is_dispatch_loop) { |
| 4760 | try w.print("zig_switch_{d}_dispatch_{d}:;", .{ @intFromEnum(inst), case.idx }); | |
| 4760 | try w.print("zig_switch_{d}_dispatch_{d}:;", .{ @backingInt(inst), case.idx }); | |
| 4761 | 4761 | try f.newline(); |
| 4762 | 4762 | } |
| 4763 | 4763 | try genBodyResolveState(f, inst, liveness.deaths[case.idx], case.body, true); |
| ... | ... | @@ -4781,7 +4781,7 @@ fn airSwitchBr(f: *Function, inst: Air.Inst.Index, is_dispatch_loop: bool) !void |
| 4781 | 4781 | try lowerSwitchToConditions(f, inst, cond_val, lowered_cond_ty, switch_br, liveness, is_dispatch_loop, true); |
| 4782 | 4782 | } |
| 4783 | 4783 | if (is_dispatch_loop) { |
| 4784 | try w.print("zig_switch_{d}_dispatch_{d}: ", .{ @intFromEnum(inst), switch_br.cases_len }); | |
| 4784 | try w.print("zig_switch_{d}_dispatch_{d}: ", .{ @backingInt(inst), switch_br.cases_len }); | |
| 4785 | 4785 | } |
| 4786 | 4786 | const else_body = it.elseBody(); |
| 4787 | 4787 | if (else_body.len > 0) { |
| ... | ... | @@ -4838,7 +4838,7 @@ fn lowerSwitchToConditions( |
| 4838 | 4838 | f.indent(); |
| 4839 | 4839 | try f.newline(); |
| 4840 | 4840 | if (is_dispatch_loop) { |
| 4841 | try w.print("zig_switch_{d}_dispatch_{d}: ", .{ @intFromEnum(inst), case.idx }); | |
| 4841 | try w.print("zig_switch_{d}_dispatch_{d}: ", .{ @backingInt(inst), case.idx }); | |
| 4842 | 4842 | } |
| 4843 | 4843 | try genBodyResolveState(f, inst, liveness.deaths[case.idx], case.body, true); |
| 4844 | 4844 | try f.outdent(); |
| ... | ... | @@ -4850,7 +4850,7 @@ fn lowerSwitchToConditions( |
| 4850 | 4850 | |
| 4851 | 4851 | if (!only_ranges) { |
| 4852 | 4852 | if (is_dispatch_loop) { |
| 4853 | try w.print("zig_switch_{d}_dispatch_{d}: ", .{ @intFromEnum(inst), switch_br.cases_len }); | |
| 4853 | try w.print("zig_switch_{d}_dispatch_{d}: ", .{ @backingInt(inst), switch_br.cases_len }); | |
| 4854 | 4854 | } |
| 4855 | 4855 | const else_body = it.elseBody(); |
| 4856 | 4856 | if (else_body.len > 0) { |
| ... | ... | @@ -5210,7 +5210,7 @@ fn airIsNull( |
| 5210 | 5210 | ) !CValue { |
| 5211 | 5211 | const pt = f.dg.pt; |
| 5212 | 5212 | const zcu = pt.zcu; |
| 5213 | const un_op = f.air.instructions.items(.data)[@intFromEnum(inst)].un_op; | |
| 5213 | const un_op = f.air.instructions.items(.data)[@backingInt(inst)].un_op; | |
| 5214 | 5214 | |
| 5215 | 5215 | const w = &f.code.writer; |
| 5216 | 5216 | const operand = try f.resolveInst(un_op); |
| ... | ... | @@ -5268,7 +5268,7 @@ fn airIsNull( |
| 5268 | 5268 | fn airOptionalPayload(f: *Function, inst: Air.Inst.Index, is_ptr: bool) !CValue { |
| 5269 | 5269 | const pt = f.dg.pt; |
| 5270 | 5270 | const zcu = pt.zcu; |
| 5271 | const ty_op = f.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 5271 | const ty_op = f.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 5272 | 5272 | |
| 5273 | 5273 | const inst_ty = f.typeOfIndex(inst); |
| 5274 | 5274 | const operand_ty = f.typeOf(ty_op.operand); |
| ... | ... | @@ -5305,7 +5305,7 @@ fn airOptionalPayload(f: *Function, inst: Air.Inst.Index, is_ptr: bool) !CValue |
| 5305 | 5305 | fn airOptionalPayloadPtrSet(f: *Function, inst: Air.Inst.Index) !CValue { |
| 5306 | 5306 | const pt = f.dg.pt; |
| 5307 | 5307 | const zcu = pt.zcu; |
| 5308 | const ty_op = f.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 5308 | const ty_op = f.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 5309 | 5309 | const w = &f.code.writer; |
| 5310 | 5310 | const operand = try f.resolveInst(ty_op.operand); |
| 5311 | 5311 | try reap(f, inst, &.{ty_op.operand}); |
| ... | ... | @@ -5418,7 +5418,7 @@ fn fieldLocation( |
| 5418 | 5418 | } |
| 5419 | 5419 | |
| 5420 | 5420 | fn airStructFieldPtr(f: *Function, inst: Air.Inst.Index) !CValue { |
| 5421 | const ty_pl = f.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | |
| 5421 | const ty_pl = f.air.instructions.items(.data)[@backingInt(inst)].ty_pl; | |
| 5422 | 5422 | const extra = f.air.extraData(Air.StructField, ty_pl.payload).data; |
| 5423 | 5423 | |
| 5424 | 5424 | const container_ptr_val = try f.resolveInst(extra.struct_operand); |
| ... | ... | @@ -5428,7 +5428,7 @@ fn airStructFieldPtr(f: *Function, inst: Air.Inst.Index) !CValue { |
| 5428 | 5428 | } |
| 5429 | 5429 | |
| 5430 | 5430 | fn airStructFieldPtrIndex(f: *Function, inst: Air.Inst.Index, index: u8) !CValue { |
| 5431 | const ty_op = f.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 5431 | const ty_op = f.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 5432 | 5432 | |
| 5433 | 5433 | const container_ptr_val = try f.resolveInst(ty_op.operand); |
| 5434 | 5434 | try reap(f, inst, &.{ty_op.operand}); |
| ... | ... | @@ -5439,7 +5439,7 @@ fn airStructFieldPtrIndex(f: *Function, inst: Air.Inst.Index, index: u8) !CValue |
| 5439 | 5439 | fn airFieldParentPtr(f: *Function, inst: Air.Inst.Index) !CValue { |
| 5440 | 5440 | const pt = f.dg.pt; |
| 5441 | 5441 | const zcu = pt.zcu; |
| 5442 | const ty_pl = f.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | |
| 5442 | const ty_pl = f.air.instructions.items(.data)[@backingInt(inst)].ty_pl; | |
| 5443 | 5443 | const extra = f.air.extraData(Air.FieldParentPtr, ty_pl.payload).data; |
| 5444 | 5444 | |
| 5445 | 5445 | const container_ptr_ty = f.typeOfIndex(inst); |
| ... | ... | @@ -5535,7 +5535,7 @@ fn airAggFieldVal(f: *Function, inst: Air.Inst.Index) !CValue { |
| 5535 | 5535 | const pt = f.dg.pt; |
| 5536 | 5536 | const zcu = pt.zcu; |
| 5537 | 5537 | const ip = &zcu.intern_pool; |
| 5538 | const ty_pl = f.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | |
| 5538 | const ty_pl = f.air.instructions.items(.data)[@backingInt(inst)].ty_pl; | |
| 5539 | 5539 | const extra = f.air.extraData(Air.StructField, ty_pl.payload).data; |
| 5540 | 5540 | |
| 5541 | 5541 | const inst_ty = f.typeOfIndex(inst); |
| ... | ... | @@ -5573,7 +5573,7 @@ fn airAggFieldVal(f: *Function, inst: Air.Inst.Index) !CValue { |
| 5573 | 5573 | fn airUnwrapErrUnionErr(f: *Function, inst: Air.Inst.Index) !CValue { |
| 5574 | 5574 | const pt = f.dg.pt; |
| 5575 | 5575 | const zcu = pt.zcu; |
| 5576 | const ty_op = f.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 5576 | const ty_op = f.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 5577 | 5577 | |
| 5578 | 5578 | const inst_ty = f.typeOfIndex(inst); |
| 5579 | 5579 | const operand = try f.resolveInst(ty_op.operand); |
| ... | ... | @@ -5599,7 +5599,7 @@ fn airUnwrapErrUnionErr(f: *Function, inst: Air.Inst.Index) !CValue { |
| 5599 | 5599 | fn airUnwrapErrUnionPay(f: *Function, inst: Air.Inst.Index, is_ptr: bool) !CValue { |
| 5600 | 5600 | const pt = f.dg.pt; |
| 5601 | 5601 | const zcu = pt.zcu; |
| 5602 | const ty_op = f.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 5602 | const ty_op = f.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 5603 | 5603 | |
| 5604 | 5604 | const inst_ty = f.typeOfIndex(inst); |
| 5605 | 5605 | const operand = try f.resolveInst(ty_op.operand); |
| ... | ... | @@ -5635,7 +5635,7 @@ fn airUnwrapErrUnionPay(f: *Function, inst: Air.Inst.Index, is_ptr: bool) !CValu |
| 5635 | 5635 | |
| 5636 | 5636 | fn airWrapOptional(f: *Function, inst: Air.Inst.Index) !CValue { |
| 5637 | 5637 | const zcu = f.dg.pt.zcu; |
| 5638 | const ty_op = f.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 5638 | const ty_op = f.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 5639 | 5639 | |
| 5640 | 5640 | const inst_ty = f.typeOfIndex(inst); |
| 5641 | 5641 | |
| ... | ... | @@ -5673,7 +5673,7 @@ fn airWrapOptional(f: *Function, inst: Air.Inst.Index) !CValue { |
| 5673 | 5673 | fn airWrapErrUnionErr(f: *Function, inst: Air.Inst.Index) !CValue { |
| 5674 | 5674 | const pt = f.dg.pt; |
| 5675 | 5675 | const zcu = pt.zcu; |
| 5676 | const ty_op = f.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 5676 | const ty_op = f.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 5677 | 5677 | |
| 5678 | 5678 | const inst_ty = f.typeOfIndex(inst); |
| 5679 | 5679 | const payload_ty = inst_ty.errorUnionPayload(zcu); |
| ... | ... | @@ -5703,7 +5703,7 @@ fn airWrapErrUnionErr(f: *Function, inst: Air.Inst.Index) !CValue { |
| 5703 | 5703 | fn airErrUnionPayloadPtrSet(f: *Function, inst: Air.Inst.Index) !CValue { |
| 5704 | 5704 | const pt = f.dg.pt; |
| 5705 | 5705 | const w = &f.code.writer; |
| 5706 | const ty_op = f.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 5706 | const ty_op = f.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 5707 | 5707 | const inst_ty = f.typeOfIndex(inst); |
| 5708 | 5708 | const operand = try f.resolveInst(ty_op.operand); |
| 5709 | 5709 | |
| ... | ... | @@ -5746,7 +5746,7 @@ fn airSaveErrReturnTraceIndex(f: *Function, inst: Air.Inst.Index) !CValue { |
| 5746 | 5746 | fn airWrapErrUnionPay(f: *Function, inst: Air.Inst.Index) !CValue { |
| 5747 | 5747 | const pt = f.dg.pt; |
| 5748 | 5748 | const zcu = pt.zcu; |
| 5749 | const ty_op = f.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 5749 | const ty_op = f.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 5750 | 5750 | |
| 5751 | 5751 | const inst_ty = f.typeOfIndex(inst); |
| 5752 | 5752 | const payload_ty = inst_ty.errorUnionPayload(zcu); |
| ... | ... | @@ -5774,7 +5774,7 @@ fn airWrapErrUnionPay(f: *Function, inst: Air.Inst.Index) !CValue { |
| 5774 | 5774 | |
| 5775 | 5775 | fn airIsErr(f: *Function, inst: Air.Inst.Index, is_ptr: bool, operator: []const u8) !CValue { |
| 5776 | 5776 | const pt = f.dg.pt; |
| 5777 | const un_op = f.air.instructions.items(.data)[@intFromEnum(inst)].un_op; | |
| 5777 | const un_op = f.air.instructions.items(.data)[@backingInt(inst)].un_op; | |
| 5778 | 5778 | |
| 5779 | 5779 | const w = &f.code.writer; |
| 5780 | 5780 | const operand = try f.resolveInst(un_op); |
| ... | ... | @@ -5798,7 +5798,7 @@ fn airIsErr(f: *Function, inst: Air.Inst.Index, is_ptr: bool, operator: []const |
| 5798 | 5798 | fn airArrayToSlice(f: *Function, inst: Air.Inst.Index) !CValue { |
| 5799 | 5799 | const pt = f.dg.pt; |
| 5800 | 5800 | const zcu = pt.zcu; |
| 5801 | const ty_op = f.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 5801 | const ty_op = f.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 5802 | 5802 | |
| 5803 | 5803 | const operand = try f.resolveInst(ty_op.operand); |
| 5804 | 5804 | try reap(f, inst, &.{ty_op.operand}); |
| ... | ... | @@ -5835,7 +5835,7 @@ fn airArrayToSlice(f: *Function, inst: Air.Inst.Index) !CValue { |
| 5835 | 5835 | fn airFloatCast(f: *Function, inst: Air.Inst.Index) !CValue { |
| 5836 | 5836 | const pt = f.dg.pt; |
| 5837 | 5837 | const zcu = pt.zcu; |
| 5838 | const ty_op = f.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 5838 | const ty_op = f.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 5839 | 5839 | |
| 5840 | 5840 | const inst_ty = f.typeOfIndex(inst); |
| 5841 | 5841 | const inst_scalar_ty = inst_ty.scalarType(zcu); |
| ... | ... | @@ -5939,7 +5939,7 @@ fn airBinBuiltinCall( |
| 5939 | 5939 | ) !CValue { |
| 5940 | 5940 | const pt = f.dg.pt; |
| 5941 | 5941 | const zcu = pt.zcu; |
| 5942 | const bin_op = f.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 5942 | const bin_op = f.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 5943 | 5943 | |
| 5944 | 5944 | const operand_ty = f.typeOf(bin_op.lhs); |
| 5945 | 5945 | const is_big = lowersToBigInt(operand_ty, zcu); |
| ... | ... | @@ -6052,7 +6052,7 @@ fn airCmpBuiltinCall( |
| 6052 | 6052 | fn airCmpxchg(f: *Function, inst: Air.Inst.Index, flavor: [*:0]const u8) !CValue { |
| 6053 | 6053 | const pt = f.dg.pt; |
| 6054 | 6054 | const zcu = pt.zcu; |
| 6055 | const ty_pl = f.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | |
| 6055 | const ty_pl = f.air.instructions.items(.data)[@backingInt(inst)].ty_pl; | |
| 6056 | 6056 | const extra = f.air.extraData(Air.Cmpxchg, ty_pl.payload).data; |
| 6057 | 6057 | const inst_ty = f.typeOfIndex(inst); |
| 6058 | 6058 | const ptr = try f.resolveInst(extra.ptr); |
| ... | ... | @@ -6151,7 +6151,7 @@ fn airCmpxchg(f: *Function, inst: Air.Inst.Index, flavor: [*:0]const u8) !CValue |
| 6151 | 6151 | fn airAtomicRmw(f: *Function, inst: Air.Inst.Index) !CValue { |
| 6152 | 6152 | const pt = f.dg.pt; |
| 6153 | 6153 | const zcu = pt.zcu; |
| 6154 | const pl_op = f.air.instructions.items(.data)[@intFromEnum(inst)].pl_op; | |
| 6154 | const pl_op = f.air.instructions.items(.data)[@backingInt(inst)].pl_op; | |
| 6155 | 6155 | const extra = f.air.extraData(Air.AtomicRmw, pl_op.payload).data; |
| 6156 | 6156 | const inst_ty = f.typeOfIndex(inst); |
| 6157 | 6157 | const ptr_ty = f.typeOf(pl_op.operand); |
| ... | ... | @@ -6208,7 +6208,7 @@ fn airAtomicRmw(f: *Function, inst: Air.Inst.Index) !CValue { |
| 6208 | 6208 | fn airAtomicLoad(f: *Function, inst: Air.Inst.Index) !CValue { |
| 6209 | 6209 | const pt = f.dg.pt; |
| 6210 | 6210 | const zcu = pt.zcu; |
| 6211 | const atomic_load = f.air.instructions.items(.data)[@intFromEnum(inst)].atomic_load; | |
| 6211 | const atomic_load = f.air.instructions.items(.data)[@backingInt(inst)].atomic_load; | |
| 6212 | 6212 | const ptr = try f.resolveInst(atomic_load.ptr); |
| 6213 | 6213 | try reap(f, inst, &.{atomic_load.ptr}); |
| 6214 | 6214 | const ptr_ty = f.typeOf(atomic_load.ptr); |
| ... | ... | @@ -6246,7 +6246,7 @@ fn airAtomicLoad(f: *Function, inst: Air.Inst.Index) !CValue { |
| 6246 | 6246 | fn airAtomicStore(f: *Function, inst: Air.Inst.Index, order: [*:0]const u8) !CValue { |
| 6247 | 6247 | const pt = f.dg.pt; |
| 6248 | 6248 | const zcu = pt.zcu; |
| 6249 | const bin_op = f.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 6249 | const bin_op = f.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 6250 | 6250 | const ptr_ty = f.typeOf(bin_op.lhs); |
| 6251 | 6251 | const ty = ptr_ty.childType(zcu); |
| 6252 | 6252 | const ptr = try f.resolveInst(bin_op.lhs); |
| ... | ... | @@ -6283,7 +6283,7 @@ fn airAtomicStore(f: *Function, inst: Air.Inst.Index, order: [*:0]const u8) !CVa |
| 6283 | 6283 | fn airMemset(f: *Function, inst: Air.Inst.Index, safety: bool) !CValue { |
| 6284 | 6284 | const pt = f.dg.pt; |
| 6285 | 6285 | const zcu = pt.zcu; |
| 6286 | const bin_op = f.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 6286 | const bin_op = f.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 6287 | 6287 | const dest_ty = f.typeOf(bin_op.lhs); |
| 6288 | 6288 | const dest_slice = try f.resolveInst(bin_op.lhs); |
| 6289 | 6289 | const value = try f.resolveInst(bin_op.rhs); |
| ... | ... | @@ -6389,7 +6389,7 @@ fn airMemset(f: *Function, inst: Air.Inst.Index, safety: bool) !CValue { |
| 6389 | 6389 | fn airMemcpy(f: *Function, inst: Air.Inst.Index, function_paren: []const u8) !CValue { |
| 6390 | 6390 | const pt = f.dg.pt; |
| 6391 | 6391 | const zcu = pt.zcu; |
| 6392 | const bin_op = f.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 6392 | const bin_op = f.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 6393 | 6393 | const dest_ptr = try f.resolveInst(bin_op.lhs); |
| 6394 | 6394 | const src_ptr = try f.resolveInst(bin_op.rhs); |
| 6395 | 6395 | const dest_ty = f.typeOf(bin_op.lhs); |
| ... | ... | @@ -6431,7 +6431,7 @@ fn airMemcpy(f: *Function, inst: Air.Inst.Index, function_paren: []const u8) !CV |
| 6431 | 6431 | fn airSetUnionTag(f: *Function, inst: Air.Inst.Index) !CValue { |
| 6432 | 6432 | const pt = f.dg.pt; |
| 6433 | 6433 | const zcu = pt.zcu; |
| 6434 | const bin_op = f.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 6434 | const bin_op = f.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 6435 | 6435 | const union_ptr = try f.resolveInst(bin_op.lhs); |
| 6436 | 6436 | const new_tag = try f.resolveInst(bin_op.rhs); |
| 6437 | 6437 | try reap(f, inst, &.{ bin_op.lhs, bin_op.rhs }); |
| ... | ... | @@ -6452,7 +6452,7 @@ fn airSetUnionTag(f: *Function, inst: Air.Inst.Index) !CValue { |
| 6452 | 6452 | fn airGetUnionTag(f: *Function, inst: Air.Inst.Index) !CValue { |
| 6453 | 6453 | const pt = f.dg.pt; |
| 6454 | 6454 | const zcu = pt.zcu; |
| 6455 | const ty_op = f.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 6455 | const ty_op = f.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 6456 | 6456 | |
| 6457 | 6457 | const operand = try f.resolveInst(ty_op.operand); |
| 6458 | 6458 | try reap(f, inst, &.{ty_op.operand}); |
| ... | ... | @@ -6476,7 +6476,7 @@ fn airTagName(f: *Function, inst: Air.Inst.Index) !CValue { |
| 6476 | 6476 | const zcu = f.dg.pt.zcu; |
| 6477 | 6477 | const ip = &zcu.intern_pool; |
| 6478 | 6478 | const gpa = zcu.comp.gpa; |
| 6479 | const un_op = f.air.instructions.items(.data)[@intFromEnum(inst)].un_op; | |
| 6479 | const un_op = f.air.instructions.items(.data)[@backingInt(inst)].un_op; | |
| 6480 | 6480 | |
| 6481 | 6481 | const inst_ty = f.typeOfIndex(inst); |
| 6482 | 6482 | const enum_ty = f.typeOf(un_op); |
| ... | ... | @@ -6489,7 +6489,7 @@ fn airTagName(f: *Function, inst: Air.Inst.Index) !CValue { |
| 6489 | 6489 | try f.need_tag_name_funcs.put(gpa, enum_ty.toIntern(), {}); |
| 6490 | 6490 | try w.print(" = zig_tagName_{f}__{d}(", .{ |
| 6491 | 6491 | fmtIdentUnsolo(enum_ty.containerTypeName(ip).toSlice(ip)), |
| 6492 | @intFromEnum(enum_ty.toIntern()), | |
| 6492 | @backingInt(enum_ty.toIntern()), | |
| 6493 | 6493 | }); |
| 6494 | 6494 | try f.writeCValue(w, operand, .other); |
| 6495 | 6495 | try w.writeAll(");"); |
| ... | ... | @@ -6499,7 +6499,7 @@ fn airTagName(f: *Function, inst: Air.Inst.Index) !CValue { |
| 6499 | 6499 | } |
| 6500 | 6500 | |
| 6501 | 6501 | fn airErrorName(f: *Function, inst: Air.Inst.Index) !CValue { |
| 6502 | const un_op = f.air.instructions.items(.data)[@intFromEnum(inst)].un_op; | |
| 6502 | const un_op = f.air.instructions.items(.data)[@backingInt(inst)].un_op; | |
| 6503 | 6503 | |
| 6504 | 6504 | const w = &f.code.writer; |
| 6505 | 6505 | const inst_ty = f.typeOfIndex(inst); |
| ... | ... | @@ -6516,7 +6516,7 @@ fn airErrorName(f: *Function, inst: Air.Inst.Index) !CValue { |
| 6516 | 6516 | } |
| 6517 | 6517 | |
| 6518 | 6518 | fn airSplat(f: *Function, inst: Air.Inst.Index) !CValue { |
| 6519 | const ty_op = f.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 6519 | const ty_op = f.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 6520 | 6520 | |
| 6521 | 6521 | const operand = try f.resolveInst(ty_op.operand); |
| 6522 | 6522 | try reap(f, inst, &.{ty_op.operand}); |
| ... | ... | @@ -6538,7 +6538,7 @@ fn airSplat(f: *Function, inst: Air.Inst.Index) !CValue { |
| 6538 | 6538 | } |
| 6539 | 6539 | |
| 6540 | 6540 | fn airSelect(f: *Function, inst: Air.Inst.Index) !CValue { |
| 6541 | const pl_op = f.air.instructions.items(.data)[@intFromEnum(inst)].pl_op; | |
| 6541 | const pl_op = f.air.instructions.items(.data)[@backingInt(inst)].pl_op; | |
| 6542 | 6542 | const extra = f.air.extraData(Air.Bin, pl_op.payload).data; |
| 6543 | 6543 | |
| 6544 | 6544 | const pred = try f.resolveInst(pl_op.operand); |
| ... | ... | @@ -6645,7 +6645,7 @@ fn airShuffleTwo(f: *Function, inst: Air.Inst.Index) !CValue { |
| 6645 | 6645 | fn airReduce(f: *Function, inst: Air.Inst.Index) !CValue { |
| 6646 | 6646 | const pt = f.dg.pt; |
| 6647 | 6647 | const zcu = pt.zcu; |
| 6648 | const reduce = f.air.instructions.items(.data)[@intFromEnum(inst)].reduce; | |
| 6648 | const reduce = f.air.instructions.items(.data)[@backingInt(inst)].reduce; | |
| 6649 | 6649 | |
| 6650 | 6650 | const scalar_ty = f.typeOfIndex(inst); |
| 6651 | 6651 | const operand = try f.resolveInst(reduce.operand); |
| ... | ... | @@ -6784,7 +6784,7 @@ fn airAggregateInit(f: *Function, inst: Air.Inst.Index) !CValue { |
| 6784 | 6784 | const pt = f.dg.pt; |
| 6785 | 6785 | const zcu = pt.zcu; |
| 6786 | 6786 | const ip = &zcu.intern_pool; |
| 6787 | const ty_pl = f.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | |
| 6787 | const ty_pl = f.air.instructions.items(.data)[@backingInt(inst)].ty_pl; | |
| 6788 | 6788 | const inst_ty = f.typeOfIndex(inst); |
| 6789 | 6789 | const len: usize = @intCast(inst_ty.arrayLen(zcu)); |
| 6790 | 6790 | const elements: []const Air.Inst.Ref = @ptrCast(f.air.extra.items[ty_pl.payload..][0..len]); |
| ... | ... | @@ -6860,7 +6860,7 @@ fn airUnionInit(f: *Function, inst: Air.Inst.Index) !CValue { |
| 6860 | 6860 | const pt = f.dg.pt; |
| 6861 | 6861 | const zcu = pt.zcu; |
| 6862 | 6862 | const ip = &zcu.intern_pool; |
| 6863 | const ty_pl = f.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | |
| 6863 | const ty_pl = f.air.instructions.items(.data)[@backingInt(inst)].ty_pl; | |
| 6864 | 6864 | const extra = f.air.extraData(Air.UnionInit, ty_pl.payload).data; |
| 6865 | 6865 | const field_index = extra.field_index; |
| 6866 | 6866 | |
| ... | ... | @@ -6904,7 +6904,7 @@ fn airUnionInit(f: *Function, inst: Air.Inst.Index) !CValue { |
| 6904 | 6904 | fn airPrefetch(f: *Function, inst: Air.Inst.Index) !CValue { |
| 6905 | 6905 | const pt = f.dg.pt; |
| 6906 | 6906 | const zcu = pt.zcu; |
| 6907 | const prefetch = f.air.instructions.items(.data)[@intFromEnum(inst)].prefetch; | |
| 6907 | const prefetch = f.air.instructions.items(.data)[@backingInt(inst)].prefetch; | |
| 6908 | 6908 | |
| 6909 | 6909 | const ptr_ty = f.typeOf(prefetch.ptr); |
| 6910 | 6910 | const ptr = try f.resolveInst(prefetch.ptr); |
| ... | ... | @@ -6918,7 +6918,7 @@ fn airPrefetch(f: *Function, inst: Air.Inst.Index) !CValue { |
| 6918 | 6918 | try f.writeCValueMember(w, ptr, .{ .identifier = "ptr" }) |
| 6919 | 6919 | else |
| 6920 | 6920 | try f.writeCValue(w, ptr, .other); |
| 6921 | try w.print(", {d}, {d});", .{ @intFromEnum(prefetch.rw), prefetch.locality }); | |
| 6921 | try w.print(", {d}, {d});", .{ @backingInt(prefetch.rw), prefetch.locality }); | |
| 6922 | 6922 | try f.newline(); |
| 6923 | 6923 | }, |
| 6924 | 6924 | // The available prefetch intrinsics do not accept a cache argument; only |
| ... | ... | @@ -6930,7 +6930,7 @@ fn airPrefetch(f: *Function, inst: Air.Inst.Index) !CValue { |
| 6930 | 6930 | } |
| 6931 | 6931 | |
| 6932 | 6932 | fn airWasmMemorySize(f: *Function, inst: Air.Inst.Index) !CValue { |
| 6933 | const pl_op = f.air.instructions.items(.data)[@intFromEnum(inst)].pl_op; | |
| 6933 | const pl_op = f.air.instructions.items(.data)[@backingInt(inst)].pl_op; | |
| 6934 | 6934 | |
| 6935 | 6935 | const w = &f.code.writer; |
| 6936 | 6936 | const inst_ty = f.typeOfIndex(inst); |
| ... | ... | @@ -6945,7 +6945,7 @@ fn airWasmMemorySize(f: *Function, inst: Air.Inst.Index) !CValue { |
| 6945 | 6945 | } |
| 6946 | 6946 | |
| 6947 | 6947 | fn airWasmMemoryGrow(f: *Function, inst: Air.Inst.Index) !CValue { |
| 6948 | const pl_op = f.air.instructions.items(.data)[@intFromEnum(inst)].pl_op; | |
| 6948 | const pl_op = f.air.instructions.items(.data)[@backingInt(inst)].pl_op; | |
| 6949 | 6949 | |
| 6950 | 6950 | const w = &f.code.writer; |
| 6951 | 6951 | const inst_ty = f.typeOfIndex(inst); |
| ... | ... | @@ -6965,7 +6965,7 @@ fn airWasmMemoryGrow(f: *Function, inst: Air.Inst.Index) !CValue { |
| 6965 | 6965 | fn airMulAdd(f: *Function, inst: Air.Inst.Index) !CValue { |
| 6966 | 6966 | const pt = f.dg.pt; |
| 6967 | 6967 | const zcu = pt.zcu; |
| 6968 | const pl_op = f.air.instructions.items(.data)[@intFromEnum(inst)].pl_op; | |
| 6968 | const pl_op = f.air.instructions.items(.data)[@backingInt(inst)].pl_op; | |
| 6969 | 6969 | const bin_op = f.air.extraData(Air.Bin, pl_op.payload).data; |
| 6970 | 6970 | |
| 6971 | 6971 | const mulend1 = try f.resolveInst(bin_op.lhs); |
| ... | ... | @@ -7000,7 +7000,7 @@ fn airMulAdd(f: *Function, inst: Air.Inst.Index) !CValue { |
| 7000 | 7000 | } |
| 7001 | 7001 | |
| 7002 | 7002 | fn airRuntimeNavPtr(f: *Function, inst: Air.Inst.Index) !CValue { |
| 7003 | const ty_nav = f.air.instructions.items(.data)[@intFromEnum(inst)].ty_nav; | |
| 7003 | const ty_nav = f.air.instructions.items(.data)[@backingInt(inst)].ty_nav; | |
| 7004 | 7004 | const w = &f.code.writer; |
| 7005 | 7005 | const local = try f.allocLocal(inst, .fromInterned(ty_nav.ty)); |
| 7006 | 7006 | try f.writeCValue(w, local, .other); |
| ... | ... | @@ -7032,7 +7032,7 @@ fn airCVaStart(f: *Function, inst: Air.Inst.Index) !CValue { |
| 7032 | 7032 | } |
| 7033 | 7033 | |
| 7034 | 7034 | fn airCVaArg(f: *Function, inst: Air.Inst.Index) !CValue { |
| 7035 | const ty_op = f.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 7035 | const ty_op = f.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 7036 | 7036 | |
| 7037 | 7037 | const inst_ty = f.typeOfIndex(inst); |
| 7038 | 7038 | const va_list = try f.resolveInst(ty_op.operand); |
| ... | ... | @@ -7051,7 +7051,7 @@ fn airCVaArg(f: *Function, inst: Air.Inst.Index) !CValue { |
| 7051 | 7051 | } |
| 7052 | 7052 | |
| 7053 | 7053 | fn airCVaEnd(f: *Function, inst: Air.Inst.Index) !CValue { |
| 7054 | const un_op = f.air.instructions.items(.data)[@intFromEnum(inst)].un_op; | |
| 7054 | const un_op = f.air.instructions.items(.data)[@backingInt(inst)].un_op; | |
| 7055 | 7055 | |
| 7056 | 7056 | const va_list = try f.resolveInst(un_op); |
| 7057 | 7057 | try reap(f, inst, &.{un_op}); |
| ... | ... | @@ -7065,7 +7065,7 @@ fn airCVaEnd(f: *Function, inst: Air.Inst.Index) !CValue { |
| 7065 | 7065 | } |
| 7066 | 7066 | |
| 7067 | 7067 | fn airCVaCopy(f: *Function, inst: Air.Inst.Index) !CValue { |
| 7068 | const ty_op = f.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 7068 | const ty_op = f.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 7069 | 7069 | |
| 7070 | 7070 | const inst_ty = f.typeOfIndex(inst); |
| 7071 | 7071 | const va_list = try f.resolveInst(ty_op.operand); |
| ... | ... | @@ -7830,9 +7830,9 @@ fn freeLocal(f: *Function, inst: ?Air.Inst.Index, local_index: LocalIndex, ref_i |
| 7830 | 7830 | const local = f.locals.items[local_index]; |
| 7831 | 7831 | if (inst) |i| { |
| 7832 | 7832 | if (ref_inst) |operand| { |
| 7833 | log.debug("%{d}: freeing t{d} (operand %{d})", .{ @intFromEnum(i), local_index, operand }); | |
| 7833 | log.debug("%{d}: freeing t{d} (operand %{d})", .{ @backingInt(i), local_index, operand }); | |
| 7834 | 7834 | } else { |
| 7835 | log.debug("%{d}: freeing t{d}", .{ @intFromEnum(i), local_index }); | |
| 7835 | log.debug("%{d}: freeing t{d}", .{ @backingInt(i), local_index }); | |
| 7836 | 7836 | } |
| 7837 | 7837 | } else { |
| 7838 | 7838 | if (ref_inst) |operand| { |
| ... | ... | @@ -7915,11 +7915,11 @@ fn renderNavName(w: *Writer, nav_index: InternPool.Nav.Index, ip: *const InternP |
| 7915 | 7915 | const fqn_slice = ip.getNav(nav_index).fqn.toSlice(ip); |
| 7916 | 7916 | try w.print("{f}__{d}", .{ |
| 7917 | 7917 | fmtIdentUnsolo(fqn_slice[0..@min(fqn_slice.len, 100)]), |
| 7918 | @intFromEnum(nav_index), | |
| 7918 | @backingInt(nav_index), | |
| 7919 | 7919 | }); |
| 7920 | 7920 | } |
| 7921 | 7921 | } |
| 7922 | 7922 | |
| 7923 | 7923 | fn renderUavName(w: *Writer, uav: Value) !void { |
| 7924 | try w.print("__anon_{d}", .{@intFromEnum(uav.toIntern())}); | |
| 7924 | try w.print("__anon_{d}", .{@backingInt(uav.toIntern())}); | |
| 7925 | 7925 | } |
src/codegen/c/type.zig+2-2| ... | ... | @@ -904,7 +904,7 @@ pub const CType = union(enum) { |
| 904 | 904 | }, |
| 905 | 905 | .error_set => switch (ty.toIntern()) { |
| 906 | 906 | .anyerror_type => try w.writeAll("anyerror"), |
| 907 | else => try w.print("error_{d}", .{@intFromEnum(ty.toIntern())}), | |
| 907 | else => try w.print("error_{d}", .{@backingInt(ty.toIntern())}), | |
| 908 | 908 | }, |
| 909 | 909 | .optional => try w.print("opt_{f}", .{fmtZigType(ty.optionalChild(zcu), zcu)}), |
| 910 | 910 | .error_union => try w.print("errunion_{f}", .{fmtZigType(ty.errorUnionPayload(zcu), zcu)}), |
| ... | ... | @@ -944,7 +944,7 @@ pub const CType = union(enum) { |
| 944 | 944 | |
| 945 | 945 | .array => if (ty.sentinel(zcu)) |s| try w.print("arr_{d}s{d}_{f}", .{ |
| 946 | 946 | ty.arrayLen(zcu), |
| 947 | @intFromEnum(s.toIntern()), | |
| 947 | @backingInt(s.toIntern()), | |
| 948 | 948 | fmtZigType(ty.childType(zcu), zcu), |
| 949 | 949 | }) else try w.print("arr_{d}_{f}", .{ |
| 950 | 950 | ty.arrayLen(zcu), |
src/codegen/llvm.zig+9-9| ... | ... | @@ -1739,14 +1739,14 @@ pub const Object = struct { |
| 1739 | 1739 | assert(zcu.intern_pool.typeOf(val) == .type_type); |
| 1740 | 1740 | |
| 1741 | 1741 | { |
| 1742 | assert(@intFromEnum(index) == o.lazy_abi_aligns.items.len); | |
| 1742 | assert(@backingInt(index) == o.lazy_abi_aligns.items.len); | |
| 1743 | 1743 | try o.lazy_abi_aligns.ensureUnusedCapacity(gpa, 1); |
| 1744 | 1744 | const fwd_ref = try o.builder.alignmentForwardReference(); |
| 1745 | 1745 | o.lazy_abi_aligns.appendAssumeCapacity(fwd_ref); |
| 1746 | 1746 | } |
| 1747 | 1747 | |
| 1748 | 1748 | if (!o.builder.strip) { |
| 1749 | assert(@intFromEnum(index) == o.debug_types.items.len); | |
| 1749 | assert(@backingInt(index) == o.debug_types.items.len); | |
| 1750 | 1750 | try o.debug_types.ensureUnusedCapacity(gpa, 1); |
| 1751 | 1751 | const fwd_ref = try o.builder.debugForwardReference(); |
| 1752 | 1752 | o.debug_types.appendAssumeCapacity(fwd_ref); |
| ... | ... | @@ -1766,13 +1766,13 @@ pub const Object = struct { |
| 1766 | 1766 | const ty: Type = .fromInterned(val); |
| 1767 | 1767 | |
| 1768 | 1768 | { |
| 1769 | const fwd_ref = o.lazy_abi_aligns.items[@intFromEnum(index)]; | |
| 1769 | const fwd_ref = o.lazy_abi_aligns.items[@backingInt(index)]; | |
| 1770 | 1770 | o.builder.resolveAlignmentForwardReference(fwd_ref, .fromByteUnits(1)); |
| 1771 | 1771 | } |
| 1772 | 1772 | |
| 1773 | 1773 | if (!o.builder.strip) { |
| 1774 | 1774 | assert(val != .anyerror_type); |
| 1775 | const fwd_ref = o.debug_types.items[@intFromEnum(index)]; | |
| 1775 | const fwd_ref = o.debug_types.items[@backingInt(index)]; | |
| 1776 | 1776 | const name_str = try o.builder.metadataStringFmt("{f}", .{ty.fmt(pt)}); |
| 1777 | 1777 | // If `ty` is a function, use a dummy *function* type to prevent existing debug |
| 1778 | 1778 | // subprograms from becoming ill-formed. |
| ... | ... | @@ -1793,12 +1793,12 @@ pub const Object = struct { |
| 1793 | 1793 | const ty: Type = .fromInterned(val); |
| 1794 | 1794 | |
| 1795 | 1795 | { |
| 1796 | const fwd_ref = o.lazy_abi_aligns.items[@intFromEnum(index)]; | |
| 1796 | const fwd_ref = o.lazy_abi_aligns.items[@backingInt(index)]; | |
| 1797 | 1797 | o.builder.resolveAlignmentForwardReference(fwd_ref, ty.abiAlignment(zcu).toLlvm()); |
| 1798 | 1798 | } |
| 1799 | 1799 | |
| 1800 | 1800 | if (!o.builder.strip) { |
| 1801 | const fwd_ref = o.debug_types.items[@intFromEnum(index)]; | |
| 1801 | const fwd_ref = o.debug_types.items[@backingInt(index)]; | |
| 1802 | 1802 | if (val == .anyerror_type) { |
| 1803 | 1803 | // Don't lower this now; it will be populated in `emit` instead. |
| 1804 | 1804 | assert(o.debug_anyerror_fwd_ref == fwd_ref.toOptional()); |
| ... | ... | @@ -1845,7 +1845,7 @@ pub const Object = struct { |
| 1845 | 1845 | pub fn getDebugType(o: *Object, pt: Zcu.PerThread, ty: Type) Allocator.Error!Builder.Metadata { |
| 1846 | 1846 | assert(!o.builder.strip); |
| 1847 | 1847 | const index = try o.type_pool.get(pt, .{ .llvm = o }, ty.toIntern()); |
| 1848 | return o.debug_types.items[@intFromEnum(index)]; | |
| 1848 | return o.debug_types.items[@backingInt(index)]; | |
| 1849 | 1849 | } |
| 1850 | 1850 | |
| 1851 | 1851 | /// In codegen logic, instead of calling this directly, use `getDebugType` to get a forward |
| ... | ... | @@ -3958,7 +3958,7 @@ pub const Object = struct { |
| 3958 | 3958 | errdefer assert(o.uav_map.remove(.{ .val = uav_val, .@"addrspace" = @"addrspace" })); |
| 3959 | 3959 | |
| 3960 | 3960 | const llvm_ty = try o.lowerType(uav_ty, .in_memory); |
| 3961 | const llvm_name = try o.builder.strtabStringFmt("__anon_{d}", .{@intFromEnum(uav_val)}); | |
| 3961 | const llvm_name = try o.builder.strtabStringFmt("__anon_{d}", .{@backingInt(uav_val)}); | |
| 3962 | 3962 | const llvm_variable = try o.builder.addVariable(llvm_name, llvm_ty, llvm_addrspace); |
| 3963 | 3963 | gop.value_ptr.* = llvm_variable; |
| 3964 | 3964 | try llvm_variable.setInitializer(try o.lowerValue(uav_val, .in_memory), &o.builder); |
| ... | ... | @@ -4195,7 +4195,7 @@ pub const Object = struct { |
| 4195 | 4195 | |
| 4196 | 4196 | pub fn lazyAbiAlignment(o: *Object, pt: Zcu.PerThread, ty: Type) Allocator.Error!Builder.Alignment.Lazy { |
| 4197 | 4197 | const index = try o.type_pool.get(pt, .{ .llvm = o }, ty.toIntern()); |
| 4198 | return o.lazy_abi_aligns.items[@intFromEnum(index)]; | |
| 4198 | return o.lazy_abi_aligns.items[@backingInt(index)]; | |
| 4199 | 4199 | } |
| 4200 | 4200 | |
| 4201 | 4201 | pub fn getIsNamedEnumValueFunction(o: *Object, enum_ty: Type) Allocator.Error!Builder.Function.Index { |
src/codegen/llvm/FuncGen.zig+129-129| ... | ... | @@ -351,7 +351,7 @@ fn genBody(self: *FuncGen, body: []const Air.Inst.Index, coverage_point: Air.Cov |
| 351 | 351 | for (body) |inst| { |
| 352 | 352 | if (self.liveness.isUnused(inst) and !self.air.mustLower(inst, ip)) continue; |
| 353 | 353 | |
| 354 | const val: Builder.Value = switch (air_tags[@intFromEnum(inst)]) { | |
| 354 | const val: Builder.Value = switch (air_tags[@backingInt(inst)]) { | |
| 355 | 355 | // zig fmt: off |
| 356 | 356 | |
| 357 | 357 | // Required due to `.scalarize_bit_cast_vector_non_elementwise` being enabled. |
| ... | ... | @@ -1061,7 +1061,7 @@ fn airRet(self: *FuncGen, inst: Air.Inst.Index, safety: bool) Allocator.Error!vo |
| 1061 | 1061 | const o = self.object; |
| 1062 | 1062 | const zcu = o.zcu; |
| 1063 | 1063 | const ip = &zcu.intern_pool; |
| 1064 | const un_op = self.air.instructions.items(.data)[@intFromEnum(inst)].un_op; | |
| 1064 | const un_op = self.air.instructions.items(.data)[@backingInt(inst)].un_op; | |
| 1065 | 1065 | |
| 1066 | 1066 | const ret_ty = self.typeOf(un_op); |
| 1067 | 1067 | |
| ... | ... | @@ -1136,7 +1136,7 @@ fn airRetLoad(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!void { |
| 1136 | 1136 | const o = self.object; |
| 1137 | 1137 | const zcu = o.zcu; |
| 1138 | 1138 | const ip = &zcu.intern_pool; |
| 1139 | const un_op = self.air.instructions.items(.data)[@intFromEnum(inst)].un_op; | |
| 1139 | const un_op = self.air.instructions.items(.data)[@backingInt(inst)].un_op; | |
| 1140 | 1140 | const ptr_ty = self.typeOf(un_op); |
| 1141 | 1141 | const ret_ty = ptr_ty.childType(zcu); |
| 1142 | 1142 | const fn_info = zcu.typeToFunc(.fromInterned(ip.getNav(self.nav_index).resolved.?.type)).?; |
| ... | ... | @@ -1162,7 +1162,7 @@ fn airRetLoad(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!void { |
| 1162 | 1162 | } |
| 1163 | 1163 | |
| 1164 | 1164 | fn airCVaArg(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 1165 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 1165 | const ty_op = self.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 1166 | 1166 | const list = try self.resolveInst(ty_op.operand); |
| 1167 | 1167 | const arg_ty = ty_op.ty.toType(); |
| 1168 | 1168 | const llvm_arg_ty = try self.object.lowerType(arg_ty, .by_value); |
| ... | ... | @@ -1173,7 +1173,7 @@ fn airCVaArg(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value |
| 1173 | 1173 | fn airCVaCopy(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 1174 | 1174 | const o = self.object; |
| 1175 | 1175 | const zcu = o.zcu; |
| 1176 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 1176 | const ty_op = self.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 1177 | 1177 | const src_list = try self.resolveInst(ty_op.operand); |
| 1178 | 1178 | const va_list_ty = ty_op.ty.toType(); |
| 1179 | 1179 | |
| ... | ... | @@ -1187,7 +1187,7 @@ fn airCVaCopy(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Valu |
| 1187 | 1187 | } |
| 1188 | 1188 | |
| 1189 | 1189 | fn airCVaEnd(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 1190 | const un_op = self.air.instructions.items(.data)[@intFromEnum(inst)].un_op; | |
| 1190 | const un_op = self.air.instructions.items(.data)[@backingInt(inst)].un_op; | |
| 1191 | 1191 | const src_list = try self.resolveInst(un_op); |
| 1192 | 1192 | |
| 1193 | 1193 | _ = try self.wip.callIntrinsic(.normal, .none, .va_end, &.{src_list.typeOfWip(&self.wip)}, &.{src_list}, ""); |
| ... | ... | @@ -1214,7 +1214,7 @@ fn airCmp( |
| 1214 | 1214 | op: math.CompareOperator, |
| 1215 | 1215 | fast: Builder.FastMathKind, |
| 1216 | 1216 | ) Allocator.Error!Builder.Value { |
| 1217 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 1217 | const bin_op = self.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 1218 | 1218 | const lhs = try self.resolveInst(bin_op.lhs); |
| 1219 | 1219 | const rhs = try self.resolveInst(bin_op.rhs); |
| 1220 | 1220 | const operand_ty = self.typeOf(bin_op.lhs); |
| ... | ... | @@ -1223,7 +1223,7 @@ fn airCmp( |
| 1223 | 1223 | } |
| 1224 | 1224 | |
| 1225 | 1225 | fn airCmpVector(self: *FuncGen, inst: Air.Inst.Index, fast: Builder.FastMathKind) Allocator.Error!Builder.Value { |
| 1226 | const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | |
| 1226 | const ty_pl = self.air.instructions.items(.data)[@backingInt(inst)].ty_pl; | |
| 1227 | 1227 | const extra = self.air.extraData(Air.VectorCmp, ty_pl.payload).data; |
| 1228 | 1228 | |
| 1229 | 1229 | const lhs = try self.resolveInst(extra.lhs); |
| ... | ... | @@ -1236,7 +1236,7 @@ fn airCmpVector(self: *FuncGen, inst: Air.Inst.Index, fast: Builder.FastMathKind |
| 1236 | 1236 | |
| 1237 | 1237 | fn airCmpLteErrorsLen(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 1238 | 1238 | const o = self.object; |
| 1239 | const un_op = self.air.instructions.items(.data)[@intFromEnum(inst)].un_op; | |
| 1239 | const un_op = self.air.instructions.items(.data)[@backingInt(inst)].un_op; | |
| 1240 | 1240 | const operand = try self.resolveInst(un_op); |
| 1241 | 1241 | const errors_len_ptr = try o.getErrorsLen(); |
| 1242 | 1242 | const errors_len_val = try self.load(errors_len_ptr.toValue(&o.builder), .none, .anyerror, .normal); |
| ... | ... | @@ -1392,7 +1392,7 @@ fn lowerBlock( |
| 1392 | 1392 | |
| 1393 | 1393 | fn airBr(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!void { |
| 1394 | 1394 | const zcu = self.object.zcu; |
| 1395 | const branch = self.air.instructions.items(.data)[@intFromEnum(inst)].br; | |
| 1395 | const branch = self.air.instructions.items(.data)[@backingInt(inst)].br; | |
| 1396 | 1396 | const block = self.blocks.get(branch.block_inst).?; |
| 1397 | 1397 | |
| 1398 | 1398 | // Add the values to the lists only if the break provides a value. |
| ... | ... | @@ -1408,7 +1408,7 @@ fn airBr(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!void { |
| 1408 | 1408 | } |
| 1409 | 1409 | |
| 1410 | 1410 | fn airRepeat(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!void { |
| 1411 | const repeat = self.air.instructions.items(.data)[@intFromEnum(inst)].repeat; | |
| 1411 | const repeat = self.air.instructions.items(.data)[@backingInt(inst)].repeat; | |
| 1412 | 1412 | const loop_bb = self.loops.get(repeat.loop_inst).?; |
| 1413 | 1413 | loop_bb.ptr(&self.wip).incoming += 1; |
| 1414 | 1414 | _ = try self.wip.br(loop_bb); |
| ... | ... | @@ -1603,7 +1603,7 @@ fn lowerSwitchDispatch( |
| 1603 | 1603 | } |
| 1604 | 1604 | |
| 1605 | 1605 | fn airSwitchDispatch(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!void { |
| 1606 | const br = self.air.instructions.items(.data)[@intFromEnum(inst)].br; | |
| 1606 | const br = self.air.instructions.items(.data)[@backingInt(inst)].br; | |
| 1607 | 1607 | const dispatch_info = self.switch_dispatch_info.get(br.block_inst).?; |
| 1608 | 1608 | return self.lowerSwitchDispatch(br.block_inst, br.operand, dispatch_info); |
| 1609 | 1609 | } |
| ... | ... | @@ -1850,7 +1850,7 @@ fn airSwitchBr(self: *FuncGen, inst: Air.Inst.Index, is_dispatch_loop: bool) Tod |
| 1850 | 1850 | const table_val = try o.builder.arrayConst(table_llvm_ty, table_elems); |
| 1851 | 1851 | |
| 1852 | 1852 | const table_variable = try o.builder.addVariable( |
| 1853 | try o.builder.strtabStringFmt("__jmptab_{d}", .{@intFromEnum(inst)}), | |
| 1853 | try o.builder.strtabStringFmt("__jmptab_{d}", .{@backingInt(inst)}), | |
| 1854 | 1854 | table_llvm_ty, |
| 1855 | 1855 | .default, |
| 1856 | 1856 | ); |
| ... | ... | @@ -2018,7 +2018,7 @@ fn airLoop(self: *FuncGen, inst: Air.Inst.Index) TodoError!void { |
| 2018 | 2018 | fn airArrayToSlice(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 2019 | 2019 | const o = self.object; |
| 2020 | 2020 | const zcu = o.zcu; |
| 2021 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 2021 | const ty_op = self.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 2022 | 2022 | const operand_ty = self.typeOf(ty_op.operand); |
| 2023 | 2023 | const array_ty = operand_ty.childType(zcu); |
| 2024 | 2024 | const llvm_usize = try o.lowerType(.usize, .by_value); |
| ... | ... | @@ -2031,7 +2031,7 @@ fn airArrayToSlice(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder |
| 2031 | 2031 | fn airFloatFromInt(self: *FuncGen, inst: Air.Inst.Index) TodoError!Builder.Value { |
| 2032 | 2032 | const o = self.object; |
| 2033 | 2033 | const zcu = o.zcu; |
| 2034 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 2034 | const ty_op = self.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 2035 | 2035 | |
| 2036 | 2036 | const operand = try self.resolveInst(ty_op.operand); |
| 2037 | 2037 | const operand_ty = self.typeOf(ty_op.operand); |
| ... | ... | @@ -2100,7 +2100,7 @@ fn airIntFromFloat( |
| 2100 | 2100 | const o = self.object; |
| 2101 | 2101 | const zcu = o.zcu; |
| 2102 | 2102 | const target = zcu.getTarget(); |
| 2103 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 2103 | const ty_op = self.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 2104 | 2104 | |
| 2105 | 2105 | const operand = try self.resolveInst(ty_op.operand); |
| 2106 | 2106 | const operand_ty = self.typeOf(ty_op.operand); |
| ... | ... | @@ -2188,21 +2188,21 @@ fn sliceOrArrayLenInBytes(fg: *FuncGen, ptr: Builder.Value, ty: Type) Allocator. |
| 2188 | 2188 | } |
| 2189 | 2189 | |
| 2190 | 2190 | fn airSliceField(self: *FuncGen, inst: Air.Inst.Index, index: u32) Allocator.Error!Builder.Value { |
| 2191 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 2191 | const ty_op = self.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 2192 | 2192 | const operand = try self.resolveInst(ty_op.operand); |
| 2193 | 2193 | return self.wip.extractValue(operand, &.{index}, ""); |
| 2194 | 2194 | } |
| 2195 | 2195 | |
| 2196 | 2196 | fn airPtrSliceFieldPtr(self: *FuncGen, inst: Air.Inst.Index, index: u1) Allocator.Error!Builder.Value { |
| 2197 | 2197 | const zcu = self.object.zcu; |
| 2198 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 2198 | const ty_op = self.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 2199 | 2199 | const slice_ptr = try self.resolveInst(ty_op.operand); |
| 2200 | 2200 | return self.ptraddConst(slice_ptr, index * Type.usize.abiSize(zcu)); |
| 2201 | 2201 | } |
| 2202 | 2202 | |
| 2203 | 2203 | fn airSliceElemVal(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 2204 | 2204 | const zcu = self.object.zcu; |
| 2205 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 2205 | const bin_op = self.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 2206 | 2206 | const slice_ty = self.typeOf(bin_op.lhs); |
| 2207 | 2207 | const slice = try self.resolveInst(bin_op.lhs); |
| 2208 | 2208 | const index = try self.resolveInst(bin_op.rhs); |
| ... | ... | @@ -2219,7 +2219,7 @@ fn airSliceElemVal(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder |
| 2219 | 2219 | |
| 2220 | 2220 | fn airSliceElemPtr(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 2221 | 2221 | const zcu = self.object.zcu; |
| 2222 | const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | |
| 2222 | const ty_pl = self.air.instructions.items(.data)[@backingInt(inst)].ty_pl; | |
| 2223 | 2223 | const bin_op = self.air.extraData(Air.Bin, ty_pl.payload).data; |
| 2224 | 2224 | const slice_ty = self.typeOf(bin_op.lhs); |
| 2225 | 2225 | |
| ... | ... | @@ -2232,7 +2232,7 @@ fn airSliceElemPtr(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder |
| 2232 | 2232 | fn airArrayElemVal(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 2233 | 2233 | const zcu = self.object.zcu; |
| 2234 | 2234 | |
| 2235 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 2235 | const bin_op = self.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 2236 | 2236 | const array_ty = self.typeOf(bin_op.lhs); |
| 2237 | 2237 | const array_llvm_val = try self.resolveInst(bin_op.lhs); |
| 2238 | 2238 | const rhs = try self.resolveInst(bin_op.rhs); |
| ... | ... | @@ -2247,7 +2247,7 @@ fn airArrayElemVal(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder |
| 2247 | 2247 | } |
| 2248 | 2248 | |
| 2249 | 2249 | fn airLegalizeVecElemVal(fg: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 2250 | const bin_op = fg.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 2250 | const bin_op = fg.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 2251 | 2251 | const vec = try fg.resolveInst(bin_op.lhs); |
| 2252 | 2252 | const index = try fg.resolveInst(bin_op.rhs); |
| 2253 | 2253 | return fg.wip.extractElement(vec, index, ""); |
| ... | ... | @@ -2255,7 +2255,7 @@ fn airLegalizeVecElemVal(fg: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Bui |
| 2255 | 2255 | fn airLegalizeVecStoreElem(fg: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 2256 | 2256 | const zcu = fg.object.zcu; |
| 2257 | 2257 | |
| 2258 | const pl_op = fg.air.instructions.items(.data)[@intFromEnum(inst)].pl_op; | |
| 2258 | const pl_op = fg.air.instructions.items(.data)[@backingInt(inst)].pl_op; | |
| 2259 | 2259 | const extra = fg.air.extraData(Air.Bin, pl_op.payload).data; |
| 2260 | 2260 | |
| 2261 | 2261 | const ptr_ty = fg.typeOf(pl_op.operand); |
| ... | ... | @@ -2276,7 +2276,7 @@ fn airLegalizeVecStoreElem(fg: *FuncGen, inst: Air.Inst.Index) Allocator.Error!B |
| 2276 | 2276 | |
| 2277 | 2277 | fn airPtrElemVal(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 2278 | 2278 | const zcu = self.object.zcu; |
| 2279 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 2279 | const bin_op = self.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 2280 | 2280 | const ptr_ty = self.typeOf(bin_op.lhs); |
| 2281 | 2281 | const elem_ty = ptr_ty.indexableElem(zcu); |
| 2282 | 2282 | const base_ptr = try self.resolveInst(bin_op.lhs); |
| ... | ... | @@ -2294,7 +2294,7 @@ fn airPtrElemVal(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.V |
| 2294 | 2294 | |
| 2295 | 2295 | fn airPtrElemPtr(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 2296 | 2296 | const zcu = self.object.zcu; |
| 2297 | const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | |
| 2297 | const ty_pl = self.air.instructions.items(.data)[@backingInt(inst)].ty_pl; | |
| 2298 | 2298 | const bin_op = self.air.extraData(Air.Bin, ty_pl.payload).data; |
| 2299 | 2299 | const ptr_ty = self.typeOf(bin_op.lhs); |
| 2300 | 2300 | const elem_ty = ptr_ty.indexableElem(zcu); |
| ... | ... | @@ -2307,7 +2307,7 @@ fn airPtrElemPtr(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.V |
| 2307 | 2307 | } |
| 2308 | 2308 | |
| 2309 | 2309 | fn airStructFieldPtr(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 2310 | const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | |
| 2310 | const ty_pl = self.air.instructions.items(.data)[@backingInt(inst)].ty_pl; | |
| 2311 | 2311 | const struct_field = self.air.extraData(Air.StructField, ty_pl.payload).data; |
| 2312 | 2312 | const struct_ptr = try self.resolveInst(struct_field.struct_operand); |
| 2313 | 2313 | const struct_ptr_ty = self.typeOf(struct_field.struct_operand); |
| ... | ... | @@ -2319,7 +2319,7 @@ fn airStructFieldPtrIndex( |
| 2319 | 2319 | inst: Air.Inst.Index, |
| 2320 | 2320 | field_index: u32, |
| 2321 | 2321 | ) Allocator.Error!Builder.Value { |
| 2322 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 2322 | const ty_op = self.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 2323 | 2323 | const struct_ptr = try self.resolveInst(ty_op.operand); |
| 2324 | 2324 | const struct_ptr_ty = self.typeOf(ty_op.operand); |
| 2325 | 2325 | return self.fieldPtr(struct_ptr, struct_ptr_ty, field_index); |
| ... | ... | @@ -2328,7 +2328,7 @@ fn airStructFieldPtrIndex( |
| 2328 | 2328 | fn airAggFieldVal(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 2329 | 2329 | const o = self.object; |
| 2330 | 2330 | const zcu = o.zcu; |
| 2331 | const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | |
| 2331 | const ty_pl = self.air.instructions.items(.data)[@backingInt(inst)].ty_pl; | |
| 2332 | 2332 | const struct_field = self.air.extraData(Air.StructField, ty_pl.payload).data; |
| 2333 | 2333 | const struct_ty = self.typeOf(struct_field.struct_operand); |
| 2334 | 2334 | const struct_llvm_val = try self.resolveInst(struct_field.struct_operand); |
| ... | ... | @@ -2386,7 +2386,7 @@ fn airAggFieldVal(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder. |
| 2386 | 2386 | fn airFieldParentPtr(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 2387 | 2387 | const o = self.object; |
| 2388 | 2388 | const zcu = o.zcu; |
| 2389 | const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | |
| 2389 | const ty_pl = self.air.instructions.items(.data)[@backingInt(inst)].ty_pl; | |
| 2390 | 2390 | const extra = self.air.extraData(Air.FieldParentPtr, ty_pl.payload).data; |
| 2391 | 2391 | |
| 2392 | 2392 | const field_ptr = try self.resolveInst(extra.field_ptr); |
| ... | ... | @@ -2409,7 +2409,7 @@ fn airFieldParentPtr(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Build |
| 2409 | 2409 | } |
| 2410 | 2410 | |
| 2411 | 2411 | fn airNot(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 2412 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 2412 | const ty_op = self.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 2413 | 2413 | const operand = try self.resolveInst(ty_op.operand); |
| 2414 | 2414 | |
| 2415 | 2415 | return self.wip.not(operand, ""); |
| ... | ... | @@ -2421,7 +2421,7 @@ fn airUnreach(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!void { |
| 2421 | 2421 | } |
| 2422 | 2422 | |
| 2423 | 2423 | fn airDbgStmt(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 2424 | const dbg_stmt = self.air.instructions.items(.data)[@intFromEnum(inst)].dbg_stmt; | |
| 2424 | const dbg_stmt = self.air.instructions.items(.data)[@backingInt(inst)].dbg_stmt; | |
| 2425 | 2425 | self.prev_dbg_line = @intCast(self.base_line + dbg_stmt.line + 1); |
| 2426 | 2426 | self.prev_dbg_column = @intCast(dbg_stmt.column + 1); |
| 2427 | 2427 | |
| ... | ... | @@ -2445,9 +2445,9 @@ fn airDbgVarPtr(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Va |
| 2445 | 2445 | const o = self.object; |
| 2446 | 2446 | const pt = self.pt; |
| 2447 | 2447 | const zcu = o.zcu; |
| 2448 | const pl_op = self.air.instructions.items(.data)[@intFromEnum(inst)].pl_op; | |
| 2448 | const pl_op = self.air.instructions.items(.data)[@backingInt(inst)].pl_op; | |
| 2449 | 2449 | const operand = try self.resolveInst(pl_op.operand); |
| 2450 | const name: Air.NullTerminatedString = @enumFromInt(pl_op.payload); | |
| 2450 | const name: Air.NullTerminatedString = @fromBackingInt(@intCast(pl_op.payload)); | |
| 2451 | 2451 | const ptr_ty = self.typeOf(pl_op.operand); |
| 2452 | 2452 | |
| 2453 | 2453 | const debug_local_var = try o.builder.debugLocalVar( |
| ... | ... | @@ -2477,10 +2477,10 @@ fn airDbgVarPtr(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Va |
| 2477 | 2477 | fn airDbgVarVal(self: *FuncGen, inst: Air.Inst.Index, is_arg: bool) Allocator.Error!Builder.Value { |
| 2478 | 2478 | const o = self.object; |
| 2479 | 2479 | const pt = self.pt; |
| 2480 | const pl_op = self.air.instructions.items(.data)[@intFromEnum(inst)].pl_op; | |
| 2480 | const pl_op = self.air.instructions.items(.data)[@backingInt(inst)].pl_op; | |
| 2481 | 2481 | const operand = try self.resolveInst(pl_op.operand); |
| 2482 | 2482 | const operand_ty = self.typeOf(pl_op.operand); |
| 2483 | const name: Air.NullTerminatedString = @enumFromInt(pl_op.payload); | |
| 2483 | const name: Air.NullTerminatedString = @fromBackingInt(@intCast(pl_op.payload)); | |
| 2484 | 2484 | const name_slice = name.toSlice(self.air); |
| 2485 | 2485 | const metadata_name = if (name_slice.len > 0) try o.builder.metadataString(name_slice) else null; |
| 2486 | 2486 | const debug_local_var = if (is_arg) try o.builder.debugParameter( |
| ... | ... | @@ -2933,7 +2933,7 @@ fn airIsNonNull( |
| 2933 | 2933 | ) Allocator.Error!Builder.Value { |
| 2934 | 2934 | const o = self.object; |
| 2935 | 2935 | const zcu = o.zcu; |
| 2936 | const un_op = self.air.instructions.items(.data)[@intFromEnum(inst)].un_op; | |
| 2936 | const un_op = self.air.instructions.items(.data)[@backingInt(inst)].un_op; | |
| 2937 | 2937 | const operand = try self.resolveInst(un_op); |
| 2938 | 2938 | const operand_ty = self.typeOf(un_op); |
| 2939 | 2939 | const optional_ty = if (operand_is_ptr) operand_ty.childType(zcu) else operand_ty; |
| ... | ... | @@ -2981,7 +2981,7 @@ fn airIsErr( |
| 2981 | 2981 | ) Allocator.Error!Builder.Value { |
| 2982 | 2982 | const o = self.object; |
| 2983 | 2983 | const zcu = o.zcu; |
| 2984 | const un_op = self.air.instructions.items(.data)[@intFromEnum(inst)].un_op; | |
| 2984 | const un_op = self.air.instructions.items(.data)[@backingInt(inst)].un_op; | |
| 2985 | 2985 | const operand = try self.resolveInst(un_op); |
| 2986 | 2986 | const operand_ty = self.typeOf(un_op); |
| 2987 | 2987 | const err_union_ty = if (operand_is_ptr) operand_ty.childType(zcu) else operand_ty; |
| ... | ... | @@ -3021,7 +3021,7 @@ fn airIsErr( |
| 3021 | 3021 | } |
| 3022 | 3022 | |
| 3023 | 3023 | fn airOptionalPayloadPtr(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 3024 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 3024 | const ty_op = self.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 3025 | 3025 | const operand = try self.resolveInst(ty_op.operand); |
| 3026 | 3026 | // If `Type.optionalReprIsPayload`, then the address should be the same. Otherwise, optional |
| 3027 | 3027 | // layouts always put the payload at offset 0, so... the address should still be the same. |
| ... | ... | @@ -3033,7 +3033,7 @@ fn airOptionalPayloadPtrSet(self: *FuncGen, inst: Air.Inst.Index) Allocator.Erro |
| 3033 | 3033 | |
| 3034 | 3034 | const o = self.object; |
| 3035 | 3035 | const zcu = o.zcu; |
| 3036 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 3036 | const ty_op = self.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 3037 | 3037 | const operand = try self.resolveInst(ty_op.operand); |
| 3038 | 3038 | const optional_ptr_ty = self.typeOf(ty_op.operand); |
| 3039 | 3039 | const optional_ty = optional_ptr_ty.childType(zcu); |
| ... | ... | @@ -3073,7 +3073,7 @@ fn airOptionalPayloadPtrSet(self: *FuncGen, inst: Air.Inst.Index) Allocator.Erro |
| 3073 | 3073 | |
| 3074 | 3074 | fn airOptionalPayload(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 3075 | 3075 | const zcu = self.object.zcu; |
| 3076 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 3076 | const ty_op = self.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 3077 | 3077 | const operand = try self.resolveInst(ty_op.operand); |
| 3078 | 3078 | const optional_ty = self.typeOf(ty_op.operand); |
| 3079 | 3079 | const payload_ty = self.typeOfIndex(inst); |
| ... | ... | @@ -3090,7 +3090,7 @@ fn airOptionalPayload(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Buil |
| 3090 | 3090 | fn airErrUnionPayload(fg: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 3091 | 3091 | const o = fg.object; |
| 3092 | 3092 | const zcu = o.zcu; |
| 3093 | const ty_op = fg.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 3093 | const ty_op = fg.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 3094 | 3094 | const operand = try fg.resolveInst(ty_op.operand); |
| 3095 | 3095 | const err_union_ty = fg.typeOf(ty_op.operand); |
| 3096 | 3096 | const payload_ty = fg.typeOfIndex(inst); |
| ... | ... | @@ -3106,7 +3106,7 @@ fn airErrUnionPayload(fg: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builde |
| 3106 | 3106 | fn airErrUnionPayloadPtr(fg: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 3107 | 3107 | const o = fg.object; |
| 3108 | 3108 | const zcu = o.zcu; |
| 3109 | const ty_op = fg.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 3109 | const ty_op = fg.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 3110 | 3110 | const operand = try fg.resolveInst(ty_op.operand); |
| 3111 | 3111 | const payload_ty = fg.typeOfIndex(inst).childType(zcu); |
| 3112 | 3112 | return fg.ptraddConst(operand, codegen.errUnionPayloadOffset(payload_ty, zcu)); |
| ... | ... | @@ -3119,7 +3119,7 @@ fn airErrUnionErr( |
| 3119 | 3119 | ) Allocator.Error!Builder.Value { |
| 3120 | 3120 | const o = self.object; |
| 3121 | 3121 | const zcu = o.zcu; |
| 3122 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 3122 | const ty_op = self.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 3123 | 3123 | const operand = try self.resolveInst(ty_op.operand); |
| 3124 | 3124 | const operand_ty = self.typeOf(ty_op.operand); |
| 3125 | 3125 | const err_union_ty = if (operand_is_ptr) operand_ty.childType(zcu) else operand_ty; |
| ... | ... | @@ -3149,7 +3149,7 @@ fn airErrUnionErr( |
| 3149 | 3149 | fn airErrUnionPayloadPtrSet(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 3150 | 3150 | const o = self.object; |
| 3151 | 3151 | const zcu = o.zcu; |
| 3152 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 3152 | const ty_op = self.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 3153 | 3153 | const operand = try self.resolveInst(ty_op.operand); |
| 3154 | 3154 | const err_union_ptr_ty = self.typeOf(ty_op.operand); |
| 3155 | 3155 | const err_union_ty = err_union_ptr_ty.childType(zcu); |
| ... | ... | @@ -3181,7 +3181,7 @@ fn airErrReturnTrace(self: *FuncGen, _: Air.Inst.Index) Allocator.Error!Builder. |
| 3181 | 3181 | } |
| 3182 | 3182 | |
| 3183 | 3183 | fn airSetErrReturnTrace(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 3184 | const un_op = self.air.instructions.items(.data)[@intFromEnum(inst)].un_op; | |
| 3184 | const un_op = self.air.instructions.items(.data)[@backingInt(inst)].un_op; | |
| 3185 | 3185 | self.err_ret_trace = try self.resolveInst(un_op); |
| 3186 | 3186 | return .none; |
| 3187 | 3187 | } |
| ... | ... | @@ -3189,7 +3189,7 @@ fn airSetErrReturnTrace(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Bu |
| 3189 | 3189 | fn airSaveErrReturnTraceIndex(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 3190 | 3190 | const zcu = self.object.zcu; |
| 3191 | 3191 | |
| 3192 | const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | |
| 3192 | const ty_pl = self.air.instructions.items(.data)[@backingInt(inst)].ty_pl; | |
| 3193 | 3193 | const struct_ty = ty_pl.ty.toType(); |
| 3194 | 3194 | const field_index = ty_pl.payload; |
| 3195 | 3195 | |
| ... | ... | @@ -3205,7 +3205,7 @@ fn airSaveErrReturnTraceIndex(self: *FuncGen, inst: Air.Inst.Index) Allocator.Er |
| 3205 | 3205 | fn airWrapOptional(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 3206 | 3206 | const o = self.object; |
| 3207 | 3207 | const zcu = o.zcu; |
| 3208 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 3208 | const ty_op = self.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 3209 | 3209 | const payload_ty = self.typeOf(ty_op.operand); |
| 3210 | 3210 | comptime assert(optional_layout_version == 3); |
| 3211 | 3211 | assert(payload_ty.hasRuntimeBits(zcu)); |
| ... | ... | @@ -3228,7 +3228,7 @@ fn airWrapOptional(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder |
| 3228 | 3228 | fn airWrapErrUnionPayload(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 3229 | 3229 | const o = self.object; |
| 3230 | 3230 | const zcu = o.zcu; |
| 3231 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 3231 | const ty_op = self.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 3232 | 3232 | const err_un_ty = self.typeOfIndex(inst); |
| 3233 | 3233 | const operand = try self.resolveInst(ty_op.operand); |
| 3234 | 3234 | const payload_ty = self.typeOf(ty_op.operand); |
| ... | ... | @@ -3250,7 +3250,7 @@ fn airWrapErrUnionPayload(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error! |
| 3250 | 3250 | fn airWrapErrUnionErr(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 3251 | 3251 | const o = self.object; |
| 3252 | 3252 | const zcu = o.zcu; |
| 3253 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 3253 | const ty_op = self.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 3254 | 3254 | const err_un_ty = self.typeOfIndex(inst); |
| 3255 | 3255 | const payload_ty = err_un_ty.errorUnionPayload(zcu); |
| 3256 | 3256 | const operand = try self.resolveInst(ty_op.operand); |
| ... | ... | @@ -3271,7 +3271,7 @@ fn airWrapErrUnionErr(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Buil |
| 3271 | 3271 | |
| 3272 | 3272 | fn airWasmMemorySize(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 3273 | 3273 | const o = self.object; |
| 3274 | const pl_op = self.air.instructions.items(.data)[@intFromEnum(inst)].pl_op; | |
| 3274 | const pl_op = self.air.instructions.items(.data)[@backingInt(inst)].pl_op; | |
| 3275 | 3275 | const index = pl_op.payload; |
| 3276 | 3276 | const llvm_usize = try o.lowerType(.usize, .by_value); |
| 3277 | 3277 | return self.wip.callIntrinsic(.normal, .none, .@"wasm.memory.size", &.{llvm_usize}, &.{ |
| ... | ... | @@ -3281,7 +3281,7 @@ fn airWasmMemorySize(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Build |
| 3281 | 3281 | |
| 3282 | 3282 | fn airWasmMemoryGrow(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 3283 | 3283 | const o = self.object; |
| 3284 | const pl_op = self.air.instructions.items(.data)[@intFromEnum(inst)].pl_op; | |
| 3284 | const pl_op = self.air.instructions.items(.data)[@backingInt(inst)].pl_op; | |
| 3285 | 3285 | const index = pl_op.payload; |
| 3286 | 3286 | const llvm_isize = try o.lowerType(.isize, .by_value); |
| 3287 | 3287 | return self.wip.callIntrinsic(.normal, .none, .@"wasm.memory.grow", &.{llvm_isize}, &.{ |
| ... | ... | @@ -3291,7 +3291,7 @@ fn airWasmMemoryGrow(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Build |
| 3291 | 3291 | |
| 3292 | 3292 | fn airRuntimeNavPtr(fg: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 3293 | 3293 | const o = fg.object; |
| 3294 | const ty_nav = fg.air.instructions.items(.data)[@intFromEnum(inst)].ty_nav; | |
| 3294 | const ty_nav = fg.air.instructions.items(.data)[@backingInt(inst)].ty_nav; | |
| 3295 | 3295 | const llvm_ptr = try o.lowerNavRef(ty_nav.nav); |
| 3296 | 3296 | return llvm_ptr.toValue(); |
| 3297 | 3297 | } |
| ... | ... | @@ -3299,7 +3299,7 @@ fn airRuntimeNavPtr(fg: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder. |
| 3299 | 3299 | fn airMin(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 3300 | 3300 | const o = self.object; |
| 3301 | 3301 | const zcu = o.zcu; |
| 3302 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 3302 | const bin_op = self.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 3303 | 3303 | const lhs = try self.resolveInst(bin_op.lhs); |
| 3304 | 3304 | const rhs = try self.resolveInst(bin_op.rhs); |
| 3305 | 3305 | const inst_ty = self.typeOfIndex(inst); |
| ... | ... | @@ -3319,7 +3319,7 @@ fn airMin(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 3319 | 3319 | fn airMax(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 3320 | 3320 | const o = self.object; |
| 3321 | 3321 | const zcu = o.zcu; |
| 3322 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 3322 | const bin_op = self.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 3323 | 3323 | const lhs = try self.resolveInst(bin_op.lhs); |
| 3324 | 3324 | const rhs = try self.resolveInst(bin_op.rhs); |
| 3325 | 3325 | const inst_ty = self.typeOfIndex(inst); |
| ... | ... | @@ -3337,7 +3337,7 @@ fn airMax(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 3337 | 3337 | } |
| 3338 | 3338 | |
| 3339 | 3339 | fn airSlice(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 3340 | const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | |
| 3340 | const ty_pl = self.air.instructions.items(.data)[@backingInt(inst)].ty_pl; | |
| 3341 | 3341 | const bin_op = self.air.extraData(Air.Bin, ty_pl.payload).data; |
| 3342 | 3342 | const ptr = try self.resolveInst(bin_op.lhs); |
| 3343 | 3343 | const len = try self.resolveInst(bin_op.rhs); |
| ... | ... | @@ -3347,7 +3347,7 @@ fn airSlice(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value |
| 3347 | 3347 | |
| 3348 | 3348 | fn airAdd(self: *FuncGen, inst: Air.Inst.Index, fast: Builder.FastMathKind) Allocator.Error!Builder.Value { |
| 3349 | 3349 | const zcu = self.object.zcu; |
| 3350 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 3350 | const bin_op = self.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 3351 | 3351 | const lhs = try self.resolveInst(bin_op.lhs); |
| 3352 | 3352 | const rhs = try self.resolveInst(bin_op.rhs); |
| 3353 | 3353 | const inst_ty = self.typeOfIndex(inst); |
| ... | ... | @@ -3366,7 +3366,7 @@ fn airSafeArithmetic( |
| 3366 | 3366 | const o = fg.object; |
| 3367 | 3367 | const zcu = o.zcu; |
| 3368 | 3368 | |
| 3369 | const bin_op = fg.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 3369 | const bin_op = fg.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 3370 | 3370 | const lhs = try fg.resolveInst(bin_op.lhs); |
| 3371 | 3371 | const rhs = try fg.resolveInst(bin_op.rhs); |
| 3372 | 3372 | const inst_ty = fg.typeOfIndex(inst); |
| ... | ... | @@ -3403,7 +3403,7 @@ fn airSafeArithmetic( |
| 3403 | 3403 | } |
| 3404 | 3404 | |
| 3405 | 3405 | fn airAddWrap(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 3406 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 3406 | const bin_op = self.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 3407 | 3407 | const lhs = try self.resolveInst(bin_op.lhs); |
| 3408 | 3408 | const rhs = try self.resolveInst(bin_op.rhs); |
| 3409 | 3409 | |
| ... | ... | @@ -3413,7 +3413,7 @@ fn airAddWrap(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Valu |
| 3413 | 3413 | fn airAddSat(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 3414 | 3414 | const o = self.object; |
| 3415 | 3415 | const zcu = o.zcu; |
| 3416 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 3416 | const bin_op = self.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 3417 | 3417 | const lhs = try self.resolveInst(bin_op.lhs); |
| 3418 | 3418 | const rhs = try self.resolveInst(bin_op.rhs); |
| 3419 | 3419 | const inst_ty = self.typeOfIndex(inst); |
| ... | ... | @@ -3431,7 +3431,7 @@ fn airAddSat(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value |
| 3431 | 3431 | |
| 3432 | 3432 | fn airSub(self: *FuncGen, inst: Air.Inst.Index, fast: Builder.FastMathKind) Allocator.Error!Builder.Value { |
| 3433 | 3433 | const zcu = self.object.zcu; |
| 3434 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 3434 | const bin_op = self.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 3435 | 3435 | const lhs = try self.resolveInst(bin_op.lhs); |
| 3436 | 3436 | const rhs = try self.resolveInst(bin_op.rhs); |
| 3437 | 3437 | const inst_ty = self.typeOfIndex(inst); |
| ... | ... | @@ -3442,7 +3442,7 @@ fn airSub(self: *FuncGen, inst: Air.Inst.Index, fast: Builder.FastMathKind) Allo |
| 3442 | 3442 | } |
| 3443 | 3443 | |
| 3444 | 3444 | fn airSubWrap(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 3445 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 3445 | const bin_op = self.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 3446 | 3446 | const lhs = try self.resolveInst(bin_op.lhs); |
| 3447 | 3447 | const rhs = try self.resolveInst(bin_op.rhs); |
| 3448 | 3448 | |
| ... | ... | @@ -3452,7 +3452,7 @@ fn airSubWrap(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Valu |
| 3452 | 3452 | fn airSubSat(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 3453 | 3453 | const o = self.object; |
| 3454 | 3454 | const zcu = o.zcu; |
| 3455 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 3455 | const bin_op = self.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 3456 | 3456 | const lhs = try self.resolveInst(bin_op.lhs); |
| 3457 | 3457 | const rhs = try self.resolveInst(bin_op.rhs); |
| 3458 | 3458 | const inst_ty = self.typeOfIndex(inst); |
| ... | ... | @@ -3470,7 +3470,7 @@ fn airSubSat(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value |
| 3470 | 3470 | |
| 3471 | 3471 | fn airMul(self: *FuncGen, inst: Air.Inst.Index, fast: Builder.FastMathKind) Allocator.Error!Builder.Value { |
| 3472 | 3472 | const zcu = self.object.zcu; |
| 3473 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 3473 | const bin_op = self.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 3474 | 3474 | const lhs = try self.resolveInst(bin_op.lhs); |
| 3475 | 3475 | const rhs = try self.resolveInst(bin_op.rhs); |
| 3476 | 3476 | const inst_ty = self.typeOfIndex(inst); |
| ... | ... | @@ -3481,7 +3481,7 @@ fn airMul(self: *FuncGen, inst: Air.Inst.Index, fast: Builder.FastMathKind) Allo |
| 3481 | 3481 | } |
| 3482 | 3482 | |
| 3483 | 3483 | fn airMulWrap(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 3484 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 3484 | const bin_op = self.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 3485 | 3485 | const lhs = try self.resolveInst(bin_op.lhs); |
| 3486 | 3486 | const rhs = try self.resolveInst(bin_op.rhs); |
| 3487 | 3487 | |
| ... | ... | @@ -3491,7 +3491,7 @@ fn airMulWrap(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Valu |
| 3491 | 3491 | fn airMulSat(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 3492 | 3492 | const o = self.object; |
| 3493 | 3493 | const zcu = o.zcu; |
| 3494 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 3494 | const bin_op = self.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 3495 | 3495 | const lhs = try self.resolveInst(bin_op.lhs); |
| 3496 | 3496 | const rhs = try self.resolveInst(bin_op.rhs); |
| 3497 | 3497 | const inst_ty = self.typeOfIndex(inst); |
| ... | ... | @@ -3508,7 +3508,7 @@ fn airMulSat(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value |
| 3508 | 3508 | } |
| 3509 | 3509 | |
| 3510 | 3510 | fn airDivFloat(self: *FuncGen, inst: Air.Inst.Index, fast: Builder.FastMathKind) Allocator.Error!Builder.Value { |
| 3511 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 3511 | const bin_op = self.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 3512 | 3512 | const lhs = try self.resolveInst(bin_op.lhs); |
| 3513 | 3513 | const rhs = try self.resolveInst(bin_op.rhs); |
| 3514 | 3514 | const inst_ty = self.typeOfIndex(inst); |
| ... | ... | @@ -3518,7 +3518,7 @@ fn airDivFloat(self: *FuncGen, inst: Air.Inst.Index, fast: Builder.FastMathKind) |
| 3518 | 3518 | |
| 3519 | 3519 | fn airDivTrunc(self: *FuncGen, inst: Air.Inst.Index, fast: Builder.FastMathKind) Allocator.Error!Builder.Value { |
| 3520 | 3520 | const zcu = self.object.zcu; |
| 3521 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 3521 | const bin_op = self.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 3522 | 3522 | const lhs = try self.resolveInst(bin_op.lhs); |
| 3523 | 3523 | const rhs = try self.resolveInst(bin_op.rhs); |
| 3524 | 3524 | const inst_ty = self.typeOfIndex(inst); |
| ... | ... | @@ -3534,7 +3534,7 @@ fn airDivTrunc(self: *FuncGen, inst: Air.Inst.Index, fast: Builder.FastMathKind) |
| 3534 | 3534 | fn airDivFloor(self: *FuncGen, inst: Air.Inst.Index, fast: Builder.FastMathKind) Allocator.Error!Builder.Value { |
| 3535 | 3535 | const o = self.object; |
| 3536 | 3536 | const zcu = o.zcu; |
| 3537 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 3537 | const bin_op = self.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 3538 | 3538 | const lhs = try self.resolveInst(bin_op.lhs); |
| 3539 | 3539 | const rhs = try self.resolveInst(bin_op.rhs); |
| 3540 | 3540 | const inst_ty = self.typeOfIndex(inst); |
| ... | ... | @@ -3583,7 +3583,7 @@ fn airDivFloor(self: *FuncGen, inst: Air.Inst.Index, fast: Builder.FastMathKind) |
| 3583 | 3583 | fn airDivCeil(self: *FuncGen, inst: Air.Inst.Index, fast: Builder.FastMathKind) Allocator.Error!Builder.Value { |
| 3584 | 3584 | const o = self.object; |
| 3585 | 3585 | const zcu = o.zcu; |
| 3586 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 3586 | const bin_op = self.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 3587 | 3587 | const lhs = try self.resolveInst(bin_op.lhs); |
| 3588 | 3588 | const rhs = try self.resolveInst(bin_op.rhs); |
| 3589 | 3589 | const inst_ty = self.typeOfIndex(inst); |
| ... | ... | @@ -3654,7 +3654,7 @@ fn airDivCeil(self: *FuncGen, inst: Air.Inst.Index, fast: Builder.FastMathKind) |
| 3654 | 3654 | |
| 3655 | 3655 | fn airDivExact(self: *FuncGen, inst: Air.Inst.Index, fast: Builder.FastMathKind) Allocator.Error!Builder.Value { |
| 3656 | 3656 | const zcu = self.object.zcu; |
| 3657 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 3657 | const bin_op = self.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 3658 | 3658 | const lhs = try self.resolveInst(bin_op.lhs); |
| 3659 | 3659 | const rhs = try self.resolveInst(bin_op.rhs); |
| 3660 | 3660 | const inst_ty = self.typeOfIndex(inst); |
| ... | ... | @@ -3671,7 +3671,7 @@ fn airDivExact(self: *FuncGen, inst: Air.Inst.Index, fast: Builder.FastMathKind) |
| 3671 | 3671 | |
| 3672 | 3672 | fn airRem(self: *FuncGen, inst: Air.Inst.Index, fast: Builder.FastMathKind) Allocator.Error!Builder.Value { |
| 3673 | 3673 | const zcu = self.object.zcu; |
| 3674 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 3674 | const bin_op = self.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 3675 | 3675 | const lhs = try self.resolveInst(bin_op.lhs); |
| 3676 | 3676 | const rhs = try self.resolveInst(bin_op.rhs); |
| 3677 | 3677 | const inst_ty = self.typeOfIndex(inst); |
| ... | ... | @@ -3688,7 +3688,7 @@ fn airRem(self: *FuncGen, inst: Air.Inst.Index, fast: Builder.FastMathKind) Allo |
| 3688 | 3688 | fn airMod(self: *FuncGen, inst: Air.Inst.Index, fast: Builder.FastMathKind) Allocator.Error!Builder.Value { |
| 3689 | 3689 | const o = self.object; |
| 3690 | 3690 | const zcu = o.zcu; |
| 3691 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 3691 | const bin_op = self.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 3692 | 3692 | const lhs = try self.resolveInst(bin_op.lhs); |
| 3693 | 3693 | const rhs = try self.resolveInst(bin_op.rhs); |
| 3694 | 3694 | const inst_ty = self.typeOfIndex(inst); |
| ... | ... | @@ -3738,7 +3738,7 @@ fn airMod(self: *FuncGen, inst: Air.Inst.Index, fast: Builder.FastMathKind) Allo |
| 3738 | 3738 | |
| 3739 | 3739 | fn airPtrAdd(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 3740 | 3740 | const zcu = self.object.zcu; |
| 3741 | const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | |
| 3741 | const ty_pl = self.air.instructions.items(.data)[@backingInt(inst)].ty_pl; | |
| 3742 | 3742 | const bin_op = self.air.extraData(Air.Bin, ty_pl.payload).data; |
| 3743 | 3743 | const ptr_or_slice = try self.resolveInst(bin_op.lhs); |
| 3744 | 3744 | const index = try self.resolveInst(bin_op.rhs); |
| ... | ... | @@ -3754,7 +3754,7 @@ fn airPtrAdd(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value |
| 3754 | 3754 | fn airPtrSub(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 3755 | 3755 | const o = self.object; |
| 3756 | 3756 | const zcu = o.zcu; |
| 3757 | const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | |
| 3757 | const ty_pl = self.air.instructions.items(.data)[@backingInt(inst)].ty_pl; | |
| 3758 | 3758 | const bin_op = self.air.extraData(Air.Bin, ty_pl.payload).data; |
| 3759 | 3759 | const ptr_or_slice = try self.resolveInst(bin_op.lhs); |
| 3760 | 3760 | const llvm_usize_ty = try o.lowerType(.usize, .by_value); |
| ... | ... | @@ -3778,7 +3778,7 @@ fn airOverflow( |
| 3778 | 3778 | ) Allocator.Error!Builder.Value { |
| 3779 | 3779 | const o = self.object; |
| 3780 | 3780 | const zcu = o.zcu; |
| 3781 | const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | |
| 3781 | const ty_pl = self.air.instructions.items(.data)[@backingInt(inst)].ty_pl; | |
| 3782 | 3782 | const extra = self.air.extraData(Air.Bin, ty_pl.payload).data; |
| 3783 | 3783 | |
| 3784 | 3784 | const lhs = try self.resolveInst(extra.lhs); |
| ... | ... | @@ -4097,7 +4097,7 @@ fn buildFloatOp( |
| 4097 | 4097 | } |
| 4098 | 4098 | |
| 4099 | 4099 | fn airMulAdd(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 4100 | const pl_op = self.air.instructions.items(.data)[@intFromEnum(inst)].pl_op; | |
| 4100 | const pl_op = self.air.instructions.items(.data)[@backingInt(inst)].pl_op; | |
| 4101 | 4101 | const extra = self.air.extraData(Air.Bin, pl_op.payload).data; |
| 4102 | 4102 | |
| 4103 | 4103 | const mulend1 = try self.resolveInst(extra.lhs); |
| ... | ... | @@ -4111,7 +4111,7 @@ fn airMulAdd(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value |
| 4111 | 4111 | fn airShlWithOverflow(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 4112 | 4112 | const o = self.object; |
| 4113 | 4113 | const zcu = o.zcu; |
| 4114 | const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | |
| 4114 | const ty_pl = self.air.instructions.items(.data)[@backingInt(inst)].ty_pl; | |
| 4115 | 4115 | const extra = self.air.extraData(Air.Bin, ty_pl.payload).data; |
| 4116 | 4116 | |
| 4117 | 4117 | const lhs = try self.resolveInst(extra.lhs); |
| ... | ... | @@ -4160,21 +4160,21 @@ fn airShlWithOverflow(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Buil |
| 4160 | 4160 | } |
| 4161 | 4161 | |
| 4162 | 4162 | fn airAnd(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 4163 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 4163 | const bin_op = self.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 4164 | 4164 | const lhs = try self.resolveInst(bin_op.lhs); |
| 4165 | 4165 | const rhs = try self.resolveInst(bin_op.rhs); |
| 4166 | 4166 | return self.wip.bin(.@"and", lhs, rhs, ""); |
| 4167 | 4167 | } |
| 4168 | 4168 | |
| 4169 | 4169 | fn airOr(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 4170 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 4170 | const bin_op = self.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 4171 | 4171 | const lhs = try self.resolveInst(bin_op.lhs); |
| 4172 | 4172 | const rhs = try self.resolveInst(bin_op.rhs); |
| 4173 | 4173 | return self.wip.bin(.@"or", lhs, rhs, ""); |
| 4174 | 4174 | } |
| 4175 | 4175 | |
| 4176 | 4176 | fn airXor(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 4177 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 4177 | const bin_op = self.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 4178 | 4178 | const lhs = try self.resolveInst(bin_op.lhs); |
| 4179 | 4179 | const rhs = try self.resolveInst(bin_op.rhs); |
| 4180 | 4180 | return self.wip.bin(.xor, lhs, rhs, ""); |
| ... | ... | @@ -4183,7 +4183,7 @@ fn airXor(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 4183 | 4183 | fn airShlExact(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 4184 | 4184 | const o = self.object; |
| 4185 | 4185 | const zcu = o.zcu; |
| 4186 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 4186 | const bin_op = self.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 4187 | 4187 | |
| 4188 | 4188 | const lhs = try self.resolveInst(bin_op.lhs); |
| 4189 | 4189 | const rhs = try self.resolveInst(bin_op.rhs); |
| ... | ... | @@ -4206,7 +4206,7 @@ fn airShlExact(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Val |
| 4206 | 4206 | fn airShl(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 4207 | 4207 | const o = self.object; |
| 4208 | 4208 | const zcu = o.zcu; |
| 4209 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 4209 | const bin_op = self.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 4210 | 4210 | |
| 4211 | 4211 | const lhs = try self.resolveInst(bin_op.lhs); |
| 4212 | 4212 | const rhs = try self.resolveInst(bin_op.rhs); |
| ... | ... | @@ -4224,7 +4224,7 @@ fn airShl(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 4224 | 4224 | fn airShlSat(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 4225 | 4225 | const o = self.object; |
| 4226 | 4226 | const zcu = o.zcu; |
| 4227 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 4227 | const bin_op = self.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 4228 | 4228 | |
| 4229 | 4229 | const lhs = try self.resolveInst(bin_op.lhs); |
| 4230 | 4230 | const rhs = try self.resolveInst(bin_op.rhs); |
| ... | ... | @@ -4306,7 +4306,7 @@ fn airShlSat(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value |
| 4306 | 4306 | fn airShr(self: *FuncGen, inst: Air.Inst.Index, is_exact: bool) Allocator.Error!Builder.Value { |
| 4307 | 4307 | const o = self.object; |
| 4308 | 4308 | const zcu = o.zcu; |
| 4309 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 4309 | const bin_op = self.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 4310 | 4310 | |
| 4311 | 4311 | const lhs = try self.resolveInst(bin_op.lhs); |
| 4312 | 4312 | const rhs = try self.resolveInst(bin_op.rhs); |
| ... | ... | @@ -4330,7 +4330,7 @@ fn airShr(self: *FuncGen, inst: Air.Inst.Index, is_exact: bool) Allocator.Error! |
| 4330 | 4330 | fn airAbs(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 4331 | 4331 | const o = self.object; |
| 4332 | 4332 | const zcu = o.zcu; |
| 4333 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 4333 | const ty_op = self.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 4334 | 4334 | const operand = try self.resolveInst(ty_op.operand); |
| 4335 | 4335 | const operand_ty = self.typeOf(ty_op.operand); |
| 4336 | 4336 | const scalar_ty = operand_ty.scalarType(zcu); |
| ... | ... | @@ -4352,7 +4352,7 @@ fn airAbs(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 4352 | 4352 | fn airIntCast(fg: *FuncGen, inst: Air.Inst.Index, safety: bool) Allocator.Error!Builder.Value { |
| 4353 | 4353 | const o = fg.object; |
| 4354 | 4354 | const zcu = o.zcu; |
| 4355 | const ty_op = fg.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 4355 | const ty_op = fg.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 4356 | 4356 | const dest_ty = fg.typeOfIndex(inst); |
| 4357 | 4357 | const dest_llvm_ty = try o.lowerType(dest_ty, .by_value); |
| 4358 | 4358 | const operand = try fg.resolveInst(ty_op.operand); |
| ... | ... | @@ -4459,7 +4459,7 @@ fn airIntCast(fg: *FuncGen, inst: Air.Inst.Index, safety: bool) Allocator.Error! |
| 4459 | 4459 | } |
| 4460 | 4460 | |
| 4461 | 4461 | fn airTrunc(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 4462 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 4462 | const ty_op = self.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 4463 | 4463 | const operand = try self.resolveInst(ty_op.operand); |
| 4464 | 4464 | const dest_llvm_ty = try self.object.lowerType(self.typeOfIndex(inst), .by_value); |
| 4465 | 4465 | return self.wip.cast(.trunc, operand, dest_llvm_ty, ""); |
| ... | ... | @@ -4468,7 +4468,7 @@ fn airTrunc(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value |
| 4468 | 4468 | fn airFptrunc(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 4469 | 4469 | const o = self.object; |
| 4470 | 4470 | const zcu = o.zcu; |
| 4471 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 4471 | const ty_op = self.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 4472 | 4472 | const operand = try self.resolveInst(ty_op.operand); |
| 4473 | 4473 | const operand_ty = self.typeOf(ty_op.operand); |
| 4474 | 4474 | const dest_ty = self.typeOfIndex(inst); |
| ... | ... | @@ -4502,7 +4502,7 @@ fn airFptrunc(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Valu |
| 4502 | 4502 | fn airFpext(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 4503 | 4503 | const o = self.object; |
| 4504 | 4504 | const zcu = o.zcu; |
| 4505 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 4505 | const ty_op = self.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 4506 | 4506 | const operand = try self.resolveInst(ty_op.operand); |
| 4507 | 4507 | const operand_ty = self.typeOf(ty_op.operand); |
| 4508 | 4508 | const dest_ty = self.typeOfIndex(inst); |
| ... | ... | @@ -4543,7 +4543,7 @@ fn airBitCast(fg: *FuncGen, inst: Air.Inst.Index, safety: bool) Allocator.Error! |
| 4543 | 4543 | const o = fg.object; |
| 4544 | 4544 | const zcu = o.zcu; |
| 4545 | 4545 | |
| 4546 | const ty_op = fg.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 4546 | const ty_op = fg.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 4547 | 4547 | const operand_ty = fg.typeOf(ty_op.operand); |
| 4548 | 4548 | const dest_ty = fg.typeOfIndex(inst); |
| 4549 | 4549 | const operand = try fg.resolveInst(ty_op.operand); |
| ... | ... | @@ -4588,7 +4588,7 @@ fn airBitCast(fg: *FuncGen, inst: Air.Inst.Index, safety: bool) Allocator.Error! |
| 4588 | 4588 | |
| 4589 | 4589 | fn airNopCast(fg: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 4590 | 4590 | const zcu = fg.object.zcu; |
| 4591 | const ty_op = fg.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 4591 | const ty_op = fg.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 4592 | 4592 | const operand_ty = fg.typeOf(ty_op.operand); |
| 4593 | 4593 | const dest_ty = fg.typeOfIndex(inst); |
| 4594 | 4594 | assert(isByRef(operand_ty, zcu) == isByRef(dest_ty, zcu)); |
| ... | ... | @@ -4599,7 +4599,7 @@ fn airNopCast(fg: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value |
| 4599 | 4599 | fn airPtrFromInt(fg: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 4600 | 4600 | const o = fg.object; |
| 4601 | 4601 | const zcu = o.zcu; |
| 4602 | const ty_op = fg.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 4602 | const ty_op = fg.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 4603 | 4603 | const operand_ty = fg.typeOf(ty_op.operand); |
| 4604 | 4604 | const dest_ty = fg.typeOfIndex(inst); |
| 4605 | 4605 | assert(operand_ty.scalarType(zcu).toIntern() == .usize_type); |
| ... | ... | @@ -4613,7 +4613,7 @@ fn airPtrFromInt(fg: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Val |
| 4613 | 4613 | fn airIntFromPtr(fg: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 4614 | 4614 | const o = fg.object; |
| 4615 | 4615 | const zcu = o.zcu; |
| 4616 | const ty_op = fg.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 4616 | const ty_op = fg.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 4617 | 4617 | const operand_ty = fg.typeOf(ty_op.operand); |
| 4618 | 4618 | const dest_ty = fg.typeOfIndex(inst); |
| 4619 | 4619 | assert(operand_ty.scalarType(zcu).isPtrAtRuntime(zcu)); |
| ... | ... | @@ -4625,7 +4625,7 @@ fn airIntFromPtr(fg: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Val |
| 4625 | 4625 | } |
| 4626 | 4626 | |
| 4627 | 4627 | fn airUnionFromEnum(fg: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 4628 | const ty_op = fg.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 4628 | const ty_op = fg.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 4629 | 4629 | const enum_ty = fg.typeOf(ty_op.operand); |
| 4630 | 4630 | const union_ty = fg.typeOfIndex(inst); |
| 4631 | 4631 | const enum_val = try fg.resolveInst(ty_op.operand); |
| ... | ... | @@ -4652,7 +4652,7 @@ fn airArg(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 4652 | 4652 | |
| 4653 | 4653 | const mod = file.mod.?; |
| 4654 | 4654 | if (mod.strip) return arg_val; |
| 4655 | const arg = self.air.instructions.items(.data)[@intFromEnum(inst)].arg; | |
| 4655 | const arg = self.air.instructions.items(.data)[@backingInt(inst)].arg; | |
| 4656 | 4656 | const zir = &file.zir.?; |
| 4657 | 4657 | const name = zir.nullTerminatedString(zir.getParamName(zir.getParamBody(func_zir.inst)[arg.zir_param_index]).?); |
| 4658 | 4658 | |
| ... | ... | @@ -4791,7 +4791,7 @@ fn buildAlloca( |
| 4791 | 4791 | fn airStore(fg: *FuncGen, inst: Air.Inst.Index, safety: bool) Allocator.Error!Builder.Value { |
| 4792 | 4792 | const o = fg.object; |
| 4793 | 4793 | const zcu = o.zcu; |
| 4794 | const bin_op = fg.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 4794 | const bin_op = fg.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 4795 | 4795 | const ptr = try fg.resolveInst(bin_op.lhs); |
| 4796 | 4796 | const ptr_ty = fg.typeOf(bin_op.lhs); |
| 4797 | 4797 | const ptr_info = ptr_ty.ptrInfo(zcu); |
| ... | ... | @@ -4914,7 +4914,7 @@ fn airStore(fg: *FuncGen, inst: Air.Inst.Index, safety: bool) Allocator.Error!Bu |
| 4914 | 4914 | fn airLoad(fg: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 4915 | 4915 | const o = fg.object; |
| 4916 | 4916 | const zcu = o.zcu; |
| 4917 | const ty_op = fg.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 4917 | const ty_op = fg.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 4918 | 4918 | const ptr_ty = fg.typeOf(ty_op.operand); |
| 4919 | 4919 | const ptr_info = ptr_ty.ptrInfo(zcu); |
| 4920 | 4920 | const ptr = try fg.resolveInst(ty_op.operand); |
| ... | ... | @@ -5024,7 +5024,7 @@ fn airCmpxchg( |
| 5024 | 5024 | ) Allocator.Error!Builder.Value { |
| 5025 | 5025 | const o = self.object; |
| 5026 | 5026 | const zcu = o.zcu; |
| 5027 | const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | |
| 5027 | const ty_pl = self.air.instructions.items(.data)[@backingInt(inst)].ty_pl; | |
| 5028 | 5028 | const extra = self.air.extraData(Air.Cmpxchg, ty_pl.payload).data; |
| 5029 | 5029 | const ptr = try self.resolveInst(extra.ptr); |
| 5030 | 5030 | const ptr_ty = self.typeOf(extra.ptr); |
| ... | ... | @@ -5090,7 +5090,7 @@ fn airCmpxchg( |
| 5090 | 5090 | fn airAtomicRmw(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 5091 | 5091 | const o = self.object; |
| 5092 | 5092 | const zcu = o.zcu; |
| 5093 | const pl_op = self.air.instructions.items(.data)[@intFromEnum(inst)].pl_op; | |
| 5093 | const pl_op = self.air.instructions.items(.data)[@backingInt(inst)].pl_op; | |
| 5094 | 5094 | const extra = self.air.extraData(Air.AtomicRmw, pl_op.payload).data; |
| 5095 | 5095 | const ptr = try self.resolveInst(pl_op.operand); |
| 5096 | 5096 | const ptr_ty = self.typeOf(pl_op.operand); |
| ... | ... | @@ -5155,7 +5155,7 @@ fn airAtomicRmw(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Va |
| 5155 | 5155 | fn airAtomicLoad(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 5156 | 5156 | const o = self.object; |
| 5157 | 5157 | const zcu = o.zcu; |
| 5158 | const atomic_load = self.air.instructions.items(.data)[@intFromEnum(inst)].atomic_load; | |
| 5158 | const atomic_load = self.air.instructions.items(.data)[@backingInt(inst)].atomic_load; | |
| 5159 | 5159 | const ptr = try self.resolveInst(atomic_load.ptr); |
| 5160 | 5160 | const ptr_ty = self.typeOf(atomic_load.ptr); |
| 5161 | 5161 | const info = ptr_ty.ptrInfo(zcu); |
| ... | ... | @@ -5203,7 +5203,7 @@ fn airAtomicStore( |
| 5203 | 5203 | ordering: Builder.AtomicOrdering, |
| 5204 | 5204 | ) Allocator.Error!Builder.Value { |
| 5205 | 5205 | const zcu = self.object.zcu; |
| 5206 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 5206 | const bin_op = self.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 5207 | 5207 | const ptr_ty = self.typeOf(bin_op.lhs); |
| 5208 | 5208 | const operand_ty = ptr_ty.childType(zcu); |
| 5209 | 5209 | if (!operand_ty.hasRuntimeBits(zcu)) return .none; |
| ... | ... | @@ -5240,7 +5240,7 @@ fn airAtomicStore( |
| 5240 | 5240 | fn airMemset(self: *FuncGen, inst: Air.Inst.Index, safety: bool) Allocator.Error!Builder.Value { |
| 5241 | 5241 | const o = self.object; |
| 5242 | 5242 | const zcu = o.zcu; |
| 5243 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 5243 | const bin_op = self.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 5244 | 5244 | const dest_slice = try self.resolveInst(bin_op.lhs); |
| 5245 | 5245 | const ptr_ty = self.typeOf(bin_op.lhs); |
| 5246 | 5246 | const elem_ty = self.typeOf(bin_op.rhs); |
| ... | ... | @@ -5389,7 +5389,7 @@ fn airMemset(self: *FuncGen, inst: Air.Inst.Index, safety: bool) Allocator.Error |
| 5389 | 5389 | |
| 5390 | 5390 | fn airMemcpy(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 5391 | 5391 | const zcu = self.object.zcu; |
| 5392 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 5392 | const bin_op = self.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 5393 | 5393 | const dest_slice = try self.resolveInst(bin_op.lhs); |
| 5394 | 5394 | const dest_ptr_ty = self.typeOf(bin_op.lhs); |
| 5395 | 5395 | const src_slice = try self.resolveInst(bin_op.rhs); |
| ... | ... | @@ -5417,7 +5417,7 @@ fn airMemcpy(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value |
| 5417 | 5417 | |
| 5418 | 5418 | fn airMemmove(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 5419 | 5419 | const zcu = self.object.zcu; |
| 5420 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 5420 | const bin_op = self.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 5421 | 5421 | const dest_slice = try self.resolveInst(bin_op.lhs); |
| 5422 | 5422 | const dest_ptr_ty = self.typeOf(bin_op.lhs); |
| 5423 | 5423 | const src_slice = try self.resolveInst(bin_op.rhs); |
| ... | ... | @@ -5441,7 +5441,7 @@ fn airMemmove(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Valu |
| 5441 | 5441 | |
| 5442 | 5442 | fn airSetUnionTag(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 5443 | 5443 | const zcu = self.object.zcu; |
| 5444 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 5444 | const bin_op = self.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 5445 | 5445 | const un_ptr_ty = self.typeOf(bin_op.lhs); |
| 5446 | 5446 | const un_ty = un_ptr_ty.childType(zcu); |
| 5447 | 5447 | const layout = un_ty.unionGetLayout(zcu); |
| ... | ... | @@ -5466,7 +5466,7 @@ fn airSetUnionTag(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder. |
| 5466 | 5466 | fn airGetUnionTag(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 5467 | 5467 | const o = self.object; |
| 5468 | 5468 | const zcu = o.zcu; |
| 5469 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 5469 | const ty_op = self.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 5470 | 5470 | const un_ty = self.typeOf(ty_op.operand); |
| 5471 | 5471 | const layout = un_ty.unionGetLayout(zcu); |
| 5472 | 5472 | assert(layout.tag_size != 0); |
| ... | ... | @@ -5477,7 +5477,7 @@ fn airGetUnionTag(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder. |
| 5477 | 5477 | } |
| 5478 | 5478 | |
| 5479 | 5479 | fn airUnaryOp(self: *FuncGen, inst: Air.Inst.Index, comptime op: FloatOp) Allocator.Error!Builder.Value { |
| 5480 | const un_op = self.air.instructions.items(.data)[@intFromEnum(inst)].un_op; | |
| 5480 | const un_op = self.air.instructions.items(.data)[@backingInt(inst)].un_op; | |
| 5481 | 5481 | const operand = try self.resolveInst(un_op); |
| 5482 | 5482 | const operand_ty = self.typeOf(un_op); |
| 5483 | 5483 | |
| ... | ... | @@ -5485,7 +5485,7 @@ fn airUnaryOp(self: *FuncGen, inst: Air.Inst.Index, comptime op: FloatOp) Alloca |
| 5485 | 5485 | } |
| 5486 | 5486 | |
| 5487 | 5487 | fn airNeg(self: *FuncGen, inst: Air.Inst.Index, fast: Builder.FastMathKind) Allocator.Error!Builder.Value { |
| 5488 | const un_op = self.air.instructions.items(.data)[@intFromEnum(inst)].un_op; | |
| 5488 | const un_op = self.air.instructions.items(.data)[@backingInt(inst)].un_op; | |
| 5489 | 5489 | const operand = try self.resolveInst(un_op); |
| 5490 | 5490 | const operand_ty = self.typeOf(un_op); |
| 5491 | 5491 | |
| ... | ... | @@ -5494,7 +5494,7 @@ fn airNeg(self: *FuncGen, inst: Air.Inst.Index, fast: Builder.FastMathKind) Allo |
| 5494 | 5494 | |
| 5495 | 5495 | fn airClzCtz(self: *FuncGen, inst: Air.Inst.Index, intrinsic: Builder.Intrinsic) Allocator.Error!Builder.Value { |
| 5496 | 5496 | const o = self.object; |
| 5497 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 5497 | const ty_op = self.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 5498 | 5498 | const inst_ty = self.typeOfIndex(inst); |
| 5499 | 5499 | const operand_ty = self.typeOf(ty_op.operand); |
| 5500 | 5500 | const operand = try self.resolveInst(ty_op.operand); |
| ... | ... | @@ -5512,7 +5512,7 @@ fn airClzCtz(self: *FuncGen, inst: Air.Inst.Index, intrinsic: Builder.Intrinsic) |
| 5512 | 5512 | |
| 5513 | 5513 | fn airBitOp(self: *FuncGen, inst: Air.Inst.Index, intrinsic: Builder.Intrinsic) Allocator.Error!Builder.Value { |
| 5514 | 5514 | const o = self.object; |
| 5515 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 5515 | const ty_op = self.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 5516 | 5516 | const inst_ty = self.typeOfIndex(inst); |
| 5517 | 5517 | const operand_ty = self.typeOf(ty_op.operand); |
| 5518 | 5518 | const operand = try self.resolveInst(ty_op.operand); |
| ... | ... | @@ -5531,7 +5531,7 @@ fn airBitOp(self: *FuncGen, inst: Air.Inst.Index, intrinsic: Builder.Intrinsic) |
| 5531 | 5531 | fn airByteSwap(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 5532 | 5532 | const o = self.object; |
| 5533 | 5533 | const zcu = o.zcu; |
| 5534 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 5534 | const ty_op = self.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 5535 | 5535 | const operand_ty = self.typeOf(ty_op.operand); |
| 5536 | 5536 | var bits = operand_ty.intInfo(zcu).bits; |
| 5537 | 5537 | assert(bits % 8 == 0); |
| ... | ... | @@ -5566,7 +5566,7 @@ fn airErrorSetHasValue(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Bui |
| 5566 | 5566 | const o = self.object; |
| 5567 | 5567 | const zcu = o.zcu; |
| 5568 | 5568 | const ip = &zcu.intern_pool; |
| 5569 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 5569 | const ty_op = self.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 5570 | 5570 | const operand = try self.resolveInst(ty_op.operand); |
| 5571 | 5571 | const error_set_ty = ty_op.ty.toType(); |
| 5572 | 5572 | |
| ... | ... | @@ -5596,7 +5596,7 @@ fn airErrorSetHasValue(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Bui |
| 5596 | 5596 | |
| 5597 | 5597 | fn airIsNamedEnumValue(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 5598 | 5598 | const o = self.object; |
| 5599 | const un_op = self.air.instructions.items(.data)[@intFromEnum(inst)].un_op; | |
| 5599 | const un_op = self.air.instructions.items(.data)[@backingInt(inst)].un_op; | |
| 5600 | 5600 | const operand = try self.resolveInst(un_op); |
| 5601 | 5601 | const enum_ty = self.typeOf(un_op); |
| 5602 | 5602 | |
| ... | ... | @@ -5614,7 +5614,7 @@ fn airIsNamedEnumValue(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Bui |
| 5614 | 5614 | |
| 5615 | 5615 | fn airTagName(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 5616 | 5616 | const o = self.object; |
| 5617 | const un_op = self.air.instructions.items(.data)[@intFromEnum(inst)].un_op; | |
| 5617 | const un_op = self.air.instructions.items(.data)[@backingInt(inst)].un_op; | |
| 5618 | 5618 | const operand = try self.resolveInst(un_op); |
| 5619 | 5619 | const enum_ty = self.typeOf(un_op); |
| 5620 | 5620 | |
| ... | ... | @@ -5633,7 +5633,7 @@ fn airTagName(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Valu |
| 5633 | 5633 | fn airErrorName(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 5634 | 5634 | const o = self.object; |
| 5635 | 5635 | const zcu = o.zcu; |
| 5636 | const un_op = self.air.instructions.items(.data)[@intFromEnum(inst)].un_op; | |
| 5636 | const un_op = self.air.instructions.items(.data)[@backingInt(inst)].un_op; | |
| 5637 | 5637 | const operand = try self.resolveInst(un_op); |
| 5638 | 5638 | const slice_ty = self.typeOfIndex(inst); |
| 5639 | 5639 | |
| ... | ... | @@ -5646,14 +5646,14 @@ fn airErrorName(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Va |
| 5646 | 5646 | } |
| 5647 | 5647 | |
| 5648 | 5648 | fn airSplat(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 5649 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 5649 | const ty_op = self.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 5650 | 5650 | const scalar = try self.resolveInst(ty_op.operand); |
| 5651 | 5651 | const vector_ty = self.typeOfIndex(inst); |
| 5652 | 5652 | return self.wip.splatVector(try self.object.lowerType(vector_ty, .by_value), scalar, ""); |
| 5653 | 5653 | } |
| 5654 | 5654 | |
| 5655 | 5655 | fn airSelect(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 5656 | const pl_op = self.air.instructions.items(.data)[@intFromEnum(inst)].pl_op; | |
| 5656 | const pl_op = self.air.instructions.items(.data)[@backingInt(inst)].pl_op; | |
| 5657 | 5657 | const extra = self.air.extraData(Air.Bin, pl_op.payload).data; |
| 5658 | 5658 | const pred = try self.resolveInst(pl_op.operand); |
| 5659 | 5659 | const a = try self.resolveInst(extra.lhs); |
| ... | ... | @@ -5921,7 +5921,7 @@ fn airReduce(self: *FuncGen, inst: Air.Inst.Index, fast: Builder.FastMathKind) A |
| 5921 | 5921 | const zcu = o.zcu; |
| 5922 | 5922 | const target = zcu.getTarget(); |
| 5923 | 5923 | |
| 5924 | const reduce = self.air.instructions.items(.data)[@intFromEnum(inst)].reduce; | |
| 5924 | const reduce = self.air.instructions.items(.data)[@backingInt(inst)].reduce; | |
| 5925 | 5925 | const operand = try self.resolveInst(reduce.operand); |
| 5926 | 5926 | const operand_ty = self.typeOf(reduce.operand); |
| 5927 | 5927 | const llvm_operand_ty = try o.lowerType(operand_ty, .by_value); |
| ... | ... | @@ -6029,7 +6029,7 @@ fn airAggregateInit(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builde |
| 6029 | 6029 | const o = self.object; |
| 6030 | 6030 | const zcu = o.zcu; |
| 6031 | 6031 | const ip = &zcu.intern_pool; |
| 6032 | const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | |
| 6032 | const ty_pl = self.air.instructions.items(.data)[@backingInt(inst)].ty_pl; | |
| 6033 | 6033 | const result_ty = self.typeOfIndex(inst); |
| 6034 | 6034 | const len: usize = @intCast(result_ty.arrayLen(zcu)); |
| 6035 | 6035 | const elements: []const Air.Inst.Ref = @ptrCast(self.air.extra.items[ty_pl.payload..][0..len]); |
| ... | ... | @@ -6126,7 +6126,7 @@ fn airUnionInit(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Va |
| 6126 | 6126 | const o = self.object; |
| 6127 | 6127 | const zcu = o.zcu; |
| 6128 | 6128 | const ip = &zcu.intern_pool; |
| 6129 | const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | |
| 6129 | const ty_pl = self.air.instructions.items(.data)[@backingInt(inst)].ty_pl; | |
| 6130 | 6130 | const extra = self.air.extraData(Air.UnionInit, ty_pl.payload).data; |
| 6131 | 6131 | const union_ty = self.typeOfIndex(inst); |
| 6132 | 6132 | const union_obj = zcu.typeToUnion(union_ty).?; |
| ... | ... | @@ -6167,16 +6167,16 @@ fn airUnionInit(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Va |
| 6167 | 6167 | |
| 6168 | 6168 | fn airPrefetch(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 6169 | 6169 | const o = self.object; |
| 6170 | const prefetch = self.air.instructions.items(.data)[@intFromEnum(inst)].prefetch; | |
| 6170 | const prefetch = self.air.instructions.items(.data)[@backingInt(inst)].prefetch; | |
| 6171 | 6171 | |
| 6172 | comptime assert(@intFromEnum(std.lang.PrefetchOptions.Rw.read) == 0); | |
| 6173 | comptime assert(@intFromEnum(std.lang.PrefetchOptions.Rw.write) == 1); | |
| 6172 | comptime assert(@backingInt(std.lang.PrefetchOptions.Rw.read) == 0); | |
| 6173 | comptime assert(@backingInt(std.lang.PrefetchOptions.Rw.write) == 1); | |
| 6174 | 6174 | |
| 6175 | 6175 | comptime assert(prefetch.locality >= 0); |
| 6176 | 6176 | comptime assert(prefetch.locality <= 3); |
| 6177 | 6177 | |
| 6178 | comptime assert(@intFromEnum(std.lang.PrefetchOptions.Cache.instruction) == 0); | |
| 6179 | comptime assert(@intFromEnum(std.lang.PrefetchOptions.Cache.data) == 1); | |
| 6178 | comptime assert(@backingInt(std.lang.PrefetchOptions.Cache.instruction) == 0); | |
| 6179 | comptime assert(@backingInt(std.lang.PrefetchOptions.Cache.data) == 1); | |
| 6180 | 6180 | |
| 6181 | 6181 | // LLVM fails during codegen of instruction cache prefetchs for these architectures. |
| 6182 | 6182 | // This is an LLVM bug as the prefetch intrinsic should be a noop if not supported |
| ... | ... | @@ -6215,7 +6215,7 @@ fn airPrefetch(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Val |
| 6215 | 6215 | } |
| 6216 | 6216 | |
| 6217 | 6217 | fn airAddrSpaceCast(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 6218 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 6218 | const ty_op = self.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 6219 | 6219 | const inst_ty = self.typeOfIndex(inst); |
| 6220 | 6220 | const operand = try self.resolveInst(ty_op.operand); |
| 6221 | 6221 | return self.wip.cast(.addrspacecast, operand, try self.object.lowerType(inst_ty, .by_value), ""); |
| ... | ... | @@ -6238,7 +6238,7 @@ fn workIntrinsic( |
| 6238 | 6238 | fn airWorkItemId(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 6239 | 6239 | const target = self.object.zcu.getTarget(); |
| 6240 | 6240 | |
| 6241 | const pl_op = self.air.instructions.items(.data)[@intFromEnum(inst)].pl_op; | |
| 6241 | const pl_op = self.air.instructions.items(.data)[@backingInt(inst)].pl_op; | |
| 6242 | 6242 | const dimension = pl_op.payload; |
| 6243 | 6243 | |
| 6244 | 6244 | return switch (target.cpu.arch) { |
| ... | ... | @@ -6251,7 +6251,7 @@ fn airWorkItemId(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.V |
| 6251 | 6251 | fn airWorkGroupSize(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 6252 | 6252 | const target = self.object.zcu.getTarget(); |
| 6253 | 6253 | |
| 6254 | const pl_op = self.air.instructions.items(.data)[@intFromEnum(inst)].pl_op; | |
| 6254 | const pl_op = self.air.instructions.items(.data)[@backingInt(inst)].pl_op; | |
| 6255 | 6255 | const dimension = pl_op.payload; |
| 6256 | 6256 | |
| 6257 | 6257 | switch (target.cpu.arch) { |
| ... | ... | @@ -6278,7 +6278,7 @@ fn airWorkGroupSize(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builde |
| 6278 | 6278 | fn airWorkGroupId(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 6279 | 6279 | const target = self.object.zcu.getTarget(); |
| 6280 | 6280 | |
| 6281 | const pl_op = self.air.instructions.items(.data)[@intFromEnum(inst)].pl_op; | |
| 6281 | const pl_op = self.air.instructions.items(.data)[@backingInt(inst)].pl_op; | |
| 6282 | 6282 | const dimension = pl_op.payload; |
| 6283 | 6283 | |
| 6284 | 6284 | return switch (target.cpu.arch) { |
src/codegen/llvm/bindings.zig+1-1| ... | ... | @@ -5,7 +5,7 @@ pub const Bool = enum(c_int) { |
| 5 | 5 | _, |
| 6 | 6 | |
| 7 | 7 | pub fn fromBool(b: bool) Bool { |
| 8 | return @as(Bool, @enumFromInt(@intFromBool(b))); | |
| 8 | return @as(Bool, @fromBackingInt(@intCast(@intFromBool(b)))); | |
| 9 | 9 | } |
| 10 | 10 | |
| 11 | 11 | pub fn toBool(b: Bool) bool { |
src/codegen/riscv64/CodeGen.zig+130-130| ... | ... | @@ -798,11 +798,11 @@ pub fn generate( |
| 798 | 798 | |
| 799 | 799 | try function.frame_allocs.resize(gpa, FrameIndex.named_count); |
| 800 | 800 | function.frame_allocs.set( |
| 801 | @intFromEnum(FrameIndex.stack_frame), | |
| 801 | @backingInt(FrameIndex.stack_frame), | |
| 802 | 802 | FrameAlloc.init(.{ .size = 0, .alignment = .@"1" }), |
| 803 | 803 | ); |
| 804 | 804 | function.frame_allocs.set( |
| 805 | @intFromEnum(FrameIndex.call_frame), | |
| 805 | @backingInt(FrameIndex.call_frame), | |
| 806 | 806 | FrameAlloc.init(.{ .size = 0, .alignment = .@"1" }), |
| 807 | 807 | ); |
| 808 | 808 | |
| ... | ... | @@ -813,22 +813,22 @@ pub fn generate( |
| 813 | 813 | |
| 814 | 814 | function.args = call_info.args; |
| 815 | 815 | function.ret_mcv = call_info.return_value; |
| 816 | function.frame_allocs.set(@intFromEnum(FrameIndex.ret_addr), FrameAlloc.init(.{ | |
| 816 | function.frame_allocs.set(@backingInt(FrameIndex.ret_addr), FrameAlloc.init(.{ | |
| 817 | 817 | .size = Type.u64.abiSize(zcu), |
| 818 | 818 | .alignment = Type.u64.abiAlignment(zcu).min(call_info.stack_align), |
| 819 | 819 | })); |
| 820 | function.frame_allocs.set(@intFromEnum(FrameIndex.base_ptr), FrameAlloc.init(.{ | |
| 820 | function.frame_allocs.set(@backingInt(FrameIndex.base_ptr), FrameAlloc.init(.{ | |
| 821 | 821 | .size = Type.u64.abiSize(zcu), |
| 822 | 822 | .alignment = Alignment.min( |
| 823 | 823 | call_info.stack_align, |
| 824 | 824 | Alignment.fromNonzeroByteUnits(function.target.stackAlignment()), |
| 825 | 825 | ), |
| 826 | 826 | })); |
| 827 | function.frame_allocs.set(@intFromEnum(FrameIndex.args_frame), FrameAlloc.init(.{ | |
| 827 | function.frame_allocs.set(@backingInt(FrameIndex.args_frame), FrameAlloc.init(.{ | |
| 828 | 828 | .size = call_info.stack_byte_count, |
| 829 | 829 | .alignment = call_info.stack_align, |
| 830 | 830 | })); |
| 831 | function.frame_allocs.set(@intFromEnum(FrameIndex.spill_frame), FrameAlloc.init(.{ | |
| 831 | function.frame_allocs.set(@backingInt(FrameIndex.spill_frame), FrameAlloc.init(.{ | |
| 832 | 832 | .size = 0, |
| 833 | 833 | .alignment = Type.u64.abiAlignment(zcu), |
| 834 | 834 | })); |
| ... | ... | @@ -1080,7 +1080,7 @@ fn setVl(func: *Func, dst_reg: Register, avl: u64, options: bits.VType) !void { |
| 1080 | 1080 | .data = .{ |
| 1081 | 1081 | .i_type = .{ |
| 1082 | 1082 | .rd = dst_reg, |
| 1083 | .rs1 = @enumFromInt(avl), | |
| 1083 | .rs1 = @fromBackingInt(@intCast(avl)), | |
| 1084 | 1084 | .imm12 = Immediate.u(options_int), |
| 1085 | 1085 | }, |
| 1086 | 1086 | }, |
| ... | ... | @@ -1297,7 +1297,7 @@ fn genLazy(func: *Func, lazy_sym: link.File.LazySymbol) InnerError!void { |
| 1297 | 1297 | }) catch |err| |
| 1298 | 1298 | return func.fail("{s} creating lazy symbol", .{@errorName(err)}); |
| 1299 | 1299 | |
| 1300 | try func.genSetReg(Type.u64, data_reg, .{ .lea_symbol = .{ .sym = @enumFromInt(sym_index) } }); | |
| 1300 | try func.genSetReg(Type.u64, data_reg, .{ .lea_symbol = .{ .sym = @fromBackingInt(@intCast(sym_index)) } }); | |
| 1301 | 1301 | |
| 1302 | 1302 | const cmp_reg, const cmp_lock = try func.allocReg(.int); |
| 1303 | 1303 | defer func.register_manager.unlockReg(cmp_lock); |
| ... | ... | @@ -1381,7 +1381,7 @@ fn genBody(func: *Func, body: []const Air.Inst.Index) InnerError!void { |
| 1381 | 1381 | |
| 1382 | 1382 | func.reused_operands = @TypeOf(func.reused_operands).empty; |
| 1383 | 1383 | try func.inst_tracking.ensureUnusedCapacity(func.gpa, 1); |
| 1384 | const tag = air_tags[@intFromEnum(inst)]; | |
| 1384 | const tag = air_tags[@backingInt(inst)]; | |
| 1385 | 1385 | switch (tag) { |
| 1386 | 1386 | // zig fmt: off |
| 1387 | 1387 | |
| ... | ... | @@ -1661,7 +1661,7 @@ fn genBody(func: *Func, body: []const Air.Inst.Index) InnerError!void { |
| 1661 | 1661 | |
| 1662 | 1662 | if (std.debug.runtime_safety) { |
| 1663 | 1663 | if (func.air_bookkeeping < old_air_bookkeeping + 1) { |
| 1664 | std.debug.panic("in codegen.zig, handling of AIR instruction %{d} ('{}') did not do proper bookkeeping. Look for a missing call to finishAir.", .{ inst, air_tags[@intFromEnum(inst)] }); | |
| 1664 | std.debug.panic("in codegen.zig, handling of AIR instruction %{d} ('{}') did not do proper bookkeeping. Look for a missing call to finishAir.", .{ inst, air_tags[@backingInt(inst)] }); | |
| 1665 | 1665 | } |
| 1666 | 1666 | |
| 1667 | 1667 | { // check consistency of tracked registers |
| ... | ... | @@ -1768,7 +1768,7 @@ fn setFrameLoc( |
| 1768 | 1768 | offset: *i32, |
| 1769 | 1769 | comptime aligned: bool, |
| 1770 | 1770 | ) void { |
| 1771 | const frame_i = @intFromEnum(frame_index); | |
| 1771 | const frame_i = @backingInt(frame_index); | |
| 1772 | 1772 | if (aligned) { |
| 1773 | 1773 | const alignment: InternPool.Alignment = func.frame_allocs.items(.abi_align)[frame_i]; |
| 1774 | 1774 | offset.* = math.sign(offset.*) * @as(i32, @intCast(alignment.backward(@intCast(@abs(offset.*))))); |
| ... | ... | @@ -1787,13 +1787,13 @@ fn computeFrameLayout(func: *Func) !FrameLayout { |
| 1787 | 1787 | const frame_align = func.frame_allocs.items(.abi_align); |
| 1788 | 1788 | |
| 1789 | 1789 | for (stack_frame_order, FrameIndex.named_count..) |*frame_order, frame_index| |
| 1790 | frame_order.* = @enumFromInt(frame_index); | |
| 1790 | frame_order.* = @fromBackingInt(@intCast(frame_index)); | |
| 1791 | 1791 | |
| 1792 | 1792 | { |
| 1793 | 1793 | const SortContext = struct { |
| 1794 | 1794 | frame_align: @TypeOf(frame_align), |
| 1795 | 1795 | pub fn lessThan(context: @This(), lhs: FrameIndex, rhs: FrameIndex) bool { |
| 1796 | return context.frame_align[@intFromEnum(lhs)].compare(.gt, context.frame_align[@intFromEnum(rhs)]); | |
| 1796 | return context.frame_align[@backingInt(lhs)].compare(.gt, context.frame_align[@backingInt(rhs)]); | |
| 1797 | 1797 | } |
| 1798 | 1798 | }; |
| 1799 | 1799 | const sort_context = SortContext{ .frame_align = frame_align }; |
| ... | ... | @@ -1810,38 +1810,38 @@ fn computeFrameLayout(func: *Func) !FrameLayout { |
| 1810 | 1810 | const total_alloc_size: i32 = blk: { |
| 1811 | 1811 | var i: i32 = 0; |
| 1812 | 1812 | for (stack_frame_order) |frame_index| { |
| 1813 | i += frame_size[@intFromEnum(frame_index)]; | |
| 1813 | i += frame_size[@backingInt(frame_index)]; | |
| 1814 | 1814 | } |
| 1815 | 1815 | break :blk i; |
| 1816 | 1816 | }; |
| 1817 | 1817 | |
| 1818 | 1818 | const saved_reg_size = save_reg_list.size(); |
| 1819 | frame_size[@intFromEnum(FrameIndex.spill_frame)] = @intCast(saved_reg_size); | |
| 1819 | frame_size[@backingInt(FrameIndex.spill_frame)] = @intCast(saved_reg_size); | |
| 1820 | 1820 | |
| 1821 | 1821 | // The total frame size is calculated by the amount of s registers you need to save * 8, as each |
| 1822 | 1822 | // register is 8 bytes, the total allocation sizes, and 16 more register for the spilled ra and s0 |
| 1823 | 1823 | // register. Finally we align the frame size to the alignment of the base pointer. |
| 1824 | const args_frame_size = frame_size[@intFromEnum(FrameIndex.args_frame)]; | |
| 1825 | const spill_frame_size = frame_size[@intFromEnum(FrameIndex.spill_frame)]; | |
| 1826 | const call_frame_size = frame_size[@intFromEnum(FrameIndex.call_frame)]; | |
| 1824 | const args_frame_size = frame_size[@backingInt(FrameIndex.args_frame)]; | |
| 1825 | const spill_frame_size = frame_size[@backingInt(FrameIndex.spill_frame)]; | |
| 1826 | const call_frame_size = frame_size[@backingInt(FrameIndex.call_frame)]; | |
| 1827 | 1827 | |
| 1828 | 1828 | // TODO: this 64 should be a 16, but we were clobbering the top and bottom of the frame. |
| 1829 | 1829 | // maybe everything can go from the bottom? |
| 1830 | 1830 | const acc_frame_size: i32 = std.mem.alignForward( |
| 1831 | 1831 | i32, |
| 1832 | 1832 | total_alloc_size + 64 + args_frame_size + spill_frame_size + call_frame_size, |
| 1833 | @intCast(frame_align[@intFromEnum(FrameIndex.base_ptr)].toByteUnits().?), | |
| 1833 | @intCast(frame_align[@backingInt(FrameIndex.base_ptr)].toByteUnits().?), | |
| 1834 | 1834 | ); |
| 1835 | 1835 | log.debug("frame size: {d}", .{acc_frame_size}); |
| 1836 | 1836 | |
| 1837 | 1837 | // store the ra at total_size - 8, so it's the very first thing in the stack |
| 1838 | 1838 | // relative to the fp |
| 1839 | 1839 | func.frame_locs.set( |
| 1840 | @intFromEnum(FrameIndex.ret_addr), | |
| 1840 | @backingInt(FrameIndex.ret_addr), | |
| 1841 | 1841 | .{ .base = .sp, .disp = acc_frame_size - 8 }, |
| 1842 | 1842 | ); |
| 1843 | 1843 | func.frame_locs.set( |
| 1844 | @intFromEnum(FrameIndex.base_ptr), | |
| 1844 | @backingInt(FrameIndex.base_ptr), | |
| 1845 | 1845 | .{ .base = .sp, .disp = acc_frame_size - 16 }, |
| 1846 | 1846 | ); |
| 1847 | 1847 | |
| ... | ... | @@ -1983,19 +1983,19 @@ fn allocFrameIndex(func: *Func, alloc: FrameAlloc) !FrameIndex { |
| 1983 | 1983 | const frame_size = frame_allocs_slice.items(.abi_size); |
| 1984 | 1984 | const frame_align = frame_allocs_slice.items(.abi_align); |
| 1985 | 1985 | |
| 1986 | const stack_frame_align = &frame_align[@intFromEnum(FrameIndex.stack_frame)]; | |
| 1986 | const stack_frame_align = &frame_align[@backingInt(FrameIndex.stack_frame)]; | |
| 1987 | 1987 | stack_frame_align.* = stack_frame_align.max(alloc.abi_align); |
| 1988 | 1988 | |
| 1989 | 1989 | for (func.free_frame_indices.keys(), 0..) |frame_index, free_i| { |
| 1990 | const abi_size = frame_size[@intFromEnum(frame_index)]; | |
| 1990 | const abi_size = frame_size[@backingInt(frame_index)]; | |
| 1991 | 1991 | if (abi_size != alloc.abi_size) continue; |
| 1992 | const abi_align = &frame_align[@intFromEnum(frame_index)]; | |
| 1992 | const abi_align = &frame_align[@backingInt(frame_index)]; | |
| 1993 | 1993 | abi_align.* = abi_align.max(alloc.abi_align); |
| 1994 | 1994 | |
| 1995 | 1995 | _ = func.free_frame_indices.swapRemoveAt(free_i); |
| 1996 | 1996 | return frame_index; |
| 1997 | 1997 | } |
| 1998 | const frame_index: FrameIndex = @enumFromInt(func.frame_allocs.len); | |
| 1998 | const frame_index: FrameIndex = @fromBackingInt(@intCast(func.frame_allocs.len)); | |
| 1999 | 1999 | try func.frame_allocs.append(func.gpa, alloc); |
| 2000 | 2000 | log.debug("allocated frame {}", .{frame_index}); |
| 2001 | 2001 | return frame_index; |
| ... | ... | @@ -2186,13 +2186,13 @@ fn airRetPtr(func: *Func, inst: Air.Inst.Index) !void { |
| 2186 | 2186 | } |
| 2187 | 2187 | |
| 2188 | 2188 | fn airFptrunc(func: *Func, inst: Air.Inst.Index) !void { |
| 2189 | const ty_op = func.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 2189 | const ty_op = func.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 2190 | 2190 | const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else return func.fail("TODO implement airFptrunc for {}", .{func.target.cpu.arch}); |
| 2191 | 2191 | return func.finishAir(inst, result, .{ ty_op.operand, .none, .none }); |
| 2192 | 2192 | } |
| 2193 | 2193 | |
| 2194 | 2194 | fn airFpext(func: *Func, inst: Air.Inst.Index) !void { |
| 2195 | const ty_op = func.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 2195 | const ty_op = func.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 2196 | 2196 | const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else return func.fail("TODO implement airFpext for {}", .{func.target.cpu.arch}); |
| 2197 | 2197 | return func.finishAir(inst, result, .{ ty_op.operand, .none, .none }); |
| 2198 | 2198 | } |
| ... | ... | @@ -2200,7 +2200,7 @@ fn airFpext(func: *Func, inst: Air.Inst.Index) !void { |
| 2200 | 2200 | fn airIntCast(func: *Func, inst: Air.Inst.Index) !void { |
| 2201 | 2201 | const pt = func.pt; |
| 2202 | 2202 | const zcu = pt.zcu; |
| 2203 | const ty_op = func.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 2203 | const ty_op = func.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 2204 | 2204 | const src_ty = func.typeOf(ty_op.operand); |
| 2205 | 2205 | const dst_ty = func.typeOfIndex(inst); |
| 2206 | 2206 | |
| ... | ... | @@ -2241,7 +2241,7 @@ fn airIntCast(func: *Func, inst: Air.Inst.Index) !void { |
| 2241 | 2241 | } |
| 2242 | 2242 | |
| 2243 | 2243 | fn airTrunc(func: *Func, inst: Air.Inst.Index) !void { |
| 2244 | const ty_op = func.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 2244 | const ty_op = func.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 2245 | 2245 | if (func.liveness.isUnused(inst)) |
| 2246 | 2246 | return func.finishAir(inst, .unreach, .{ ty_op.operand, .none, .none }); |
| 2247 | 2247 | // we assume no zeroext in the "Zig ABI", so it's fine to just not truncate it. |
| ... | ... | @@ -2257,7 +2257,7 @@ fn airTrunc(func: *Func, inst: Air.Inst.Index) !void { |
| 2257 | 2257 | } |
| 2258 | 2258 | |
| 2259 | 2259 | fn airNot(func: *Func, inst: Air.Inst.Index) !void { |
| 2260 | const ty_op = func.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 2260 | const ty_op = func.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 2261 | 2261 | const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else result: { |
| 2262 | 2262 | const pt = func.pt; |
| 2263 | 2263 | const zcu = pt.zcu; |
| ... | ... | @@ -2319,7 +2319,7 @@ fn airNot(func: *Func, inst: Air.Inst.Index) !void { |
| 2319 | 2319 | fn airSlice(func: *Func, inst: Air.Inst.Index) !void { |
| 2320 | 2320 | const pt = func.pt; |
| 2321 | 2321 | const zcu = pt.zcu; |
| 2322 | const ty_pl = func.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | |
| 2322 | const ty_pl = func.air.instructions.items(.data)[@backingInt(inst)].ty_pl; | |
| 2323 | 2323 | const bin_op = func.air.extraData(Air.Bin, ty_pl.payload).data; |
| 2324 | 2324 | |
| 2325 | 2325 | const slice_ty = func.typeOfIndex(inst); |
| ... | ... | @@ -2343,7 +2343,7 @@ fn airSlice(func: *Func, inst: Air.Inst.Index) !void { |
| 2343 | 2343 | fn airBinOp(func: *Func, inst: Air.Inst.Index, tag: Air.Inst.Tag) !void { |
| 2344 | 2344 | const pt = func.pt; |
| 2345 | 2345 | const zcu = pt.zcu; |
| 2346 | const bin_op = func.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 2346 | const bin_op = func.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 2347 | 2347 | const dst_mcv = try func.binOp(inst, tag, bin_op.lhs, bin_op.rhs); |
| 2348 | 2348 | |
| 2349 | 2349 | const dst_ty = func.typeOfIndex(inst); |
| ... | ... | @@ -2873,7 +2873,7 @@ fn genBinOp( |
| 2873 | 2873 | } |
| 2874 | 2874 | |
| 2875 | 2875 | fn airPtrArithmetic(func: *Func, inst: Air.Inst.Index, tag: Air.Inst.Tag) !void { |
| 2876 | const ty_pl = func.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | |
| 2876 | const ty_pl = func.air.instructions.items(.data)[@backingInt(inst)].ty_pl; | |
| 2877 | 2877 | const bin_op = func.air.extraData(Air.Bin, ty_pl.payload).data; |
| 2878 | 2878 | const dst_mcv = try func.binOp(inst, tag, bin_op.lhs, bin_op.rhs); |
| 2879 | 2879 | return func.finishAir(inst, dst_mcv, .{ bin_op.lhs, bin_op.rhs, .none }); |
| ... | ... | @@ -2882,7 +2882,7 @@ fn airPtrArithmetic(func: *Func, inst: Air.Inst.Index, tag: Air.Inst.Tag) !void |
| 2882 | 2882 | fn airAddWithOverflow(func: *Func, inst: Air.Inst.Index) !void { |
| 2883 | 2883 | const pt = func.pt; |
| 2884 | 2884 | const zcu = pt.zcu; |
| 2885 | const ty_pl = func.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | |
| 2885 | const ty_pl = func.air.instructions.items(.data)[@backingInt(inst)].ty_pl; | |
| 2886 | 2886 | const extra = func.air.extraData(Air.Bin, ty_pl.payload).data; |
| 2887 | 2887 | |
| 2888 | 2888 | const rhs_ty = func.typeOf(extra.rhs); |
| ... | ... | @@ -3010,7 +3010,7 @@ fn airAddWithOverflow(func: *Func, inst: Air.Inst.Index) !void { |
| 3010 | 3010 | fn airSubWithOverflow(func: *Func, inst: Air.Inst.Index) !void { |
| 3011 | 3011 | const pt = func.pt; |
| 3012 | 3012 | const zcu = pt.zcu; |
| 3013 | const ty_pl = func.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | |
| 3013 | const ty_pl = func.air.instructions.items(.data)[@backingInt(inst)].ty_pl; | |
| 3014 | 3014 | const extra = func.air.extraData(Air.Bin, ty_pl.payload).data; |
| 3015 | 3015 | |
| 3016 | 3016 | const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else result: { |
| ... | ... | @@ -3135,7 +3135,7 @@ fn airSubWithOverflow(func: *Func, inst: Air.Inst.Index) !void { |
| 3135 | 3135 | fn airMulWithOverflow(func: *Func, inst: Air.Inst.Index) !void { |
| 3136 | 3136 | const pt = func.pt; |
| 3137 | 3137 | const zcu = pt.zcu; |
| 3138 | const ty_pl = func.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | |
| 3138 | const ty_pl = func.air.instructions.items(.data)[@backingInt(inst)].ty_pl; | |
| 3139 | 3139 | const extra = func.air.extraData(Air.Bin, ty_pl.payload).data; |
| 3140 | 3140 | |
| 3141 | 3141 | const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else result: { |
| ... | ... | @@ -3210,7 +3210,7 @@ fn airMulWithOverflow(func: *Func, inst: Air.Inst.Index) !void { |
| 3210 | 3210 | |
| 3211 | 3211 | fn airShlWithOverflow(func: *Func, inst: Air.Inst.Index) !void { |
| 3212 | 3212 | const zcu = func.pt.zcu; |
| 3213 | const bin_op = func.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 3213 | const bin_op = func.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 3214 | 3214 | const result: MCValue = if (func.liveness.isUnused(inst)) |
| 3215 | 3215 | .unreach |
| 3216 | 3216 | else if (func.typeOf(bin_op.lhs).isVector(zcu) and !func.typeOf(bin_op.rhs).isVector(zcu)) |
| ... | ... | @@ -3221,20 +3221,20 @@ fn airShlWithOverflow(func: *Func, inst: Air.Inst.Index) !void { |
| 3221 | 3221 | } |
| 3222 | 3222 | |
| 3223 | 3223 | fn airSubSat(func: *Func, inst: Air.Inst.Index) !void { |
| 3224 | const bin_op = func.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 3224 | const bin_op = func.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 3225 | 3225 | const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else return func.fail("TODO implement airSubSat", .{}); |
| 3226 | 3226 | return func.finishAir(inst, result, .{ bin_op.lhs, bin_op.rhs, .none }); |
| 3227 | 3227 | } |
| 3228 | 3228 | |
| 3229 | 3229 | fn airMulSat(func: *Func, inst: Air.Inst.Index) !void { |
| 3230 | const bin_op = func.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 3230 | const bin_op = func.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 3231 | 3231 | const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else return func.fail("TODO implement airMulSat", .{}); |
| 3232 | 3232 | return func.finishAir(inst, result, .{ bin_op.lhs, bin_op.rhs, .none }); |
| 3233 | 3233 | } |
| 3234 | 3234 | |
| 3235 | 3235 | fn airShlSat(func: *Func, inst: Air.Inst.Index) !void { |
| 3236 | 3236 | const zcu = func.pt.zcu; |
| 3237 | const bin_op = func.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 3237 | const bin_op = func.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 3238 | 3238 | const result: MCValue = if (func.liveness.isUnused(inst)) |
| 3239 | 3239 | .unreach |
| 3240 | 3240 | else if (func.typeOf(bin_op.lhs).isVector(zcu) and !func.typeOf(bin_op.rhs).isVector(zcu)) |
| ... | ... | @@ -3246,7 +3246,7 @@ fn airShlSat(func: *Func, inst: Air.Inst.Index) !void { |
| 3246 | 3246 | |
| 3247 | 3247 | fn airOptionalPayload(func: *Func, inst: Air.Inst.Index) !void { |
| 3248 | 3248 | const zcu = func.pt.zcu; |
| 3249 | const ty_op = func.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 3249 | const ty_op = func.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 3250 | 3250 | const result: MCValue = result: { |
| 3251 | 3251 | const pl_ty = func.typeOfIndex(inst); |
| 3252 | 3252 | if (!pl_ty.hasRuntimeBits(zcu)) break :result .none; |
| ... | ... | @@ -3268,7 +3268,7 @@ fn airOptionalPayload(func: *Func, inst: Air.Inst.Index) !void { |
| 3268 | 3268 | } |
| 3269 | 3269 | |
| 3270 | 3270 | fn airOptionalPayloadPtr(func: *Func, inst: Air.Inst.Index) !void { |
| 3271 | const ty_op = func.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 3271 | const ty_op = func.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 3272 | 3272 | const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else return func.fail("TODO implement .optional_payload_ptr for {}", .{func.target.cpu.arch}); |
| 3273 | 3273 | return func.finishAir(inst, result, .{ ty_op.operand, .none, .none }); |
| 3274 | 3274 | } |
| ... | ... | @@ -3276,7 +3276,7 @@ fn airOptionalPayloadPtr(func: *Func, inst: Air.Inst.Index) !void { |
| 3276 | 3276 | fn airOptionalPayloadPtrSet(func: *Func, inst: Air.Inst.Index) !void { |
| 3277 | 3277 | const zcu = func.pt.zcu; |
| 3278 | 3278 | |
| 3279 | const ty_op = func.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 3279 | const ty_op = func.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 3280 | 3280 | const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else result: { |
| 3281 | 3281 | const dst_ty = func.typeOfIndex(inst); |
| 3282 | 3282 | const src_ty = func.typeOf(ty_op.operand); |
| ... | ... | @@ -3310,7 +3310,7 @@ fn airOptionalPayloadPtrSet(func: *Func, inst: Air.Inst.Index) !void { |
| 3310 | 3310 | } |
| 3311 | 3311 | |
| 3312 | 3312 | fn airUnwrapErrErr(func: *Func, inst: Air.Inst.Index) !void { |
| 3313 | const ty_op = func.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 3313 | const ty_op = func.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 3314 | 3314 | const pt = func.pt; |
| 3315 | 3315 | const zcu = pt.zcu; |
| 3316 | 3316 | const err_union_ty = func.typeOf(ty_op.operand); |
| ... | ... | @@ -3359,7 +3359,7 @@ fn airUnwrapErrErr(func: *Func, inst: Air.Inst.Index) !void { |
| 3359 | 3359 | } |
| 3360 | 3360 | |
| 3361 | 3361 | fn airUnwrapErrPayload(func: *Func, inst: Air.Inst.Index) !void { |
| 3362 | const ty_op = func.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 3362 | const ty_op = func.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 3363 | 3363 | const operand_ty = func.typeOf(ty_op.operand); |
| 3364 | 3364 | const operand = try func.resolveInst(ty_op.operand); |
| 3365 | 3365 | const result = try func.genUnwrapErrUnionPayloadMir(operand_ty, operand); |
| ... | ... | @@ -3410,21 +3410,21 @@ fn genUnwrapErrUnionPayloadMir( |
| 3410 | 3410 | |
| 3411 | 3411 | // *(E!T) -> E |
| 3412 | 3412 | fn airUnwrapErrErrPtr(func: *Func, inst: Air.Inst.Index) !void { |
| 3413 | const ty_op = func.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 3413 | const ty_op = func.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 3414 | 3414 | const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else return func.fail("TODO implement unwrap error union error ptr for {}", .{func.target.cpu.arch}); |
| 3415 | 3415 | return func.finishAir(inst, result, .{ ty_op.operand, .none, .none }); |
| 3416 | 3416 | } |
| 3417 | 3417 | |
| 3418 | 3418 | // *(E!T) -> *T |
| 3419 | 3419 | fn airUnwrapErrPayloadPtr(func: *Func, inst: Air.Inst.Index) !void { |
| 3420 | const ty_op = func.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 3420 | const ty_op = func.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 3421 | 3421 | const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else return func.fail("TODO implement unwrap error union payload ptr for {}", .{func.target.cpu.arch}); |
| 3422 | 3422 | return func.finishAir(inst, result, .{ ty_op.operand, .none, .none }); |
| 3423 | 3423 | } |
| 3424 | 3424 | |
| 3425 | 3425 | // *(E!T) => *T |
| 3426 | 3426 | fn airErrUnionPayloadPtrSet(func: *Func, inst: Air.Inst.Index) !void { |
| 3427 | const ty_op = func.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 3427 | const ty_op = func.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 3428 | 3428 | const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else result: { |
| 3429 | 3429 | const zcu = func.pt.zcu; |
| 3430 | 3430 | const src_ty = func.typeOf(ty_op.operand); |
| ... | ... | @@ -3488,7 +3488,7 @@ fn airSaveErrReturnTraceIndex(func: *Func, inst: Air.Inst.Index) !void { |
| 3488 | 3488 | fn airWrapOptional(func: *Func, inst: Air.Inst.Index) !void { |
| 3489 | 3489 | const pt = func.pt; |
| 3490 | 3490 | const zcu = pt.zcu; |
| 3491 | const ty_op = func.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 3491 | const ty_op = func.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 3492 | 3492 | const result: MCValue = result: { |
| 3493 | 3493 | const pl_ty = func.typeOf(ty_op.operand); |
| 3494 | 3494 | if (!pl_ty.hasRuntimeBits(zcu)) break :result .{ .immediate = 1 }; |
| ... | ... | @@ -3531,7 +3531,7 @@ fn airWrapOptional(func: *Func, inst: Air.Inst.Index) !void { |
| 3531 | 3531 | fn airWrapErrUnionPayload(func: *Func, inst: Air.Inst.Index) !void { |
| 3532 | 3532 | const pt = func.pt; |
| 3533 | 3533 | const zcu = pt.zcu; |
| 3534 | const ty_op = func.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 3534 | const ty_op = func.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 3535 | 3535 | |
| 3536 | 3536 | const eu_ty = ty_op.ty.toType(); |
| 3537 | 3537 | const pl_ty = eu_ty.errorUnionPayload(zcu); |
| ... | ... | @@ -3556,7 +3556,7 @@ fn airWrapErrUnionPayload(func: *Func, inst: Air.Inst.Index) !void { |
| 3556 | 3556 | fn airWrapErrUnionErr(func: *Func, inst: Air.Inst.Index) !void { |
| 3557 | 3557 | const pt = func.pt; |
| 3558 | 3558 | const zcu = pt.zcu; |
| 3559 | const ty_op = func.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 3559 | const ty_op = func.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 3560 | 3560 | |
| 3561 | 3561 | const eu_ty = ty_op.ty.toType(); |
| 3562 | 3562 | const pl_ty = eu_ty.errorUnionPayload(zcu); |
| ... | ... | @@ -3579,7 +3579,7 @@ fn airWrapErrUnionErr(func: *Func, inst: Air.Inst.Index) !void { |
| 3579 | 3579 | fn airRuntimeNavPtr(func: *Func, inst: Air.Inst.Index) !void { |
| 3580 | 3580 | const zcu = func.pt.zcu; |
| 3581 | 3581 | const ip = &zcu.intern_pool; |
| 3582 | const ty_nav = func.air.instructions.items(.data)[@intFromEnum(inst)].ty_nav; | |
| 3582 | const ty_nav = func.air.instructions.items(.data)[@backingInt(inst)].ty_nav; | |
| 3583 | 3583 | const ptr_ty: Type = .fromInterned(ty_nav.ty); |
| 3584 | 3584 | |
| 3585 | 3585 | const nav = ip.getNav(ty_nav.nav); |
| ... | ... | @@ -3597,8 +3597,8 @@ fn airRuntimeNavPtr(func: *Func, inst: Air.Inst.Index) !void { |
| 3597 | 3597 | .tag = .pseudo_load_tlv, |
| 3598 | 3598 | .data = .{ .reloc = .{ |
| 3599 | 3599 | .register = dest_mcv.getReg().?, |
| 3600 | .atom_index = @enumFromInt(try func.owner.getSymbolIndex(func)), | |
| 3601 | .sym_index = @enumFromInt(tlv_sym_index), | |
| 3600 | .atom_index = @fromBackingInt(@intCast(try func.owner.getSymbolIndex(func))), | |
| 3601 | .sym_index = @fromBackingInt(@intCast(tlv_sym_index)), | |
| 3602 | 3602 | } }, |
| 3603 | 3603 | }); |
| 3604 | 3604 | } else { |
| ... | ... | @@ -3608,8 +3608,8 @@ fn airRuntimeNavPtr(func: *Func, inst: Air.Inst.Index) !void { |
| 3608 | 3608 | .tag = .pseudo_load_tlv, |
| 3609 | 3609 | .data = .{ .reloc = .{ |
| 3610 | 3610 | .register = tmp_reg, |
| 3611 | .atom_index = @enumFromInt(try func.owner.getSymbolIndex(func)), | |
| 3612 | .sym_index = @enumFromInt(tlv_sym_index), | |
| 3611 | .atom_index = @fromBackingInt(@intCast(try func.owner.getSymbolIndex(func))), | |
| 3612 | .sym_index = @fromBackingInt(@intCast(tlv_sym_index)), | |
| 3613 | 3613 | } }, |
| 3614 | 3614 | }); |
| 3615 | 3615 | try func.genCopy(ptr_ty, dest_mcv, .{ .register = tmp_reg }); |
| ... | ... | @@ -3674,7 +3674,7 @@ fn genTry( |
| 3674 | 3674 | } |
| 3675 | 3675 | |
| 3676 | 3676 | fn airSlicePtr(func: *Func, inst: Air.Inst.Index) !void { |
| 3677 | const ty_op = func.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 3677 | const ty_op = func.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 3678 | 3678 | const result = result: { |
| 3679 | 3679 | const src_mcv = try func.resolveInst(ty_op.operand); |
| 3680 | 3680 | if (func.reuseOperand(inst, ty_op.operand, 0, src_mcv)) break :result src_mcv; |
| ... | ... | @@ -3688,7 +3688,7 @@ fn airSlicePtr(func: *Func, inst: Air.Inst.Index) !void { |
| 3688 | 3688 | } |
| 3689 | 3689 | |
| 3690 | 3690 | fn airSliceLen(func: *Func, inst: Air.Inst.Index) !void { |
| 3691 | const ty_op = func.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 3691 | const ty_op = func.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 3692 | 3692 | const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else result: { |
| 3693 | 3693 | const src_mcv = try func.resolveInst(ty_op.operand); |
| 3694 | 3694 | const ty = func.typeOfIndex(inst); |
| ... | ... | @@ -3721,7 +3721,7 @@ fn airSliceLen(func: *Func, inst: Air.Inst.Index) !void { |
| 3721 | 3721 | } |
| 3722 | 3722 | |
| 3723 | 3723 | fn airPtrSliceLenPtr(func: *Func, inst: Air.Inst.Index) !void { |
| 3724 | const ty_op = func.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 3724 | const ty_op = func.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 3725 | 3725 | const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else result: { |
| 3726 | 3726 | const src_mcv = try func.resolveInst(ty_op.operand); |
| 3727 | 3727 | |
| ... | ... | @@ -3736,7 +3736,7 @@ fn airPtrSliceLenPtr(func: *Func, inst: Air.Inst.Index) !void { |
| 3736 | 3736 | } |
| 3737 | 3737 | |
| 3738 | 3738 | fn airPtrSlicePtrPtr(func: *Func, inst: Air.Inst.Index) !void { |
| 3739 | const ty_op = func.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 3739 | const ty_op = func.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 3740 | 3740 | |
| 3741 | 3741 | const opt_mcv = try func.resolveInst(ty_op.operand); |
| 3742 | 3742 | const dst_mcv = if (func.reuseOperand(inst, ty_op.operand, 0, opt_mcv)) |
| ... | ... | @@ -3749,7 +3749,7 @@ fn airPtrSlicePtrPtr(func: *Func, inst: Air.Inst.Index) !void { |
| 3749 | 3749 | fn airSliceElemVal(func: *Func, inst: Air.Inst.Index) !void { |
| 3750 | 3750 | const pt = func.pt; |
| 3751 | 3751 | const zcu = pt.zcu; |
| 3752 | const bin_op = func.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 3752 | const bin_op = func.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 3753 | 3753 | |
| 3754 | 3754 | const result: MCValue = result: { |
| 3755 | 3755 | const elem_ty = func.typeOfIndex(inst); |
| ... | ... | @@ -3766,7 +3766,7 @@ fn airSliceElemVal(func: *Func, inst: Air.Inst.Index) !void { |
| 3766 | 3766 | } |
| 3767 | 3767 | |
| 3768 | 3768 | fn airSliceElemPtr(func: *Func, inst: Air.Inst.Index) !void { |
| 3769 | const ty_pl = func.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | |
| 3769 | const ty_pl = func.air.instructions.items(.data)[@backingInt(inst)].ty_pl; | |
| 3770 | 3770 | const extra = func.air.extraData(Air.Bin, ty_pl.payload).data; |
| 3771 | 3771 | const dst_mcv = try func.genSliceElemPtr(extra.lhs, extra.rhs); |
| 3772 | 3772 | return func.finishAir(inst, dst_mcv, .{ extra.lhs, extra.rhs, .none }); |
| ... | ... | @@ -3817,7 +3817,7 @@ fn genSliceElemPtr(func: *Func, lhs: Air.Inst.Ref, rhs: Air.Inst.Ref) !MCValue { |
| 3817 | 3817 | fn airArrayElemVal(func: *Func, inst: Air.Inst.Index) !void { |
| 3818 | 3818 | const pt = func.pt; |
| 3819 | 3819 | const zcu = pt.zcu; |
| 3820 | const bin_op = func.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 3820 | const bin_op = func.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 3821 | 3821 | const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else result: { |
| 3822 | 3822 | const result_ty = func.typeOfIndex(inst); |
| 3823 | 3823 | |
| ... | ... | @@ -3901,7 +3901,7 @@ fn airPtrElemVal(func: *Func, inst: Air.Inst.Index) !void { |
| 3901 | 3901 | const is_volatile = false; // TODO |
| 3902 | 3902 | const pt = func.pt; |
| 3903 | 3903 | const zcu = pt.zcu; |
| 3904 | const bin_op = func.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 3904 | const bin_op = func.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 3905 | 3905 | const base_ptr_ty = func.typeOf(bin_op.lhs); |
| 3906 | 3906 | |
| 3907 | 3907 | const result: MCValue = if (!is_volatile and func.liveness.isUnused(inst)) .unreach else result: { |
| ... | ... | @@ -3956,7 +3956,7 @@ fn airPtrElemVal(func: *Func, inst: Air.Inst.Index) !void { |
| 3956 | 3956 | fn airPtrElemPtr(func: *Func, inst: Air.Inst.Index) !void { |
| 3957 | 3957 | const pt = func.pt; |
| 3958 | 3958 | const zcu = pt.zcu; |
| 3959 | const ty_pl = func.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | |
| 3959 | const ty_pl = func.air.instructions.items(.data)[@backingInt(inst)].ty_pl; | |
| 3960 | 3960 | const extra = func.air.extraData(Air.Bin, ty_pl.payload).data; |
| 3961 | 3961 | |
| 3962 | 3962 | const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else result: { |
| ... | ... | @@ -3998,7 +3998,7 @@ fn airPtrElemPtr(func: *Func, inst: Air.Inst.Index) !void { |
| 3998 | 3998 | } |
| 3999 | 3999 | |
| 4000 | 4000 | fn airSetUnionTag(func: *Func, inst: Air.Inst.Index) !void { |
| 4001 | const bin_op = func.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 4001 | const bin_op = func.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 4002 | 4002 | _ = bin_op; |
| 4003 | 4003 | return func.fail("TODO implement airSetUnionTag for {}", .{func.target.cpu.arch}); |
| 4004 | 4004 | // return func.finishAir(inst, result, .{ bin_op.lhs, bin_op.rhs, .none }); |
| ... | ... | @@ -4007,7 +4007,7 @@ fn airSetUnionTag(func: *Func, inst: Air.Inst.Index) !void { |
| 4007 | 4007 | fn airGetUnionTag(func: *Func, inst: Air.Inst.Index) !void { |
| 4008 | 4008 | const pt = func.pt; |
| 4009 | 4009 | const zcu = pt.zcu; |
| 4010 | const ty_op = func.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 4010 | const ty_op = func.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 4011 | 4011 | |
| 4012 | 4012 | const tag_ty = func.typeOfIndex(inst); |
| 4013 | 4013 | const union_ty = func.typeOf(ty_op.operand); |
| ... | ... | @@ -4053,7 +4053,7 @@ fn airGetUnionTag(func: *Func, inst: Air.Inst.Index) !void { |
| 4053 | 4053 | } |
| 4054 | 4054 | |
| 4055 | 4055 | fn airClz(func: *Func, inst: Air.Inst.Index) !void { |
| 4056 | const ty_op = func.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 4056 | const ty_op = func.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 4057 | 4057 | const operand = try func.resolveInst(ty_op.operand); |
| 4058 | 4058 | const ty = func.typeOf(ty_op.operand); |
| 4059 | 4059 | |
| ... | ... | @@ -4109,13 +4109,13 @@ fn airClz(func: *Func, inst: Air.Inst.Index) !void { |
| 4109 | 4109 | } |
| 4110 | 4110 | |
| 4111 | 4111 | fn airCtz(func: *Func, inst: Air.Inst.Index) !void { |
| 4112 | const ty_op = func.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 4112 | const ty_op = func.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 4113 | 4113 | _ = ty_op; |
| 4114 | 4114 | return func.fail("TODO: finish ctz", .{}); |
| 4115 | 4115 | } |
| 4116 | 4116 | |
| 4117 | 4117 | fn airPopcount(func: *Func, inst: Air.Inst.Index) !void { |
| 4118 | const ty_op = func.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 4118 | const ty_op = func.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 4119 | 4119 | const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else result: { |
| 4120 | 4120 | const pt = func.pt; |
| 4121 | 4121 | const zcu = pt.zcu; |
| ... | ... | @@ -4141,7 +4141,7 @@ fn airPopcount(func: *Func, inst: Air.Inst.Index) !void { |
| 4141 | 4141 | .r_type = .{ |
| 4142 | 4142 | .rd = dst_reg, |
| 4143 | 4143 | .rs1 = operand_reg, |
| 4144 | .rs2 = @enumFromInt(0b00010), // this is the cpop funct5 | |
| 4144 | .rs2 = @fromBackingInt(@intCast(0b00010)), // this is the cpop funct5 | |
| 4145 | 4145 | }, |
| 4146 | 4146 | }, |
| 4147 | 4147 | }); |
| ... | ... | @@ -4154,7 +4154,7 @@ fn airPopcount(func: *Func, inst: Air.Inst.Index) !void { |
| 4154 | 4154 | fn airAbs(func: *Func, inst: Air.Inst.Index) !void { |
| 4155 | 4155 | const pt = func.pt; |
| 4156 | 4156 | const zcu = pt.zcu; |
| 4157 | const ty_op = func.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 4157 | const ty_op = func.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 4158 | 4158 | const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else result: { |
| 4159 | 4159 | const ty = func.typeOf(ty_op.operand); |
| 4160 | 4160 | const scalar_ty = ty.scalarType(zcu); |
| ... | ... | @@ -4252,7 +4252,7 @@ fn airAbs(func: *Func, inst: Air.Inst.Index) !void { |
| 4252 | 4252 | } |
| 4253 | 4253 | |
| 4254 | 4254 | fn airByteSwap(func: *Func, inst: Air.Inst.Index) !void { |
| 4255 | const ty_op = func.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 4255 | const ty_op = func.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 4256 | 4256 | const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else result: { |
| 4257 | 4257 | const pt = func.pt; |
| 4258 | 4258 | const zcu = pt.zcu; |
| ... | ... | @@ -4314,7 +4314,7 @@ fn airByteSwap(func: *Func, inst: Air.Inst.Index) !void { |
| 4314 | 4314 | } |
| 4315 | 4315 | |
| 4316 | 4316 | fn airBitReverse(func: *Func, inst: Air.Inst.Index) !void { |
| 4317 | const ty_op = func.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 4317 | const ty_op = func.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 4318 | 4318 | const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else return func.fail("TODO implement airBitReverse for {}", .{func.target.cpu.arch}); |
| 4319 | 4319 | return func.finishAir(inst, result, .{ ty_op.operand, .none, .none }); |
| 4320 | 4320 | } |
| ... | ... | @@ -4322,7 +4322,7 @@ fn airBitReverse(func: *Func, inst: Air.Inst.Index) !void { |
| 4322 | 4322 | fn airUnaryMath(func: *Func, inst: Air.Inst.Index, tag: Air.Inst.Tag) !void { |
| 4323 | 4323 | const pt = func.pt; |
| 4324 | 4324 | const zcu = pt.zcu; |
| 4325 | const un_op = func.air.instructions.items(.data)[@intFromEnum(inst)].un_op; | |
| 4325 | const un_op = func.air.instructions.items(.data)[@backingInt(inst)].un_op; | |
| 4326 | 4326 | const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else result: { |
| 4327 | 4327 | const ty = func.typeOf(un_op); |
| 4328 | 4328 | |
| ... | ... | @@ -4432,7 +4432,7 @@ fn reuseOperandAdvanced( |
| 4432 | 4432 | fn airLoad(func: *Func, inst: Air.Inst.Index) !void { |
| 4433 | 4433 | const pt = func.pt; |
| 4434 | 4434 | const zcu = pt.zcu; |
| 4435 | const ty_op = func.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 4435 | const ty_op = func.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 4436 | 4436 | const elem_ty = func.typeOfIndex(inst); |
| 4437 | 4437 | |
| 4438 | 4438 | const result: MCValue = result: { |
| ... | ... | @@ -4512,7 +4512,7 @@ fn airStore(func: *Func, inst: Air.Inst.Index, safety: bool) !void { |
| 4512 | 4512 | } else { |
| 4513 | 4513 | // TODO if the value is undef, don't lower this instruction |
| 4514 | 4514 | } |
| 4515 | const bin_op = func.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 4515 | const bin_op = func.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 4516 | 4516 | const ptr = try func.resolveInst(bin_op.lhs); |
| 4517 | 4517 | const value = try func.resolveInst(bin_op.rhs); |
| 4518 | 4518 | const ptr_ty = func.typeOf(bin_op.lhs); |
| ... | ... | @@ -4559,14 +4559,14 @@ fn store(func: *Func, ptr_mcv: MCValue, src_mcv: MCValue, ptr_ty: Type) !void { |
| 4559 | 4559 | } |
| 4560 | 4560 | |
| 4561 | 4561 | fn airStructFieldPtr(func: *Func, inst: Air.Inst.Index) !void { |
| 4562 | const ty_pl = func.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | |
| 4562 | const ty_pl = func.air.instructions.items(.data)[@backingInt(inst)].ty_pl; | |
| 4563 | 4563 | const extra = func.air.extraData(Air.StructField, ty_pl.payload).data; |
| 4564 | 4564 | const result = try func.structFieldPtr(inst, extra.struct_operand, extra.field_index); |
| 4565 | 4565 | return func.finishAir(inst, result, .{ extra.struct_operand, .none, .none }); |
| 4566 | 4566 | } |
| 4567 | 4567 | |
| 4568 | 4568 | fn airStructFieldPtrIndex(func: *Func, inst: Air.Inst.Index, index: u8) !void { |
| 4569 | const ty_op = func.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 4569 | const ty_op = func.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 4570 | 4570 | const result = try func.structFieldPtr(inst, ty_op.operand, index); |
| 4571 | 4571 | return func.finishAir(inst, result, .{ ty_op.operand, .none, .none }); |
| 4572 | 4572 | } |
| ... | ... | @@ -4598,7 +4598,7 @@ fn airAggFieldVal(func: *Func, inst: Air.Inst.Index) !void { |
| 4598 | 4598 | const pt = func.pt; |
| 4599 | 4599 | const zcu = pt.zcu; |
| 4600 | 4600 | |
| 4601 | const ty_pl = func.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | |
| 4601 | const ty_pl = func.air.instructions.items(.data)[@backingInt(inst)].ty_pl; | |
| 4602 | 4602 | const extra = func.air.extraData(Air.StructField, ty_pl.payload).data; |
| 4603 | 4603 | const operand = extra.struct_operand; |
| 4604 | 4604 | const index = extra.field_index; |
| ... | ... | @@ -4746,7 +4746,7 @@ fn airArg(func: *Func, inst: Air.Inst.Index) InnerError!void { |
| 4746 | 4746 | |
| 4747 | 4747 | try func.genCopy(arg_ty, dst_mcv, src_mcv); |
| 4748 | 4748 | |
| 4749 | const arg = func.air.instructions.items(.data)[@intFromEnum(inst)].arg; | |
| 4749 | const arg = func.air.instructions.items(.data)[@backingInt(inst)].arg; | |
| 4750 | 4750 | // can delete `func.func_index` if this logic is moved to emit |
| 4751 | 4751 | const func_zir = zcu.funcInfo(func.func_index).zir_body_inst.resolveFull(&zcu.intern_pool).?; |
| 4752 | 4752 | const file = zcu.fileByIndex(func_zir.file); |
| ... | ... | @@ -4871,10 +4871,10 @@ fn genCall( |
| 4871 | 4871 | }); |
| 4872 | 4872 | const frame_allocs_slice = func.frame_allocs.slice(); |
| 4873 | 4873 | const stack_frame_size = |
| 4874 | &frame_allocs_slice.items(.abi_size)[@intFromEnum(FrameIndex.call_frame)]; | |
| 4874 | &frame_allocs_slice.items(.abi_size)[@backingInt(FrameIndex.call_frame)]; | |
| 4875 | 4875 | stack_frame_size.* = @max(stack_frame_size.*, needed_call_frame.abi_size); |
| 4876 | 4876 | const stack_frame_align = |
| 4877 | &frame_allocs_slice.items(.abi_align)[@intFromEnum(FrameIndex.call_frame)]; | |
| 4877 | &frame_allocs_slice.items(.abi_align)[@backingInt(FrameIndex.call_frame)]; | |
| 4878 | 4878 | stack_frame_align.* = stack_frame_align.max(needed_call_frame.abi_align); |
| 4879 | 4879 | } |
| 4880 | 4880 | |
| ... | ... | @@ -4958,7 +4958,7 @@ fn genCall( |
| 4958 | 4958 | .func => |func_val| { |
| 4959 | 4959 | if (func.bin_file.cast(.elf)) |elf_file| { |
| 4960 | 4960 | const zo = elf_file.zigObjectPtr().?; |
| 4961 | const sym_index: link.File.SymbolId = @enumFromInt(try zo.getOrCreateMetadataForNav(zcu, func_val.owner_nav)); | |
| 4961 | const sym_index: link.File.SymbolId = @fromBackingInt(@intCast(try zo.getOrCreateMetadataForNav(zcu, func_val.owner_nav))); | |
| 4962 | 4962 | |
| 4963 | 4963 | if (func.mod.pic) { |
| 4964 | 4964 | return func.fail("TODO: genCall pic", .{}); |
| ... | ... | @@ -4978,7 +4978,7 @@ fn genCall( |
| 4978 | 4978 | .@"extern" => |@"extern"| { |
| 4979 | 4979 | const lib_name = @"extern".lib_name.toSlice(&zcu.intern_pool); |
| 4980 | 4980 | const name = @"extern".name.toSlice(&zcu.intern_pool); |
| 4981 | const atom_index: link.File.AtomId = @enumFromInt(try func.owner.getSymbolIndex(func)); | |
| 4981 | const atom_index: link.File.AtomId = @fromBackingInt(@intCast(try func.owner.getSymbolIndex(func))); | |
| 4982 | 4982 | |
| 4983 | 4983 | const elf_file = func.bin_file.cast(.elf).?; |
| 4984 | 4984 | _ = try func.addInst(.{ |
| ... | ... | @@ -4986,7 +4986,7 @@ fn genCall( |
| 4986 | 4986 | .data = .{ .reloc = .{ |
| 4987 | 4987 | .register = .ra, |
| 4988 | 4988 | .atom_index = atom_index, |
| 4989 | .sym_index = @enumFromInt(try elf_file.getGlobalSymbol(name, lib_name)), | |
| 4989 | .sym_index = @fromBackingInt(@intCast(try elf_file.getGlobalSymbol(name, lib_name))), | |
| 4990 | 4990 | } }, |
| 4991 | 4991 | }); |
| 4992 | 4992 | }, |
| ... | ... | @@ -5021,7 +5021,7 @@ fn genCall( |
| 5021 | 5021 | fn airRet(func: *Func, inst: Air.Inst.Index, safety: bool) !void { |
| 5022 | 5022 | const pt = func.pt; |
| 5023 | 5023 | const zcu = pt.zcu; |
| 5024 | const un_op = func.air.instructions.items(.data)[@intFromEnum(inst)].un_op; | |
| 5024 | const un_op = func.air.instructions.items(.data)[@backingInt(inst)].un_op; | |
| 5025 | 5025 | |
| 5026 | 5026 | if (safety) { |
| 5027 | 5027 | // safe |
| ... | ... | @@ -5087,7 +5087,7 @@ fn airRet(func: *Func, inst: Air.Inst.Index, safety: bool) !void { |
| 5087 | 5087 | } |
| 5088 | 5088 | |
| 5089 | 5089 | fn airRetLoad(func: *Func, inst: Air.Inst.Index) !void { |
| 5090 | const un_op = func.air.instructions.items(.data)[@intFromEnum(inst)].un_op; | |
| 5090 | const un_op = func.air.instructions.items(.data)[@backingInt(inst)].un_op; | |
| 5091 | 5091 | const ptr = try func.resolveInst(un_op); |
| 5092 | 5092 | |
| 5093 | 5093 | const ptr_ty = func.typeOf(un_op); |
| ... | ... | @@ -5113,7 +5113,7 @@ fn airRetLoad(func: *Func, inst: Air.Inst.Index) !void { |
| 5113 | 5113 | } |
| 5114 | 5114 | |
| 5115 | 5115 | fn airCmp(func: *Func, inst: Air.Inst.Index, tag: Air.Inst.Tag) !void { |
| 5116 | const bin_op = func.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 5116 | const bin_op = func.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 5117 | 5117 | const pt = func.pt; |
| 5118 | 5118 | const zcu = pt.zcu; |
| 5119 | 5119 | |
| ... | ... | @@ -5176,7 +5176,7 @@ fn airCmpVector(func: *Func, inst: Air.Inst.Index) !void { |
| 5176 | 5176 | } |
| 5177 | 5177 | |
| 5178 | 5178 | fn airCmpLteErrorsLen(func: *Func, inst: Air.Inst.Index) !void { |
| 5179 | const un_op = func.air.instructions.items(.data)[@intFromEnum(inst)].un_op; | |
| 5179 | const un_op = func.air.instructions.items(.data)[@backingInt(inst)].un_op; | |
| 5180 | 5180 | const operand = try func.resolveInst(un_op); |
| 5181 | 5181 | _ = operand; |
| 5182 | 5182 | const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else return func.fail("TODO implement airCmpLteErrorsLen for {}", .{func.target.cpu.arch}); |
| ... | ... | @@ -5184,7 +5184,7 @@ fn airCmpLteErrorsLen(func: *Func, inst: Air.Inst.Index) !void { |
| 5184 | 5184 | } |
| 5185 | 5185 | |
| 5186 | 5186 | fn airDbgStmt(func: *Func, inst: Air.Inst.Index) !void { |
| 5187 | const dbg_stmt = func.air.instructions.items(.data)[@intFromEnum(inst)].dbg_stmt; | |
| 5187 | const dbg_stmt = func.air.instructions.items(.data)[@backingInt(inst)].dbg_stmt; | |
| 5188 | 5188 | |
| 5189 | 5189 | _ = try func.addInst(.{ |
| 5190 | 5190 | .tag = .pseudo_dbg_line_column, |
| ... | ... | @@ -5203,13 +5203,13 @@ fn airDbgInlineBlock(func: *Func, inst: Air.Inst.Index) !void { |
| 5203 | 5203 | } |
| 5204 | 5204 | |
| 5205 | 5205 | fn airDbgVar(func: *Func, inst: Air.Inst.Index) InnerError!void { |
| 5206 | const pl_op = func.air.instructions.items(.data)[@intFromEnum(inst)].pl_op; | |
| 5206 | const pl_op = func.air.instructions.items(.data)[@backingInt(inst)].pl_op; | |
| 5207 | 5207 | const operand = pl_op.operand; |
| 5208 | 5208 | const ty = func.typeOf(operand); |
| 5209 | 5209 | const mcv = try func.resolveInst(operand); |
| 5210 | const name: Air.NullTerminatedString = @enumFromInt(pl_op.payload); | |
| 5210 | const name: Air.NullTerminatedString = @fromBackingInt(@intCast(pl_op.payload)); | |
| 5211 | 5211 | |
| 5212 | const tag = func.air.instructions.items(.tag)[@intFromEnum(inst)]; | |
| 5212 | const tag = func.air.instructions.items(.tag)[@backingInt(inst)]; | |
| 5213 | 5213 | func.genVarDbgInfo(tag, ty, mcv, name.toSlice(func.air)) catch |err| |
| 5214 | 5214 | return func.fail("failed to generate variable debug info: {s}", .{@errorName(err)}); |
| 5215 | 5215 | |
| ... | ... | @@ -5409,7 +5409,7 @@ fn isNull(func: *Func, inst: Air.Inst.Index, opt_ty: Type, opt_mcv: MCValue) !MC |
| 5409 | 5409 | } |
| 5410 | 5410 | |
| 5411 | 5411 | fn airIsNull(func: *Func, inst: Air.Inst.Index) !void { |
| 5412 | const un_op = func.air.instructions.items(.data)[@intFromEnum(inst)].un_op; | |
| 5412 | const un_op = func.air.instructions.items(.data)[@backingInt(inst)].un_op; | |
| 5413 | 5413 | const operand = try func.resolveInst(un_op); |
| 5414 | 5414 | const ty = func.typeOf(un_op); |
| 5415 | 5415 | const result = try func.isNull(inst, ty, operand); |
| ... | ... | @@ -5417,7 +5417,7 @@ fn airIsNull(func: *Func, inst: Air.Inst.Index) !void { |
| 5417 | 5417 | } |
| 5418 | 5418 | |
| 5419 | 5419 | fn airIsNullPtr(func: *Func, inst: Air.Inst.Index) !void { |
| 5420 | const un_op = func.air.instructions.items(.data)[@intFromEnum(inst)].un_op; | |
| 5420 | const un_op = func.air.instructions.items(.data)[@backingInt(inst)].un_op; | |
| 5421 | 5421 | const operand = try func.resolveInst(un_op); |
| 5422 | 5422 | _ = operand; |
| 5423 | 5423 | const ty = func.typeOf(un_op); |
| ... | ... | @@ -5429,7 +5429,7 @@ fn airIsNullPtr(func: *Func, inst: Air.Inst.Index) !void { |
| 5429 | 5429 | } |
| 5430 | 5430 | |
| 5431 | 5431 | fn airIsNonNull(func: *Func, inst: Air.Inst.Index) !void { |
| 5432 | const un_op = func.air.instructions.items(.data)[@intFromEnum(inst)].un_op; | |
| 5432 | const un_op = func.air.instructions.items(.data)[@backingInt(inst)].un_op; | |
| 5433 | 5433 | const operand = try func.resolveInst(un_op); |
| 5434 | 5434 | const ty = func.typeOf(un_op); |
| 5435 | 5435 | const result = try func.isNull(inst, ty, operand); |
| ... | ... | @@ -5449,7 +5449,7 @@ fn airIsNonNull(func: *Func, inst: Air.Inst.Index) !void { |
| 5449 | 5449 | } |
| 5450 | 5450 | |
| 5451 | 5451 | fn airIsNonNullPtr(func: *Func, inst: Air.Inst.Index) !void { |
| 5452 | const un_op = func.air.instructions.items(.data)[@intFromEnum(inst)].un_op; | |
| 5452 | const un_op = func.air.instructions.items(.data)[@backingInt(inst)].un_op; | |
| 5453 | 5453 | const operand = try func.resolveInst(un_op); |
| 5454 | 5454 | _ = operand; |
| 5455 | 5455 | const ty = func.typeOf(un_op); |
| ... | ... | @@ -5461,7 +5461,7 @@ fn airIsNonNullPtr(func: *Func, inst: Air.Inst.Index) !void { |
| 5461 | 5461 | } |
| 5462 | 5462 | |
| 5463 | 5463 | fn airIsErr(func: *Func, inst: Air.Inst.Index) !void { |
| 5464 | const un_op = func.air.instructions.items(.data)[@intFromEnum(inst)].un_op; | |
| 5464 | const un_op = func.air.instructions.items(.data)[@backingInt(inst)].un_op; | |
| 5465 | 5465 | const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else result: { |
| 5466 | 5466 | const operand = try func.resolveInst(un_op); |
| 5467 | 5467 | const operand_ty = func.typeOf(un_op); |
| ... | ... | @@ -5473,7 +5473,7 @@ fn airIsErr(func: *Func, inst: Air.Inst.Index) !void { |
| 5473 | 5473 | fn airIsErrPtr(func: *Func, inst: Air.Inst.Index) !void { |
| 5474 | 5474 | const pt = func.pt; |
| 5475 | 5475 | const zcu = pt.zcu; |
| 5476 | const un_op = func.air.instructions.items(.data)[@intFromEnum(inst)].un_op; | |
| 5476 | const un_op = func.air.instructions.items(.data)[@backingInt(inst)].un_op; | |
| 5477 | 5477 | const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else result: { |
| 5478 | 5478 | const operand_ptr = try func.resolveInst(un_op); |
| 5479 | 5479 | const operand: MCValue = blk: { |
| ... | ... | @@ -5553,7 +5553,7 @@ fn isErr(func: *Func, maybe_inst: ?Air.Inst.Index, eu_ty: Type, eu_mcv: MCValue) |
| 5553 | 5553 | } |
| 5554 | 5554 | |
| 5555 | 5555 | fn airIsNonErr(func: *Func, inst: Air.Inst.Index) !void { |
| 5556 | const un_op = func.air.instructions.items(.data)[@intFromEnum(inst)].un_op; | |
| 5556 | const un_op = func.air.instructions.items(.data)[@backingInt(inst)].un_op; | |
| 5557 | 5557 | const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else result: { |
| 5558 | 5558 | const operand = try func.resolveInst(un_op); |
| 5559 | 5559 | const ty = func.typeOf(un_op); |
| ... | ... | @@ -5589,7 +5589,7 @@ fn isNonErr(func: *Func, inst: Air.Inst.Index, eu_ty: Type, eu_mcv: MCValue) !MC |
| 5589 | 5589 | fn airIsNonErrPtr(func: *Func, inst: Air.Inst.Index) !void { |
| 5590 | 5590 | const pt = func.pt; |
| 5591 | 5591 | const zcu = pt.zcu; |
| 5592 | const un_op = func.air.instructions.items(.data)[@intFromEnum(inst)].un_op; | |
| 5592 | const un_op = func.air.instructions.items(.data)[@backingInt(inst)].un_op; | |
| 5593 | 5593 | const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else result: { |
| 5594 | 5594 | const operand_ptr = try func.resolveInst(un_op); |
| 5595 | 5595 | const operand: MCValue = blk: { |
| ... | ... | @@ -5843,7 +5843,7 @@ fn airLoopSwitchBr(func: *Func, inst: Air.Inst.Index) !void { |
| 5843 | 5843 | } |
| 5844 | 5844 | |
| 5845 | 5845 | fn airSwitchDispatch(func: *Func, inst: Air.Inst.Index) !void { |
| 5846 | const br = func.air.instructions.items(.data)[@intFromEnum(inst)].br; | |
| 5846 | const br = func.air.instructions.items(.data)[@backingInt(inst)].br; | |
| 5847 | 5847 | |
| 5848 | 5848 | const block_ty = func.typeOfIndex(br.block_inst); |
| 5849 | 5849 | const block_tracking = func.inst_tracking.getPtr(br.block_inst).?; |
| ... | ... | @@ -5905,7 +5905,7 @@ fn performReloc(func: *Func, inst: Mir.Inst.Index) void { |
| 5905 | 5905 | |
| 5906 | 5906 | fn airBr(func: *Func, inst: Air.Inst.Index) !void { |
| 5907 | 5907 | const zcu = func.pt.zcu; |
| 5908 | const br = func.air.instructions.items(.data)[@intFromEnum(inst)].br; | |
| 5908 | const br = func.air.instructions.items(.data)[@backingInt(inst)].br; | |
| 5909 | 5909 | |
| 5910 | 5910 | const block_ty = func.typeOfIndex(br.block_inst); |
| 5911 | 5911 | const block_unused = !block_ty.hasRuntimeBits(zcu) or func.liveness.isUnused(br.block_inst); |
| ... | ... | @@ -5968,7 +5968,7 @@ fn airBr(func: *Func, inst: Air.Inst.Index) !void { |
| 5968 | 5968 | } |
| 5969 | 5969 | |
| 5970 | 5970 | fn airRepeat(func: *Func, inst: Air.Inst.Index) !void { |
| 5971 | const loop_inst = func.air.instructions.items(.data)[@intFromEnum(inst)].repeat.loop_inst; | |
| 5971 | const loop_inst = func.air.instructions.items(.data)[@backingInt(inst)].repeat.loop_inst; | |
| 5972 | 5972 | const repeat_info = func.loops.get(loop_inst).?; |
| 5973 | 5973 | try func.restoreState(repeat_info.state, &.{}, .{ |
| 5974 | 5974 | .emit_instructions = true, |
| ... | ... | @@ -5981,8 +5981,8 @@ fn airRepeat(func: *Func, inst: Air.Inst.Index) !void { |
| 5981 | 5981 | } |
| 5982 | 5982 | |
| 5983 | 5983 | fn airBoolOp(func: *Func, inst: Air.Inst.Index) !void { |
| 5984 | const bin_op = func.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 5985 | const tag: Air.Inst.Tag = func.air.instructions.items(.tag)[@intFromEnum(inst)]; | |
| 5984 | const bin_op = func.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 5985 | const tag: Air.Inst.Tag = func.air.instructions.items(.tag)[@backingInt(inst)]; | |
| 5986 | 5986 | |
| 5987 | 5987 | const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else result: { |
| 5988 | 5988 | const lhs = try func.resolveInst(bin_op.lhs); |
| ... | ... | @@ -6404,7 +6404,7 @@ fn airAsm(func: *Func, inst: Air.Inst.Index) !void { |
| 6404 | 6404 | .tag = .pseudo_extern_fn_reloc, |
| 6405 | 6405 | .data = .{ .reloc = .{ |
| 6406 | 6406 | .register = random_link_reg, |
| 6407 | .atom_index = @enumFromInt(try func.owner.getSymbolIndex(func)), | |
| 6407 | .atom_index = @fromBackingInt(@intCast(try func.owner.getSymbolIndex(func))), | |
| 6408 | 6408 | .sym_index = sym_offset.sym, |
| 6409 | 6409 | } }, |
| 6410 | 6410 | }); |
| ... | ... | @@ -7035,7 +7035,7 @@ fn genSetReg(func: *Func, ty: Type, reg: Register, src_mcv: MCValue) InnerError! |
| 7035 | 7035 | }, |
| 7036 | 7036 | .lea_symbol => |sym_off| { |
| 7037 | 7037 | assert(sym_off.off == 0); |
| 7038 | const atom_index: link.File.AtomId = @enumFromInt(try func.owner.getSymbolIndex(func)); | |
| 7038 | const atom_index: link.File.AtomId = @fromBackingInt(@intCast(try func.owner.getSymbolIndex(func))); | |
| 7039 | 7039 | |
| 7040 | 7040 | _ = try func.addInst(.{ |
| 7041 | 7041 | .tag = .pseudo_load_symbol, |
| ... | ... | @@ -7154,8 +7154,8 @@ fn genSetMem( |
| 7154 | 7154 | const mem_size = switch (base) { |
| 7155 | 7155 | .frame => |base_fi| mem_size: { |
| 7156 | 7156 | assert(disp >= 0); |
| 7157 | const frame_abi_size = func.frame_allocs.items(.abi_size)[@intFromEnum(base_fi)]; | |
| 7158 | const frame_spill_pad = func.frame_allocs.items(.spill_pad)[@intFromEnum(base_fi)]; | |
| 7157 | const frame_abi_size = func.frame_allocs.items(.abi_size)[@backingInt(base_fi)]; | |
| 7158 | const frame_spill_pad = func.frame_allocs.items(.spill_pad)[@backingInt(base_fi)]; | |
| 7159 | 7159 | assert(frame_abi_size - frame_spill_pad - disp >= abi_size); |
| 7160 | 7160 | break :mem_size if (frame_abi_size - frame_spill_pad - disp == abi_size) |
| 7161 | 7161 | frame_abi_size |
| ... | ... | @@ -7225,7 +7225,7 @@ fn airBitCast(func: *Func, inst: Air.Inst.Index) !void { |
| 7225 | 7225 | const pt = func.pt; |
| 7226 | 7226 | const zcu = pt.zcu; |
| 7227 | 7227 | |
| 7228 | const ty_op = func.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 7228 | const ty_op = func.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 7229 | 7229 | const result = if (func.liveness.isUnused(inst)) .unreach else result: { |
| 7230 | 7230 | const src_mcv = try func.resolveInst(ty_op.operand); |
| 7231 | 7231 | |
| ... | ... | @@ -7262,7 +7262,7 @@ fn airBitCast(func: *Func, inst: Air.Inst.Index) !void { |
| 7262 | 7262 | fn airArrayToSlice(func: *Func, inst: Air.Inst.Index) !void { |
| 7263 | 7263 | const pt = func.pt; |
| 7264 | 7264 | const zcu = pt.zcu; |
| 7265 | const ty_op = func.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 7265 | const ty_op = func.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 7266 | 7266 | |
| 7267 | 7267 | const slice_ty = func.typeOfIndex(inst); |
| 7268 | 7268 | const ptr_ty = func.typeOf(ty_op.operand); |
| ... | ... | @@ -7284,7 +7284,7 @@ fn airArrayToSlice(func: *Func, inst: Air.Inst.Index) !void { |
| 7284 | 7284 | } |
| 7285 | 7285 | |
| 7286 | 7286 | fn airFloatFromInt(func: *Func, inst: Air.Inst.Index) !void { |
| 7287 | const ty_op = func.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 7287 | const ty_op = func.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 7288 | 7288 | const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else result: { |
| 7289 | 7289 | const pt = func.pt; |
| 7290 | 7290 | const zcu = pt.zcu; |
| ... | ... | @@ -7348,7 +7348,7 @@ fn airFloatFromInt(func: *Func, inst: Air.Inst.Index) !void { |
| 7348 | 7348 | } |
| 7349 | 7349 | |
| 7350 | 7350 | fn airIntFromFloat(func: *Func, inst: Air.Inst.Index) !void { |
| 7351 | const ty_op = func.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 7351 | const ty_op = func.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 7352 | 7352 | const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else result: { |
| 7353 | 7353 | const pt = func.pt; |
| 7354 | 7354 | const zcu = pt.zcu; |
| ... | ... | @@ -7410,7 +7410,7 @@ fn airCmpxchg(func: *Func, inst: Air.Inst.Index, strength: enum { weak, strong } |
| 7410 | 7410 | |
| 7411 | 7411 | const pt = func.pt; |
| 7412 | 7412 | const zcu = pt.zcu; |
| 7413 | const ty_pl = func.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | |
| 7413 | const ty_pl = func.air.instructions.items(.data)[@backingInt(inst)].ty_pl; | |
| 7414 | 7414 | const extra = func.air.extraData(Air.Cmpxchg, ty_pl.payload).data; |
| 7415 | 7415 | |
| 7416 | 7416 | const ptr_ty = func.typeOf(extra.ptr); |
| ... | ... | @@ -7547,7 +7547,7 @@ fn airCmpxchg(func: *Func, inst: Air.Inst.Index, strength: enum { weak, strong } |
| 7547 | 7547 | fn airAtomicRmw(func: *Func, inst: Air.Inst.Index) !void { |
| 7548 | 7548 | const pt = func.pt; |
| 7549 | 7549 | const zcu = pt.zcu; |
| 7550 | const pl_op = func.air.instructions.items(.data)[@intFromEnum(inst)].pl_op; | |
| 7550 | const pl_op = func.air.instructions.items(.data)[@backingInt(inst)].pl_op; | |
| 7551 | 7551 | const extra = func.air.extraData(Air.AtomicRmw, pl_op.payload).data; |
| 7552 | 7552 | |
| 7553 | 7553 | const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else result: { |
| ... | ... | @@ -7689,7 +7689,7 @@ fn airAtomicRmw(func: *Func, inst: Air.Inst.Index) !void { |
| 7689 | 7689 | fn airAtomicLoad(func: *Func, inst: Air.Inst.Index) !void { |
| 7690 | 7690 | const pt = func.pt; |
| 7691 | 7691 | const zcu = pt.zcu; |
| 7692 | const atomic_load = func.air.instructions.items(.data)[@intFromEnum(inst)].atomic_load; | |
| 7692 | const atomic_load = func.air.instructions.items(.data)[@backingInt(inst)].atomic_load; | |
| 7693 | 7693 | const order: std.lang.AtomicOrder = atomic_load.order; |
| 7694 | 7694 | |
| 7695 | 7695 | const ptr_ty = func.typeOf(atomic_load.ptr); |
| ... | ... | @@ -7737,7 +7737,7 @@ fn airAtomicLoad(func: *Func, inst: Air.Inst.Index) !void { |
| 7737 | 7737 | } |
| 7738 | 7738 | |
| 7739 | 7739 | fn airAtomicStore(func: *Func, inst: Air.Inst.Index, order: std.lang.AtomicOrder) !void { |
| 7740 | const bin_op = func.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 7740 | const bin_op = func.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 7741 | 7741 | |
| 7742 | 7742 | const ptr_ty = func.typeOf(bin_op.lhs); |
| 7743 | 7743 | const ptr_mcv = try func.resolveInst(bin_op.lhs); |
| ... | ... | @@ -7780,7 +7780,7 @@ fn airAtomicStore(func: *Func, inst: Air.Inst.Index, order: std.lang.AtomicOrder |
| 7780 | 7780 | fn airMemset(func: *Func, inst: Air.Inst.Index, safety: bool) !void { |
| 7781 | 7781 | const pt = func.pt; |
| 7782 | 7782 | const zcu = pt.zcu; |
| 7783 | const bin_op = func.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 7783 | const bin_op = func.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 7784 | 7784 | |
| 7785 | 7785 | result: { |
| 7786 | 7786 | if (!safety and (try func.resolveInst(bin_op.rhs)) == .undef) break :result; |
| ... | ... | @@ -7861,7 +7861,7 @@ fn airMemset(func: *Func, inst: Air.Inst.Index, safety: bool) !void { |
| 7861 | 7861 | fn airMemcpy(func: *Func, inst: Air.Inst.Index) !void { |
| 7862 | 7862 | const pt = func.pt; |
| 7863 | 7863 | const zcu = pt.zcu; |
| 7864 | const bin_op = func.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 7864 | const bin_op = func.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 7865 | 7865 | |
| 7866 | 7866 | const dst_ptr = try func.resolveInst(bin_op.lhs); |
| 7867 | 7867 | const src_ptr = try func.resolveInst(bin_op.rhs); |
| ... | ... | @@ -7909,7 +7909,7 @@ fn airMemmove(func: *Func, inst: Air.Inst.Index) !void { |
| 7909 | 7909 | fn airTagName(func: *Func, inst: Air.Inst.Index) !void { |
| 7910 | 7910 | const pt = func.pt; |
| 7911 | 7911 | |
| 7912 | const un_op = func.air.instructions.items(.data)[@intFromEnum(inst)].un_op; | |
| 7912 | const un_op = func.air.instructions.items(.data)[@backingInt(inst)].un_op; | |
| 7913 | 7913 | const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else result: { |
| 7914 | 7914 | const enum_ty = func.typeOf(un_op); |
| 7915 | 7915 | |
| ... | ... | @@ -7954,13 +7954,13 @@ fn airErrorName(func: *Func, inst: Air.Inst.Index) !void { |
| 7954 | 7954 | } |
| 7955 | 7955 | |
| 7956 | 7956 | fn airSplat(func: *Func, inst: Air.Inst.Index) !void { |
| 7957 | const ty_op = func.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 7957 | const ty_op = func.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 7958 | 7958 | const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else return func.fail("TODO implement airSplat for riscv64", .{}); |
| 7959 | 7959 | return func.finishAir(inst, result, .{ ty_op.operand, .none, .none }); |
| 7960 | 7960 | } |
| 7961 | 7961 | |
| 7962 | 7962 | fn airSelect(func: *Func, inst: Air.Inst.Index) !void { |
| 7963 | const pl_op = func.air.instructions.items(.data)[@intFromEnum(inst)].pl_op; | |
| 7963 | const pl_op = func.air.instructions.items(.data)[@backingInt(inst)].pl_op; | |
| 7964 | 7964 | const extra = func.air.extraData(Air.Bin, pl_op.payload).data; |
| 7965 | 7965 | const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else return func.fail("TODO implement airSelect for riscv64", .{}); |
| 7966 | 7966 | return func.finishAir(inst, result, .{ pl_op.operand, extra.lhs, extra.rhs }); |
| ... | ... | @@ -7977,7 +7977,7 @@ fn airShuffleTwo(func: *Func, inst: Air.Inst.Index) !void { |
| 7977 | 7977 | } |
| 7978 | 7978 | |
| 7979 | 7979 | fn airReduce(func: *Func, inst: Air.Inst.Index) !void { |
| 7980 | const reduce = func.air.instructions.items(.data)[@intFromEnum(inst)].reduce; | |
| 7980 | const reduce = func.air.instructions.items(.data)[@backingInt(inst)].reduce; | |
| 7981 | 7981 | const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else return func.fail("TODO implement airReduce for riscv64", .{}); |
| 7982 | 7982 | return func.finishAir(inst, result, .{ reduce.operand, .none, .none }); |
| 7983 | 7983 | } |
| ... | ... | @@ -7987,7 +7987,7 @@ fn airAggregateInit(func: *Func, inst: Air.Inst.Index) !void { |
| 7987 | 7987 | const zcu = pt.zcu; |
| 7988 | 7988 | const result_ty = func.typeOfIndex(inst); |
| 7989 | 7989 | const len: usize = @intCast(result_ty.arrayLen(zcu)); |
| 7990 | const ty_pl = func.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | |
| 7990 | const ty_pl = func.air.instructions.items(.data)[@backingInt(inst)].ty_pl; | |
| 7991 | 7991 | const elements: []const Air.Inst.Ref = @ptrCast(func.air.extra.items[ty_pl.payload..][0..len]); |
| 7992 | 7992 | |
| 7993 | 7993 | const result: MCValue = result: { |
| ... | ... | @@ -8085,7 +8085,7 @@ fn airAggregateInit(func: *Func, inst: Air.Inst.Index) !void { |
| 8085 | 8085 | } |
| 8086 | 8086 | |
| 8087 | 8087 | fn airUnionInit(func: *Func, inst: Air.Inst.Index) !void { |
| 8088 | const ty_pl = func.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | |
| 8088 | const ty_pl = func.air.instructions.items(.data)[@backingInt(inst)].ty_pl; | |
| 8089 | 8089 | const extra = func.air.extraData(Air.UnionInit, ty_pl.payload).data; |
| 8090 | 8090 | _ = extra; |
| 8091 | 8091 | return func.fail("TODO implement airUnionInit for riscv64", .{}); |
| ... | ... | @@ -8093,14 +8093,14 @@ fn airUnionInit(func: *Func, inst: Air.Inst.Index) !void { |
| 8093 | 8093 | } |
| 8094 | 8094 | |
| 8095 | 8095 | fn airPrefetch(func: *Func, inst: Air.Inst.Index) !void { |
| 8096 | const prefetch = func.air.instructions.items(.data)[@intFromEnum(inst)].prefetch; | |
| 8096 | const prefetch = func.air.instructions.items(.data)[@backingInt(inst)].prefetch; | |
| 8097 | 8097 | // TODO: RISC-V does have prefetch instruction variants. |
| 8098 | 8098 | // see here: https://raw.githubusercontent.com/riscv/riscv-CMOs/master/specifications/cmobase-v1.0.1.pdf |
| 8099 | 8099 | return func.finishAir(inst, .unreach, .{ prefetch.ptr, .none, .none }); |
| 8100 | 8100 | } |
| 8101 | 8101 | |
| 8102 | 8102 | fn airMulAdd(func: *Func, inst: Air.Inst.Index) !void { |
| 8103 | const pl_op = func.air.instructions.items(.data)[@intFromEnum(inst)].pl_op; | |
| 8103 | const pl_op = func.air.instructions.items(.data)[@backingInt(inst)].pl_op; | |
| 8104 | 8104 | const extra = func.air.extraData(Air.Bin, pl_op.payload).data; |
| 8105 | 8105 | const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else { |
| 8106 | 8106 | return func.fail("TODO implement airMulAdd for riscv64", .{}); |
| ... | ... | @@ -8379,7 +8379,7 @@ fn typeOf(func: *Func, inst: Air.Inst.Ref) Type { |
| 8379 | 8379 | |
| 8380 | 8380 | fn typeOfIndex(func: *Func, inst: Air.Inst.Index) Type { |
| 8381 | 8381 | const zcu = func.pt.zcu; |
| 8382 | return switch (func.air.instructions.items(.tag)[@intFromEnum(inst)]) { | |
| 8382 | return switch (func.air.instructions.items(.tag)[@backingInt(inst)]) { | |
| 8383 | 8383 | .loop_switch_br => func.typeOf(func.air.unwrapSwitch(inst).operand), |
| 8384 | 8384 | else => func.air.typeOfIndex(inst, &zcu.intern_pool), |
| 8385 | 8385 | }; |
src/codegen/riscv64/Emit.zig+13-13| ... | ... | @@ -47,25 +47,25 @@ pub fn emitMir(emit: *Emit) Error!void { |
| 47 | 47 | const elf_file = emit.bin_file.cast(.elf).?; |
| 48 | 48 | const zo = elf_file.zigObjectPtr().?; |
| 49 | 49 | |
| 50 | const atom_ptr = zo.symbol(@intFromEnum(symbol.atom_index)).atom(elf_file).?; | |
| 51 | const sym = zo.symbol(@intFromEnum(symbol.sym_index)); | |
| 50 | const atom_ptr = zo.symbol(@backingInt(symbol.atom_index)).atom(elf_file).?; | |
| 51 | const sym = zo.symbol(@backingInt(symbol.sym_index)); | |
| 52 | 52 | |
| 53 | 53 | if (emit.lower.pic) { |
| 54 | 54 | return emit.fail("know when to emit GOT relocation for symbol '{s}'", .{sym.name(elf_file)}); |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | const hi_r_type: u32 = @intFromEnum(std.elf.R_RISCV.HI20); | |
| 58 | const lo_r_type: u32 = @intFromEnum(std.elf.R_RISCV.LO12_I); | |
| 57 | const hi_r_type: u32 = @backingInt(std.elf.R_RISCV.HI20); | |
| 58 | const lo_r_type: u32 = @backingInt(std.elf.R_RISCV.LO12_I); | |
| 59 | 59 | |
| 60 | 60 | try atom_ptr.addReloc(gpa, .{ |
| 61 | 61 | .r_offset = start_offset, |
| 62 | .r_info = (@as(u64, @intFromEnum(symbol.sym_index)) << 32) | hi_r_type, | |
| 62 | .r_info = (@as(u64, @backingInt(symbol.sym_index)) << 32) | hi_r_type, | |
| 63 | 63 | .r_addend = 0, |
| 64 | 64 | }, zo); |
| 65 | 65 | |
| 66 | 66 | try atom_ptr.addReloc(gpa, .{ |
| 67 | 67 | .r_offset = start_offset + 4, |
| 68 | .r_info = (@as(u64, @intFromEnum(symbol.sym_index)) << 32) | lo_r_type, | |
| 68 | .r_info = (@as(u64, @backingInt(symbol.sym_index)) << 32) | lo_r_type, | |
| 69 | 69 | .r_addend = 0, |
| 70 | 70 | }, zo); |
| 71 | 71 | }, |
| ... | ... | @@ -73,38 +73,38 @@ pub fn emitMir(emit: *Emit) Error!void { |
| 73 | 73 | const elf_file = emit.bin_file.cast(.elf).?; |
| 74 | 74 | const zo = elf_file.zigObjectPtr().?; |
| 75 | 75 | |
| 76 | const atom_ptr = zo.symbol(@intFromEnum(symbol.atom_index)).atom(elf_file).?; | |
| 76 | const atom_ptr = zo.symbol(@backingInt(symbol.atom_index)).atom(elf_file).?; | |
| 77 | 77 | |
| 78 | 78 | const R_RISCV = std.elf.R_RISCV; |
| 79 | 79 | |
| 80 | 80 | try atom_ptr.addReloc(gpa, .{ |
| 81 | 81 | .r_offset = start_offset, |
| 82 | .r_info = (@as(u64, @intFromEnum(symbol.sym_index)) << 32) | @intFromEnum(R_RISCV.TPREL_HI20), | |
| 82 | .r_info = (@as(u64, @backingInt(symbol.sym_index)) << 32) | @backingInt(R_RISCV.TPREL_HI20), | |
| 83 | 83 | .r_addend = 0, |
| 84 | 84 | }, zo); |
| 85 | 85 | |
| 86 | 86 | try atom_ptr.addReloc(gpa, .{ |
| 87 | 87 | .r_offset = start_offset + 4, |
| 88 | .r_info = (@as(u64, @intFromEnum(symbol.sym_index)) << 32) | @intFromEnum(R_RISCV.TPREL_ADD), | |
| 88 | .r_info = (@as(u64, @backingInt(symbol.sym_index)) << 32) | @backingInt(R_RISCV.TPREL_ADD), | |
| 89 | 89 | .r_addend = 0, |
| 90 | 90 | }, zo); |
| 91 | 91 | |
| 92 | 92 | try atom_ptr.addReloc(gpa, .{ |
| 93 | 93 | .r_offset = start_offset + 8, |
| 94 | .r_info = (@as(u64, @intFromEnum(symbol.sym_index)) << 32) | @intFromEnum(R_RISCV.TPREL_LO12_I), | |
| 94 | .r_info = (@as(u64, @backingInt(symbol.sym_index)) << 32) | @backingInt(R_RISCV.TPREL_LO12_I), | |
| 95 | 95 | .r_addend = 0, |
| 96 | 96 | }, zo); |
| 97 | 97 | }, |
| 98 | 98 | .call_extern_fn_reloc => |symbol| { |
| 99 | 99 | const elf_file = emit.bin_file.cast(.elf).?; |
| 100 | 100 | const zo = elf_file.zigObjectPtr().?; |
| 101 | const atom_ptr = zo.symbol(@intFromEnum(symbol.atom_index)).atom(elf_file).?; | |
| 101 | const atom_ptr = zo.symbol(@backingInt(symbol.atom_index)).atom(elf_file).?; | |
| 102 | 102 | |
| 103 | const r_type: u32 = @intFromEnum(std.elf.R_RISCV.CALL_PLT); | |
| 103 | const r_type: u32 = @backingInt(std.elf.R_RISCV.CALL_PLT); | |
| 104 | 104 | |
| 105 | 105 | try atom_ptr.addReloc(gpa, .{ |
| 106 | 106 | .r_offset = start_offset, |
| 107 | .r_info = (@as(u64, @intFromEnum(symbol.sym_index)) << 32) | r_type, | |
| 107 | .r_info = (@as(u64, @backingInt(symbol.sym_index)) << 32) | r_type, | |
| 108 | 108 | .r_addend = 0, |
| 109 | 109 | }, zo); |
| 110 | 110 | }, |
src/codegen/riscv64/Lower.zig+1-1| ... | ... | @@ -554,7 +554,7 @@ fn pushPopRegList(lower: *Lower, comptime spilling: bool, reg_list: Mir.Register |
| 554 | 554 | |
| 555 | 555 | var reg_i: u31 = 0; |
| 556 | 556 | while (it.next()) |i| { |
| 557 | const frame = lower.mir.frame_locs.get(@intFromEnum(bits.FrameIndex.spill_frame)); | |
| 557 | const frame = lower.mir.frame_locs.get(@backingInt(bits.FrameIndex.spill_frame)); | |
| 558 | 558 | const reg = abi.Registers.all_preserved[i]; |
| 559 | 559 | |
| 560 | 560 | const reg_class = reg.class(); |
src/codegen/riscv64/bits.zig+6-6| ... | ... | @@ -75,7 +75,7 @@ pub const Memory = struct { |
| 75 | 75 | }; |
| 76 | 76 | }, |
| 77 | 77 | .frame => |index| { |
| 78 | const base_loc = mir.frame_locs.get(@intFromEnum(index)); | |
| 78 | const base_loc = mir.frame_locs.get(@backingInt(index)); | |
| 79 | 79 | return .{ |
| 80 | 80 | .base = base_loc.base, |
| 81 | 81 | .disp = base_loc.disp + offset, |
| ... | ... | @@ -191,7 +191,7 @@ pub const Register = enum(u8) { |
| 191 | 191 | /// seperate IDs for `x0` and `f0`. We will assume that each register set has 32 registers |
| 192 | 192 | /// and is repeated twice, once for the named version, once for the number version. |
| 193 | 193 | pub fn id(reg: Register) std.math.IntFittingRange(0, @typeInfo(Register).@"enum".field_names.len) { |
| 194 | const base = switch (@intFromEnum(reg)) { | |
| 194 | const base = switch (@backingInt(reg)) { | |
| 195 | 195 | // zig fmt: off |
| 196 | 196 | @intFromEnum(Register.zero) ... @intFromEnum(Register.x31) => @intFromEnum(Register.zero), |
| 197 | 197 | @intFromEnum(Register.ft0) ... @intFromEnum(Register.f31) => @intFromEnum(Register.ft0), |
| ... | ... | @@ -204,7 +204,7 @@ pub const Register = enum(u8) { |
| 204 | 204 | } |
| 205 | 205 | |
| 206 | 206 | pub fn encodeId(reg: Register) u5 { |
| 207 | return @truncate(@intFromEnum(reg)); | |
| 207 | return @truncate(@backingInt(reg)); | |
| 208 | 208 | } |
| 209 | 209 | |
| 210 | 210 | pub fn dwarfNum(reg: Register) u8 { |
| ... | ... | @@ -212,7 +212,7 @@ pub const Register = enum(u8) { |
| 212 | 212 | } |
| 213 | 213 | |
| 214 | 214 | pub fn bitSize(reg: Register, zcu: *const Zcu) u32 { |
| 215 | return switch (@intFromEnum(reg)) { | |
| 215 | return switch (@backingInt(reg)) { | |
| 216 | 216 | // zig fmt: off |
| 217 | 217 | @intFromEnum(Register.zero) ... @intFromEnum(Register.x31) => 64, |
| 218 | 218 | @intFromEnum(Register.ft0) ... @intFromEnum(Register.f31) => if (zcu.getTarget().cpu.has(.riscv, .d)) 64 else 32, |
| ... | ... | @@ -223,7 +223,7 @@ pub const Register = enum(u8) { |
| 223 | 223 | } |
| 224 | 224 | |
| 225 | 225 | pub fn class(reg: Register) abi.RegisterClass { |
| 226 | return switch (@intFromEnum(reg)) { | |
| 226 | return switch (@backingInt(reg)) { | |
| 227 | 227 | // zig fmt: off |
| 228 | 228 | @intFromEnum(Register.zero) ... @intFromEnum(Register.x31) => .int, |
| 229 | 229 | @intFromEnum(Register.ft0) ... @intFromEnum(Register.f31) => .float, |
| ... | ... | @@ -254,7 +254,7 @@ pub const FrameIndex = enum(u32) { |
| 254 | 254 | pub const named_count = @typeInfo(FrameIndex).@"enum".field_names.len; |
| 255 | 255 | |
| 256 | 256 | pub fn isNamed(fi: FrameIndex) bool { |
| 257 | return @intFromEnum(fi) < named_count; | |
| 257 | return @backingInt(fi) < named_count; | |
| 258 | 258 | } |
| 259 | 259 | }; |
| 260 | 260 |
src/codegen/riscv64/encoding.zig+12-12| ... | ... | @@ -523,7 +523,7 @@ pub const Instruction = union(Lir.Format) { |
| 523 | 523 | } |
| 524 | 524 | |
| 525 | 525 | pub fn fromLir(lir: Lir, ops: []const Operand) Instruction { |
| 526 | const opcode: u7 = @intFromEnum(lir.opcode); | |
| 526 | const opcode: u7 = @backingInt(lir.opcode); | |
| 527 | 527 | |
| 528 | 528 | switch (lir.format) { |
| 529 | 529 | .R => { |
| ... | ... | @@ -545,26 +545,26 @@ pub const Instruction = union(Lir.Format) { |
| 545 | 545 | |
| 546 | 546 | .opcode = opcode, |
| 547 | 547 | .funct3 = fmt.rm, |
| 548 | .funct7 = (@as(u7, fmt.funct5) << 2) | @intFromEnum(fmt.fmt), | |
| 548 | .funct7 = (@as(u7, fmt.funct5) << 2) | @backingInt(fmt.fmt), | |
| 549 | 549 | }, |
| 550 | 550 | .fcvt => |fcvt| .{ |
| 551 | 551 | .rd = ops[0].reg.encodeId(), |
| 552 | 552 | .rs1 = ops[1].reg.encodeId(), |
| 553 | .rs2 = @intFromEnum(fcvt.width), | |
| 553 | .rs2 = @backingInt(fcvt.width), | |
| 554 | 554 | |
| 555 | 555 | .opcode = opcode, |
| 556 | 556 | .funct3 = fcvt.rm, |
| 557 | .funct7 = (@as(u7, fcvt.funct5) << 2) | @intFromEnum(fcvt.fmt), | |
| 557 | .funct7 = (@as(u7, fcvt.funct5) << 2) | @backingInt(fcvt.fmt), | |
| 558 | 558 | }, |
| 559 | 559 | .vecls => |vec| .{ |
| 560 | 560 | .rd = ops[0].reg.encodeId(), |
| 561 | 561 | .rs1 = ops[1].reg.encodeId(), |
| 562 | 562 | |
| 563 | .rs2 = @intFromEnum(vec.umop), | |
| 563 | .rs2 = @backingInt(vec.umop), | |
| 564 | 564 | |
| 565 | 565 | .opcode = opcode, |
| 566 | .funct3 = @intFromEnum(vec.width), | |
| 567 | .funct7 = (@as(u7, vec.nf) << 4) | (@as(u7, @intFromBool(vec.mew)) << 3) | (@as(u7, @intFromEnum(vec.mop)) << 1) | @intFromBool(vec.vm), | |
| 566 | .funct3 = @backingInt(vec.width), | |
| 567 | .funct7 = (@as(u7, vec.nf) << 4) | (@as(u7, @intFromBool(vec.mew)) << 3) | (@as(u7, @backingInt(vec.mop)) << 1) | @intFromBool(vec.vm), | |
| 568 | 568 | }, |
| 569 | 569 | .vecmath => |vec| .{ |
| 570 | 570 | .rd = ops[0].reg.encodeId(), |
| ... | ... | @@ -572,7 +572,7 @@ pub const Instruction = union(Lir.Format) { |
| 572 | 572 | .rs2 = ops[2].reg.encodeId(), |
| 573 | 573 | |
| 574 | 574 | .opcode = opcode, |
| 575 | .funct3 = @intFromEnum(vec.funct3), | |
| 575 | .funct3 = @backingInt(vec.funct3), | |
| 576 | 576 | .funct7 = (@as(u7, vec.funct6) << 1) | @intFromBool(vec.vm), |
| 577 | 577 | }, |
| 578 | 578 | .amo => |amo| .{ |
| ... | ... | @@ -581,7 +581,7 @@ pub const Instruction = union(Lir.Format) { |
| 581 | 581 | .rs2 = ops[2].reg.encodeId(), |
| 582 | 582 | |
| 583 | 583 | .opcode = opcode, |
| 584 | .funct3 = @intFromEnum(amo.width), | |
| 584 | .funct3 = @backingInt(amo.width), | |
| 585 | 585 | .funct7 = @as(u7, amo.funct5) << 2 | |
| 586 | 586 | @as(u7, @intFromBool(ops[3].barrier == .rl)) << 1 | |
| 587 | 587 | @as(u7, @intFromBool(ops[4].barrier == .aq)), |
| ... | ... | @@ -629,9 +629,9 @@ pub const Instruction = union(Lir.Format) { |
| 629 | 629 | .rd = 0, |
| 630 | 630 | .rs1 = 0, |
| 631 | 631 | .funct3 = 0, |
| 632 | .imm0_11 = (@as(u12, @intFromEnum(fence.fm)) << 8) | | |
| 633 | (@as(u12, @intFromEnum(ops[1].barrier)) << 4) | | |
| 634 | @as(u12, @intFromEnum(ops[0].barrier)), | |
| 632 | .imm0_11 = (@as(u12, @backingInt(fence.fm)) << 8) | | |
| 633 | (@as(u12, @backingInt(ops[1].barrier)) << 4) | | |
| 634 | @as(u12, @backingInt(ops[0].barrier)), | |
| 635 | 635 | .opcode = opcode, |
| 636 | 636 | }, |
| 637 | 637 | else => unreachable, |
src/codegen/sparc64/CodeGen.zig+78-78| ... | ... | @@ -466,7 +466,7 @@ fn genBody(self: *Self, body: []const Air.Inst.Index) InnerError!void { |
| 466 | 466 | try self.ensureProcessDeathCapacity(Air.Liveness.bpi); |
| 467 | 467 | |
| 468 | 468 | self.reused_operands = @TypeOf(self.reused_operands).empty; |
| 469 | switch (air_tags[@intFromEnum(inst)]) { | |
| 469 | switch (air_tags[@backingInt(inst)]) { | |
| 470 | 470 | // zig fmt: off |
| 471 | 471 | |
| 472 | 472 | // No "scalarize" legalizations are enabled, so these instructions never appear. |
| ... | ... | @@ -726,21 +726,21 @@ fn genBody(self: *Self, body: []const Air.Inst.Index) InnerError!void { |
| 726 | 726 | |
| 727 | 727 | if (std.debug.runtime_safety) { |
| 728 | 728 | if (self.air_bookkeeping < old_air_bookkeeping + 1) { |
| 729 | std.debug.panic("in codegen.zig, handling of AIR instruction %{d} ('{t}') did not do proper bookkeeping. Look for a missing call to finishAir.", .{ inst, air_tags[@intFromEnum(inst)] }); | |
| 729 | std.debug.panic("in codegen.zig, handling of AIR instruction %{d} ('{t}') did not do proper bookkeeping. Look for a missing call to finishAir.", .{ inst, air_tags[@backingInt(inst)] }); | |
| 730 | 730 | } |
| 731 | 731 | } |
| 732 | 732 | } |
| 733 | 733 | } |
| 734 | 734 | |
| 735 | 735 | fn airAddSat(self: *Self, inst: Air.Inst.Index) !void { |
| 736 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 736 | const bin_op = self.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 737 | 737 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else return self.fail("TODO implement add_sat for {}", .{self.target.cpu.arch}); |
| 738 | 738 | return self.finishAir(inst, result, .{ bin_op.lhs, bin_op.rhs, .none }); |
| 739 | 739 | } |
| 740 | 740 | |
| 741 | 741 | fn airAddSubWithOverflow(self: *Self, inst: Air.Inst.Index) !void { |
| 742 | const tag = self.air.instructions.items(.tag)[@intFromEnum(inst)]; | |
| 743 | const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | |
| 742 | const tag = self.air.instructions.items(.tag)[@backingInt(inst)]; | |
| 743 | const ty_pl = self.air.instructions.items(.data)[@backingInt(inst)].ty_pl; | |
| 744 | 744 | const extra = self.air.extraData(Air.Bin, ty_pl.payload).data; |
| 745 | 745 | const pt = self.pt; |
| 746 | 746 | const zcu = pt.zcu; |
| ... | ... | @@ -825,7 +825,7 @@ fn airAggregateInit(self: *Self, inst: Air.Inst.Index) !void { |
| 825 | 825 | const zcu = pt.zcu; |
| 826 | 826 | const vector_ty = self.typeOfIndex(inst); |
| 827 | 827 | const len = vector_ty.vectorLen(zcu); |
| 828 | const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | |
| 828 | const ty_pl = self.air.instructions.items(.data)[@backingInt(inst)].ty_pl; | |
| 829 | 829 | const elements: []const Air.Inst.Ref = @ptrCast(self.air.extra.items[ty_pl.payload..][0..len]); |
| 830 | 830 | const result: MCValue = res: { |
| 831 | 831 | if (self.liveness.isUnused(inst)) break :res MCValue.dead; |
| ... | ... | @@ -850,7 +850,7 @@ fn airAlloc(self: *Self, inst: Air.Inst.Index) !void { |
| 850 | 850 | } |
| 851 | 851 | |
| 852 | 852 | fn airArrayElemVal(self: *Self, inst: Air.Inst.Index) !void { |
| 853 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 853 | const bin_op = self.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 854 | 854 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else return self.fail("TODO implement array_elem_val for {}", .{self.target.cpu.arch}); |
| 855 | 855 | return self.finishAir(inst, result, .{ bin_op.lhs, bin_op.rhs, .none }); |
| 856 | 856 | } |
| ... | ... | @@ -858,7 +858,7 @@ fn airArrayElemVal(self: *Self, inst: Air.Inst.Index) !void { |
| 858 | 858 | fn airArrayToSlice(self: *Self, inst: Air.Inst.Index) !void { |
| 859 | 859 | const pt = self.pt; |
| 860 | 860 | const zcu = pt.zcu; |
| 861 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 861 | const ty_op = self.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 862 | 862 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { |
| 863 | 863 | const ptr_ty = self.typeOf(ty_op.operand); |
| 864 | 864 | const ptr = try self.resolveInst(ty_op.operand); |
| ... | ... | @@ -993,7 +993,7 @@ fn airArg(self: *Self, inst: Air.Inst.Index) InnerError!void { |
| 993 | 993 | const func_zir = zcu.funcInfo(self.func_index).zir_body_inst.resolveFull(&zcu.intern_pool).?; |
| 994 | 994 | const file = zcu.fileByIndex(func_zir.file); |
| 995 | 995 | if (!file.mod.?.strip) { |
| 996 | const arg = self.air.instructions.items(.data)[@intFromEnum(inst)].arg; | |
| 996 | const arg = self.air.instructions.items(.data)[@backingInt(inst)].arg; | |
| 997 | 997 | const zir = &file.zir.?; |
| 998 | 998 | const name = zir.nullTerminatedString(zir.getParamName(zir.getParamBody(func_zir.inst)[arg.zir_param_index]).?); |
| 999 | 999 | |
| ... | ... | @@ -1015,7 +1015,7 @@ fn airArg(self: *Self, inst: Air.Inst.Index) InnerError!void { |
| 1015 | 1015 | } |
| 1016 | 1016 | |
| 1017 | 1017 | fn airAtomicLoad(self: *Self, inst: Air.Inst.Index) !void { |
| 1018 | _ = self.air.instructions.items(.data)[@intFromEnum(inst)].atomic_load; | |
| 1018 | _ = self.air.instructions.items(.data)[@backingInt(inst)].atomic_load; | |
| 1019 | 1019 | |
| 1020 | 1020 | return self.fail("TODO implement airAtomicLoad for {}", .{ |
| 1021 | 1021 | self.target.cpu.arch, |
| ... | ... | @@ -1023,7 +1023,7 @@ fn airAtomicLoad(self: *Self, inst: Air.Inst.Index) !void { |
| 1023 | 1023 | } |
| 1024 | 1024 | |
| 1025 | 1025 | fn airAtomicRmw(self: *Self, inst: Air.Inst.Index) !void { |
| 1026 | _ = self.air.instructions.items(.data)[@intFromEnum(inst)].pl_op; | |
| 1026 | _ = self.air.instructions.items(.data)[@backingInt(inst)].pl_op; | |
| 1027 | 1027 | |
| 1028 | 1028 | return self.fail("TODO implement airAtomicRmw for {}", .{ |
| 1029 | 1029 | self.target.cpu.arch, |
| ... | ... | @@ -1031,7 +1031,7 @@ fn airAtomicRmw(self: *Self, inst: Air.Inst.Index) !void { |
| 1031 | 1031 | } |
| 1032 | 1032 | |
| 1033 | 1033 | fn airBinOp(self: *Self, inst: Air.Inst.Index, tag: Air.Inst.Tag) !void { |
| 1034 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 1034 | const bin_op = self.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 1035 | 1035 | const lhs = try self.resolveInst(bin_op.lhs); |
| 1036 | 1036 | const rhs = try self.resolveInst(bin_op.rhs); |
| 1037 | 1037 | const lhs_ty = self.typeOf(bin_op.lhs); |
| ... | ... | @@ -1048,7 +1048,7 @@ fn airBinOp(self: *Self, inst: Air.Inst.Index, tag: Air.Inst.Tag) !void { |
| 1048 | 1048 | } |
| 1049 | 1049 | |
| 1050 | 1050 | fn airPtrArithmetic(self: *Self, inst: Air.Inst.Index, tag: Air.Inst.Tag) !void { |
| 1051 | const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | |
| 1051 | const ty_pl = self.air.instructions.items(.data)[@backingInt(inst)].ty_pl; | |
| 1052 | 1052 | const bin_op = self.air.extraData(Air.Bin, ty_pl.payload).data; |
| 1053 | 1053 | const lhs = try self.resolveInst(bin_op.lhs); |
| 1054 | 1054 | const rhs = try self.resolveInst(bin_op.rhs); |
| ... | ... | @@ -1066,7 +1066,7 @@ fn airPtrArithmetic(self: *Self, inst: Air.Inst.Index, tag: Air.Inst.Tag) !void |
| 1066 | 1066 | } |
| 1067 | 1067 | |
| 1068 | 1068 | fn airBitCast(self: *Self, inst: Air.Inst.Index) !void { |
| 1069 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 1069 | const ty_op = self.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 1070 | 1070 | const result = if (self.liveness.isUnused(inst)) .dead else result: { |
| 1071 | 1071 | const operand = try self.resolveInst(ty_op.operand); |
| 1072 | 1072 | if (self.reuseOperand(inst, ty_op.operand, 0, operand)) break :result operand; |
| ... | ... | @@ -1086,7 +1086,7 @@ fn airBitCast(self: *Self, inst: Air.Inst.Index) !void { |
| 1086 | 1086 | } |
| 1087 | 1087 | |
| 1088 | 1088 | fn airBitReverse(self: *Self, inst: Air.Inst.Index) !void { |
| 1089 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 1089 | const ty_op = self.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 1090 | 1090 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else return self.fail("TODO implement airBitReverse for {}", .{self.target.cpu.arch}); |
| 1091 | 1091 | return self.finishAir(inst, result, .{ ty_op.operand, .none, .none }); |
| 1092 | 1092 | } |
| ... | ... | @@ -1134,7 +1134,7 @@ fn lowerBlock(self: *Self, inst: Air.Inst.Index, body: []const Air.Inst.Index) ! |
| 1134 | 1134 | } |
| 1135 | 1135 | |
| 1136 | 1136 | fn airBr(self: *Self, inst: Air.Inst.Index) !void { |
| 1137 | const branch = self.air.instructions.items(.data)[@intFromEnum(inst)].br; | |
| 1137 | const branch = self.air.instructions.items(.data)[@backingInt(inst)].br; | |
| 1138 | 1138 | try self.br(branch.block_inst, branch.operand); |
| 1139 | 1139 | return self.finishAir(inst, .dead, .{ branch.operand, .none, .none }); |
| 1140 | 1140 | } |
| ... | ... | @@ -1172,7 +1172,7 @@ fn airBreakpoint(self: *Self) !void { |
| 1172 | 1172 | fn airByteSwap(self: *Self, inst: Air.Inst.Index) !void { |
| 1173 | 1173 | const pt = self.pt; |
| 1174 | 1174 | const zcu = pt.zcu; |
| 1175 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 1175 | const ty_op = self.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 1176 | 1176 | |
| 1177 | 1177 | // We have hardware byteswapper in SPARCv9, don't let mainstream compilers mislead you. |
| 1178 | 1178 | // That being said, the strategy to lower this is: |
| ... | ... | @@ -1359,13 +1359,13 @@ fn airCall(self: *Self, inst: Air.Inst.Index, modifier: std.lang.CallModifier) ! |
| 1359 | 1359 | } |
| 1360 | 1360 | |
| 1361 | 1361 | fn airClz(self: *Self, inst: Air.Inst.Index) !void { |
| 1362 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 1362 | const ty_op = self.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 1363 | 1363 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else return self.fail("TODO implement airClz for {}", .{self.target.cpu.arch}); |
| 1364 | 1364 | return self.finishAir(inst, result, .{ ty_op.operand, .none, .none }); |
| 1365 | 1365 | } |
| 1366 | 1366 | |
| 1367 | 1367 | fn airCmp(self: *Self, inst: Air.Inst.Index, op: math.CompareOperator) !void { |
| 1368 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 1368 | const bin_op = self.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 1369 | 1369 | const pt = self.pt; |
| 1370 | 1370 | const zcu = pt.zcu; |
| 1371 | 1371 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { |
| ... | ... | @@ -1423,7 +1423,7 @@ fn airCmp(self: *Self, inst: Air.Inst.Index, op: math.CompareOperator) !void { |
| 1423 | 1423 | } |
| 1424 | 1424 | |
| 1425 | 1425 | fn airCmpLteErrorsLen(self: *Self, inst: Air.Inst.Index) !void { |
| 1426 | const un_op = self.air.instructions.items(.data)[@intFromEnum(inst)].un_op; | |
| 1426 | const un_op = self.air.instructions.items(.data)[@backingInt(inst)].un_op; | |
| 1427 | 1427 | const operand = try self.resolveInst(un_op); |
| 1428 | 1428 | _ = operand; |
| 1429 | 1429 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else return self.fail("TODO implement airCmpLteErrorsLen for {}", .{self.target.cpu.arch}); |
| ... | ... | @@ -1584,7 +1584,7 @@ fn airCondBr(self: *Self, inst: Air.Inst.Index) !void { |
| 1584 | 1584 | } |
| 1585 | 1585 | |
| 1586 | 1586 | fn airCtz(self: *Self, inst: Air.Inst.Index) !void { |
| 1587 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 1587 | const ty_op = self.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 1588 | 1588 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else return self.fail("TODO implement airCtz for {}", .{self.target.cpu.arch}); |
| 1589 | 1589 | return self.finishAir(inst, result, .{ ty_op.operand, .none, .none }); |
| 1590 | 1590 | } |
| ... | ... | @@ -1596,7 +1596,7 @@ fn airDbgInlineBlock(self: *Self, inst: Air.Inst.Index) !void { |
| 1596 | 1596 | } |
| 1597 | 1597 | |
| 1598 | 1598 | fn airDbgStmt(self: *Self, inst: Air.Inst.Index) !void { |
| 1599 | const dbg_stmt = self.air.instructions.items(.data)[@intFromEnum(inst)].dbg_stmt; | |
| 1599 | const dbg_stmt = self.air.instructions.items(.data)[@backingInt(inst)].dbg_stmt; | |
| 1600 | 1600 | |
| 1601 | 1601 | _ = try self.addInst(.{ |
| 1602 | 1602 | .tag = .dbg_line, |
| ... | ... | @@ -1612,8 +1612,8 @@ fn airDbgStmt(self: *Self, inst: Air.Inst.Index) !void { |
| 1612 | 1612 | } |
| 1613 | 1613 | |
| 1614 | 1614 | fn airDbgVar(self: *Self, inst: Air.Inst.Index) !void { |
| 1615 | const pl_op = self.air.instructions.items(.data)[@intFromEnum(inst)].pl_op; | |
| 1616 | const name: Air.NullTerminatedString = @enumFromInt(pl_op.payload); | |
| 1615 | const pl_op = self.air.instructions.items(.data)[@backingInt(inst)].pl_op; | |
| 1616 | const name: Air.NullTerminatedString = @fromBackingInt(@intCast(pl_op.payload)); | |
| 1617 | 1617 | const operand = pl_op.operand; |
| 1618 | 1618 | // TODO emit debug info for this variable |
| 1619 | 1619 | _ = name; |
| ... | ... | @@ -1621,13 +1621,13 @@ fn airDbgVar(self: *Self, inst: Air.Inst.Index) !void { |
| 1621 | 1621 | } |
| 1622 | 1622 | |
| 1623 | 1623 | fn airDiv(self: *Self, inst: Air.Inst.Index) !void { |
| 1624 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 1624 | const bin_op = self.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 1625 | 1625 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else return self.fail("TODO implement div for {}", .{self.target.cpu.arch}); |
| 1626 | 1626 | return self.finishAir(inst, result, .{ bin_op.lhs, bin_op.rhs, .none }); |
| 1627 | 1627 | } |
| 1628 | 1628 | |
| 1629 | 1629 | fn airErrorName(self: *Self, inst: Air.Inst.Index) !void { |
| 1630 | const un_op = self.air.instructions.items(.data)[@intFromEnum(inst)].un_op; | |
| 1630 | const un_op = self.air.instructions.items(.data)[@backingInt(inst)].un_op; | |
| 1631 | 1631 | const operand = try self.resolveInst(un_op); |
| 1632 | 1632 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else { |
| 1633 | 1633 | _ = operand; |
| ... | ... | @@ -1637,13 +1637,13 @@ fn airErrorName(self: *Self, inst: Air.Inst.Index) !void { |
| 1637 | 1637 | } |
| 1638 | 1638 | |
| 1639 | 1639 | fn airErrUnionPayloadPtrSet(self: *Self, inst: Air.Inst.Index) !void { |
| 1640 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 1640 | const ty_op = self.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 1641 | 1641 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else return self.fail("TODO implement .errunion_payload_ptr_set for {}", .{self.target.cpu.arch}); |
| 1642 | 1642 | return self.finishAir(inst, result, .{ ty_op.operand, .none, .none }); |
| 1643 | 1643 | } |
| 1644 | 1644 | |
| 1645 | 1645 | fn airIntFromFloat(self: *Self, inst: Air.Inst.Index) !void { |
| 1646 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 1646 | const ty_op = self.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 1647 | 1647 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else return self.fail("TODO implement airIntFromFloat for {}", .{ |
| 1648 | 1648 | self.target.cpu.arch, |
| 1649 | 1649 | }); |
| ... | ... | @@ -1651,13 +1651,13 @@ fn airIntFromFloat(self: *Self, inst: Air.Inst.Index) !void { |
| 1651 | 1651 | } |
| 1652 | 1652 | |
| 1653 | 1653 | fn airGetUnionTag(self: *Self, inst: Air.Inst.Index) !void { |
| 1654 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 1654 | const ty_op = self.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 1655 | 1655 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else return self.fail("TODO implement airGetUnionTag for {}", .{self.target.cpu.arch}); |
| 1656 | 1656 | return self.finishAir(inst, result, .{ ty_op.operand, .none, .none }); |
| 1657 | 1657 | } |
| 1658 | 1658 | |
| 1659 | 1659 | fn airIntCast(self: *Self, inst: Air.Inst.Index) !void { |
| 1660 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 1660 | const ty_op = self.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 1661 | 1661 | if (self.liveness.isUnused(inst)) |
| 1662 | 1662 | return self.finishAir(inst, .dead, .{ ty_op.operand, .none, .none }); |
| 1663 | 1663 | |
| ... | ... | @@ -1677,7 +1677,7 @@ fn airIntCast(self: *Self, inst: Air.Inst.Index) !void { |
| 1677 | 1677 | } |
| 1678 | 1678 | |
| 1679 | 1679 | fn airFloatFromInt(self: *Self, inst: Air.Inst.Index) !void { |
| 1680 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 1680 | const ty_op = self.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 1681 | 1681 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else return self.fail("TODO implement airFloatFromInt for {}", .{ |
| 1682 | 1682 | self.target.cpu.arch, |
| 1683 | 1683 | }); |
| ... | ... | @@ -1685,7 +1685,7 @@ fn airFloatFromInt(self: *Self, inst: Air.Inst.Index) !void { |
| 1685 | 1685 | } |
| 1686 | 1686 | |
| 1687 | 1687 | fn airIsErr(self: *Self, inst: Air.Inst.Index) !void { |
| 1688 | const un_op = self.air.instructions.items(.data)[@intFromEnum(inst)].un_op; | |
| 1688 | const un_op = self.air.instructions.items(.data)[@backingInt(inst)].un_op; | |
| 1689 | 1689 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { |
| 1690 | 1690 | const operand = try self.resolveInst(un_op); |
| 1691 | 1691 | const ty = self.typeOf(un_op); |
| ... | ... | @@ -1695,7 +1695,7 @@ fn airIsErr(self: *Self, inst: Air.Inst.Index) !void { |
| 1695 | 1695 | } |
| 1696 | 1696 | |
| 1697 | 1697 | fn airIsNonErr(self: *Self, inst: Air.Inst.Index) !void { |
| 1698 | const un_op = self.air.instructions.items(.data)[@intFromEnum(inst)].un_op; | |
| 1698 | const un_op = self.air.instructions.items(.data)[@backingInt(inst)].un_op; | |
| 1699 | 1699 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { |
| 1700 | 1700 | const operand = try self.resolveInst(un_op); |
| 1701 | 1701 | const ty = self.typeOf(un_op); |
| ... | ... | @@ -1705,7 +1705,7 @@ fn airIsNonErr(self: *Self, inst: Air.Inst.Index) !void { |
| 1705 | 1705 | } |
| 1706 | 1706 | |
| 1707 | 1707 | fn airIsNull(self: *Self, inst: Air.Inst.Index) !void { |
| 1708 | const un_op = self.air.instructions.items(.data)[@intFromEnum(inst)].un_op; | |
| 1708 | const un_op = self.air.instructions.items(.data)[@backingInt(inst)].un_op; | |
| 1709 | 1709 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { |
| 1710 | 1710 | const operand = try self.resolveInst(un_op); |
| 1711 | 1711 | break :result try self.isNull(operand); |
| ... | ... | @@ -1714,7 +1714,7 @@ fn airIsNull(self: *Self, inst: Air.Inst.Index) !void { |
| 1714 | 1714 | } |
| 1715 | 1715 | |
| 1716 | 1716 | fn airIsNonNull(self: *Self, inst: Air.Inst.Index) !void { |
| 1717 | const un_op = self.air.instructions.items(.data)[@intFromEnum(inst)].un_op; | |
| 1717 | const un_op = self.air.instructions.items(.data)[@backingInt(inst)].un_op; | |
| 1718 | 1718 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { |
| 1719 | 1719 | const operand = try self.resolveInst(un_op); |
| 1720 | 1720 | break :result try self.isNonNull(operand); |
| ... | ... | @@ -1725,7 +1725,7 @@ fn airIsNonNull(self: *Self, inst: Air.Inst.Index) !void { |
| 1725 | 1725 | fn airLoad(self: *Self, inst: Air.Inst.Index) !void { |
| 1726 | 1726 | const pt = self.pt; |
| 1727 | 1727 | const zcu = pt.zcu; |
| 1728 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 1728 | const ty_op = self.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 1729 | 1729 | const elem_ty = self.typeOfIndex(inst); |
| 1730 | 1730 | const elem_size = elem_ty.abiSize(zcu); |
| 1731 | 1731 | const result: MCValue = result: { |
| ... | ... | @@ -1771,7 +1771,7 @@ fn airMemset(self: *Self, inst: Air.Inst.Index, safety: bool) !void { |
| 1771 | 1771 | } else { |
| 1772 | 1772 | // TODO if the value is undef, don't lower this instruction |
| 1773 | 1773 | } |
| 1774 | const pl_op = self.air.instructions.items(.data)[@intFromEnum(inst)].pl_op; | |
| 1774 | const pl_op = self.air.instructions.items(.data)[@backingInt(inst)].pl_op; | |
| 1775 | 1775 | const extra = self.air.extraData(Air.Bin, pl_op.payload); |
| 1776 | 1776 | |
| 1777 | 1777 | const operand = pl_op.operand; |
| ... | ... | @@ -1785,8 +1785,8 @@ fn airMemset(self: *Self, inst: Air.Inst.Index, safety: bool) !void { |
| 1785 | 1785 | } |
| 1786 | 1786 | |
| 1787 | 1787 | fn airMinMax(self: *Self, inst: Air.Inst.Index) !void { |
| 1788 | const tag = self.air.instructions.items(.tag)[@intFromEnum(inst)]; | |
| 1789 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 1788 | const tag = self.air.instructions.items(.tag)[@backingInt(inst)]; | |
| 1789 | const bin_op = self.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 1790 | 1790 | const lhs = try self.resolveInst(bin_op.lhs); |
| 1791 | 1791 | const rhs = try self.resolveInst(bin_op.rhs); |
| 1792 | 1792 | const lhs_ty = self.typeOf(bin_op.lhs); |
| ... | ... | @@ -1801,7 +1801,7 @@ fn airMinMax(self: *Self, inst: Air.Inst.Index) !void { |
| 1801 | 1801 | } |
| 1802 | 1802 | |
| 1803 | 1803 | fn airMod(self: *Self, inst: Air.Inst.Index) !void { |
| 1804 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 1804 | const bin_op = self.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 1805 | 1805 | const lhs = try self.resolveInst(bin_op.lhs); |
| 1806 | 1806 | const rhs = try self.resolveInst(bin_op.rhs); |
| 1807 | 1807 | const lhs_ty = self.typeOf(bin_op.lhs); |
| ... | ... | @@ -1939,14 +1939,14 @@ fn airMod(self: *Self, inst: Air.Inst.Index) !void { |
| 1939 | 1939 | } |
| 1940 | 1940 | |
| 1941 | 1941 | fn airMulSat(self: *Self, inst: Air.Inst.Index) !void { |
| 1942 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 1942 | const bin_op = self.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 1943 | 1943 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else return self.fail("TODO implement mul_sat for {}", .{self.target.cpu.arch}); |
| 1944 | 1944 | return self.finishAir(inst, result, .{ bin_op.lhs, bin_op.rhs, .none }); |
| 1945 | 1945 | } |
| 1946 | 1946 | |
| 1947 | 1947 | fn airMulWithOverflow(self: *Self, inst: Air.Inst.Index) !void { |
| 1948 | 1948 | //const tag = self.air.instructions.items(.tag)[@intFromEnum(inst)]; |
| 1949 | const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | |
| 1949 | const ty_pl = self.air.instructions.items(.data)[@backingInt(inst)].ty_pl; | |
| 1950 | 1950 | const extra = self.air.extraData(Air.Bin, ty_pl.payload).data; |
| 1951 | 1951 | const pt = self.pt; |
| 1952 | 1952 | const zcu = pt.zcu; |
| ... | ... | @@ -2012,7 +2012,7 @@ fn airMulWithOverflow(self: *Self, inst: Air.Inst.Index) !void { |
| 2012 | 2012 | } |
| 2013 | 2013 | |
| 2014 | 2014 | fn airNot(self: *Self, inst: Air.Inst.Index) !void { |
| 2015 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 2015 | const ty_op = self.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 2016 | 2016 | const pt = self.pt; |
| 2017 | 2017 | const zcu = pt.zcu; |
| 2018 | 2018 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { |
| ... | ... | @@ -2109,51 +2109,51 @@ fn airNot(self: *Self, inst: Air.Inst.Index) !void { |
| 2109 | 2109 | } |
| 2110 | 2110 | |
| 2111 | 2111 | fn airOptionalPayload(self: *Self, inst: Air.Inst.Index) !void { |
| 2112 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 2112 | const ty_op = self.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 2113 | 2113 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else return self.fail("TODO implement .optional_payload for {}", .{self.target.cpu.arch}); |
| 2114 | 2114 | return self.finishAir(inst, result, .{ ty_op.operand, .none, .none }); |
| 2115 | 2115 | } |
| 2116 | 2116 | |
| 2117 | 2117 | fn airOptionalPayloadPtr(self: *Self, inst: Air.Inst.Index) !void { |
| 2118 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 2118 | const ty_op = self.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 2119 | 2119 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else return self.fail("TODO implement .optional_payload_ptr for {}", .{self.target.cpu.arch}); |
| 2120 | 2120 | return self.finishAir(inst, result, .{ ty_op.operand, .none, .none }); |
| 2121 | 2121 | } |
| 2122 | 2122 | |
| 2123 | 2123 | fn airOptionalPayloadPtrSet(self: *Self, inst: Air.Inst.Index) !void { |
| 2124 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 2124 | const ty_op = self.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 2125 | 2125 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else return self.fail("TODO implement .optional_payload_ptr_set for {}", .{self.target.cpu.arch}); |
| 2126 | 2126 | return self.finishAir(inst, result, .{ ty_op.operand, .none, .none }); |
| 2127 | 2127 | } |
| 2128 | 2128 | |
| 2129 | 2129 | fn airPopcount(self: *Self, inst: Air.Inst.Index) !void { |
| 2130 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 2130 | const ty_op = self.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 2131 | 2131 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else return self.fail("TODO implement airPopcount for {}", .{self.target.cpu.arch}); |
| 2132 | 2132 | return self.finishAir(inst, result, .{ ty_op.operand, .none, .none }); |
| 2133 | 2133 | } |
| 2134 | 2134 | |
| 2135 | 2135 | fn airPrefetch(self: *Self, inst: Air.Inst.Index) !void { |
| 2136 | const prefetch = self.air.instructions.items(.data)[@intFromEnum(inst)].prefetch; | |
| 2136 | const prefetch = self.air.instructions.items(.data)[@backingInt(inst)].prefetch; | |
| 2137 | 2137 | // TODO Emit a PREFETCH/IPREFETCH as necessary, see A.7 and A.42 |
| 2138 | 2138 | return self.finishAir(inst, MCValue.dead, .{ prefetch.ptr, .none, .none }); |
| 2139 | 2139 | } |
| 2140 | 2140 | |
| 2141 | 2141 | fn airPtrElemVal(self: *Self, inst: Air.Inst.Index) !void { |
| 2142 | 2142 | const is_volatile = false; // TODO |
| 2143 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 2143 | const bin_op = self.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 2144 | 2144 | const result: MCValue = if (!is_volatile and self.liveness.isUnused(inst)) .dead else return self.fail("TODO implement ptr_elem_val for {}", .{self.target.cpu.arch}); |
| 2145 | 2145 | return self.finishAir(inst, result, .{ bin_op.lhs, bin_op.rhs, .none }); |
| 2146 | 2146 | } |
| 2147 | 2147 | |
| 2148 | 2148 | fn airPtrElemPtr(self: *Self, inst: Air.Inst.Index) !void { |
| 2149 | const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | |
| 2149 | const ty_pl = self.air.instructions.items(.data)[@backingInt(inst)].ty_pl; | |
| 2150 | 2150 | const extra = self.air.extraData(Air.Bin, ty_pl.payload).data; |
| 2151 | 2151 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else return self.fail("TODO implement ptr_elem_ptr for {}", .{self.target.cpu.arch}); |
| 2152 | 2152 | return self.finishAir(inst, result, .{ extra.lhs, extra.rhs, .none }); |
| 2153 | 2153 | } |
| 2154 | 2154 | |
| 2155 | 2155 | fn airPtrSliceLenPtr(self: *Self, inst: Air.Inst.Index) !void { |
| 2156 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 2156 | const ty_op = self.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 2157 | 2157 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { |
| 2158 | 2158 | const ptr_bits = self.target.ptrBitWidth(); |
| 2159 | 2159 | const ptr_bytes = @divExact(ptr_bits, 8); |
| ... | ... | @@ -2170,7 +2170,7 @@ fn airPtrSliceLenPtr(self: *Self, inst: Air.Inst.Index) !void { |
| 2170 | 2170 | } |
| 2171 | 2171 | |
| 2172 | 2172 | fn airPtrSlicePtrPtr(self: *Self, inst: Air.Inst.Index) !void { |
| 2173 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 2173 | const ty_op = self.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 2174 | 2174 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { |
| 2175 | 2175 | const mcv = try self.resolveInst(ty_op.operand); |
| 2176 | 2176 | switch (mcv) { |
| ... | ... | @@ -2185,7 +2185,7 @@ fn airPtrSlicePtrPtr(self: *Self, inst: Air.Inst.Index) !void { |
| 2185 | 2185 | } |
| 2186 | 2186 | |
| 2187 | 2187 | fn airRem(self: *Self, inst: Air.Inst.Index) !void { |
| 2188 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 2188 | const bin_op = self.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 2189 | 2189 | const lhs = try self.resolveInst(bin_op.lhs); |
| 2190 | 2190 | const rhs = try self.resolveInst(bin_op.rhs); |
| 2191 | 2191 | const lhs_ty = self.typeOf(bin_op.lhs); |
| ... | ... | @@ -2206,14 +2206,14 @@ fn airRem(self: *Self, inst: Air.Inst.Index) !void { |
| 2206 | 2206 | } |
| 2207 | 2207 | |
| 2208 | 2208 | fn airRet(self: *Self, inst: Air.Inst.Index) !void { |
| 2209 | const un_op = self.air.instructions.items(.data)[@intFromEnum(inst)].un_op; | |
| 2209 | const un_op = self.air.instructions.items(.data)[@backingInt(inst)].un_op; | |
| 2210 | 2210 | const operand = try self.resolveInst(un_op); |
| 2211 | 2211 | try self.ret(operand); |
| 2212 | 2212 | return self.finishAir(inst, .dead, .{ un_op, .none, .none }); |
| 2213 | 2213 | } |
| 2214 | 2214 | |
| 2215 | 2215 | fn airRetLoad(self: *Self, inst: Air.Inst.Index) !void { |
| 2216 | const un_op = self.air.instructions.items(.data)[@intFromEnum(inst)].un_op; | |
| 2216 | const un_op = self.air.instructions.items(.data)[@backingInt(inst)].un_op; | |
| 2217 | 2217 | const ptr = try self.resolveInst(un_op); |
| 2218 | 2218 | _ = ptr; |
| 2219 | 2219 | return self.fail("TODO implement airRetLoad for {}", .{self.target.cpu.arch}); |
| ... | ... | @@ -2226,14 +2226,14 @@ fn airRetPtr(self: *Self, inst: Air.Inst.Index) !void { |
| 2226 | 2226 | } |
| 2227 | 2227 | |
| 2228 | 2228 | fn airSetUnionTag(self: *Self, inst: Air.Inst.Index) !void { |
| 2229 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 2229 | const bin_op = self.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 2230 | 2230 | _ = bin_op; |
| 2231 | 2231 | return self.fail("TODO implement airSetUnionTag for {}", .{self.target.cpu.arch}); |
| 2232 | 2232 | } |
| 2233 | 2233 | |
| 2234 | 2234 | fn airShlSat(self: *Self, inst: Air.Inst.Index) !void { |
| 2235 | 2235 | const zcu = self.pt.zcu; |
| 2236 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 2236 | const bin_op = self.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 2237 | 2237 | const result: MCValue = if (self.liveness.isUnused(inst)) |
| 2238 | 2238 | .dead |
| 2239 | 2239 | else if (self.typeOf(bin_op.lhs).isVector(zcu) and !self.typeOf(bin_op.rhs).isVector(zcu)) |
| ... | ... | @@ -2244,7 +2244,7 @@ fn airShlSat(self: *Self, inst: Air.Inst.Index) !void { |
| 2244 | 2244 | } |
| 2245 | 2245 | |
| 2246 | 2246 | fn airShlWithOverflow(self: *Self, inst: Air.Inst.Index) !void { |
| 2247 | const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | |
| 2247 | const ty_pl = self.air.instructions.items(.data)[@backingInt(inst)].ty_pl; | |
| 2248 | 2248 | const extra = self.air.extraData(Air.Bin, ty_pl.payload).data; |
| 2249 | 2249 | const pt = self.pt; |
| 2250 | 2250 | const zcu = pt.zcu; |
| ... | ... | @@ -2338,7 +2338,7 @@ fn airShlWithOverflow(self: *Self, inst: Air.Inst.Index) !void { |
| 2338 | 2338 | } |
| 2339 | 2339 | |
| 2340 | 2340 | fn airSlice(self: *Self, inst: Air.Inst.Index) !void { |
| 2341 | const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | |
| 2341 | const ty_pl = self.air.instructions.items(.data)[@backingInt(inst)].ty_pl; | |
| 2342 | 2342 | const bin_op = self.air.extraData(Air.Bin, ty_pl.payload).data; |
| 2343 | 2343 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { |
| 2344 | 2344 | const ptr = try self.resolveInst(bin_op.lhs); |
| ... | ... | @@ -2358,7 +2358,7 @@ fn airSliceElemVal(self: *Self, inst: Air.Inst.Index) !void { |
| 2358 | 2358 | const pt = self.pt; |
| 2359 | 2359 | const zcu = pt.zcu; |
| 2360 | 2360 | const is_volatile = false; // TODO |
| 2361 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 2361 | const bin_op = self.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 2362 | 2362 | |
| 2363 | 2363 | if (!is_volatile and self.liveness.isUnused(inst)) return self.finishAir(inst, .dead, .{ bin_op.lhs, bin_op.rhs, .none }); |
| 2364 | 2364 | const result: MCValue = result: { |
| ... | ... | @@ -2400,7 +2400,7 @@ fn airSliceElemVal(self: *Self, inst: Air.Inst.Index) !void { |
| 2400 | 2400 | } |
| 2401 | 2401 | |
| 2402 | 2402 | fn airSliceLen(self: *Self, inst: Air.Inst.Index) !void { |
| 2403 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 2403 | const ty_op = self.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 2404 | 2404 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { |
| 2405 | 2405 | const ptr_bits = self.target.ptrBitWidth(); |
| 2406 | 2406 | const ptr_bytes = @divExact(ptr_bits, 8); |
| ... | ... | @@ -2421,7 +2421,7 @@ fn airSliceLen(self: *Self, inst: Air.Inst.Index) !void { |
| 2421 | 2421 | } |
| 2422 | 2422 | |
| 2423 | 2423 | fn airSlicePtr(self: *Self, inst: Air.Inst.Index) !void { |
| 2424 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 2424 | const ty_op = self.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 2425 | 2425 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { |
| 2426 | 2426 | const mcv = try self.resolveInst(ty_op.operand); |
| 2427 | 2427 | switch (mcv) { |
| ... | ... | @@ -2440,7 +2440,7 @@ fn airSlicePtr(self: *Self, inst: Air.Inst.Index) !void { |
| 2440 | 2440 | } |
| 2441 | 2441 | |
| 2442 | 2442 | fn airSplat(self: *Self, inst: Air.Inst.Index) !void { |
| 2443 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 2443 | const ty_op = self.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 2444 | 2444 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else return self.fail("TODO implement airSplat for {}", .{self.target.cpu.arch}); |
| 2445 | 2445 | return self.finishAir(inst, result, .{ ty_op.operand, .none, .none }); |
| 2446 | 2446 | } |
| ... | ... | @@ -2451,7 +2451,7 @@ fn airStore(self: *Self, inst: Air.Inst.Index, safety: bool) !void { |
| 2451 | 2451 | } else { |
| 2452 | 2452 | // TODO if the value is undef, don't lower this instruction |
| 2453 | 2453 | } |
| 2454 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 2454 | const bin_op = self.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 2455 | 2455 | const ptr = try self.resolveInst(bin_op.lhs); |
| 2456 | 2456 | const value = try self.resolveInst(bin_op.rhs); |
| 2457 | 2457 | const ptr_ty = self.typeOf(bin_op.lhs); |
| ... | ... | @@ -2463,20 +2463,20 @@ fn airStore(self: *Self, inst: Air.Inst.Index, safety: bool) !void { |
| 2463 | 2463 | } |
| 2464 | 2464 | |
| 2465 | 2465 | fn airStructFieldPtr(self: *Self, inst: Air.Inst.Index) !void { |
| 2466 | const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | |
| 2466 | const ty_pl = self.air.instructions.items(.data)[@backingInt(inst)].ty_pl; | |
| 2467 | 2467 | const extra = self.air.extraData(Air.StructField, ty_pl.payload).data; |
| 2468 | 2468 | const result = try self.structFieldPtr(inst, extra.struct_operand, extra.field_index); |
| 2469 | 2469 | return self.finishAir(inst, result, .{ extra.struct_operand, .none, .none }); |
| 2470 | 2470 | } |
| 2471 | 2471 | |
| 2472 | 2472 | fn airStructFieldPtrIndex(self: *Self, inst: Air.Inst.Index, index: u8) !void { |
| 2473 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 2473 | const ty_op = self.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 2474 | 2474 | const result = try self.structFieldPtr(inst, ty_op.operand, index); |
| 2475 | 2475 | return self.finishAir(inst, result, .{ ty_op.operand, .none, .none }); |
| 2476 | 2476 | } |
| 2477 | 2477 | |
| 2478 | 2478 | fn airAggFieldVal(self: *Self, inst: Air.Inst.Index) !void { |
| 2479 | const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | |
| 2479 | const ty_pl = self.air.instructions.items(.data)[@backingInt(inst)].ty_pl; | |
| 2480 | 2480 | const extra = self.air.extraData(Air.StructField, ty_pl.payload).data; |
| 2481 | 2481 | const operand = extra.struct_operand; |
| 2482 | 2482 | const index = extra.field_index; |
| ... | ... | @@ -2546,7 +2546,7 @@ fn airAggFieldVal(self: *Self, inst: Air.Inst.Index) !void { |
| 2546 | 2546 | } |
| 2547 | 2547 | |
| 2548 | 2548 | fn airSubSat(self: *Self, inst: Air.Inst.Index) !void { |
| 2549 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 2549 | const bin_op = self.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 2550 | 2550 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else return self.fail("TODO implement sub_sat for {}", .{self.target.cpu.arch}); |
| 2551 | 2551 | return self.finishAir(inst, result, .{ bin_op.lhs, bin_op.rhs, .none }); |
| 2552 | 2552 | } |
| ... | ... | @@ -2557,7 +2557,7 @@ fn airSwitch(self: *Self, inst: Air.Inst.Index) !void { |
| 2557 | 2557 | } |
| 2558 | 2558 | |
| 2559 | 2559 | fn airTagName(self: *Self, inst: Air.Inst.Index) !void { |
| 2560 | const un_op = self.air.instructions.items(.data)[@intFromEnum(inst)].un_op; | |
| 2560 | const un_op = self.air.instructions.items(.data)[@backingInt(inst)].un_op; | |
| 2561 | 2561 | const operand = try self.resolveInst(un_op); |
| 2562 | 2562 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else { |
| 2563 | 2563 | _ = operand; |
| ... | ... | @@ -2567,7 +2567,7 @@ fn airTagName(self: *Self, inst: Air.Inst.Index) !void { |
| 2567 | 2567 | } |
| 2568 | 2568 | |
| 2569 | 2569 | fn airTrunc(self: *Self, inst: Air.Inst.Index) !void { |
| 2570 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 2570 | const ty_op = self.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 2571 | 2571 | const operand = try self.resolveInst(ty_op.operand); |
| 2572 | 2572 | const operand_ty = self.typeOf(ty_op.operand); |
| 2573 | 2573 | const dest_ty = self.typeOfIndex(inst); |
| ... | ... | @@ -2597,7 +2597,7 @@ fn airTry(self: *Self, inst: Air.Inst.Index) !void { |
| 2597 | 2597 | } |
| 2598 | 2598 | |
| 2599 | 2599 | fn airUnaryMath(self: *Self, inst: Air.Inst.Index) !void { |
| 2600 | const un_op = self.air.instructions.items(.data)[@intFromEnum(inst)].un_op; | |
| 2600 | const un_op = self.air.instructions.items(.data)[@backingInt(inst)].un_op; | |
| 2601 | 2601 | const result: MCValue = if (self.liveness.isUnused(inst)) |
| 2602 | 2602 | .dead |
| 2603 | 2603 | else |
| ... | ... | @@ -2606,7 +2606,7 @@ fn airUnaryMath(self: *Self, inst: Air.Inst.Index) !void { |
| 2606 | 2606 | } |
| 2607 | 2607 | |
| 2608 | 2608 | fn airUnionInit(self: *Self, inst: Air.Inst.Index) !void { |
| 2609 | const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | |
| 2609 | const ty_pl = self.air.instructions.items(.data)[@backingInt(inst)].ty_pl; | |
| 2610 | 2610 | const extra = self.air.extraData(Air.UnionInit, ty_pl.payload).data; |
| 2611 | 2611 | _ = extra; |
| 2612 | 2612 | return self.fail("TODO implement airUnionInit for {}", .{self.target.cpu.arch}); |
| ... | ... | @@ -2615,7 +2615,7 @@ fn airUnionInit(self: *Self, inst: Air.Inst.Index) !void { |
| 2615 | 2615 | fn airUnwrapErrErr(self: *Self, inst: Air.Inst.Index) !void { |
| 2616 | 2616 | const pt = self.pt; |
| 2617 | 2617 | const zcu = pt.zcu; |
| 2618 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 2618 | const ty_op = self.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 2619 | 2619 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { |
| 2620 | 2620 | const error_union_ty = self.typeOf(ty_op.operand); |
| 2621 | 2621 | const payload_ty = error_union_ty.errorUnionPayload(zcu); |
| ... | ... | @@ -2630,7 +2630,7 @@ fn airUnwrapErrErr(self: *Self, inst: Air.Inst.Index) !void { |
| 2630 | 2630 | fn airUnwrapErrPayload(self: *Self, inst: Air.Inst.Index) !void { |
| 2631 | 2631 | const pt = self.pt; |
| 2632 | 2632 | const zcu = pt.zcu; |
| 2633 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 2633 | const ty_op = self.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 2634 | 2634 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { |
| 2635 | 2635 | const error_union_ty = self.typeOf(ty_op.operand); |
| 2636 | 2636 | const payload_ty = error_union_ty.errorUnionPayload(zcu); |
| ... | ... | @@ -2645,7 +2645,7 @@ fn airUnwrapErrPayload(self: *Self, inst: Air.Inst.Index) !void { |
| 2645 | 2645 | fn airWrapErrUnionErr(self: *Self, inst: Air.Inst.Index) !void { |
| 2646 | 2646 | const pt = self.pt; |
| 2647 | 2647 | const zcu = pt.zcu; |
| 2648 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 2648 | const ty_op = self.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 2649 | 2649 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { |
| 2650 | 2650 | const error_union_ty = ty_op.ty.toType(); |
| 2651 | 2651 | const payload_ty = error_union_ty.errorUnionPayload(zcu); |
| ... | ... | @@ -2659,14 +2659,14 @@ fn airWrapErrUnionErr(self: *Self, inst: Air.Inst.Index) !void { |
| 2659 | 2659 | |
| 2660 | 2660 | /// T to E!T |
| 2661 | 2661 | fn airWrapErrUnionPayload(self: *Self, inst: Air.Inst.Index) !void { |
| 2662 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 2662 | const ty_op = self.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 2663 | 2663 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else return self.fail("TODO implement wrap errunion payload for {}", .{self.target.cpu.arch}); |
| 2664 | 2664 | return self.finishAir(inst, result, .{ ty_op.operand, .none, .none }); |
| 2665 | 2665 | } |
| 2666 | 2666 | |
| 2667 | 2667 | fn airWrapOptional(self: *Self, inst: Air.Inst.Index) !void { |
| 2668 | 2668 | const pt = self.pt; |
| 2669 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 2669 | const ty_op = self.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 2670 | 2670 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { |
| 2671 | 2671 | const optional_ty = self.typeOfIndex(inst); |
| 2672 | 2672 | |
| ... | ... | @@ -4670,7 +4670,7 @@ fn trunc( |
| 4670 | 4670 | defer if (lock) |reg| self.register_manager.unlockReg(reg); |
| 4671 | 4671 | |
| 4672 | 4672 | const dest_reg = if (maybe_inst) |inst| blk: { |
| 4673 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 4673 | const ty_op = self.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 4674 | 4674 | |
| 4675 | 4675 | if (operand == .register and self.reuseOperand(inst, ty_op.operand, 0, operand)) { |
| 4676 | 4676 | break :blk operand_reg; |
src/codegen/sparc64/bits.zig+31-31| ... | ... | @@ -15,7 +15,7 @@ pub const Register = enum(u6) { |
| 15 | 15 | // zig fmt: on |
| 16 | 16 | |
| 17 | 17 | pub fn id(reg: Register) u5 { |
| 18 | return @truncate(@intFromEnum(reg)); | |
| 18 | return @truncate(@backingInt(reg)); | |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | pub fn enc(reg: Register) u5 { |
| ... | ... | @@ -95,9 +95,9 @@ pub const FloatingPointRegister = enum(u7) { |
| 95 | 95 | |
| 96 | 96 | pub fn id(self: FloatingPointRegister) u6 { |
| 97 | 97 | return switch (self.size()) { |
| 98 | 32 => @as(u6, @truncate(@intFromEnum(self))), | |
| 99 | 64 => @as(u6, @truncate((@intFromEnum(self) - 32) * 2)), | |
| 100 | 128 => @as(u6, @truncate((@intFromEnum(self) - 64) * 4)), | |
| 98 | 32 => @as(u6, @truncate(@backingInt(self))), | |
| 99 | 64 => @as(u6, @truncate((@backingInt(self) - 32) * 2)), | |
| 100 | 128 => @as(u6, @truncate((@backingInt(self) - 64) * 4)), | |
| 101 | 101 | else => unreachable, |
| 102 | 102 | }; |
| 103 | 103 | } |
| ... | ... | @@ -113,7 +113,7 @@ pub const FloatingPointRegister = enum(u7) { |
| 113 | 113 | |
| 114 | 114 | /// Returns the bit-width of the register. |
| 115 | 115 | pub fn size(self: FloatingPointRegister) u8 { |
| 116 | return switch (@intFromEnum(self)) { | |
| 116 | return switch (@backingInt(self)) { | |
| 117 | 117 | 0...31 => 32, |
| 118 | 118 | 32...63 => 64, |
| 119 | 119 | 64...79 => 128, |
| ... | ... | @@ -695,8 +695,8 @@ pub const Instruction = union(enum) { |
| 695 | 695 | /// Encodes the condition into the instruction bit pattern. |
| 696 | 696 | pub fn enc(cond: Condition) u4 { |
| 697 | 697 | return switch (cond) { |
| 698 | .icond => |c| @intFromEnum(c), | |
| 699 | .fcond => |c| @intFromEnum(c), | |
| 698 | .icond => |c| @backingInt(c), | |
| 699 | .fcond => |c| @backingInt(c), | |
| 700 | 700 | }; |
| 701 | 701 | } |
| 702 | 702 | |
| ... | ... | @@ -802,8 +802,8 @@ pub const Instruction = union(enum) { |
| 802 | 802 | // Discard the last two bits since those are implicitly zero. |
| 803 | 803 | const udisp_truncated = @as(u19, @truncate(udisp >> 2)); |
| 804 | 804 | |
| 805 | const ccr_cc1 = @as(u1, @truncate(@intFromEnum(ccr) >> 1)); | |
| 806 | const ccr_cc0 = @as(u1, @truncate(@intFromEnum(ccr))); | |
| 805 | const ccr_cc1 = @as(u1, @truncate(@backingInt(ccr) >> 1)); | |
| 806 | const ccr_cc0 = @as(u1, @truncate(@backingInt(ccr))); | |
| 807 | 807 | return Instruction{ |
| 808 | 808 | .format_2c = .{ |
| 809 | 809 | .a = @intFromBool(annul), |
| ... | ... | @@ -831,7 +831,7 @@ pub const Instruction = union(enum) { |
| 831 | 831 | return Instruction{ |
| 832 | 832 | .format_2d = .{ |
| 833 | 833 | .a = @intFromBool(annul), |
| 834 | .rcond = @intFromEnum(rcond), | |
| 834 | .rcond = @backingInt(rcond), | |
| 835 | 835 | .op2 = op2, |
| 836 | 836 | .p = @intFromBool(pt), |
| 837 | 837 | .rs1 = rs1.enc(), |
| ... | ... | @@ -890,7 +890,7 @@ pub const Instruction = union(enum) { |
| 890 | 890 | .rd = rd.enc(), |
| 891 | 891 | .op3 = op3, |
| 892 | 892 | .rs1 = rs1.enc(), |
| 893 | .rcond = @intFromEnum(rcond), | |
| 893 | .rcond = @backingInt(rcond), | |
| 894 | 894 | .rs2 = rs2.enc(), |
| 895 | 895 | }, |
| 896 | 896 | }; |
| ... | ... | @@ -902,7 +902,7 @@ pub const Instruction = union(enum) { |
| 902 | 902 | .rd = rd.enc(), |
| 903 | 903 | .op3 = op3, |
| 904 | 904 | .rs1 = rs1.enc(), |
| 905 | .rcond = @intFromEnum(rcond), | |
| 905 | .rcond = @backingInt(rcond), | |
| 906 | 906 | .simm10 = @as(u10, @bitCast(imm)), |
| 907 | 907 | }, |
| 908 | 908 | }; |
| ... | ... | @@ -933,7 +933,7 @@ pub const Instruction = union(enum) { |
| 933 | 933 | .rd = rd.enc(), |
| 934 | 934 | .op3 = op3, |
| 935 | 935 | .rs1 = rs1.enc(), |
| 936 | .imm_asi = @intFromEnum(asi), | |
| 936 | .imm_asi = @backingInt(asi), | |
| 937 | 937 | .rs2 = rs2.enc(), |
| 938 | 938 | }, |
| 939 | 939 | }; |
| ... | ... | @@ -955,7 +955,7 @@ pub const Instruction = union(enum) { |
| 955 | 955 | .rd = rd.enc(), |
| 956 | 956 | .op3 = op3, |
| 957 | 957 | .rs1 = rs1.enc(), |
| 958 | .x = @intFromEnum(sw), | |
| 958 | .x = @backingInt(sw), | |
| 959 | 959 | .rs2 = rs2.enc(), |
| 960 | 960 | }, |
| 961 | 961 | }; |
| ... | ... | @@ -994,8 +994,8 @@ pub const Instruction = union(enum) { |
| 994 | 994 | }; |
| 995 | 995 | } |
| 996 | 996 | fn format3o(op: u2, op3: u6, opf: u9, ccr: CCR, rs1: Register, rs2: Register) Instruction { |
| 997 | const ccr_cc1 = @as(u1, @truncate(@intFromEnum(ccr) >> 1)); | |
| 998 | const ccr_cc0 = @as(u1, @truncate(@intFromEnum(ccr))); | |
| 997 | const ccr_cc1 = @as(u1, @truncate(@backingInt(ccr) >> 1)); | |
| 998 | const ccr_cc0 = @as(u1, @truncate(@backingInt(ccr))); | |
| 999 | 999 | return Instruction{ |
| 1000 | 1000 | .format_3o = .{ |
| 1001 | 1001 | .op = op, |
| ... | ... | @@ -1050,8 +1050,8 @@ pub const Instruction = union(enum) { |
| 1050 | 1050 | } |
| 1051 | 1051 | |
| 1052 | 1052 | fn format4a(op3: u6, ccr: CCR, rs1: Register, rs2: Register, rd: Register) Instruction { |
| 1053 | const ccr_cc1 = @as(u1, @truncate(@intFromEnum(ccr) >> 1)); | |
| 1054 | const ccr_cc0 = @as(u1, @truncate(@intFromEnum(ccr))); | |
| 1053 | const ccr_cc1 = @as(u1, @truncate(@backingInt(ccr) >> 1)); | |
| 1054 | const ccr_cc0 = @as(u1, @truncate(@backingInt(ccr))); | |
| 1055 | 1055 | return Instruction{ |
| 1056 | 1056 | .format_4a = .{ |
| 1057 | 1057 | .rd = rd.enc(), |
| ... | ... | @@ -1065,8 +1065,8 @@ pub const Instruction = union(enum) { |
| 1065 | 1065 | } |
| 1066 | 1066 | |
| 1067 | 1067 | fn format4b(op3: u6, ccr: CCR, rs1: Register, imm: i11, rd: Register) Instruction { |
| 1068 | const ccr_cc1 = @as(u1, @truncate(@intFromEnum(ccr) >> 1)); | |
| 1069 | const ccr_cc0 = @as(u1, @truncate(@intFromEnum(ccr))); | |
| 1068 | const ccr_cc1 = @as(u1, @truncate(@backingInt(ccr) >> 1)); | |
| 1069 | const ccr_cc0 = @as(u1, @truncate(@backingInt(ccr))); | |
| 1070 | 1070 | return Instruction{ |
| 1071 | 1071 | .format_4b = .{ |
| 1072 | 1072 | .rd = rd.enc(), |
| ... | ... | @@ -1080,9 +1080,9 @@ pub const Instruction = union(enum) { |
| 1080 | 1080 | } |
| 1081 | 1081 | |
| 1082 | 1082 | fn format4c(op3: u6, cond: Condition, ccr: CCR, rs2: Register, rd: Register) Instruction { |
| 1083 | const ccr_cc2 = @as(u1, @truncate(@intFromEnum(ccr) >> 2)); | |
| 1084 | const ccr_cc1 = @as(u1, @truncate(@intFromEnum(ccr) >> 1)); | |
| 1085 | const ccr_cc0 = @as(u1, @truncate(@intFromEnum(ccr))); | |
| 1083 | const ccr_cc2 = @as(u1, @truncate(@backingInt(ccr) >> 2)); | |
| 1084 | const ccr_cc1 = @as(u1, @truncate(@backingInt(ccr) >> 1)); | |
| 1085 | const ccr_cc0 = @as(u1, @truncate(@backingInt(ccr))); | |
| 1086 | 1086 | return Instruction{ |
| 1087 | 1087 | .format_4c = .{ |
| 1088 | 1088 | .rd = rd.enc(), |
| ... | ... | @@ -1097,9 +1097,9 @@ pub const Instruction = union(enum) { |
| 1097 | 1097 | } |
| 1098 | 1098 | |
| 1099 | 1099 | fn format4d(op3: u6, cond: Condition, ccr: CCR, imm: i11, rd: Register) Instruction { |
| 1100 | const ccr_cc2 = @as(u1, @truncate(@intFromEnum(ccr) >> 2)); | |
| 1101 | const ccr_cc1 = @as(u1, @truncate(@intFromEnum(ccr) >> 1)); | |
| 1102 | const ccr_cc0 = @as(u1, @truncate(@intFromEnum(ccr))); | |
| 1100 | const ccr_cc2 = @as(u1, @truncate(@backingInt(ccr) >> 2)); | |
| 1101 | const ccr_cc1 = @as(u1, @truncate(@backingInt(ccr) >> 1)); | |
| 1102 | const ccr_cc0 = @as(u1, @truncate(@backingInt(ccr))); | |
| 1103 | 1103 | return Instruction{ |
| 1104 | 1104 | .format_4d = .{ |
| 1105 | 1105 | .rd = rd.enc(), |
| ... | ... | @@ -1114,8 +1114,8 @@ pub const Instruction = union(enum) { |
| 1114 | 1114 | } |
| 1115 | 1115 | |
| 1116 | 1116 | fn format4e(op3: u6, ccr: CCR, rs1: Register, rd: Register, sw_trap: u7) Instruction { |
| 1117 | const ccr_cc1 = @as(u1, @truncate(@intFromEnum(ccr) >> 1)); | |
| 1118 | const ccr_cc0 = @as(u1, @truncate(@intFromEnum(ccr))); | |
| 1117 | const ccr_cc1 = @as(u1, @truncate(@backingInt(ccr) >> 1)); | |
| 1118 | const ccr_cc0 = @as(u1, @truncate(@backingInt(ccr))); | |
| 1119 | 1119 | return Instruction{ |
| 1120 | 1120 | .format_4e = .{ |
| 1121 | 1121 | .rd = rd.enc(), |
| ... | ... | @@ -1141,7 +1141,7 @@ pub const Instruction = union(enum) { |
| 1141 | 1141 | .rd = rd.enc(), |
| 1142 | 1142 | .op3 = op3, |
| 1143 | 1143 | .rs1 = rs1.enc(), |
| 1144 | .rcond = @intFromEnum(rcond), | |
| 1144 | .rcond = @backingInt(rcond), | |
| 1145 | 1145 | .opf_low = opf_low, |
| 1146 | 1146 | .rs2 = rs2.enc(), |
| 1147 | 1147 | }, |
| ... | ... | @@ -1467,8 +1467,8 @@ pub const Instruction = union(enum) { |
| 1467 | 1467 | pub fn trap(comptime s2: type, cond: ICondition, ccr: CCR, rs1: Register, rs2: s2) Instruction { |
| 1468 | 1468 | // Tcc instructions abuse the rd field to store the conditionals. |
| 1469 | 1469 | return switch (s2) { |
| 1470 | Register => format4a(0b11_1010, ccr, rs1, rs2, @as(Register, @enumFromInt(@intFromEnum(cond)))), | |
| 1471 | u7 => format4e(0b11_1010, ccr, rs1, @as(Register, @enumFromInt(@intFromEnum(cond))), rs2), | |
| 1470 | Register => format4a(0b11_1010, ccr, rs1, rs2, @as(Register, @fromBackingInt(@intCast(@backingInt(cond))))), | |
| 1471 | u7 => format4e(0b11_1010, ccr, rs1, @as(Register, @fromBackingInt(@intCast(@backingInt(cond)))), rs2), | |
| 1472 | 1472 | else => unreachable, |
| 1473 | 1473 | }; |
| 1474 | 1474 | } |
src/codegen/spirv/Assembler.zig+10-10| ... | ... | @@ -267,7 +267,7 @@ fn processTypeInstruction(ass: *Assembler) !AsmValue { |
| 267 | 267 | break :blk result_id; |
| 268 | 268 | }, |
| 269 | 269 | .OpTypePointer => blk: { |
| 270 | const storage_class: StorageClass = @enumFromInt(operands[1].value); | |
| 270 | const storage_class: StorageClass = @fromBackingInt(@intCast(operands[1].value)); | |
| 271 | 271 | const child_type = try ass.resolveRefId(operands[2].ref_id); |
| 272 | 272 | const result_id = cg.allocId(); |
| 273 | 273 | try section.emit(cg.gpa, .OpTypePointer, .{ |
| ... | ... | @@ -290,12 +290,12 @@ fn processTypeInstruction(ass: *Assembler) !AsmValue { |
| 290 | 290 | try section.emit(gpa, .OpTypeImage, .{ |
| 291 | 291 | .id_result = result_id, |
| 292 | 292 | .sampled_type = sampled_type, |
| 293 | .dim = @enumFromInt(operands[2].value), | |
| 293 | .dim = @fromBackingInt(@intCast(operands[2].value)), | |
| 294 | 294 | .depth = operands[3].literal32, |
| 295 | 295 | .arrayed = operands[4].literal32, |
| 296 | 296 | .ms = operands[5].literal32, |
| 297 | 297 | .sampled = operands[6].literal32, |
| 298 | .image_format = @enumFromInt(operands[7].value), | |
| 298 | .image_format = @fromBackingInt(@intCast(operands[7].value)), | |
| 299 | 299 | }); |
| 300 | 300 | break :blk result_id; |
| 301 | 301 | }, |
| ... | ... | @@ -350,7 +350,7 @@ fn processGenericInstruction(ass: *Assembler) !?AsmValue { |
| 350 | 350 | .OpEntryPoint => unreachable, |
| 351 | 351 | .OpExecutionMode, .OpExecutionModeId => &cg.sections.execution_modes, |
| 352 | 352 | .OpVariable => section: { |
| 353 | const storage_class: spec.StorageClass = @enumFromInt(operands[2].value); | |
| 353 | const storage_class: spec.StorageClass = @fromBackingInt(@intCast(operands[2].value)); | |
| 354 | 354 | if (storage_class == .function) break :section &ass.cg.prologue; |
| 355 | 355 | maybe_spv_decl_index = try cg.allocDecl(.global); |
| 356 | 356 | if (!target.cpu.has(.spirv, .v1_4) and storage_class != .input and storage_class != .output) { |
| ... | ... | @@ -404,7 +404,7 @@ fn processGenericInstruction(ass: *Assembler) !?AsmValue { |
| 404 | 404 | } |
| 405 | 405 | |
| 406 | 406 | const actual_word_count = section.instructions.items.len - first_word; |
| 407 | section.instructions.items[first_word] |= @as(u32, @as(u16, @intCast(actual_word_count))) << 16 | @intFromEnum(ass.inst.opcode); | |
| 407 | section.instructions.items[first_word] |= @as(u32, @as(u16, @intCast(actual_word_count))) << 16 | @backingInt(ass.inst.opcode); | |
| 408 | 408 | |
| 409 | 409 | switch (ass.inst.opcode) { |
| 410 | 410 | .OpKill, |
| ... | ... | @@ -487,7 +487,7 @@ fn processSpecConstVector(ass: *Assembler) !?AsmValue { |
| 487 | 487 | }; |
| 488 | 488 | try annotations.emitRaw(gpa, .OpDecorate, 3); |
| 489 | 489 | annotations.writeOperand(Id, elem_id); |
| 490 | annotations.writeWord(@intFromEnum(spec.Decoration.spec_id)); | |
| 490 | annotations.writeWord(@backingInt(spec.Decoration.spec_id)); | |
| 491 | 491 | annotations.writeWord(spec_id_word); |
| 492 | 492 | } |
| 493 | 493 | |
| ... | ... | @@ -561,7 +561,7 @@ fn parseInstruction(ass: *Assembler) !void { |
| 561 | 561 | }; |
| 562 | 562 | |
| 563 | 563 | const inst = spec.InstructionSet.core.instructions()[index]; |
| 564 | ass.inst.opcode = @enumFromInt(inst.opcode); | |
| 564 | ass.inst.opcode = @fromBackingInt(@intCast(inst.opcode)); | |
| 565 | 565 | |
| 566 | 566 | const expected_operands = inst.operands; |
| 567 | 567 | // This is a loop because the result-id is not always the first operand. |
| ... | ... | @@ -855,16 +855,16 @@ fn parseContextDependentNumber(ass: *Assembler) !void { |
| 855 | 855 | var offset: usize = 0; |
| 856 | 856 | while (offset < words.len) { |
| 857 | 857 | const word_count = words[offset] >> 16; |
| 858 | const opcode: Opcode = @enumFromInt(words[offset] & 0xFFFF); | |
| 858 | const opcode: Opcode = @fromBackingInt(@intCast(words[offset] & 0xFFFF)); | |
| 859 | 859 | defer offset += word_count; |
| 860 | 860 | if (word_count == 0) break; |
| 861 | 861 | switch (opcode) { |
| 862 | .OpTypeInt => if (word_count >= 4 and @as(Id, @enumFromInt(words[offset + 1])) == result_id) { | |
| 862 | .OpTypeInt => if (word_count >= 4 and @as(Id, @fromBackingInt(@intCast(words[offset + 1]))) == result_id) { | |
| 863 | 863 | const width: u16 = @intCast(words[offset + 2]); |
| 864 | 864 | const signedness: std.lang.Signedness = if (words[offset + 3] == 0) .unsigned else .signed; |
| 865 | 865 | return ass.parseContextDependentInt(signedness, width); |
| 866 | 866 | }, |
| 867 | .OpTypeFloat => if (word_count >= 3 and @as(Id, @enumFromInt(words[offset + 1])) == result_id) { | |
| 867 | .OpTypeFloat => if (word_count >= 3 and @as(Id, @fromBackingInt(@intCast(words[offset + 1]))) == result_id) { | |
| 868 | 868 | const bits = words[offset + 2]; |
| 869 | 869 | return switch (bits) { |
| 870 | 870 | 16 => ass.parseContextDependentFloat(16), |
src/codegen/spirv/CodeGen.zig+89-89| ... | ... | @@ -432,11 +432,11 @@ pub fn addEntryPointDeps( |
| 432 | 432 | const decl = cg.declPtr(decl_index); |
| 433 | 433 | const deps = cg.decl_deps.items[decl.begin_dep..decl.end_dep]; |
| 434 | 434 | |
| 435 | if (seen.isSet(@intFromEnum(decl_index))) { | |
| 435 | if (seen.isSet(@backingInt(decl_index))) { | |
| 436 | 436 | return; |
| 437 | 437 | } |
| 438 | 438 | |
| 439 | seen.set(@intFromEnum(decl_index)); | |
| 439 | seen.set(@backingInt(decl_index)); | |
| 440 | 440 | |
| 441 | 441 | if (decl.kind == .global) { |
| 442 | 442 | try interface.append(cg.gpa, decl.result_id); |
| ... | ... | @@ -778,11 +778,11 @@ pub fn allocDecl(cg: *CodeGen, kind: Decl.Kind) !Decl.Index { |
| 778 | 778 | .result_id = cg.allocId(), |
| 779 | 779 | }); |
| 780 | 780 | |
| 781 | return @as(Decl.Index, @enumFromInt(@as(u32, @intCast(cg.decls.items.len - 1)))); | |
| 781 | return @as(Decl.Index, @fromBackingInt(@intCast(@as(u32, @intCast(cg.decls.items.len - 1))))); | |
| 782 | 782 | } |
| 783 | 783 | |
| 784 | 784 | pub fn declPtr(cg: *CodeGen, index: Decl.Index) *Decl { |
| 785 | return &cg.decls.items[@intFromEnum(index)]; | |
| 785 | return &cg.decls.items[@backingInt(index)]; | |
| 786 | 786 | } |
| 787 | 787 | |
| 788 | 788 | pub fn debugName(cg: *CodeGen, target: Id, name: []const u8) !void { |
| ... | ... | @@ -1054,7 +1054,7 @@ pub fn genNav(cg: *CodeGen, do_codegen: bool) Error!void { |
| 1054 | 1054 | .id_result_type = ptr_ty_id, |
| 1055 | 1055 | .id_result = result_id, |
| 1056 | 1056 | .set = try cg.importInstructionSet(.zig), |
| 1057 | .instruction = .{ .inst = @intFromEnum(spec.Zig.InvocationGlobal) }, | |
| 1057 | .instruction = .{ .inst = @backingInt(spec.Zig.InvocationGlobal) }, | |
| 1058 | 1058 | .id_ref_4 = &.{initializer_id}, |
| 1059 | 1059 | }); |
| 1060 | 1060 | }, |
| ... | ... | @@ -1269,14 +1269,14 @@ fn resolveUav(cg: *CodeGen, val: InternPool.Index) !Id { |
| 1269 | 1269 | try cg.sections.functions.append(gpa, cg.prologue); |
| 1270 | 1270 | try cg.sections.functions.append(gpa, cg.body); |
| 1271 | 1271 | |
| 1272 | try cg.debugNameFmt(initializer_id, "initializer of __anon_{d}", .{@intFromEnum(val)}); | |
| 1272 | try cg.debugNameFmt(initializer_id, "initializer of __anon_{d}", .{@backingInt(val)}); | |
| 1273 | 1273 | |
| 1274 | 1274 | const fn_decl_ptr_ty_id = try cg.ptrType(ty_id, .function); |
| 1275 | 1275 | try cg.sections.globals.emit(gpa, .OpExtInst, .{ |
| 1276 | 1276 | .id_result_type = fn_decl_ptr_ty_id, |
| 1277 | 1277 | .id_result = result_id, |
| 1278 | 1278 | .set = try cg.importInstructionSet(.zig), |
| 1279 | .instruction = .{ .inst = @intFromEnum(spec.Zig.InvocationGlobal) }, | |
| 1279 | .instruction = .{ .inst = @backingInt(spec.Zig.InvocationGlobal) }, | |
| 1280 | 1280 | .id_ref_4 = &.{initializer_id}, |
| 1281 | 1281 | }); |
| 1282 | 1282 | } |
| ... | ... | @@ -2760,7 +2760,7 @@ const Temporary = struct { |
| 2760 | 2760 | // If the value is a scalar, then this is a no-op. |
| 2761 | 2761 | if (!temp.ty.isVector(zcu)) { |
| 2762 | 2762 | return switch (temp.value) { |
| 2763 | .singleton => |id| .{ .base = @intFromEnum(id), .len = 1 }, | |
| 2763 | .singleton => |id| .{ .base = @backingInt(id), .len = 1 }, | |
| 2764 | 2764 | .exploded_vector => |range| range, |
| 2765 | 2765 | }; |
| 2766 | 2766 | } |
| ... | ... | @@ -3367,7 +3367,7 @@ const CompositeInt = struct { |
| 3367 | 3367 | .id_result_type = limb_ty_id, |
| 3368 | 3368 | .id_result = hi, |
| 3369 | 3369 | .set = set, |
| 3370 | .instruction = .{ .inst = @intFromEnum(spec.OpenClOpcode.u_mul_hi) }, | |
| 3370 | .instruction = .{ .inst = @backingInt(spec.OpenClOpcode.u_mul_hi) }, | |
| 3371 | 3371 | .id_ref_4 = &.{ ci.limbs[i], other.limbs[j] }, |
| 3372 | 3372 | }); |
| 3373 | 3373 | }, |
| ... | ... | @@ -3805,7 +3805,7 @@ const UnaryOp = enum { |
| 3805 | 3805 | |
| 3806 | 3806 | pub fn extInstOpcode(op: UnaryOp, target: *const std.Target) ?u32 { |
| 3807 | 3807 | return switch (target.os.tag) { |
| 3808 | .opencl => @intFromEnum(@as(spec.OpenClOpcode, switch (op) { | |
| 3808 | .opencl => @backingInt(@as(spec.OpenClOpcode, switch (op) { | |
| 3809 | 3809 | .i_abs => .s_abs, |
| 3810 | 3810 | .f_abs => .fabs, |
| 3811 | 3811 | .clz => .clz, |
| ... | ... | @@ -3828,7 +3828,7 @@ const UnaryOp = enum { |
| 3828 | 3828 | // Note: We'll need to check these for floating point accuracy |
| 3829 | 3829 | // Vulkan does not put tight requirements on these, for correction |
| 3830 | 3830 | // we might want to emulate them at some point. |
| 3831 | .vulkan, .opengl => @intFromEnum(@as(spec.GlslOpcode, switch (op) { | |
| 3831 | .vulkan, .opengl => @backingInt(@as(spec.GlslOpcode, switch (op) { | |
| 3832 | 3832 | .i_abs => .SAbs, |
| 3833 | 3833 | .f_abs => .FAbs, |
| 3834 | 3834 | .floor => .Floor, |
| ... | ... | @@ -3970,7 +3970,7 @@ fn buildWideMul( |
| 3970 | 3970 | .id_result_type = arith_op_ty_id, |
| 3971 | 3971 | .id_result = overflow_results.at(i), |
| 3972 | 3972 | .set = set, |
| 3973 | .instruction = .{ .inst = @intFromEnum(overflow_inst) }, | |
| 3973 | .instruction = .{ .inst = @backingInt(overflow_inst) }, | |
| 3974 | 3974 | .id_ref_4 = &.{ lhs_op.at(i), rhs_op.at(i) }, |
| 3975 | 3975 | }); |
| 3976 | 3976 | } |
| ... | ... | @@ -4355,7 +4355,7 @@ fn genInst(cg: *CodeGen, inst: Air.Inst.Index) Error!void { |
| 4355 | 4355 | return; |
| 4356 | 4356 | |
| 4357 | 4357 | const air_tags = cg.air.instructions.items(.tag); |
| 4358 | const maybe_result_id: ?Id = switch (air_tags[@intFromEnum(inst)]) { | |
| 4358 | const maybe_result_id: ?Id = switch (air_tags[@backingInt(inst)]) { | |
| 4359 | 4359 | // zig fmt: off |
| 4360 | 4360 | .add, .add_wrap, .add_optimized => try cg.airArithOp(inst, .OpFAdd, .OpIAdd, .OpIAdd), |
| 4361 | 4361 | .sub, .sub_wrap, .sub_optimized => try cg.airArithOp(inst, .OpFSub, .OpISub, .OpISub), |
| ... | ... | @@ -4535,7 +4535,7 @@ fn genInst(cg: *CodeGen, inst: Air.Inst.Index) Error!void { |
| 4535 | 4535 | } |
| 4536 | 4536 | |
| 4537 | 4537 | fn airBinOpSimple(cg: *CodeGen, inst: Air.Inst.Index, op: Opcode) !?Id { |
| 4538 | const bin_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 4538 | const bin_op = cg.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 4539 | 4539 | const lhs = try cg.temporary(bin_op.lhs); |
| 4540 | 4540 | const rhs = try cg.temporary(bin_op.rhs); |
| 4541 | 4541 | |
| ... | ... | @@ -4546,7 +4546,7 @@ fn airBinOpSimple(cg: *CodeGen, inst: Air.Inst.Index, op: Opcode) !?Id { |
| 4546 | 4546 | const BitwiseOp = enum { bit_and, bit_or, xor }; |
| 4547 | 4547 | |
| 4548 | 4548 | fn airBitwiseOp(cg: *CodeGen, inst: Air.Inst.Index, op: BitwiseOp) !?Id { |
| 4549 | const bin_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 4549 | const bin_op = cg.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 4550 | 4550 | const lhs = try cg.temporary(bin_op.lhs); |
| 4551 | 4551 | const rhs = try cg.temporary(bin_op.rhs); |
| 4552 | 4552 | const info = cg.arithmeticTypeInfo(lhs.ty); |
| ... | ... | @@ -4587,7 +4587,7 @@ fn airBitwiseOp(cg: *CodeGen, inst: Air.Inst.Index, op: BitwiseOp) !?Id { |
| 4587 | 4587 | |
| 4588 | 4588 | fn airShift(cg: *CodeGen, inst: Air.Inst.Index, unsigned: Opcode, signed: Opcode) !?Id { |
| 4589 | 4589 | const zcu = cg.zcu; |
| 4590 | const bin_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 4590 | const bin_op = cg.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 4591 | 4591 | |
| 4592 | 4592 | const base = try cg.temporary(bin_op.lhs); |
| 4593 | 4593 | const shift = try cg.temporary(bin_op.rhs); |
| ... | ... | @@ -4661,7 +4661,7 @@ const MinMax = enum { |
| 4661 | 4661 | info: ArithmeticTypeInfo, |
| 4662 | 4662 | ) u32 { |
| 4663 | 4663 | return switch (target.os.tag) { |
| 4664 | .opencl => @intFromEnum(@as(spec.OpenClOpcode, switch (info.class) { | |
| 4664 | .opencl => @backingInt(@as(spec.OpenClOpcode, switch (info.class) { | |
| 4665 | 4665 | .float => switch (op) { |
| 4666 | 4666 | .min => .fmin, |
| 4667 | 4667 | .max => .fmax, |
| ... | ... | @@ -4678,7 +4678,7 @@ const MinMax = enum { |
| 4678 | 4678 | }, |
| 4679 | 4679 | .bool => unreachable, |
| 4680 | 4680 | })), |
| 4681 | .vulkan, .opengl => @intFromEnum(@as(spec.GlslOpcode, switch (info.class) { | |
| 4681 | .vulkan, .opengl => @backingInt(@as(spec.GlslOpcode, switch (info.class) { | |
| 4682 | 4682 | .float => switch (op) { |
| 4683 | 4683 | .min => .FMin, |
| 4684 | 4684 | .max => .FMax, |
| ... | ... | @@ -4701,7 +4701,7 @@ const MinMax = enum { |
| 4701 | 4701 | }; |
| 4702 | 4702 | |
| 4703 | 4703 | fn airMinMax(cg: *CodeGen, inst: Air.Inst.Index, op: MinMax) !?Id { |
| 4704 | const bin_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 4704 | const bin_op = cg.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 4705 | 4705 | |
| 4706 | 4706 | const lhs = try cg.temporary(bin_op.lhs); |
| 4707 | 4707 | const rhs = try cg.temporary(bin_op.rhs); |
| ... | ... | @@ -4781,7 +4781,7 @@ fn normalize(cg: *CodeGen, value: Temporary, info: ArithmeticTypeInfo) !Temporar |
| 4781 | 4781 | } |
| 4782 | 4782 | |
| 4783 | 4783 | fn airDivFloor(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 4784 | const bin_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 4784 | const bin_op = cg.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 4785 | 4785 | |
| 4786 | 4786 | const lhs = try cg.temporary(bin_op.lhs); |
| 4787 | 4787 | const rhs = try cg.temporary(bin_op.rhs); |
| ... | ... | @@ -4822,7 +4822,7 @@ fn airDivFloor(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 4822 | 4822 | } |
| 4823 | 4823 | |
| 4824 | 4824 | fn airDivTrunc(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 4825 | const bin_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 4825 | const bin_op = cg.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 4826 | 4826 | const lhs = try cg.temporary(bin_op.lhs); |
| 4827 | 4827 | const rhs = try cg.temporary(bin_op.rhs); |
| 4828 | 4828 | const info = cg.arithmeticTypeInfo(lhs.ty); |
| ... | ... | @@ -4848,7 +4848,7 @@ fn airDivTrunc(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 4848 | 4848 | } |
| 4849 | 4849 | |
| 4850 | 4850 | fn airUnOpSimple(cg: *CodeGen, inst: Air.Inst.Index, op: UnaryOp) !?Id { |
| 4851 | const un_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].un_op; | |
| 4851 | const un_op = cg.air.instructions.items(.data)[@backingInt(inst)].un_op; | |
| 4852 | 4852 | const operand = try cg.temporary(un_op); |
| 4853 | 4853 | const result = try cg.buildUnary(op, operand); |
| 4854 | 4854 | return try result.materialize(cg); |
| ... | ... | @@ -4861,7 +4861,7 @@ fn airArithOp( |
| 4861 | 4861 | comptime sop: Opcode, |
| 4862 | 4862 | comptime uop: Opcode, |
| 4863 | 4863 | ) !?Id { |
| 4864 | const bin_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 4864 | const bin_op = cg.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 4865 | 4865 | const lhs = try cg.temporary(bin_op.lhs); |
| 4866 | 4866 | const rhs = try cg.temporary(bin_op.rhs); |
| 4867 | 4867 | const info = cg.arithmeticTypeInfo(lhs.ty); |
| ... | ... | @@ -4898,7 +4898,7 @@ fn airArithOp( |
| 4898 | 4898 | fn airAbs(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 4899 | 4899 | const zcu = cg.zcu; |
| 4900 | 4900 | const target = zcu.getTarget(); |
| 4901 | const ty_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 4901 | const ty_op = cg.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 4902 | 4902 | const value = try cg.temporary(ty_op.operand); |
| 4903 | 4903 | // Note: operand_ty may be signed, while ty is always unsigned. |
| 4904 | 4904 | const result_ty = cg.typeOfIndex(inst); |
| ... | ... | @@ -4970,7 +4970,7 @@ fn airAddSubOverflow( |
| 4970 | 4970 | |
| 4971 | 4971 | _ = s_opcode; |
| 4972 | 4972 | |
| 4973 | const ty_pl = cg.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | |
| 4973 | const ty_pl = cg.air.instructions.items(.data)[@backingInt(inst)].ty_pl; | |
| 4974 | 4974 | const extra = cg.air.extraData(Air.Bin, ty_pl.payload).data; |
| 4975 | 4975 | const lhs = try cg.temporary(extra.lhs); |
| 4976 | 4976 | const rhs = try cg.temporary(extra.rhs); |
| ... | ... | @@ -5087,7 +5087,7 @@ fn airAddSubOverflow( |
| 5087 | 5087 | fn airMulOverflow(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 5088 | 5088 | const pt = cg.pt; |
| 5089 | 5089 | const gpa = cg.gpa; |
| 5090 | const ty_pl = cg.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | |
| 5090 | const ty_pl = cg.air.instructions.items(.data)[@backingInt(inst)].ty_pl; | |
| 5091 | 5091 | const extra = cg.air.extraData(Air.Bin, ty_pl.payload).data; |
| 5092 | 5092 | const lhs = try cg.temporary(extra.lhs); |
| 5093 | 5093 | const rhs = try cg.temporary(extra.rhs); |
| ... | ... | @@ -5416,7 +5416,7 @@ fn airMulOverflow(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 5416 | 5416 | fn airShlOverflow(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 5417 | 5417 | const zcu = cg.zcu; |
| 5418 | 5418 | |
| 5419 | const ty_pl = cg.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | |
| 5419 | const ty_pl = cg.air.instructions.items(.data)[@backingInt(inst)].ty_pl; | |
| 5420 | 5420 | const extra = cg.air.extraData(Air.Bin, ty_pl.payload).data; |
| 5421 | 5421 | |
| 5422 | 5422 | const base = try cg.temporary(extra.lhs); |
| ... | ... | @@ -5451,7 +5451,7 @@ fn airShlOverflow(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 5451 | 5451 | } |
| 5452 | 5452 | |
| 5453 | 5453 | fn airMulAdd(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 5454 | const pl_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].pl_op; | |
| 5454 | const pl_op = cg.air.instructions.items(.data)[@backingInt(inst)].pl_op; | |
| 5455 | 5455 | const extra = cg.air.extraData(Air.Bin, pl_op.payload).data; |
| 5456 | 5456 | |
| 5457 | 5457 | const a = try cg.temporary(extra.lhs); |
| ... | ... | @@ -5479,10 +5479,10 @@ fn airMulAdd(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 5479 | 5479 | |
| 5480 | 5480 | const set = try cg.importExtendedSet(); |
| 5481 | 5481 | const opcode: u32 = switch (target.os.tag) { |
| 5482 | .opencl => @intFromEnum(spec.OpenClOpcode.fma), | |
| 5482 | .opencl => @backingInt(spec.OpenClOpcode.fma), | |
| 5483 | 5483 | // NOTE: Vulkan's FMA does not meet Zig's nor OpenCL's precision guarantees and needs |
| 5484 | 5484 | // to be emulated. |
| 5485 | .vulkan, .opengl => @intFromEnum(spec.GlslOpcode.Fma), | |
| 5485 | .vulkan, .opengl => @backingInt(spec.GlslOpcode.Fma), | |
| 5486 | 5486 | else => unreachable, |
| 5487 | 5487 | }; |
| 5488 | 5488 | |
| ... | ... | @@ -5504,7 +5504,7 @@ fn airClzCtz(cg: *CodeGen, inst: Air.Inst.Index, op: UnaryOp) !?Id { |
| 5504 | 5504 | if (cg.liveness.isUnused(inst)) return null; |
| 5505 | 5505 | |
| 5506 | 5506 | const zcu = cg.zcu; |
| 5507 | const ty_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 5507 | const ty_op = cg.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 5508 | 5508 | const operand = try cg.temporary(ty_op.operand); |
| 5509 | 5509 | |
| 5510 | 5510 | const scalar_result_ty = cg.typeOfIndex(inst).scalarType(zcu); |
| ... | ... | @@ -5526,7 +5526,7 @@ fn airClzCtz(cg: *CodeGen, inst: Air.Inst.Index, op: UnaryOp) !?Id { |
| 5526 | 5526 | } |
| 5527 | 5527 | |
| 5528 | 5528 | fn airSelect(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 5529 | const pl_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].pl_op; | |
| 5529 | const pl_op = cg.air.instructions.items(.data)[@backingInt(inst)].pl_op; | |
| 5530 | 5530 | const extra = cg.air.extraData(Air.Bin, pl_op.payload).data; |
| 5531 | 5531 | const pred = try cg.temporary(pl_op.operand); |
| 5532 | 5532 | const a = try cg.temporary(extra.lhs); |
| ... | ... | @@ -5537,7 +5537,7 @@ fn airSelect(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 5537 | 5537 | } |
| 5538 | 5538 | |
| 5539 | 5539 | fn airSplat(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 5540 | const ty_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 5540 | const ty_op = cg.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 5541 | 5541 | |
| 5542 | 5542 | const operand_id = try cg.resolve(ty_op.operand); |
| 5543 | 5543 | const result_ty = cg.typeOfIndex(inst); |
| ... | ... | @@ -5547,7 +5547,7 @@ fn airSplat(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 5547 | 5547 | |
| 5548 | 5548 | fn airReduce(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 5549 | 5549 | const zcu = cg.zcu; |
| 5550 | const reduce = cg.air.instructions.items(.data)[@intFromEnum(inst)].reduce; | |
| 5550 | const reduce = cg.air.instructions.items(.data)[@backingInt(inst)].reduce; | |
| 5551 | 5551 | const operand = try cg.resolve(reduce.operand); |
| 5552 | 5552 | const operand_ty = cg.typeOf(reduce.operand); |
| 5553 | 5553 | const scalar_ty = operand_ty.scalarType(zcu); |
| ... | ... | @@ -5763,7 +5763,7 @@ fn ptrAdd(cg: *CodeGen, result_ty: Type, ptr_ty: Type, ptr_id: Id, offset_id: Id |
| 5763 | 5763 | } |
| 5764 | 5764 | |
| 5765 | 5765 | fn airPtrAdd(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 5766 | const ty_pl = cg.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | |
| 5766 | const ty_pl = cg.air.instructions.items(.data)[@backingInt(inst)].ty_pl; | |
| 5767 | 5767 | const bin_op = cg.air.extraData(Air.Bin, ty_pl.payload).data; |
| 5768 | 5768 | const ptr_id = try cg.resolve(bin_op.lhs); |
| 5769 | 5769 | const offset_id = try cg.resolve(bin_op.rhs); |
| ... | ... | @@ -5774,7 +5774,7 @@ fn airPtrAdd(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 5774 | 5774 | } |
| 5775 | 5775 | |
| 5776 | 5776 | fn airPtrSub(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 5777 | const ty_pl = cg.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | |
| 5777 | const ty_pl = cg.air.instructions.items(.data)[@backingInt(inst)].ty_pl; | |
| 5778 | 5778 | const bin_op = cg.air.extraData(Air.Bin, ty_pl.payload).data; |
| 5779 | 5779 | const ptr_id = try cg.resolve(bin_op.lhs); |
| 5780 | 5780 | const ptr_ty = cg.typeOf(bin_op.lhs); |
| ... | ... | @@ -5979,7 +5979,7 @@ fn airCmp( |
| 5979 | 5979 | inst: Air.Inst.Index, |
| 5980 | 5980 | comptime op: std.math.CompareOperator, |
| 5981 | 5981 | ) !?Id { |
| 5982 | const bin_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 5982 | const bin_op = cg.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 5983 | 5983 | const lhs = try cg.temporary(bin_op.lhs); |
| 5984 | 5984 | const rhs = try cg.temporary(bin_op.rhs); |
| 5985 | 5985 | |
| ... | ... | @@ -5988,7 +5988,7 @@ fn airCmp( |
| 5988 | 5988 | } |
| 5989 | 5989 | |
| 5990 | 5990 | fn airVectorCmp(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 5991 | const ty_pl = cg.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | |
| 5991 | const ty_pl = cg.air.instructions.items(.data)[@backingInt(inst)].ty_pl; | |
| 5992 | 5992 | const vec_cmp = cg.air.extraData(Air.VectorCmp, ty_pl.payload).data; |
| 5993 | 5993 | const lhs = try cg.temporary(vec_cmp.lhs); |
| 5994 | 5994 | const rhs = try cg.temporary(vec_cmp.rhs); |
| ... | ... | @@ -6126,7 +6126,7 @@ fn bitCast( |
| 6126 | 6126 | } |
| 6127 | 6127 | |
| 6128 | 6128 | fn airBitCast(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 6129 | const ty_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 6129 | const ty_op = cg.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 6130 | 6130 | const operand_ty = cg.typeOf(ty_op.operand); |
| 6131 | 6131 | const result_ty = cg.typeOfIndex(inst); |
| 6132 | 6132 | if (operand_ty.toIntern() == .bool_type) { |
| ... | ... | @@ -6145,7 +6145,7 @@ fn airBitCast(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 6145 | 6145 | } |
| 6146 | 6146 | |
| 6147 | 6147 | fn airIntCast(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 6148 | const ty_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 6148 | const ty_op = cg.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 6149 | 6149 | const src = try cg.temporary(ty_op.operand); |
| 6150 | 6150 | const dst_ty = cg.typeOfIndex(inst); |
| 6151 | 6151 | |
| ... | ... | @@ -6391,7 +6391,7 @@ fn intFromPtr(cg: *CodeGen, operand_id: Id) !Id { |
| 6391 | 6391 | |
| 6392 | 6392 | fn airFloatFromInt(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 6393 | 6393 | const gpa = cg.gpa; |
| 6394 | const ty_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 6394 | const ty_op = cg.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 6395 | 6395 | const operand_ty = cg.typeOf(ty_op.operand); |
| 6396 | 6396 | const operand_id = try cg.resolve(ty_op.operand); |
| 6397 | 6397 | const result_ty = cg.typeOfIndex(inst); |
| ... | ... | @@ -6415,7 +6415,7 @@ fn airFloatFromInt(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 6415 | 6415 | |
| 6416 | 6416 | fn airIntFromFloat(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 6417 | 6417 | const gpa = cg.gpa; |
| 6418 | const ty_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 6418 | const ty_op = cg.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 6419 | 6419 | const operand_id = try cg.resolve(ty_op.operand); |
| 6420 | 6420 | const result_ty = cg.typeOfIndex(inst); |
| 6421 | 6421 | const result_info = cg.arithmeticTypeInfo(result_ty); |
| ... | ... | @@ -6437,7 +6437,7 @@ fn airIntFromFloat(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 6437 | 6437 | } |
| 6438 | 6438 | |
| 6439 | 6439 | fn airFloatCast(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 6440 | const ty_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 6440 | const ty_op = cg.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 6441 | 6441 | const operand = try cg.temporary(ty_op.operand); |
| 6442 | 6442 | const dest_ty = cg.typeOfIndex(inst); |
| 6443 | 6443 | const result = try cg.buildConvert(dest_ty, operand); |
| ... | ... | @@ -6445,7 +6445,7 @@ fn airFloatCast(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 6445 | 6445 | } |
| 6446 | 6446 | |
| 6447 | 6447 | fn airNot(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 6448 | const ty_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 6448 | const ty_op = cg.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 6449 | 6449 | const operand = try cg.temporary(ty_op.operand); |
| 6450 | 6450 | const result_ty = cg.typeOfIndex(inst); |
| 6451 | 6451 | const info = cg.arithmeticTypeInfo(result_ty); |
| ... | ... | @@ -6473,7 +6473,7 @@ fn airNot(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 6473 | 6473 | |
| 6474 | 6474 | fn airArrayToSlice(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 6475 | 6475 | const zcu = cg.zcu; |
| 6476 | const ty_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 6476 | const ty_op = cg.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 6477 | 6477 | const array_ptr_ty = cg.typeOf(ty_op.operand); |
| 6478 | 6478 | const array_ty = array_ptr_ty.childType(zcu); |
| 6479 | 6479 | const slice_ty = cg.typeOfIndex(inst); |
| ... | ... | @@ -6496,7 +6496,7 @@ fn airArrayToSlice(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 6496 | 6496 | } |
| 6497 | 6497 | |
| 6498 | 6498 | fn airSlice(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 6499 | const ty_pl = cg.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | |
| 6499 | const ty_pl = cg.air.instructions.items(.data)[@backingInt(inst)].ty_pl; | |
| 6500 | 6500 | const bin_op = cg.air.extraData(Air.Bin, ty_pl.payload).data; |
| 6501 | 6501 | const ptr_id = try cg.resolve(bin_op.lhs); |
| 6502 | 6502 | const len_id = try cg.resolve(bin_op.rhs); |
| ... | ... | @@ -6511,7 +6511,7 @@ fn airAggregateInit(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 6511 | 6511 | const zcu = cg.zcu; |
| 6512 | 6512 | const ip = &zcu.intern_pool; |
| 6513 | 6513 | const target = cg.zcu.getTarget(); |
| 6514 | const ty_pl = cg.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | |
| 6514 | const ty_pl = cg.air.instructions.items(.data)[@backingInt(inst)].ty_pl; | |
| 6515 | 6515 | const result_ty = cg.typeOfIndex(inst); |
| 6516 | 6516 | const len: usize = @intCast(result_ty.arrayLen(zcu)); |
| 6517 | 6517 | const elements: []const Air.Inst.Ref = @ptrCast(cg.air.extra.items[ty_pl.payload..][0..len]); |
| ... | ... | @@ -6645,7 +6645,7 @@ fn sliceOrArrayPtr(cg: *CodeGen, operand_id: Id, ty: Type) !Id { |
| 6645 | 6645 | } |
| 6646 | 6646 | |
| 6647 | 6647 | fn airMemcpy(cg: *CodeGen, inst: Air.Inst.Index) !void { |
| 6648 | const bin_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 6648 | const bin_op = cg.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 6649 | 6649 | const dest_slice = try cg.resolve(bin_op.lhs); |
| 6650 | 6650 | const src_slice = try cg.resolve(bin_op.rhs); |
| 6651 | 6651 | const dest_ty = cg.typeOf(bin_op.lhs); |
| ... | ... | @@ -6675,7 +6675,7 @@ fn airMemmove(cg: *CodeGen, inst: Air.Inst.Index) !void { |
| 6675 | 6675 | } |
| 6676 | 6676 | |
| 6677 | 6677 | fn airSliceField(cg: *CodeGen, inst: Air.Inst.Index, field: u32) !?Id { |
| 6678 | const ty_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 6678 | const ty_op = cg.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 6679 | 6679 | const field_ty = cg.typeOfIndex(inst); |
| 6680 | 6680 | const operand_id = try cg.resolve(ty_op.operand); |
| 6681 | 6681 | return try cg.extractField(field_ty, operand_id, field); |
| ... | ... | @@ -6683,7 +6683,7 @@ fn airSliceField(cg: *CodeGen, inst: Air.Inst.Index, field: u32) !?Id { |
| 6683 | 6683 | |
| 6684 | 6684 | fn airSpirvRuntimeArrayLen(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 6685 | 6685 | const gpa = cg.gpa; |
| 6686 | const ty_pl = cg.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | |
| 6686 | const ty_pl = cg.air.instructions.items(.data)[@backingInt(inst)].ty_pl; | |
| 6687 | 6687 | const extra = cg.air.extraData(Air.StructField, ty_pl.payload).data; |
| 6688 | 6688 | const struct_ptr_id = try cg.resolve(extra.struct_operand); |
| 6689 | 6689 | const u32_ty_id = try cg.intType(.unsigned, 32); |
| ... | ... | @@ -6699,7 +6699,7 @@ fn airSpirvRuntimeArrayLen(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 6699 | 6699 | |
| 6700 | 6700 | fn airSliceElemPtr(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 6701 | 6701 | const zcu = cg.zcu; |
| 6702 | const ty_pl = cg.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | |
| 6702 | const ty_pl = cg.air.instructions.items(.data)[@backingInt(inst)].ty_pl; | |
| 6703 | 6703 | const bin_op = cg.air.extraData(Air.Bin, ty_pl.payload).data; |
| 6704 | 6704 | const slice_ty = cg.typeOf(bin_op.lhs); |
| 6705 | 6705 | if (!slice_ty.isVolatilePtr(zcu) and cg.liveness.isUnused(inst)) return null; |
| ... | ... | @@ -6716,7 +6716,7 @@ fn airSliceElemPtr(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 6716 | 6716 | |
| 6717 | 6717 | fn airSliceElemVal(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 6718 | 6718 | const zcu = cg.zcu; |
| 6719 | const bin_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 6719 | const bin_op = cg.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 6720 | 6720 | const slice_ty = cg.typeOf(bin_op.lhs); |
| 6721 | 6721 | if (!slice_ty.isVolatilePtr(zcu) and cg.liveness.isUnused(inst)) return null; |
| 6722 | 6722 | |
| ... | ... | @@ -6749,7 +6749,7 @@ fn ptrElemPtr(cg: *CodeGen, ptr_ty: Type, ptr_id: Id, index_id: Id) !Id { |
| 6749 | 6749 | |
| 6750 | 6750 | fn airPtrElemPtr(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 6751 | 6751 | const zcu = cg.zcu; |
| 6752 | const ty_pl = cg.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | |
| 6752 | const ty_pl = cg.air.instructions.items(.data)[@backingInt(inst)].ty_pl; | |
| 6753 | 6753 | const bin_op = cg.air.extraData(Air.Bin, ty_pl.payload).data; |
| 6754 | 6754 | const src_ptr_ty = cg.typeOf(bin_op.lhs); |
| 6755 | 6755 | const elem_ty = src_ptr_ty.childType(zcu); |
| ... | ... | @@ -6764,7 +6764,7 @@ fn airPtrElemPtr(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 6764 | 6764 | fn airArrayElemVal(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 6765 | 6765 | const gpa = cg.gpa; |
| 6766 | 6766 | const zcu = cg.zcu; |
| 6767 | const bin_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 6767 | const bin_op = cg.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 6768 | 6768 | const array_ty = cg.typeOf(bin_op.lhs); |
| 6769 | 6769 | const elem_ty = array_ty.childType(zcu); |
| 6770 | 6770 | const array_id = try cg.resolve(bin_op.lhs); |
| ... | ... | @@ -6815,7 +6815,7 @@ fn airArrayElemVal(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 6815 | 6815 | |
| 6816 | 6816 | fn airPtrElemVal(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 6817 | 6817 | const zcu = cg.zcu; |
| 6818 | const bin_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 6818 | const bin_op = cg.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 6819 | 6819 | const ptr_ty = cg.typeOf(bin_op.lhs); |
| 6820 | 6820 | const elem_ty = cg.typeOfIndex(inst); |
| 6821 | 6821 | const ptr_id = try cg.resolve(bin_op.lhs); |
| ... | ... | @@ -6826,7 +6826,7 @@ fn airPtrElemVal(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 6826 | 6826 | |
| 6827 | 6827 | fn airSetUnionTag(cg: *CodeGen, inst: Air.Inst.Index) !void { |
| 6828 | 6828 | const zcu = cg.zcu; |
| 6829 | const bin_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 6829 | const bin_op = cg.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 6830 | 6830 | const un_ptr_ty = cg.typeOf(bin_op.lhs); |
| 6831 | 6831 | const un_ty = un_ptr_ty.childType(zcu); |
| 6832 | 6832 | const layout = cg.unionLayout(un_ty); |
| ... | ... | @@ -6849,7 +6849,7 @@ fn airSetUnionTag(cg: *CodeGen, inst: Air.Inst.Index) !void { |
| 6849 | 6849 | } |
| 6850 | 6850 | |
| 6851 | 6851 | fn airGetUnionTag(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 6852 | const ty_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 6852 | const ty_op = cg.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 6853 | 6853 | const un_ty = cg.typeOf(ty_op.operand); |
| 6854 | 6854 | |
| 6855 | 6855 | const zcu = cg.zcu; |
| ... | ... | @@ -6937,7 +6937,7 @@ fn unionInit( |
| 6937 | 6937 | fn airUnionInit(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 6938 | 6938 | const zcu = cg.zcu; |
| 6939 | 6939 | const ip = &zcu.intern_pool; |
| 6940 | const ty_pl = cg.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | |
| 6940 | const ty_pl = cg.air.instructions.items(.data)[@backingInt(inst)].ty_pl; | |
| 6941 | 6941 | const extra = cg.air.extraData(Air.UnionInit, ty_pl.payload).data; |
| 6942 | 6942 | const ty = cg.typeOfIndex(inst); |
| 6943 | 6943 | |
| ... | ... | @@ -6953,7 +6953,7 @@ fn airUnionInit(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 6953 | 6953 | fn airAggFieldVal(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 6954 | 6954 | const pt = cg.pt; |
| 6955 | 6955 | const zcu = cg.zcu; |
| 6956 | const ty_pl = cg.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | |
| 6956 | const ty_pl = cg.air.instructions.items(.data)[@backingInt(inst)].ty_pl; | |
| 6957 | 6957 | const struct_field = cg.air.extraData(Air.StructField, ty_pl.payload).data; |
| 6958 | 6958 | |
| 6959 | 6959 | const object_ty = cg.typeOf(struct_field.struct_operand); |
| ... | ... | @@ -7058,7 +7058,7 @@ fn airAggFieldVal(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 7058 | 7058 | fn airFieldParentPtr(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 7059 | 7059 | const zcu = cg.zcu; |
| 7060 | 7060 | const target = zcu.getTarget(); |
| 7061 | const ty_pl = cg.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | |
| 7061 | const ty_pl = cg.air.instructions.items(.data)[@backingInt(inst)].ty_pl; | |
| 7062 | 7062 | const extra = cg.air.extraData(Air.FieldParentPtr, ty_pl.payload).data; |
| 7063 | 7063 | |
| 7064 | 7064 | const parent_ptr_ty = ty_pl.ty.toType(); |
| ... | ... | @@ -7190,7 +7190,7 @@ fn structFieldPtr( |
| 7190 | 7190 | } |
| 7191 | 7191 | |
| 7192 | 7192 | fn airStructFieldPtr(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 7193 | const ty_pl = cg.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | |
| 7193 | const ty_pl = cg.air.instructions.items(.data)[@backingInt(inst)].ty_pl; | |
| 7194 | 7194 | const struct_field = cg.air.extraData(Air.StructField, ty_pl.payload).data; |
| 7195 | 7195 | const struct_ptr = try cg.resolve(struct_field.struct_operand); |
| 7196 | 7196 | const struct_ptr_ty = cg.typeOf(struct_field.struct_operand); |
| ... | ... | @@ -7199,7 +7199,7 @@ fn airStructFieldPtr(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 7199 | 7199 | } |
| 7200 | 7200 | |
| 7201 | 7201 | fn airStructFieldPtrIndex(cg: *CodeGen, inst: Air.Inst.Index, field_index: u32) !?Id { |
| 7202 | const ty_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 7202 | const ty_op = cg.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 7203 | 7203 | const struct_ptr = try cg.resolve(ty_op.operand); |
| 7204 | 7204 | const struct_ptr_ty = cg.typeOf(ty_op.operand); |
| 7205 | 7205 | const result_ptr_ty = cg.typeOfIndex(inst); |
| ... | ... | @@ -7437,7 +7437,7 @@ fn lowerBlock(cg: *CodeGen, inst: Air.Inst.Index, body: []const Air.Inst.Index) |
| 7437 | 7437 | assert(cg.block_stack.items.len > 0); |
| 7438 | 7438 | |
| 7439 | 7439 | // Check if the target of the branch was this current block. |
| 7440 | const this_block = try cg.constInt(.u32, @intFromEnum(inst)); | |
| 7440 | const this_block = try cg.constInt(.u32, @backingInt(inst)); | |
| 7441 | 7441 | const jump_to_this_block_id = cg.allocId(); |
| 7442 | 7442 | const bool_ty_id = try cg.resolveType(.bool, .direct); |
| 7443 | 7443 | try cg.body.emit(gpa, .OpIEqual, .{ |
| ... | ... | @@ -7506,7 +7506,7 @@ fn lowerBlock(cg: *CodeGen, inst: Air.Inst.Index, body: []const Air.Inst.Index) |
| 7506 | 7506 | |
| 7507 | 7507 | fn airBr(cg: *CodeGen, inst: Air.Inst.Index) !void { |
| 7508 | 7508 | const zcu = cg.zcu; |
| 7509 | const br = cg.air.instructions.items(.data)[@intFromEnum(inst)].br; | |
| 7509 | const br = cg.air.instructions.items(.data)[@backingInt(inst)].br; | |
| 7510 | 7510 | const operand_ty = cg.typeOf(br.operand); |
| 7511 | 7511 | |
| 7512 | 7512 | if (operand_ty.hasRuntimeBits(zcu)) { |
| ... | ... | @@ -7515,7 +7515,7 @@ fn airBr(cg: *CodeGen, inst: Air.Inst.Index) !void { |
| 7515 | 7515 | try cg.store(operand_ty, block_result_var_id, operand_id, .{}); |
| 7516 | 7516 | } |
| 7517 | 7517 | |
| 7518 | const next_block = try cg.constInt(.u32, @intFromEnum(br.block_inst)); | |
| 7518 | const next_block = try cg.constInt(.u32, @backingInt(br.block_inst)); | |
| 7519 | 7519 | try cg.structuredBreak(next_block); |
| 7520 | 7520 | } |
| 7521 | 7521 | |
| ... | ... | @@ -7611,7 +7611,7 @@ fn airLoop(cg: *CodeGen, inst: Air.Inst.Index) !void { |
| 7611 | 7611 | fn airLoad(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 7612 | 7612 | const zcu = cg.zcu; |
| 7613 | 7613 | const pt = cg.pt; |
| 7614 | const ty_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 7614 | const ty_op = cg.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 7615 | 7615 | const ptr_ty = cg.typeOf(ty_op.operand); |
| 7616 | 7616 | const ptr_info = ptr_ty.ptrInfo(zcu); |
| 7617 | 7617 | const elem_ty = cg.typeOfIndex(inst); |
| ... | ... | @@ -7655,7 +7655,7 @@ fn airLoad(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 7655 | 7655 | try cg.resolveType(elem_ty, .indirect), |
| 7656 | 7656 | cg.storageClass(ptr_info.flags.address_space), |
| 7657 | 7657 | ); |
| 7658 | break :ptr_id try cg.accessChain(elem_ptr_ty_id, operand_ptr_id, &.{@intFromEnum(index)}); | |
| 7658 | break :ptr_id try cg.accessChain(elem_ptr_ty_id, operand_ptr_id, &.{@backingInt(index)}); | |
| 7659 | 7659 | }, |
| 7660 | 7660 | }; |
| 7661 | 7661 | return try cg.load(elem_ty, ptr_id, .{ |
| ... | ... | @@ -7667,7 +7667,7 @@ fn airLoad(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 7667 | 7667 | fn airStore(cg: *CodeGen, inst: Air.Inst.Index) !void { |
| 7668 | 7668 | const zcu = cg.zcu; |
| 7669 | 7669 | const pt = cg.pt; |
| 7670 | const bin_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 7670 | const bin_op = cg.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 7671 | 7671 | const ptr_ty = cg.typeOf(bin_op.lhs); |
| 7672 | 7672 | const ptr_info = ptr_ty.ptrInfo(zcu); |
| 7673 | 7673 | const elem_ty: Type = .fromInterned(ptr_info.child); |
| ... | ... | @@ -7729,7 +7729,7 @@ fn airStore(cg: *CodeGen, inst: Air.Inst.Index) !void { |
| 7729 | 7729 | try cg.resolveType(elem_ty, .indirect), |
| 7730 | 7730 | cg.storageClass(ptr_info.flags.address_space), |
| 7731 | 7731 | ); |
| 7732 | break :ptr_id try cg.accessChain(elem_ptr_ty_id, operand_ptr_id, &.{@intFromEnum(index)}); | |
| 7732 | break :ptr_id try cg.accessChain(elem_ptr_ty_id, operand_ptr_id, &.{@backingInt(index)}); | |
| 7733 | 7733 | }, |
| 7734 | 7734 | }; |
| 7735 | 7735 | |
| ... | ... | @@ -7742,7 +7742,7 @@ fn airStore(cg: *CodeGen, inst: Air.Inst.Index) !void { |
| 7742 | 7742 | fn airRet(cg: *CodeGen, inst: Air.Inst.Index) !void { |
| 7743 | 7743 | const gpa = cg.gpa; |
| 7744 | 7744 | const zcu = cg.zcu; |
| 7745 | const operand = cg.air.instructions.items(.data)[@intFromEnum(inst)].un_op; | |
| 7745 | const operand = cg.air.instructions.items(.data)[@backingInt(inst)].un_op; | |
| 7746 | 7746 | const ret_ty = cg.typeOf(operand); |
| 7747 | 7747 | if (!ret_ty.hasRuntimeBits(zcu)) { |
| 7748 | 7748 | const fn_info = zcu.typeToFunc(zcu.navValue(cg.owner_nav).typeOf(zcu)).?; |
| ... | ... | @@ -7764,7 +7764,7 @@ fn airRet(cg: *CodeGen, inst: Air.Inst.Index) !void { |
| 7764 | 7764 | fn airRetLoad(cg: *CodeGen, inst: Air.Inst.Index) !void { |
| 7765 | 7765 | const gpa = cg.gpa; |
| 7766 | 7766 | const zcu = cg.zcu; |
| 7767 | const un_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].un_op; | |
| 7767 | const un_op = cg.air.instructions.items(.data)[@backingInt(inst)].un_op; | |
| 7768 | 7768 | const ptr_ty = cg.typeOf(un_op); |
| 7769 | 7769 | const ret_ty = ptr_ty.childType(zcu); |
| 7770 | 7770 | |
| ... | ... | @@ -7856,7 +7856,7 @@ fn airTry(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 7856 | 7856 | |
| 7857 | 7857 | fn airErrUnionErr(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 7858 | 7858 | const zcu = cg.zcu; |
| 7859 | const ty_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 7859 | const ty_op = cg.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 7860 | 7860 | const operand_id = try cg.resolve(ty_op.operand); |
| 7861 | 7861 | const err_union_ty = cg.typeOf(ty_op.operand); |
| 7862 | 7862 | const err_ty_id = try cg.resolveType(.anyerror, .direct); |
| ... | ... | @@ -7878,7 +7878,7 @@ fn airErrUnionErr(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 7878 | 7878 | } |
| 7879 | 7879 | |
| 7880 | 7880 | fn airErrUnionPayload(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 7881 | const ty_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 7881 | const ty_op = cg.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 7882 | 7882 | const operand_id = try cg.resolve(ty_op.operand); |
| 7883 | 7883 | const payload_ty = cg.typeOfIndex(inst); |
| 7884 | 7884 | const eu_layout = cg.errorUnionLayout(payload_ty); |
| ... | ... | @@ -7892,7 +7892,7 @@ fn airErrUnionPayload(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 7892 | 7892 | |
| 7893 | 7893 | fn airWrapErrUnionErr(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 7894 | 7894 | const zcu = cg.zcu; |
| 7895 | const ty_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 7895 | const ty_op = cg.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 7896 | 7896 | const err_union_ty = cg.typeOfIndex(inst); |
| 7897 | 7897 | const payload_ty = err_union_ty.errorUnionPayload(zcu); |
| 7898 | 7898 | const operand_id = try cg.resolve(ty_op.operand); |
| ... | ... | @@ -7917,7 +7917,7 @@ fn airWrapErrUnionErr(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 7917 | 7917 | } |
| 7918 | 7918 | |
| 7919 | 7919 | fn airWrapErrUnionPayload(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 7920 | const ty_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 7920 | const ty_op = cg.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 7921 | 7921 | const err_union_ty = cg.typeOfIndex(inst); |
| 7922 | 7922 | const operand_id = try cg.resolve(ty_op.operand); |
| 7923 | 7923 | const payload_ty = cg.typeOf(ty_op.operand); |
| ... | ... | @@ -7941,7 +7941,7 @@ fn airWrapErrUnionPayload(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 7941 | 7941 | |
| 7942 | 7942 | fn airIsNull(cg: *CodeGen, inst: Air.Inst.Index, is_pointer: bool, pred: enum { is_null, is_non_null }) !?Id { |
| 7943 | 7943 | const zcu = cg.zcu; |
| 7944 | const un_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].un_op; | |
| 7944 | const un_op = cg.air.instructions.items(.data)[@backingInt(inst)].un_op; | |
| 7945 | 7945 | const operand_id = try cg.resolve(un_op); |
| 7946 | 7946 | const operand_ty = cg.typeOf(un_op); |
| 7947 | 7947 | const optional_ty = if (is_pointer) operand_ty.childType(zcu) else operand_ty; |
| ... | ... | @@ -8018,7 +8018,7 @@ fn airIsNull(cg: *CodeGen, inst: Air.Inst.Index, is_pointer: bool, pred: enum { |
| 8018 | 8018 | |
| 8019 | 8019 | fn airIsErr(cg: *CodeGen, inst: Air.Inst.Index, pred: enum { is_err, is_non_err }) !?Id { |
| 8020 | 8020 | const zcu = cg.zcu; |
| 8021 | const un_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].un_op; | |
| 8021 | const un_op = cg.air.instructions.items(.data)[@backingInt(inst)].un_op; | |
| 8022 | 8022 | const operand_id = try cg.resolve(un_op); |
| 8023 | 8023 | const err_union_ty = cg.typeOf(un_op); |
| 8024 | 8024 | |
| ... | ... | @@ -8056,7 +8056,7 @@ fn airIsErr(cg: *CodeGen, inst: Air.Inst.Index, pred: enum { is_err, is_non_err |
| 8056 | 8056 | |
| 8057 | 8057 | fn airUnwrapOptional(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 8058 | 8058 | const zcu = cg.zcu; |
| 8059 | const ty_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 8059 | const ty_op = cg.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 8060 | 8060 | const operand_id = try cg.resolve(ty_op.operand); |
| 8061 | 8061 | const optional_ty = cg.typeOf(ty_op.operand); |
| 8062 | 8062 | const payload_ty = cg.typeOfIndex(inst); |
| ... | ... | @@ -8072,7 +8072,7 @@ fn airUnwrapOptional(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 8072 | 8072 | |
| 8073 | 8073 | fn airUnwrapOptionalPtr(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 8074 | 8074 | const zcu = cg.zcu; |
| 8075 | const ty_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 8075 | const ty_op = cg.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 8076 | 8076 | const operand_id = try cg.resolve(ty_op.operand); |
| 8077 | 8077 | const operand_ty = cg.typeOf(ty_op.operand); |
| 8078 | 8078 | const optional_ty = operand_ty.childType(zcu); |
| ... | ... | @@ -8096,7 +8096,7 @@ fn airUnwrapOptionalPtr(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 8096 | 8096 | |
| 8097 | 8097 | fn airSetOptionalPtr(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 8098 | 8098 | const zcu = cg.zcu; |
| 8099 | const ty_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 8099 | const ty_op = cg.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 8100 | 8100 | |
| 8101 | 8101 | const ptr_ty = cg.typeOf(ty_op.operand); |
| 8102 | 8102 | const ptr_id = try cg.resolve(ty_op.operand); |
| ... | ... | @@ -8129,7 +8129,7 @@ fn airSetOptionalPtr(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 8129 | 8129 | |
| 8130 | 8130 | fn airWrapOptional(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 8131 | 8131 | const zcu = cg.zcu; |
| 8132 | const ty_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 8132 | const ty_op = cg.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 8133 | 8133 | const payload_ty = cg.typeOf(ty_op.operand); |
| 8134 | 8134 | |
| 8135 | 8135 | assert(payload_ty.hasRuntimeBits(zcu)); |
| ... | ... | @@ -8424,7 +8424,7 @@ fn airLoopSwitchBr(cg: *CodeGen, inst: Air.Inst.Index) !void { |
| 8424 | 8424 | // switch_dispatch signals "continue the loop" by using this sentinel as the |
| 8425 | 8425 | // next_block in structuredBreak. at switch_merge, a phi + comparison distinguishes |
| 8426 | 8426 | // dispatch (continue) from break (exit) |
| 8427 | const dispatch_sentinel = try cg.constInt(.u32, @intFromEnum(inst)); | |
| 8427 | const dispatch_sentinel = try cg.constInt(.u32, @backingInt(inst)); | |
| 8428 | 8428 | |
| 8429 | 8429 | try cg.loop_switches.putNoClobber(gpa, inst, .{ |
| 8430 | 8430 | .cond_var = cond_var, |
| ... | ... | @@ -8627,7 +8627,7 @@ fn airLoopSwitchBr(cg: *CodeGen, inst: Air.Inst.Index) !void { |
| 8627 | 8627 | } |
| 8628 | 8628 | |
| 8629 | 8629 | fn airSwitchDispatch(cg: *CodeGen, inst: Air.Inst.Index) !void { |
| 8630 | const br = cg.air.instructions.items(.data)[@intFromEnum(inst)].br; | |
| 8630 | const br = cg.air.instructions.items(.data)[@backingInt(inst)].br; | |
| 8631 | 8631 | const loop_switch = cg.loop_switches.get(br.block_inst).?; |
| 8632 | 8632 | const cond_ty = cg.typeOf(br.operand); |
| 8633 | 8633 | const operand = try cg.resolve(br.operand); |
| ... | ... | @@ -8643,7 +8643,7 @@ fn airUnreach(cg: *CodeGen) !void { |
| 8643 | 8643 | |
| 8644 | 8644 | fn airDbgStmt(cg: *CodeGen, inst: Air.Inst.Index) !void { |
| 8645 | 8645 | const zcu = cg.zcu; |
| 8646 | const dbg_stmt = cg.air.instructions.items(.data)[@intFromEnum(inst)].dbg_stmt; | |
| 8646 | const dbg_stmt = cg.air.instructions.items(.data)[@backingInt(inst)].dbg_stmt; | |
| 8647 | 8647 | const path = zcu.navFileScope(cg.owner_nav).sub_file_path; |
| 8648 | 8648 | |
| 8649 | 8649 | if (zcu.comp.config.root_strip) return; |
| ... | ... | @@ -8670,12 +8670,12 @@ fn airDbgInlineBlock(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 8670 | 8670 | } |
| 8671 | 8671 | |
| 8672 | 8672 | fn airDbgVar(cg: *CodeGen, inst: Air.Inst.Index) !void { |
| 8673 | const pl_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].pl_op; | |
| 8673 | const pl_op = cg.air.instructions.items(.data)[@backingInt(inst)].pl_op; | |
| 8674 | 8674 | const target_id = switch (try cg.resolvePtr(pl_op.operand)) { |
| 8675 | 8675 | .tracked => return, |
| 8676 | 8676 | .id => |id| id, |
| 8677 | 8677 | }; |
| 8678 | const name: Air.NullTerminatedString = @enumFromInt(pl_op.payload); | |
| 8678 | const name: Air.NullTerminatedString = @fromBackingInt(@intCast(pl_op.payload)); | |
| 8679 | 8679 | try cg.debugName(target_id, name.toSlice(cg.air)); |
| 8680 | 8680 | } |
| 8681 | 8681 | |
| ... | ... | @@ -8944,7 +8944,7 @@ fn builtin3D( |
| 8944 | 8944 | |
| 8945 | 8945 | fn airWorkItemId(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 8946 | 8946 | if (cg.liveness.isUnused(inst)) return null; |
| 8947 | const pl_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].pl_op; | |
| 8947 | const pl_op = cg.air.instructions.items(.data)[@backingInt(inst)].pl_op; | |
| 8948 | 8948 | const dimension = pl_op.payload; |
| 8949 | 8949 | return try cg.builtin3D(.u32, .local_invocation_id, dimension, 0); |
| 8950 | 8950 | } |
| ... | ... | @@ -8952,14 +8952,14 @@ fn airWorkItemId(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 8952 | 8952 | // TODO: this must be an OpConstant/OpSpec but even then the driver crashes. |
| 8953 | 8953 | fn airWorkGroupSize(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 8954 | 8954 | if (cg.liveness.isUnused(inst)) return null; |
| 8955 | const pl_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].pl_op; | |
| 8955 | const pl_op = cg.air.instructions.items(.data)[@backingInt(inst)].pl_op; | |
| 8956 | 8956 | const dimension = pl_op.payload; |
| 8957 | 8957 | return try cg.builtin3D(.u32, .workgroup_size, dimension, 0); |
| 8958 | 8958 | } |
| 8959 | 8959 | |
| 8960 | 8960 | fn airWorkGroupId(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 8961 | 8961 | if (cg.liveness.isUnused(inst)) return null; |
| 8962 | const pl_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].pl_op; | |
| 8962 | const pl_op = cg.air.instructions.items(.data)[@backingInt(inst)].pl_op; | |
| 8963 | 8963 | const dimension = pl_op.payload; |
| 8964 | 8964 | return try cg.builtin3D(.u32, .workgroup_id, dimension, 0); |
| 8965 | 8965 | } |
src/codegen/spirv/Section.zig+9-9| ... | ... | @@ -50,7 +50,7 @@ pub fn emitRaw( |
| 50 | 50 | ) !void { |
| 51 | 51 | const word_count = 1 + operand_words; |
| 52 | 52 | try section.instructions.ensureUnusedCapacity(allocator, word_count); |
| 53 | section.writeWord((@as(Word, @intCast(word_count << 16))) | @intFromEnum(opcode)); | |
| 53 | section.writeWord((@as(Word, @intCast(word_count << 16))) | @backingInt(opcode)); | |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | /// Write an entire instruction, including all operands |
| ... | ... | @@ -70,7 +70,7 @@ pub fn emitAssumeCapacity( |
| 70 | 70 | operands: opcode.Operands(), |
| 71 | 71 | ) !void { |
| 72 | 72 | const word_count = instructionSize(opcode, operands); |
| 73 | section.writeWord(@as(Word, @intCast(word_count << 16)) | @intFromEnum(opcode)); | |
| 73 | section.writeWord(@as(Word, @intCast(word_count << 16)) | @backingInt(opcode)); | |
| 74 | 74 | section.writeOperands(opcode.Operands(), operands); |
| 75 | 75 | } |
| 76 | 76 | |
| ... | ... | @@ -82,7 +82,7 @@ pub fn emit( |
| 82 | 82 | ) !void { |
| 83 | 83 | const word_count = instructionSize(opcode, operands); |
| 84 | 84 | try section.instructions.ensureUnusedCapacity(allocator, word_count); |
| 85 | section.writeWord(@as(Word, @intCast(word_count << 16)) | @intFromEnum(opcode)); | |
| 85 | section.writeWord(@as(Word, @intCast(word_count << 16)) | @backingInt(opcode)); | |
| 86 | 86 | section.writeOperands(opcode.Operands(), operands); |
| 87 | 87 | } |
| 88 | 88 | |
| ... | ... | @@ -115,16 +115,16 @@ fn writeOperands(section: *Section, comptime Operands: type, operands: Operands) |
| 115 | 115 | pub fn writeOperand(section: *Section, comptime Operand: type, operand: Operand) void { |
| 116 | 116 | switch (Operand) { |
| 117 | 117 | spec.LiteralSpecConstantOpInteger => unreachable, |
| 118 | spec.Id => section.writeWord(@intFromEnum(operand)), | |
| 118 | spec.Id => section.writeWord(@backingInt(operand)), | |
| 119 | 119 | spec.LiteralInteger => section.writeWord(operand), |
| 120 | 120 | spec.LiteralString => section.writeString(operand), |
| 121 | 121 | spec.LiteralContextDependentNumber => section.writeContextDependentNumber(operand), |
| 122 | 122 | spec.LiteralExtInstInteger => section.writeWord(operand.inst), |
| 123 | spec.PairLiteralIntegerIdRef => section.writeWords(&.{ operand.value, @enumFromInt(operand.label) }), | |
| 124 | spec.PairIdRefLiteralInteger => section.writeWords(&.{ @intFromEnum(operand.target), operand.member }), | |
| 125 | spec.PairIdRefIdRef => section.writeWords(&.{ @intFromEnum(operand[0]), @intFromEnum(operand[1]) }), | |
| 123 | spec.PairLiteralIntegerIdRef => section.writeWords(&.{ operand.value, @fromBackingInt(@intCast(operand.label)) }), | |
| 124 | spec.PairIdRefLiteralInteger => section.writeWords(&.{ @backingInt(operand.target), operand.member }), | |
| 125 | spec.PairIdRefIdRef => section.writeWords(&.{ @backingInt(operand[0]), @backingInt(operand[1]) }), | |
| 126 | 126 | else => switch (@typeInfo(Operand)) { |
| 127 | .@"enum" => section.writeWord(@intFromEnum(operand)), | |
| 127 | .@"enum" => section.writeWord(@backingInt(operand)), | |
| 128 | 128 | .optional => |info| if (operand) |child| section.writeOperand(info.child, child), |
| 129 | 129 | .pointer => |info| { |
| 130 | 130 | std.debug.assert(info.size == .slice); // Should be no other pointer types in the spec. |
| ... | ... | @@ -200,7 +200,7 @@ fn writeExtendedMask(section: *Section, comptime Operand: type, operand: Operand |
| 200 | 200 | fn writeExtendedUnion(section: *Section, comptime Operand: type, operand: Operand) void { |
| 201 | 201 | return switch (operand) { |
| 202 | 202 | inline else => |op, tag| { |
| 203 | section.writeWord(@intFromEnum(tag)); | |
| 203 | section.writeWord(@backingInt(tag)); | |
| 204 | 204 | section.writeOperands( |
| 205 | 205 | @FieldType(Operand, @tagName(tag)), |
| 206 | 206 | op, |
src/codegen/spirv/spec.zig+2-2| ... | ... | @@ -21,7 +21,7 @@ pub const Id = enum(Word) { |
| 21 | 21 | pub fn format(self: Id, writer: *std.Io.Writer) std.Io.Writer.Error!void { |
| 22 | 22 | switch (self) { |
| 23 | 23 | .none => try writer.writeAll("(none)"), |
| 24 | else => try writer.print("%{d}", .{@intFromEnum(self)}), | |
| 24 | else => try writer.print("%{d}", .{@backingInt(self)}), | |
| 25 | 25 | } |
| 26 | 26 | } |
| 27 | 27 | }; |
| ... | ... | @@ -32,7 +32,7 @@ pub const IdRange = struct { |
| 32 | 32 | |
| 33 | 33 | pub fn at(range: IdRange, i: usize) Id { |
| 34 | 34 | std.debug.assert(i < range.len); |
| 35 | return @enumFromInt(range.base + i); | |
| 35 | return @fromBackingInt(@intCast(range.base + i)); | |
| 36 | 36 | } |
| 37 | 37 | }; |
| 38 | 38 |
src/codegen/wasm/CodeGen.zig+104-104| ... | ... | @@ -482,7 +482,7 @@ fn processDeath(cg: *CodeGen, ref: Air.Inst.Ref) void { |
| 482 | 482 | if (value.local.value < reserved_indexes) { |
| 483 | 483 | return; // function arguments can never be re-used |
| 484 | 484 | } |
| 485 | log.debug("Decreasing reference for ref: %{d}, using local '{d}'", .{ @intFromEnum(ref.toIndex().?), value.local.value }); | |
| 485 | log.debug("Decreasing reference for ref: %{d}, using local '{d}'", .{ @backingInt(ref.toIndex().?), value.local.value }); | |
| 486 | 486 | value.local.references -= 1; // if this panics, a call to `reuseOperand` was forgotten by the developer |
| 487 | 487 | if (value.local.references == 0) { |
| 488 | 488 | value.free(cg); |
| ... | ... | @@ -499,7 +499,7 @@ pub fn addTag(cg: *CodeGen, tag: Mir.Inst.Tag) error{OutOfMemory}!void { |
| 499 | 499 | |
| 500 | 500 | pub fn addExtended(cg: *CodeGen, opcode: std.wasm.MiscOpcode) error{OutOfMemory}!void { |
| 501 | 501 | const extra_index: u32 = @intCast(cg.mir_extra.items.len); |
| 502 | try cg.mir_extra.append(cg.gpa, @intFromEnum(opcode)); | |
| 502 | try cg.mir_extra.append(cg.gpa, @backingInt(opcode)); | |
| 503 | 503 | try cg.addInst(.{ .tag = .misc_prefix, .data = .{ .payload = extra_index } }); |
| 504 | 504 | } |
| 505 | 505 | |
| ... | ... | @@ -532,7 +532,7 @@ pub fn addImm128(cg: *CodeGen, index: u32) error{OutOfMemory}!void { |
| 532 | 532 | const extra_index: u32 = @intCast(cg.mir_extra.items.len); |
| 533 | 533 | // tag + 128bit value |
| 534 | 534 | try cg.mir_extra.ensureUnusedCapacity(cg.gpa, 5); |
| 535 | cg.mir_extra.appendAssumeCapacity(@intFromEnum(std.wasm.SimdOpcode.v128_const)); | |
| 535 | cg.mir_extra.appendAssumeCapacity(@backingInt(std.wasm.SimdOpcode.v128_const)); | |
| 536 | 536 | cg.mir_extra.appendSliceAssumeCapacity(@alignCast(mem.bytesAsSlice(u32, &simd_values))); |
| 537 | 537 | try cg.addInst(.{ .tag = .simd_prefix, .data = .{ .payload = extra_index } }); |
| 538 | 538 | } |
| ... | ... | @@ -555,14 +555,14 @@ pub fn addMemArg(cg: *CodeGen, tag: Mir.Inst.Tag, mem_arg: Mir.MemArg) error{Out |
| 555 | 555 | /// Inserts an instruction from the 'atomics' feature which accesses wasm's linear memory dependent on the |
| 556 | 556 | /// given `tag`. |
| 557 | 557 | pub fn addAtomicMemArg(cg: *CodeGen, tag: std.wasm.AtomicsOpcode, mem_arg: Mir.MemArg) error{OutOfMemory}!void { |
| 558 | const extra_index = try cg.addExtra(@as(struct { val: u32 }, .{ .val = @intFromEnum(tag) })); | |
| 558 | const extra_index = try cg.addExtra(@as(struct { val: u32 }, .{ .val = @backingInt(tag) })); | |
| 559 | 559 | _ = try cg.addExtra(mem_arg); |
| 560 | 560 | try cg.addInst(.{ .tag = .atomics_prefix, .data = .{ .payload = extra_index } }); |
| 561 | 561 | } |
| 562 | 562 | |
| 563 | 563 | /// Helper function to emit atomic mir opcodes. |
| 564 | 564 | pub fn addAtomicTag(cg: *CodeGen, tag: std.wasm.AtomicsOpcode) error{OutOfMemory}!void { |
| 565 | const extra_index = try cg.addExtra(@as(struct { val: u32 }, .{ .val = @intFromEnum(tag) })); | |
| 565 | const extra_index = try cg.addExtra(@as(struct { val: u32 }, .{ .val = @backingInt(tag) })); | |
| 566 | 566 | try cg.addInst(.{ .tag = .atomics_prefix, .data = .{ .payload = extra_index } }); |
| 567 | 567 | } |
| 568 | 568 | |
| ... | ... | @@ -589,7 +589,7 @@ fn addExtraAssumeCapacity(cg: *CodeGen, extra: anytype) error{OutOfMemory}!u32 { |
| 589 | 589 | i32 => @bitCast(@field(extra, field_name)), |
| 590 | 590 | InternPool.Index, |
| 591 | 591 | InternPool.Nav.Index, |
| 592 | => @intFromEnum(@field(extra, field_name)), | |
| 592 | => @backingInt(@field(extra, field_name)), | |
| 593 | 593 | else => @compileError("Unsupported field type " ++ @typeName(field_type)), |
| 594 | 594 | }); |
| 595 | 595 | } |
| ... | ... | @@ -1304,7 +1304,7 @@ fn buildPointerOffset(cg: *CodeGen, ptr_value: WValue, offset: u64, action: enum |
| 1304 | 1304 | fn genInst(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 1305 | 1305 | const zcu = cg.pt.zcu; |
| 1306 | 1306 | const air_tags = cg.air.instructions.items(.tag); |
| 1307 | return switch (air_tags[@intFromEnum(inst)]) { | |
| 1307 | return switch (air_tags[@backingInt(inst)]) { | |
| 1308 | 1308 | // No soft float legalizations are enabled. |
| 1309 | 1309 | .legalize_compiler_rt_call => unreachable, |
| 1310 | 1310 | |
| ... | ... | @@ -1312,7 +1312,7 @@ fn genInst(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 1312 | 1312 | |
| 1313 | 1313 | .legalize_vec_elem_val => cg.airArrayElemVal(inst), |
| 1314 | 1314 | .legalize_vec_store_elem => { |
| 1315 | const pl_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].pl_op; | |
| 1315 | const pl_op = cg.air.instructions.items(.data)[@backingInt(inst)].pl_op; | |
| 1316 | 1316 | const bin_op = cg.air.extraData(Air.Bin, pl_op.payload).data; |
| 1317 | 1317 | const vec_ptr = try cg.resolveInst(pl_op.operand); |
| 1318 | 1318 | const elem_idx = try cg.resolveInst(bin_op.lhs); |
| ... | ... | @@ -1345,7 +1345,7 @@ fn genInst(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 1345 | 1345 | .div_floor, |
| 1346 | 1346 | .div_ceil, |
| 1347 | 1347 | => |tag| { |
| 1348 | const bin_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 1348 | const bin_op = cg.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 1349 | 1349 | const lhs = try cg.resolveInst(bin_op.lhs); |
| 1350 | 1350 | const rhs = try cg.resolveInst(bin_op.rhs); |
| 1351 | 1351 | |
| ... | ... | @@ -1399,7 +1399,7 @@ fn genInst(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 1399 | 1399 | } |
| 1400 | 1400 | }, |
| 1401 | 1401 | .div_float => { |
| 1402 | const bin_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 1402 | const bin_op = cg.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 1403 | 1403 | const lhs = try cg.resolveInst(bin_op.lhs); |
| 1404 | 1404 | const rhs = try cg.resolveInst(bin_op.rhs); |
| 1405 | 1405 | const ty = cg.typeOfIndex(inst); |
| ... | ... | @@ -1412,7 +1412,7 @@ fn genInst(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 1412 | 1412 | try cg.finishAir(inst, result, &.{ bin_op.lhs, bin_op.rhs }); |
| 1413 | 1413 | }, |
| 1414 | 1414 | .abs => { |
| 1415 | const ty_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 1415 | const ty_op = cg.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 1416 | 1416 | const operand = try cg.resolveInst(ty_op.operand); |
| 1417 | 1417 | |
| 1418 | 1418 | const ty = cg.typeOf(ty_op.operand); |
| ... | ... | @@ -1433,7 +1433,7 @@ fn genInst(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 1433 | 1433 | } |
| 1434 | 1434 | }, |
| 1435 | 1435 | .mul_add => { |
| 1436 | const pl_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].pl_op; | |
| 1436 | const pl_op = cg.air.instructions.items(.data)[@backingInt(inst)].pl_op; | |
| 1437 | 1437 | const bin_op = cg.air.extraData(Air.Bin, pl_op.payload).data; |
| 1438 | 1438 | const addend = try cg.resolveInst(pl_op.operand); |
| 1439 | 1439 | const lhs = try cg.resolveInst(bin_op.lhs); |
| ... | ... | @@ -1453,7 +1453,7 @@ fn genInst(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 1453 | 1453 | .mul_sat, |
| 1454 | 1454 | .shl_sat, |
| 1455 | 1455 | => |tag| { |
| 1456 | const bin_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 1456 | const bin_op = cg.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 1457 | 1457 | const lhs = try cg.resolveInst(bin_op.lhs); |
| 1458 | 1458 | const rhs = try cg.resolveInst(bin_op.rhs); |
| 1459 | 1459 | const ty = cg.typeOfIndex(inst); |
| ... | ... | @@ -1479,7 +1479,7 @@ fn genInst(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 1479 | 1479 | .mul_with_overflow, |
| 1480 | 1480 | .shl_with_overflow, |
| 1481 | 1481 | => |tag| { |
| 1482 | const ty_pl = cg.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | |
| 1482 | const ty_pl = cg.air.instructions.items(.data)[@backingInt(inst)].ty_pl; | |
| 1483 | 1483 | const extra = cg.air.extraData(Air.Bin, ty_pl.payload).data; |
| 1484 | 1484 | |
| 1485 | 1485 | const lhs = try cg.resolveInst(extra.lhs); |
| ... | ... | @@ -1512,7 +1512,7 @@ fn genInst(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 1512 | 1512 | }, |
| 1513 | 1513 | |
| 1514 | 1514 | .add_wrap, .sub_wrap, .mul_wrap, .shl => |tag| { |
| 1515 | const bin_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 1515 | const bin_op = cg.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 1516 | 1516 | const lhs = try cg.resolveInst(bin_op.lhs); |
| 1517 | 1517 | const rhs = try cg.resolveInst(bin_op.rhs); |
| 1518 | 1518 | const ty = cg.typeOfIndex(inst); |
| ... | ... | @@ -1535,7 +1535,7 @@ fn genInst(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 1535 | 1535 | }, |
| 1536 | 1536 | |
| 1537 | 1537 | .bit_and, .bit_or, .xor, .shl_exact, .shr, .shr_exact => |tag| { |
| 1538 | const bin_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 1538 | const bin_op = cg.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 1539 | 1539 | const lhs = try cg.resolveInst(bin_op.lhs); |
| 1540 | 1540 | const rhs = try cg.resolveInst(bin_op.rhs); |
| 1541 | 1541 | const ty = cg.typeOfIndex(inst); |
| ... | ... | @@ -1558,7 +1558,7 @@ fn genInst(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 1558 | 1558 | }, |
| 1559 | 1559 | |
| 1560 | 1560 | .not => { |
| 1561 | const ty_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 1561 | const ty_op = cg.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 1562 | 1562 | const operand = try cg.resolveInst(ty_op.operand); |
| 1563 | 1563 | const ty = cg.typeOf(ty_op.operand); |
| 1564 | 1564 | |
| ... | ... | @@ -1581,7 +1581,7 @@ fn genInst(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 1581 | 1581 | .union_from_enum => cg.airUnionFromEnum(inst), |
| 1582 | 1582 | |
| 1583 | 1583 | .int_cast => { |
| 1584 | const ty_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 1584 | const ty_op = cg.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 1585 | 1585 | |
| 1586 | 1586 | const dest_ty = ty_op.ty.toType(); |
| 1587 | 1587 | const operand = try cg.resolveInst(ty_op.operand); |
| ... | ... | @@ -1609,7 +1609,7 @@ fn genInst(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 1609 | 1609 | try cg.finishAir(inst, result, &.{ty_op.operand}); |
| 1610 | 1610 | }, |
| 1611 | 1611 | .trunc => { |
| 1612 | const ty_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 1612 | const ty_op = cg.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 1613 | 1613 | |
| 1614 | 1614 | const operand = try cg.resolveInst(ty_op.operand); |
| 1615 | 1615 | const dest_ty = ty_op.ty.toType(); |
| ... | ... | @@ -1632,7 +1632,7 @@ fn genInst(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 1632 | 1632 | }, |
| 1633 | 1633 | |
| 1634 | 1634 | .fptrunc, .fpext => |tag| { |
| 1635 | const ty_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 1635 | const ty_op = cg.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 1636 | 1636 | |
| 1637 | 1637 | const operand = try cg.resolveInst(ty_op.operand); |
| 1638 | 1638 | const src_ty = cg.typeOf(ty_op.operand); |
| ... | ... | @@ -1655,7 +1655,7 @@ fn genInst(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 1655 | 1655 | }, |
| 1656 | 1656 | |
| 1657 | 1657 | .int_from_float => { |
| 1658 | const ty_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 1658 | const ty_op = cg.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 1659 | 1659 | const operand = try cg.resolveInst(ty_op.operand); |
| 1660 | 1660 | const src_ty = cg.typeOf(ty_op.operand); |
| 1661 | 1661 | const dest_ty = cg.typeOfIndex(inst); |
| ... | ... | @@ -1668,7 +1668,7 @@ fn genInst(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 1668 | 1668 | try cg.finishAir(inst, result, &.{ty_op.operand}); |
| 1669 | 1669 | }, |
| 1670 | 1670 | .float_from_int => { |
| 1671 | const ty_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 1671 | const ty_op = cg.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 1672 | 1672 | const operand = try cg.resolveInst(ty_op.operand); |
| 1673 | 1673 | const src_ty = cg.typeOf(ty_op.operand); |
| 1674 | 1674 | const dest_ty = cg.typeOfIndex(inst); |
| ... | ... | @@ -1682,7 +1682,7 @@ fn genInst(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 1682 | 1682 | }, |
| 1683 | 1683 | |
| 1684 | 1684 | .clz, .ctz, .popcount, .byte_swap, .bit_reverse => |tag| { |
| 1685 | const ty_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 1685 | const ty_op = cg.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 1686 | 1686 | const operand = try cg.resolveInst(ty_op.operand); |
| 1687 | 1687 | |
| 1688 | 1688 | const ty = cg.typeOf(ty_op.operand); |
| ... | ... | @@ -1704,7 +1704,7 @@ fn genInst(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 1704 | 1704 | }, |
| 1705 | 1705 | |
| 1706 | 1706 | .sqrt, .sin, .cos, .tan, .exp, .exp2, .log, .log2, .log10, .floor, .ceil, .round, .trunc_float, .neg => |tag| { |
| 1707 | const un_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].un_op; | |
| 1707 | const un_op = cg.air.instructions.items(.data)[@backingInt(inst)].un_op; | |
| 1708 | 1708 | const operand = try cg.resolveInst(un_op); |
| 1709 | 1709 | const ty = cg.typeOfIndex(inst); |
| 1710 | 1710 | |
| ... | ... | @@ -1935,7 +1935,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 1935 | 1935 | if (std.debug.runtime_safety and cg.air_bookkeeping < old_bookkeeping_value + 1) { |
| 1936 | 1936 | std.debug.panic("Missing call to `finishAir` in AIR instruction %{d} ('{t}')", .{ |
| 1937 | 1937 | inst, |
| 1938 | cg.air.instructions.items(.tag)[@intFromEnum(inst)], | |
| 1938 | cg.air.instructions.items(.tag)[@backingInt(inst)], | |
| 1939 | 1939 | }); |
| 1940 | 1940 | } |
| 1941 | 1941 | } |
| ... | ... | @@ -1943,7 +1943,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 1943 | 1943 | |
| 1944 | 1944 | fn airRet(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 1945 | 1945 | const zcu = cg.pt.zcu; |
| 1946 | const un_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].un_op; | |
| 1946 | const un_op = cg.air.instructions.items(.data)[@backingInt(inst)].un_op; | |
| 1947 | 1947 | const operand = try cg.resolveInst(un_op); |
| 1948 | 1948 | const fn_info = zcu.typeToFunc(zcu.navValue(cg.owner_nav).typeOf(zcu)).?; |
| 1949 | 1949 | const ret_ty = Type.fromInterned(fn_info.return_type); |
| ... | ... | @@ -1999,7 +1999,7 @@ fn airRetPtr(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 1999 | 1999 | |
| 2000 | 2000 | fn airRetLoad(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 2001 | 2001 | const zcu = cg.pt.zcu; |
| 2002 | const un_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].un_op; | |
| 2002 | const un_op = cg.air.instructions.items(.data)[@backingInt(inst)].un_op; | |
| 2003 | 2003 | const operand = try cg.resolveInst(un_op); |
| 2004 | 2004 | const ret_ty = cg.typeOf(un_op).childType(zcu); |
| 2005 | 2005 | |
| ... | ... | @@ -2174,12 +2174,12 @@ fn airVaStart(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 2174 | 2174 | } |
| 2175 | 2175 | |
| 2176 | 2176 | fn airVaEnd(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 2177 | const un_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].un_op; | |
| 2177 | const un_op = cg.air.instructions.items(.data)[@backingInt(inst)].un_op; | |
| 2178 | 2178 | return cg.finishAir(inst, .none, &.{un_op}); |
| 2179 | 2179 | } |
| 2180 | 2180 | |
| 2181 | 2181 | fn airVaCopy(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 2182 | const ty_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 2182 | const ty_op = cg.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 2183 | 2183 | const operand = try cg.resolveInst(ty_op.operand); |
| 2184 | 2184 | |
| 2185 | 2185 | const result = try cg.load(operand, .usize, 0); |
| ... | ... | @@ -2189,7 +2189,7 @@ fn airVaCopy(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 2189 | 2189 | |
| 2190 | 2190 | fn airVaArg(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 2191 | 2191 | const zcu = cg.pt.zcu; |
| 2192 | const ty_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 2192 | const ty_op = cg.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 2193 | 2193 | const operand = try cg.resolveInst(ty_op.operand); |
| 2194 | 2194 | |
| 2195 | 2195 | const ty = cg.typeOfIndex(inst); |
| ... | ... | @@ -2261,7 +2261,7 @@ fn airAlloc(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 2261 | 2261 | fn airStore(cg: *CodeGen, inst: Air.Inst.Index, safety: bool) InnerError!void { |
| 2262 | 2262 | const pt = cg.pt; |
| 2263 | 2263 | const zcu = pt.zcu; |
| 2264 | const bin_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 2264 | const bin_op = cg.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 2265 | 2265 | |
| 2266 | 2266 | const lhs = try cg.resolveInst(bin_op.lhs); |
| 2267 | 2267 | const rhs = try cg.resolveInst(bin_op.rhs); |
| ... | ... | @@ -2278,7 +2278,7 @@ fn airStore(cg: *CodeGen, inst: Air.Inst.Index, safety: bool) InnerError!void { |
| 2278 | 2278 | assert(ptr_info.packed_offset.host_size == 0); // legalize .expand_packed_store |
| 2279 | 2279 | break :offset 0; |
| 2280 | 2280 | }, |
| 2281 | else => |index| @intCast(@intFromEnum(index) * elem_ty.abiSize(zcu)), | |
| 2281 | else => |index| @intCast(@backingInt(index) * elem_ty.abiSize(zcu)), | |
| 2282 | 2282 | }; |
| 2283 | 2283 | try cg.store(lhs, rhs, elem_ty, offset); |
| 2284 | 2284 | return cg.finishAir(inst, .none, &.{ bin_op.lhs, bin_op.rhs }); |
| ... | ... | @@ -2312,7 +2312,7 @@ fn store(cg: *CodeGen, lhs: WValue, rhs: WValue, ty: Type, offset: u32) InnerErr |
| 2312 | 2312 | const extra_index: u32 = @intCast(cg.mir_extra.items.len); |
| 2313 | 2313 | // stores as := opcode, offset, alignment (opcode::memarg) |
| 2314 | 2314 | try cg.mir_extra.appendSlice(cg.gpa, &[_]u32{ |
| 2315 | @intFromEnum(std.wasm.SimdOpcode.v128_store), | |
| 2315 | @backingInt(std.wasm.SimdOpcode.v128_store), | |
| 2316 | 2316 | offset + lhs.offset(), |
| 2317 | 2317 | @intCast(ty.abiAlignment(zcu).toByteUnits().?), |
| 2318 | 2318 | }); |
| ... | ... | @@ -2353,7 +2353,7 @@ fn store(cg: *CodeGen, lhs: WValue, rhs: WValue, ty: Type, offset: u32) InnerErr |
| 2353 | 2353 | fn airLoad(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 2354 | 2354 | const pt = cg.pt; |
| 2355 | 2355 | const zcu = pt.zcu; |
| 2356 | const ty_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 2356 | const ty_op = cg.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 2357 | 2357 | const operand = try cg.resolveInst(ty_op.operand); |
| 2358 | 2358 | const elem_ty = ty_op.ty.toType(); |
| 2359 | 2359 | const ptr_ty = cg.typeOf(ty_op.operand); |
| ... | ... | @@ -2366,7 +2366,7 @@ fn airLoad(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 2366 | 2366 | assert(ptr_info.packed_offset.host_size == 0); // legalize .expand_packed_load |
| 2367 | 2367 | break :offset 0; |
| 2368 | 2368 | }, |
| 2369 | else => |index| @intCast(@intFromEnum(index) * elem_ty.abiSize(zcu)), | |
| 2369 | else => |index| @intCast(@backingInt(index) * elem_ty.abiSize(zcu)), | |
| 2370 | 2370 | }; |
| 2371 | 2371 | const result = try cg.load(operand, elem_ty, offset); |
| 2372 | 2372 | return cg.finishAir(inst, result, &.{ty_op.operand}); |
| ... | ... | @@ -2400,7 +2400,7 @@ fn load(cg: *CodeGen, operand: WValue, ty: Type, offset: u32) InnerError!WValue |
| 2400 | 2400 | const extra_index: u32 = @intCast(cg.mir_extra.items.len); |
| 2401 | 2401 | // stores as := opcode, offset, alignment (opcode::memarg) |
| 2402 | 2402 | try cg.mir_extra.appendSlice(cg.gpa, &[_]u32{ |
| 2403 | @intFromEnum(std.wasm.SimdOpcode.v128_load), | |
| 2403 | @backingInt(std.wasm.SimdOpcode.v128_load), | |
| 2404 | 2404 | offset + operand.offset(), |
| 2405 | 2405 | @intCast(ty.abiAlignment(zcu).toByteUnits().?), |
| 2406 | 2406 | }); |
| ... | ... | @@ -5241,7 +5241,7 @@ fn airCondBr(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 5241 | 5241 | } |
| 5242 | 5242 | |
| 5243 | 5243 | fn airCmp(cg: *CodeGen, inst: Air.Inst.Index, op: std.math.CompareOperator) InnerError!void { |
| 5244 | const bin_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 5244 | const bin_op = cg.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 5245 | 5245 | const lhs = try cg.resolveInst(bin_op.lhs); |
| 5246 | 5246 | const rhs = try cg.resolveInst(bin_op.rhs); |
| 5247 | 5247 | const operand_ty = cg.typeOf(bin_op.lhs); |
| ... | ... | @@ -5473,7 +5473,7 @@ fn airCmpVector(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 5473 | 5473 | } |
| 5474 | 5474 | |
| 5475 | 5475 | fn airCmpLteErrorsLen(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 5476 | const un_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].un_op; | |
| 5476 | const un_op = cg.air.instructions.items(.data)[@backingInt(inst)].un_op; | |
| 5477 | 5477 | const operand = try cg.resolveInst(un_op); |
| 5478 | 5478 | |
| 5479 | 5479 | try cg.emitWValue(operand); |
| ... | ... | @@ -5486,7 +5486,7 @@ fn airCmpLteErrorsLen(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 5486 | 5486 | } |
| 5487 | 5487 | |
| 5488 | 5488 | fn airBr(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 5489 | const br = cg.air.instructions.items(.data)[@intFromEnum(inst)].br; | |
| 5489 | const br = cg.air.instructions.items(.data)[@backingInt(inst)].br; | |
| 5490 | 5490 | const block = cg.blocks.get(br.block_inst).?; |
| 5491 | 5491 | |
| 5492 | 5492 | // if operand has codegen bits we should break with a value |
| ... | ... | @@ -5505,7 +5505,7 @@ fn airBr(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 5505 | 5505 | } |
| 5506 | 5506 | |
| 5507 | 5507 | fn airRepeat(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 5508 | const repeat = cg.air.instructions.items(.data)[@intFromEnum(inst)].repeat; | |
| 5508 | const repeat = cg.air.instructions.items(.data)[@backingInt(inst)].repeat; | |
| 5509 | 5509 | const loop_label = cg.loops.get(repeat.loop_inst).?; |
| 5510 | 5510 | |
| 5511 | 5511 | const idx: u32 = cg.block_depth - loop_label; |
| ... | ... | @@ -5533,7 +5533,7 @@ fn airUnreachable(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 5533 | 5533 | |
| 5534 | 5534 | fn airNopCast(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 5535 | 5535 | const zcu = cg.pt.zcu; |
| 5536 | const ty_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 5536 | const ty_op = cg.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 5537 | 5537 | |
| 5538 | 5538 | const operand_ty = cg.typeOf(ty_op.operand); |
| 5539 | 5539 | const dest_ty = cg.typeOfIndex(inst); |
| ... | ... | @@ -5548,7 +5548,7 @@ fn airNopCast(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 5548 | 5548 | |
| 5549 | 5549 | fn airIntFromPtr(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 5550 | 5550 | const zcu = cg.pt.zcu; |
| 5551 | const ty_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 5551 | const ty_op = cg.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 5552 | 5552 | |
| 5553 | 5553 | const operand_ty = cg.typeOf(ty_op.operand); |
| 5554 | 5554 | const dest_ty = cg.typeOfIndex(inst); |
| ... | ... | @@ -5566,7 +5566,7 @@ fn airIntFromPtr(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 5566 | 5566 | |
| 5567 | 5567 | fn airUnionFromEnum(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 5568 | 5568 | const zcu = cg.pt.zcu; |
| 5569 | const ty_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 5569 | const ty_op = cg.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 5570 | 5570 | |
| 5571 | 5571 | const union_ty = cg.typeOfIndex(inst); |
| 5572 | 5572 | const enum_ty = cg.typeOf(ty_op.operand); |
| ... | ... | @@ -5580,7 +5580,7 @@ fn airUnionFromEnum(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 5580 | 5580 | } |
| 5581 | 5581 | |
| 5582 | 5582 | fn airBitcast(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 5583 | const ty_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 5583 | const ty_op = cg.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 5584 | 5584 | const operand = try cg.resolveInst(ty_op.operand); |
| 5585 | 5585 | const dest_ty = cg.typeOfIndex(inst); |
| 5586 | 5586 | const src_ty = cg.typeOf(ty_op.operand); |
| ... | ... | @@ -5690,7 +5690,7 @@ fn bitcast(cg: *CodeGen, dest_ty: Type, src_ty: Type, operand: WValue) InnerErro |
| 5690 | 5690 | |
| 5691 | 5691 | fn airStructFieldPtr(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 5692 | 5692 | const zcu = cg.pt.zcu; |
| 5693 | const ty_pl = cg.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | |
| 5693 | const ty_pl = cg.air.instructions.items(.data)[@backingInt(inst)].ty_pl; | |
| 5694 | 5694 | const extra = cg.air.extraData(Air.StructField, ty_pl.payload); |
| 5695 | 5695 | |
| 5696 | 5696 | const struct_ptr = try cg.resolveInst(extra.data.struct_operand); |
| ... | ... | @@ -5702,7 +5702,7 @@ fn airStructFieldPtr(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 5702 | 5702 | |
| 5703 | 5703 | fn airStructFieldPtrIndex(cg: *CodeGen, inst: Air.Inst.Index, index: u32) InnerError!void { |
| 5704 | 5704 | const zcu = cg.pt.zcu; |
| 5705 | const ty_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 5705 | const ty_op = cg.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 5706 | 5706 | const struct_ptr = try cg.resolveInst(ty_op.operand); |
| 5707 | 5707 | const struct_ptr_ty = cg.typeOf(ty_op.operand); |
| 5708 | 5708 | const struct_ty = struct_ptr_ty.childType(zcu); |
| ... | ... | @@ -5754,7 +5754,7 @@ fn structFieldPtr( |
| 5754 | 5754 | fn airAggFieldVal(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 5755 | 5755 | const pt = cg.pt; |
| 5756 | 5756 | const zcu = pt.zcu; |
| 5757 | const ty_pl = cg.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | |
| 5757 | const ty_pl = cg.air.instructions.items(.data)[@backingInt(inst)].ty_pl; | |
| 5758 | 5758 | const struct_field = cg.air.extraData(Air.StructField, ty_pl.payload).data; |
| 5759 | 5759 | |
| 5760 | 5760 | const struct_ty = cg.typeOf(struct_field.struct_operand); |
| ... | ... | @@ -5986,7 +5986,7 @@ fn airSwitchBr(cg: *CodeGen, inst: Air.Inst.Index, is_dispatch_loop: bool) Inner |
| 5986 | 5986 | } |
| 5987 | 5987 | |
| 5988 | 5988 | fn airSwitchDispatch(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 5989 | const br = cg.air.instructions.items(.data)[@intFromEnum(inst)].br; | |
| 5989 | const br = cg.air.instructions.items(.data)[@backingInt(inst)].br; | |
| 5990 | 5990 | const switch_loop = cg.blocks.get(br.block_inst).?; |
| 5991 | 5991 | |
| 5992 | 5992 | const operand = try cg.resolveInst(br.operand); |
| ... | ... | @@ -6001,7 +6001,7 @@ fn airSwitchDispatch(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 6001 | 6001 | |
| 6002 | 6002 | fn airIsErr(cg: *CodeGen, inst: Air.Inst.Index, opcode: std.wasm.Opcode, op_kind: enum { value, ptr }) InnerError!void { |
| 6003 | 6003 | const zcu = cg.pt.zcu; |
| 6004 | const un_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].un_op; | |
| 6004 | const un_op = cg.air.instructions.items(.data)[@backingInt(inst)].un_op; | |
| 6005 | 6005 | const operand = try cg.resolveInst(un_op); |
| 6006 | 6006 | const err_union_ty = switch (op_kind) { |
| 6007 | 6007 | .value => cg.typeOf(un_op), |
| ... | ... | @@ -6038,7 +6038,7 @@ fn airIsErr(cg: *CodeGen, inst: Air.Inst.Index, opcode: std.wasm.Opcode, op_kind |
| 6038 | 6038 | /// *(E!T) -> *T op_is_prt == true |
| 6039 | 6039 | fn airUnwrapErrUnionPayload(cg: *CodeGen, inst: Air.Inst.Index, op_is_ptr: bool) InnerError!void { |
| 6040 | 6040 | const zcu = cg.pt.zcu; |
| 6041 | const ty_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 6041 | const ty_op = cg.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 6042 | 6042 | |
| 6043 | 6043 | const operand = try cg.resolveInst(ty_op.operand); |
| 6044 | 6044 | const op_ty = cg.typeOf(ty_op.operand); |
| ... | ... | @@ -6070,7 +6070,7 @@ fn airUnwrapErrUnionPayload(cg: *CodeGen, inst: Air.Inst.Index, op_is_ptr: bool) |
| 6070 | 6070 | /// NOTE: op_is_ptr will not change return type |
| 6071 | 6071 | fn airUnwrapErrUnionError(cg: *CodeGen, inst: Air.Inst.Index, op_is_ptr: bool) InnerError!void { |
| 6072 | 6072 | const zcu = cg.pt.zcu; |
| 6073 | const ty_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 6073 | const ty_op = cg.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 6074 | 6074 | |
| 6075 | 6075 | const operand = try cg.resolveInst(ty_op.operand); |
| 6076 | 6076 | const op_ty = cg.typeOf(ty_op.operand); |
| ... | ... | @@ -6095,7 +6095,7 @@ fn airUnwrapErrUnionError(cg: *CodeGen, inst: Air.Inst.Index, op_is_ptr: bool) I |
| 6095 | 6095 | |
| 6096 | 6096 | fn airWrapErrUnionPayload(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 6097 | 6097 | const zcu = cg.pt.zcu; |
| 6098 | const ty_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 6098 | const ty_op = cg.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 6099 | 6099 | |
| 6100 | 6100 | const operand = try cg.resolveInst(ty_op.operand); |
| 6101 | 6101 | const err_ty = cg.typeOfIndex(inst); |
| ... | ... | @@ -6125,7 +6125,7 @@ fn airWrapErrUnionPayload(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 6125 | 6125 | |
| 6126 | 6126 | fn airWrapErrUnionErr(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 6127 | 6127 | const zcu = cg.pt.zcu; |
| 6128 | const ty_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 6128 | const ty_op = cg.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 6129 | 6129 | |
| 6130 | 6130 | const operand = try cg.resolveInst(ty_op.operand); |
| 6131 | 6131 | const err_ty = ty_op.ty.toType(); |
| ... | ... | @@ -6153,7 +6153,7 @@ fn airWrapErrUnionErr(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 6153 | 6153 | const OpKind = enum { value, ptr }; |
| 6154 | 6154 | |
| 6155 | 6155 | fn airIsNull(cg: *CodeGen, inst: Air.Inst.Index, opcode: std.wasm.Opcode, op_kind: OpKind) InnerError!void { |
| 6156 | const un_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].un_op; | |
| 6156 | const un_op = cg.air.instructions.items(.data)[@backingInt(inst)].un_op; | |
| 6157 | 6157 | const operand = try cg.resolveInst(un_op); |
| 6158 | 6158 | |
| 6159 | 6159 | const op_ty = cg.typeOf(un_op); |
| ... | ... | @@ -6204,7 +6204,7 @@ fn isNull(cg: *CodeGen, operand: WValue, op_ty: Type, opcode: std.wasm.Opcode, o |
| 6204 | 6204 | |
| 6205 | 6205 | fn airOptionalPayload(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 6206 | 6206 | const zcu = cg.pt.zcu; |
| 6207 | const ty_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 6207 | const ty_op = cg.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 6208 | 6208 | const opt_ty = cg.typeOf(ty_op.operand); |
| 6209 | 6209 | const payload_ty = cg.typeOfIndex(inst); |
| 6210 | 6210 | if (!payload_ty.hasRuntimeBits(zcu)) { |
| ... | ... | @@ -6226,7 +6226,7 @@ fn airOptionalPayload(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 6226 | 6226 | |
| 6227 | 6227 | fn airOptionalPayloadPtr(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 6228 | 6228 | const zcu = cg.pt.zcu; |
| 6229 | const ty_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 6229 | const ty_op = cg.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 6230 | 6230 | const operand = try cg.resolveInst(ty_op.operand); |
| 6231 | 6231 | const opt_ty = cg.typeOf(ty_op.operand).childType(zcu); |
| 6232 | 6232 | |
| ... | ... | @@ -6244,7 +6244,7 @@ fn airOptionalPayloadPtr(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 6244 | 6244 | fn airOptionalPayloadPtrSet(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 6245 | 6245 | const pt = cg.pt; |
| 6246 | 6246 | const zcu = pt.zcu; |
| 6247 | const ty_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 6247 | const ty_op = cg.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 6248 | 6248 | const operand = try cg.resolveInst(ty_op.operand); |
| 6249 | 6249 | const opt_ty = cg.typeOf(ty_op.operand).childType(zcu); |
| 6250 | 6250 | const payload_ty = opt_ty.optionalChild(zcu); |
| ... | ... | @@ -6266,7 +6266,7 @@ fn airOptionalPayloadPtrSet(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void |
| 6266 | 6266 | } |
| 6267 | 6267 | |
| 6268 | 6268 | fn airWrapOptional(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 6269 | const ty_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 6269 | const ty_op = cg.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 6270 | 6270 | const payload_ty = cg.typeOf(ty_op.operand); |
| 6271 | 6271 | const pt = cg.pt; |
| 6272 | 6272 | const zcu = pt.zcu; |
| ... | ... | @@ -6304,7 +6304,7 @@ fn airWrapOptional(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 6304 | 6304 | } |
| 6305 | 6305 | |
| 6306 | 6306 | fn airSlice(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 6307 | const ty_pl = cg.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | |
| 6307 | const ty_pl = cg.air.instructions.items(.data)[@backingInt(inst)].ty_pl; | |
| 6308 | 6308 | const bin_op = cg.air.extraData(Air.Bin, ty_pl.payload).data; |
| 6309 | 6309 | |
| 6310 | 6310 | const lhs = try cg.resolveInst(bin_op.lhs); |
| ... | ... | @@ -6319,7 +6319,7 @@ fn airSlice(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 6319 | 6319 | } |
| 6320 | 6320 | |
| 6321 | 6321 | fn airSliceLen(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 6322 | const ty_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 6322 | const ty_op = cg.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 6323 | 6323 | |
| 6324 | 6324 | const operand = try cg.resolveInst(ty_op.operand); |
| 6325 | 6325 | return cg.finishAir(inst, try cg.sliceLen(operand), &.{ty_op.operand}); |
| ... | ... | @@ -6327,7 +6327,7 @@ fn airSliceLen(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 6327 | 6327 | |
| 6328 | 6328 | fn airSliceElemVal(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 6329 | 6329 | const zcu = cg.pt.zcu; |
| 6330 | const bin_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 6330 | const bin_op = cg.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 6331 | 6331 | |
| 6332 | 6332 | const slice_ty = cg.typeOf(bin_op.lhs); |
| 6333 | 6333 | const slice = try cg.resolveInst(bin_op.lhs); |
| ... | ... | @@ -6351,7 +6351,7 @@ fn airSliceElemVal(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 6351 | 6351 | |
| 6352 | 6352 | fn airSliceElemPtr(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 6353 | 6353 | const zcu = cg.pt.zcu; |
| 6354 | const ty_pl = cg.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | |
| 6354 | const ty_pl = cg.air.instructions.items(.data)[@backingInt(inst)].ty_pl; | |
| 6355 | 6355 | const bin_op = cg.air.extraData(Air.Bin, ty_pl.payload).data; |
| 6356 | 6356 | |
| 6357 | 6357 | const elem_ty = ty_pl.ty.toType().childType(zcu); |
| ... | ... | @@ -6372,7 +6372,7 @@ fn airSliceElemPtr(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 6372 | 6372 | } |
| 6373 | 6373 | |
| 6374 | 6374 | fn airSlicePtr(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 6375 | const ty_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 6375 | const ty_op = cg.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 6376 | 6376 | const operand = try cg.resolveInst(ty_op.operand); |
| 6377 | 6377 | return cg.finishAir(inst, try cg.slicePtr(operand), &.{ty_op.operand}); |
| 6378 | 6378 | } |
| ... | ... | @@ -6389,7 +6389,7 @@ fn sliceLen(cg: *CodeGen, operand: WValue) InnerError!WValue { |
| 6389 | 6389 | |
| 6390 | 6390 | fn airArrayToSlice(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 6391 | 6391 | const zcu = cg.pt.zcu; |
| 6392 | const ty_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 6392 | const ty_op = cg.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 6393 | 6393 | |
| 6394 | 6394 | const operand = try cg.resolveInst(ty_op.operand); |
| 6395 | 6395 | const array_ty = cg.typeOf(ty_op.operand).childType(zcu); |
| ... | ... | @@ -6409,7 +6409,7 @@ fn airArrayToSlice(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 6409 | 6409 | |
| 6410 | 6410 | fn airPtrElemVal(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 6411 | 6411 | const zcu = cg.pt.zcu; |
| 6412 | const bin_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 6412 | const bin_op = cg.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 6413 | 6413 | |
| 6414 | 6414 | const ptr_ty = cg.typeOf(bin_op.lhs); |
| 6415 | 6415 | const ptr = try cg.resolveInst(bin_op.lhs); |
| ... | ... | @@ -6437,7 +6437,7 @@ fn airPtrElemVal(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 6437 | 6437 | |
| 6438 | 6438 | fn airPtrElemPtr(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 6439 | 6439 | const zcu = cg.pt.zcu; |
| 6440 | const ty_pl = cg.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | |
| 6440 | const ty_pl = cg.air.instructions.items(.data)[@backingInt(inst)].ty_pl; | |
| 6441 | 6441 | const bin_op = cg.air.extraData(Air.Bin, ty_pl.payload).data; |
| 6442 | 6442 | |
| 6443 | 6443 | const ptr_ty = cg.typeOf(bin_op.lhs); |
| ... | ... | @@ -6465,7 +6465,7 @@ fn airPtrElemPtr(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 6465 | 6465 | |
| 6466 | 6466 | fn airPtrBinOp(cg: *CodeGen, inst: Air.Inst.Index, op: enum { add, sub }) InnerError!void { |
| 6467 | 6467 | const zcu = cg.pt.zcu; |
| 6468 | const ty_pl = cg.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | |
| 6468 | const ty_pl = cg.air.instructions.items(.data)[@backingInt(inst)].ty_pl; | |
| 6469 | 6469 | const bin_op = cg.air.extraData(Air.Bin, ty_pl.payload).data; |
| 6470 | 6470 | |
| 6471 | 6471 | const ptr = try cg.resolveInst(bin_op.lhs); |
| ... | ... | @@ -6503,7 +6503,7 @@ fn airPtrBinOp(cg: *CodeGen, inst: Air.Inst.Index, op: enum { add, sub }) InnerE |
| 6503 | 6503 | |
| 6504 | 6504 | fn airMemset(cg: *CodeGen, inst: Air.Inst.Index, safety: bool) InnerError!void { |
| 6505 | 6505 | const zcu = cg.pt.zcu; |
| 6506 | const bin_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 6506 | const bin_op = cg.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 6507 | 6507 | |
| 6508 | 6508 | const ptr = try cg.resolveInst(bin_op.lhs); |
| 6509 | 6509 | const ptr_ty = cg.typeOf(bin_op.lhs); |
| ... | ... | @@ -6643,7 +6643,7 @@ fn memset(cg: *CodeGen, elem_ty: Type, ptr: WValue, len: WValue, value: WValue) |
| 6643 | 6643 | |
| 6644 | 6644 | fn airArrayElemVal(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 6645 | 6645 | const zcu = cg.pt.zcu; |
| 6646 | const bin_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 6646 | const bin_op = cg.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 6647 | 6647 | |
| 6648 | 6648 | const array_ty = cg.typeOf(bin_op.lhs); |
| 6649 | 6649 | const array = try cg.resolveInst(bin_op.lhs); |
| ... | ... | @@ -6670,7 +6670,7 @@ fn airArrayElemVal(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 6670 | 6670 | else => unreachable, |
| 6671 | 6671 | }; |
| 6672 | 6672 | |
| 6673 | var operands = [_]u32{ @intFromEnum(opcode), @as(u8, @intCast(lane)) }; | |
| 6673 | var operands = [_]u32{ @backingInt(opcode), @as(u8, @intCast(lane)) }; | |
| 6674 | 6674 | |
| 6675 | 6675 | try cg.emitWValue(array); |
| 6676 | 6676 | |
| ... | ... | @@ -6703,7 +6703,7 @@ fn airArrayElemVal(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 6703 | 6703 | |
| 6704 | 6704 | fn airSplat(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 6705 | 6705 | const zcu = cg.pt.zcu; |
| 6706 | const ty_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 6706 | const ty_op = cg.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 6707 | 6707 | const operand = try cg.resolveInst(ty_op.operand); |
| 6708 | 6708 | const ty = cg.typeOfIndex(inst); |
| 6709 | 6709 | const elem_ty = ty.childType(zcu); |
| ... | ... | @@ -6715,10 +6715,10 @@ fn airSplat(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 6715 | 6715 | // the scalar value onto the stack. |
| 6716 | 6716 | .stack_offset, .nav_ref, .uav_ref => { |
| 6717 | 6717 | const opcode = switch (elem_ty.bitSize(zcu)) { |
| 6718 | 8 => @intFromEnum(std.wasm.SimdOpcode.v128_load8_splat), | |
| 6719 | 16 => @intFromEnum(std.wasm.SimdOpcode.v128_load16_splat), | |
| 6720 | 32 => @intFromEnum(std.wasm.SimdOpcode.v128_load32_splat), | |
| 6721 | 64 => @intFromEnum(std.wasm.SimdOpcode.v128_load64_splat), | |
| 6718 | 8 => @backingInt(std.wasm.SimdOpcode.v128_load8_splat), | |
| 6719 | 16 => @backingInt(std.wasm.SimdOpcode.v128_load16_splat), | |
| 6720 | 32 => @backingInt(std.wasm.SimdOpcode.v128_load32_splat), | |
| 6721 | 64 => @backingInt(std.wasm.SimdOpcode.v128_load64_splat), | |
| 6722 | 6722 | else => break :blk, // Cannot make use of simd-instructions |
| 6723 | 6723 | }; |
| 6724 | 6724 | try cg.emitWValue(operand); |
| ... | ... | @@ -6734,10 +6734,10 @@ fn airSplat(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 6734 | 6734 | }, |
| 6735 | 6735 | .local => { |
| 6736 | 6736 | const opcode = switch (elem_ty.bitSize(zcu)) { |
| 6737 | 8 => @intFromEnum(std.wasm.SimdOpcode.i8x16_splat), | |
| 6738 | 16 => @intFromEnum(std.wasm.SimdOpcode.i16x8_splat), | |
| 6739 | 32 => if (elem_ty.isInt(zcu)) @intFromEnum(std.wasm.SimdOpcode.i32x4_splat) else @intFromEnum(std.wasm.SimdOpcode.f32x4_splat), | |
| 6740 | 64 => if (elem_ty.isInt(zcu)) @intFromEnum(std.wasm.SimdOpcode.i64x2_splat) else @intFromEnum(std.wasm.SimdOpcode.f64x2_splat), | |
| 6737 | 8 => @backingInt(std.wasm.SimdOpcode.i8x16_splat), | |
| 6738 | 16 => @backingInt(std.wasm.SimdOpcode.i16x8_splat), | |
| 6739 | 32 => if (elem_ty.isInt(zcu)) @backingInt(std.wasm.SimdOpcode.i32x4_splat) else @backingInt(std.wasm.SimdOpcode.f32x4_splat), | |
| 6740 | 64 => if (elem_ty.isInt(zcu)) @backingInt(std.wasm.SimdOpcode.i64x2_splat) else @backingInt(std.wasm.SimdOpcode.f64x2_splat), | |
| 6741 | 6741 | else => break :blk, // Cannot make use of simd-instructions |
| 6742 | 6742 | }; |
| 6743 | 6743 | try cg.emitWValue(operand); |
| ... | ... | @@ -6764,7 +6764,7 @@ fn airSplat(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 6764 | 6764 | } |
| 6765 | 6765 | |
| 6766 | 6766 | fn airSelect(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 6767 | const pl_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].pl_op; | |
| 6767 | const pl_op = cg.air.instructions.items(.data)[@backingInt(inst)].pl_op; | |
| 6768 | 6768 | const operand = try cg.resolveInst(pl_op.operand); |
| 6769 | 6769 | |
| 6770 | 6770 | _ = operand; |
| ... | ... | @@ -6843,7 +6843,7 @@ fn airShuffleTwo(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 6843 | 6843 | try cg.emitWValue(operand_b); |
| 6844 | 6844 | const extra_index: u32 = @intCast(cg.mir_extra.items.len); |
| 6845 | 6845 | try cg.mir_extra.appendSlice(cg.gpa, &.{ |
| 6846 | @intFromEnum(std.wasm.SimdOpcode.i8x16_shuffle), | |
| 6846 | @backingInt(std.wasm.SimdOpcode.i8x16_shuffle), | |
| 6847 | 6847 | @bitCast(lane_map[0..4].*), |
| 6848 | 6848 | @bitCast(lane_map[4..8].*), |
| 6849 | 6849 | @bitCast(lane_map[8..12].*), |
| ... | ... | @@ -6873,7 +6873,7 @@ fn airShuffleTwo(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 6873 | 6873 | } |
| 6874 | 6874 | |
| 6875 | 6875 | fn airReduce(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 6876 | const reduce = cg.air.instructions.items(.data)[@intFromEnum(inst)].reduce; | |
| 6876 | const reduce = cg.air.instructions.items(.data)[@backingInt(inst)].reduce; | |
| 6877 | 6877 | const operand = try cg.resolveInst(reduce.operand); |
| 6878 | 6878 | |
| 6879 | 6879 | _ = operand; |
| ... | ... | @@ -6883,7 +6883,7 @@ fn airReduce(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 6883 | 6883 | fn airAggregateInit(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 6884 | 6884 | const pt = cg.pt; |
| 6885 | 6885 | const zcu = pt.zcu; |
| 6886 | const ty_pl = cg.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | |
| 6886 | const ty_pl = cg.air.instructions.items(.data)[@backingInt(inst)].ty_pl; | |
| 6887 | 6887 | const result_ty = cg.typeOfIndex(inst); |
| 6888 | 6888 | const len = @as(usize, @intCast(result_ty.arrayLen(zcu))); |
| 6889 | 6889 | const elements: []const Air.Inst.Ref = @ptrCast(cg.air.extra.items[ty_pl.payload..][0..len]); |
| ... | ... | @@ -6960,7 +6960,7 @@ fn airUnionInit(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 6960 | 6960 | const pt = cg.pt; |
| 6961 | 6961 | const zcu = pt.zcu; |
| 6962 | 6962 | const ip = &zcu.intern_pool; |
| 6963 | const ty_pl = cg.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | |
| 6963 | const ty_pl = cg.air.instructions.items(.data)[@backingInt(inst)].ty_pl; | |
| 6964 | 6964 | const extra = cg.air.extraData(Air.UnionInit, ty_pl.payload).data; |
| 6965 | 6965 | |
| 6966 | 6966 | const result = result: { |
| ... | ... | @@ -7019,19 +7019,19 @@ fn airUnionInit(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 7019 | 7019 | } |
| 7020 | 7020 | |
| 7021 | 7021 | fn airPrefetch(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 7022 | const prefetch = cg.air.instructions.items(.data)[@intFromEnum(inst)].prefetch; | |
| 7022 | const prefetch = cg.air.instructions.items(.data)[@backingInt(inst)].prefetch; | |
| 7023 | 7023 | return cg.finishAir(inst, .none, &.{prefetch.ptr}); |
| 7024 | 7024 | } |
| 7025 | 7025 | |
| 7026 | 7026 | fn airWasmMemorySize(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 7027 | const pl_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].pl_op; | |
| 7027 | const pl_op = cg.air.instructions.items(.data)[@backingInt(inst)].pl_op; | |
| 7028 | 7028 | |
| 7029 | 7029 | try cg.addLabel(.memory_size, pl_op.payload); |
| 7030 | 7030 | return cg.finishAir(inst, .stack, &.{pl_op.operand}); |
| 7031 | 7031 | } |
| 7032 | 7032 | |
| 7033 | 7033 | fn airWasmMemoryGrow(cg: *CodeGen, inst: Air.Inst.Index) !void { |
| 7034 | const pl_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].pl_op; | |
| 7034 | const pl_op = cg.air.instructions.items(.data)[@backingInt(inst)].pl_op; | |
| 7035 | 7035 | |
| 7036 | 7036 | const operand = try cg.resolveInst(pl_op.operand); |
| 7037 | 7037 | try cg.emitWValue(operand); |
| ... | ... | @@ -7042,7 +7042,7 @@ fn airWasmMemoryGrow(cg: *CodeGen, inst: Air.Inst.Index) !void { |
| 7042 | 7042 | fn airSetUnionTag(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 7043 | 7043 | const pt = cg.pt; |
| 7044 | 7044 | const zcu = pt.zcu; |
| 7045 | const bin_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 7045 | const bin_op = cg.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 7046 | 7046 | const un_ty = cg.typeOf(bin_op.lhs).childType(zcu); |
| 7047 | 7047 | const tag_ty = cg.typeOf(bin_op.rhs); |
| 7048 | 7048 | const layout = un_ty.unionGetLayout(zcu); |
| ... | ... | @@ -7066,7 +7066,7 @@ fn airSetUnionTag(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 7066 | 7066 | |
| 7067 | 7067 | fn airGetUnionTag(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 7068 | 7068 | const zcu = cg.pt.zcu; |
| 7069 | const ty_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 7069 | const ty_op = cg.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 7070 | 7070 | |
| 7071 | 7071 | const un_ty = cg.typeOf(ty_op.operand); |
| 7072 | 7072 | const tag_ty = cg.typeOfIndex(inst); |
| ... | ... | @@ -7086,7 +7086,7 @@ fn airGetUnionTag(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 7086 | 7086 | |
| 7087 | 7087 | fn airErrUnionPayloadPtrSet(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 7088 | 7088 | const zcu = cg.pt.zcu; |
| 7089 | const ty_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 7089 | const ty_op = cg.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 7090 | 7090 | |
| 7091 | 7091 | const err_set_ty = cg.typeOf(ty_op.operand).childType(zcu); |
| 7092 | 7092 | const payload_ty = err_set_ty.errorUnionPayload(zcu); |
| ... | ... | @@ -7113,7 +7113,7 @@ fn airErrUnionPayloadPtrSet(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void |
| 7113 | 7113 | fn airFieldParentPtr(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 7114 | 7114 | const pt = cg.pt; |
| 7115 | 7115 | const zcu = pt.zcu; |
| 7116 | const ty_pl = cg.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | |
| 7116 | const ty_pl = cg.air.instructions.items(.data)[@backingInt(inst)].ty_pl; | |
| 7117 | 7117 | const extra = cg.air.extraData(Air.FieldParentPtr, ty_pl.payload).data; |
| 7118 | 7118 | |
| 7119 | 7119 | const field_ptr = try cg.resolveInst(extra.field_ptr); |
| ... | ... | @@ -7154,7 +7154,7 @@ fn sliceOrArrayPtr(cg: *CodeGen, ptr: WValue, ptr_ty: Type) InnerError!WValue { |
| 7154 | 7154 | |
| 7155 | 7155 | fn airMemcpy(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 7156 | 7156 | const zcu = cg.pt.zcu; |
| 7157 | const bin_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 7157 | const bin_op = cg.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 7158 | 7158 | const dst = try cg.resolveInst(bin_op.lhs); |
| 7159 | 7159 | const dst_ty = cg.typeOf(bin_op.lhs); |
| 7160 | 7160 | const ptr_elem_ty = dst_ty.childType(zcu); |
| ... | ... | @@ -7185,7 +7185,7 @@ fn airMemcpy(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 7185 | 7185 | |
| 7186 | 7186 | fn airMemmove(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 7187 | 7187 | const zcu = cg.pt.zcu; |
| 7188 | const bin_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 7188 | const bin_op = cg.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 7189 | 7189 | const dst = try cg.resolveInst(bin_op.lhs); |
| 7190 | 7190 | const dst_ty = cg.typeOf(bin_op.lhs); |
| 7191 | 7191 | const ptr_elem_ty = dst_ty.childType(zcu); |
| ... | ... | @@ -7223,7 +7223,7 @@ fn airRetAddr(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 7223 | 7223 | } |
| 7224 | 7224 | |
| 7225 | 7225 | fn airErrorName(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 7226 | const un_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].un_op; | |
| 7226 | const un_op = cg.air.instructions.items(.data)[@backingInt(inst)].un_op; | |
| 7227 | 7227 | const operand = try cg.resolveInst(un_op); |
| 7228 | 7228 | // Each entry to this table is a slice (ptr+len). |
| 7229 | 7229 | // The operand in this instruction represents the index within this table. |
| ... | ... | @@ -7257,14 +7257,14 @@ fn airErrorName(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 7257 | 7257 | } |
| 7258 | 7258 | |
| 7259 | 7259 | fn airPtrSliceFieldPtr(cg: *CodeGen, inst: Air.Inst.Index, offset: u32) InnerError!void { |
| 7260 | const ty_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 7260 | const ty_op = cg.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 7261 | 7261 | const slice_ptr = try cg.resolveInst(ty_op.operand); |
| 7262 | 7262 | const result = try cg.buildPointerOffset(slice_ptr, offset, .new); |
| 7263 | 7263 | return cg.finishAir(inst, result, &.{ty_op.operand}); |
| 7264 | 7264 | } |
| 7265 | 7265 | |
| 7266 | 7266 | fn airDbgStmt(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 7267 | const dbg_stmt = cg.air.instructions.items(.data)[@intFromEnum(inst)].dbg_stmt; | |
| 7267 | const dbg_stmt = cg.air.instructions.items(.data)[@backingInt(inst)].dbg_stmt; | |
| 7268 | 7268 | try cg.addInst(.{ .tag = .dbg_line, .data = .{ |
| 7269 | 7269 | .payload = try cg.addExtra(Mir.DbgLineColumn{ |
| 7270 | 7270 | .line = dbg_stmt.line, |
| ... | ... | @@ -7408,7 +7408,7 @@ fn callIntrinsic( |
| 7408 | 7408 | } |
| 7409 | 7409 | |
| 7410 | 7410 | fn airTagName(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 7411 | const un_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].un_op; | |
| 7411 | const un_op = cg.air.instructions.items(.data)[@backingInt(inst)].un_op; | |
| 7412 | 7412 | const operand = try cg.resolveInst(un_op); |
| 7413 | 7413 | const enum_ty = cg.typeOf(un_op); |
| 7414 | 7414 | |
| ... | ... | @@ -7433,7 +7433,7 @@ fn airTagName(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 7433 | 7433 | } |
| 7434 | 7434 | |
| 7435 | 7435 | fn airIsNamedEnumValue(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 7436 | const un_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].un_op; | |
| 7436 | const un_op = cg.air.instructions.items(.data)[@backingInt(inst)].un_op; | |
| 7437 | 7437 | const operand = try cg.resolveInst(un_op); |
| 7438 | 7438 | const enum_ty = cg.typeOf(un_op); |
| 7439 | 7439 | |
| ... | ... | @@ -7448,7 +7448,7 @@ fn airIsNamedEnumValue(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 7448 | 7448 | fn airErrorSetHasValue(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 7449 | 7449 | const zcu = cg.pt.zcu; |
| 7450 | 7450 | const ip = &zcu.intern_pool; |
| 7451 | const ty_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 7451 | const ty_op = cg.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 7452 | 7452 | |
| 7453 | 7453 | const operand = try cg.resolveInst(ty_op.operand); |
| 7454 | 7454 | const error_set_ty = ty_op.ty.toType(); |
| ... | ... | @@ -7534,7 +7534,7 @@ inline fn useAtomicFeature(cg: *const CodeGen) bool { |
| 7534 | 7534 | |
| 7535 | 7535 | fn airCmpxchg(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 7536 | 7536 | const zcu = cg.pt.zcu; |
| 7537 | const ty_pl = cg.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | |
| 7537 | const ty_pl = cg.air.instructions.items(.data)[@backingInt(inst)].ty_pl; | |
| 7538 | 7538 | const extra = cg.air.extraData(Air.Cmpxchg, ty_pl.payload).data; |
| 7539 | 7539 | |
| 7540 | 7540 | const ptr_ty = cg.typeOf(extra.ptr); |
| ... | ... | @@ -7609,7 +7609,7 @@ fn airCmpxchg(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 7609 | 7609 | |
| 7610 | 7610 | fn airAtomicLoad(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 7611 | 7611 | const zcu = cg.pt.zcu; |
| 7612 | const atomic_load = cg.air.instructions.items(.data)[@intFromEnum(inst)].atomic_load; | |
| 7612 | const atomic_load = cg.air.instructions.items(.data)[@backingInt(inst)].atomic_load; | |
| 7613 | 7613 | const ptr = try cg.resolveInst(atomic_load.ptr); |
| 7614 | 7614 | const ty = cg.typeOfIndex(inst); |
| 7615 | 7615 | |
| ... | ... | @@ -7635,7 +7635,7 @@ fn airAtomicLoad(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 7635 | 7635 | |
| 7636 | 7636 | fn airAtomicRmw(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 7637 | 7637 | const zcu = cg.pt.zcu; |
| 7638 | const pl_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].pl_op; | |
| 7638 | const pl_op = cg.air.instructions.items(.data)[@backingInt(inst)].pl_op; | |
| 7639 | 7639 | const extra = cg.air.extraData(Air.AtomicRmw, pl_op.payload).data; |
| 7640 | 7640 | |
| 7641 | 7641 | const ptr = try cg.resolveInst(pl_op.operand); |
| ... | ... | @@ -7838,7 +7838,7 @@ fn airAtomicRmw(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 7838 | 7838 | |
| 7839 | 7839 | fn airAtomicStore(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 7840 | 7840 | const zcu = cg.pt.zcu; |
| 7841 | const bin_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 7841 | const bin_op = cg.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 7842 | 7842 | |
| 7843 | 7843 | const ptr = try cg.resolveInst(bin_op.lhs); |
| 7844 | 7844 | const operand = try cg.resolveInst(bin_op.rhs); |
| ... | ... | @@ -7875,7 +7875,7 @@ fn airFrameAddress(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 7875 | 7875 | } |
| 7876 | 7876 | |
| 7877 | 7877 | fn airRuntimeNavPtr(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 7878 | const ty_nav = cg.air.instructions.items(.data)[@intFromEnum(inst)].ty_nav; | |
| 7878 | const ty_nav = cg.air.instructions.items(.data)[@backingInt(inst)].ty_nav; | |
| 7879 | 7879 | const mod = cg.pt.zcu.navFileScope(cg.owner_nav).mod.?; |
| 7880 | 7880 | if (mod.single_threaded) { |
| 7881 | 7881 | const result: WValue = .{ .nav_ref = .{ |
src/codegen/wasm/Emit.zig+39-39| ... | ... | @@ -42,8 +42,8 @@ pub fn lowerToCode(emit: *Emit) Error!void { |
| 42 | 42 | .block, .loop => { |
| 43 | 43 | const block_type = datas[inst].block_type; |
| 44 | 44 | try code.ensureUnusedCapacity(gpa, 2); |
| 45 | code.appendAssumeCapacity(@intFromEnum(tags[inst])); | |
| 46 | code.appendAssumeCapacity(@intFromEnum(block_type)); | |
| 45 | code.appendAssumeCapacity(@backingInt(tags[inst])); | |
| 46 | code.appendAssumeCapacity(@backingInt(block_type)); | |
| 47 | 47 | |
| 48 | 48 | inst += 1; |
| 49 | 49 | continue :loop tags[inst]; |
| ... | ... | @@ -78,14 +78,14 @@ pub fn lowerToCode(emit: *Emit) Error!void { |
| 78 | 78 | continue :loop tags[inst]; |
| 79 | 79 | }, |
| 80 | 80 | .func_ref => { |
| 81 | const indirect_func_idx: Wasm.ZcuIndirectFunctionSetIndex = @enumFromInt( | |
| 81 | const indirect_func_idx: Wasm.ZcuIndirectFunctionSetIndex = @fromBackingInt(@intCast( | |
| 82 | 82 | wasm.zcu_indirect_function_set.getIndex(datas[inst].nav_index).?, |
| 83 | ); | |
| 84 | code.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.i32_const)); | |
| 83 | )); | |
| 84 | code.appendAssumeCapacity(@backingInt(std.wasm.Opcode.i32_const)); | |
| 85 | 85 | if (is_obj) { |
| 86 | 86 | @panic("TODO"); |
| 87 | 87 | } else { |
| 88 | writeSleb128(code, 1 + @intFromEnum(indirect_func_idx)); | |
| 88 | writeSleb128(code, 1 + @backingInt(indirect_func_idx)); | |
| 89 | 89 | } |
| 90 | 90 | inst += 1; |
| 91 | 91 | continue :loop tags[inst]; |
| ... | ... | @@ -96,7 +96,7 @@ pub fn lowerToCode(emit: *Emit) Error!void { |
| 96 | 96 | }, |
| 97 | 97 | .errors_len => { |
| 98 | 98 | try code.ensureUnusedCapacity(gpa, 6); |
| 99 | code.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.i32_const)); | |
| 99 | code.appendAssumeCapacity(@backingInt(std.wasm.Opcode.i32_const)); | |
| 100 | 100 | // MIR is lowered during flush, so there is indeed only one thread at this time. |
| 101 | 101 | const errors_len = 1 + comp.zcu.?.intern_pool.global_error_set.getNamesFromMainThread().len; |
| 102 | 102 | writeSleb128(code, errors_len); |
| ... | ... | @@ -108,7 +108,7 @@ pub fn lowerToCode(emit: *Emit) Error!void { |
| 108 | 108 | wasm.error_name_table_ref_count += 1; |
| 109 | 109 | try code.ensureUnusedCapacity(gpa, 11); |
| 110 | 110 | const opcode: std.wasm.Opcode = if (is_wasm32) .i32_const else .i64_const; |
| 111 | code.appendAssumeCapacity(@intFromEnum(opcode)); | |
| 111 | code.appendAssumeCapacity(@backingInt(opcode)); | |
| 112 | 112 | if (is_obj) { |
| 113 | 113 | try wasm.out_relocs.append(gpa, .{ |
| 114 | 114 | .offset = @intCast(code.items.len), |
| ... | ... | @@ -130,7 +130,7 @@ pub fn lowerToCode(emit: *Emit) Error!void { |
| 130 | 130 | }, |
| 131 | 131 | .br_if, .br, .memory_grow, .memory_size => { |
| 132 | 132 | try code.ensureUnusedCapacity(gpa, 11); |
| 133 | code.appendAssumeCapacity(@intFromEnum(tags[inst])); | |
| 133 | code.appendAssumeCapacity(@backingInt(tags[inst])); | |
| 134 | 134 | writeUleb128(code, datas[inst].label); |
| 135 | 135 | |
| 136 | 136 | inst += 1; |
| ... | ... | @@ -139,7 +139,7 @@ pub fn lowerToCode(emit: *Emit) Error!void { |
| 139 | 139 | |
| 140 | 140 | .local_get, .local_set, .local_tee => { |
| 141 | 141 | try code.ensureUnusedCapacity(gpa, 11); |
| 142 | code.appendAssumeCapacity(@intFromEnum(tags[inst])); | |
| 142 | code.appendAssumeCapacity(@backingInt(tags[inst])); | |
| 143 | 143 | writeUleb128(code, datas[inst].local); |
| 144 | 144 | |
| 145 | 145 | inst += 1; |
| ... | ... | @@ -151,7 +151,7 @@ pub fn lowerToCode(emit: *Emit) Error!void { |
| 151 | 151 | const extra = mir.extraData(Mir.JumpTable, extra_index); |
| 152 | 152 | const labels = mir.extra[extra.end..][0..extra.data.length]; |
| 153 | 153 | try code.ensureUnusedCapacity(gpa, 11 + 10 * labels.len); |
| 154 | code.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.br_table)); | |
| 154 | code.appendAssumeCapacity(@backingInt(std.wasm.Opcode.br_table)); | |
| 155 | 155 | // -1 because default label is not part of length/depth. |
| 156 | 156 | writeUleb128(code, extra.data.length - 1); |
| 157 | 157 | for (labels) |label| writeUleb128(code, label); |
| ... | ... | @@ -162,7 +162,7 @@ pub fn lowerToCode(emit: *Emit) Error!void { |
| 162 | 162 | |
| 163 | 163 | .call_nav => { |
| 164 | 164 | try code.ensureUnusedCapacity(gpa, 6); |
| 165 | code.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.call)); | |
| 165 | code.appendAssumeCapacity(@backingInt(std.wasm.Opcode.call)); | |
| 166 | 166 | if (is_obj) { |
| 167 | 167 | try wasm.out_relocs.append(gpa, .{ |
| 168 | 168 | .offset = @intCast(code.items.len), |
| ... | ... | @@ -190,7 +190,7 @@ pub fn lowerToCode(emit: *Emit) Error!void { |
| 190 | 190 | target, |
| 191 | 191 | ).?; |
| 192 | 192 | if (is_obj) { |
| 193 | code.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.call_indirect)); | |
| 193 | code.appendAssumeCapacity(@backingInt(std.wasm.Opcode.call_indirect)); | |
| 194 | 194 | try wasm.out_relocs.append(gpa, .{ |
| 195 | 195 | .offset = @intCast(code.items.len), |
| 196 | 196 | .pointee = .{ .type_index = func_ty_index }, |
| ... | ... | @@ -199,7 +199,7 @@ pub fn lowerToCode(emit: *Emit) Error!void { |
| 199 | 199 | }); |
| 200 | 200 | code.appendNTimesAssumeCapacity(0, 5); |
| 201 | 201 | } else { |
| 202 | const index: Wasm.Flush.FuncTypeIndex = @enumFromInt(wasm.flush_buffer.func_types.getIndex(func_ty_index) orelse { | |
| 202 | const index: Wasm.Flush.FuncTypeIndex = @fromBackingInt(@intCast(wasm.flush_buffer.func_types.getIndex(func_ty_index) orelse { | |
| 203 | 203 | // In this case we tried to call a function pointer for |
| 204 | 204 | // which the type signature does not match any function |
| 205 | 205 | // body or function import in the entire wasm executable. |
| ... | ... | @@ -207,12 +207,12 @@ pub fn lowerToCode(emit: *Emit) Error!void { |
| 207 | 207 | // Since there is no way to create a reference to a |
| 208 | 208 | // function without it being in the function table or |
| 209 | 209 | // import table, this instruction is unreachable. |
| 210 | code.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.@"unreachable")); | |
| 210 | code.appendAssumeCapacity(@backingInt(std.wasm.Opcode.@"unreachable")); | |
| 211 | 211 | inst += 1; |
| 212 | 212 | continue :loop tags[inst]; |
| 213 | }); | |
| 214 | code.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.call_indirect)); | |
| 215 | writeUleb128(code, @intFromEnum(index)); | |
| 213 | })); | |
| 214 | code.appendAssumeCapacity(@backingInt(std.wasm.Opcode.call_indirect)); | |
| 215 | writeUleb128(code, @backingInt(index)); | |
| 216 | 216 | } |
| 217 | 217 | writeUleb128(code, @as(u32, 0)); // table index |
| 218 | 218 | |
| ... | ... | @@ -222,7 +222,7 @@ pub fn lowerToCode(emit: *Emit) Error!void { |
| 222 | 222 | |
| 223 | 223 | .call_tag_index => { |
| 224 | 224 | try code.ensureUnusedCapacity(gpa, 6); |
| 225 | code.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.call)); | |
| 225 | code.appendAssumeCapacity(@backingInt(std.wasm.Opcode.call)); | |
| 226 | 226 | if (is_obj) { |
| 227 | 227 | try wasm.out_relocs.append(gpa, .{ |
| 228 | 228 | .offset = @intCast(code.items.len), |
| ... | ... | @@ -242,7 +242,7 @@ pub fn lowerToCode(emit: *Emit) Error!void { |
| 242 | 242 | .enum_tag_name_table_ref => { |
| 243 | 243 | try code.ensureUnusedCapacity(gpa, 11); |
| 244 | 244 | const opcode: std.wasm.Opcode = if (is_wasm32) .i32_const else .i64_const; |
| 245 | code.appendAssumeCapacity(@intFromEnum(opcode)); | |
| 245 | code.appendAssumeCapacity(@backingInt(opcode)); | |
| 246 | 246 | if (is_obj) { |
| 247 | 247 | @panic("TODO"); |
| 248 | 248 | } else { |
| ... | ... | @@ -261,7 +261,7 @@ pub fn lowerToCode(emit: *Emit) Error!void { |
| 261 | 261 | const symbol_name = try wasm.internString(@tagName(datas[inst].intrinsic)); |
| 262 | 262 | |
| 263 | 263 | try code.ensureUnusedCapacity(gpa, 6); |
| 264 | code.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.call)); | |
| 264 | code.appendAssumeCapacity(@backingInt(std.wasm.Opcode.call)); | |
| 265 | 265 | if (is_obj) { |
| 266 | 266 | try wasm.out_relocs.append(gpa, .{ |
| 267 | 267 | .offset = @intCast(code.items.len), |
| ... | ... | @@ -280,7 +280,7 @@ pub fn lowerToCode(emit: *Emit) Error!void { |
| 280 | 280 | |
| 281 | 281 | .global_set_sp => { |
| 282 | 282 | try code.ensureUnusedCapacity(gpa, 6); |
| 283 | code.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.global_set)); | |
| 283 | code.appendAssumeCapacity(@backingInt(std.wasm.Opcode.global_set)); | |
| 284 | 284 | if (is_obj) { |
| 285 | 285 | try wasm.out_relocs.append(gpa, .{ |
| 286 | 286 | .offset = @intCast(code.items.len), |
| ... | ... | @@ -291,7 +291,7 @@ pub fn lowerToCode(emit: *Emit) Error!void { |
| 291 | 291 | code.appendNTimesAssumeCapacity(0, 5); |
| 292 | 292 | } else { |
| 293 | 293 | const sp_global: Wasm.GlobalIndex = .stack_pointer; |
| 294 | writeUleb128(code, @intFromEnum(sp_global)); | |
| 294 | writeUleb128(code, @backingInt(sp_global)); | |
| 295 | 295 | } |
| 296 | 296 | |
| 297 | 297 | inst += 1; |
| ... | ... | @@ -300,7 +300,7 @@ pub fn lowerToCode(emit: *Emit) Error!void { |
| 300 | 300 | |
| 301 | 301 | .f32_const => { |
| 302 | 302 | try code.ensureUnusedCapacity(gpa, 5); |
| 303 | code.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.f32_const)); | |
| 303 | code.appendAssumeCapacity(@backingInt(std.wasm.Opcode.f32_const)); | |
| 304 | 304 | std.mem.writeInt(u32, code.addManyAsArrayAssumeCapacity(4), @bitCast(datas[inst].float32), .little); |
| 305 | 305 | |
| 306 | 306 | inst += 1; |
| ... | ... | @@ -309,7 +309,7 @@ pub fn lowerToCode(emit: *Emit) Error!void { |
| 309 | 309 | |
| 310 | 310 | .f64_const => { |
| 311 | 311 | try code.ensureUnusedCapacity(gpa, 9); |
| 312 | code.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.f64_const)); | |
| 312 | code.appendAssumeCapacity(@backingInt(std.wasm.Opcode.f64_const)); | |
| 313 | 313 | const float64 = mir.extraData(Mir.Float64, datas[inst].payload).data; |
| 314 | 314 | std.mem.writeInt(u64, code.addManyAsArrayAssumeCapacity(8), float64.toInt(), .little); |
| 315 | 315 | |
| ... | ... | @@ -318,7 +318,7 @@ pub fn lowerToCode(emit: *Emit) Error!void { |
| 318 | 318 | }, |
| 319 | 319 | .i32_const => { |
| 320 | 320 | try code.ensureUnusedCapacity(gpa, 6); |
| 321 | code.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.i32_const)); | |
| 321 | code.appendAssumeCapacity(@backingInt(std.wasm.Opcode.i32_const)); | |
| 322 | 322 | writeSleb128(code, datas[inst].imm32); |
| 323 | 323 | |
| 324 | 324 | inst += 1; |
| ... | ... | @@ -326,7 +326,7 @@ pub fn lowerToCode(emit: *Emit) Error!void { |
| 326 | 326 | }, |
| 327 | 327 | .i64_const => { |
| 328 | 328 | try code.ensureUnusedCapacity(gpa, 11); |
| 329 | code.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.i64_const)); | |
| 329 | code.appendAssumeCapacity(@backingInt(std.wasm.Opcode.i64_const)); | |
| 330 | 330 | const int64: i64 = @bitCast(mir.extraData(Mir.Imm64, datas[inst].payload).data.toInt()); |
| 331 | 331 | writeSleb128(code, int64); |
| 332 | 332 | |
| ... | ... | @@ -359,7 +359,7 @@ pub fn lowerToCode(emit: *Emit) Error!void { |
| 359 | 359 | .i64_store32, |
| 360 | 360 | => { |
| 361 | 361 | try code.ensureUnusedCapacity(gpa, 1 + 20); |
| 362 | code.appendAssumeCapacity(@intFromEnum(tags[inst])); | |
| 362 | code.appendAssumeCapacity(@backingInt(tags[inst])); | |
| 363 | 363 | encodeMemArg(code, mir.extraData(Mir.MemArg, datas[inst].payload).data); |
| 364 | 364 | inst += 1; |
| 365 | 365 | continue :loop tags[inst]; |
| ... | ... | @@ -495,7 +495,7 @@ pub fn lowerToCode(emit: *Emit) Error!void { |
| 495 | 495 | .i64_clz, |
| 496 | 496 | .i64_ctz, |
| 497 | 497 | => { |
| 498 | try code.append(gpa, @intFromEnum(tags[inst])); | |
| 498 | try code.append(gpa, @backingInt(tags[inst])); | |
| 499 | 499 | inst += 1; |
| 500 | 500 | continue :loop tags[inst]; |
| 501 | 501 | }, |
| ... | ... | @@ -504,9 +504,9 @@ pub fn lowerToCode(emit: *Emit) Error!void { |
| 504 | 504 | try code.ensureUnusedCapacity(gpa, 6 + 6); |
| 505 | 505 | const extra_index = datas[inst].payload; |
| 506 | 506 | const opcode = mir.extra[extra_index]; |
| 507 | code.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.misc_prefix)); | |
| 507 | code.appendAssumeCapacity(@backingInt(std.wasm.Opcode.misc_prefix)); | |
| 508 | 508 | writeUleb128(code, opcode); |
| 509 | switch (@as(std.wasm.MiscOpcode, @enumFromInt(opcode))) { | |
| 509 | switch (@as(std.wasm.MiscOpcode, @fromBackingInt(@intCast(opcode)))) { | |
| 510 | 510 | // bulk-memory opcodes |
| 511 | 511 | .data_drop => { |
| 512 | 512 | const segment = mir.extra[extra_index + 1]; |
| ... | ... | @@ -566,9 +566,9 @@ pub fn lowerToCode(emit: *Emit) Error!void { |
| 566 | 566 | try code.ensureUnusedCapacity(gpa, 6 + 20); |
| 567 | 567 | const extra_index = datas[inst].payload; |
| 568 | 568 | const opcode = mir.extra[extra_index]; |
| 569 | code.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.simd_prefix)); | |
| 569 | code.appendAssumeCapacity(@backingInt(std.wasm.Opcode.simd_prefix)); | |
| 570 | 570 | writeUleb128(code, opcode); |
| 571 | switch (@as(std.wasm.SimdOpcode, @enumFromInt(opcode))) { | |
| 571 | switch (@as(std.wasm.SimdOpcode, @fromBackingInt(@intCast(opcode)))) { | |
| 572 | 572 | .v128_store, |
| 573 | 573 | .v128_load, |
| 574 | 574 | .v128_load8_splat, |
| ... | ... | @@ -852,9 +852,9 @@ pub fn lowerToCode(emit: *Emit) Error!void { |
| 852 | 852 | |
| 853 | 853 | const extra_index = datas[inst].payload; |
| 854 | 854 | const opcode = mir.extra[extra_index]; |
| 855 | code.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.atomics_prefix)); | |
| 855 | code.appendAssumeCapacity(@backingInt(std.wasm.Opcode.atomics_prefix)); | |
| 856 | 856 | writeUleb128(code, opcode); |
| 857 | switch (@as(std.wasm.AtomicsOpcode, @enumFromInt(opcode))) { | |
| 857 | switch (@as(std.wasm.AtomicsOpcode, @fromBackingInt(@intCast(opcode)))) { | |
| 858 | 858 | .i32_atomic_load, |
| 859 | 859 | .i64_atomic_load, |
| 860 | 860 | .i32_atomic_load8_u, |
| ... | ... | @@ -958,7 +958,7 @@ fn uavRefObj(wasm: *Wasm, code: *ArrayList(u8), value: InternPool.Index, offset: |
| 958 | 958 | const opcode: std.wasm.Opcode = if (is_wasm32) .i32_const else .i64_const; |
| 959 | 959 | |
| 960 | 960 | try code.ensureUnusedCapacity(gpa, 11); |
| 961 | code.appendAssumeCapacity(@intFromEnum(opcode)); | |
| 961 | code.appendAssumeCapacity(@backingInt(opcode)); | |
| 962 | 962 | |
| 963 | 963 | try wasm.out_relocs.append(gpa, .{ |
| 964 | 964 | .offset = @intCast(code.items.len), |
| ... | ... | @@ -975,7 +975,7 @@ fn uavRefExe(wasm: *Wasm, code: *ArrayList(u8), value: InternPool.Index, offset: |
| 975 | 975 | const opcode: std.wasm.Opcode = if (is_wasm32) .i32_const else .i64_const; |
| 976 | 976 | |
| 977 | 977 | try code.ensureUnusedCapacity(gpa, 11); |
| 978 | code.appendAssumeCapacity(@intFromEnum(opcode)); | |
| 978 | code.appendAssumeCapacity(@backingInt(opcode)); | |
| 979 | 979 | |
| 980 | 980 | const addr = wasm.uavAddr(value); |
| 981 | 981 | writeUleb128(code, @as(u32, @intCast(@as(i64, addr) + offset))); |
| ... | ... | @@ -993,7 +993,7 @@ fn navRefOff(wasm: *Wasm, code: *ArrayList(u8), data: Mir.NavRefOff, is_wasm32: |
| 993 | 993 | try code.ensureUnusedCapacity(gpa, 11); |
| 994 | 994 | |
| 995 | 995 | const opcode: std.wasm.Opcode = if (is_wasm32) .i32_const else .i64_const; |
| 996 | code.appendAssumeCapacity(@intFromEnum(opcode)); | |
| 996 | code.appendAssumeCapacity(@backingInt(opcode)); | |
| 997 | 997 | if (is_obj) { |
| 998 | 998 | try wasm.out_relocs.append(gpa, .{ |
| 999 | 999 | .offset = @intCast(code.items.len), |
| ... | ... | @@ -1009,7 +1009,7 @@ fn navRefOff(wasm: *Wasm, code: *ArrayList(u8), data: Mir.NavRefOff, is_wasm32: |
| 1009 | 1009 | } |
| 1010 | 1010 | |
| 1011 | 1011 | fn appendOutputFunctionIndex(code: *ArrayList(u8), i: Wasm.OutputFunctionIndex) void { |
| 1012 | writeUleb128(code, @intFromEnum(i)); | |
| 1012 | writeUleb128(code, @backingInt(i)); | |
| 1013 | 1013 | } |
| 1014 | 1014 | |
| 1015 | 1015 | fn writeUleb128(code: *ArrayList(u8), arg: anytype) void { |
src/codegen/wasm/Mir.zig+14-14| ... | ... | @@ -618,12 +618,12 @@ pub const Inst = struct { |
| 618 | 618 | |
| 619 | 619 | /// From a given wasm opcode, returns a MIR tag. |
| 620 | 620 | pub fn fromOpcode(opcode: std.wasm.Opcode) Tag { |
| 621 | return @as(Tag, @enumFromInt(@intFromEnum(opcode))); // Given `Opcode` is not present as a tag for MIR yet | |
| 621 | return @as(Tag, @fromBackingInt(@intCast(@backingInt(opcode)))); // Given `Opcode` is not present as a tag for MIR yet | |
| 622 | 622 | } |
| 623 | 623 | |
| 624 | 624 | /// Returns a wasm opcode from a given MIR tag. |
| 625 | 625 | pub fn toOpcode(self: Tag) std.wasm.Opcode { |
| 626 | return @as(std.wasm.Opcode, @enumFromInt(@intFromEnum(self))); | |
| 626 | return @as(std.wasm.Opcode, @fromBackingInt(@intCast(@backingInt(self)))); | |
| 627 | 627 | } |
| 628 | 628 | }; |
| 629 | 629 | |
| ... | ... | @@ -690,7 +690,7 @@ pub fn lower(mir: *const Mir, wasm: *Wasm, code: *std.ArrayList(u8)) std.mem.All |
| 690 | 690 | |
| 691 | 691 | for (mir.locals) |local| { |
| 692 | 692 | w.writeLeb128(@as(u32, 1)) catch unreachable; |
| 693 | w.writeByte(@intFromEnum(local)) catch unreachable; | |
| 693 | w.writeByte(@backingInt(local)) catch unreachable; | |
| 694 | 694 | } |
| 695 | 695 | |
| 696 | 696 | // Stack management section of function prologue. |
| ... | ... | @@ -698,31 +698,31 @@ pub fn lower(mir: *const Mir, wasm: *Wasm, code: *std.ArrayList(u8)) std.mem.All |
| 698 | 698 | if (stack_alignment.toByteUnits()) |align_bytes| { |
| 699 | 699 | const sp_global: Wasm.GlobalIndex = .stack_pointer; |
| 700 | 700 | // load stack pointer |
| 701 | w.writeByte(@intFromEnum(std.wasm.Opcode.global_get)) catch unreachable; | |
| 702 | w.writeUleb128(@intFromEnum(sp_global)) catch unreachable; | |
| 701 | w.writeByte(@backingInt(std.wasm.Opcode.global_get)) catch unreachable; | |
| 702 | w.writeUleb128(@backingInt(sp_global)) catch unreachable; | |
| 703 | 703 | // store stack pointer so we can restore it when we return from the function |
| 704 | w.writeByte(@intFromEnum(std.wasm.Opcode.local_tee)) catch unreachable; | |
| 704 | w.writeByte(@backingInt(std.wasm.Opcode.local_tee)) catch unreachable; | |
| 705 | 705 | w.writeUleb128(mir.prologue.sp_local) catch unreachable; |
| 706 | 706 | // get the total stack size |
| 707 | 707 | const aligned_stack: i32 = @intCast(stack_alignment.forward(mir.prologue.stack_size)); |
| 708 | w.writeByte(@intFromEnum(std.wasm.Opcode.i32_const)) catch unreachable; | |
| 708 | w.writeByte(@backingInt(std.wasm.Opcode.i32_const)) catch unreachable; | |
| 709 | 709 | w.writeSleb128(aligned_stack) catch unreachable; |
| 710 | 710 | // subtract it from the current stack pointer |
| 711 | w.writeByte(@intFromEnum(std.wasm.Opcode.i32_sub)) catch unreachable; | |
| 711 | w.writeByte(@backingInt(std.wasm.Opcode.i32_sub)) catch unreachable; | |
| 712 | 712 | // Get negative stack alignment |
| 713 | 713 | const neg_stack_align = @as(i32, @intCast(align_bytes)) * -1; |
| 714 | w.writeByte(@intFromEnum(std.wasm.Opcode.i32_const)) catch unreachable; | |
| 714 | w.writeByte(@backingInt(std.wasm.Opcode.i32_const)) catch unreachable; | |
| 715 | 715 | w.writeSleb128(neg_stack_align) catch unreachable; |
| 716 | 716 | // Bitwise-and the value to get the new stack pointer to ensure the |
| 717 | 717 | // pointers are aligned with the abi alignment. |
| 718 | w.writeByte(@intFromEnum(std.wasm.Opcode.i32_and)) catch unreachable; | |
| 718 | w.writeByte(@backingInt(std.wasm.Opcode.i32_and)) catch unreachable; | |
| 719 | 719 | // The bottom will be used to calculate all stack pointer offsets. |
| 720 | w.writeByte(@intFromEnum(std.wasm.Opcode.local_tee)) catch unreachable; | |
| 720 | w.writeByte(@backingInt(std.wasm.Opcode.local_tee)) catch unreachable; | |
| 721 | 721 | w.writeUleb128(mir.prologue.bottom_stack_local) catch unreachable; |
| 722 | 722 | // Store the current stack pointer value into the global stack pointer so other function calls will |
| 723 | 723 | // start from this value instead and not overwrite the current stack. |
| 724 | w.writeByte(@intFromEnum(std.wasm.Opcode.global_set)) catch unreachable; | |
| 725 | w.writeUleb128(@intFromEnum(sp_global)) catch unreachable; | |
| 724 | w.writeByte(@backingInt(std.wasm.Opcode.global_set)) catch unreachable; | |
| 725 | w.writeUleb128(@backingInt(sp_global)) catch unreachable; | |
| 726 | 726 | } |
| 727 | 727 | |
| 728 | 728 | code.items.len += w.end; |
| ... | ... | @@ -747,7 +747,7 @@ pub fn extraData(self: *const Mir, comptime T: type, index: usize) struct { data |
| 747 | 747 | Wasm.UavsExeIndex, |
| 748 | 748 | InternPool.Nav.Index, |
| 749 | 749 | InternPool.Index, |
| 750 | => @enumFromInt(self.extra[i]), | |
| 750 | => @fromBackingInt(@intCast(self.extra[i])), | |
| 751 | 751 | else => @compileError("Unsupported field type " ++ @typeName(field_type)), |
| 752 | 752 | }; |
| 753 | 753 | i += 1; |
src/codegen/x86_64/CodeGen.zig+250-250| ... | ... | @@ -85,7 +85,7 @@ pub fn legalizeFeatures(_: *const std.Target) *const Air.Legalize.Features { |
| 85 | 85 | /// https://github.com/ziglang/zig/issues/22419 |
| 86 | 86 | const hack_around_sema_opv_bugs = true; |
| 87 | 87 | |
| 88 | const err_ret_trace_index: Air.Inst.Index = @enumFromInt(std.math.maxInt(u32)); | |
| 88 | const err_ret_trace_index: Air.Inst.Index = @fromBackingInt(@intCast(std.math.maxInt(u32))); | |
| 89 | 89 | |
| 90 | 90 | gpa: Allocator, |
| 91 | 91 | pt: Zcu.PerThread, |
| ... | ... | @@ -165,7 +165,7 @@ loop_switches: std.AutoHashMapUnmanaged(Air.Inst.Index, struct { |
| 165 | 165 | }, |
| 166 | 166 | }) = .empty, |
| 167 | 167 | |
| 168 | next_temp_index: Temp.Index = @enumFromInt(0), | |
| 168 | next_temp_index: Temp.Index = @fromBackingInt(@intCast(0)), | |
| 169 | 169 | temp_type: [Temp.Index.max]Type = undefined, |
| 170 | 170 | |
| 171 | 171 | const MaskInfo = packed struct { |
| ... | ... | @@ -616,14 +616,14 @@ pub const MCValue = union(enum) { |
| 616 | 616 | }), |
| 617 | 617 | .load_frame => |pl| try w.print("[{f} + 0x{x}]", .{ pl.index, pl.off }), |
| 618 | 618 | .lea_frame => |pl| try w.print("{f} + 0x{x}", .{ pl.index, pl.off }), |
| 619 | .load_nav => |pl| try w.print("[nav:{d}]", .{@intFromEnum(pl)}), | |
| 620 | .lea_nav => |pl| try w.print("nav:{d}", .{@intFromEnum(pl)}), | |
| 621 | .load_uav => |pl| try w.print("[uav:{d}]", .{@intFromEnum(pl.val)}), | |
| 622 | .lea_uav => |pl| try w.print("uav:{d}", .{@intFromEnum(pl.val)}), | |
| 623 | .load_lazy_sym => |pl| try w.print("[lazy:{s}:{d}]", .{ @tagName(pl.kind), @intFromEnum(pl.ty) }), | |
| 624 | .lea_lazy_sym => |pl| try w.print("lazy:{s}:{d}", .{ @tagName(pl.kind), @intFromEnum(pl.ty) }), | |
| 625 | .load_extern_func => |pl| try w.print("[extern:{d}]", .{@intFromEnum(pl)}), | |
| 626 | .lea_extern_func => |pl| try w.print("extern:{d}", .{@intFromEnum(pl)}), | |
| 619 | .load_nav => |pl| try w.print("[nav:{d}]", .{@backingInt(pl)}), | |
| 620 | .lea_nav => |pl| try w.print("nav:{d}", .{@backingInt(pl)}), | |
| 621 | .load_uav => |pl| try w.print("[uav:{d}]", .{@backingInt(pl.val)}), | |
| 622 | .lea_uav => |pl| try w.print("uav:{d}", .{@backingInt(pl.val)}), | |
| 623 | .load_lazy_sym => |pl| try w.print("[lazy:{s}:{d}]", .{ @tagName(pl.kind), @backingInt(pl.ty) }), | |
| 624 | .lea_lazy_sym => |pl| try w.print("lazy:{s}:{d}", .{ @tagName(pl.kind), @backingInt(pl.ty) }), | |
| 625 | .load_extern_func => |pl| try w.print("[extern:{d}]", .{@backingInt(pl)}), | |
| 626 | .lea_extern_func => |pl| try w.print("extern:{d}", .{@backingInt(pl)}), | |
| 627 | 627 | .register_tee => |pl| try w.print("tee:{s}:{s}", .{ @tagName(pl[1]), @tagName(pl[0]) }), |
| 628 | 628 | .elementwise_gpr => |pl| try w.print("elementwise:gpr{d}:[{f} + 0x{x}]", .{ |
| 629 | 629 | pl.info.reg_index, pl.frame_index, pl.info.frame_off, |
| ... | ... | @@ -641,7 +641,7 @@ pub const MCValue = union(enum) { |
| 641 | 641 | pl.info.reg_index, pl.frame_index, pl.info.frame_off, |
| 642 | 642 | }), |
| 643 | 643 | .reserved_frame => |pl| try w.print("(dead:{f})", .{pl}), |
| 644 | .air_ref => |pl| try w.print("(air:0x{x})", .{@intFromEnum(pl)}), | |
| 644 | .air_ref => |pl| try w.print("(air:0x{x})", .{@backingInt(pl)}), | |
| 645 | 645 | } |
| 646 | 646 | } |
| 647 | 647 | }; |
| ... | ... | @@ -1011,7 +1011,7 @@ pub fn generate( |
| 1011 | 1011 | } |
| 1012 | 1012 | try function.inst_tracking.ensureTotalCapacity(gpa, Temp.Index.max); |
| 1013 | 1013 | for (0..Temp.Index.max) |temp_index| { |
| 1014 | const temp: Temp.Index = @enumFromInt(temp_index); | |
| 1014 | const temp: Temp.Index = @fromBackingInt(@intCast(temp_index)); | |
| 1015 | 1015 | function.inst_tracking.putAssumeCapacityNoClobber(temp.toIndex(), .init(.none)); |
| 1016 | 1016 | } |
| 1017 | 1017 | |
| ... | ... | @@ -1019,11 +1019,11 @@ pub fn generate( |
| 1019 | 1019 | |
| 1020 | 1020 | try function.frame_allocs.resize(gpa, FrameIndex.named_count); |
| 1021 | 1021 | function.frame_allocs.set( |
| 1022 | @intFromEnum(FrameIndex.stack_frame), | |
| 1022 | @backingInt(FrameIndex.stack_frame), | |
| 1023 | 1023 | .init(.{ .size = 0, .alignment = .@"1" }), |
| 1024 | 1024 | ); |
| 1025 | 1025 | function.frame_allocs.set( |
| 1026 | @intFromEnum(FrameIndex.call_frame), | |
| 1026 | @backingInt(FrameIndex.call_frame), | |
| 1027 | 1027 | .init(.{ .size = 0, .alignment = .@"1" }), |
| 1028 | 1028 | ); |
| 1029 | 1029 | |
| ... | ... | @@ -1034,18 +1034,18 @@ pub fn generate( |
| 1034 | 1034 | function.args = call_info.args; |
| 1035 | 1035 | function.ret_mcv = call_info.return_value; |
| 1036 | 1036 | function.err_ret_trace_reg = call_info.err_ret_trace_reg; |
| 1037 | function.frame_allocs.set(@intFromEnum(FrameIndex.ret_addr), .init(.{ | |
| 1037 | function.frame_allocs.set(@backingInt(FrameIndex.ret_addr), .init(.{ | |
| 1038 | 1038 | .size = Type.usize.abiSize(zcu), |
| 1039 | 1039 | .alignment = Type.usize.abiAlignment(zcu).min(call_info.stack_align), |
| 1040 | 1040 | })); |
| 1041 | function.frame_allocs.set(@intFromEnum(FrameIndex.base_ptr), .init(.{ | |
| 1041 | function.frame_allocs.set(@backingInt(FrameIndex.base_ptr), .init(.{ | |
| 1042 | 1042 | .size = Type.usize.abiSize(zcu), |
| 1043 | 1043 | .alignment = call_info.stack_align.min( |
| 1044 | 1044 | .fromNonzeroByteUnits(function.target.stackAlignment()), |
| 1045 | 1045 | ), |
| 1046 | 1046 | })); |
| 1047 | 1047 | function.frame_allocs.set( |
| 1048 | @intFromEnum(FrameIndex.args_frame), | |
| 1048 | @backingInt(FrameIndex.args_frame), | |
| 1049 | 1049 | .init(.{ |
| 1050 | 1050 | .size = call_info.stack_byte_count, |
| 1051 | 1051 | .alignment = call_info.stack_align, |
| ... | ... | @@ -1148,7 +1148,7 @@ pub fn generateLazy( |
| 1148 | 1148 | } |
| 1149 | 1149 | try function.inst_tracking.ensureTotalCapacity(gpa, Temp.Index.max); |
| 1150 | 1150 | for (0..Temp.Index.max) |temp_index| { |
| 1151 | const temp: Temp.Index = @enumFromInt(temp_index); | |
| 1151 | const temp: Temp.Index = @fromBackingInt(@intCast(temp_index)); | |
| 1152 | 1152 | function.inst_tracking.putAssumeCapacityNoClobber(temp.toIndex(), .init(.none)); |
| 1153 | 1153 | } |
| 1154 | 1154 | |
| ... | ... | @@ -1313,7 +1313,7 @@ fn addExtraAssumeCapacity(self: *CodeGen, extra: anytype) u32 { |
| 1313 | 1313 | self.mir_extra.appendAssumeCapacity(switch (field_type) { |
| 1314 | 1314 | u32 => @field(extra, field_name), |
| 1315 | 1315 | i32, Mir.Memory.Info => @bitCast(@field(extra, field_name)), |
| 1316 | FrameIndex => @intFromEnum(@field(extra, field_name)), | |
| 1316 | FrameIndex => @backingInt(@field(extra, field_name)), | |
| 1317 | 1317 | else => @compileError("bad field type: " ++ field_name ++ ": " ++ @typeName(field_type)), |
| 1318 | 1318 | }); |
| 1319 | 1319 | } |
| ... | ... | @@ -1333,7 +1333,7 @@ fn addString(cg: *CodeGen, string: []const u8) Allocator.Error!Mir.NullTerminate |
| 1333 | 1333 | cg.mir_string_bytes.appendSliceAssumeCapacity(string); |
| 1334 | 1334 | cg.mir_string_bytes.appendAssumeCapacity(0); |
| 1335 | 1335 | } |
| 1336 | return @enumFromInt(mir_string_gop.key_ptr.*); | |
| 1336 | return @fromBackingInt(@intCast(mir_string_gop.key_ptr.*)); | |
| 1337 | 1337 | } |
| 1338 | 1338 | |
| 1339 | 1339 | fn asmOps(self: *CodeGen, tag: Mir.Inst.FixedTag, ops: [4]Operand) !void { |
| ... | ... | @@ -2392,13 +2392,13 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 2392 | 2392 | |
| 2393 | 2393 | cg.reused_operands = .empty; |
| 2394 | 2394 | try cg.inst_tracking.ensureUnusedCapacity(cg.gpa, 1); |
| 2395 | switch (air_tags[@intFromEnum(inst)]) { | |
| 2395 | switch (air_tags[@backingInt(inst)]) { | |
| 2396 | 2396 | .select => try cg.airSelect(inst), |
| 2397 | 2397 | .shuffle_one, .shuffle_two => @panic("x86_64 TODO: shuffle_one/shuffle_two"), |
| 2398 | 2398 | |
| 2399 | 2399 | .arg => try cg.airArg(inst), |
| 2400 | 2400 | .add, .add_optimized, .add_wrap => |air_tag| { |
| 2401 | const bin_op = air_datas[@intFromEnum(inst)].bin_op; | |
| 2401 | const bin_op = air_datas[@backingInt(inst)].bin_op; | |
| 2402 | 2402 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }); |
| 2403 | 2403 | var res: [1]Temp = undefined; |
| 2404 | 2404 | cg.select(&res, &.{cg.typeOf(bin_op.lhs)}, &ops, comptime &.{ .{ |
| ... | ... | @@ -4560,7 +4560,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 4560 | 4560 | }, |
| 4561 | 4561 | .add_safe => unreachable, |
| 4562 | 4562 | .add_sat => |air_tag| { |
| 4563 | const bin_op = air_datas[@intFromEnum(inst)].bin_op; | |
| 4563 | const bin_op = air_datas[@backingInt(inst)].bin_op; | |
| 4564 | 4564 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }); |
| 4565 | 4565 | var res: [1]Temp = undefined; |
| 4566 | 4566 | cg.select(&res, &.{cg.typeOf(bin_op.lhs)}, &ops, comptime &.{ .{ |
| ... | ... | @@ -13124,7 +13124,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 13124 | 13124 | try res[0].finish(inst, &.{ bin_op.lhs, bin_op.rhs }, &ops, cg); |
| 13125 | 13125 | }, |
| 13126 | 13126 | .sub, .sub_optimized, .sub_wrap => |air_tag| { |
| 13127 | const bin_op = air_datas[@intFromEnum(inst)].bin_op; | |
| 13127 | const bin_op = air_datas[@backingInt(inst)].bin_op; | |
| 13128 | 13128 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }); |
| 13129 | 13129 | var res: [1]Temp = undefined; |
| 13130 | 13130 | cg.select(&res, &.{cg.typeOf(bin_op.lhs)}, &ops, comptime &.{ .{ |
| ... | ... | @@ -15311,7 +15311,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 15311 | 15311 | }, |
| 15312 | 15312 | .sub_safe => unreachable, |
| 15313 | 15313 | .sub_sat => |air_tag| { |
| 15314 | const bin_op = air_datas[@intFromEnum(inst)].bin_op; | |
| 15314 | const bin_op = air_datas[@backingInt(inst)].bin_op; | |
| 15315 | 15315 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }); |
| 15316 | 15316 | var res: [1]Temp = undefined; |
| 15317 | 15317 | cg.select(&res, &.{cg.typeOf(bin_op.lhs)}, &ops, comptime &.{ .{ |
| ... | ... | @@ -22145,7 +22145,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 22145 | 22145 | try res[0].finish(inst, &.{ bin_op.lhs, bin_op.rhs }, &ops, cg); |
| 22146 | 22146 | }, |
| 22147 | 22147 | .mul, .mul_optimized => |air_tag| { |
| 22148 | const bin_op = air_datas[@intFromEnum(inst)].bin_op; | |
| 22148 | const bin_op = air_datas[@backingInt(inst)].bin_op; | |
| 22149 | 22149 | const ty = cg.typeOf(bin_op.lhs); |
| 22150 | 22150 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }); |
| 22151 | 22151 | var res: [1]Temp = undefined; |
| ... | ... | @@ -25083,7 +25083,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 25083 | 25083 | }, |
| 25084 | 25084 | .mul_safe => unreachable, |
| 25085 | 25085 | .mul_wrap => |air_tag| { |
| 25086 | const bin_op = air_datas[@intFromEnum(inst)].bin_op; | |
| 25086 | const bin_op = air_datas[@backingInt(inst)].bin_op; | |
| 25087 | 25087 | const ty = cg.typeOf(bin_op.lhs); |
| 25088 | 25088 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }); |
| 25089 | 25089 | var res: [1]Temp = undefined; |
| ... | ... | @@ -26888,7 +26888,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 26888 | 26888 | try res[0].finish(inst, &.{ bin_op.lhs, bin_op.rhs }, &ops, cg); |
| 26889 | 26889 | }, |
| 26890 | 26890 | .mul_sat => |air_tag| { |
| 26891 | const bin_op = air_datas[@intFromEnum(inst)].bin_op; | |
| 26891 | const bin_op = air_datas[@backingInt(inst)].bin_op; | |
| 26892 | 26892 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }); |
| 26893 | 26893 | var res: [1]Temp = undefined; |
| 26894 | 26894 | cg.select(&res, &.{cg.typeOf(bin_op.lhs)}, &ops, comptime &.{ .{ |
| ... | ... | @@ -32105,7 +32105,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 32105 | 32105 | try res[0].finish(inst, &.{ bin_op.lhs, bin_op.rhs }, &ops, cg); |
| 32106 | 32106 | }, |
| 32107 | 32107 | .div_float, .div_float_optimized, .div_exact, .div_exact_optimized => |air_tag| { |
| 32108 | const bin_op = air_datas[@intFromEnum(inst)].bin_op; | |
| 32108 | const bin_op = air_datas[@backingInt(inst)].bin_op; | |
| 32109 | 32109 | const ty = cg.typeOf(bin_op.lhs); |
| 32110 | 32110 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }); |
| 32111 | 32111 | var res: [1]Temp = undefined; |
| ... | ... | @@ -33343,7 +33343,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 33343 | 33343 | try res[0].finish(inst, &.{ bin_op.lhs, bin_op.rhs }, &ops, cg); |
| 33344 | 33344 | }, |
| 33345 | 33345 | .div_trunc => |air_tag| { |
| 33346 | const bin_op = air_datas[@intFromEnum(inst)].bin_op; | |
| 33346 | const bin_op = air_datas[@backingInt(inst)].bin_op; | |
| 33347 | 33347 | const ty = cg.typeOf(bin_op.lhs); |
| 33348 | 33348 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }); |
| 33349 | 33349 | var res: [1]Temp = undefined; |
| ... | ... | @@ -34800,7 +34800,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 34800 | 34800 | try res[0].finish(inst, &.{ bin_op.lhs, bin_op.rhs }, &ops, cg); |
| 34801 | 34801 | }, |
| 34802 | 34802 | .div_trunc_optimized, .div_floor_optimized => |air_tag| { |
| 34803 | const bin_op = air_datas[@intFromEnum(inst)].bin_op; | |
| 34803 | const bin_op = air_datas[@backingInt(inst)].bin_op; | |
| 34804 | 34804 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }); |
| 34805 | 34805 | var res: [1]Temp = undefined; |
| 34806 | 34806 | cg.select(&res, &.{cg.typeOf(bin_op.lhs)}, &ops, switch (@as(bits.RoundMode.Direction, switch (air_tag) { |
| ... | ... | @@ -36361,7 +36361,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 36361 | 36361 | try res[0].finish(inst, &.{ bin_op.lhs, bin_op.rhs }, &ops, cg); |
| 36362 | 36362 | }, |
| 36363 | 36363 | .div_floor => |air_tag| { |
| 36364 | const bin_op = air_datas[@intFromEnum(inst)].bin_op; | |
| 36364 | const bin_op = air_datas[@backingInt(inst)].bin_op; | |
| 36365 | 36365 | const ty = cg.typeOf(bin_op.lhs); |
| 36366 | 36366 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }); |
| 36367 | 36367 | var res: [1]Temp = undefined; |
| ... | ... | @@ -38053,7 +38053,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 38053 | 38053 | try res[0].finish(inst, &.{ bin_op.lhs, bin_op.rhs }, &ops, cg); |
| 38054 | 38054 | }, |
| 38055 | 38055 | .rem, .rem_optimized => |air_tag| { |
| 38056 | const bin_op = air_datas[@intFromEnum(inst)].bin_op; | |
| 38056 | const bin_op = air_datas[@backingInt(inst)].bin_op; | |
| 38057 | 38057 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }); |
| 38058 | 38058 | var res: [1]Temp = undefined; |
| 38059 | 38059 | cg.select(&res, &.{cg.typeOf(bin_op.lhs)}, &ops, comptime &.{ .{ |
| ... | ... | @@ -39835,7 +39835,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 39835 | 39835 | try res[0].finish(inst, &.{ bin_op.lhs, bin_op.rhs }, &ops, cg); |
| 39836 | 39836 | }, |
| 39837 | 39837 | .mod, .mod_optimized => |air_tag| { |
| 39838 | const bin_op = air_datas[@intFromEnum(inst)].bin_op; | |
| 39838 | const bin_op = air_datas[@backingInt(inst)].bin_op; | |
| 39839 | 39839 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }); |
| 39840 | 39840 | var res: [1]Temp = undefined; |
| 39841 | 39841 | cg.select(&res, &.{cg.typeOf(bin_op.lhs)}, &ops, comptime &.{ .{ |
| ... | ... | @@ -43348,7 +43348,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 43348 | 43348 | try res[0].finish(inst, &.{ bin_op.lhs, bin_op.rhs }, &ops, cg); |
| 43349 | 43349 | }, |
| 43350 | 43350 | .ptr_add => |air_tag| { |
| 43351 | const ty_pl = air_datas[@intFromEnum(inst)].ty_pl; | |
| 43351 | const ty_pl = air_datas[@backingInt(inst)].ty_pl; | |
| 43352 | 43352 | const bin_op = cg.air.extraData(Air.Bin, ty_pl.payload).data; |
| 43353 | 43353 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }); |
| 43354 | 43354 | try ops[0].toSlicePtr(cg); |
| ... | ... | @@ -43462,7 +43462,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 43462 | 43462 | try res[0].finish(inst, &.{ bin_op.lhs, bin_op.rhs }, &ops, cg); |
| 43463 | 43463 | }, |
| 43464 | 43464 | .ptr_sub => |air_tag| { |
| 43465 | const ty_pl = air_datas[@intFromEnum(inst)].ty_pl; | |
| 43465 | const ty_pl = air_datas[@backingInt(inst)].ty_pl; | |
| 43466 | 43466 | const bin_op = cg.air.extraData(Air.Bin, ty_pl.payload).data; |
| 43467 | 43467 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }); |
| 43468 | 43468 | try ops[0].toSlicePtr(cg); |
| ... | ... | @@ -43591,7 +43591,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 43591 | 43591 | try res[0].finish(inst, &.{ bin_op.lhs, bin_op.rhs }, &ops, cg); |
| 43592 | 43592 | }, |
| 43593 | 43593 | .max => |air_tag| { |
| 43594 | const bin_op = air_datas[@intFromEnum(inst)].bin_op; | |
| 43594 | const bin_op = air_datas[@backingInt(inst)].bin_op; | |
| 43595 | 43595 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }); |
| 43596 | 43596 | var res: [1]Temp = undefined; |
| 43597 | 43597 | cg.select(&res, &.{cg.typeOf(bin_op.lhs)}, &ops, comptime &.{ .{ |
| ... | ... | @@ -47900,7 +47900,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 47900 | 47900 | try res[0].finish(inst, &.{ bin_op.lhs, bin_op.rhs }, &ops, cg); |
| 47901 | 47901 | }, |
| 47902 | 47902 | .min => |air_tag| { |
| 47903 | const bin_op = air_datas[@intFromEnum(inst)].bin_op; | |
| 47903 | const bin_op = air_datas[@backingInt(inst)].bin_op; | |
| 47904 | 47904 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }); |
| 47905 | 47905 | var res: [1]Temp = undefined; |
| 47906 | 47906 | cg.select(&res, &.{cg.typeOf(bin_op.lhs)}, &ops, comptime &.{ .{ |
| ... | ... | @@ -52203,7 +52203,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 52203 | 52203 | try res[0].finish(inst, &.{ bin_op.lhs, bin_op.rhs }, &ops, cg); |
| 52204 | 52204 | }, |
| 52205 | 52205 | .add_with_overflow => |air_tag| { |
| 52206 | const ty_pl = air_datas[@intFromEnum(inst)].ty_pl; | |
| 52206 | const ty_pl = air_datas[@backingInt(inst)].ty_pl; | |
| 52207 | 52207 | const bin_op = cg.air.extraData(Air.Bin, ty_pl.payload).data; |
| 52208 | 52208 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }); |
| 52209 | 52209 | var res: [2]Temp = undefined; |
| ... | ... | @@ -53053,7 +53053,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 53053 | 53053 | try res[0].finish(inst, &.{ bin_op.lhs, bin_op.rhs }, &ops, cg); |
| 53054 | 53054 | }, |
| 53055 | 53055 | .sub_with_overflow => |air_tag| { |
| 53056 | const ty_pl = air_datas[@intFromEnum(inst)].ty_pl; | |
| 53056 | const ty_pl = air_datas[@backingInt(inst)].ty_pl; | |
| 53057 | 53057 | const bin_op = cg.air.extraData(Air.Bin, ty_pl.payload).data; |
| 53058 | 53058 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }); |
| 53059 | 53059 | var res: [2]Temp = undefined; |
| ... | ... | @@ -53958,7 +53958,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 53958 | 53958 | try res[0].finish(inst, &.{ bin_op.lhs, bin_op.rhs }, &ops, cg); |
| 53959 | 53959 | }, |
| 53960 | 53960 | .mul_with_overflow => |air_tag| { |
| 53961 | const ty_pl = air_datas[@intFromEnum(inst)].ty_pl; | |
| 53961 | const ty_pl = air_datas[@backingInt(inst)].ty_pl; | |
| 53962 | 53962 | const bin_op = cg.air.extraData(Air.Bin, ty_pl.payload).data; |
| 53963 | 53963 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }); |
| 53964 | 53964 | var res: [2]Temp = undefined; |
| ... | ... | @@ -57555,7 +57555,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 57555 | 57555 | try res[0].finish(inst, &.{ bin_op.lhs, bin_op.rhs }, &ops, cg); |
| 57556 | 57556 | }, |
| 57557 | 57557 | .shl_with_overflow => |air_tag| { |
| 57558 | const ty_pl = air_datas[@intFromEnum(inst)].ty_pl; | |
| 57558 | const ty_pl = air_datas[@backingInt(inst)].ty_pl; | |
| 57559 | 57559 | const bin_op = cg.air.extraData(Air.Bin, ty_pl.payload).data; |
| 57560 | 57560 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }); |
| 57561 | 57561 | var res: [2]Temp = undefined; |
| ... | ... | @@ -60900,7 +60900,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 60900 | 60900 | try res[0].finish(inst, &.{ bin_op.lhs, bin_op.rhs }, &ops, cg); |
| 60901 | 60901 | }, |
| 60902 | 60902 | .alloc => { |
| 60903 | const ty = air_datas[@intFromEnum(inst)].ty; | |
| 60903 | const ty = air_datas[@backingInt(inst)].ty; | |
| 60904 | 60904 | const slot = try cg.tempInit(ty, .{ .lea_frame = .{ |
| 60905 | 60905 | .index = try cg.allocMemPtr(inst), |
| 60906 | 60906 | } }); |
| ... | ... | @@ -60908,7 +60908,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 60908 | 60908 | }, |
| 60909 | 60909 | .inferred_alloc, .inferred_alloc_comptime => unreachable, |
| 60910 | 60910 | .ret_ptr => { |
| 60911 | const ty = air_datas[@intFromEnum(inst)].ty; | |
| 60911 | const ty = air_datas[@backingInt(inst)].ty; | |
| 60912 | 60912 | var slot = switch (cg.ret_mcv.long) { |
| 60913 | 60913 | else => unreachable, |
| 60914 | 60914 | .none => try cg.tempInit(ty, .{ .lea_frame = .{ |
| ... | ... | @@ -60924,7 +60924,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 60924 | 60924 | }, |
| 60925 | 60925 | .assembly => try cg.airAsm(inst), |
| 60926 | 60926 | .bit_and, .bit_or, .xor => |air_tag| { |
| 60927 | const bin_op = air_datas[@intFromEnum(inst)].bin_op; | |
| 60927 | const bin_op = air_datas[@backingInt(inst)].bin_op; | |
| 60928 | 60928 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }); |
| 60929 | 60929 | var res: [1]Temp = undefined; |
| 60930 | 60930 | cg.select(&res, &.{cg.typeOf(bin_op.lhs)}, &ops, switch (@as(Mir.Inst.Tag, switch (air_tag) { |
| ... | ... | @@ -61294,7 +61294,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 61294 | 61294 | try res[0].finish(inst, &.{ bin_op.lhs, bin_op.rhs }, &ops, cg); |
| 61295 | 61295 | }, |
| 61296 | 61296 | .shr, .shr_exact => |air_tag| { |
| 61297 | const bin_op = air_datas[@intFromEnum(inst)].bin_op; | |
| 61297 | const bin_op = air_datas[@backingInt(inst)].bin_op; | |
| 61298 | 61298 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }); |
| 61299 | 61299 | var res: [1]Temp = undefined; |
| 61300 | 61300 | cg.select(&res, &.{cg.typeOf(bin_op.lhs)}, &ops, comptime &.{ .{ |
| ... | ... | @@ -61858,7 +61858,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 61858 | 61858 | try res[0].finish(inst, &.{ bin_op.lhs, bin_op.rhs }, &ops, cg); |
| 61859 | 61859 | }, |
| 61860 | 61860 | .shl, .shl_exact => |air_tag| { |
| 61861 | const bin_op = air_datas[@intFromEnum(inst)].bin_op; | |
| 61861 | const bin_op = air_datas[@backingInt(inst)].bin_op; | |
| 61862 | 61862 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }); |
| 61863 | 61863 | var res: [1]Temp = undefined; |
| 61864 | 61864 | cg.select(&res, &.{cg.typeOf(bin_op.lhs)}, &ops, comptime &.{ .{ |
| ... | ... | @@ -62232,7 +62232,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 62232 | 62232 | try res[0].finish(inst, &.{ bin_op.lhs, bin_op.rhs }, &ops, cg); |
| 62233 | 62233 | }, |
| 62234 | 62234 | .shl_sat => |air_tag| { |
| 62235 | const bin_op = air_datas[@intFromEnum(inst)].bin_op; | |
| 62235 | const bin_op = air_datas[@backingInt(inst)].bin_op; | |
| 62236 | 62236 | const lhs_ty = cg.typeOf(bin_op.lhs); |
| 62237 | 62237 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }); |
| 62238 | 62238 | var res: [1]Temp = undefined; |
| ... | ... | @@ -65655,7 +65655,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 65655 | 65655 | try res[0].finish(inst, &.{ bin_op.lhs, bin_op.rhs }, &ops, cg); |
| 65656 | 65656 | }, |
| 65657 | 65657 | .not => |air_tag| { |
| 65658 | const ty_op = air_datas[@intFromEnum(inst)].ty_op; | |
| 65658 | const ty_op = air_datas[@backingInt(inst)].ty_op; | |
| 65659 | 65659 | var ops = try cg.tempsFromOperands(inst, .{ty_op.operand}); |
| 65660 | 65660 | var res: [1]Temp = undefined; |
| 65661 | 65661 | cg.select(&res, &.{ty_op.ty.toType()}, &ops, comptime &.{ .{ |
| ... | ... | @@ -67464,7 +67464,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 67464 | 67464 | try cg.genBodyBlock(block.body); |
| 67465 | 67465 | }, |
| 67466 | 67466 | .repeat => { |
| 67467 | const repeat = air_datas[@intFromEnum(inst)].repeat; | |
| 67467 | const repeat = air_datas[@backingInt(inst)].repeat; | |
| 67468 | 67468 | const loop = cg.loops.get(repeat.loop_inst).?; |
| 67469 | 67469 | try cg.restoreState(loop.state, &.{}, .{ |
| 67470 | 67470 | .emit_instructions = true, |
| ... | ... | @@ -67495,7 +67495,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 67495 | 67495 | .call_never_tail => try cg.airCall(inst, .never_tail, .{ .safety = true }), |
| 67496 | 67496 | .call_never_inline => try cg.airCall(inst, .never_inline, .{ .safety = true }), |
| 67497 | 67497 | .clz => |air_tag| { |
| 67498 | const ty_op = air_datas[@intFromEnum(inst)].ty_op; | |
| 67498 | const ty_op = air_datas[@backingInt(inst)].ty_op; | |
| 67499 | 67499 | var ops = try cg.tempsFromOperands(inst, .{ty_op.operand}); |
| 67500 | 67500 | var res: [1]Temp = undefined; |
| 67501 | 67501 | cg.select(&res, &.{ty_op.ty.toType()}, &ops, comptime &.{ .{ |
| ... | ... | @@ -70600,7 +70600,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 70600 | 70600 | try res[0].finish(inst, &.{ty_op.operand}, &ops, cg); |
| 70601 | 70601 | }, |
| 70602 | 70602 | .ctz => |air_tag| { |
| 70603 | const ty_op = air_datas[@intFromEnum(inst)].ty_op; | |
| 70603 | const ty_op = air_datas[@backingInt(inst)].ty_op; | |
| 70604 | 70604 | var ops = try cg.tempsFromOperands(inst, .{ty_op.operand}); |
| 70605 | 70605 | var res: [1]Temp = undefined; |
| 70606 | 70606 | cg.select(&res, &.{ty_op.ty.toType()}, &ops, comptime &.{ .{ |
| ... | ... | @@ -70997,7 +70997,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 70997 | 70997 | try res[0].finish(inst, &.{ty_op.operand}, &ops, cg); |
| 70998 | 70998 | }, |
| 70999 | 70999 | .popcount => |air_tag| { |
| 71000 | const ty_op = air_datas[@intFromEnum(inst)].ty_op; | |
| 71000 | const ty_op = air_datas[@backingInt(inst)].ty_op; | |
| 71001 | 71001 | var ops = try cg.tempsFromOperands(inst, .{ty_op.operand}); |
| 71002 | 71002 | var res: [1]Temp = undefined; |
| 71003 | 71003 | cg.select(&res, &.{ty_op.ty.toType()}, &ops, comptime &.{ .{ |
| ... | ... | @@ -71885,7 +71885,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 71885 | 71885 | try res[0].finish(inst, &.{ty_op.operand}, &ops, cg); |
| 71886 | 71886 | }, |
| 71887 | 71887 | .byte_swap => |air_tag| { |
| 71888 | const ty_op = air_datas[@intFromEnum(inst)].ty_op; | |
| 71888 | const ty_op = air_datas[@backingInt(inst)].ty_op; | |
| 71889 | 71889 | var ops = try cg.tempsFromOperands(inst, .{ty_op.operand}); |
| 71890 | 71890 | var res: [1]Temp = undefined; |
| 71891 | 71891 | cg.select(&res, &.{ty_op.ty.toType()}, &ops, comptime &.{ .{ |
| ... | ... | @@ -72534,7 +72534,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 72534 | 72534 | try res[0].finish(inst, &.{ty_op.operand}, &ops, cg); |
| 72535 | 72535 | }, |
| 72536 | 72536 | .bit_reverse => |air_tag| { |
| 72537 | const ty_op = air_datas[@intFromEnum(inst)].ty_op; | |
| 72537 | const ty_op = air_datas[@backingInt(inst)].ty_op; | |
| 72538 | 72538 | var ops = try cg.tempsFromOperands(inst, .{ty_op.operand}); |
| 72539 | 72539 | var res: [1]Temp = undefined; |
| 72540 | 72540 | cg.select(&res, &.{ty_op.ty.toType()}, &ops, comptime &.{ .{ |
| ... | ... | @@ -75636,7 +75636,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 75636 | 75636 | try res[0].finish(inst, &.{ty_op.operand}, &ops, cg); |
| 75637 | 75637 | }, |
| 75638 | 75638 | .sqrt => |air_tag| { |
| 75639 | const un_op = air_datas[@intFromEnum(inst)].un_op; | |
| 75639 | const un_op = air_datas[@backingInt(inst)].un_op; | |
| 75640 | 75640 | var ops = try cg.tempsFromOperands(inst, .{un_op}); |
| 75641 | 75641 | var res: [1]Temp = undefined; |
| 75642 | 75642 | cg.select(&res, &.{cg.typeOf(un_op)}, &ops, comptime &.{ .{ |
| ... | ... | @@ -76698,7 +76698,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 76698 | 76698 | try res[0].finish(inst, &.{un_op}, &ops, cg); |
| 76699 | 76699 | }, |
| 76700 | 76700 | .sin, .cos, .tan, .exp, .exp2, .log, .log2, .log10, .round => |air_tag| { |
| 76701 | const un_op = air_datas[@intFromEnum(inst)].un_op; | |
| 76701 | const un_op = air_datas[@backingInt(inst)].un_op; | |
| 76702 | 76702 | var ops = try cg.tempsFromOperands(inst, .{un_op}); |
| 76703 | 76703 | var res: [1]Temp = undefined; |
| 76704 | 76704 | cg.select(&res, &.{cg.typeOf(un_op)}, &ops, switch (air_tag) { |
| ... | ... | @@ -77548,7 +77548,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 77548 | 77548 | try res[0].finish(inst, &.{un_op}, &ops, cg); |
| 77549 | 77549 | }, |
| 77550 | 77550 | .abs => |air_tag| { |
| 77551 | const ty_op = air_datas[@intFromEnum(inst)].ty_op; | |
| 77551 | const ty_op = air_datas[@backingInt(inst)].ty_op; | |
| 77552 | 77552 | var ops = try cg.tempsFromOperands(inst, .{ty_op.operand}); |
| 77553 | 77553 | var res: [1]Temp = undefined; |
| 77554 | 77554 | cg.select(&res, &.{ty_op.ty.toType()}, &ops, comptime &.{ .{ |
| ... | ... | @@ -79099,7 +79099,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 79099 | 79099 | try res[0].finish(inst, &.{ty_op.operand}, &ops, cg); |
| 79100 | 79100 | }, |
| 79101 | 79101 | .floor, .ceil, .trunc_float => |air_tag| { |
| 79102 | const un_op = air_datas[@intFromEnum(inst)].un_op; | |
| 79102 | const un_op = air_datas[@backingInt(inst)].un_op; | |
| 79103 | 79103 | var ops = try cg.tempsFromOperands(inst, .{un_op}); |
| 79104 | 79104 | var res: [1]Temp = undefined; |
| 79105 | 79105 | cg.select(&res, &.{cg.typeOf(un_op)}, &ops, switch (@as(bits.RoundMode.Direction, switch (air_tag) { |
| ... | ... | @@ -80435,7 +80435,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 80435 | 80435 | try res[0].finish(inst, &.{un_op}, &ops, cg); |
| 80436 | 80436 | }, |
| 80437 | 80437 | .neg, .neg_optimized => |air_tag| { |
| 80438 | const un_op = air_datas[@intFromEnum(inst)].un_op; | |
| 80438 | const un_op = air_datas[@backingInt(inst)].un_op; | |
| 80439 | 80439 | var ops = try cg.tempsFromOperands(inst, .{un_op}); |
| 80440 | 80440 | var res: [1]Temp = undefined; |
| 80441 | 80441 | cg.select(&res, &.{cg.typeOf(un_op)}, &ops, comptime &.{ .{ |
| ... | ... | @@ -80983,7 +80983,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 80983 | 80983 | .cmp_gt, |
| 80984 | 80984 | .cmp_gt_optimized, |
| 80985 | 80985 | => |air_tag| { |
| 80986 | const bin_op = air_datas[@intFromEnum(inst)].bin_op; | |
| 80986 | const bin_op = air_datas[@backingInt(inst)].bin_op; | |
| 80987 | 80987 | const cmp_op = air_tag.toCmpOp().?; |
| 80988 | 80988 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }); |
| 80989 | 80989 | var res: [1]Temp = undefined; |
| ... | ... | @@ -81460,7 +81460,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 81460 | 81460 | .cmp_neq, |
| 81461 | 81461 | .cmp_neq_optimized, |
| 81462 | 81462 | => |air_tag| { |
| 81463 | const bin_op = air_datas[@intFromEnum(inst)].bin_op; | |
| 81463 | const bin_op = air_datas[@backingInt(inst)].bin_op; | |
| 81464 | 81464 | const cmp_op = air_tag.toCmpOp().?; |
| 81465 | 81465 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }); |
| 81466 | 81466 | const ty = cg.typeOf(bin_op.lhs); |
| ... | ... | @@ -82059,7 +82059,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 82059 | 82059 | try res[0].finish(inst, &.{ bin_op.lhs, bin_op.rhs }, &ops, cg); |
| 82060 | 82060 | }, |
| 82061 | 82061 | .cmp_vector, .cmp_vector_optimized => |air_tag| { |
| 82062 | const ty_pl = air_datas[@intFromEnum(inst)].ty_pl; | |
| 82062 | const ty_pl = air_datas[@backingInt(inst)].ty_pl; | |
| 82063 | 82063 | const vector_cmp = cg.air.extraData(Air.VectorCmp, ty_pl.payload).data; |
| 82064 | 82064 | var ops = try cg.tempsFromOperands(inst, .{ vector_cmp.lhs, vector_cmp.rhs }); |
| 82065 | 82065 | var res: [1]Temp = undefined; |
| ... | ... | @@ -89128,7 +89128,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 89128 | 89128 | .@"try", .try_cold => try cg.airTry(inst), |
| 89129 | 89129 | .try_ptr, .try_ptr_cold => try cg.airTryPtr(inst), |
| 89130 | 89130 | .dbg_stmt => if (!cg.mod.strip) { |
| 89131 | const dbg_stmt = air_datas[@intFromEnum(inst)].dbg_stmt; | |
| 89131 | const dbg_stmt = air_datas[@backingInt(inst)].dbg_stmt; | |
| 89132 | 89132 | _ = try cg.addInst(.{ |
| 89133 | 89133 | .tag = .pseudo, |
| 89134 | 89134 | .ops = .pseudo_dbg_line_stmt_line_column, |
| ... | ... | @@ -89164,8 +89164,8 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 89164 | 89164 | }); |
| 89165 | 89165 | }, |
| 89166 | 89166 | .dbg_var_ptr, .dbg_var_val, .dbg_arg_inline => |air_tag| if (!cg.mod.strip) { |
| 89167 | const pl_op = air_datas[@intFromEnum(inst)].pl_op; | |
| 89168 | const air_name: Air.NullTerminatedString = @enumFromInt(pl_op.payload); | |
| 89167 | const pl_op = air_datas[@backingInt(inst)].pl_op; | |
| 89168 | const air_name: Air.NullTerminatedString = @fromBackingInt(@intCast(pl_op.payload)); | |
| 89169 | 89169 | const op_ty = cg.typeOf(pl_op.operand); |
| 89170 | 89170 | const local_ty = switch (air_tag) { |
| 89171 | 89171 | else => unreachable, |
| ... | ... | @@ -89202,7 +89202,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 89202 | 89202 | try ops[0].die(cg); |
| 89203 | 89203 | }, |
| 89204 | 89204 | .is_null => { |
| 89205 | const un_op = air_datas[@intFromEnum(inst)].un_op; | |
| 89205 | const un_op = air_datas[@backingInt(inst)].un_op; | |
| 89206 | 89206 | const opt_ty = cg.typeOf(un_op); |
| 89207 | 89207 | const opt_repr_is_pl = opt_ty.optionalReprIsPayload(zcu); |
| 89208 | 89208 | const opt_child_ty = opt_ty.optionalChild(zcu); |
| ... | ... | @@ -89227,7 +89227,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 89227 | 89227 | try is_null.finish(inst, &.{un_op}, &ops, cg); |
| 89228 | 89228 | }, |
| 89229 | 89229 | .is_non_null => { |
| 89230 | const un_op = air_datas[@intFromEnum(inst)].un_op; | |
| 89230 | const un_op = air_datas[@backingInt(inst)].un_op; | |
| 89231 | 89231 | const opt_ty = cg.typeOf(un_op); |
| 89232 | 89232 | const opt_repr_is_pl = opt_ty.optionalReprIsPayload(zcu); |
| 89233 | 89233 | const opt_child_ty = opt_ty.optionalChild(zcu); |
| ... | ... | @@ -89252,7 +89252,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 89252 | 89252 | try is_non_null.finish(inst, &.{un_op}, &ops, cg); |
| 89253 | 89253 | }, |
| 89254 | 89254 | .is_null_ptr => { |
| 89255 | const un_op = air_datas[@intFromEnum(inst)].un_op; | |
| 89255 | const un_op = air_datas[@backingInt(inst)].un_op; | |
| 89256 | 89256 | const opt_ty = cg.typeOf(un_op).childType(zcu); |
| 89257 | 89257 | const opt_repr_is_pl = opt_ty.optionalReprIsPayload(zcu); |
| 89258 | 89258 | const opt_child_ty = opt_ty.optionalChild(zcu); |
| ... | ... | @@ -89275,7 +89275,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 89275 | 89275 | try is_null.finish(inst, &.{un_op}, &ops, cg); |
| 89276 | 89276 | }, |
| 89277 | 89277 | .is_non_null_ptr => { |
| 89278 | const un_op = air_datas[@intFromEnum(inst)].un_op; | |
| 89278 | const un_op = air_datas[@backingInt(inst)].un_op; | |
| 89279 | 89279 | const opt_ty = cg.typeOf(un_op).childType(zcu); |
| 89280 | 89280 | const opt_repr_is_pl = opt_ty.optionalReprIsPayload(zcu); |
| 89281 | 89281 | const opt_child_ty = opt_ty.optionalChild(zcu); |
| ... | ... | @@ -89298,7 +89298,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 89298 | 89298 | try is_non_null.finish(inst, &.{un_op}, &ops, cg); |
| 89299 | 89299 | }, |
| 89300 | 89300 | .is_err => { |
| 89301 | const un_op = air_datas[@intFromEnum(inst)].un_op; | |
| 89301 | const un_op = air_datas[@backingInt(inst)].un_op; | |
| 89302 | 89302 | const eu_ty = cg.typeOf(un_op); |
| 89303 | 89303 | const eu_err_ty = eu_ty.errorUnionSet(zcu); |
| 89304 | 89304 | const eu_pl_ty = eu_ty.errorUnionPayload(zcu); |
| ... | ... | @@ -89314,7 +89314,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 89314 | 89314 | try is_err.finish(inst, &.{un_op}, &ops, cg); |
| 89315 | 89315 | }, |
| 89316 | 89316 | .is_non_err => { |
| 89317 | const un_op = air_datas[@intFromEnum(inst)].un_op; | |
| 89317 | const un_op = air_datas[@backingInt(inst)].un_op; | |
| 89318 | 89318 | const eu_ty = cg.typeOf(un_op); |
| 89319 | 89319 | const eu_err_ty = eu_ty.errorUnionSet(zcu); |
| 89320 | 89320 | const eu_pl_ty = eu_ty.errorUnionPayload(zcu); |
| ... | ... | @@ -89330,7 +89330,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 89330 | 89330 | try is_non_err.finish(inst, &.{un_op}, &ops, cg); |
| 89331 | 89331 | }, |
| 89332 | 89332 | .is_err_ptr => { |
| 89333 | const un_op = air_datas[@intFromEnum(inst)].un_op; | |
| 89333 | const un_op = air_datas[@backingInt(inst)].un_op; | |
| 89334 | 89334 | const eu_ty = cg.typeOf(un_op).childType(zcu); |
| 89335 | 89335 | const eu_err_ty = eu_ty.errorUnionSet(zcu); |
| 89336 | 89336 | const eu_pl_ty = eu_ty.errorUnionPayload(zcu); |
| ... | ... | @@ -89346,7 +89346,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 89346 | 89346 | try is_err.finish(inst, &.{un_op}, &ops, cg); |
| 89347 | 89347 | }, |
| 89348 | 89348 | .is_non_err_ptr => { |
| 89349 | const un_op = air_datas[@intFromEnum(inst)].un_op; | |
| 89349 | const un_op = air_datas[@backingInt(inst)].un_op; | |
| 89350 | 89350 | const eu_ty = cg.typeOf(un_op).childType(zcu); |
| 89351 | 89351 | const eu_err_ty = eu_ty.errorUnionSet(zcu); |
| 89352 | 89352 | const eu_pl_ty = eu_ty.errorUnionPayload(zcu); |
| ... | ... | @@ -89362,7 +89362,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 89362 | 89362 | try is_non_err.finish(inst, &.{un_op}, &ops, cg); |
| 89363 | 89363 | }, |
| 89364 | 89364 | .load => { |
| 89365 | const ty_op = air_datas[@intFromEnum(inst)].ty_op; | |
| 89365 | const ty_op = air_datas[@backingInt(inst)].ty_op; | |
| 89366 | 89366 | const val_ty = ty_op.ty.toType(); |
| 89367 | 89367 | var ops = try cg.tempsFromOperands(inst, .{ty_op.operand}); |
| 89368 | 89368 | var res: [1]Temp = undefined; |
| ... | ... | @@ -89414,7 +89414,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 89414 | 89414 | error.SelectFailed => res[0] = try ops[0].load(val_ty, .{ |
| 89415 | 89415 | .disp = switch (cg.typeOf(ty_op.operand).ptrInfo(zcu).flags.vector_index) { |
| 89416 | 89416 | .none => 0, |
| 89417 | else => |vector_index| @intCast(val_ty.abiSize(zcu) * @intFromEnum(vector_index)), | |
| 89417 | else => |vector_index| @intCast(val_ty.abiSize(zcu) * @backingInt(vector_index)), | |
| 89418 | 89418 | }, |
| 89419 | 89419 | }, cg), |
| 89420 | 89420 | else => |e| return e, |
| ... | ... | @@ -89425,7 +89425,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 89425 | 89425 | .ret_safe => try cg.airRet(inst, true), |
| 89426 | 89426 | .ret_load => try cg.airRetLoad(inst), |
| 89427 | 89427 | .store, .store_safe => |air_tag| { |
| 89428 | const bin_op = air_datas[@intFromEnum(inst)].bin_op; | |
| 89428 | const bin_op = air_datas[@backingInt(inst)].bin_op; | |
| 89429 | 89429 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }); |
| 89430 | 89430 | switch (ops[1].tracking(cg).short) { |
| 89431 | 89431 | else => {}, |
| ... | ... | @@ -89675,7 +89675,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 89675 | 89675 | error.SelectFailed => try ops[0].store(&ops[1], .{ |
| 89676 | 89676 | .disp = switch (cg.typeOf(bin_op.lhs).ptrInfo(zcu).flags.vector_index) { |
| 89677 | 89677 | .none => 0, |
| 89678 | else => |vector_index| @intCast(cg.typeOf(bin_op.rhs).abiSize(zcu) * @intFromEnum(vector_index)), | |
| 89678 | else => |vector_index| @intCast(cg.typeOf(bin_op.rhs).abiSize(zcu) * @backingInt(vector_index)), | |
| 89679 | 89679 | }, |
| 89680 | 89680 | .safe = switch (air_tag) { |
| 89681 | 89681 | else => unreachable, |
| ... | ... | @@ -89689,7 +89689,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 89689 | 89689 | }, |
| 89690 | 89690 | .unreach => {}, |
| 89691 | 89691 | .fptrunc => |air_tag| { |
| 89692 | const ty_op = air_datas[@intFromEnum(inst)].ty_op; | |
| 89692 | const ty_op = air_datas[@backingInt(inst)].ty_op; | |
| 89693 | 89693 | var ops = try cg.tempsFromOperands(inst, .{ty_op.operand}); |
| 89694 | 89694 | var res: [1]Temp = undefined; |
| 89695 | 89695 | cg.select(&res, &.{ty_op.ty.toType()}, &ops, comptime &.{ .{ |
| ... | ... | @@ -91714,7 +91714,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 91714 | 91714 | try res[0].finish(inst, &.{ty_op.operand}, &ops, cg); |
| 91715 | 91715 | }, |
| 91716 | 91716 | .fpext => |air_tag| { |
| 91717 | const ty_op = air_datas[@intFromEnum(inst)].ty_op; | |
| 91717 | const ty_op = air_datas[@backingInt(inst)].ty_op; | |
| 91718 | 91718 | var ops = try cg.tempsFromOperands(inst, .{ty_op.operand}); |
| 91719 | 91719 | var res: [1]Temp = undefined; |
| 91720 | 91720 | cg.select(&res, &.{ty_op.ty.toType()}, &ops, comptime &.{ .{ |
| ... | ... | @@ -93389,7 +93389,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 93389 | 93389 | try res[0].finish(inst, &.{ty_op.operand}, &ops, cg); |
| 93390 | 93390 | }, |
| 93391 | 93391 | .int_cast => |air_tag| { |
| 93392 | const ty_op = air_datas[@intFromEnum(inst)].ty_op; | |
| 93392 | const ty_op = air_datas[@backingInt(inst)].ty_op; | |
| 93393 | 93393 | const dst_ty = ty_op.ty.toType(); |
| 93394 | 93394 | const src_ty = cg.typeOf(ty_op.operand); |
| 93395 | 93395 | var ops = try cg.tempsFromOperands(inst, .{ty_op.operand}); |
| ... | ... | @@ -98148,7 +98148,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 98148 | 98148 | }, |
| 98149 | 98149 | .int_cast_safe => unreachable, |
| 98150 | 98150 | .trunc => |air_tag| { |
| 98151 | const ty_op = air_datas[@intFromEnum(inst)].ty_op; | |
| 98151 | const ty_op = air_datas[@backingInt(inst)].ty_op; | |
| 98152 | 98152 | var ops = try cg.tempsFromOperands(inst, .{ty_op.operand}); |
| 98153 | 98153 | var res: [1]Temp = undefined; |
| 98154 | 98154 | cg.select(&res, &.{ty_op.ty.toType()}, &ops, comptime &.{ .{ |
| ... | ... | @@ -103813,7 +103813,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 103813 | 103813 | try res[0].finish(inst, &.{ty_op.operand}, &ops, cg); |
| 103814 | 103814 | }, |
| 103815 | 103815 | .optional_payload => { |
| 103816 | const ty_op = air_datas[@intFromEnum(inst)].ty_op; | |
| 103816 | const ty_op = air_datas[@backingInt(inst)].ty_op; | |
| 103817 | 103817 | var ops = try cg.tempsFromOperands(inst, .{ty_op.operand}); |
| 103818 | 103818 | const pl = if (!hack_around_sema_opv_bugs or ty_op.ty.toType().hasRuntimeBits(zcu)) |
| 103819 | 103819 | try ops[0].read(ty_op.ty.toType(), .{}, cg) |
| ... | ... | @@ -103822,12 +103822,12 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 103822 | 103822 | try pl.finish(inst, &.{ty_op.operand}, &ops, cg); |
| 103823 | 103823 | }, |
| 103824 | 103824 | .optional_payload_ptr => { |
| 103825 | const ty_op = air_datas[@intFromEnum(inst)].ty_op; | |
| 103825 | const ty_op = air_datas[@backingInt(inst)].ty_op; | |
| 103826 | 103826 | const ops = try cg.tempsFromOperands(inst, .{ty_op.operand}); |
| 103827 | 103827 | try ops[0].finish(inst, &.{ty_op.operand}, &ops, cg); |
| 103828 | 103828 | }, |
| 103829 | 103829 | .optional_payload_ptr_set => { |
| 103830 | const ty_op = air_datas[@intFromEnum(inst)].ty_op; | |
| 103830 | const ty_op = air_datas[@backingInt(inst)].ty_op; | |
| 103831 | 103831 | const opt_ty = cg.typeOf(ty_op.operand).childType(zcu); |
| 103832 | 103832 | var ops = try cg.tempsFromOperands(inst, .{ty_op.operand}); |
| 103833 | 103833 | if (!opt_ty.optionalReprIsPayload(zcu)) { |
| ... | ... | @@ -103842,7 +103842,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 103842 | 103842 | try ops[0].finish(inst, &.{ty_op.operand}, &ops, cg); |
| 103843 | 103843 | }, |
| 103844 | 103844 | .wrap_optional => { |
| 103845 | const ty_op = air_datas[@intFromEnum(inst)].ty_op; | |
| 103845 | const ty_op = air_datas[@backingInt(inst)].ty_op; | |
| 103846 | 103846 | const opt_ty = ty_op.ty.toType(); |
| 103847 | 103847 | const opt_pl_ty = cg.typeOf(ty_op.operand); |
| 103848 | 103848 | const opt_pl_abi_size: u31 = @intCast(opt_pl_ty.abiSize(zcu)); |
| ... | ... | @@ -103857,7 +103857,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 103857 | 103857 | try opt.finish(inst, &.{ty_op.operand}, &ops, cg); |
| 103858 | 103858 | }, |
| 103859 | 103859 | .unwrap_errunion_payload => { |
| 103860 | const ty_op = air_datas[@intFromEnum(inst)].ty_op; | |
| 103860 | const ty_op = air_datas[@backingInt(inst)].ty_op; | |
| 103861 | 103861 | const eu_pl_ty = ty_op.ty.toType(); |
| 103862 | 103862 | const eu_pl_off: i32 = @intCast(codegen.errUnionPayloadOffset(eu_pl_ty, zcu)); |
| 103863 | 103863 | var ops = try cg.tempsFromOperands(inst, .{ty_op.operand}); |
| ... | ... | @@ -103868,7 +103868,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 103868 | 103868 | try pl.finish(inst, &.{ty_op.operand}, &ops, cg); |
| 103869 | 103869 | }, |
| 103870 | 103870 | .unwrap_errunion_err => { |
| 103871 | const ty_op = air_datas[@intFromEnum(inst)].ty_op; | |
| 103871 | const ty_op = air_datas[@backingInt(inst)].ty_op; | |
| 103872 | 103872 | const eu_ty = cg.typeOf(ty_op.operand); |
| 103873 | 103873 | const eu_err_ty = ty_op.ty.toType(); |
| 103874 | 103874 | const eu_pl_ty = eu_ty.errorUnionPayload(zcu); |
| ... | ... | @@ -103878,7 +103878,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 103878 | 103878 | try err.finish(inst, &.{ty_op.operand}, &ops, cg); |
| 103879 | 103879 | }, |
| 103880 | 103880 | .unwrap_errunion_payload_ptr => { |
| 103881 | const ty_op = air_datas[@intFromEnum(inst)].ty_op; | |
| 103881 | const ty_op = air_datas[@backingInt(inst)].ty_op; | |
| 103882 | 103882 | const eu_ty = cg.typeOf(ty_op.operand).childType(zcu); |
| 103883 | 103883 | const eu_pl_ty = eu_ty.errorUnionPayload(zcu); |
| 103884 | 103884 | const eu_pl_off: i32 = @intCast(codegen.errUnionPayloadOffset(eu_pl_ty, zcu)); |
| ... | ... | @@ -103887,7 +103887,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 103887 | 103887 | try ops[0].finish(inst, &.{ty_op.operand}, &ops, cg); |
| 103888 | 103888 | }, |
| 103889 | 103889 | .unwrap_errunion_err_ptr => { |
| 103890 | const ty_op = air_datas[@intFromEnum(inst)].ty_op; | |
| 103890 | const ty_op = air_datas[@backingInt(inst)].ty_op; | |
| 103891 | 103891 | const eu_ty = cg.typeOf(ty_op.operand).childType(zcu); |
| 103892 | 103892 | const eu_err_ty = ty_op.ty.toType(); |
| 103893 | 103893 | const eu_pl_ty = eu_ty.errorUnionPayload(zcu); |
| ... | ... | @@ -103898,7 +103898,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 103898 | 103898 | try err.finish(inst, &.{ty_op.operand}, &ops, cg); |
| 103899 | 103899 | }, |
| 103900 | 103900 | .errunion_payload_ptr_set => { |
| 103901 | const ty_op = air_datas[@intFromEnum(inst)].ty_op; | |
| 103901 | const ty_op = air_datas[@backingInt(inst)].ty_op; | |
| 103902 | 103902 | const eu_ty = cg.typeOf(ty_op.operand).childType(zcu); |
| 103903 | 103903 | const eu_err_ty = eu_ty.errorUnionSet(zcu); |
| 103904 | 103904 | const eu_pl_ty = eu_ty.errorUnionPayload(zcu); |
| ... | ... | @@ -103913,7 +103913,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 103913 | 103913 | try ops[0].finish(inst, &.{ty_op.operand}, &ops, cg); |
| 103914 | 103914 | }, |
| 103915 | 103915 | .wrap_errunion_payload => { |
| 103916 | const ty_op = air_datas[@intFromEnum(inst)].ty_op; | |
| 103916 | const ty_op = air_datas[@backingInt(inst)].ty_op; | |
| 103917 | 103917 | const eu_ty = ty_op.ty.toType(); |
| 103918 | 103918 | const eu_err_ty = eu_ty.errorUnionSet(zcu); |
| 103919 | 103919 | const eu_pl_ty = cg.typeOf(ty_op.operand); |
| ... | ... | @@ -103928,7 +103928,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 103928 | 103928 | try eu.finish(inst, &.{ty_op.operand}, &ops, cg); |
| 103929 | 103929 | }, |
| 103930 | 103930 | .wrap_errunion_err => { |
| 103931 | const ty_op = air_datas[@intFromEnum(inst)].ty_op; | |
| 103931 | const ty_op = air_datas[@backingInt(inst)].ty_op; | |
| 103932 | 103932 | const eu_ty = ty_op.ty.toType(); |
| 103933 | 103933 | const eu_pl_ty = eu_ty.errorUnionPayload(zcu); |
| 103934 | 103934 | const eu_err_off: u31 = @intCast(codegen.errUnionErrorOffset(eu_pl_ty, zcu)); |
| ... | ... | @@ -103938,7 +103938,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 103938 | 103938 | try eu.finish(inst, &.{ty_op.operand}, &ops, cg); |
| 103939 | 103939 | }, |
| 103940 | 103940 | .struct_field_ptr => { |
| 103941 | const ty_pl = air_datas[@intFromEnum(inst)].ty_pl; | |
| 103941 | const ty_pl = air_datas[@backingInt(inst)].ty_pl; | |
| 103942 | 103942 | const struct_field = cg.air.extraData(Air.StructField, ty_pl.payload).data; |
| 103943 | 103943 | var ops = try cg.tempsFromOperands(inst, .{struct_field.struct_operand}); |
| 103944 | 103944 | try ops[0].toOffset(@intCast(codegen.fieldOffset( |
| ... | ... | @@ -103954,7 +103954,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 103954 | 103954 | .struct_field_ptr_index_2, |
| 103955 | 103955 | .struct_field_ptr_index_3, |
| 103956 | 103956 | => |air_tag| { |
| 103957 | const ty_op = air_datas[@intFromEnum(inst)].ty_op; | |
| 103957 | const ty_op = air_datas[@backingInt(inst)].ty_op; | |
| 103958 | 103958 | var ops = try cg.tempsFromOperands(inst, .{ty_op.operand}); |
| 103959 | 103959 | try ops[0].toOffset(@intCast(codegen.fieldOffset( |
| 103960 | 103960 | cg.typeOf(ty_op.operand), |
| ... | ... | @@ -103971,7 +103971,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 103971 | 103971 | try ops[0].finish(inst, &.{ty_op.operand}, &ops, cg); |
| 103972 | 103972 | }, |
| 103973 | 103973 | .agg_field_val => { |
| 103974 | const ty_pl = air_datas[@intFromEnum(inst)].ty_pl; | |
| 103974 | const ty_pl = air_datas[@backingInt(inst)].ty_pl; | |
| 103975 | 103975 | const struct_field = cg.air.extraData(Air.StructField, ty_pl.payload).data; |
| 103976 | 103976 | const agg_ty = cg.typeOf(struct_field.struct_operand); |
| 103977 | 103977 | const field_ty = ty_pl.ty.toType(); |
| ... | ... | @@ -103987,7 +103987,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 103987 | 103987 | try res.finish(inst, &.{struct_field.struct_operand}, &ops, cg); |
| 103988 | 103988 | }, |
| 103989 | 103989 | .set_union_tag => { |
| 103990 | const bin_op = air_datas[@intFromEnum(inst)].bin_op; | |
| 103990 | const bin_op = air_datas[@backingInt(inst)].bin_op; | |
| 103991 | 103991 | const union_ty = cg.typeOf(bin_op.lhs).childType(zcu); |
| 103992 | 103992 | const union_layout = union_ty.unionGetLayout(zcu); |
| 103993 | 103993 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }); |
| ... | ... | @@ -103998,7 +103998,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 103998 | 103998 | try res.finish(inst, &.{ bin_op.lhs, bin_op.rhs }, &ops, cg); |
| 103999 | 103999 | }, |
| 104000 | 104000 | .get_union_tag => { |
| 104001 | const ty_op = air_datas[@intFromEnum(inst)].ty_op; | |
| 104001 | const ty_op = air_datas[@backingInt(inst)].ty_op; | |
| 104002 | 104002 | const union_ty = cg.typeOf(ty_op.operand); |
| 104003 | 104003 | var ops = try cg.tempsFromOperands(inst, .{ty_op.operand}); |
| 104004 | 104004 | const union_layout = union_ty.unionGetLayout(zcu); |
| ... | ... | @@ -104009,38 +104009,38 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 104009 | 104009 | try res.finish(inst, &.{ty_op.operand}, &ops, cg); |
| 104010 | 104010 | }, |
| 104011 | 104011 | .slice => { |
| 104012 | const ty_pl = air_datas[@intFromEnum(inst)].ty_pl; | |
| 104012 | const ty_pl = air_datas[@backingInt(inst)].ty_pl; | |
| 104013 | 104013 | const bin_op = cg.air.extraData(Air.Bin, ty_pl.payload).data; |
| 104014 | 104014 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }); |
| 104015 | 104015 | try ops[0].toPair(&ops[1], cg); |
| 104016 | 104016 | try ops[0].finish(inst, &.{ bin_op.lhs, bin_op.rhs }, &ops, cg); |
| 104017 | 104017 | }, |
| 104018 | 104018 | .slice_len => { |
| 104019 | const ty_op = air_datas[@intFromEnum(inst)].ty_op; | |
| 104019 | const ty_op = air_datas[@backingInt(inst)].ty_op; | |
| 104020 | 104020 | var ops = try cg.tempsFromOperands(inst, .{ty_op.operand}); |
| 104021 | 104021 | try ops[0].toSliceLen(cg); |
| 104022 | 104022 | try ops[0].finish(inst, &.{ty_op.operand}, &ops, cg); |
| 104023 | 104023 | }, |
| 104024 | 104024 | .slice_ptr => { |
| 104025 | const ty_op = air_datas[@intFromEnum(inst)].ty_op; | |
| 104025 | const ty_op = air_datas[@backingInt(inst)].ty_op; | |
| 104026 | 104026 | var ops = try cg.tempsFromOperands(inst, .{ty_op.operand}); |
| 104027 | 104027 | try ops[0].toSlicePtr(cg); |
| 104028 | 104028 | try ops[0].finish(inst, &.{ty_op.operand}, &ops, cg); |
| 104029 | 104029 | }, |
| 104030 | 104030 | .ptr_slice_len_ptr => { |
| 104031 | const ty_op = air_datas[@intFromEnum(inst)].ty_op; | |
| 104031 | const ty_op = air_datas[@backingInt(inst)].ty_op; | |
| 104032 | 104032 | var ops = try cg.tempsFromOperands(inst, .{ty_op.operand}); |
| 104033 | 104033 | try ops[0].toOffset(8, cg); |
| 104034 | 104034 | try ops[0].finish(inst, &.{ty_op.operand}, &ops, cg); |
| 104035 | 104035 | }, |
| 104036 | 104036 | .ptr_slice_ptr_ptr => { |
| 104037 | const ty_op = air_datas[@intFromEnum(inst)].ty_op; | |
| 104037 | const ty_op = air_datas[@backingInt(inst)].ty_op; | |
| 104038 | 104038 | var ops = try cg.tempsFromOperands(inst, .{ty_op.operand}); |
| 104039 | 104039 | try ops[0].toOffset(0, cg); |
| 104040 | 104040 | try ops[0].finish(inst, &.{ty_op.operand}, &ops, cg); |
| 104041 | 104041 | }, |
| 104042 | 104042 | .array_elem_val, .legalize_vec_elem_val => { |
| 104043 | const bin_op = air_datas[@intFromEnum(inst)].bin_op; | |
| 104043 | const bin_op = air_datas[@backingInt(inst)].bin_op; | |
| 104044 | 104044 | const array_ty = cg.typeOf(bin_op.lhs); |
| 104045 | 104045 | const res_ty = array_ty.childType(zcu); |
| 104046 | 104046 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }); |
| ... | ... | @@ -104236,7 +104236,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 104236 | 104236 | try res[0].finish(inst, &.{ bin_op.lhs, bin_op.rhs }, &ops, cg); |
| 104237 | 104237 | }, |
| 104238 | 104238 | .slice_elem_val, .ptr_elem_val => { |
| 104239 | const bin_op = air_datas[@intFromEnum(inst)].bin_op; | |
| 104239 | const bin_op = air_datas[@backingInt(inst)].bin_op; | |
| 104240 | 104240 | const res_ty = cg.typeOf(bin_op.lhs).indexableElem(zcu); |
| 104241 | 104241 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }); |
| 104242 | 104242 | try ops[0].toSlicePtr(cg); |
| ... | ... | @@ -104359,7 +104359,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 104359 | 104359 | try res[0].finish(inst, &.{ bin_op.lhs, bin_op.rhs }, &ops, cg); |
| 104360 | 104360 | }, |
| 104361 | 104361 | .slice_elem_ptr, .ptr_elem_ptr => { |
| 104362 | const ty_pl = air_datas[@intFromEnum(inst)].ty_pl; | |
| 104362 | const ty_pl = air_datas[@backingInt(inst)].ty_pl; | |
| 104363 | 104363 | const bin_op = cg.air.extraData(Air.Bin, ty_pl.payload).data; |
| 104364 | 104364 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }); |
| 104365 | 104365 | try ops[0].toSlicePtr(cg); |
| ... | ... | @@ -104406,7 +104406,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 104406 | 104406 | try ops[0].finish(inst, &.{ bin_op.lhs, bin_op.rhs }, &ops, cg); |
| 104407 | 104407 | }, |
| 104408 | 104408 | .array_to_slice => { |
| 104409 | const ty_op = air_datas[@intFromEnum(inst)].ty_op; | |
| 104409 | const ty_op = air_datas[@backingInt(inst)].ty_op; | |
| 104410 | 104410 | var ops = try cg.tempsFromOperands(inst, .{ty_op.operand}); |
| 104411 | 104411 | var len = try cg.tempInit(.usize, .{ |
| 104412 | 104412 | .immediate = cg.typeOf(ty_op.operand).childType(zcu).arrayLen(zcu), |
| ... | ... | @@ -104415,7 +104415,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 104415 | 104415 | try ops[0].finish(inst, &.{ty_op.operand}, &ops, cg); |
| 104416 | 104416 | }, |
| 104417 | 104417 | .int_from_float, .int_from_float_optimized => |air_tag| { |
| 104418 | const ty_op = air_datas[@intFromEnum(inst)].ty_op; | |
| 104418 | const ty_op = air_datas[@backingInt(inst)].ty_op; | |
| 104419 | 104419 | var ops = try cg.tempsFromOperands(inst, .{ty_op.operand}); |
| 104420 | 104420 | var res: [1]Temp = undefined; |
| 104421 | 104421 | cg.select(&res, &.{ty_op.ty.toType()}, &ops, comptime &.{ .{ |
| ... | ... | @@ -115184,7 +115184,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 115184 | 115184 | .int_from_float_safe => unreachable, |
| 115185 | 115185 | .int_from_float_optimized_safe => unreachable, |
| 115186 | 115186 | .float_from_int => |air_tag| { |
| 115187 | const ty_op = air_datas[@intFromEnum(inst)].ty_op; | |
| 115187 | const ty_op = air_datas[@backingInt(inst)].ty_op; | |
| 115188 | 115188 | var ops = try cg.tempsFromOperands(inst, .{ty_op.operand}); |
| 115189 | 115189 | var res: [1]Temp = undefined; |
| 115190 | 115190 | cg.select(&res, &.{ty_op.ty.toType()}, &ops, comptime &.{ .{ |
| ... | ... | @@ -127202,7 +127202,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 127202 | 127202 | }, |
| 127203 | 127203 | .reduce => |air_tag| { |
| 127204 | 127204 | const nan = std.math.nan(f16); |
| 127205 | const reduce = air_datas[@intFromEnum(inst)].reduce; | |
| 127205 | const reduce = air_datas[@backingInt(inst)].reduce; | |
| 127206 | 127206 | const res_ty = cg.typeOfIndex(inst); |
| 127207 | 127207 | var ops = try cg.tempsFromOperands(inst, .{reduce.operand}); |
| 127208 | 127208 | var res: [1]Temp = undefined; |
| ... | ... | @@ -161404,7 +161404,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 161404 | 161404 | }, |
| 161405 | 161405 | .reduce_optimized => |air_tag| { |
| 161406 | 161406 | const inf = std.math.inf(f16); |
| 161407 | const reduce = air_datas[@intFromEnum(inst)].reduce; | |
| 161407 | const reduce = air_datas[@backingInt(inst)].reduce; | |
| 161408 | 161408 | var ops = try cg.tempsFromOperands(inst, .{reduce.operand}); |
| 161409 | 161409 | var res: [1]Temp = undefined; |
| 161410 | 161410 | cg.select(&res, &.{cg.typeOfIndex(inst)}, &ops, switch (reduce.operation) { |
| ... | ... | @@ -169105,7 +169105,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 169105 | 169105 | try res[0].finish(inst, &.{reduce.operand}, &ops, cg); |
| 169106 | 169106 | }, |
| 169107 | 169107 | .splat => |air_tag| { |
| 169108 | const ty_op = air_datas[@intFromEnum(inst)].ty_op; | |
| 169108 | const ty_op = air_datas[@backingInt(inst)].ty_op; | |
| 169109 | 169109 | var ops = try cg.tempsFromOperands(inst, .{ty_op.operand}); |
| 169110 | 169110 | var res: [1]Temp = undefined; |
| 169111 | 169111 | cg.select(&res, &.{ty_op.ty.toType()}, &ops, comptime &.{ .{ |
| ... | ... | @@ -170948,7 +170948,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 170948 | 170948 | .memset => try cg.airMemset(inst, false), |
| 170949 | 170949 | .memset_safe => try cg.airMemset(inst, true), |
| 170950 | 170950 | .memcpy, .memmove => |air_tag| { |
| 170951 | const bin_op = air_datas[@intFromEnum(inst)].bin_op; | |
| 170951 | const bin_op = air_datas[@backingInt(inst)].bin_op; | |
| 170952 | 170952 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }) ++ .{undefined}; |
| 170953 | 170953 | ops[2] = ops[0].getByteLen(cg) catch |err| switch (err) { |
| 170954 | 170954 | error.SelectFailed => return cg.fail("failed to select {s} {f} {f} {f} {f}", .{ |
| ... | ... | @@ -171012,7 +171012,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 171012 | 171012 | .atomic_store_seq_cst => try cg.airAtomicStore(inst, .seq_cst), |
| 171013 | 171013 | .atomic_rmw => try cg.airAtomicRmw(inst), |
| 171014 | 171014 | .is_named_enum_value => |air_tag| { |
| 171015 | const un_op = air_datas[@intFromEnum(inst)].un_op; | |
| 171015 | const un_op = air_datas[@backingInt(inst)].un_op; | |
| 171016 | 171016 | var ops = try cg.tempsFromOperands(inst, .{un_op}); |
| 171017 | 171017 | var res: [1]Temp = undefined; |
| 171018 | 171018 | cg.select(&res, &.{.bool}, &ops, comptime &.{ .{ |
| ... | ... | @@ -171183,7 +171183,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 171183 | 171183 | try res[0].finish(inst, &.{un_op}, &ops, cg); |
| 171184 | 171184 | }, |
| 171185 | 171185 | .tag_name => |air_tag| { |
| 171186 | const un_op = air_datas[@intFromEnum(inst)].un_op; | |
| 171186 | const un_op = air_datas[@backingInt(inst)].un_op; | |
| 171187 | 171187 | var ops = try cg.tempsFromOperands(inst, .{un_op}); |
| 171188 | 171188 | var res: [1]Temp = undefined; |
| 171189 | 171189 | cg.select(&res, &.{.slice_const_u8_sentinel_0}, &ops, comptime &.{ .{ |
| ... | ... | @@ -171350,7 +171350,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 171350 | 171350 | try res[0].finish(inst, &.{un_op}, &ops, cg); |
| 171351 | 171351 | }, |
| 171352 | 171352 | .error_name => |air_tag| { |
| 171353 | const un_op = air_datas[@intFromEnum(inst)].un_op; | |
| 171353 | const un_op = air_datas[@backingInt(inst)].un_op; | |
| 171354 | 171354 | var ops = try cg.tempsFromOperands(inst, .{un_op}); |
| 171355 | 171355 | var res: [2]Temp = undefined; |
| 171356 | 171356 | cg.select(&res, &.{ .slice_const_u8_sentinel_0, .usize }, &ops, comptime &.{ .{ |
| ... | ... | @@ -171458,7 +171458,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 171458 | 171458 | try res[0].finish(inst, &.{un_op}, &ops, cg); |
| 171459 | 171459 | }, |
| 171460 | 171460 | .error_set_has_value => |air_tag| { |
| 171461 | const ty_op = air_datas[@intFromEnum(inst)].ty_op; | |
| 171461 | const ty_op = air_datas[@backingInt(inst)].ty_op; | |
| 171462 | 171462 | var ops = try cg.tempsFromOperands(inst, .{ty_op.operand}) ++ .{try cg.tempInit(ty_op.ty.toType(), .none)}; |
| 171463 | 171463 | var res: [1]Temp = undefined; |
| 171464 | 171464 | cg.select(&res, &.{.bool}, &ops, comptime &.{ .{ |
| ... | ... | @@ -171550,7 +171550,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 171550 | 171550 | try res[0].finish(inst, &.{ty_op.operand}, ops[0..1], cg); |
| 171551 | 171551 | }, |
| 171552 | 171552 | .aggregate_init => |air_tag| fallback: { |
| 171553 | const ty_pl = air_datas[@intFromEnum(inst)].ty_pl; | |
| 171553 | const ty_pl = air_datas[@backingInt(inst)].ty_pl; | |
| 171554 | 171554 | const agg_ty = ty_pl.ty.toType(); |
| 171555 | 171555 | if (agg_ty.isVector(zcu) and agg_ty.childType(zcu).toIntern() == .bool_type) { |
| 171556 | 171556 | break :fallback try cg.airAggregateInitBoolVec(inst); |
| ... | ... | @@ -171620,7 +171620,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 171620 | 171620 | try res.finish(inst, &.{}, &.{}, cg); |
| 171621 | 171621 | }, |
| 171622 | 171622 | .union_init => { |
| 171623 | const ty_pl = air_datas[@intFromEnum(inst)].ty_pl; | |
| 171623 | const ty_pl = air_datas[@backingInt(inst)].ty_pl; | |
| 171624 | 171624 | const union_init = cg.air.extraData(Air.UnionInit, ty_pl.payload).data; |
| 171625 | 171625 | const union_ty = ty_pl.ty.toType(); |
| 171626 | 171626 | var ops = try cg.tempsFromOperands(inst, .{union_init.init}); |
| ... | ... | @@ -171642,7 +171642,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 171642 | 171642 | try res.finish(inst, &.{union_init.init}, &ops, cg); |
| 171643 | 171643 | }, |
| 171644 | 171644 | .prefetch => { |
| 171645 | const prefetch = air_datas[@intFromEnum(inst)].prefetch; | |
| 171645 | const prefetch = air_datas[@backingInt(inst)].prefetch; | |
| 171646 | 171646 | var ops = try cg.tempsFromOperands(inst, .{prefetch.ptr}); |
| 171647 | 171647 | switch (prefetch.cache) { |
| 171648 | 171648 | .instruction => {}, // prefetchi requires rip-relative addressing, which is currently non-trivial to emit from an arbitrary ptr value |
| ... | ... | @@ -171669,7 +171669,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 171669 | 171669 | try res.finish(inst, &.{prefetch.ptr}, &ops, cg); |
| 171670 | 171670 | }, |
| 171671 | 171671 | .mul_add => |air_tag| { |
| 171672 | const pl_op = air_datas[@intFromEnum(inst)].pl_op; | |
| 171672 | const pl_op = air_datas[@backingInt(inst)].pl_op; | |
| 171673 | 171673 | const bin_op = cg.air.extraData(Air.Bin, pl_op.payload).data; |
| 171674 | 171674 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs, pl_op.operand }); |
| 171675 | 171675 | var res: [1]Temp = undefined; |
| ... | ... | @@ -173070,7 +173070,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 173070 | 173070 | try res[0].finish(inst, &.{ bin_op.lhs, bin_op.rhs, pl_op.operand }, &ops, cg); |
| 173071 | 173071 | }, |
| 173072 | 173072 | .field_parent_ptr => { |
| 173073 | const ty_pl = air_datas[@intFromEnum(inst)].ty_pl; | |
| 173073 | const ty_pl = air_datas[@backingInt(inst)].ty_pl; | |
| 173074 | 173074 | const field_parent_ptr = cg.air.extraData(Air.FieldParentPtr, ty_pl.payload).data; |
| 173075 | 173075 | var ops = try cg.tempsFromOperands(inst, .{field_parent_ptr.field_ptr}); |
| 173076 | 173076 | try ops[0].toOffset(-@as(i32, @intCast(codegen.fieldOffset( |
| ... | ... | @@ -173083,7 +173083,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 173083 | 173083 | }, |
| 173084 | 173084 | .wasm_memory_size, .wasm_memory_grow => unreachable, |
| 173085 | 173085 | .cmp_lte_errors_len => |air_tag| { |
| 173086 | const un_op = air_datas[@intFromEnum(inst)].un_op; | |
| 173086 | const un_op = air_datas[@backingInt(inst)].un_op; | |
| 173087 | 173087 | var ops = try cg.tempsFromOperands(inst, .{un_op}); |
| 173088 | 173088 | var res: [1]Temp = undefined; |
| 173089 | 173089 | cg.select(&res, &.{.bool}, &ops, comptime &.{ .{ |
| ... | ... | @@ -173172,7 +173172,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 173172 | 173172 | try ert.finish(inst, &.{}, &.{}, cg); |
| 173173 | 173173 | }, |
| 173174 | 173174 | .set_err_return_trace => { |
| 173175 | const un_op = air_datas[@intFromEnum(inst)].un_op; | |
| 173175 | const un_op = air_datas[@backingInt(inst)].un_op; | |
| 173176 | 173176 | var ops = try cg.tempsFromOperands(inst, .{un_op}); |
| 173177 | 173177 | switch (ops[0].unwrap(cg)) { |
| 173178 | 173178 | .ref => { |
| ... | ... | @@ -173191,12 +173191,12 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 173191 | 173191 | } |
| 173192 | 173192 | }, |
| 173193 | 173193 | .addrspace_cast => { |
| 173194 | const ty_op = air_datas[@intFromEnum(inst)].ty_op; | |
| 173194 | const ty_op = air_datas[@backingInt(inst)].ty_op; | |
| 173195 | 173195 | const ops = try cg.tempsFromOperands(inst, .{ty_op.operand}); |
| 173196 | 173196 | try ops[0].finish(inst, &.{ty_op.operand}, &ops, cg); |
| 173197 | 173197 | }, |
| 173198 | 173198 | .save_err_return_trace_index => { |
| 173199 | const ty_pl = air_datas[@intFromEnum(inst)].ty_pl; | |
| 173199 | const ty_pl = air_datas[@backingInt(inst)].ty_pl; | |
| 173200 | 173200 | const agg_ty = ty_pl.ty.toType(); |
| 173201 | 173201 | assert(agg_ty.containerLayout(zcu) != .@"packed"); |
| 173202 | 173202 | var ert: Temp = .{ .index = err_ret_trace_index }; |
| ... | ... | @@ -173205,7 +173205,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 173205 | 173205 | try res.finish(inst, &.{}, &.{}, cg); |
| 173206 | 173206 | }, |
| 173207 | 173207 | .runtime_nav_ptr => { |
| 173208 | const ty_nav = air_datas[@intFromEnum(inst)].ty_nav; | |
| 173208 | const ty_nav = air_datas[@backingInt(inst)].ty_nav; | |
| 173209 | 173209 | const nav = ip.getNav(ty_nav.nav); |
| 173210 | 173210 | const is_threadlocal = zcu.comp.config.any_non_single_threaded and nav.resolved.?.@"threadlocal"; |
| 173211 | 173211 | |
| ... | ... | @@ -173250,7 +173250,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 173250 | 173250 | .c_va_end => try cg.airVaEnd(inst), |
| 173251 | 173251 | .c_va_start => try cg.airVaStart(inst), |
| 173252 | 173252 | .legalize_vec_store_elem => { |
| 173253 | const pl_op = air_datas[@intFromEnum(inst)].pl_op; | |
| 173253 | const pl_op = air_datas[@backingInt(inst)].pl_op; | |
| 173254 | 173254 | const bin = cg.air.extraData(Air.Bin, pl_op.payload).data; |
| 173255 | 173255 | // vector_ptr, index, elem_val |
| 173256 | 173256 | var ops = try cg.tempsFromOperands(inst, .{ pl_op.operand, bin.lhs, bin.rhs }); |
| ... | ... | @@ -173885,7 +173885,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 173885 | 173885 | |
| 173886 | 173886 | .work_item_id, .work_group_size, .work_group_id, .spirv_runtime_array_len => unreachable, |
| 173887 | 173887 | } |
| 173888 | try cg.resetTemps(@enumFromInt(0)); | |
| 173888 | try cg.resetTemps(@fromBackingInt(@intCast(0))); | |
| 173889 | 173889 | cg.checkInvariantsAfterAirInst(); |
| 173890 | 173890 | } |
| 173891 | 173891 | verbose_tracking_log.debug("{f}", .{cg.fmtTracking()}); |
| ... | ... | @@ -174007,7 +174007,7 @@ fn genLazy(cg: *CodeGen, lazy_sym: link.File.LazySymbol) InnerError!void { |
| 174007 | 174007 | .{ @tagName(lazy_sym.kind), Type.fromInterned(lazy_sym.ty).fmt(pt) }, |
| 174008 | 174008 | ), |
| 174009 | 174009 | } |
| 174010 | try cg.resetTemps(@enumFromInt(0)); | |
| 174010 | try cg.resetTemps(@fromBackingInt(@intCast(0))); | |
| 174011 | 174011 | cg.checkInvariantsAfterAirInst(); |
| 174012 | 174012 | } |
| 174013 | 174013 | |
| ... | ... | @@ -174059,7 +174059,7 @@ fn processDeath(self: *CodeGen, inst: Air.Inst.Index, comptime opts: FreeOptions |
| 174059 | 174059 | } |
| 174060 | 174060 | |
| 174061 | 174061 | fn finishAirResult(self: *CodeGen, inst: Air.Inst.Index, result: MCValue) void { |
| 174062 | if (self.liveness.isUnused(inst) and self.air.instructions.items(.tag)[@intFromEnum(inst)] != .arg) switch (result) { | |
| 174062 | if (self.liveness.isUnused(inst) and self.air.instructions.items(.tag)[@backingInt(inst)] != .arg) switch (result) { | |
| 174063 | 174063 | .none, .dead, .unreach => {}, |
| 174064 | 174064 | else => unreachable, // Why didn't the result die? |
| 174065 | 174065 | } else { |
| ... | ... | @@ -174100,7 +174100,7 @@ fn setFrameLoc( |
| 174100 | 174100 | offset: *i32, |
| 174101 | 174101 | comptime aligned: bool, |
| 174102 | 174102 | ) void { |
| 174103 | const frame_i = @intFromEnum(frame_index); | |
| 174103 | const frame_i = @backingInt(frame_index); | |
| 174104 | 174104 | if (aligned) { |
| 174105 | 174105 | const alignment = self.frame_allocs.items(.abi_align)[frame_i]; |
| 174106 | 174106 | offset.* = @intCast(alignment.forward(@intCast(offset.*))); |
| ... | ... | @@ -174120,21 +174120,21 @@ fn computeFrameLayout(self: *CodeGen, cc: std.lang.CallingConvention.Tag) !Frame |
| 174120 | 174120 | const frame_offset = self.frame_locs.items(.disp); |
| 174121 | 174121 | |
| 174122 | 174122 | for (stack_frame_order, FrameIndex.named_count..) |*frame_order, frame_index| |
| 174123 | frame_order.* = @enumFromInt(frame_index); | |
| 174123 | frame_order.* = @fromBackingInt(@intCast(frame_index)); | |
| 174124 | 174124 | { |
| 174125 | 174125 | const SortContext = struct { |
| 174126 | 174126 | frame_align: @TypeOf(frame_align), |
| 174127 | 174127 | pub fn lessThan(context: @This(), lhs: FrameIndex, rhs: FrameIndex) bool { |
| 174128 | return context.frame_align[@intFromEnum(lhs)].compare(.gt, context.frame_align[@intFromEnum(rhs)]); | |
| 174128 | return context.frame_align[@backingInt(lhs)].compare(.gt, context.frame_align[@backingInt(rhs)]); | |
| 174129 | 174129 | } |
| 174130 | 174130 | }; |
| 174131 | 174131 | const sort_context = SortContext{ .frame_align = frame_align }; |
| 174132 | 174132 | std.mem.sort(FrameIndex, stack_frame_order, sort_context, SortContext.lessThan); |
| 174133 | 174133 | } |
| 174134 | 174134 | |
| 174135 | const call_frame_align = frame_align[@intFromEnum(FrameIndex.call_frame)]; | |
| 174136 | const stack_frame_align = frame_align[@intFromEnum(FrameIndex.stack_frame)]; | |
| 174137 | const args_frame_align = frame_align[@intFromEnum(FrameIndex.args_frame)]; | |
| 174135 | const call_frame_align = frame_align[@backingInt(FrameIndex.call_frame)]; | |
| 174136 | const stack_frame_align = frame_align[@backingInt(FrameIndex.stack_frame)]; | |
| 174137 | const args_frame_align = frame_align[@backingInt(FrameIndex.args_frame)]; | |
| 174138 | 174138 | const needed_align = call_frame_align.max(stack_frame_align); |
| 174139 | 174139 | const need_align_stack = needed_align.compare(.gt, args_frame_align); |
| 174140 | 174140 | |
| ... | ... | @@ -174155,7 +174155,7 @@ fn computeFrameLayout(self: *CodeGen, cc: std.lang.CallingConvention.Tag) !Frame |
| 174155 | 174155 | const stack_frame_align_offset = if (need_align_stack) |
| 174156 | 174156 | 0 |
| 174157 | 174157 | else |
| 174158 | save_reg_list.size(self.target) + frame_offset[@intFromEnum(FrameIndex.args_frame)]; | |
| 174158 | save_reg_list.size(self.target) + frame_offset[@backingInt(FrameIndex.args_frame)]; | |
| 174159 | 174159 | |
| 174160 | 174160 | var rsp_offset: i32 = 0; |
| 174161 | 174161 | self.setFrameLoc(.call_frame, .rsp, &rsp_offset, true); |
| ... | ... | @@ -174164,23 +174164,23 @@ fn computeFrameLayout(self: *CodeGen, cc: std.lang.CallingConvention.Tag) !Frame |
| 174164 | 174164 | rsp_offset += stack_frame_align_offset; |
| 174165 | 174165 | rsp_offset = @intCast(needed_align.forward(@intCast(rsp_offset))); |
| 174166 | 174166 | rsp_offset -= stack_frame_align_offset; |
| 174167 | frame_size[@intFromEnum(FrameIndex.call_frame)] = | |
| 174168 | @intCast(rsp_offset - frame_offset[@intFromEnum(FrameIndex.stack_frame)]); | |
| 174167 | frame_size[@backingInt(FrameIndex.call_frame)] = | |
| 174168 | @intCast(rsp_offset - frame_offset[@backingInt(FrameIndex.stack_frame)]); | |
| 174169 | 174169 | |
| 174170 | 174170 | return .{ |
| 174171 | .stack_mask = @as(u32, std.math.maxInt(u32)) << @intCast(if (need_align_stack) @intFromEnum(needed_align) else 0), | |
| 174172 | .stack_adjust = @intCast(rsp_offset - frame_offset[@intFromEnum(FrameIndex.call_frame)]), | |
| 174171 | .stack_mask = @as(u32, std.math.maxInt(u32)) << @intCast(if (need_align_stack) @backingInt(needed_align) else 0), | |
| 174172 | .stack_adjust = @intCast(rsp_offset - frame_offset[@backingInt(FrameIndex.call_frame)]), | |
| 174173 | 174173 | .save_reg_list = save_reg_list, |
| 174174 | 174174 | }; |
| 174175 | 174175 | } |
| 174176 | 174176 | |
| 174177 | 174177 | fn getFrameAddrAlignment(self: *CodeGen, frame_addr: bits.FrameAddr) InternPool.Alignment { |
| 174178 | const alloc_align = self.frame_allocs.get(@intFromEnum(frame_addr.index)).abi_align; | |
| 174179 | return @enumFromInt(@min(@intFromEnum(alloc_align), @ctz(frame_addr.off))); | |
| 174178 | const alloc_align = self.frame_allocs.get(@backingInt(frame_addr.index)).abi_align; | |
| 174179 | return @fromBackingInt(@intCast(@min(@backingInt(alloc_align), @ctz(frame_addr.off)))); | |
| 174180 | 174180 | } |
| 174181 | 174181 | |
| 174182 | 174182 | fn getFrameAddrSize(self: *CodeGen, frame_addr: bits.FrameAddr) u32 { |
| 174183 | return self.frame_allocs.get(@intFromEnum(frame_addr.index)).abi_size - @as(u31, @intCast(frame_addr.off)); | |
| 174183 | return self.frame_allocs.get(@backingInt(frame_addr.index)).abi_size - @as(u31, @intCast(frame_addr.off)); | |
| 174184 | 174184 | } |
| 174185 | 174185 | |
| 174186 | 174186 | fn allocFrameIndex(self: *CodeGen, alloc: FrameAlloc) !FrameIndex { |
| ... | ... | @@ -174188,19 +174188,19 @@ fn allocFrameIndex(self: *CodeGen, alloc: FrameAlloc) !FrameIndex { |
| 174188 | 174188 | const frame_size = frame_allocs_slice.items(.abi_size); |
| 174189 | 174189 | const frame_align = frame_allocs_slice.items(.abi_align); |
| 174190 | 174190 | |
| 174191 | const stack_frame_align = &frame_align[@intFromEnum(FrameIndex.stack_frame)]; | |
| 174191 | const stack_frame_align = &frame_align[@backingInt(FrameIndex.stack_frame)]; | |
| 174192 | 174192 | stack_frame_align.* = stack_frame_align.max(alloc.abi_align); |
| 174193 | 174193 | |
| 174194 | 174194 | for (self.free_frame_indices.keys(), 0..) |frame_index, free_i| { |
| 174195 | const abi_size = frame_size[@intFromEnum(frame_index)]; | |
| 174195 | const abi_size = frame_size[@backingInt(frame_index)]; | |
| 174196 | 174196 | if (abi_size != alloc.abi_size) continue; |
| 174197 | const abi_align = &frame_align[@intFromEnum(frame_index)]; | |
| 174197 | const abi_align = &frame_align[@backingInt(frame_index)]; | |
| 174198 | 174198 | abi_align.* = abi_align.max(alloc.abi_align); |
| 174199 | 174199 | |
| 174200 | 174200 | _ = self.free_frame_indices.swapRemoveAt(free_i); |
| 174201 | 174201 | return frame_index; |
| 174202 | 174202 | } |
| 174203 | const frame_index: FrameIndex = @enumFromInt(self.frame_allocs.len); | |
| 174203 | const frame_index: FrameIndex = @fromBackingInt(@intCast(self.frame_allocs.len)); | |
| 174204 | 174204 | try self.frame_allocs.append(self.gpa, alloc); |
| 174205 | 174205 | return frame_index; |
| 174206 | 174206 | } |
| ... | ... | @@ -174318,7 +174318,7 @@ fn initRetroactiveState(self: *CodeGen) State { |
| 174318 | 174318 | self.scope_generation = scope_generation; |
| 174319 | 174319 | |
| 174320 | 174320 | var state: State = undefined; |
| 174321 | state.next_temp_index = @enumFromInt(0); | |
| 174321 | state.next_temp_index = @fromBackingInt(@intCast(0)); | |
| 174322 | 174322 | state.inst_tracking_len = @intCast(self.inst_tracking.count()); |
| 174323 | 174323 | state.scope_generation = scope_generation; |
| 174324 | 174324 | return state; |
| ... | ... | @@ -174350,8 +174350,8 @@ fn restoreState(self: *CodeGen, state: State, deaths: []const Air.Inst.Index, co |
| 174350 | 174350 | }) !void { |
| 174351 | 174351 | if (opts.close_scope) { |
| 174352 | 174352 | for ( |
| 174353 | self.inst_tracking.keys()[@intFromEnum(state.next_temp_index)..@intFromEnum(self.next_temp_index)], | |
| 174354 | self.inst_tracking.values()[@intFromEnum(state.next_temp_index)..@intFromEnum(self.next_temp_index)], | |
| 174353 | self.inst_tracking.keys()[@backingInt(state.next_temp_index)..@backingInt(self.next_temp_index)], | |
| 174354 | self.inst_tracking.values()[@backingInt(state.next_temp_index)..@backingInt(self.next_temp_index)], | |
| 174355 | 174355 | ) |inst, *tracking| try tracking.die(self, inst, .{ .emit_instructions = opts.emit_instructions }); |
| 174356 | 174356 | self.next_temp_index = state.next_temp_index; |
| 174357 | 174357 | for ( |
| ... | ... | @@ -174363,8 +174363,8 @@ fn restoreState(self: *CodeGen, state: State, deaths: []const Air.Inst.Index, co |
| 174363 | 174363 | |
| 174364 | 174364 | if (opts.resurrect) { |
| 174365 | 174365 | for ( |
| 174366 | self.inst_tracking.keys()[0..@intFromEnum(state.next_temp_index)], | |
| 174367 | self.inst_tracking.values()[0..@intFromEnum(state.next_temp_index)], | |
| 174366 | self.inst_tracking.keys()[0..@backingInt(state.next_temp_index)], | |
| 174367 | self.inst_tracking.values()[0..@backingInt(state.next_temp_index)], | |
| 174368 | 174368 | ) |inst, *tracking| try tracking.resurrect(self, inst, state.scope_generation); |
| 174369 | 174369 | for ( |
| 174370 | 174370 | self.inst_tracking.keys()[Temp.Index.max..state.inst_tracking_len], |
| ... | ... | @@ -176367,10 +176367,10 @@ fn genCall(cg: *CodeGen, info: union(enum) { |
| 176367 | 176367 | }); |
| 176368 | 176368 | const frame_allocs_slice = cg.frame_allocs.slice(); |
| 176369 | 176369 | const stack_frame_size = |
| 176370 | &frame_allocs_slice.items(.abi_size)[@intFromEnum(FrameIndex.call_frame)]; | |
| 176370 | &frame_allocs_slice.items(.abi_size)[@backingInt(FrameIndex.call_frame)]; | |
| 176371 | 176371 | stack_frame_size.* = @max(stack_frame_size.*, needed_call_frame.abi_size); |
| 176372 | 176372 | const stack_frame_align = |
| 176373 | &frame_allocs_slice.items(.abi_align)[@intFromEnum(FrameIndex.call_frame)]; | |
| 176373 | &frame_allocs_slice.items(.abi_align)[@backingInt(FrameIndex.call_frame)]; | |
| 176374 | 176374 | stack_frame_align.* = stack_frame_align.max(needed_call_frame.abi_align); |
| 176375 | 176375 | } |
| 176376 | 176376 | |
| ... | ... | @@ -176762,7 +176762,7 @@ fn genCall(cg: *CodeGen, info: union(enum) { |
| 176762 | 176762 | } |
| 176763 | 176763 | |
| 176764 | 176764 | fn airRet(cg: *CodeGen, inst: Air.Inst.Index, safety: bool) !void { |
| 176765 | const un_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].un_op; | |
| 176765 | const un_op = cg.air.instructions.items(.data)[@backingInt(inst)].un_op; | |
| 176766 | 176766 | |
| 176767 | 176767 | const ret_ty = cg.fn_type.fnReturnType(cg.pt.zcu); |
| 176768 | 176768 | switch (cg.ret_mcv.short) { |
| ... | ... | @@ -176828,7 +176828,7 @@ fn airRet(cg: *CodeGen, inst: Air.Inst.Index, safety: bool) !void { |
| 176828 | 176828 | } |
| 176829 | 176829 | |
| 176830 | 176830 | fn airRetLoad(cg: *CodeGen, inst: Air.Inst.Index) !void { |
| 176831 | const un_op = cg.air.instructions.items(.data)[@intFromEnum(inst)].un_op; | |
| 176831 | const un_op = cg.air.instructions.items(.data)[@backingInt(inst)].un_op; | |
| 176832 | 176832 | switch (cg.ret_mcv.short) { |
| 176833 | 176833 | .none => {}, |
| 176834 | 176834 | .register, |
| ... | ... | @@ -177341,7 +177341,7 @@ fn lowerSwitchBr( |
| 177341 | 177341 | const cc = cc_temp.tracking(cg).short.eflags; |
| 177342 | 177342 | try cc_temp.die(cg); |
| 177343 | 177343 | try cond_temp.die(cg); |
| 177344 | try cg.resetTemps(@enumFromInt(0)); | |
| 177344 | try cg.resetTemps(@fromBackingInt(@intCast(0))); | |
| 177345 | 177345 | break :cc cc; |
| 177346 | 177346 | }, |
| 177347 | 177347 | }; |
| ... | ... | @@ -177394,7 +177394,7 @@ fn lowerSwitchBr( |
| 177394 | 177394 | }, |
| 177395 | 177395 | }; |
| 177396 | 177396 | try cond_temp.die(cg); |
| 177397 | try cg.resetTemps(@enumFromInt(0)); | |
| 177397 | try cg.resetTemps(@fromBackingInt(@intCast(0))); | |
| 177398 | 177398 | // "Success" case is in `reloc`.... |
| 177399 | 177399 | if (lte_max) |cc| { |
| 177400 | 177400 | reloc.* = try cg.asmJccReloc(cc, undefined); |
| ... | ... | @@ -177498,7 +177498,7 @@ fn airLoopSwitchBr(self: *CodeGen, inst: Air.Inst.Index) !void { |
| 177498 | 177498 | } |
| 177499 | 177499 | |
| 177500 | 177500 | fn airSwitchDispatch(self: *CodeGen, inst: Air.Inst.Index) !void { |
| 177501 | const br = self.air.instructions.items(.data)[@intFromEnum(inst)].br; | |
| 177501 | const br = self.air.instructions.items(.data)[@backingInt(inst)].br; | |
| 177502 | 177502 | |
| 177503 | 177503 | const block_ty = self.typeOfIndex(br.block_inst); |
| 177504 | 177504 | const loop_data = self.loops.getPtr(br.block_inst).?; |
| ... | ... | @@ -177630,7 +177630,7 @@ fn performReloc(self: *CodeGen, reloc: Mir.Inst.Index) void { |
| 177630 | 177630 | |
| 177631 | 177631 | fn airBr(self: *CodeGen, inst: Air.Inst.Index) !void { |
| 177632 | 177632 | const zcu = self.pt.zcu; |
| 177633 | const br = self.air.instructions.items(.data)[@intFromEnum(inst)].br; | |
| 177633 | const br = self.air.instructions.items(.data)[@backingInt(inst)].br; | |
| 177634 | 177634 | |
| 177635 | 177635 | const block_ty = self.typeOfIndex(br.block_inst); |
| 177636 | 177636 | const block_unused = !block_ty.hasRuntimeBits(zcu) or self.liveness.isUnused(br.block_inst); |
| ... | ... | @@ -178498,7 +178498,7 @@ const MoveStrategy = union(enum) { |
| 178498 | 178498 | .load_store_x87 => if (dst_reg != .st0 and cg.register_manager.isKnownRegFree(.st7)) { |
| 178499 | 178499 | try cg.asmMemory(.{ .f_, .ld }, src_mem); |
| 178500 | 178500 | switch (dst_reg) { |
| 178501 | .st1, .st2, .st3, .st4, .st5, .st6 => try cg.asmRegister(.{ .f_p, .st }, @enumFromInt(@intFromEnum(dst_reg) + 1)), | |
| 178501 | .st1, .st2, .st3, .st4, .st5, .st6 => try cg.asmRegister(.{ .f_p, .st }, @fromBackingInt(@intCast(@backingInt(dst_reg) + 1))), | |
| 178502 | 178502 | .st7 => try cg.asmOpOnly(.{ .f_cstp, .in }), |
| 178503 | 178503 | else => unreachable, |
| 178504 | 178504 | } |
| ... | ... | @@ -179239,11 +179239,11 @@ fn genSetReg( |
| 179239 | 179239 | .st1, .st2, .st3, .st4, .st5, .st6 => switch (dst_reg) { |
| 179240 | 179240 | .st0 => { |
| 179241 | 179241 | try cg.asmRegister(.{ .f_p, .st }, .st0); |
| 179242 | try cg.asmRegister(.{ .f_, .ld }, @enumFromInt(@intFromEnum(src_reg) - 1)); | |
| 179242 | try cg.asmRegister(.{ .f_, .ld }, @fromBackingInt(@intCast(@backingInt(src_reg) - 1))); | |
| 179243 | 179243 | }, |
| 179244 | 179244 | .st2, .st3, .st4, .st5, .st6 => if (cg.register_manager.isKnownRegFree(.st7)) { |
| 179245 | 179245 | try cg.asmRegister(.{ .f_, .ld }, src_reg); |
| 179246 | try cg.asmRegister(.{ .f_p, .st }, @enumFromInt(@intFromEnum(dst_reg) + 1)); | |
| 179246 | try cg.asmRegister(.{ .f_p, .st }, @fromBackingInt(@intCast(@backingInt(dst_reg) + 1))); | |
| 179247 | 179247 | } else { |
| 179248 | 179248 | try cg.asmRegister(.{ .f_, .xch }, src_reg); |
| 179249 | 179249 | try cg.asmRegister(.{ .f_, .xch }, dst_reg); |
| ... | ... | @@ -179802,8 +179802,8 @@ fn genSetMem( |
| 179802 | 179802 | const mem_size = switch (base) { |
| 179803 | 179803 | .frame => |base_fi| mem_size: { |
| 179804 | 179804 | assert(disp >= 0); |
| 179805 | const frame_abi_size = cg.frame_allocs.items(.abi_size)[@intFromEnum(base_fi)]; | |
| 179806 | const frame_spill_pad = cg.frame_allocs.items(.spill_pad)[@intFromEnum(base_fi)]; | |
| 179805 | const frame_abi_size = cg.frame_allocs.items(.abi_size)[@backingInt(base_fi)]; | |
| 179806 | const frame_spill_pad = cg.frame_allocs.items(.spill_pad)[@backingInt(base_fi)]; | |
| 179807 | 179807 | assert(frame_abi_size - frame_spill_pad - disp >= abi_size); |
| 179808 | 179808 | break :mem_size if (frame_abi_size - frame_spill_pad - disp == abi_size) frame_abi_size else abi_size; |
| 179809 | 179809 | }, |
| ... | ... | @@ -180097,7 +180097,7 @@ fn genInlineMemset( |
| 180097 | 180097 | fn airBitCast(self: *CodeGen, inst: Air.Inst.Index) !void { |
| 180098 | 180098 | const pt = self.pt; |
| 180099 | 180099 | const zcu = pt.zcu; |
| 180100 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 180100 | const ty_op = self.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 180101 | 180101 | const dst_ty = self.typeOfIndex(inst); |
| 180102 | 180102 | const src_ty = self.typeOf(ty_op.operand); |
| 180103 | 180103 | |
| ... | ... | @@ -180218,7 +180218,7 @@ fn airBitCast(self: *CodeGen, inst: Air.Inst.Index) !void { |
| 180218 | 180218 | fn airCmpxchg(self: *CodeGen, inst: Air.Inst.Index) !void { |
| 180219 | 180219 | const pt = self.pt; |
| 180220 | 180220 | const zcu = pt.zcu; |
| 180221 | const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | |
| 180221 | const ty_pl = self.air.instructions.items(.data)[@backingInt(inst)].ty_pl; | |
| 180222 | 180222 | const extra = self.air.extraData(Air.Cmpxchg, ty_pl.payload).data; |
| 180223 | 180223 | |
| 180224 | 180224 | const dst_ty = self.typeOfIndex(inst); |
| ... | ... | @@ -180673,7 +180673,7 @@ fn atomicOp( |
| 180673 | 180673 | } |
| 180674 | 180674 | |
| 180675 | 180675 | fn airAtomicRmw(self: *CodeGen, inst: Air.Inst.Index) !void { |
| 180676 | const pl_op = self.air.instructions.items(.data)[@intFromEnum(inst)].pl_op; | |
| 180676 | const pl_op = self.air.instructions.items(.data)[@backingInt(inst)].pl_op; | |
| 180677 | 180677 | const extra = self.air.extraData(Air.AtomicRmw, pl_op.payload).data; |
| 180678 | 180678 | |
| 180679 | 180679 | try self.spillRegisters(&.{ .rax, .rdx, .rbx, .rcx }); |
| ... | ... | @@ -180694,7 +180694,7 @@ fn airAtomicRmw(self: *CodeGen, inst: Air.Inst.Index) !void { |
| 180694 | 180694 | } |
| 180695 | 180695 | |
| 180696 | 180696 | fn airAtomicLoad(self: *CodeGen, inst: Air.Inst.Index) !void { |
| 180697 | const atomic_load = self.air.instructions.items(.data)[@intFromEnum(inst)].atomic_load; | |
| 180697 | const atomic_load = self.air.instructions.items(.data)[@backingInt(inst)].atomic_load; | |
| 180698 | 180698 | const result: MCValue = result: { |
| 180699 | 180699 | const ptr_ty = self.typeOf(atomic_load.ptr); |
| 180700 | 180700 | const ptr_mcv = try self.resolveInst(atomic_load.ptr); |
| ... | ... | @@ -180721,7 +180721,7 @@ fn airAtomicLoad(self: *CodeGen, inst: Air.Inst.Index) !void { |
| 180721 | 180721 | } |
| 180722 | 180722 | |
| 180723 | 180723 | fn airAtomicStore(self: *CodeGen, inst: Air.Inst.Index, order: std.lang.AtomicOrder) !void { |
| 180724 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 180724 | const bin_op = self.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 180725 | 180725 | |
| 180726 | 180726 | const ptr_ty = self.typeOf(bin_op.lhs); |
| 180727 | 180727 | const ptr_mcv = try self.resolveInst(bin_op.lhs); |
| ... | ... | @@ -180736,7 +180736,7 @@ fn airAtomicStore(self: *CodeGen, inst: Air.Inst.Index, order: std.lang.AtomicOr |
| 180736 | 180736 | fn airMemset(self: *CodeGen, inst: Air.Inst.Index, safety: bool) !void { |
| 180737 | 180737 | const pt = self.pt; |
| 180738 | 180738 | const zcu = pt.zcu; |
| 180739 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | |
| 180739 | const bin_op = self.air.instructions.items(.data)[@backingInt(inst)].bin_op; | |
| 180740 | 180740 | |
| 180741 | 180741 | result: { |
| 180742 | 180742 | if (!safety and (try self.resolveInst(bin_op.rhs)) == .undef) break :result; |
| ... | ... | @@ -180879,7 +180879,7 @@ fn airSelect(self: *CodeGen, inst: Air.Inst.Index) !void { |
| 180879 | 180879 | const pt = self.pt; |
| 180880 | 180880 | const zcu = pt.zcu; |
| 180881 | 180881 | const io = zcu.comp.io; |
| 180882 | const pl_op = self.air.instructions.items(.data)[@intFromEnum(inst)].pl_op; | |
| 180882 | const pl_op = self.air.instructions.items(.data)[@backingInt(inst)].pl_op; | |
| 180883 | 180883 | const extra = self.air.extraData(Air.Bin, pl_op.payload).data; |
| 180884 | 180884 | const ty = self.typeOfIndex(inst); |
| 180885 | 180885 | const vec_len = ty.vectorLen(zcu); |
| ... | ... | @@ -181351,7 +181351,7 @@ fn airAggregateInitBoolVec(self: *CodeGen, inst: Air.Inst.Index) !void { |
| 181351 | 181351 | const zcu = pt.zcu; |
| 181352 | 181352 | const result_ty = self.typeOfIndex(inst); |
| 181353 | 181353 | const len: usize = @intCast(result_ty.arrayLen(zcu)); |
| 181354 | const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | |
| 181354 | const ty_pl = self.air.instructions.items(.data)[@backingInt(inst)].ty_pl; | |
| 181355 | 181355 | const elements: []const Air.Inst.Ref = @ptrCast(self.air.extra.items[ty_pl.payload..][0..len]); |
| 181356 | 181356 | |
| 181357 | 181357 | assert(result_ty.zigTypeTag(zcu) == .vector); |
| ... | ... | @@ -181411,7 +181411,7 @@ fn airAggregateInitBoolVec(self: *CodeGen, inst: Air.Inst.Index) !void { |
| 181411 | 181411 | fn airVaStart(self: *CodeGen, inst: Air.Inst.Index) !void { |
| 181412 | 181412 | const pt = self.pt; |
| 181413 | 181413 | const zcu = pt.zcu; |
| 181414 | const va_list_ty = self.air.instructions.items(.data)[@intFromEnum(inst)].ty; | |
| 181414 | const va_list_ty = self.air.instructions.items(.data)[@backingInt(inst)].ty; | |
| 181415 | 181415 | const ptr_anyopaque_ty = try pt.singleMutPtrType(.anyopaque); |
| 181416 | 181416 | |
| 181417 | 181417 | const result: MCValue = switch (self.fn_type.fnCallingConvention(zcu)) { |
| ... | ... | @@ -181477,7 +181477,7 @@ fn airVaStart(self: *CodeGen, inst: Air.Inst.Index) !void { |
| 181477 | 181477 | fn airVaArg(self: *CodeGen, inst: Air.Inst.Index) !void { |
| 181478 | 181478 | const pt = self.pt; |
| 181479 | 181479 | const zcu = pt.zcu; |
| 181480 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 181480 | const ty_op = self.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 181481 | 181481 | const ty = self.typeOfIndex(inst); |
| 181482 | 181482 | const promote_ty = self.promoteVarArg(ty); |
| 181483 | 181483 | const ptr_anyopaque_ty = try pt.singleMutPtrType(.anyopaque); |
| ... | ... | @@ -181705,7 +181705,7 @@ fn convertFloatVarArg( |
| 181705 | 181705 | } |
| 181706 | 181706 | |
| 181707 | 181707 | fn airVaCopy(self: *CodeGen, inst: Air.Inst.Index) !void { |
| 181708 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | |
| 181708 | const ty_op = self.air.instructions.items(.data)[@backingInt(inst)].ty_op; | |
| 181709 | 181709 | const ptr_va_list_ty = self.typeOf(ty_op.operand); |
| 181710 | 181710 | |
| 181711 | 181711 | const dst_mcv = try self.allocRegOrMem(inst, true); |
| ... | ... | @@ -181714,7 +181714,7 @@ fn airVaCopy(self: *CodeGen, inst: Air.Inst.Index) !void { |
| 181714 | 181714 | } |
| 181715 | 181715 | |
| 181716 | 181716 | fn airVaEnd(self: *CodeGen, inst: Air.Inst.Index) !void { |
| 181717 | const un_op = self.air.instructions.items(.data)[@intFromEnum(inst)].un_op; | |
| 181717 | const un_op = self.air.instructions.items(.data)[@backingInt(inst)].un_op; | |
| 181718 | 181718 | return self.finishAir(inst, .unreach, .{ un_op, .none, .none }); |
| 181719 | 181719 | } |
| 181720 | 181720 | |
| ... | ... | @@ -182302,9 +182302,9 @@ fn fail(cg: *CodeGen, comptime format: []const u8, args: anytype) error{ OutOfMe |
| 182302 | 182302 | } |
| 182303 | 182303 | |
| 182304 | 182304 | fn parseRegName(name: []const u8) ?Register { |
| 182305 | if (std.mem.startsWith(u8, name, "db")) return @enumFromInt( | |
| 182306 | @intFromEnum(Register.dr0) + (std.fmt.parseInt(u4, name["db".len..], 0) catch return null), | |
| 182307 | ); | |
| 182305 | if (std.mem.startsWith(u8, name, "db")) return @fromBackingInt(@intCast( | |
| 182306 | @backingInt(Register.dr0) + (std.fmt.parseInt(u4, name["db".len..], 0) catch return null), | |
| 182307 | )); | |
| 182308 | 182308 | return std.meta.stringToEnum(Register, name); |
| 182309 | 182309 | } |
| 182310 | 182310 | |
| ... | ... | @@ -182685,7 +182685,7 @@ const Temp = struct { |
| 182685 | 182685 | .ref => |ref| return .{ .ref = ref }, |
| 182686 | 182686 | .target => |target_index| { |
| 182687 | 182687 | if (temp.index == err_ret_trace_index) return .err_ret_trace; |
| 182688 | const temp_index: Index = @enumFromInt(target_index); | |
| 182688 | const temp_index: Index = @fromBackingInt(@intCast(target_index)); | |
| 182689 | 182689 | assert(temp_index.isValid(cg)); |
| 182690 | 182690 | return .{ .temp = temp_index }; |
| 182691 | 182691 | }, |
| ... | ... | @@ -182694,7 +182694,7 @@ const Temp = struct { |
| 182694 | 182694 | |
| 182695 | 182695 | fn typeOf(temp: Temp, cg: *CodeGen) Type { |
| 182696 | 182696 | return switch (temp.unwrap(cg)) { |
| 182697 | .ref => switch (cg.air.instructions.items(.tag)[@intFromEnum(temp.index)]) { | |
| 182697 | .ref => switch (cg.air.instructions.items(.tag)[@backingInt(temp.index)]) { | |
| 182698 | 182698 | .loop_switch_br => cg.typeOf(cg.air.unwrapSwitch(temp.index).operand), |
| 182699 | 182699 | else => cg.air.typeOfIndex(temp.index, &cg.pt.zcu.intern_pool), |
| 182700 | 182700 | }, |
| ... | ... | @@ -182754,8 +182754,8 @@ const Temp = struct { |
| 182754 | 182754 | |
| 182755 | 182755 | fn getOffset(temp: Temp, off: i32, cg: *CodeGen) InnerError!Temp { |
| 182756 | 182756 | const new_temp_index = cg.next_temp_index; |
| 182757 | cg.temp_type[@intFromEnum(new_temp_index)] = .usize; | |
| 182758 | cg.next_temp_index = @enumFromInt(@intFromEnum(new_temp_index) + 1); | |
| 182757 | cg.temp_type[@backingInt(new_temp_index)] = .usize; | |
| 182758 | cg.next_temp_index = @fromBackingInt(@intCast(@backingInt(new_temp_index) + 1)); | |
| 182759 | 182759 | const mcv = temp.tracking(cg).short; |
| 182760 | 182760 | switch (mcv) { |
| 182761 | 182761 | else => std.debug.panic("{s}: {f}\n", .{ @src().fn_name, mcv }), |
| ... | ... | @@ -182830,7 +182830,7 @@ const Temp = struct { |
| 182830 | 182830 | |
| 182831 | 182831 | fn getLimb(temp: Temp, limb_ty: Type, limb_index: u28, cg: *CodeGen) InnerError!Temp { |
| 182832 | 182832 | const new_temp_index = cg.next_temp_index; |
| 182833 | cg.temp_type[@intFromEnum(new_temp_index)] = limb_ty; | |
| 182833 | cg.temp_type[@backingInt(new_temp_index)] = limb_ty; | |
| 182834 | 182834 | switch (temp.tracking(cg).short) { |
| 182835 | 182835 | else => |mcv| std.debug.panic("{s}: {f}\n", .{ @src().fn_name, mcv }), |
| 182836 | 182836 | .immediate => |imm| { |
| ... | ... | @@ -182941,7 +182941,7 @@ const Temp = struct { |
| 182941 | 182941 | new_temp_index.tracking(cg).* = .init(.{ .lea_extern_func = extern_func }); |
| 182942 | 182942 | }, |
| 182943 | 182943 | } |
| 182944 | cg.next_temp_index = @enumFromInt(@intFromEnum(new_temp_index) + 1); | |
| 182944 | cg.next_temp_index = @fromBackingInt(@intCast(@backingInt(new_temp_index) + 1)); | |
| 182945 | 182945 | return .{ .index = new_temp_index.toIndex() }; |
| 182946 | 182946 | } |
| 182947 | 182947 | |
| ... | ... | @@ -182997,7 +182997,7 @@ const Temp = struct { |
| 182997 | 182997 | else => {}, |
| 182998 | 182998 | .register, .lea_frame, .lea_nav, .lea_uav, .lea_lazy_sym => { |
| 182999 | 182999 | assert(limb_index == 0); |
| 183000 | cg.temp_type[@intFromEnum(temp_index)] = limb_ty; | |
| 183000 | cg.temp_type[@backingInt(temp_index)] = limb_ty; | |
| 183001 | 183001 | return; |
| 183002 | 183002 | }, |
| 183003 | 183003 | .register_pair => |regs| { |
| ... | ... | @@ -183009,7 +183009,7 @@ const Temp = struct { |
| 183009 | 183009 | for (regs, 0..) |reg, reg_index| if (reg_index != limb_index) |
| 183010 | 183010 | cg.register_manager.freeReg(reg); |
| 183011 | 183011 | temp_tracking.* = .init(.{ .register = regs[limb_index] }); |
| 183012 | cg.temp_type[@intFromEnum(temp_index)] = limb_ty; | |
| 183012 | cg.temp_type[@backingInt(temp_index)] = limb_ty; | |
| 183013 | 183013 | return; |
| 183014 | 183014 | }, |
| 183015 | 183015 | .load_frame => |frame_addr| if (!frame_addr.index.isNamed()) { |
| ... | ... | @@ -183018,7 +183018,7 @@ const Temp = struct { |
| 183018 | 183018 | .index = frame_addr.index, |
| 183019 | 183019 | .off = frame_addr.off + @as(u31, limb_index) * 8, |
| 183020 | 183020 | } }); |
| 183021 | cg.temp_type[@intFromEnum(temp_index)] = limb_ty; | |
| 183021 | cg.temp_type[@backingInt(temp_index)] = limb_ty; | |
| 183022 | 183022 | return; |
| 183023 | 183023 | }, |
| 183024 | 183024 | } |
| ... | ... | @@ -183051,9 +183051,9 @@ const Temp = struct { |
| 183051 | 183051 | .err_ret_trace => .usize, |
| 183052 | 183052 | }; |
| 183053 | 183053 | const new_temp_index = cg.next_temp_index; |
| 183054 | cg.next_temp_index = @enumFromInt(@intFromEnum(new_temp_index) + 1); | |
| 183054 | cg.next_temp_index = @fromBackingInt(@intCast(@backingInt(new_temp_index) + 1)); | |
| 183055 | 183055 | try cg.register_manager.getReg(new_reg, new_temp_index.toIndex()); |
| 183056 | cg.temp_type[@intFromEnum(new_temp_index)] = ty; | |
| 183056 | cg.temp_type[@backingInt(new_temp_index)] = ty; | |
| 183057 | 183057 | new_temp_index.tracking(cg).* = .init(.{ .register = new_reg }); |
| 183058 | 183058 | while (try temp.toBase(false, cg)) {} |
| 183059 | 183059 | try temp.readTo(ty, .{ .register = new_reg }, .{}, cg); |
| ... | ... | @@ -183074,9 +183074,9 @@ const Temp = struct { |
| 183074 | 183074 | .err_ret_trace => .usize, |
| 183075 | 183075 | }; |
| 183076 | 183076 | const new_temp_index = cg.next_temp_index; |
| 183077 | cg.next_temp_index = @enumFromInt(@intFromEnum(new_temp_index) + 1); | |
| 183077 | cg.next_temp_index = @fromBackingInt(@intCast(@backingInt(new_temp_index) + 1)); | |
| 183078 | 183078 | for (new_regs) |new_reg| try cg.register_manager.getReg(new_reg, new_temp_index.toIndex()); |
| 183079 | cg.temp_type[@intFromEnum(new_temp_index)] = ty; | |
| 183079 | cg.temp_type[@backingInt(new_temp_index)] = ty; | |
| 183080 | 183080 | new_temp_index.tracking(cg).* = .init(.{ .register_pair = new_regs }); |
| 183081 | 183081 | while (try temp.toBase(false, cg)) {} |
| 183082 | 183082 | for (new_regs, 0..) |new_reg, reg_index| try temp.readTo( |
| ... | ... | @@ -183099,12 +183099,12 @@ const Temp = struct { |
| 183099 | 183099 | }; |
| 183100 | 183100 | const ty = temp.typeOf(cg); |
| 183101 | 183101 | const new_temp_index = cg.next_temp_index; |
| 183102 | cg.temp_type[@intFromEnum(new_temp_index)] = ty; | |
| 183102 | cg.temp_type[@backingInt(new_temp_index)] = ty; | |
| 183103 | 183103 | const new_reg = try cg.register_manager.allocReg(new_temp_index.toIndex(), regSetForRegClass(rc)); |
| 183104 | 183104 | try cg.genSetReg(new_reg, ty, val, .{}); |
| 183105 | 183105 | new_temp_index.tracking(cg).* = .init(.{ .register = new_reg }); |
| 183106 | 183106 | try temp.die(cg); |
| 183107 | cg.next_temp_index = @enumFromInt(@intFromEnum(new_temp_index) + 1); | |
| 183107 | cg.next_temp_index = @fromBackingInt(@intCast(@backingInt(new_temp_index) + 1)); | |
| 183108 | 183108 | temp.* = .{ .index = new_temp_index.toIndex() }; |
| 183109 | 183109 | return true; |
| 183110 | 183110 | } |
| ... | ... | @@ -183124,8 +183124,8 @@ const Temp = struct { |
| 183124 | 183124 | assert(cg.reuseTemp(result_temp.index, first_temp.index, first_temp_tracking)); |
| 183125 | 183125 | assert(cg.reuseTemp(result_temp.index, second_temp.index, second_temp_tracking)); |
| 183126 | 183126 | result_temp_index.tracking(cg).* = .init(result); |
| 183127 | cg.temp_type[@intFromEnum(result_temp_index)] = .slice_const_u8; | |
| 183128 | cg.next_temp_index = @enumFromInt(@intFromEnum(result_temp_index) + 1); | |
| 183127 | cg.temp_type[@backingInt(result_temp_index)] = .slice_const_u8; | |
| 183128 | cg.next_temp_index = @fromBackingInt(@intCast(@backingInt(result_temp_index) + 1)); | |
| 183129 | 183129 | first_temp.* = result_temp; |
| 183130 | 183130 | second_temp.* = result_temp; |
| 183131 | 183131 | } |
| ... | ... | @@ -183142,8 +183142,8 @@ const Temp = struct { |
| 183142 | 183142 | assert(cg.reuseTemp(result_temp.index, temp.index, temp_tracking)); |
| 183143 | 183143 | assert(cg.reuseTemp(result_temp.index, overflow_temp.index, overflow_temp_tracking)); |
| 183144 | 183144 | result_temp_index.tracking(cg).* = .init(.{ .register_overflow = .{ .reg = reg, .eflags = overflow_cc } }); |
| 183145 | cg.temp_type[@intFromEnum(result_temp_index)] = .slice_const_u8; | |
| 183146 | cg.next_temp_index = @enumFromInt(@intFromEnum(result_temp_index) + 1); | |
| 183145 | cg.temp_type[@backingInt(result_temp_index)] = .slice_const_u8; | |
| 183146 | cg.next_temp_index = @fromBackingInt(@intCast(@backingInt(result_temp_index) + 1)); | |
| 183147 | 183147 | temp.* = result_temp; |
| 183148 | 183148 | overflow_temp.* = result_temp; |
| 183149 | 183149 | return; |
| ... | ... | @@ -183154,8 +183154,8 @@ const Temp = struct { |
| 183154 | 183154 | assert(cg.reuseTemp(result_temp.index, temp.index, temp_tracking)); |
| 183155 | 183155 | assert(cg.reuseTemp(result_temp.index, overflow_temp.index, overflow_temp_tracking)); |
| 183156 | 183156 | result_temp_index.tracking(cg).* = .init(.{ .register_pair = .{ reg, overflow_reg } }); |
| 183157 | cg.temp_type[@intFromEnum(result_temp_index)] = .slice_const_u8; | |
| 183158 | cg.next_temp_index = @enumFromInt(@intFromEnum(result_temp_index) + 1); | |
| 183157 | cg.temp_type[@backingInt(result_temp_index)] = .slice_const_u8; | |
| 183158 | cg.next_temp_index = @fromBackingInt(@intCast(@backingInt(result_temp_index) + 1)); | |
| 183159 | 183159 | temp.* = result_temp; |
| 183160 | 183160 | overflow_temp.* = result_temp; |
| 183161 | 183161 | return; |
| ... | ... | @@ -183231,12 +183231,12 @@ const Temp = struct { |
| 183231 | 183231 | if ((!mut or temp.isMut(cg)) and temp_tracking.short.isMemory()) return false; |
| 183232 | 183232 | const new_temp_index = cg.next_temp_index; |
| 183233 | 183233 | const ty = temp.typeOf(cg); |
| 183234 | cg.temp_type[@intFromEnum(new_temp_index)] = ty; | |
| 183234 | cg.temp_type[@backingInt(new_temp_index)] = ty; | |
| 183235 | 183235 | const new_frame_index = try cg.allocFrameIndex(.initSpill(ty, cg.pt.zcu)); |
| 183236 | 183236 | try cg.genSetMem(.{ .frame = new_frame_index }, 0, ty, temp_tracking.short, .{}); |
| 183237 | 183237 | new_temp_index.tracking(cg).* = .init(.{ .load_frame = .{ .index = new_frame_index } }); |
| 183238 | 183238 | try temp.die(cg); |
| 183239 | cg.next_temp_index = @enumFromInt(@intFromEnum(new_temp_index) + 1); | |
| 183239 | cg.next_temp_index = @fromBackingInt(@intCast(@backingInt(new_temp_index) + 1)); | |
| 183240 | 183240 | temp.* = .{ .index = new_temp_index.toIndex() }; |
| 183241 | 183241 | return true; |
| 183242 | 183242 | } |
| ... | ... | @@ -183247,13 +183247,13 @@ const Temp = struct { |
| 183247 | 183247 | if ((!mut or temp.isMut(cg)) and temp_tracking.short.isBase()) return false; |
| 183248 | 183248 | if (try temp.toMemory(mut, cg)) return true; |
| 183249 | 183249 | const new_temp_index = cg.next_temp_index; |
| 183250 | cg.temp_type[@intFromEnum(new_temp_index)] = temp.typeOf(cg); | |
| 183250 | cg.temp_type[@backingInt(new_temp_index)] = temp.typeOf(cg); | |
| 183251 | 183251 | const new_reg = |
| 183252 | 183252 | try cg.register_manager.allocReg(new_temp_index.toIndex(), abi.RegisterClass.gp); |
| 183253 | 183253 | try cg.genSetReg(new_reg, .usize, temp_tracking.short.address(), .{}); |
| 183254 | 183254 | new_temp_index.tracking(cg).* = .init(.{ .indirect = .{ .reg = new_reg } }); |
| 183255 | 183255 | try temp.die(cg); |
| 183256 | cg.next_temp_index = @enumFromInt(@intFromEnum(new_temp_index) + 1); | |
| 183256 | cg.next_temp_index = @fromBackingInt(@intCast(@backingInt(new_temp_index) + 1)); | |
| 183257 | 183257 | temp.* = .{ .index = new_temp_index.toIndex() }; |
| 183258 | 183258 | return true; |
| 183259 | 183259 | } |
| ... | ... | @@ -189703,25 +189703,25 @@ const Temp = struct { |
| 189703 | 189703 | _, |
| 189704 | 189704 | |
| 189705 | 189705 | fn toIndex(index: Index) Air.Inst.Index { |
| 189706 | return .fromTargetIndex(@intFromEnum(index)); | |
| 189706 | return .fromTargetIndex(@backingInt(index)); | |
| 189707 | 189707 | } |
| 189708 | 189708 | |
| 189709 | 189709 | fn fromIndex(index: Air.Inst.Index) Index { |
| 189710 | return @enumFromInt(index.toTargetIndex()); | |
| 189710 | return @fromBackingInt(@intCast(index.toTargetIndex())); | |
| 189711 | 189711 | } |
| 189712 | 189712 | |
| 189713 | 189713 | fn tracking(index: Index, cg: *CodeGen) *InstTracking { |
| 189714 | return &cg.inst_tracking.values()[@intFromEnum(index)]; | |
| 189714 | return &cg.inst_tracking.values()[@backingInt(index)]; | |
| 189715 | 189715 | } |
| 189716 | 189716 | |
| 189717 | 189717 | fn isValid(index: Index, cg: *CodeGen) bool { |
| 189718 | return @intFromEnum(index) < @intFromEnum(cg.next_temp_index) and | |
| 189718 | return @backingInt(index) < @backingInt(cg.next_temp_index) and | |
| 189719 | 189719 | index.tracking(cg).short != .dead; |
| 189720 | 189720 | } |
| 189721 | 189721 | |
| 189722 | 189722 | fn typeOf(index: Index, cg: *CodeGen) Type { |
| 189723 | 189723 | assert(index.isValid(cg)); |
| 189724 | return cg.temp_type[@intFromEnum(index)]; | |
| 189724 | return cg.temp_type[@backingInt(index)]; | |
| 189725 | 189725 | } |
| 189726 | 189726 | |
| 189727 | 189727 | const max = std.math.maxInt(@typeInfo(Index).@"enum".tag_type); |
| ... | ... | @@ -189747,8 +189747,8 @@ const Temp = struct { |
| 189747 | 189747 | |
| 189748 | 189748 | fn resetTemps(cg: *CodeGen, from_index: Temp.Index) InnerError!void { |
| 189749 | 189749 | var any_valid = false; |
| 189750 | for (@intFromEnum(from_index)..@intFromEnum(cg.next_temp_index)) |temp_index| { | |
| 189751 | const temp: Temp.Index = @enumFromInt(temp_index); | |
| 189750 | for (@backingInt(from_index)..@backingInt(cg.next_temp_index)) |temp_index| { | |
| 189751 | const temp: Temp.Index = @fromBackingInt(@intCast(temp_index)); | |
| 189752 | 189752 | if (temp.isValid(cg)) { |
| 189753 | 189753 | any_valid = true; |
| 189754 | 189754 | tracking_log.err("failed to kill {f}: {f}", .{ |
| ... | ... | @@ -189796,8 +189796,8 @@ fn tempAlloc(cg: *CodeGen, ty: Type) InnerError!Temp { |
| 189796 | 189796 | temp_index.tracking(cg).* = .init( |
| 189797 | 189797 | try cg.allocRegOrMemAdvanced(ty, temp_index.toIndex(), true), |
| 189798 | 189798 | ); |
| 189799 | cg.temp_type[@intFromEnum(temp_index)] = ty; | |
| 189800 | cg.next_temp_index = @enumFromInt(@intFromEnum(temp_index) + 1); | |
| 189799 | cg.temp_type[@backingInt(temp_index)] = ty; | |
| 189800 | cg.next_temp_index = @fromBackingInt(@intCast(@backingInt(temp_index) + 1)); | |
| 189801 | 189801 | return .{ .index = temp_index.toIndex() }; |
| 189802 | 189802 | } |
| 189803 | 189803 | |
| ... | ... | @@ -189806,8 +189806,8 @@ fn tempAllocReg(cg: *CodeGen, ty: Type, rs: RegisterManager.RegisterBitSet) Inne |
| 189806 | 189806 | temp_index.tracking(cg).* = .init( |
| 189807 | 189807 | .{ .register = try cg.register_manager.allocReg(temp_index.toIndex(), rs) }, |
| 189808 | 189808 | ); |
| 189809 | cg.temp_type[@intFromEnum(temp_index)] = ty; | |
| 189810 | cg.next_temp_index = @enumFromInt(@intFromEnum(temp_index) + 1); | |
| 189809 | cg.temp_type[@backingInt(temp_index)] = ty; | |
| 189810 | cg.next_temp_index = @fromBackingInt(@intCast(@backingInt(temp_index) + 1)); | |
| 189811 | 189811 | return .{ .index = temp_index.toIndex() }; |
| 189812 | 189812 | } |
| 189813 | 189813 | |
| ... | ... | @@ -189816,8 +189816,8 @@ fn tempAllocRegPair(cg: *CodeGen, ty: Type, rs: RegisterManager.RegisterBitSet) |
| 189816 | 189816 | temp_index.tracking(cg).* = .init( |
| 189817 | 189817 | .{ .register_pair = try cg.register_manager.allocRegs(2, @splat(temp_index.toIndex()), rs) }, |
| 189818 | 189818 | ); |
| 189819 | cg.temp_type[@intFromEnum(temp_index)] = ty; | |
| 189820 | cg.next_temp_index = @enumFromInt(@intFromEnum(temp_index) + 1); | |
| 189819 | cg.temp_type[@backingInt(temp_index)] = ty; | |
| 189820 | cg.next_temp_index = @fromBackingInt(@intCast(@backingInt(temp_index) + 1)); | |
| 189821 | 189821 | return .{ .index = temp_index.toIndex() }; |
| 189822 | 189822 | } |
| 189823 | 189823 | |
| ... | ... | @@ -189826,17 +189826,17 @@ fn tempAllocMem(cg: *CodeGen, ty: Type) InnerError!Temp { |
| 189826 | 189826 | temp_index.tracking(cg).* = .init( |
| 189827 | 189827 | try cg.allocRegOrMemAdvanced(ty, temp_index.toIndex(), false), |
| 189828 | 189828 | ); |
| 189829 | cg.temp_type[@intFromEnum(temp_index)] = ty; | |
| 189830 | cg.next_temp_index = @enumFromInt(@intFromEnum(temp_index) + 1); | |
| 189829 | cg.temp_type[@backingInt(temp_index)] = ty; | |
| 189830 | cg.next_temp_index = @fromBackingInt(@intCast(@backingInt(temp_index) + 1)); | |
| 189831 | 189831 | return .{ .index = temp_index.toIndex() }; |
| 189832 | 189832 | } |
| 189833 | 189833 | |
| 189834 | 189834 | fn tempInit(cg: *CodeGen, ty: Type, value: MCValue) InnerError!Temp { |
| 189835 | 189835 | const temp_index = cg.next_temp_index; |
| 189836 | 189836 | temp_index.tracking(cg).* = .init(value); |
| 189837 | cg.temp_type[@intFromEnum(temp_index)] = ty; | |
| 189837 | cg.temp_type[@backingInt(temp_index)] = ty; | |
| 189838 | 189838 | try cg.getValue(value, temp_index.toIndex()); |
| 189839 | cg.next_temp_index = @enumFromInt(@intFromEnum(temp_index) + 1); | |
| 189839 | cg.next_temp_index = @fromBackingInt(@intCast(@backingInt(temp_index) + 1)); | |
| 189840 | 189840 | return .{ .index = temp_index.toIndex() }; |
| 189841 | 189841 | } |
| 189842 | 189842 | |
| ... | ... | @@ -189870,8 +189870,8 @@ fn tempFromOperand(cg: *CodeGen, op_ref: Air.Inst.Ref, op_dies: bool) InnerError |
| 189870 | 189870 | const tracking = cg.getResolvedInstValue(op_inst); |
| 189871 | 189871 | temp_index.tracking(cg).* = tracking.*; |
| 189872 | 189872 | if (!cg.reuseTemp(temp.index, op_inst, tracking)) return .{ .index = op_ref.toIndex().? }; |
| 189873 | cg.temp_type[@intFromEnum(temp_index)] = cg.typeOf(op_ref); | |
| 189874 | cg.next_temp_index = @enumFromInt(@intFromEnum(temp_index) + 1); | |
| 189873 | cg.temp_type[@backingInt(temp_index)] = cg.typeOf(op_ref); | |
| 189874 | cg.next_temp_index = @fromBackingInt(@intCast(@backingInt(temp_index) + 1)); | |
| 189875 | 189875 | return temp; |
| 189876 | 189876 | } |
| 189877 | 189877 | |
| ... | ... | @@ -189910,9 +189910,9 @@ const Operand = union(enum) { |
| 189910 | 189910 | |
| 189911 | 189911 | const Select = struct { |
| 189912 | 189912 | cg: *CodeGen, |
| 189913 | types: [@intFromEnum(Select.Operand.Ref.none)]Type, | |
| 189914 | temps: [@intFromEnum(Select.Operand.Ref.none)]Temp, | |
| 189915 | labels: [@intFromEnum(Label._)]struct { | |
| 189913 | types: [@backingInt(Select.Operand.Ref.none)]Type, | |
| 189914 | temps: [@backingInt(Select.Operand.Ref.none)]Temp, | |
| 189915 | labels: [@backingInt(Label._)]struct { | |
| 189916 | 189916 | backward: ?Mir.Inst.Index, |
| 189917 | 189917 | forward: [3]?Mir.Inst.Index, |
| 189918 | 189918 | }, |
| ... | ... | @@ -189921,8 +189921,8 @@ const Select = struct { |
| 189921 | 189921 | const Error = InnerError || error{SelectFailed}; |
| 189922 | 189922 | |
| 189923 | 189923 | fn emitLabel(s: *Select, label_index: Label) void { |
| 189924 | assert(@intFromEnum(label_index) < @intFromEnum(Label._)); | |
| 189925 | const label = &s.labels[@intFromEnum(label_index)]; | |
| 189924 | assert(@backingInt(label_index) < @backingInt(Label._)); | |
| 189925 | const label = &s.labels[@backingInt(label_index)]; | |
| 189926 | 189926 | for (&label.forward) |*reloc| { |
| 189927 | 189927 | if (reloc.*) |r| s.cg.performReloc(r); |
| 189928 | 189928 | reloc.* = null; |
| ... | ... | @@ -190072,19 +190072,19 @@ const Select = struct { |
| 190072 | 190072 | } |
| 190073 | 190073 | |
| 190074 | 190074 | fn lowerReg(s: *const Select, reg: Register) Register { |
| 190075 | return if (reg.isClass(.x87)) @enumFromInt(@intFromEnum(Register.st0) + (@as(u3, @intCast(reg.enc())) -% s.top)) else reg; | |
| 190075 | return if (reg.isClass(.x87)) @fromBackingInt(@intCast(@backingInt(Register.st0) + (@as(u3, @intCast(reg.enc())) -% s.top))) else reg; | |
| 190076 | 190076 | } |
| 190077 | 190077 | |
| 190078 | 190078 | const Case = struct { |
| 190079 | 190079 | required_abi: enum { any, gnu, msvc } = .any, |
| 190080 | 190080 | required_cc_abi: enum { any, sysv64, win64 } = .any, |
| 190081 | 190081 | required_features: [4]?std.Target.x86.Feature = @splat(null), |
| 190082 | src_constraints: [@intFromEnum(Select.Operand.Ref.none) - @intFromEnum(Select.Operand.Ref.src0)]Constraint = @splat(.any), | |
| 190083 | dst_constraints: [@intFromEnum(Select.Operand.Ref.src0) - @intFromEnum(Select.Operand.Ref.dst0)]Constraint = @splat(.any), | |
| 190082 | src_constraints: [@backingInt(Select.Operand.Ref.none) - @backingInt(Select.Operand.Ref.src0)]Constraint = @splat(.any), | |
| 190083 | dst_constraints: [@backingInt(Select.Operand.Ref.src0) - @backingInt(Select.Operand.Ref.dst0)]Constraint = @splat(.any), | |
| 190084 | 190084 | patterns: []const Select.Pattern, |
| 190085 | 190085 | call_frame: packed struct(u16) { size: u10 = 0, alignment: InternPool.Alignment } = .{ .size = 0, .alignment = .none }, |
| 190086 | extra_temps: [@intFromEnum(Select.Operand.Ref.dst0) - @intFromEnum(Select.Operand.Ref.tmp0)]TempSpec = @splat(.unused), | |
| 190087 | dst_temps: [@intFromEnum(Select.Operand.Ref.src0) - @intFromEnum(Select.Operand.Ref.dst0)]TempSpec.Kind = @splat(.unused), | |
| 190086 | extra_temps: [@backingInt(Select.Operand.Ref.dst0) - @backingInt(Select.Operand.Ref.tmp0)]TempSpec = @splat(.unused), | |
| 190087 | dst_temps: [@backingInt(Select.Operand.Ref.src0) - @backingInt(Select.Operand.Ref.dst0)]TempSpec.Kind = @splat(.unused), | |
| 190088 | 190088 | clobbers: packed struct { |
| 190089 | 190089 | eflags: bool = false, |
| 190090 | 190090 | caller_preserved: CallConv = .none, |
| ... | ... | @@ -190452,7 +190452,7 @@ const Select = struct { |
| 190452 | 190452 | }; |
| 190453 | 190453 | |
| 190454 | 190454 | const Pattern = struct { |
| 190455 | src: [@intFromEnum(Select.Operand.Ref.none) - @intFromEnum(Select.Operand.Ref.src0)]Src, | |
| 190455 | src: [@backingInt(Select.Operand.Ref.none) - @backingInt(Select.Operand.Ref.src0)]Src, | |
| 190456 | 190456 | commute: struct { u8, u8 } = .{ 0, 0 }, |
| 190457 | 190457 | |
| 190458 | 190458 | const Src = union(enum) { |
| ... | ... | @@ -191203,7 +191203,7 @@ const Select = struct { |
| 191203 | 191203 | else => {}, |
| 191204 | 191204 | inline .rc_mask, .mut_rc_mask, .ref_mask => |mask| temp.asMask(mask.info, cg), |
| 191205 | 191205 | } |
| 191206 | cg.temp_type[@intFromEnum(temp.unwrap(cg).temp)] = spec.type; | |
| 191206 | cg.temp_type[@backingInt(temp.unwrap(cg).temp)] = spec.type; | |
| 191207 | 191207 | } |
| 191208 | 191208 | }; |
| 191209 | 191209 | |
| ... | ... | @@ -191602,17 +191602,17 @@ const Select = struct { |
| 191602 | 191602 | }; |
| 191603 | 191603 | |
| 191604 | 191604 | fn typeOf(ref: Ref, s: *const Select) Type { |
| 191605 | return s.types[@intFromEnum(ref)]; | |
| 191605 | return s.types[@backingInt(ref)]; | |
| 191606 | 191606 | } |
| 191607 | 191607 | |
| 191608 | 191608 | fn tempOf(ref: Ref, s: *const Select) Temp { |
| 191609 | return s.temps[@intFromEnum(ref)]; | |
| 191609 | return s.temps[@backingInt(ref)]; | |
| 191610 | 191610 | } |
| 191611 | 191611 | |
| 191612 | 191612 | fn valueOf(ref: Ref, s: *const Select) MCValue { |
| 191613 | 191613 | return switch (ref) { |
| 191614 | 191614 | .none => .none, |
| 191615 | else => s.temps[@intFromEnum(ref)].tracking(s.cg).short, | |
| 191615 | else => s.temps[@backingInt(ref)].tracking(s.cg).short, | |
| 191616 | 191616 | }; |
| 191617 | 191617 | } |
| 191618 | 191618 | }; |
| ... | ... | @@ -192281,7 +192281,7 @@ const Select = struct { |
| 192281 | 192281 | Select.Operand.Ref.src1.valueOf(s).immediate), |
| 192282 | 192282 | .vector_index => switch (op.flags.base.ref.typeOf(s).ptrInfo(s.cg.pt.zcu).flags.vector_index) { |
| 192283 | 192283 | .none => unreachable, |
| 192284 | else => |vector_index| @intFromEnum(vector_index), | |
| 192284 | else => |vector_index| @backingInt(vector_index), | |
| 192285 | 192285 | }, |
| 192286 | 192286 | .src1 => @intCast(Select.Operand.Ref.src1.valueOf(s).immediate), |
| 192287 | 192287 | .src1_sub_bit_size => @as(SignedImm, @intCast(Select.Operand.Ref.src1.valueOf(s).immediate)) - |
| ... | ... | @@ -192465,14 +192465,14 @@ fn select( |
| 192465 | 192465 | if (case.call_frame.alignment != .none) { |
| 192466 | 192466 | const frame_allocs_slice = cg.frame_allocs.slice(); |
| 192467 | 192467 | const stack_frame_size = |
| 192468 | &frame_allocs_slice.items(.abi_size)[@intFromEnum(FrameIndex.call_frame)]; | |
| 192468 | &frame_allocs_slice.items(.abi_size)[@backingInt(FrameIndex.call_frame)]; | |
| 192469 | 192469 | stack_frame_size.* = @max(stack_frame_size.*, switch (cg.target.cCallingConvention().?) { |
| 192470 | 192470 | .x86_64_sysv => case.call_frame.size, |
| 192471 | 192471 | .x86_64_win => win64_shadow_space + case.call_frame.size, |
| 192472 | 192472 | else => unreachable, |
| 192473 | 192473 | }); |
| 192474 | 192474 | const stack_frame_align = |
| 192475 | &frame_allocs_slice.items(.abi_align)[@intFromEnum(FrameIndex.call_frame)]; | |
| 192475 | &frame_allocs_slice.items(.abi_align)[@backingInt(FrameIndex.call_frame)]; | |
| 192476 | 192476 | stack_frame_align.* = stack_frame_align.max(case.call_frame.alignment); |
| 192477 | 192477 | } |
| 192478 | 192478 | |
| ... | ... | @@ -192483,12 +192483,12 @@ fn select( |
| 192483 | 192483 | .labels = @splat(.{ .forward = @splat(null), .backward = null }), |
| 192484 | 192484 | .top = 0, |
| 192485 | 192485 | }; |
| 192486 | const s_tmp_types = s.types[@intFromEnum(Select.Operand.Ref.tmp0)..@intFromEnum(Select.Operand.Ref.dst0)]; | |
| 192487 | const s_tmp_temps = s.temps[@intFromEnum(Select.Operand.Ref.tmp0)..@intFromEnum(Select.Operand.Ref.dst0)]; | |
| 192488 | const s_dst_types = s.types[@intFromEnum(Select.Operand.Ref.dst0)..@intFromEnum(Select.Operand.Ref.src0)]; | |
| 192489 | const s_dst_temps = s.temps[@intFromEnum(Select.Operand.Ref.dst0)..@intFromEnum(Select.Operand.Ref.src0)]; | |
| 192490 | const s_src_types = s.types[@intFromEnum(Select.Operand.Ref.src0)..@intFromEnum(Select.Operand.Ref.none)]; | |
| 192491 | const s_src_temps = s.temps[@intFromEnum(Select.Operand.Ref.src0)..@intFromEnum(Select.Operand.Ref.none)]; | |
| 192486 | const s_tmp_types = s.types[@backingInt(Select.Operand.Ref.tmp0)..@backingInt(Select.Operand.Ref.dst0)]; | |
| 192487 | const s_tmp_temps = s.temps[@backingInt(Select.Operand.Ref.tmp0)..@backingInt(Select.Operand.Ref.dst0)]; | |
| 192488 | const s_dst_types = s.types[@backingInt(Select.Operand.Ref.dst0)..@backingInt(Select.Operand.Ref.src0)]; | |
| 192489 | const s_dst_temps = s.temps[@backingInt(Select.Operand.Ref.dst0)..@backingInt(Select.Operand.Ref.src0)]; | |
| 192490 | const s_src_types = s.types[@backingInt(Select.Operand.Ref.src0)..@backingInt(Select.Operand.Ref.none)]; | |
| 192491 | const s_src_temps = s.temps[@backingInt(Select.Operand.Ref.src0)..@backingInt(Select.Operand.Ref.none)]; | |
| 192492 | 192492 | |
| 192493 | 192493 | for (s_tmp_types, case.extra_temps) |*ty, spec| ty.* = spec.type; |
| 192494 | 192494 | @memcpy(s_dst_types[0..dst_tys.len], dst_tys); |
src/codegen/x86_64/Disassembler.zig+1-1| ... | ... | @@ -379,7 +379,7 @@ fn parseEncoding(dis: *Disassembler, prefixes: Prefixes) !?Encoding { |
| 379 | 379 | |
| 380 | 380 | fn parseGpRegister(low_enc: u3, is_extended: bool, rex: Rex, bit_size: u64) Register { |
| 381 | 381 | const reg_id: u4 = @as(u4, @intCast(@intFromBool(is_extended))) << 3 | low_enc; |
| 382 | const reg = @as(Register, @enumFromInt(reg_id)).toBitSize(bit_size); | |
| 382 | const reg = @as(Register, @fromBackingInt(@intCast(reg_id))).toBitSize(bit_size); | |
| 383 | 383 | return switch (reg) { |
| 384 | 384 | .spl => if (rex.present or rex.isSet()) .spl else .ah, |
| 385 | 385 | .dil => if (rex.present or rex.isSet()) .dil else .bh, |
src/codegen/x86_64/Emit.zig+41-41| ... | ... | @@ -135,33 +135,33 @@ pub fn emitMir(emit: *Emit) Error!void { |
| 135 | 135 | } }, |
| 136 | 136 | .lazy_sym => |lazy_sym| .{ .symbol = .{ |
| 137 | 137 | .symbol = if (emit.bin_file.cast(.elf)) |elf_file| |
| 138 | @enumFromInt( | |
| 138 | @fromBackingInt(@intCast( | |
| 139 | 139 | elf_file.zigObjectPtr().?.getOrCreateMetadataForLazySymbol(elf_file, emit.pt, lazy_sym) catch |err| |
| 140 | 140 | return emit.fail("{s} creating lazy symbol", .{@errorName(err)}), |
| 141 | ) | |
| 141 | )) | |
| 142 | 142 | else if (emit.bin_file.cast(.elf2)) |elf| |
| 143 | 143 | try elf.lazySymbol(lazy_sym) |
| 144 | 144 | else if (emit.bin_file.cast(.macho)) |macho_file| |
| 145 | @enumFromInt(macho_file.getZigObject().?.getOrCreateMetadataForLazySymbol(macho_file, emit.pt, lazy_sym) catch |err| | |
| 146 | return emit.fail("{s} creating lazy symbol", .{@errorName(err)})) | |
| 145 | @fromBackingInt(@intCast(macho_file.getZigObject().?.getOrCreateMetadataForLazySymbol(macho_file, emit.pt, lazy_sym) catch |err| | |
| 146 | return emit.fail("{s} creating lazy symbol", .{@errorName(err)}))) | |
| 147 | 147 | else if (emit.bin_file.cast(.coff2)) |coff| |
| 148 | @enumFromInt(@intFromEnum(try coff.lazySymbol(lazy_sym))) | |
| 148 | @fromBackingInt(@intCast(@backingInt(try coff.lazySymbol(lazy_sym)))) | |
| 149 | 149 | else |
| 150 | 150 | return emit.fail("lazy symbols unimplemented for {s}", .{@tagName(emit.bin_file.tag)}), |
| 151 | 151 | .is_extern = false, |
| 152 | 152 | } }, |
| 153 | 153 | .extern_func => |extern_func| .{ .symbol = .{ |
| 154 | 154 | .symbol = if (emit.bin_file.cast(.elf)) |elf_file| |
| 155 | @enumFromInt(try elf_file.getGlobalSymbol(extern_func.toSlice(&emit.lower.mir).?, null)) | |
| 155 | @fromBackingInt(@intCast(try elf_file.getGlobalSymbol(extern_func.toSlice(&emit.lower.mir).?, null))) | |
| 156 | 156 | else if (emit.bin_file.cast(.elf2)) |elf| try elf.externSymbol(.{ |
| 157 | 157 | .name = extern_func.toSlice(&emit.lower.mir).?, |
| 158 | 158 | .lib_name = null, |
| 159 | 159 | .type = .FUNC, |
| 160 | 160 | }) else if (emit.bin_file.cast(.macho)) |macho_file| |
| 161 | @enumFromInt(try macho_file.getGlobalSymbol(extern_func.toSlice(&emit.lower.mir).?, null)) | |
| 162 | else if (emit.bin_file.cast(.coff2)) |coff| @enumFromInt(@intFromEnum(try coff.globalSymbol(.{ | |
| 161 | @fromBackingInt(@intCast(try macho_file.getGlobalSymbol(extern_func.toSlice(&emit.lower.mir).?, null))) | |
| 162 | else if (emit.bin_file.cast(.coff2)) |coff| @fromBackingInt(@intCast(@backingInt(try coff.globalSymbol(.{ | |
| 163 | 163 | .name = extern_func.toSlice(&emit.lower.mir).?, |
| 164 | }))) else return emit.fail("external symbol unimplemented for {s}", .{@tagName(emit.bin_file.tag)}), | |
| 164 | })))) else return emit.fail("external symbol unimplemented for {s}", .{@tagName(emit.bin_file.tag)}), | |
| 165 | 165 | .is_extern = true, |
| 166 | 166 | } }, |
| 167 | 167 | }, |
| ... | ... | @@ -309,10 +309,10 @@ pub fn emitMir(emit: *Emit) Error!void { |
| 309 | 309 | }, emit.lower.target), &.{.{ |
| 310 | 310 | .op_index = 0, |
| 311 | 311 | .target = .{ .branch = .{ |
| 312 | .symbol = if (emit.bin_file.cast(.elf)) |elf_file| @enumFromInt(try elf_file.getGlobalSymbol( | |
| 312 | .symbol = if (emit.bin_file.cast(.elf)) |elf_file| @fromBackingInt(@intCast(try elf_file.getGlobalSymbol( | |
| 313 | 313 | "__tls_get_addr", |
| 314 | 314 | if (comp.config.link_libc) "c" else null, |
| 315 | )) else if (emit.bin_file.cast(.elf2)) |elf| try elf.externSymbol(.{ | |
| 315 | ))) else if (emit.bin_file.cast(.elf2)) |elf| try elf.externSymbol(.{ | |
| 316 | 316 | .name = "__tls_get_addr", |
| 317 | 317 | .lib_name = if (comp.config.link_libc) "c" else null, |
| 318 | 318 | .type = .FUNC, |
| ... | ... | @@ -391,9 +391,9 @@ pub fn emitMir(emit: *Emit) Error!void { |
| 391 | 391 | }, emit.lower.target), &.{.{ |
| 392 | 392 | .op_index = 1, |
| 393 | 393 | .target = .{ .symbol = .{ |
| 394 | .symbol = @enumFromInt(@intFromEnum( | |
| 394 | .symbol = @fromBackingInt(@intCast(@backingInt( | |
| 395 | 395 | try coff.globalSymbol(.{ .name = "__tls_index" }), |
| 396 | )), | |
| 396 | ))), | |
| 397 | 397 | .is_extern = false, |
| 398 | 398 | } }, |
| 399 | 399 | }}); |
| ... | ... | @@ -426,9 +426,9 @@ pub fn emitMir(emit: *Emit) Error!void { |
| 426 | 426 | }, emit.lower.target), &.{.{ |
| 427 | 427 | .op_index = 1, |
| 428 | 428 | .target = .{ .symbol = .{ |
| 429 | .symbol = @enumFromInt(@intFromEnum( | |
| 429 | .symbol = @fromBackingInt(@intCast(@backingInt( | |
| 430 | 430 | try coff.globalSymbol(.{ .name = "_tls_index" }), |
| 431 | )), | |
| 431 | ))), | |
| 432 | 432 | .is_extern = false, |
| 433 | 433 | } }, |
| 434 | 434 | }}); |
| ... | ... | @@ -680,17 +680,17 @@ pub fn emitMir(emit: *Emit) Error!void { |
| 680 | 680 | var table_offset = std.mem.alignForward(u32, @intCast(emit.w.end), ptr_size); |
| 681 | 681 | if (emit.bin_file.cast(.elf)) |elf_file| { |
| 682 | 682 | const zo = elf_file.zigObjectPtr().?; |
| 683 | const atom = zo.symbol(@intFromEnum(emit.atom_id)).atom(elf_file).?; | |
| 683 | const atom = zo.symbol(@backingInt(emit.atom_id)).atom(elf_file).?; | |
| 684 | 684 | |
| 685 | 685 | for (emit.table_relocs.items) |table_reloc| try atom.addReloc(gpa, .{ |
| 686 | 686 | .r_offset = table_reloc.source_offset, |
| 687 | .r_info = @as(u64, @intFromEnum(emit.atom_id)) << 32 | @intFromEnum(std.elf.R_X86_64.@"32S"), | |
| 687 | .r_info = @as(u64, @backingInt(emit.atom_id)) << 32 | @backingInt(std.elf.R_X86_64.@"32S"), | |
| 688 | 688 | .r_addend = @as(i64, table_offset) + table_reloc.target_offset, |
| 689 | 689 | }, zo); |
| 690 | 690 | for (emit.lower.mir.table) |entry| { |
| 691 | 691 | try atom.addReloc(gpa, .{ |
| 692 | 692 | .r_offset = table_offset, |
| 693 | .r_info = @as(u64, @intFromEnum(emit.atom_id)) << 32 | @intFromEnum(std.elf.R_X86_64.@"64"), | |
| 693 | .r_info = @as(u64, @backingInt(emit.atom_id)) << 32 | @backingInt(std.elf.R_X86_64.@"64"), | |
| 694 | 694 | .r_addend = emit.code_offset_mapping.items[entry], |
| 695 | 695 | }, zo); |
| 696 | 696 | table_offset += ptr_size; |
| ... | ... | @@ -793,7 +793,7 @@ fn encodeInst(emit: *Emit, lowered_inst: Instruction, reloc_info: []const RelocI |
| 793 | 793 | }), |
| 794 | 794 | .symbol => |target| if (emit.bin_file.cast(.elf)) |elf_file| { |
| 795 | 795 | const zo = elf_file.zigObjectPtr().?; |
| 796 | const atom = zo.symbol(@intFromEnum(emit.atom_id)).atom(elf_file).?; | |
| 796 | const atom = zo.symbol(@backingInt(emit.atom_id)).atom(elf_file).?; | |
| 797 | 797 | const r_type: std.elf.R_X86_64 = if (!emit.pic) |
| 798 | 798 | .@"32S" |
| 799 | 799 | else if (target.is_extern and !target.force_pcrel_direct) |
| ... | ... | @@ -802,23 +802,23 @@ fn encodeInst(emit: *Emit, lowered_inst: Instruction, reloc_info: []const RelocI |
| 802 | 802 | .PC32; |
| 803 | 803 | try atom.addReloc(gpa, .{ |
| 804 | 804 | .r_offset = end_offset - 4, |
| 805 | .r_info = @as(u64, @intFromEnum(target.symbol)) << 32 | @intFromEnum(r_type), | |
| 805 | .r_info = @as(u64, @backingInt(target.symbol)) << 32 | @backingInt(r_type), | |
| 806 | 806 | .r_addend = if (emit.pic) reloc.off - 4 else reloc.off, |
| 807 | 807 | }, zo); |
| 808 | 808 | } else if (emit.bin_file.cast(.macho)) |macho_file| { |
| 809 | 809 | const zo = macho_file.getZigObject().?; |
| 810 | const atom = zo.symbols.items[@intFromEnum(emit.atom_id)].getAtom(macho_file).?; | |
| 810 | const atom = zo.symbols.items[@backingInt(emit.atom_id)].getAtom(macho_file).?; | |
| 811 | 811 | try atom.addReloc(macho_file, .{ |
| 812 | 812 | .tag = .@"extern", |
| 813 | 813 | .offset = end_offset - 4, |
| 814 | .target = @intFromEnum(target.symbol), | |
| 814 | .target = @backingInt(target.symbol), | |
| 815 | 815 | .addend = reloc.off, |
| 816 | 816 | .type = if (target.is_extern and !target.force_pcrel_direct) .got_load else .signed, |
| 817 | 817 | .meta = .{ |
| 818 | 818 | .pcrel = true, |
| 819 | 819 | .has_subtractor = false, |
| 820 | 820 | .length = 2, |
| 821 | .symbolnum = @intCast(@intFromEnum(target.symbol)), | |
| 821 | .symbolnum = @intCast(@backingInt(target.symbol)), | |
| 822 | 822 | }, |
| 823 | 823 | }); |
| 824 | 824 | } else if (emit.bin_file.cast(.elf2)) |elf| try elf.addReloc( |
| ... | ... | @@ -832,19 +832,19 @@ fn encodeInst(emit: *Emit, lowered_inst: Instruction, reloc_info: []const RelocI |
| 832 | 832 | break :rt .PC32; |
| 833 | 833 | } }, |
| 834 | 834 | ) else if (emit.bin_file.cast(.coff2)) |coff| try coff.addReloc( |
| 835 | @enumFromInt(@intFromEnum(emit.atom_id)), | |
| 835 | @fromBackingInt(@intCast(@backingInt(emit.atom_id))), | |
| 836 | 836 | end_offset - 4, |
| 837 | @enumFromInt(@intFromEnum(target.symbol)), | |
| 837 | @fromBackingInt(@intCast(@backingInt(target.symbol))), | |
| 838 | 838 | .{ .known = reloc.off }, |
| 839 | 839 | .{ .AMD64 = .REL32 }, |
| 840 | 840 | ) else unreachable, |
| 841 | 841 | .branch => |target| if (emit.bin_file.cast(.elf)) |elf_file| { |
| 842 | 842 | const zo = elf_file.zigObjectPtr().?; |
| 843 | const atom = zo.symbol(@intFromEnum(emit.atom_id)).atom(elf_file).?; | |
| 843 | const atom = zo.symbol(@backingInt(emit.atom_id)).atom(elf_file).?; | |
| 844 | 844 | const r_type: std.elf.R_X86_64 = .PLT32; |
| 845 | 845 | try atom.addReloc(gpa, .{ |
| 846 | 846 | .r_offset = end_offset - 4, |
| 847 | .r_info = @as(u64, @intFromEnum(target.symbol)) << 32 | @intFromEnum(r_type), | |
| 847 | .r_info = @as(u64, @backingInt(target.symbol)) << 32 | @backingInt(r_type), | |
| 848 | 848 | .r_addend = reloc.off - 4, |
| 849 | 849 | }, zo); |
| 850 | 850 | } else if (emit.bin_file.cast(.elf2)) |elf| try elf.addReloc( |
| ... | ... | @@ -855,24 +855,24 @@ fn encodeInst(emit: *Emit, lowered_inst: Instruction, reloc_info: []const RelocI |
| 855 | 855 | .{ .X86_64 = .PLT32 }, |
| 856 | 856 | ) else if (emit.bin_file.cast(.macho)) |macho_file| { |
| 857 | 857 | const zo = macho_file.getZigObject().?; |
| 858 | const atom = zo.symbols.items[@intFromEnum(emit.atom_id)].getAtom(macho_file).?; | |
| 858 | const atom = zo.symbols.items[@backingInt(emit.atom_id)].getAtom(macho_file).?; | |
| 859 | 859 | try atom.addReloc(macho_file, .{ |
| 860 | 860 | .tag = .@"extern", |
| 861 | 861 | .offset = end_offset - 4, |
| 862 | .target = @intFromEnum(target.symbol), | |
| 862 | .target = @backingInt(target.symbol), | |
| 863 | 863 | .addend = reloc.off, |
| 864 | 864 | .type = .branch, |
| 865 | 865 | .meta = .{ |
| 866 | 866 | .pcrel = true, |
| 867 | 867 | .has_subtractor = false, |
| 868 | 868 | .length = 2, |
| 869 | .symbolnum = @intCast(@intFromEnum(target.symbol)), | |
| 869 | .symbolnum = @intCast(@backingInt(target.symbol)), | |
| 870 | 870 | }, |
| 871 | 871 | }); |
| 872 | 872 | } else if (emit.bin_file.cast(.coff2)) |coff| try coff.addReloc( |
| 873 | @enumFromInt(@intFromEnum(emit.atom_id)), | |
| 873 | @fromBackingInt(@intCast(@backingInt(emit.atom_id))), | |
| 874 | 874 | end_offset - 4, |
| 875 | @enumFromInt(@intFromEnum(target.symbol)), | |
| 875 | @fromBackingInt(@intCast(@backingInt(target.symbol))), | |
| 876 | 876 | .{ .known = reloc.off }, |
| 877 | 877 | .{ .AMD64 = .REL32 }, |
| 878 | 878 | ) else return emit.fail("TODO implement {s} reloc for {s}", .{ |
| ... | ... | @@ -880,11 +880,11 @@ fn encodeInst(emit: *Emit, lowered_inst: Instruction, reloc_info: []const RelocI |
| 880 | 880 | }), |
| 881 | 881 | .tls => |target_symbol| if (emit.bin_file.cast(.elf)) |elf_file| { |
| 882 | 882 | const zo = elf_file.zigObjectPtr().?; |
| 883 | const atom = zo.symbol(@intFromEnum(emit.atom_id)).atom(elf_file).?; | |
| 883 | const atom = zo.symbol(@backingInt(emit.atom_id)).atom(elf_file).?; | |
| 884 | 884 | const r_type: std.elf.R_X86_64 = if (emit.pic) .TLSLD else unreachable; |
| 885 | 885 | try atom.addReloc(gpa, .{ |
| 886 | 886 | .r_offset = end_offset - 4, |
| 887 | .r_info = @as(u64, @intFromEnum(target_symbol)) << 32 | @intFromEnum(r_type), | |
| 887 | .r_info = @as(u64, @backingInt(target_symbol)) << 32 | @backingInt(r_type), | |
| 888 | 888 | .r_addend = reloc.off - 4, |
| 889 | 889 | }, zo); |
| 890 | 890 | } else if (emit.bin_file.cast(.elf2)) |elf| try elf.addReloc( |
| ... | ... | @@ -898,11 +898,11 @@ fn encodeInst(emit: *Emit, lowered_inst: Instruction, reloc_info: []const RelocI |
| 898 | 898 | }), |
| 899 | 899 | .tlv => |target| if (emit.bin_file.cast(.elf)) |elf_file| { |
| 900 | 900 | const zo = elf_file.zigObjectPtr().?; |
| 901 | const atom = zo.symbol(@intFromEnum(emit.atom_id)).atom(elf_file).?; | |
| 901 | const atom = zo.symbol(@backingInt(emit.atom_id)).atom(elf_file).?; | |
| 902 | 902 | const r_type: std.elf.R_X86_64 = if (emit.pic) .DTPOFF32 else .TPOFF32; |
| 903 | 903 | try atom.addReloc(gpa, .{ |
| 904 | 904 | .r_offset = end_offset - 4, |
| 905 | .r_info = @as(u64, @intFromEnum(target.symbol)) << 32 | @intFromEnum(r_type), | |
| 905 | .r_info = @as(u64, @backingInt(target.symbol)) << 32 | @backingInt(r_type), | |
| 906 | 906 | .r_addend = reloc.off, |
| 907 | 907 | }, zo); |
| 908 | 908 | } else if (emit.bin_file.cast(.elf2)) |elf| try elf.addReloc( |
| ... | ... | @@ -913,24 +913,24 @@ fn encodeInst(emit: *Emit, lowered_inst: Instruction, reloc_info: []const RelocI |
| 913 | 913 | .{ .X86_64 = if (emit.pic) .DTPOFF32 else .TPOFF32 }, |
| 914 | 914 | ) else if (emit.bin_file.cast(.macho)) |macho_file| { |
| 915 | 915 | const zo = macho_file.getZigObject().?; |
| 916 | const atom = zo.symbols.items[@intFromEnum(emit.atom_id)].getAtom(macho_file).?; | |
| 916 | const atom = zo.symbols.items[@backingInt(emit.atom_id)].getAtom(macho_file).?; | |
| 917 | 917 | try atom.addReloc(macho_file, .{ |
| 918 | 918 | .tag = .@"extern", |
| 919 | 919 | .offset = end_offset - 4, |
| 920 | .target = @intFromEnum(target.symbol), | |
| 920 | .target = @backingInt(target.symbol), | |
| 921 | 921 | .addend = reloc.off, |
| 922 | 922 | .type = .tlv, |
| 923 | 923 | .meta = .{ |
| 924 | 924 | .pcrel = true, |
| 925 | 925 | .has_subtractor = false, |
| 926 | 926 | .length = 2, |
| 927 | .symbolnum = @intCast(@intFromEnum(target.symbol)), | |
| 927 | .symbolnum = @intCast(@backingInt(target.symbol)), | |
| 928 | 928 | }, |
| 929 | 929 | }); |
| 930 | 930 | } else if (emit.bin_file.cast(.coff2)) |coff| try coff.addReloc( |
| 931 | @enumFromInt(@intFromEnum(emit.atom_id)), | |
| 931 | @fromBackingInt(@intCast(@backingInt(emit.atom_id))), | |
| 932 | 932 | end_offset - 4, |
| 933 | @enumFromInt(@intFromEnum(target.symbol)), | |
| 933 | @fromBackingInt(@intCast(@backingInt(target.symbol))), | |
| 934 | 934 | .{ .known = reloc.off }, |
| 935 | 935 | .{ .AMD64 = .SECREL }, |
| 936 | 936 | ) else return emit.fail("TODO implement {s} reloc for {s}", .{ |
src/codegen/x86_64/Encoding.zig+5-5| ... | ... | @@ -57,7 +57,7 @@ pub fn findByMnemonic( |
| 57 | 57 | |
| 58 | 58 | var shortest_enc: ?Encoding = null; |
| 59 | 59 | var shortest_len: ?usize = null; |
| 60 | next: for (mnemonic_to_encodings_map[@intFromEnum(mnemonic)]) |data| { | |
| 60 | next: for (mnemonic_to_encodings_map[@backingInt(mnemonic)]) |data| { | |
| 61 | 61 | if (!switch (data.feature) { |
| 62 | 62 | .none => true, |
| 63 | 63 | .@"32bit" => switch (target.cpu.arch) { |
| ... | ... | @@ -122,7 +122,7 @@ pub fn findByOpcode(opc: []const u8, prefixes: struct { |
| 122 | 122 | rex: Rex, |
| 123 | 123 | }, modrm_ext: ?u3) ?Encoding { |
| 124 | 124 | for (mnemonic_to_encodings_map, 0..) |encs, mnemonic_int| for (encs) |data| { |
| 125 | const enc = Encoding{ .mnemonic = @as(Mnemonic, @enumFromInt(mnemonic_int)), .data = data }; | |
| 125 | const enc = Encoding{ .mnemonic = @as(Mnemonic, @fromBackingInt(@intCast(mnemonic_int))), .data = data }; | |
| 126 | 126 | if (modrm_ext) |ext| if (ext != data.modrm_ext) continue; |
| 127 | 127 | if (!std.mem.eql(u8, opc, enc.opcode())) continue; |
| 128 | 128 | if (prefixes.rex.w) { |
| ... | ... | @@ -1030,7 +1030,7 @@ const mnemonic_to_encodings_map = init: { |
| 1030 | 1030 | |
| 1031 | 1031 | const mnemonic_count = @typeInfo(Mnemonic).@"enum".field_names.len; |
| 1032 | 1032 | var mnemonic_map: [mnemonic_count][]Data = @splat(&.{}); |
| 1033 | for (encodings) |entry| mnemonic_map[@intFromEnum(entry[0])].len += 1; | |
| 1033 | for (encodings) |entry| mnemonic_map[@backingInt(entry[0])].len += 1; | |
| 1034 | 1034 | var data_storage: [encodings.len]Data = undefined; |
| 1035 | 1035 | var storage_index: usize = 0; |
| 1036 | 1036 | for (&mnemonic_map) |*value| { |
| ... | ... | @@ -1041,8 +1041,8 @@ const mnemonic_to_encodings_map = init: { |
| 1041 | 1041 | const ops_len = @typeInfo(@FieldType(Data, "ops")).array.len; |
| 1042 | 1042 | const opc_len = @typeInfo(@FieldType(Data, "opc")).array.len; |
| 1043 | 1043 | for (encodings) |entry| { |
| 1044 | const index = &mnemonic_index[@intFromEnum(entry[0])]; | |
| 1045 | mnemonic_map[@intFromEnum(entry[0])][index.*] = .{ | |
| 1044 | const index = &mnemonic_index[@backingInt(entry[0])]; | |
| 1045 | mnemonic_map[@backingInt(entry[0])][index.*] = .{ | |
| 1046 | 1046 | .op_en = entry[1], |
| 1047 | 1047 | .ops = ops: { |
| 1048 | 1048 | var ops: [ops_len]Op = @splat(.none); |
src/codegen/x86_64/Lower.zig+3-3| ... | ... | @@ -433,7 +433,7 @@ const mnemonic_table: [inst_tags_len * inst_fixes_len]?Mnemonic = table: { |
| 433 | 433 | @setEvalBranchQuota(80_000); |
| 434 | 434 | var table: [inst_tags_len * inst_fixes_len]?Mnemonic = undefined; |
| 435 | 435 | for (0..inst_fixes_len) |fixes_i| { |
| 436 | const fixes: Mir.Inst.Fixes = @enumFromInt(fixes_i); | |
| 436 | const fixes: Mir.Inst.Fixes = @fromBackingInt(@intCast(fixes_i)); | |
| 437 | 437 | const prefix, const suffix = affix: { |
| 438 | 438 | const pattern = if (std.mem.indexOfScalar(u8, @tagName(fixes), ' ')) |i| |
| 439 | 439 | @tagName(fixes)[i + 1 ..] |
| ... | ... | @@ -443,7 +443,7 @@ const mnemonic_table: [inst_tags_len * inst_fixes_len]?Mnemonic = table: { |
| 443 | 443 | break :affix .{ pattern[0..wildcard_idx], pattern[wildcard_idx + 1 ..] }; |
| 444 | 444 | }; |
| 445 | 445 | for (0..inst_tags_len) |inst_tag_i| { |
| 446 | const inst_tag: Mir.Inst.Tag = @enumFromInt(inst_tag_i); | |
| 446 | const inst_tag: Mir.Inst.Tag = @fromBackingInt(@intCast(inst_tag_i)); | |
| 447 | 447 | const name = prefix ++ @tagName(inst_tag) ++ suffix; |
| 448 | 448 | const idx = inst_tag_i * inst_fixes_len + fixes_i; |
| 449 | 449 | table[idx] = if (@hasField(Mnemonic, name)) @field(Mnemonic, name) else null; |
| ... | ... | @@ -482,7 +482,7 @@ fn generic(lower: *Lower, inst: Mir.Inst) Error!void { |
| 482 | 482 | else |
| 483 | 483 | .none, |
| 484 | 484 | }, mnemonic: { |
| 485 | if (mnemonic_table[@intFromEnum(inst.tag) * inst_fixes_len + @intFromEnum(fixes)]) |mnemonic| { | |
| 485 | if (mnemonic_table[@backingInt(inst.tag) * inst_fixes_len + @backingInt(fixes)]) |mnemonic| { | |
| 486 | 486 | break :mnemonic mnemonic; |
| 487 | 487 | } |
| 488 | 488 | // This combination is invalid; make the theoretical mnemonic name and emit an error with it. |
src/codegen/x86_64/Mir.zig+20-20| ... | ... | @@ -1822,7 +1822,7 @@ pub const NullTerminatedString = enum(u32) { |
| 1822 | 1822 | |
| 1823 | 1823 | pub fn toSlice(nts: NullTerminatedString, mir: *const Mir) ?[:0]const u8 { |
| 1824 | 1824 | if (nts == .none) return null; |
| 1825 | const string_bytes = mir.string_bytes[@intFromEnum(nts)..]; | |
| 1825 | const string_bytes = mir.string_bytes[@backingInt(nts)..]; | |
| 1826 | 1826 | return string_bytes[0..std.mem.indexOfScalar(u8, string_bytes, 0).? :0]; |
| 1827 | 1827 | } |
| 1828 | 1828 | }; |
| ... | ... | @@ -1890,13 +1890,13 @@ pub const Memory = struct { |
| 1890 | 1890 | }, |
| 1891 | 1891 | .base = switch (mem.base) { |
| 1892 | 1892 | .none, .table => undefined, |
| 1893 | .reg => |reg| @intFromEnum(reg), | |
| 1894 | .frame => |frame_index| @intFromEnum(frame_index), | |
| 1893 | .reg => |reg| @backingInt(reg), | |
| 1894 | .frame => |frame_index| @backingInt(frame_index), | |
| 1895 | 1895 | .rip_inst => |inst_index| inst_index, |
| 1896 | .nav => |nav| @intFromEnum(nav), | |
| 1897 | .uav => |uav| @intFromEnum(uav.val), | |
| 1898 | .lazy_sym => |lazy_sym| @intFromEnum(lazy_sym.ty), | |
| 1899 | .extern_func => |extern_func| @intFromEnum(extern_func), | |
| 1896 | .nav => |nav| @backingInt(nav), | |
| 1897 | .uav => |uav| @backingInt(uav.val), | |
| 1898 | .lazy_sym => |lazy_sym| @backingInt(lazy_sym.ty), | |
| 1899 | .extern_func => |extern_func| @backingInt(extern_func), | |
| 1900 | 1900 | }, |
| 1901 | 1901 | .off = switch (mem.mod) { |
| 1902 | 1902 | .rm => |rm| @bitCast(rm.disp), |
| ... | ... | @@ -1905,8 +1905,8 @@ pub const Memory = struct { |
| 1905 | 1905 | .extra = switch (mem.mod) { |
| 1906 | 1906 | .rm => switch (mem.base) { |
| 1907 | 1907 | else => undefined, |
| 1908 | .uav => |uav| @intFromEnum(uav.orig_ty), | |
| 1909 | .lazy_sym => |lazy_sym| @intFromEnum(lazy_sym.kind), | |
| 1908 | .uav => |uav| @backingInt(uav.orig_ty), | |
| 1909 | .lazy_sym => |lazy_sym| @backingInt(lazy_sym.kind), | |
| 1910 | 1910 | }, |
| 1911 | 1911 | .off => switch (mem.base) { |
| 1912 | 1912 | .reg => @intCast(mem.mod.off >> 32), |
| ... | ... | @@ -1919,7 +1919,7 @@ pub const Memory = struct { |
| 1919 | 1919 | pub fn decode(mem: Memory) encoder.Instruction.Memory { |
| 1920 | 1920 | switch (mem.info.mod) { |
| 1921 | 1921 | .rm => { |
| 1922 | if (mem.info.base == .reg and @as(Register, @enumFromInt(mem.base)) == .rip) { | |
| 1922 | if (mem.info.base == .reg and @as(Register, @fromBackingInt(@intCast(mem.base))) == .rip) { | |
| 1923 | 1923 | assert(mem.info.index == .none and mem.info.scale == .@"1"); |
| 1924 | 1924 | return encoder.Instruction.Memory.initRip(mem.info.size, @bitCast(mem.off)); |
| 1925 | 1925 | } |
| ... | ... | @@ -1927,14 +1927,14 @@ pub const Memory = struct { |
| 1927 | 1927 | .disp = @bitCast(mem.off), |
| 1928 | 1928 | .base = switch (mem.info.base) { |
| 1929 | 1929 | .none => .none, |
| 1930 | .reg => .{ .reg = @enumFromInt(mem.base) }, | |
| 1931 | .frame => .{ .frame = @enumFromInt(mem.base) }, | |
| 1930 | .reg => .{ .reg = @fromBackingInt(@intCast(mem.base)) }, | |
| 1931 | .frame => .{ .frame = @fromBackingInt(@intCast(mem.base)) }, | |
| 1932 | 1932 | .table => .table, |
| 1933 | 1933 | .rip_inst => .{ .rip_inst = mem.base }, |
| 1934 | .nav => .{ .nav = @enumFromInt(mem.base) }, | |
| 1935 | .uav => .{ .uav = .{ .val = @enumFromInt(mem.base), .orig_ty = @enumFromInt(mem.extra) } }, | |
| 1936 | .lazy_sym => .{ .lazy_sym = .{ .kind = @enumFromInt(mem.extra), .ty = @enumFromInt(mem.base) } }, | |
| 1937 | .extern_func => .{ .extern_func = @enumFromInt(mem.base) }, | |
| 1934 | .nav => .{ .nav = @fromBackingInt(@intCast(mem.base)) }, | |
| 1935 | .uav => .{ .uav = .{ .val = @fromBackingInt(@intCast(mem.base)), .orig_ty = @fromBackingInt(@intCast(mem.extra)) } }, | |
| 1936 | .lazy_sym => .{ .lazy_sym = .{ .kind = @fromBackingInt(@intCast(mem.extra)), .ty = @fromBackingInt(@intCast(mem.base)) } }, | |
| 1937 | .extern_func => .{ .extern_func = @fromBackingInt(@intCast(mem.base)) }, | |
| 1938 | 1938 | }, |
| 1939 | 1939 | .scale_index = switch (mem.info.index) { |
| 1940 | 1940 | .none => null, |
| ... | ... | @@ -1951,7 +1951,7 @@ pub const Memory = struct { |
| 1951 | 1951 | .off => { |
| 1952 | 1952 | assert(mem.info.base == .reg); |
| 1953 | 1953 | return encoder.Instruction.Memory.initMoffs( |
| 1954 | @enumFromInt(mem.base), | |
| 1954 | @fromBackingInt(@intCast(mem.base)), | |
| 1955 | 1955 | @as(u64, mem.extra) << 32 | mem.off, |
| 1956 | 1956 | ); |
| 1957 | 1957 | }, |
| ... | ... | @@ -2074,7 +2074,7 @@ pub fn extraData(mir: Mir, comptime T: type, index: u32) struct { data: T, end: |
| 2074 | 2074 | @field(result, field_name) = switch (field_type) { |
| 2075 | 2075 | u32 => mir.extra[i], |
| 2076 | 2076 | i32, Memory.Info => @bitCast(mir.extra[i]), |
| 2077 | bits.FrameIndex => @enumFromInt(mir.extra[i]), | |
| 2077 | bits.FrameIndex => @fromBackingInt(@intCast(mir.extra[i])), | |
| 2078 | 2078 | else => @compileError("bad field type: " ++ field_name ++ ": " ++ @typeName(field_type)), |
| 2079 | 2079 | }; |
| 2080 | 2080 | i += 1; |
| ... | ... | @@ -2091,7 +2091,7 @@ pub const FrameLoc = struct { |
| 2091 | 2091 | }; |
| 2092 | 2092 | |
| 2093 | 2093 | pub fn resolveFrameAddr(mir: Mir, frame_addr: bits.FrameAddr) bits.RegisterOffset { |
| 2094 | const frame_loc = mir.frame_locs.get(@intFromEnum(frame_addr.index)); | |
| 2094 | const frame_loc = mir.frame_locs.get(@backingInt(frame_addr.index)); | |
| 2095 | 2095 | return .{ .reg = frame_loc.base, .off = frame_loc.disp + frame_addr.off }; |
| 2096 | 2096 | } |
| 2097 | 2097 | |
| ... | ... | @@ -2107,7 +2107,7 @@ pub fn resolveMemoryExtra(mir: Mir, payload: u32) Memory { |
| 2107 | 2107 | .index = mem.info.index, |
| 2108 | 2108 | .scale = mem.info.scale, |
| 2109 | 2109 | }, |
| 2110 | .base = @intFromEnum(mir.frame_locs.items(.base)[mem.base]), | |
| 2110 | .base = @backingInt(mir.frame_locs.items(.base)[mem.base]), | |
| 2111 | 2111 | .off = @bitCast(mir.frame_locs.items(.disp)[mem.base] + @as(i32, @bitCast(mem.off))), |
| 2112 | 2112 | .extra = mem.extra, |
| 2113 | 2113 | } else mem, |
src/codegen/x86_64/bits.zig+30-30| ... | ... | @@ -241,7 +241,7 @@ pub const SseFloatPredicate = enum(u3) { |
| 241 | 241 | pub const ord_q: SseFloatPredicate = .ord; |
| 242 | 242 | |
| 243 | 243 | pub fn imm(pred: SseFloatPredicate) Immediate { |
| 244 | return .u(@intFromEnum(pred)); | |
| 244 | return .u(@backingInt(pred)); | |
| 245 | 245 | } |
| 246 | 246 | }; |
| 247 | 247 | |
| ... | ... | @@ -342,7 +342,7 @@ pub const VexFloatPredicate = enum(u5) { |
| 342 | 342 | pub const @"true": VexFloatPredicate = .true_uq; |
| 343 | 343 | |
| 344 | 344 | pub fn imm(pred: VexFloatPredicate) Immediate { |
| 345 | return .u(@intFromEnum(pred)); | |
| 345 | return .u(@backingInt(pred)); | |
| 346 | 346 | } |
| 347 | 347 | }; |
| 348 | 348 | |
| ... | ... | @@ -407,7 +407,7 @@ pub const Register = enum(u8) { |
| 407 | 407 | }; |
| 408 | 408 | |
| 409 | 409 | pub fn class(reg: Register) Class { |
| 410 | return switch (@intFromEnum(reg)) { | |
| 410 | return switch (@backingInt(reg)) { | |
| 411 | 411 | // zig fmt: off |
| 412 | 412 | @intFromEnum(Register.rax) ... @intFromEnum(Register.r15) => .general_purpose, |
| 413 | 413 | @intFromEnum(Register.eax) ... @intFromEnum(Register.r15d) => .general_purpose, |
| ... | ... | @@ -442,7 +442,7 @@ pub const Register = enum(u8) { |
| 442 | 442 | } |
| 443 | 443 | |
| 444 | 444 | pub fn id(reg: Register) u7 { |
| 445 | const base = switch (@intFromEnum(reg)) { | |
| 445 | const base = switch (@backingInt(reg)) { | |
| 446 | 446 | // zig fmt: off |
| 447 | 447 | @intFromEnum(Register.rax) ... @intFromEnum(Register.r15) => @intFromEnum(Register.rax), |
| 448 | 448 | @intFromEnum(Register.eax) ... @intFromEnum(Register.r15d) => @intFromEnum(Register.eax), |
| ... | ... | @@ -462,11 +462,11 @@ pub const Register = enum(u8) { |
| 462 | 462 | else => unreachable, |
| 463 | 463 | // zig fmt: on |
| 464 | 464 | }; |
| 465 | return @intCast(@intFromEnum(reg) - base); | |
| 465 | return @intCast(@backingInt(reg) - base); | |
| 466 | 466 | } |
| 467 | 467 | |
| 468 | 468 | pub fn size(reg: Register) Memory.Size { |
| 469 | return switch (@intFromEnum(reg)) { | |
| 469 | return switch (@backingInt(reg)) { | |
| 470 | 470 | // zig fmt: off |
| 471 | 471 | @intFromEnum(Register.rax) ... @intFromEnum(Register.r15) => .qword, |
| 472 | 472 | @intFromEnum(Register.eax) ... @intFromEnum(Register.r15d) => .dword, |
| ... | ... | @@ -491,7 +491,7 @@ pub const Register = enum(u8) { |
| 491 | 491 | } |
| 492 | 492 | |
| 493 | 493 | pub fn isExtended(reg: Register) bool { |
| 494 | return switch (@intFromEnum(reg)) { | |
| 494 | return switch (@backingInt(reg)) { | |
| 495 | 495 | // zig fmt: off |
| 496 | 496 | @intFromEnum(Register.r8) ... @intFromEnum(Register.r15) => true, |
| 497 | 497 | @intFromEnum(Register.r8d) ... @intFromEnum(Register.r15d) => true, |
| ... | ... | @@ -511,7 +511,7 @@ pub const Register = enum(u8) { |
| 511 | 511 | } |
| 512 | 512 | |
| 513 | 513 | pub fn enc(reg: Register) u5 { |
| 514 | const base = switch (@intFromEnum(reg)) { | |
| 514 | const base = switch (@backingInt(reg)) { | |
| 515 | 515 | // zig fmt: off |
| 516 | 516 | @intFromEnum(Register.rax) ... @intFromEnum(Register.r15) => @intFromEnum(Register.rax), |
| 517 | 517 | @intFromEnum(Register.eax) ... @intFromEnum(Register.r15d) => @intFromEnum(Register.eax), |
| ... | ... | @@ -532,7 +532,7 @@ pub const Register = enum(u8) { |
| 532 | 532 | else => unreachable, |
| 533 | 533 | // zig fmt: on |
| 534 | 534 | }; |
| 535 | return @truncate(@intFromEnum(reg) - base); | |
| 535 | return @truncate(@backingInt(reg) - base); | |
| 536 | 536 | } |
| 537 | 537 | |
| 538 | 538 | pub fn toBitSize(reg: Register, bit_size: u64) Register { |
| ... | ... | @@ -572,7 +572,7 @@ pub const Register = enum(u8) { |
| 572 | 572 | } |
| 573 | 573 | |
| 574 | 574 | fn gpBase(reg: Register) u7 { |
| 575 | return switch (@intFromEnum(reg)) { | |
| 575 | return switch (@backingInt(reg)) { | |
| 576 | 576 | // zig fmt: off |
| 577 | 577 | @intFromEnum(Register.rax) ... @intFromEnum(Register.r15) => @intFromEnum(Register.rax), |
| 578 | 578 | @intFromEnum(Register.eax) ... @intFromEnum(Register.r15d) => @intFromEnum(Register.eax), |
| ... | ... | @@ -586,7 +586,7 @@ pub const Register = enum(u8) { |
| 586 | 586 | |
| 587 | 587 | pub fn to64(reg: Register) Register { |
| 588 | 588 | return switch (reg.class()) { |
| 589 | .general_purpose, .gphi => @enumFromInt(@intFromEnum(reg) - reg.gpBase() + @intFromEnum(Register.rax)), | |
| 589 | .general_purpose, .gphi => @fromBackingInt(@intCast(@backingInt(reg) - reg.gpBase() + @backingInt(Register.rax))), | |
| 590 | 590 | .segment => unreachable, |
| 591 | 591 | .x87, .mmx, .cr, .dr => reg, |
| 592 | 592 | .sse => reg.to128(), |
| ... | ... | @@ -596,7 +596,7 @@ pub const Register = enum(u8) { |
| 596 | 596 | |
| 597 | 597 | pub fn to32(reg: Register) Register { |
| 598 | 598 | return switch (reg.class()) { |
| 599 | .general_purpose, .gphi => @enumFromInt(@intFromEnum(reg) - reg.gpBase() + @intFromEnum(Register.eax)), | |
| 599 | .general_purpose, .gphi => @fromBackingInt(@intCast(@backingInt(reg) - reg.gpBase() + @backingInt(Register.eax))), | |
| 600 | 600 | .segment => unreachable, |
| 601 | 601 | .x87, .mmx, .cr, .dr => reg, |
| 602 | 602 | .sse => reg.to128(), |
| ... | ... | @@ -606,7 +606,7 @@ pub const Register = enum(u8) { |
| 606 | 606 | |
| 607 | 607 | pub fn to16(reg: Register) Register { |
| 608 | 608 | return switch (reg.class()) { |
| 609 | .general_purpose, .gphi => @enumFromInt(@intFromEnum(reg) - reg.gpBase() + @intFromEnum(Register.ax)), | |
| 609 | .general_purpose, .gphi => @fromBackingInt(@intCast(@backingInt(reg) - reg.gpBase() + @backingInt(Register.ax))), | |
| 610 | 610 | .segment, .x87, .mmx, .cr, .dr => reg, |
| 611 | 611 | .sse => reg.to128(), |
| 612 | 612 | .ip => .ip, |
| ... | ... | @@ -623,12 +623,12 @@ pub const Register = enum(u8) { |
| 623 | 623 | } |
| 624 | 624 | |
| 625 | 625 | pub fn toLo8(reg: Register) Register { |
| 626 | return @enumFromInt(@intFromEnum(reg) - reg.gpBase() + @intFromEnum(Register.al)); | |
| 626 | return @fromBackingInt(@intCast(@backingInt(reg) - reg.gpBase() + @backingInt(Register.al))); | |
| 627 | 627 | } |
| 628 | 628 | |
| 629 | 629 | pub fn toHi8(reg: Register) Register { |
| 630 | 630 | assert(reg.isClass(.gphi)); |
| 631 | return @enumFromInt(@intFromEnum(reg) - reg.gpBase() + @intFromEnum(Register.ah)); | |
| 631 | return @fromBackingInt(@intCast(@backingInt(reg) - reg.gpBase() + @backingInt(Register.ah))); | |
| 632 | 632 | } |
| 633 | 633 | |
| 634 | 634 | pub fn to80(reg: Register) Register { |
| ... | ... | @@ -638,24 +638,24 @@ pub const Register = enum(u8) { |
| 638 | 638 | |
| 639 | 639 | fn sseBase(reg: Register) u8 { |
| 640 | 640 | assert(reg.isClass(.sse)); |
| 641 | return switch (@intFromEnum(reg)) { | |
| 642 | @intFromEnum(Register.zmm0)...@intFromEnum(Register.zmm31) => @intFromEnum(Register.zmm0), | |
| 643 | @intFromEnum(Register.ymm0)...@intFromEnum(Register.ymm31) => @intFromEnum(Register.ymm0), | |
| 644 | @intFromEnum(Register.xmm0)...@intFromEnum(Register.xmm31) => @intFromEnum(Register.xmm0), | |
| 641 | return switch (@backingInt(reg)) { | |
| 642 | @backingInt(Register.zmm0)...@backingInt(Register.zmm31) => @backingInt(Register.zmm0), | |
| 643 | @backingInt(Register.ymm0)...@backingInt(Register.ymm31) => @backingInt(Register.ymm0), | |
| 644 | @backingInt(Register.xmm0)...@backingInt(Register.xmm31) => @backingInt(Register.xmm0), | |
| 645 | 645 | else => unreachable, |
| 646 | 646 | }; |
| 647 | 647 | } |
| 648 | 648 | |
| 649 | 649 | pub fn to512(reg: Register) Register { |
| 650 | return @enumFromInt(@intFromEnum(reg) - reg.sseBase() + @intFromEnum(Register.zmm0)); | |
| 650 | return @fromBackingInt(@intCast(@backingInt(reg) - reg.sseBase() + @backingInt(Register.zmm0))); | |
| 651 | 651 | } |
| 652 | 652 | |
| 653 | 653 | pub fn to256(reg: Register) Register { |
| 654 | return @enumFromInt(@intFromEnum(reg) - reg.sseBase() + @intFromEnum(Register.ymm0)); | |
| 654 | return @fromBackingInt(@intCast(@backingInt(reg) - reg.sseBase() + @backingInt(Register.ymm0))); | |
| 655 | 655 | } |
| 656 | 656 | |
| 657 | 657 | pub fn to128(reg: Register) Register { |
| 658 | return @enumFromInt(@intFromEnum(reg) - reg.sseBase() + @intFromEnum(Register.xmm0)); | |
| 658 | return @fromBackingInt(@intCast(@backingInt(reg) - reg.sseBase() + @backingInt(Register.xmm0))); | |
| 659 | 659 | } |
| 660 | 660 | |
| 661 | 661 | /// DWARF register encoding |
| ... | ... | @@ -725,14 +725,14 @@ pub const FrameIndex = enum(u32) { |
| 725 | 725 | pub const named_count = @typeInfo(FrameIndex).@"enum".field_names.len; |
| 726 | 726 | |
| 727 | 727 | pub fn isNamed(fi: FrameIndex) bool { |
| 728 | return @intFromEnum(fi) < named_count; | |
| 728 | return @backingInt(fi) < named_count; | |
| 729 | 729 | } |
| 730 | 730 | |
| 731 | 731 | pub fn format(fi: FrameIndex, writer: *std.Io.Writer) std.Io.Writer.Error!void { |
| 732 | 732 | if (fi.isNamed()) { |
| 733 | 733 | try writer.print("FrameIndex.{t}", .{fi}); |
| 734 | 734 | } else { |
| 735 | try writer.print("FrameIndex({d})", .{@intFromEnum(fi)}); | |
| 735 | try writer.print("FrameIndex({d})", .{@backingInt(fi)}); | |
| 736 | 736 | } |
| 737 | 737 | } |
| 738 | 738 | }; |
| ... | ... | @@ -875,11 +875,11 @@ pub const Memory = struct { |
| 875 | 875 | } |
| 876 | 876 | |
| 877 | 877 | pub fn fromLog2(log2: u2) Scale { |
| 878 | return @enumFromInt(log2); | |
| 878 | return @fromBackingInt(@intCast(log2)); | |
| 879 | 879 | } |
| 880 | 880 | |
| 881 | 881 | pub fn toLog2(scale: Scale) u2 { |
| 882 | return @intFromEnum(scale); | |
| 882 | return @backingInt(scale); | |
| 883 | 883 | } |
| 884 | 884 | }; |
| 885 | 885 | }; |
| ... | ... | @@ -903,10 +903,10 @@ pub const Immediate = union(enum) { |
| 903 | 903 | pub fn format(imm: Immediate, writer: *std.Io.Writer) std.Io.Writer.Error!void { |
| 904 | 904 | switch (imm) { |
| 905 | 905 | inline else => |int| try writer.print("{d}", .{int}), |
| 906 | .nav => |nav_off| try writer.print("Nav({d}) + {d}", .{ @intFromEnum(nav_off.nav), nav_off.off }), | |
| 907 | .uav => |uav| try writer.print("Uav({d})", .{@intFromEnum(uav.val)}), | |
| 908 | .lazy_sym => |lazy_sym| try writer.print("LazySym({s}, {d})", .{ @tagName(lazy_sym.kind), @intFromEnum(lazy_sym.ty) }), | |
| 909 | .extern_func => |extern_func| try writer.print("ExternFunc({d})", .{@intFromEnum(extern_func)}), | |
| 906 | .nav => |nav_off| try writer.print("Nav({d}) + {d}", .{ @backingInt(nav_off.nav), nav_off.off }), | |
| 907 | .uav => |uav| try writer.print("Uav({d})", .{@backingInt(uav.val)}), | |
| 908 | .lazy_sym => |lazy_sym| try writer.print("LazySym({s}, {d})", .{ @tagName(lazy_sym.kind), @backingInt(lazy_sym.ty) }), | |
| 909 | .extern_func => |extern_func| try writer.print("ExternFunc({d})", .{@backingInt(extern_func)}), | |
| 910 | 910 | } |
| 911 | 911 | } |
| 912 | 912 | }; |
src/codegen/x86_64/encoder.zig+7-7| ... | ... | @@ -250,13 +250,13 @@ pub const Instruction = struct { |
| 250 | 250 | .frame => |frame_index| try w.print("{f}", .{frame_index}), |
| 251 | 251 | .table => try w.print("Table", .{}), |
| 252 | 252 | .rip_inst => |inst_index| try w.print("RipInst({d})", .{inst_index}), |
| 253 | .nav => |nav| try w.print("Nav({d})", .{@intFromEnum(nav)}), | |
| 254 | .uav => |uav| try w.print("Uav({d})", .{@intFromEnum(uav.val)}), | |
| 253 | .nav => |nav| try w.print("Nav({d})", .{@backingInt(nav)}), | |
| 254 | .uav => |uav| try w.print("Uav({d})", .{@backingInt(uav.val)}), | |
| 255 | 255 | .lazy_sym => |lazy_sym| try w.print("LazySym({s}, {d})", .{ |
| 256 | 256 | @tagName(lazy_sym.kind), |
| 257 | @intFromEnum(lazy_sym.ty), | |
| 257 | @backingInt(lazy_sym.ty), | |
| 258 | 258 | }), |
| 259 | .extern_func => |extern_func| try w.print("ExternFunc({d})", .{@intFromEnum(extern_func)}), | |
| 259 | .extern_func => |extern_func| try w.print("ExternFunc({d})", .{@backingInt(extern_func)}), | |
| 260 | 260 | } |
| 261 | 261 | if (mem.scaleIndex()) |si| { |
| 262 | 262 | if (any) try w.writeAll(" + "); |
| ... | ... | @@ -845,14 +845,14 @@ fn Encoder(comptime opts: Options) type { |
| 845 | 845 | @as(u8, ~@intFromBool(fields.r)) << 7 | |
| 846 | 846 | @as(u8, ~@intFromBool(fields.x)) << 6 | |
| 847 | 847 | @as(u8, ~@intFromBool(fields.b)) << 5 | |
| 848 | @as(u8, @intFromEnum(fields.m)) << 0, | |
| 848 | @as(u8, @backingInt(fields.m)) << 0, | |
| 849 | 849 | ); |
| 850 | 850 | |
| 851 | 851 | try self.w.writeByte( |
| 852 | 852 | @as(u8, @intFromBool(fields.w)) << 7 | |
| 853 | 853 | @as(u8, ~@as(u4, @intCast(fields.v.enc()))) << 3 | |
| 854 | 854 | @as(u8, @intFromBool(fields.l)) << 2 | |
| 855 | @as(u8, @intFromEnum(fields.p)) << 0, | |
| 855 | @as(u8, @backingInt(fields.p)) << 0, | |
| 856 | 856 | ); |
| 857 | 857 | } else { |
| 858 | 858 | try self.w.writeByte(0b1100_0101); |
| ... | ... | @@ -860,7 +860,7 @@ fn Encoder(comptime opts: Options) type { |
| 860 | 860 | @as(u8, ~@intFromBool(fields.r)) << 7 | |
| 861 | 861 | @as(u8, ~@as(u4, @intCast(fields.v.enc()))) << 3 | |
| 862 | 862 | @as(u8, @intFromBool(fields.l)) << 2 | |
| 863 | @as(u8, @intFromEnum(fields.p)) << 0, | |
| 863 | @as(u8, @backingInt(fields.p)) << 0, | |
| 864 | 864 | ); |
| 865 | 865 | } |
| 866 | 866 | } |
src/libs/mingw/Preprocessor.zig+2-2| ... | ... | @@ -63,11 +63,11 @@ const IfContext = struct { |
| 63 | 63 | level: u8, |
| 64 | 64 | |
| 65 | 65 | fn get(self: *const IfContext) Nesting { |
| 66 | return @enumFromInt(std.mem.readPackedInt(Backing, &self.kind, @as(usize, self.level) * 2, .native)); | |
| 66 | return @fromBackingInt(@intCast(std.mem.readPackedInt(Backing, &self.kind, @as(usize, self.level) * 2, .native))); | |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | fn set(self: *IfContext, context: Nesting) void { |
| 70 | std.mem.writePackedInt(Backing, &self.kind, @as(usize, self.level) * 2, @intFromEnum(context), .native); | |
| 70 | std.mem.writePackedInt(Backing, &self.kind, @as(usize, self.level) * 2, @backingInt(context), .native); | |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | fn increment(self: *IfContext) void { |
src/libs/mingw/implib.zig+17-17| ... | ... | @@ -505,7 +505,7 @@ fn getImportDescriptor( |
| 505 | 505 | writeSymbol(&writer, .{ |
| 506 | 506 | .name = first_string_table_entry, |
| 507 | 507 | .value = 0, |
| 508 | .section_number = @enumFromInt(1), | |
| 508 | .section_number = @fromBackingInt(@intCast(1)), | |
| 509 | 509 | .type = .{ |
| 510 | 510 | .base_type = .NULL, |
| 511 | 511 | .complex_type = .NULL, |
| ... | ... | @@ -517,7 +517,7 @@ fn getImportDescriptor( |
| 517 | 517 | writeSymbol(&writer, .{ |
| 518 | 518 | .name = ".idata$2".*, |
| 519 | 519 | .value = 0, |
| 520 | .section_number = @enumFromInt(1), | |
| 520 | .section_number = @fromBackingInt(@intCast(1)), | |
| 521 | 521 | .type = .{ |
| 522 | 522 | .base_type = .NULL, |
| 523 | 523 | .complex_type = .NULL, |
| ... | ... | @@ -528,7 +528,7 @@ fn getImportDescriptor( |
| 528 | 528 | writeSymbol(&writer, .{ |
| 529 | 529 | .name = ".idata$6".*, |
| 530 | 530 | .value = 0, |
| 531 | .section_number = @enumFromInt(2), | |
| 531 | .section_number = @fromBackingInt(@intCast(2)), | |
| 532 | 532 | .type = .{ |
| 533 | 533 | .base_type = .NULL, |
| 534 | 534 | .complex_type = .NULL, |
| ... | ... | @@ -668,7 +668,7 @@ fn getNullImportDescriptor( |
| 668 | 668 | writeSymbol(&writer, .{ |
| 669 | 669 | .name = first_string_table_entry, |
| 670 | 670 | .value = 0, |
| 671 | .section_number = @enumFromInt(1), | |
| 671 | .section_number = @fromBackingInt(@intCast(1)), | |
| 672 | 672 | .type = .{ |
| 673 | 673 | .base_type = .NULL, |
| 674 | 674 | .complex_type = .NULL, |
| ... | ... | @@ -781,7 +781,7 @@ fn getNullThunk( |
| 781 | 781 | writeSymbol(&writer, .{ |
| 782 | 782 | .name = first_string_table_entry, |
| 783 | 783 | .value = 0, |
| 784 | .section_number = @enumFromInt(1), | |
| 784 | .section_number = @fromBackingInt(@intCast(1)), | |
| 785 | 785 | .type = .{ |
| 786 | 786 | .base_type = .NULL, |
| 787 | 787 | .complex_type = .NULL, |
| ... | ... | @@ -903,7 +903,7 @@ fn getWeakExternal( |
| 903 | 903 | writeSymbol(&writer, .{ |
| 904 | 904 | .name = first_string_table_entry, |
| 905 | 905 | .value = 0, |
| 906 | .section_number = @enumFromInt(0), | |
| 906 | .section_number = @fromBackingInt(@intCast(0)), | |
| 907 | 907 | .type = .{ |
| 908 | 908 | .base_type = .NULL, |
| 909 | 909 | .complex_type = .NULL, |
| ... | ... | @@ -915,7 +915,7 @@ fn getWeakExternal( |
| 915 | 915 | writeSymbol(&writer, .{ |
| 916 | 916 | .name = getNameBytesForStringTableOffset(@intCast(string_table_offset)), |
| 917 | 917 | .value = 0, |
| 918 | .section_number = @enumFromInt(0), | |
| 918 | .section_number = @fromBackingInt(@intCast(0)), | |
| 919 | 919 | .type = .{ |
| 920 | 920 | .base_type = .NULL, |
| 921 | 921 | .complex_type = .NULL, |
| ... | ... | @@ -1012,16 +1012,16 @@ fn getShortImport( |
| 1012 | 1012 | fn writeSymbol(writer: *std.Io.Writer, symbol: std.coff.Symbol) !void { |
| 1013 | 1013 | try writer.writeAll(&symbol.name); |
| 1014 | 1014 | try writer.writeInt(u32, symbol.value, .little); |
| 1015 | try writer.writeInt(i16, @intFromEnum(symbol.section_number), .little); | |
| 1016 | try writer.writeInt(u8, @intFromEnum(symbol.type.base_type), .little); | |
| 1017 | try writer.writeInt(u8, @intFromEnum(symbol.type.complex_type), .little); | |
| 1018 | try writer.writeInt(u8, @intFromEnum(symbol.storage_class), .little); | |
| 1015 | try writer.writeInt(i16, @backingInt(symbol.section_number), .little); | |
| 1016 | try writer.writeInt(u8, @backingInt(symbol.type.base_type), .little); | |
| 1017 | try writer.writeInt(u8, @backingInt(symbol.type.complex_type), .little); | |
| 1018 | try writer.writeInt(u8, @backingInt(symbol.storage_class), .little); | |
| 1019 | 1019 | try writer.writeInt(u8, symbol.number_of_aux_symbols, .little); |
| 1020 | 1020 | } |
| 1021 | 1021 | |
| 1022 | 1022 | fn writeWeakExternalDefinition(writer: *std.Io.Writer, weak_external: std.coff.WeakExternalDefinition) !void { |
| 1023 | 1023 | try writer.writeInt(u32, weak_external.tag_index, .little); |
| 1024 | try writer.writeInt(u32, @intFromEnum(weak_external.flag), .little); | |
| 1024 | try writer.writeInt(u32, @backingInt(weak_external.flag), .little); | |
| 1025 | 1025 | try writer.writeAll(&weak_external.unused); |
| 1026 | 1026 | } |
| 1027 | 1027 | |
| ... | ... | @@ -1034,11 +1034,11 @@ fn writeRelocation(writer: *std.Io.Writer, relocation: std.coff.Relocation) !voi |
| 1034 | 1034 | // https://learn.microsoft.com/en-us/windows/win32/debug/pe-format#type-indicators |
| 1035 | 1035 | pub fn rvaRelocationTypeIndicator(target: std.coff.IMAGE.FILE.MACHINE) ?u16 { |
| 1036 | 1036 | return switch (target) { |
| 1037 | .AMD64 => @intFromEnum(std.coff.IMAGE.REL.AMD64.ADDR32NB), | |
| 1038 | .I386 => @intFromEnum(std.coff.IMAGE.REL.I386.DIR32NB), | |
| 1039 | .ARMNT => @intFromEnum(std.coff.IMAGE.REL.ARM.ADDR32NB), | |
| 1040 | .ARM64, .ARM64EC, .ARM64X => @intFromEnum(std.coff.IMAGE.REL.ARM64.ADDR32NB), | |
| 1041 | .IA64 => @intFromEnum(std.coff.IMAGE.REL.IA64.DIR32NB), | |
| 1037 | .AMD64 => @backingInt(std.coff.IMAGE.REL.AMD64.ADDR32NB), | |
| 1038 | .I386 => @backingInt(std.coff.IMAGE.REL.I386.DIR32NB), | |
| 1039 | .ARMNT => @backingInt(std.coff.IMAGE.REL.ARM.ADDR32NB), | |
| 1040 | .ARM64, .ARM64EC, .ARM64X => @backingInt(std.coff.IMAGE.REL.ARM64.ADDR32NB), | |
| 1041 | .IA64 => @backingInt(std.coff.IMAGE.REL.IA64.DIR32NB), | |
| 1042 | 1042 | else => null, |
| 1043 | 1043 | }; |
| 1044 | 1044 | } |
src/link.zig+2-2| ... | ... | @@ -386,7 +386,7 @@ pub const Diags = struct { |
| 386 | 386 | }); |
| 387 | 387 | const notes_start = try bundle.reserveNotes(@intCast(link_err.notes.len)); |
| 388 | 388 | for (link_err.notes, 0..) |note, i| { |
| 389 | bundle.extra.items[notes_start + i] = @intFromEnum(try bundle.addErrorMessage(.{ | |
| 389 | bundle.extra.items[notes_start + i] = @backingInt(try bundle.addErrorMessage(.{ | |
| 390 | 390 | .msg = try note.string(bundle, base), |
| 391 | 391 | })); |
| 392 | 392 | } |
| ... | ... | @@ -860,7 +860,7 @@ pub const File = struct { |
| 860 | 860 | { |
| 861 | 861 | const ti = ti_id.resolveFull(&pt.zcu.intern_pool).?; |
| 862 | 862 | const file = pt.zcu.fileByIndex(ti.file); |
| 863 | const inst = file.zir.?.instructions.get(@intFromEnum(ti.inst)); | |
| 863 | const inst = file.zir.?.instructions.get(@backingInt(ti.inst)); | |
| 864 | 864 | assert(inst.tag == .declaration); |
| 865 | 865 | } |
| 866 | 866 |
src/link/C.zig+14-14| ... | ... | @@ -211,7 +211,7 @@ pub fn addConst( |
| 211 | 211 | const zcu = pt.zcu; |
| 212 | 212 | const gpa = zcu.comp.gpa; |
| 213 | 213 | assert(zcu.intern_pool.typeOf(val) == .type_type); |
| 214 | assert(@intFromEnum(pool_index) == c.types.items.len); | |
| 214 | assert(@backingInt(pool_index) == c.types.items.len); | |
| 215 | 215 | |
| 216 | 216 | const ty: Type = .fromInterned(val); |
| 217 | 217 | |
| ... | ... | @@ -262,7 +262,7 @@ pub fn addConst( |
| 262 | 262 | _ = try codegen.CType.lower(ty, &deps, arena.allocator(), zcu); |
| 263 | 263 | // This call may add more items to `c.types`. |
| 264 | 264 | const type_deps = try c.addCTypeDependencies(pt, &deps); |
| 265 | c.types.items[@intFromEnum(pool_index)].deps = type_deps; | |
| 265 | c.types.items[@backingInt(pool_index)].deps = type_deps; | |
| 266 | 266 | } |
| 267 | 267 | } |
| 268 | 268 | |
| ... | ... | @@ -279,7 +279,7 @@ pub fn updateConstIncomplete( |
| 279 | 279 | assert(zcu.intern_pool.typeOf(val) == .type_type); |
| 280 | 280 | const ty: Type = .fromInterned(val); |
| 281 | 281 | |
| 282 | const rendered: *RenderedType = &c.types.items[@intFromEnum(index)]; | |
| 282 | const rendered: *RenderedType = &c.types.items[@backingInt(index)]; | |
| 283 | 283 | |
| 284 | 284 | rendered.errunion_definition = .empty; |
| 285 | 285 | rendered.definition_deps = .empty; |
| ... | ... | @@ -315,7 +315,7 @@ pub fn updateConst( |
| 315 | 315 | assert(zcu.intern_pool.typeOf(val) == .type_type); |
| 316 | 316 | const ty: Type = .fromInterned(val); |
| 317 | 317 | |
| 318 | const rendered: *RenderedType = &c.types.items[@intFromEnum(index)]; | |
| 318 | const rendered: *RenderedType = &c.types.items[@backingInt(index)]; | |
| 319 | 319 | |
| 320 | 320 | var arena: std.heap.ArenaAllocator = .init(gpa); |
| 321 | 321 | defer arena.deinit(); |
| ... | ... | @@ -371,7 +371,7 @@ pub fn updateConst( |
| 371 | 371 | { |
| 372 | 372 | // This call invalidates `rendered`. |
| 373 | 373 | const definition_deps = try c.addCTypeDependencies(pt, &deps); |
| 374 | c.types.items[@intFromEnum(index)].definition_deps = definition_deps; | |
| 374 | c.types.items[@backingInt(index)].definition_deps = definition_deps; | |
| 375 | 375 | } |
| 376 | 376 | } |
| 377 | 377 | |
| ... | ... | @@ -858,7 +858,7 @@ pub fn flush(c: *C, arena: Allocator, tid: Zcu.PerThread.Id, prog_node: std.Prog |
| 858 | 858 | while (true) { |
| 859 | 859 | if (index < need_types.count()) { |
| 860 | 860 | const pool_index = need_types.keys()[index]; |
| 861 | const rendered = &c.types.items[@intFromEnum(pool_index)]; | |
| 861 | const rendered = &c.types.items[@backingInt(pool_index)]; | |
| 862 | 862 | try mergeNeededCTypes( |
| 863 | 863 | c, |
| 864 | 864 | &need_types, |
| ... | ... | @@ -872,7 +872,7 @@ pub fn flush(c: *C, arena: Allocator, tid: Zcu.PerThread.Id, prog_node: std.Prog |
| 872 | 872 | |
| 873 | 873 | if (errunion_index < need_errunion_types.count()) { |
| 874 | 874 | const payload_pool_index = need_errunion_types.keys()[errunion_index]; |
| 875 | const rendered = &c.types.items[@intFromEnum(payload_pool_index)]; | |
| 875 | const rendered = &c.types.items[@backingInt(payload_pool_index)]; | |
| 876 | 876 | try mergeNeededCTypes( |
| 877 | 877 | c, |
| 878 | 878 | &need_types, |
| ... | ... | @@ -886,7 +886,7 @@ pub fn flush(c: *C, arena: Allocator, tid: Zcu.PerThread.Id, prog_node: std.Prog |
| 886 | 886 | |
| 887 | 887 | if (aligned_index < need_aligned_types.count()) { |
| 888 | 888 | const pool_index = need_aligned_types.keys()[aligned_index]; |
| 889 | const rendered = &c.types.items[@intFromEnum(pool_index)]; | |
| 889 | const rendered = &c.types.items[@backingInt(pool_index)]; | |
| 890 | 890 | try mergeNeededCTypes( |
| 891 | 891 | c, |
| 892 | 892 | &need_types, |
| ... | ... | @@ -916,7 +916,7 @@ pub fn flush(c: *C, arena: Allocator, tid: Zcu.PerThread.Id, prog_node: std.Prog |
| 916 | 916 | aligned_type_strings, |
| 917 | 917 | ) |pool_index, align_mask, *str_out| { |
| 918 | 918 | const ty: Type = .fromInterned(pool_index.val(&c.type_pool)); |
| 919 | const has_layout = c.types.items[@intFromEnum(pool_index)].errunion_definition.len > 0; | |
| 919 | const has_layout = c.types.items[@backingInt(pool_index)].errunion_definition.len > 0; | |
| 920 | 920 | for (0..@bitSizeOf(@TypeOf(align_mask))) |bit_index| { |
| 921 | 921 | switch (@as(u1, @truncate(align_mask >> @intCast(bit_index)))) { |
| 922 | 922 | 0 => continue, |
| ... | ... | @@ -1450,7 +1450,7 @@ const FlushTypes = struct { |
| 1450 | 1450 | const c = ft.c; |
| 1451 | 1451 | if (ft.aligned_status.contains(pool_index)) return; |
| 1452 | 1452 | if (ft.aligned_types.getIndex(pool_index)) |i| { |
| 1453 | const rendered = &c.types.items[@intFromEnum(pool_index)]; | |
| 1453 | const rendered = &c.types.items[@backingInt(pool_index)]; | |
| 1454 | 1454 | ft.processDepsAsFwd(&rendered.deps); |
| 1455 | 1455 | ft.f.appendBufAssumeCapacity(ft.aligned_type_strings[i]); |
| 1456 | 1456 | } |
| ... | ... | @@ -1459,7 +1459,7 @@ const FlushTypes = struct { |
| 1459 | 1459 | fn doTypeFwd(ft: *FlushTypes, pool_index: link.ConstPool.Index) void { |
| 1460 | 1460 | const c = ft.c; |
| 1461 | 1461 | if (ft.status.contains(pool_index)) return; |
| 1462 | const rendered = &c.types.items[@intFromEnum(pool_index)]; | |
| 1462 | const rendered = &c.types.items[@backingInt(pool_index)]; | |
| 1463 | 1463 | if (rendered.fwd_decl.len > 0) { |
| 1464 | 1464 | ft.f.appendBufAssumeCapacity(rendered.fwd_decl.get(c)); |
| 1465 | 1465 | ft.status.putAssumeCapacityNoClobber(pool_index, false); |
| ... | ... | @@ -1477,7 +1477,7 @@ const FlushTypes = struct { |
| 1477 | 1477 | if (ft.status.get(pool_index)) |completed| { |
| 1478 | 1478 | if (completed) return; |
| 1479 | 1479 | } |
| 1480 | const rendered = &c.types.items[@intFromEnum(pool_index)]; | |
| 1480 | const rendered = &c.types.items[@backingInt(pool_index)]; | |
| 1481 | 1481 | ft.processDeps(&rendered.definition_deps); |
| 1482 | 1482 | if (rendered.fwd_decl.len == 0 and ft.status.contains(pool_index)) { |
| 1483 | 1483 | // `doTypeFwd` already rendered the defintion, we just had to complete the type by |
| ... | ... | @@ -1495,7 +1495,7 @@ const FlushTypes = struct { |
| 1495 | 1495 | const c = ft.c; |
| 1496 | 1496 | const gop = ft.errunion_status.getOrPutAssumeCapacity(pool_index); |
| 1497 | 1497 | if (gop.found_existing) return; |
| 1498 | const rendered = &c.types.items[@intFromEnum(pool_index)]; | |
| 1498 | const rendered = &c.types.items[@backingInt(pool_index)]; | |
| 1499 | 1499 | ft.f.appendBufAssumeCapacity(rendered.errunion_fwd_decl.get(c)); |
| 1500 | 1500 | gop.value_ptr.* = false; |
| 1501 | 1501 | } |
| ... | ... | @@ -1504,7 +1504,7 @@ const FlushTypes = struct { |
| 1504 | 1504 | if (ft.errunion_status.get(pool_index)) |completed| { |
| 1505 | 1505 | if (completed) return; |
| 1506 | 1506 | } |
| 1507 | const rendered = &c.types.items[@intFromEnum(pool_index)]; | |
| 1507 | const rendered = &c.types.items[@backingInt(pool_index)]; | |
| 1508 | 1508 | ft.processDeps(&rendered.deps); |
| 1509 | 1509 | if (rendered.errunion_definition.len > 0) { |
| 1510 | 1510 | ft.f.appendBufAssumeCapacity(rendered.errunion_definition.get(c)); |
src/link/Coff.zig+148-148| ... | ... | @@ -234,11 +234,11 @@ pub const Node = union(enum) { |
| 234 | 234 | _, |
| 235 | 235 | |
| 236 | 236 | pub fn name(psmi: PseudoSectionMapIndex, coff: *const Coff) String { |
| 237 | return coff.pseudo_section_table.keys()[@intFromEnum(psmi)]; | |
| 237 | return coff.pseudo_section_table.keys()[@backingInt(psmi)]; | |
| 238 | 238 | } |
| 239 | 239 | |
| 240 | 240 | pub fn symbol(psmi: PseudoSectionMapIndex, coff: *const Coff) Symbol.Index { |
| 241 | return coff.pseudo_section_table.values()[@intFromEnum(psmi)]; | |
| 241 | return coff.pseudo_section_table.values()[@backingInt(psmi)]; | |
| 242 | 242 | } |
| 243 | 243 | }; |
| 244 | 244 | |
| ... | ... | @@ -246,11 +246,11 @@ pub const Node = union(enum) { |
| 246 | 246 | _, |
| 247 | 247 | |
| 248 | 248 | pub fn name(osmi: ObjectSectionMapIndex, coff: *const Coff) String { |
| 249 | return coff.object_section_table.keys()[@intFromEnum(osmi)]; | |
| 249 | return coff.object_section_table.keys()[@backingInt(osmi)]; | |
| 250 | 250 | } |
| 251 | 251 | |
| 252 | 252 | pub fn symbol(osmi: ObjectSectionMapIndex, coff: *const Coff) Symbol.Index { |
| 253 | return coff.object_section_table.values()[@intFromEnum(osmi)]; | |
| 253 | return coff.object_section_table.values()[@backingInt(osmi)]; | |
| 254 | 254 | } |
| 255 | 255 | }; |
| 256 | 256 | |
| ... | ... | @@ -259,13 +259,13 @@ pub const Node = union(enum) { |
| 259 | 259 | _, |
| 260 | 260 | |
| 261 | 261 | pub fn wrap(i: ?u32) GlobalMapIndex { |
| 262 | return @enumFromInt((i orelse return .none) + 1); | |
| 262 | return @fromBackingInt(@intCast((i orelse return .none) + 1)); | |
| 263 | 263 | } |
| 264 | 264 | |
| 265 | 265 | pub fn unwrap(gmi: GlobalMapIndex) ?u32 { |
| 266 | 266 | return switch (gmi) { |
| 267 | 267 | .none => null, |
| 268 | _ => @intFromEnum(gmi) - 1, | |
| 268 | _ => @backingInt(gmi) - 1, | |
| 269 | 269 | }; |
| 270 | 270 | } |
| 271 | 271 | |
| ... | ... | @@ -286,11 +286,11 @@ pub const Node = union(enum) { |
| 286 | 286 | _, |
| 287 | 287 | |
| 288 | 288 | pub fn navIndex(nmi: NavMapIndex, coff: *const Coff) InternPool.Nav.Index { |
| 289 | return coff.navs.keys()[@intFromEnum(nmi)]; | |
| 289 | return coff.navs.keys()[@backingInt(nmi)]; | |
| 290 | 290 | } |
| 291 | 291 | |
| 292 | 292 | pub fn symbol(nmi: NavMapIndex, coff: *const Coff) Symbol.Index { |
| 293 | return coff.navs.values()[@intFromEnum(nmi)]; | |
| 293 | return coff.navs.values()[@backingInt(nmi)]; | |
| 294 | 294 | } |
| 295 | 295 | }; |
| 296 | 296 | |
| ... | ... | @@ -298,11 +298,11 @@ pub const Node = union(enum) { |
| 298 | 298 | _, |
| 299 | 299 | |
| 300 | 300 | pub fn uavValue(umi: UavMapIndex, coff: *const Coff) InternPool.Index { |
| 301 | return coff.uavs.keys()[@intFromEnum(umi)]; | |
| 301 | return coff.uavs.keys()[@backingInt(umi)]; | |
| 302 | 302 | } |
| 303 | 303 | |
| 304 | 304 | pub fn symbol(umi: UavMapIndex, coff: *const Coff) Symbol.Index { |
| 305 | return coff.uavs.values()[@intFromEnum(umi)]; | |
| 305 | return coff.uavs.values()[@backingInt(umi)]; | |
| 306 | 306 | } |
| 307 | 307 | }; |
| 308 | 308 | |
| ... | ... | @@ -318,23 +318,23 @@ pub const Node = union(enum) { |
| 318 | 318 | _, |
| 319 | 319 | |
| 320 | 320 | pub fn inputSection(isi: Index, coff: *const Coff) *InputSection { |
| 321 | return &coff.input_sections.items[@intFromEnum(isi)]; | |
| 321 | return &coff.input_sections.items[@backingInt(isi)]; | |
| 322 | 322 | } |
| 323 | 323 | |
| 324 | 324 | pub fn input(isi: Index, coff: *const Coff) InputObject.Index { |
| 325 | return coff.input_sections.items[@intFromEnum(isi)].ioi; | |
| 325 | return coff.input_sections.items[@backingInt(isi)].ioi; | |
| 326 | 326 | } |
| 327 | 327 | |
| 328 | 328 | pub fn fileLocation(isi: Index, coff: *const Coff) MappedFile.Node.FileLocation { |
| 329 | return coff.input_sections.items[@intFromEnum(isi)].file_location; | |
| 329 | return coff.input_sections.items[@backingInt(isi)].file_location; | |
| 330 | 330 | } |
| 331 | 331 | |
| 332 | 332 | pub fn symbol(isi: Index, coff: *const Coff) Symbol.Index { |
| 333 | return coff.input_sections.items[@intFromEnum(isi)].si; | |
| 333 | return coff.input_sections.items[@backingInt(isi)].si; | |
| 334 | 334 | } |
| 335 | 335 | |
| 336 | 336 | pub fn firstSymbol(isi: Index, coff: *const Coff) LocalIndex { |
| 337 | return coff.input_sections.items[@intFromEnum(isi)].first_li; | |
| 337 | return coff.input_sections.items[@backingInt(isi)].first_li; | |
| 338 | 338 | } |
| 339 | 339 | }; |
| 340 | 340 | |
| ... | ... | @@ -342,7 +342,7 @@ pub const Node = union(enum) { |
| 342 | 342 | _, |
| 343 | 343 | |
| 344 | 344 | pub fn name(isli: LocalIndex, coff: *const Coff) String { |
| 345 | return coff.input_symbols.items[@intFromEnum(isli)].name; | |
| 345 | return coff.input_symbols.items[@backingInt(isli)].name; | |
| 346 | 346 | } |
| 347 | 347 | }; |
| 348 | 348 | }; |
| ... | ... | @@ -356,7 +356,7 @@ pub const Node = union(enum) { |
| 356 | 356 | _, |
| 357 | 357 | |
| 358 | 358 | pub fn ref(lmi: @This()) LazyMapRef { |
| 359 | return .{ .kind = kind, .index = @intFromEnum(lmi) }; | |
| 359 | return .{ .kind = kind, .index = @backingInt(lmi) }; | |
| 360 | 360 | } |
| 361 | 361 | |
| 362 | 362 | pub fn lazySymbol(lmi: @This(), coff: *const Coff) link.File.LazySymbol { |
| ... | ... | @@ -402,7 +402,7 @@ pub const Node = union(enum) { |
| 402 | 402 | var mut_known: std.enums.EnumFieldStruct(Known, MappedFile.Node.Index, null) = undefined; |
| 403 | 403 | const info = @typeInfo(Known).@"enum"; |
| 404 | 404 | for (info.field_names, info.field_values) |field_name, field_value| |
| 405 | @field(mut_known, field_name) = @enumFromInt(field_value); | |
| 405 | @field(mut_known, field_name) = @fromBackingInt(@intCast(field_value)); | |
| 406 | 406 | break :known mut_known; |
| 407 | 407 | }; |
| 408 | 408 | |
| ... | ... | @@ -418,7 +418,7 @@ pub const InputArchive = struct { |
| 418 | 418 | _, |
| 419 | 419 | |
| 420 | 420 | pub fn path(iai: InputArchive.Index, coff: *Coff) std.Build.Cache.Path { |
| 421 | return coff.input_archives.items[@intFromEnum(iai)].path; | |
| 421 | return coff.input_archives.items[@backingInt(iai)].path; | |
| 422 | 422 | } |
| 423 | 423 | }; |
| 424 | 424 | |
| ... | ... | @@ -446,7 +446,7 @@ pub const InputArchive = struct { |
| 446 | 446 | _, |
| 447 | 447 | |
| 448 | 448 | pub fn member(iami: InputArchive.Member.Index, coff: *Coff) *InputArchive.Member { |
| 449 | return &coff.input_archive_members.items[@intFromEnum(iami)]; | |
| 449 | return &coff.input_archive_members.items[@backingInt(iami)]; | |
| 450 | 450 | } |
| 451 | 451 | }; |
| 452 | 452 | |
| ... | ... | @@ -476,11 +476,11 @@ pub const InputObject = struct { |
| 476 | 476 | _, |
| 477 | 477 | |
| 478 | 478 | pub fn path(ioi: Index, coff: *const Coff) std.Build.Cache.Path { |
| 479 | return coff.input_objects.items[@intFromEnum(ioi)].path; | |
| 479 | return coff.input_objects.items[@backingInt(ioi)].path; | |
| 480 | 480 | } |
| 481 | 481 | |
| 482 | 482 | pub fn memberName(ioi: Index, coff: *const Coff) ?[]const u8 { |
| 483 | return coff.input_objects.items[@intFromEnum(ioi)].member_name; | |
| 483 | return coff.input_objects.items[@backingInt(ioi)].member_name; | |
| 484 | 484 | } |
| 485 | 485 | }; |
| 486 | 486 | }; |
| ... | ... | @@ -503,7 +503,7 @@ pub const Member = struct { |
| 503 | 503 | const known_count = @typeInfo(Index).@"enum".field_names.len; |
| 504 | 504 | |
| 505 | 505 | pub fn get(member_index: Member.Index, coff: *Coff) *Member { |
| 506 | return &coff.members.items[@intFromEnum(member_index)]; | |
| 506 | return &coff.members.items[@backingInt(member_index)]; | |
| 507 | 507 | } |
| 508 | 508 | }; |
| 509 | 509 | |
| ... | ... | @@ -657,7 +657,7 @@ pub const SymbolTable = struct { |
| 657 | 657 | }, |
| 658 | 658 | .long => |l| { |
| 659 | 659 | @memset(field[0..4], 0); |
| 660 | std.mem.writePackedInt(u32, field[4..], 0, @intFromEnum(l), coff.targetEndian()); | |
| 660 | std.mem.writePackedInt(u32, field[4..], 0, @backingInt(l), coff.targetEndian()); | |
| 661 | 661 | }, |
| 662 | 662 | } |
| 663 | 663 | } |
| ... | ... | @@ -671,13 +671,13 @@ pub const SymbolTable = struct { |
| 671 | 671 | _, |
| 672 | 672 | |
| 673 | 673 | pub fn wrap(i: u32) Index { |
| 674 | return @enumFromInt(i + 1); | |
| 674 | return @fromBackingInt(@intCast(i + 1)); | |
| 675 | 675 | } |
| 676 | 676 | |
| 677 | 677 | pub fn unwrap(sti: Index) ?u32 { |
| 678 | 678 | return switch (sti) { |
| 679 | 679 | .none => null, |
| 680 | _ => @intFromEnum(sti) - 1, | |
| 680 | _ => @backingInt(sti) - 1, | |
| 681 | 681 | }; |
| 682 | 682 | } |
| 683 | 683 | }; |
| ... | ... | @@ -720,7 +720,7 @@ pub const ExportTable = struct { |
| 720 | 720 | _, |
| 721 | 721 | |
| 722 | 722 | pub fn get(export_index: ExportTable.Ordinal, coff: *Coff) *Entry { |
| 723 | return &coff.export_table.entries.values()[@intFromEnum(export_index)]; | |
| 723 | return &coff.export_table.entries.values()[@backingInt(export_index)]; | |
| 724 | 724 | } |
| 725 | 725 | }; |
| 726 | 726 | }; |
| ... | ... | @@ -768,7 +768,7 @@ pub const ImportTable = struct { |
| 768 | 768 | _, |
| 769 | 769 | |
| 770 | 770 | pub fn get(import_index: ImportTable.Index, coff: *Coff) *Entry { |
| 771 | return &coff.import_table.entries.values()[@intFromEnum(import_index)]; | |
| 771 | return &coff.import_table.entries.values()[@backingInt(import_index)]; | |
| 772 | 772 | } |
| 773 | 773 | }; |
| 774 | 774 | }; |
| ... | ... | @@ -791,26 +791,26 @@ pub const String = enum(u32) { |
| 791 | 791 | _, |
| 792 | 792 | |
| 793 | 793 | pub const Optional = enum(u32) { |
| 794 | @".data" = @intFromEnum(String.@".data"), | |
| 795 | @".idata" = @intFromEnum(String.@".idata"), | |
| 796 | @".rdata" = @intFromEnum(String.@".rdata"), | |
| 797 | @".text" = @intFromEnum(String.@".text"), | |
| 798 | @".tls$" = @intFromEnum(String.@".tls$"), | |
| 799 | @".edata" = @intFromEnum(String.@".edata"), | |
| 800 | @".ctors" = @intFromEnum(String.@".ctors"), | |
| 801 | @".ctors$ZZZ" = @intFromEnum(String.@".ctors$ZZZ"), | |
| 802 | @".dtors" = @intFromEnum(String.@".dtors"), | |
| 803 | @".dtors$ZZZ" = @intFromEnum(String.@".dtors$ZZZ"), | |
| 804 | @".bss" = @intFromEnum(String.@".bss"), | |
| 805 | @".fptable" = @intFromEnum(String.@".fptable"), | |
| 806 | @".tls" = @intFromEnum(String.@".tls"), | |
| 807 | @".thunks" = @intFromEnum(String.@".thunks"), | |
| 794 | @".data" = @backingInt(String.@".data"), | |
| 795 | @".idata" = @backingInt(String.@".idata"), | |
| 796 | @".rdata" = @backingInt(String.@".rdata"), | |
| 797 | @".text" = @backingInt(String.@".text"), | |
| 798 | @".tls$" = @backingInt(String.@".tls$"), | |
| 799 | @".edata" = @backingInt(String.@".edata"), | |
| 800 | @".ctors" = @backingInt(String.@".ctors"), | |
| 801 | @".ctors$ZZZ" = @backingInt(String.@".ctors$ZZZ"), | |
| 802 | @".dtors" = @backingInt(String.@".dtors"), | |
| 803 | @".dtors$ZZZ" = @backingInt(String.@".dtors$ZZZ"), | |
| 804 | @".bss" = @backingInt(String.@".bss"), | |
| 805 | @".fptable" = @backingInt(String.@".fptable"), | |
| 806 | @".tls" = @backingInt(String.@".tls"), | |
| 807 | @".thunks" = @backingInt(String.@".thunks"), | |
| 808 | 808 | none = std.math.maxInt(u32), |
| 809 | 809 | _, |
| 810 | 810 | |
| 811 | 811 | pub fn unwrap(os: String.Optional) ?String { |
| 812 | 812 | return switch (os) { |
| 813 | else => |s| @enumFromInt(@intFromEnum(s)), | |
| 813 | else => |s| @fromBackingInt(@intCast(@backingInt(s))), | |
| 814 | 814 | .none => null, |
| 815 | 815 | }; |
| 816 | 816 | } |
| ... | ... | @@ -821,12 +821,12 @@ pub const String = enum(u32) { |
| 821 | 821 | }; |
| 822 | 822 | |
| 823 | 823 | pub fn toSlice(s: String, coff: *Coff) [:0]const u8 { |
| 824 | const slice = coff.string_bytes.items[@intFromEnum(s)..]; | |
| 824 | const slice = coff.string_bytes.items[@backingInt(s)..]; | |
| 825 | 825 | return slice[0..std.mem.indexOfScalar(u8, slice, 0).? :0]; |
| 826 | 826 | } |
| 827 | 827 | |
| 828 | 828 | pub fn toOptional(s: String) String.Optional { |
| 829 | return @enumFromInt(@intFromEnum(s)); | |
| 829 | return @fromBackingInt(@intCast(@backingInt(s))); | |
| 830 | 830 | } |
| 831 | 831 | }; |
| 832 | 832 | |
| ... | ... | @@ -839,13 +839,13 @@ pub const Section = struct { |
| 839 | 839 | _, |
| 840 | 840 | |
| 841 | 841 | pub fn wrap(i: ?u16) RelocationIndex { |
| 842 | return @enumFromInt((i orelse return .none) + 1); | |
| 842 | return @fromBackingInt(@intCast((i orelse return .none) + 1)); | |
| 843 | 843 | } |
| 844 | 844 | |
| 845 | 845 | pub fn unwrap(sri: RelocationIndex) ?u16 { |
| 846 | 846 | return switch (sri) { |
| 847 | 847 | .none => null, |
| 848 | _ => @intFromEnum(sri) - 1, | |
| 848 | _ => @backingInt(sri) - 1, | |
| 849 | 849 | }; |
| 850 | 850 | } |
| 851 | 851 | |
| ... | ... | @@ -1008,11 +1008,11 @@ pub const Symbol = struct { |
| 1008 | 1008 | _, |
| 1009 | 1009 | |
| 1010 | 1010 | fn toIndex(sn: SectionNumber) u15 { |
| 1011 | return @intCast(@intFromEnum(sn) - 1); | |
| 1011 | return @intCast(@backingInt(sn) - 1); | |
| 1012 | 1012 | } |
| 1013 | 1013 | |
| 1014 | 1014 | fn hasIndex(sn: SectionNumber) bool { |
| 1015 | return @intFromEnum(sn) > 0; | |
| 1015 | return @backingInt(sn) > 0; | |
| 1016 | 1016 | } |
| 1017 | 1017 | |
| 1018 | 1018 | pub fn symbol(sn: SectionNumber, coff: *const Coff) Symbol.Index { |
| ... | ... | @@ -1043,7 +1043,7 @@ pub const Symbol = struct { |
| 1043 | 1043 | const known_count = @typeInfo(Index).@"enum".field_names.len; |
| 1044 | 1044 | |
| 1045 | 1045 | pub fn get(si: Symbol.Index, coff: *Coff) *Symbol { |
| 1046 | return &coff.symbols.items[@intFromEnum(si)]; | |
| 1046 | return &coff.symbols.items[@backingInt(si)]; | |
| 1047 | 1047 | } |
| 1048 | 1048 | |
| 1049 | 1049 | pub fn unwrap(si: Symbol.Index) ?Symbol.Index { |
| ... | ... | @@ -1063,7 +1063,7 @@ pub const Symbol = struct { |
| 1063 | 1063 | } |
| 1064 | 1064 | |
| 1065 | 1065 | pub fn next(si: Symbol.Index) Symbol.Index { |
| 1066 | return @enumFromInt(@intFromEnum(si) + 1); | |
| 1066 | return @fromBackingInt(@intCast(@backingInt(si) + 1)); | |
| 1067 | 1067 | } |
| 1068 | 1068 | |
| 1069 | 1069 | pub fn knownString(si: Symbol.Index) String.Optional { |
| ... | ... | @@ -1107,7 +1107,7 @@ pub const Symbol = struct { |
| 1107 | 1107 | switch (sym.loc_relocs) { |
| 1108 | 1108 | .none => {}, |
| 1109 | 1109 | else => |loc_relocs| { |
| 1110 | for (coff.relocs.items[@intFromEnum(loc_relocs)..]) |*reloc| { | |
| 1110 | for (coff.relocs.items[@backingInt(loc_relocs)..]) |*reloc| { | |
| 1111 | 1111 | if (reloc.loc != si) break; |
| 1112 | 1112 | if (reloc.sri.entry(coff, sym.section_number)) |entry| coff.targetStore( |
| 1113 | 1113 | &entry.virtual_address, |
| ... | ... | @@ -1136,7 +1136,7 @@ pub const Symbol = struct { |
| 1136 | 1136 | switch (sym.loc_relocs) { |
| 1137 | 1137 | .none => {}, |
| 1138 | 1138 | else => |loc_relocs| { |
| 1139 | for (coff.relocs.items[@intFromEnum(loc_relocs)..]) |*reloc| { | |
| 1139 | for (coff.relocs.items[@backingInt(loc_relocs)..]) |*reloc| { | |
| 1140 | 1140 | if (reloc.loc != si) break; |
| 1141 | 1141 | reloc.delete(coff); |
| 1142 | 1142 | } |
| ... | ... | @@ -1189,11 +1189,11 @@ pub const Reloc = extern struct { |
| 1189 | 1189 | _, |
| 1190 | 1190 | |
| 1191 | 1191 | pub fn wrap(i: ?u32) Reloc.Index { |
| 1192 | return @enumFromInt((i orelse return .none) + 1); | |
| 1192 | return @fromBackingInt(@intCast((i orelse return .none) + 1)); | |
| 1193 | 1193 | } |
| 1194 | 1194 | |
| 1195 | 1195 | pub fn get(ri: Reloc.Index, coff: *Coff) *Reloc { |
| 1196 | return &coff.relocs.items[@intFromEnum(ri)]; | |
| 1196 | return &coff.relocs.items[@backingInt(ri)]; | |
| 1197 | 1197 | } |
| 1198 | 1198 | }; |
| 1199 | 1199 | |
| ... | ... | @@ -1574,13 +1574,13 @@ fn create( |
| 1574 | 1574 | else => return error.UnsupportedCOFFArchitecture, |
| 1575 | 1575 | }; |
| 1576 | 1576 | const section_align: std.mem.Alignment = switch (machine) { |
| 1577 | .AMD64, .I386 => @enumFromInt(12), | |
| 1578 | .SH3, .SH3DSP, .SH4, .SH5 => @enumFromInt(12), | |
| 1579 | .MIPS16, .MIPSFPU, .MIPSFPU16, .WCEMIPSV2 => @enumFromInt(12), | |
| 1580 | .POWERPC, .POWERPCFP => @enumFromInt(12), | |
| 1581 | .ALPHA, .ALPHA64 => @enumFromInt(13), | |
| 1582 | .IA64 => @enumFromInt(13), | |
| 1583 | .ARM => @enumFromInt(12), | |
| 1577 | .AMD64, .I386 => @fromBackingInt(@intCast(12)), | |
| 1578 | .SH3, .SH3DSP, .SH4, .SH5 => @fromBackingInt(@intCast(12)), | |
| 1579 | .MIPS16, .MIPSFPU, .MIPSFPU16, .WCEMIPSV2 => @fromBackingInt(@intCast(12)), | |
| 1580 | .POWERPC, .POWERPCFP => @fromBackingInt(@intCast(12)), | |
| 1581 | .ALPHA, .ALPHA64 => @fromBackingInt(@intCast(13)), | |
| 1582 | .IA64 => @fromBackingInt(@intCast(13)), | |
| 1583 | .ARM => @fromBackingInt(@intCast(12)), | |
| 1584 | 1584 | else => return error.UnsupportedCOFFArchitecture, |
| 1585 | 1585 | }; |
| 1586 | 1586 | |
| ... | ... | @@ -2193,7 +2193,7 @@ fn initHeaders( |
| 2193 | 2193 | const export_address_table_sym = coff.export_table.export_address_table_si.get(coff); |
| 2194 | 2194 | export_address_table_sym.ni = export_address_table_ni; |
| 2195 | 2195 | assert(export_address_table_sym.loc_relocs == .none); |
| 2196 | export_address_table_sym.loc_relocs = @enumFromInt(coff.relocs.items.len); | |
| 2196 | export_address_table_sym.loc_relocs = @fromBackingInt(@intCast(coff.relocs.items.len)); | |
| 2197 | 2197 | export_address_table_sym.section_number = |
| 2198 | 2198 | coff.getNode(coff.export_table.ni).pseudo_section.symbol(coff).get(coff).section_number; |
| 2199 | 2199 | |
| ... | ... | @@ -2383,7 +2383,7 @@ pub fn endProgress(coff: *Coff) void { |
| 2383 | 2383 | } |
| 2384 | 2384 | |
| 2385 | 2385 | fn getNode(coff: *const Coff, ni: MappedFile.Node.Index) Node { |
| 2386 | return coff.nodes.get(@intFromEnum(ni)); | |
| 2386 | return coff.nodes.get(@backingInt(ni)); | |
| 2387 | 2387 | } |
| 2388 | 2388 | fn computeNodeRva(coff: *Coff, ni: MappedFile.Node.Index) u32 { |
| 2389 | 2389 | const parent_rva = parent_rva: { |
| ... | ... | @@ -2499,7 +2499,7 @@ fn targetLoad(coff: *const Coff, ptr: anytype) @typeInfo(@TypeOf(ptr)).pointer.c |
| 2499 | 2499 | return switch (@typeInfo(Child)) { |
| 2500 | 2500 | else => @compileError(@typeName(Child)), |
| 2501 | 2501 | .int => std.mem.toNative(Child, ptr.*, coff.targetEndian()), |
| 2502 | .@"enum" => |@"enum"| @enumFromInt(coff.targetLoad(@as(*@"enum".tag_type, @ptrCast(ptr)))), | |
| 2502 | .@"enum" => |@"enum"| @fromBackingInt(@intCast(coff.targetLoad(@as(*@"enum".tag_type, @ptrCast(ptr))))), | |
| 2503 | 2503 | .@"struct" => |@"struct"| @bitCast( |
| 2504 | 2504 | coff.targetLoad(@as(*@"struct".backing_integer.?, @ptrCast(ptr))), |
| 2505 | 2505 | ), |
| ... | ... | @@ -2512,7 +2512,7 @@ fn targetStore(coff: *const Coff, ptr: anytype, val: @typeInfo(@TypeOf(ptr)).poi |
| 2512 | 2512 | .int => ptr.* = std.mem.nativeTo(Child, val, coff.targetEndian()), |
| 2513 | 2513 | .@"enum" => |@"enum"| coff.targetStore( |
| 2514 | 2514 | @as(*@"enum".tag_type, @ptrCast(ptr)), |
| 2515 | @intFromEnum(val), | |
| 2515 | @backingInt(val), | |
| 2516 | 2516 | ), |
| 2517 | 2517 | .@"struct" => |@"struct"| coff.targetStore( |
| 2518 | 2518 | @as(*@"struct".backing_integer.?, @ptrCast(ptr)), |
| ... | ... | @@ -2613,7 +2613,7 @@ pub fn dataDirectoryPtr( |
| 2613 | 2613 | coff: *Coff, |
| 2614 | 2614 | entry: std.coff.IMAGE.DIRECTORY_ENTRY, |
| 2615 | 2615 | ) *std.coff.ImageDataDirectory { |
| 2616 | return &coff.dataDirectorySlice()[@intFromEnum(entry)]; | |
| 2616 | return &coff.dataDirectorySlice()[@backingInt(entry)]; | |
| 2617 | 2617 | } |
| 2618 | 2618 | |
| 2619 | 2619 | pub fn sectionTableSlice(coff: *Coff) []std.coff.SectionHeader { |
| ... | ... | @@ -2665,7 +2665,7 @@ pub fn importDirectoryEntryPtr( |
| 2665 | 2665 | coff: *Coff, |
| 2666 | 2666 | import_index: ImportTable.Index, |
| 2667 | 2667 | ) *std.coff.ImportDirectoryEntry { |
| 2668 | return &coff.importDirectoryTableSlice()[@intFromEnum(import_index)]; | |
| 2668 | return &coff.importDirectoryTableSlice()[@backingInt(import_index)]; | |
| 2669 | 2669 | } |
| 2670 | 2670 | |
| 2671 | 2671 | pub fn exportDirectoryTable(coff: *Coff) *std.coff.ExportDirectoryTable { |
| ... | ... | @@ -2701,7 +2701,7 @@ fn addSymbolAssumeCapacity(coff: *Coff) Symbol.Index { |
| 2701 | 2701 | .section_number = .UNDEFINED, |
| 2702 | 2702 | .gmi = .none, |
| 2703 | 2703 | }; |
| 2704 | return @enumFromInt(coff.symbols.items.len); | |
| 2704 | return @fromBackingInt(@intCast(coff.symbols.items.len)); | |
| 2705 | 2705 | } |
| 2706 | 2706 | |
| 2707 | 2707 | fn initSymbolAssumeCapacity(coff: *Coff) !Symbol.Index { |
| ... | ... | @@ -2721,7 +2721,7 @@ fn getString(coff: *Coff, string: []const u8) String.Optional { |
| 2721 | 2721 | string, |
| 2722 | 2722 | std.hash_map.StringIndexAdapter{ .bytes = &coff.string_bytes }, |
| 2723 | 2723 | )) |key| |
| 2724 | return @as(String, @enumFromInt(key)).toOptional() | |
| 2724 | return @as(String, @fromBackingInt(@intCast(key))).toOptional() | |
| 2725 | 2725 | else |
| 2726 | 2726 | return .none; |
| 2727 | 2727 | } |
| ... | ... | @@ -2739,7 +2739,7 @@ fn getOrPutSymbolName(coff: *Coff, name: []const u8, opt_string: ?String) !Symbo |
| 2739 | 2739 | const string_gop = try coff.symbol_table.strings.getOrPut(gpa, string); |
| 2740 | 2740 | if (!string_gop.found_existing) { |
| 2741 | 2741 | const string_index = coff.symbol_table.strings_ni.location(&coff.mf).resolve(&coff.mf)[1]; |
| 2742 | string_gop.value_ptr.* = @enumFromInt(string_index); | |
| 2742 | string_gop.value_ptr.* = @fromBackingInt(@intCast(string_index)); | |
| 2743 | 2743 | |
| 2744 | 2744 | try coff.symbol_table.strings_ni.resize(&coff.mf, gpa, string_index + name.len + 1); |
| 2745 | 2745 | const slice = coff.symbol_table.strings_ni.slice(&coff.mf); |
| ... | ... | @@ -2776,7 +2776,7 @@ fn getOrPutStringAssumeCapacity(coff: *Coff, string: []const u8) String { |
| 2776 | 2776 | coff.string_bytes.appendSliceAssumeCapacity(string); |
| 2777 | 2777 | coff.string_bytes.appendAssumeCapacity(0); |
| 2778 | 2778 | } |
| 2779 | return @enumFromInt(gop.key_ptr.*); | |
| 2779 | return @fromBackingInt(@intCast(gop.key_ptr.*)); | |
| 2780 | 2780 | } |
| 2781 | 2781 | |
| 2782 | 2782 | const GlobalOptions = struct { |
| ... | ... | @@ -2887,7 +2887,7 @@ fn navMapIndex(coff: *Coff, zcu: *Zcu, nav_index: InternPool.Nav.Index) !Node.Na |
| 2887 | 2887 | try coff.symbols.ensureUnusedCapacity(gpa, 1); |
| 2888 | 2888 | const sym_gop = try coff.navs.getOrPut(gpa, nav_index); |
| 2889 | 2889 | if (!sym_gop.found_existing) sym_gop.value_ptr.* = coff.addSymbolAssumeCapacity(); |
| 2890 | return @enumFromInt(sym_gop.index); | |
| 2890 | return @fromBackingInt(@intCast(sym_gop.index)); | |
| 2891 | 2891 | } |
| 2892 | 2892 | pub fn navSymbol(coff: *Coff, zcu: *Zcu, nav_index: InternPool.Nav.Index) !Symbol.Index { |
| 2893 | 2893 | const ip = &zcu.intern_pool; |
| ... | ... | @@ -2908,7 +2908,7 @@ fn uavMapIndex(coff: *Coff, uav_val: InternPool.Index) !Node.UavMapIndex { |
| 2908 | 2908 | try coff.symbols.ensureUnusedCapacity(gpa, 1); |
| 2909 | 2909 | const sym_gop = try coff.uavs.getOrPut(gpa, uav_val); |
| 2910 | 2910 | if (!sym_gop.found_existing) sym_gop.value_ptr.* = coff.addSymbolAssumeCapacity(); |
| 2911 | return @enumFromInt(sym_gop.index); | |
| 2911 | return @fromBackingInt(@intCast(sym_gop.index)); | |
| 2912 | 2912 | } |
| 2913 | 2913 | pub fn uavSymbol(coff: *Coff, uav_val: InternPool.Index) !Symbol.Index { |
| 2914 | 2914 | const umi = try coff.uavMapIndex(uav_val); |
| ... | ... | @@ -2945,7 +2945,7 @@ pub fn getUavVAddr( |
| 2945 | 2945 | |
| 2946 | 2946 | pub fn getVAddr(coff: *Coff, reloc_info: link.File.RelocInfo, target_si: Symbol.Index) link.Error!u64 { |
| 2947 | 2947 | try coff.addReloc( |
| 2948 | @enumFromInt(@intFromEnum(reloc_info.parent.atom_index)), | |
| 2948 | @fromBackingInt(@intCast(@backingInt(reloc_info.parent.atom_index))), | |
| 2949 | 2949 | reloc_info.offset, |
| 2950 | 2950 | target_si, |
| 2951 | 2951 | .{ .known = reloc_info.addend }, |
| ... | ... | @@ -2986,7 +2986,7 @@ fn addMemberAssumeCapacity(coff: *Coff, kind: std.coff.ArchiveMemberHeader.Kind, |
| 2986 | 2986 | .fixed = true, |
| 2987 | 2987 | }); |
| 2988 | 2988 | |
| 2989 | const mi: Member.Index = @enumFromInt(coff.members.items.len); | |
| 2989 | const mi: Member.Index = @fromBackingInt(@intCast(coff.members.items.len)); | |
| 2990 | 2990 | coff.members.appendAssumeCapacity(.{ |
| 2991 | 2991 | .kind = kind, |
| 2992 | 2992 | .header_ni = header_ni, |
| ... | ... | @@ -3065,7 +3065,7 @@ fn ensureMemberSymbol(coff: *Coff, mi: Member.Index, name: String) !void { |
| 3065 | 3065 | const num_symbols_ptr = coff.firstLinkerMemberNumSymbolsPtr(); |
| 3066 | 3066 | const num_symbols = std.mem.toNative(u32, num_symbols_ptr.*, .big); |
| 3067 | 3067 | num_symbols_ptr.* = std.mem.nativeTo(u32, num_symbols + 1, .big); |
| 3068 | break :blk @enumFromInt(num_symbols); | |
| 3068 | break :blk @fromBackingInt(@intCast(num_symbols)); | |
| 3069 | 3069 | }; |
| 3070 | 3070 | |
| 3071 | 3071 | gop.value_ptr.* = mfli; |
| ... | ... | @@ -3078,7 +3078,7 @@ fn ensureMemberSymbol(coff: *Coff, mi: Member.Index, name: String) !void { |
| 3078 | 3078 | defer coff.lib_string_len = new_string_table_size; |
| 3079 | 3079 | |
| 3080 | 3080 | { |
| 3081 | const old_header_size: usize = @intCast(@sizeOf(u32) + @intFromEnum(mfli) * @sizeOf(u32)); | |
| 3081 | const old_header_size: usize = @intCast(@sizeOf(u32) + @backingInt(mfli) * @sizeOf(u32)); | |
| 3082 | 3082 | const new_header_size: usize = @intCast(old_header_size + @sizeOf(u32)); |
| 3083 | 3083 | try Node.known.first_linker_member.resize(&coff.mf, gpa, new_header_size + new_string_table_size); |
| 3084 | 3084 | |
| ... | ... | @@ -3092,7 +3092,7 @@ fn ensureMemberSymbol(coff: *Coff, mi: Member.Index, name: String) !void { |
| 3092 | 3092 | |
| 3093 | 3093 | { |
| 3094 | 3094 | const num_members = coff.targetLoad(coff.secondLinkerMemberNumMembersPtr()); |
| 3095 | const old_header_size = 2 * @sizeOf(u32) + num_members * @sizeOf(u32) + @intFromEnum(mfli) * @sizeOf(u16); | |
| 3095 | const old_header_size = 2 * @sizeOf(u32) + num_members * @sizeOf(u32) + @backingInt(mfli) * @sizeOf(u16); | |
| 3096 | 3096 | const new_header_size = old_header_size + @sizeOf(u16); |
| 3097 | 3097 | try Node.known.second_linker_member.resize(&coff.mf, gpa, new_header_size + new_string_table_size); |
| 3098 | 3098 | |
| ... | ... | @@ -3109,7 +3109,7 @@ fn ensureMemberSymbol(coff: *Coff, mi: Member.Index, name: String) !void { |
| 3109 | 3109 | try coff.lib_string_table.append(gpa, name); |
| 3110 | 3110 | |
| 3111 | 3111 | const slice = Node.known.second_linker_member.slice(&coff.mf); |
| 3112 | coff.targetStore(coff.secondLinkerMemberNumSymbolsPtr(), @intFromEnum(mfli) + 1); | |
| 3112 | coff.targetStore(coff.secondLinkerMemberNumSymbolsPtr(), @backingInt(mfli) + 1); | |
| 3113 | 3113 | if (!needs_sort) { |
| 3114 | 3114 | @memmove(slice[new_header_size..][0..coff.lib_string_len], slice[old_header_size..][0..coff.lib_string_len]); |
| 3115 | 3115 | @memcpy(slice[new_header_size + coff.lib_string_len ..][0..name_slice.len], name_slice[0..name_slice.len]); |
| ... | ... | @@ -3121,7 +3121,7 @@ fn ensureMemberSymbol(coff: *Coff, mi: Member.Index, name: String) !void { |
| 3121 | 3121 | |
| 3122 | 3122 | // Indices in this table are 1-based |
| 3123 | 3123 | const index_ptr: *u16 = @ptrCast(@alignCast(slice[old_header_size..])); |
| 3124 | coff.targetStore(index_ptr, @intCast(@intFromEnum(mi) - Member.Index.known_count + 1)); | |
| 3124 | coff.targetStore(index_ptr, @intCast(@backingInt(mi) - Member.Index.known_count + 1)); | |
| 3125 | 3125 | } |
| 3126 | 3126 | |
| 3127 | 3127 | coff.pending_members.putAssumeCapacity(mi, {}); |
| ... | ... | @@ -3209,7 +3209,7 @@ fn flushSymbolTableEntry(coff: *Coff, index: u32, pt: Zcu.PerThread) !void { |
| 3209 | 3209 | const entry = coff.symbolTableEntryPtr(sti.*).?; |
| 3210 | 3210 | symbol_name.store(coff, &entry.name); |
| 3211 | 3211 | |
| 3212 | entry.section_number = @enumFromInt(@intFromEnum(sym.section_number)); | |
| 3212 | entry.section_number = @fromBackingInt(@intCast(@backingInt(sym.section_number))); | |
| 3213 | 3213 | entry.type = .{ |
| 3214 | 3214 | .complex_type = complex_type, |
| 3215 | 3215 | .base_type = .NULL, |
| ... | ... | @@ -3399,7 +3399,7 @@ fn addSection(coff: *Coff, name: String, flags: std.coff.SectionHeader.Flags) !S |
| 3399 | 3399 | const sym = si.get(coff); |
| 3400 | 3400 | sym.ni = ni; |
| 3401 | 3401 | sym.rva = rva; |
| 3402 | sym.section_number = @enumFromInt(section_table_len); | |
| 3402 | sym.section_number = @fromBackingInt(@intCast(section_table_len)); | |
| 3403 | 3403 | } |
| 3404 | 3404 | const section = &section_table[section_index]; |
| 3405 | 3405 | section.* = .{ |
| ... | ... | @@ -3486,7 +3486,7 @@ fn pseudoSectionMapIndex( |
| 3486 | 3486 | ) !Node.PseudoSectionMapIndex { |
| 3487 | 3487 | const gpa = coff.base.comp.gpa; |
| 3488 | 3488 | const pseudo_section_gop = try coff.pseudo_section_table.getOrPut(gpa, name); |
| 3489 | const psmi: Node.PseudoSectionMapIndex = @enumFromInt(pseudo_section_gop.index); | |
| 3489 | const psmi: Node.PseudoSectionMapIndex = @fromBackingInt(@intCast(pseudo_section_gop.index)); | |
| 3490 | 3490 | const parent_sn = if (!pseudo_section_gop.found_existing) sn: { |
| 3491 | 3491 | const effective_name = coff.section_merges.get(name) orelse name; |
| 3492 | 3492 | const parent = if (coff.section_table.get(effective_name)) |existing_sec| |
| ... | ... | @@ -3514,7 +3514,7 @@ fn pseudoSectionMapIndex( |
| 3514 | 3514 | sym.rva = coff.computeNodeRva(ni); |
| 3515 | 3515 | sym.section_number = parent.get(coff).section_number; |
| 3516 | 3516 | assert(sym.loc_relocs == .none); |
| 3517 | sym.loc_relocs = @enumFromInt(coff.relocs.items.len); | |
| 3517 | sym.loc_relocs = @fromBackingInt(@intCast(coff.relocs.items.len)); | |
| 3518 | 3518 | coff.nodes.appendAssumeCapacity(.{ .pseudo_section = psmi }); |
| 3519 | 3519 | break :sn sym.section_number; |
| 3520 | 3520 | } else pseudo_section_gop.value_ptr.get(coff).section_number; |
| ... | ... | @@ -3557,7 +3557,7 @@ fn objectSectionMapIndex( |
| 3557 | 3557 | } else attributes; |
| 3558 | 3558 | |
| 3559 | 3559 | const object_section_gop = try coff.object_section_table.getOrPut(gpa, name); |
| 3560 | const osmi: Node.ObjectSectionMapIndex = @enumFromInt(object_section_gop.index); | |
| 3560 | const osmi: Node.ObjectSectionMapIndex = @fromBackingInt(@intCast(object_section_gop.index)); | |
| 3561 | 3561 | const sym = if (!object_section_gop.found_existing) sym: { |
| 3562 | 3562 | try coff.ensureUnusedStringCapacity(name_slice.len); |
| 3563 | 3563 | const parent_name = coff.getOrPutStringAssumeCapacity(coff.objectSectionParentName(name_slice)); |
| ... | ... | @@ -3593,7 +3593,7 @@ fn objectSectionMapIndex( |
| 3593 | 3593 | sym.rva = coff.computeNodeRva(ni); |
| 3594 | 3594 | sym.section_number = parent.get(coff).section_number; |
| 3595 | 3595 | assert(sym.loc_relocs == .none); |
| 3596 | sym.loc_relocs = @enumFromInt(coff.relocs.items.len); | |
| 3596 | sym.loc_relocs = @fromBackingInt(@intCast(coff.relocs.items.len)); | |
| 3597 | 3597 | coff.nodes.appendAssumeCapacity(.{ .object_section = osmi }); |
| 3598 | 3598 | break :sym sym; |
| 3599 | 3599 | } else object_section_gop.value_ptr.get(coff); |
| ... | ... | @@ -3723,7 +3723,7 @@ fn addRelocAssumeCapacity( |
| 3723 | 3723 | const gpa = coff.base.comp.gpa; |
| 3724 | 3724 | const target = target_si.get(coff); |
| 3725 | 3725 | |
| 3726 | const ri: Reloc.Index = @enumFromInt(coff.relocs.items.len); | |
| 3726 | const ri: Reloc.Index = @fromBackingInt(@intCast(coff.relocs.items.len)); | |
| 3727 | 3727 | log.debug("addReloc({d}@{d}+0x{x} -> {d}@{d}+0x{x}{s}) = {d}", .{ |
| 3728 | 3728 | loc_si, |
| 3729 | 3729 | loc_si.get(coff).section_number, |
| ... | ... | @@ -3984,7 +3984,7 @@ fn loadObject( |
| 3984 | 3984 | symbol_table_end + string_table_len > fl.size) |
| 3985 | 3985 | return diags.failParse(path, "bad string table length: 0x{x}", .{string_table_len}); |
| 3986 | 3986 | |
| 3987 | const ioi: InputObject.Index = @enumFromInt(coff.input_objects.items.len); | |
| 3987 | const ioi: InputObject.Index = @fromBackingInt(@intCast(coff.input_objects.items.len)); | |
| 3988 | 3988 | try coff.input_objects.ensureUnusedCapacity(gpa, 1); |
| 3989 | 3989 | const input = coff.input_objects.addOneAssumeCapacity(); |
| 3990 | 3990 | input.* = .{ |
| ... | ... | @@ -4013,13 +4013,13 @@ fn loadObject( |
| 4013 | 4013 | _, |
| 4014 | 4014 | |
| 4015 | 4015 | pub fn wrap(i: ?u32) @This() { |
| 4016 | return @enumFromInt((i orelse return .none) + 1); | |
| 4016 | return @fromBackingInt(@intCast((i orelse return .none) + 1)); | |
| 4017 | 4017 | } |
| 4018 | 4018 | |
| 4019 | 4019 | pub fn unwrap(i: @This()) ?u32 { |
| 4020 | 4020 | return switch (i) { |
| 4021 | 4021 | .none => null, |
| 4022 | _ => @intFromEnum(i) - 1, | |
| 4022 | _ => @backingInt(i) - 1, | |
| 4023 | 4023 | }; |
| 4024 | 4024 | } |
| 4025 | 4025 | }; |
| ... | ... | @@ -4208,12 +4208,12 @@ fn loadObject( |
| 4208 | 4208 | |
| 4209 | 4209 | switch (symbol.section_number) { |
| 4210 | 4210 | .UNDEFINED, .DEBUG, .ABSOLUTE => {}, |
| 4211 | else => |sn| if (@intFromEnum(sn) > sections.len) | |
| 4211 | else => |sn| if (@backingInt(sn) > sections.len) | |
| 4212 | 4212 | return diags.failParse(path, "out-of-bounds section number {d} in symbol 0x{x}", .{ sn, symbol_i }), |
| 4213 | 4213 | } |
| 4214 | 4214 | |
| 4215 | 4215 | const psi: PendingSymbolIndex = .wrap(@intCast(pending_symbols.count())); |
| 4216 | const section_number: Symbol.SectionNumber = @enumFromInt(@intFromEnum(symbol.section_number)); | |
| 4216 | const section_number: Symbol.SectionNumber = @fromBackingInt(@intCast(@backingInt(symbol.section_number))); | |
| 4217 | 4217 | |
| 4218 | 4218 | const values: []const @FieldType(PendingSymbol, "value") = pending_symbols: switch (symbol.storage_class) { |
| 4219 | 4219 | .STATIC, .LABEL => |storage_class| switch (section_number) { |
| ... | ... | @@ -4270,7 +4270,7 @@ fn loadObject( |
| 4270 | 4270 | .{ symbol_i + 1, name, section_def.number }, |
| 4271 | 4271 | ); |
| 4272 | 4272 | |
| 4273 | section.comdat_association = @enumFromInt(section_def.number); | |
| 4273 | section.comdat_association = @fromBackingInt(@intCast(section_def.number)); | |
| 4274 | 4274 | } |
| 4275 | 4275 | |
| 4276 | 4276 | section.comdat = section_def.selection; |
| ... | ... | @@ -4684,7 +4684,7 @@ fn loadObject( |
| 4684 | 4684 | .alignment = section.header.flags.ALIGN.alignment() orelse .@"1", |
| 4685 | 4685 | .moved = true, |
| 4686 | 4686 | }); |
| 4687 | coff.nodes.appendAssumeCapacity(.{ .input_section = @enumFromInt(coff.input_sections.items.len) }); | |
| 4687 | coff.nodes.appendAssumeCapacity(.{ .input_section = @fromBackingInt(@intCast(coff.input_sections.items.len)) }); | |
| 4688 | 4688 | |
| 4689 | 4689 | section.si = coff.addSymbolAssumeCapacity(); |
| 4690 | 4690 | if (section.psi.unwrap()) |psi| |
| ... | ... | @@ -4701,7 +4701,7 @@ fn loadObject( |
| 4701 | 4701 | .offset = fl.offset + section.header.pointer_to_raw_data, |
| 4702 | 4702 | .size = section.header.size_of_raw_data, |
| 4703 | 4703 | }, |
| 4704 | .first_li = @enumFromInt(coff.input_symbols.items.len), | |
| 4704 | .first_li = @fromBackingInt(@intCast(coff.input_symbols.items.len)), | |
| 4705 | 4705 | .crc = section.comdat_crc, |
| 4706 | 4706 | .comdat_si = if (section.comdat_psi.unwrap()) |psi| |
| 4707 | 4707 | pending_symbols.values()[psi].si |
| ... | ... | @@ -4888,7 +4888,7 @@ fn loadObject( |
| 4888 | 4888 | |
| 4889 | 4889 | const loc_sym = section.si.get(coff); |
| 4890 | 4890 | assert(loc_sym.loc_relocs == .none); |
| 4891 | loc_sym.loc_relocs = @enumFromInt(coff.relocs.items.len); | |
| 4891 | loc_sym.loc_relocs = @fromBackingInt(@intCast(coff.relocs.items.len)); | |
| 4892 | 4892 | |
| 4893 | 4893 | if (section.header.number_of_relocations == 0) continue; |
| 4894 | 4894 | |
| ... | ... | @@ -4947,8 +4947,8 @@ fn loadObject( |
| 4947 | 4947 | const lhs = &ctx.v[a_index]; |
| 4948 | 4948 | const rhs = &ctx.v[b_index]; |
| 4949 | 4949 | if (lhs.section_number == rhs.section_number) |
| 4950 | return @intFromEnum(lhs.si) < @intFromEnum(rhs.si); | |
| 4951 | return @intFromEnum(lhs.section_number) < @intFromEnum(rhs.section_number); | |
| 4950 | return @backingInt(lhs.si) < @backingInt(rhs.si); | |
| 4951 | return @backingInt(lhs.section_number) < @backingInt(rhs.section_number); | |
| 4952 | 4952 | } |
| 4953 | 4953 | }; |
| 4954 | 4954 | |
| ... | ... | @@ -4968,14 +4968,14 @@ fn loadObject( |
| 4968 | 4968 | include_section = section.comdat_result == .include; |
| 4969 | 4969 | if (include_section) { |
| 4970 | 4970 | const isi = coff.getNode(section.si.get(coff).ni).input_section; |
| 4971 | isi.inputSection(coff).first_li = @enumFromInt(coff.input_symbols.items.len); | |
| 4971 | isi.inputSection(coff).first_li = @fromBackingInt(@intCast(coff.input_symbols.items.len)); | |
| 4972 | 4972 | } |
| 4973 | 4973 | } |
| 4974 | 4974 | } |
| 4975 | 4975 | |
| 4976 | 4976 | if (include_section) { |
| 4977 | 4977 | assert(coff.getNode(symbol.si.get(coff).ni) == .input_section); |
| 4978 | symbol.si.get(coff).setExtra(.{ .isli = @enumFromInt(coff.input_symbols.items.len) }); | |
| 4978 | symbol.si.get(coff).setExtra(.{ .isli = @fromBackingInt(@intCast(coff.input_symbols.items.len)) }); | |
| 4979 | 4979 | coff.input_symbols.addOneAssumeCapacity().* = .{ |
| 4980 | 4980 | .si = symbol.si, |
| 4981 | 4981 | .name = symbol.name, |
| ... | ... | @@ -5092,7 +5092,7 @@ fn loadArchive(coff: *Coff, path: std.Build.Cache.Path, fr: *Io.File.Reader) Loa |
| 5092 | 5092 | }) = .empty; |
| 5093 | 5093 | var symbol_member_indices: std.ArrayList(u32) = .empty; |
| 5094 | 5094 | |
| 5095 | const iai: InputArchive.Index = @enumFromInt(coff.input_archives.items.len); | |
| 5095 | const iai: InputArchive.Index = @fromBackingInt(@intCast(coff.input_archives.items.len)); | |
| 5096 | 5096 | (try coff.input_archives.addOne(gpa)).* = .{ |
| 5097 | 5097 | .path = path, |
| 5098 | 5098 | }; |
| ... | ... | @@ -5103,13 +5103,13 @@ fn loadArchive(coff: *Coff, path: std.Build.Cache.Path, fr: *Io.File.Reader) Loa |
| 5103 | 5103 | |
| 5104 | 5104 | errdefer { |
| 5105 | 5105 | for (coff.input_archive_symbol_indices.values()) |*v| { |
| 5106 | if (@intFromEnum(v.last) < first_iamsi) continue; | |
| 5107 | if (@intFromEnum(v.first) >= first_iamsi) continue; | |
| 5106 | if (@backingInt(v.last) < first_iamsi) continue; | |
| 5107 | if (@backingInt(v.first) >= first_iamsi) continue; | |
| 5108 | 5108 | |
| 5109 | 5109 | var iter = v.first; |
| 5110 | 5110 | v.last = while (iter != v.last) { |
| 5111 | const sym = &coff.input_archive_symbols.items[@intFromEnum(iter)]; | |
| 5112 | if (@intFromEnum(sym.next) >= first_iamsi) { | |
| 5111 | const sym = &coff.input_archive_symbols.items[@backingInt(iter)]; | |
| 5112 | if (@backingInt(sym.next) >= first_iamsi) { | |
| 5113 | 5113 | sym.next = iter; |
| 5114 | 5114 | break iter; |
| 5115 | 5115 | } |
| ... | ... | @@ -5189,7 +5189,7 @@ fn loadArchive(coff: *Coff, path: std.Build.Cache.Path, fr: *Io.File.Reader) Loa |
| 5189 | 5189 | }) |n| n else return diags.failParse(path, "unterminated string found in second linker member", .{}); |
| 5190 | 5190 | |
| 5191 | 5191 | const string = coff.getOrPutStringAssumeCapacity(name); |
| 5192 | const iamsi: InputArchive.Member.Symbol.Index = @enumFromInt(coff.input_archive_symbols.items.len); | |
| 5192 | const iamsi: InputArchive.Member.Symbol.Index = @fromBackingInt(@intCast(coff.input_archive_symbols.items.len)); | |
| 5193 | 5193 | const symbol_gop = coff.input_archive_symbol_indices.getOrPutAssumeCapacity(string); |
| 5194 | 5194 | if (!symbol_gop.found_existing) { |
| 5195 | 5195 | symbol_gop.value_ptr.* = .{ |
| ... | ... | @@ -5197,12 +5197,12 @@ fn loadArchive(coff: *Coff, path: std.Build.Cache.Path, fr: *Io.File.Reader) Loa |
| 5197 | 5197 | .last = iamsi, |
| 5198 | 5198 | }; |
| 5199 | 5199 | } else { |
| 5200 | coff.input_archive_symbols.items[@intFromEnum(symbol_gop.value_ptr.last)].next = iamsi; | |
| 5200 | coff.input_archive_symbols.items[@backingInt(symbol_gop.value_ptr.last)].next = iamsi; | |
| 5201 | 5201 | symbol_gop.value_ptr.last = iamsi; |
| 5202 | 5202 | } |
| 5203 | 5203 | |
| 5204 | 5204 | const iami = members.items[symbol_member_indices.items[symbol_i]].iami orelse iami: { |
| 5205 | const iami: InputArchive.Member.Index = @enumFromInt(coff.input_archive_members.items.len); | |
| 5205 | const iami: InputArchive.Member.Index = @fromBackingInt(@intCast(coff.input_archive_members.items.len)); | |
| 5206 | 5206 | const member_offset = members.items[symbol_member_indices.items[symbol_i]].offset; |
| 5207 | 5207 | coff.input_archive_members.addOneAssumeCapacity().* = .{ |
| 5208 | 5208 | .iai = iai, |
| ... | ... | @@ -5271,7 +5271,7 @@ fn loadArchive(coff: *Coff, path: std.Build.Cache.Path, fr: *Io.File.Reader) Loa |
| 5271 | 5271 | |
| 5272 | 5272 | const member_sig = try r.peek(4); |
| 5273 | 5273 | const machine: std.coff.IMAGE.FILE.MACHINE = |
| 5274 | @enumFromInt(std.mem.readInt(u16, member_sig[0..2], target_endian)); | |
| 5274 | @fromBackingInt(@intCast(std.mem.readInt(u16, member_sig[0..2], target_endian))); | |
| 5275 | 5275 | const sig = std.mem.readInt(u16, member_sig[2..4], target_endian); |
| 5276 | 5276 | |
| 5277 | 5277 | log.debug("verifyArchiveMember({s}) = 0x{x}+{x}", .{ |
| ... | ... | @@ -5484,7 +5484,7 @@ fn updateNavInner(coff: *Coff, pt: Zcu.PerThread, nav_index: InternPool.Nav.Inde |
| 5484 | 5484 | } |
| 5485 | 5485 | const sym = si.get(coff); |
| 5486 | 5486 | assert(sym.loc_relocs == .none); |
| 5487 | sym.loc_relocs = @enumFromInt(coff.relocs.items.len); | |
| 5487 | sym.loc_relocs = @fromBackingInt(@intCast(coff.relocs.items.len)); | |
| 5488 | 5488 | if (!isImage(coff) and sym.target_relocs != .none) |
| 5489 | 5489 | try coff.pendingSymbolTableEntry(si); |
| 5490 | 5490 | |
| ... | ... | @@ -5500,7 +5500,7 @@ fn updateNavInner(coff: *Coff, pt: Zcu.PerThread, nav_index: InternPool.Nav.Inde |
| 5500 | 5500 | pt, |
| 5501 | 5501 | .fromInterned(nav.resolved.?.value), |
| 5502 | 5502 | &nw.interface, |
| 5503 | .{ .atom_index = @enumFromInt(@intFromEnum(si)) }, | |
| 5503 | .{ .atom_index = @fromBackingInt(@intCast(@backingInt(si))) }, | |
| 5504 | 5504 | ) catch |err| switch (err) { |
| 5505 | 5505 | error.WriteFailed => return nw.err.?, |
| 5506 | 5506 | else => |e| return e, |
| ... | ... | @@ -5554,7 +5554,7 @@ pub fn lowerUav( |
| 5554 | 5554 | coff.const_prog_node.increaseEstimatedTotalItems(1); |
| 5555 | 5555 | } |
| 5556 | 5556 | } |
| 5557 | return @enumFromInt(@intFromEnum(si)); | |
| 5557 | return @fromBackingInt(@intCast(@backingInt(si))); | |
| 5558 | 5558 | } |
| 5559 | 5559 | |
| 5560 | 5560 | pub fn updateFunc( |
| ... | ... | @@ -5617,7 +5617,7 @@ fn updateFuncInner( |
| 5617 | 5617 | } |
| 5618 | 5618 | const sym = si.get(coff); |
| 5619 | 5619 | assert(sym.loc_relocs == .none); |
| 5620 | sym.loc_relocs = @enumFromInt(coff.relocs.items.len); | |
| 5620 | sym.loc_relocs = @fromBackingInt(@intCast(coff.relocs.items.len)); | |
| 5621 | 5621 | if (!isImage(coff) and sym.target_relocs != .none) |
| 5622 | 5622 | try coff.pendingSymbolTableEntry(si); |
| 5623 | 5623 | break :ni sym.ni; |
| ... | ... | @@ -5630,7 +5630,7 @@ fn updateFuncInner( |
| 5630 | 5630 | &coff.base, |
| 5631 | 5631 | pt, |
| 5632 | 5632 | func_index, |
| 5633 | @enumFromInt(@intFromEnum(si)), | |
| 5633 | @fromBackingInt(@intCast(@backingInt(si))), | |
| 5634 | 5634 | mir, |
| 5635 | 5635 | &nw.interface, |
| 5636 | 5636 | .none, |
| ... | ... | @@ -5756,9 +5756,9 @@ fn reportUndefs(coff: *Coff, tid: Zcu.PerThread.Id) !void { |
| 5756 | 5756 | const reloc_l = &ctx.relocs.items[lhs]; |
| 5757 | 5757 | const reloc_r = &ctx.relocs.items[rhs]; |
| 5758 | 5758 | if (reloc_l.target == reloc_r.target) |
| 5759 | return @intFromEnum(reloc_l.loc) < @intFromEnum(reloc_r.loc) | |
| 5759 | return @backingInt(reloc_l.loc) < @backingInt(reloc_r.loc) | |
| 5760 | 5760 | else |
| 5761 | return @intFromEnum(reloc_l.target) < @intFromEnum(reloc_r.target); | |
| 5761 | return @backingInt(reloc_l.target) < @backingInt(reloc_r.target); | |
| 5762 | 5762 | } |
| 5763 | 5763 | }.lessThan; |
| 5764 | 5764 | |
| ... | ... | @@ -5798,7 +5798,7 @@ fn reportUndefs(coff: *Coff, tid: Zcu.PerThread.Id) !void { |
| 5798 | 5798 | switch (coff.getNode(loc_sym.ni)) { |
| 5799 | 5799 | .data_directories => { |
| 5800 | 5800 | const dir: std.coff.IMAGE.DIRECTORY_ENTRY = |
| 5801 | @enumFromInt(reloc.offset / @sizeOf(std.coff.ImageDataDirectory)); | |
| 5801 | @fromBackingInt(@intCast(reloc.offset / @sizeOf(std.coff.ImageDataDirectory))); | |
| 5802 | 5802 | err.addNote("referenced by data directory entry: {t}", .{dir}); |
| 5803 | 5803 | }, |
| 5804 | 5804 | .optional_header => err.addNote("referenced by optional header field", .{}), |
| ... | ... | @@ -6095,7 +6095,7 @@ pub fn idle(coff: *Coff, tid: Zcu.PerThread.Id) !bool { |
| 6095 | 6095 | task: { |
| 6096 | 6096 | // TODO: Idle task for flushing obj into lib |
| 6097 | 6097 | if (coff.input_section_pending_index < coff.input_sections.items.len) { |
| 6098 | const isi: Node.InputSection.Index = @enumFromInt(coff.input_section_pending_index); | |
| 6098 | const isi: Node.InputSection.Index = @fromBackingInt(@intCast(coff.input_section_pending_index)); | |
| 6099 | 6099 | coff.input_section_pending_index += 1; |
| 6100 | 6100 | const sub_prog_node = coff.idleProgNode(tid, coff.input_prog_node, coff.getNode(isi.symbol(coff).node(coff))); |
| 6101 | 6101 | defer sub_prog_node.end(); |
| ... | ... | @@ -6229,7 +6229,7 @@ fn flushUav( |
| 6229 | 6229 | } |
| 6230 | 6230 | const sym = si.get(coff); |
| 6231 | 6231 | assert(sym.loc_relocs == .none); |
| 6232 | sym.loc_relocs = @enumFromInt(coff.relocs.items.len); | |
| 6232 | sym.loc_relocs = @fromBackingInt(@intCast(coff.relocs.items.len)); | |
| 6233 | 6233 | if (!isImage(coff) and sym.target_relocs != .none) |
| 6234 | 6234 | try coff.pendingSymbolTableEntry(si); |
| 6235 | 6235 | |
| ... | ... | @@ -6244,7 +6244,7 @@ fn flushUav( |
| 6244 | 6244 | pt, |
| 6245 | 6245 | .fromInterned(uav_val), |
| 6246 | 6246 | &nw.interface, |
| 6247 | .{ .atom_index = @enumFromInt(@intFromEnum(si)) }, | |
| 6247 | .{ .atom_index = @fromBackingInt(@intCast(@backingInt(si))) }, | |
| 6248 | 6248 | ) catch |err| switch (err) { |
| 6249 | 6249 | error.WriteFailed => return nw.err.?, |
| 6250 | 6250 | else => |e| return e, |
| ... | ... | @@ -6375,8 +6375,8 @@ fn flushGlobal(coff: *Coff, gmi: Node.GlobalMapIndex) !bool { |
| 6375 | 6375 | const indices_list = opt_indices_list orelse continue; |
| 6376 | 6376 | var iter: InputArchive.Member.Symbol.Index = indices_list.first; |
| 6377 | 6377 | while (true) { |
| 6378 | const archive_sym = &coff.input_archive_symbols.items[@intFromEnum(iter)]; | |
| 6379 | const member = &coff.input_archive_members.items[@intFromEnum(archive_sym.iami)]; | |
| 6378 | const archive_sym = &coff.input_archive_symbols.items[@backingInt(iter)]; | |
| 6379 | const member = &coff.input_archive_members.items[@backingInt(archive_sym.iami)]; | |
| 6380 | 6380 | member: switch (member.content) { |
| 6381 | 6381 | .object => if (!member.flags.is_loaded) { |
| 6382 | 6382 | if (gmi.libName(coff).unwrap()) |lib_name| |
| ... | ... | @@ -6523,7 +6523,7 @@ fn flushGlobal(coff: *Coff, gmi: Node.GlobalMapIndex) !bool { |
| 6523 | 6523 | const import_address_table_sym = import_address_table_si.get(coff); |
| 6524 | 6524 | import_address_table_sym.ni = import_address_table_ni; |
| 6525 | 6525 | assert(import_address_table_sym.loc_relocs == .none); |
| 6526 | import_address_table_sym.loc_relocs = @enumFromInt(coff.relocs.items.len); | |
| 6526 | import_address_table_sym.loc_relocs = @fromBackingInt(@intCast(coff.relocs.items.len)); | |
| 6527 | 6527 | import_address_table_sym.section_number = |
| 6528 | 6528 | coff.getNode(idata_section_ni).object_section.symbol(coff).get(coff).section_number; |
| 6529 | 6529 | } |
| ... | ... | @@ -6544,9 +6544,9 @@ fn flushGlobal(coff: *Coff, gmi: Node.GlobalMapIndex) !bool { |
| 6544 | 6544 | @memcpy(import_hint_name_slice[0..lib_name.len], lib_name); |
| 6545 | 6545 | @memcpy(import_hint_name_slice[lib_name.len..][0..".dll".len], ".dll"); |
| 6546 | 6546 | @memset(import_hint_name_slice[lib_name.len + ".dll".len ..], 0); |
| 6547 | coff.nodes.appendAssumeCapacity(.{ .import_lookup_table = @enumFromInt(gop.index) }); | |
| 6548 | coff.nodes.appendAssumeCapacity(.{ .import_address_table = @enumFromInt(gop.index) }); | |
| 6549 | coff.nodes.appendAssumeCapacity(.{ .import_hint_name_table = @enumFromInt(gop.index) }); | |
| 6547 | coff.nodes.appendAssumeCapacity(.{ .import_lookup_table = @fromBackingInt(@intCast(gop.index)) }); | |
| 6548 | coff.nodes.appendAssumeCapacity(.{ .import_address_table = @fromBackingInt(@intCast(gop.index)) }); | |
| 6549 | coff.nodes.appendAssumeCapacity(.{ .import_hint_name_table = @fromBackingInt(@intCast(gop.index)) }); | |
| 6550 | 6550 | |
| 6551 | 6551 | const import_directory_entries = coff.importDirectoryTableSlice()[gop.index..][0..2]; |
| 6552 | 6552 | import_directory_entries.* = .{ .{ |
| ... | ... | @@ -6572,7 +6572,7 @@ fn flushGlobal(coff: *Coff, gmi: Node.GlobalMapIndex) !bool { |
| 6572 | 6572 | ); |
| 6573 | 6573 | |
| 6574 | 6574 | const iat_symbol_gop = try coff.import_table.iat_symbol_indices.getOrPut(gpa, .{ |
| 6575 | .iti = @enumFromInt(gop.index), | |
| 6575 | .iti = @fromBackingInt(@intCast(gop.index)), | |
| 6576 | 6576 | .name = import.name, |
| 6577 | 6577 | .ordinal_hint = import.ordinal_hint, |
| 6578 | 6578 | }); |
| ... | ... | @@ -6645,7 +6645,7 @@ fn flushGlobal(coff: *Coff, gmi: Node.GlobalMapIndex) !bool { |
| 6645 | 6645 | (try gop.value_ptr.import_address_table_symbols.addOne(gpa)).* = si; |
| 6646 | 6646 | }, |
| 6647 | 6647 | .thunk => { |
| 6648 | sym.loc_relocs = @enumFromInt(coff.relocs.items.len); | |
| 6648 | sym.loc_relocs = @fromBackingInt(@intCast(coff.relocs.items.len)); | |
| 6649 | 6649 | |
| 6650 | 6650 | const target = &comp.root_mod.resolved_target.result; |
| 6651 | 6651 | const alignment = switch (comp.root_mod.optimize_mode) { |
| ... | ... | @@ -6738,7 +6738,7 @@ fn flushSpecialSymbol(coff: *Coff, pending: SpecialSymbol) !SpecialSymbol { |
| 6738 | 6738 | const optional_hdr_sym = optional_hdr_si.get(coff); |
| 6739 | 6739 | optional_hdr_sym.ni = Node.known.optional_header; |
| 6740 | 6740 | assert(optional_hdr_sym.loc_relocs == .none); |
| 6741 | optional_hdr_sym.loc_relocs = @enumFromInt(coff.relocs.items.len); | |
| 6741 | optional_hdr_sym.loc_relocs = @fromBackingInt(@intCast(coff.relocs.items.len)); | |
| 6742 | 6742 | |
| 6743 | 6743 | const optional_hdr = coff.optionalHeaderStandardPtr(); |
| 6744 | 6744 | optional_hdr.address_of_entry_point = std.mem.nativeTo( |
| ... | ... | @@ -6785,7 +6785,7 @@ fn flushSpecialSymbol(coff: *Coff, pending: SpecialSymbol) !SpecialSymbol { |
| 6785 | 6785 | const data_dir_sym = data_dir_si.get(coff); |
| 6786 | 6786 | data_dir_sym.ni = Node.known.data_directories; |
| 6787 | 6787 | assert(data_dir_sym.loc_relocs == .none); |
| 6788 | data_dir_sym.loc_relocs = @enumFromInt(coff.relocs.items.len); | |
| 6788 | data_dir_sym.loc_relocs = @fromBackingInt(@intCast(coff.relocs.items.len)); | |
| 6789 | 6789 | |
| 6790 | 6790 | try coff.addReloc( |
| 6791 | 6791 | data_dir_si, |
| ... | ... | @@ -6823,8 +6823,8 @@ fn flushLazy(coff: *Coff, pt: Zcu.PerThread, lmr: Node.LazyMapRef) !void { |
| 6823 | 6823 | }; |
| 6824 | 6824 | const ni = try coff.mf.addLastChildNode(gpa, sec_si.node(coff), .{ .moved = true }); |
| 6825 | 6825 | coff.nodes.appendAssumeCapacity(switch (lazy.kind) { |
| 6826 | .code => .{ .lazy_code = @enumFromInt(lmr.index) }, | |
| 6827 | .const_data => .{ .lazy_const_data = @enumFromInt(lmr.index) }, | |
| 6826 | .code => .{ .lazy_code = @fromBackingInt(@intCast(lmr.index)) }, | |
| 6827 | .const_data => .{ .lazy_const_data = @fromBackingInt(@intCast(lmr.index)) }, | |
| 6828 | 6828 | }); |
| 6829 | 6829 | sym.ni = ni; |
| 6830 | 6830 | sym.section_number = sec_si.get(coff).section_number; |
| ... | ... | @@ -6832,7 +6832,7 @@ fn flushLazy(coff: *Coff, pt: Zcu.PerThread, lmr: Node.LazyMapRef) !void { |
| 6832 | 6832 | else => si.deleteLocationRelocs(coff), |
| 6833 | 6833 | } |
| 6834 | 6834 | assert(sym.loc_relocs == .none); |
| 6835 | sym.loc_relocs = @enumFromInt(coff.relocs.items.len); | |
| 6835 | sym.loc_relocs = @fromBackingInt(@intCast(coff.relocs.items.len)); | |
| 6836 | 6836 | if (!isImage(coff) and sym.target_relocs != .none) |
| 6837 | 6837 | try coff.pendingSymbolTableEntry(si); |
| 6838 | 6838 | |
| ... | ... | @@ -6850,7 +6850,7 @@ fn flushLazy(coff: *Coff, pt: Zcu.PerThread, lmr: Node.LazyMapRef) !void { |
| 6850 | 6850 | &required_alignment, |
| 6851 | 6851 | &nw.interface, |
| 6852 | 6852 | .none, |
| 6853 | .{ .atom_index = @enumFromInt(@intFromEnum(si)) }, | |
| 6853 | .{ .atom_index = @fromBackingInt(@intCast(@backingInt(si))) }, | |
| 6854 | 6854 | ) catch |err| switch (err) { |
| 6855 | 6855 | error.WriteFailed => return nw.err.?, |
| 6856 | 6856 | else => |e| return e, |
| ... | ... | @@ -6899,7 +6899,7 @@ fn flushMoved(coff: *Coff, ni: MappedFile.Node.Index) !void { |
| 6899 | 6899 | switch (member.kind) { |
| 6900 | 6900 | .first_linker, .second_linker, .longnames => {}, |
| 6901 | 6901 | else => coff.targetStore( |
| 6902 | &coff.secondLinkerMemberOffsetsSlice()[@intFromEnum(mi) - Member.Index.known_count], | |
| 6902 | &coff.secondLinkerMemberOffsetsSlice()[@backingInt(mi) - Member.Index.known_count], | |
| 6903 | 6903 | @intCast(ni.fileLocation(&coff.mf, false).offset), |
| 6904 | 6904 | ), |
| 6905 | 6905 | } |
| ... | ... | @@ -6926,7 +6926,7 @@ fn flushMoved(coff: *Coff, ni: MappedFile.Node.Index) !void { |
| 6926 | 6926 | }, |
| 6927 | 6927 | .input_section => |isi| { |
| 6928 | 6928 | try isi.symbol(coff).flushMoved(coff); |
| 6929 | for (coff.input_symbols.items[@intFromEnum(isi.firstSymbol(coff))..]) |input_symbol| { | |
| 6929 | for (coff.input_symbols.items[@backingInt(isi.firstSymbol(coff))..]) |input_symbol| { | |
| 6930 | 6930 | if (input_symbol.si.get(coff).ni != ni) break; |
| 6931 | 6931 | try input_symbol.si.flushMoved(coff); |
| 6932 | 6932 | } |
| ... | ... | @@ -7032,7 +7032,7 @@ fn flushMoved(coff: *Coff, ni: MappedFile.Node.Index) !void { |
| 7032 | 7032 | coff.exportNamePointerTableSlice(), |
| 7033 | 7033 | coff.exportOrdinalTableSlice(), |
| 7034 | 7034 | ) |*np, target_ord| { |
| 7035 | const ord: ExportTable.Ordinal = @enumFromInt(coff.targetLoad(&target_ord.unbiased_ordinal)); | |
| 7035 | const ord: ExportTable.Ordinal = @fromBackingInt(@intCast(coff.targetLoad(&target_ord.unbiased_ordinal))); | |
| 7036 | 7036 | const entry = ord.get(coff); |
| 7037 | 7037 | coff.targetStore( |
| 7038 | 7038 | &np.name_rva, |
| ... | ... | @@ -7243,7 +7243,7 @@ fn flushMember(coff: *Coff, mi: Member.Index) !void { |
| 7243 | 7243 | const file_offset: u32 = @intCast(member.header_ni.fileLocation(&coff.mf, false).offset); |
| 7244 | 7244 | const first_linker_offsets = coff.firstLinkerMemberOffsetsSlice(); |
| 7245 | 7245 | for (member.first_linker_indices.values()) |mfli| |
| 7246 | first_linker_offsets[@intFromEnum(mfli)] = std.mem.nativeTo(u32, file_offset, .big); | |
| 7246 | first_linker_offsets[@backingInt(mfli)] = std.mem.nativeTo(u32, file_offset, .big); | |
| 7247 | 7247 | }, |
| 7248 | 7248 | } |
| 7249 | 7249 | } |
| ... | ... | @@ -7323,7 +7323,7 @@ fn flushSectionMerge(coff: *Coff, index: u32) !void { |
| 7323 | 7323 | @memcpy(from_name[0..to_slice.len], to_slice); |
| 7324 | 7324 | @memset(from_name[to_slice.len..], 0); |
| 7325 | 7325 | } else if (coff.pseudo_section_table.getIndex(from)) |from_index| { |
| 7326 | const from_psmi: Node.PseudoSectionMapIndex = @enumFromInt(from_index); | |
| 7326 | const from_psmi: Node.PseudoSectionMapIndex = @fromBackingInt(@intCast(from_index)); | |
| 7327 | 7327 | const from_sym = from_psmi.symbol(coff).get(coff); |
| 7328 | 7328 | if (opt_to_sec) |to_sec| { |
| 7329 | 7329 | const to_sym = to_sec.si.get(coff); |
| ... | ... | @@ -7395,11 +7395,11 @@ fn updateExportsInner( |
| 7395 | 7395 | try coff.symbols.ensureUnusedCapacity(gpa, export_indices.len); |
| 7396 | 7396 | const exported_si: Symbol.Index = switch (exported) { |
| 7397 | 7397 | .nav => |nav| try coff.navSymbol(zcu, nav), |
| 7398 | .uav => |uav| @enumFromInt(@intFromEnum(try coff.lowerUav( | |
| 7398 | .uav => |uav| @fromBackingInt(@intCast(@backingInt(try coff.lowerUav( | |
| 7399 | 7399 | pt, |
| 7400 | 7400 | uav, |
| 7401 | 7401 | Type.fromInterned(ip.typeOf(uav)).abiAlignment(zcu), |
| 7402 | ))), | |
| 7402 | )))), | |
| 7403 | 7403 | }; |
| 7404 | 7404 | switch (exported) { |
| 7405 | 7405 | .nav => |nav| log.debug("updateExports({f}) = {d}", .{ ip.getNav(nav).fqn.fmt(ip), exported_si }), |
| ... | ... | @@ -7479,7 +7479,7 @@ fn updateExportsInner( |
| 7479 | 7479 | const ordinal_table_slice = coff.exportOrdinalTableSlice(); |
| 7480 | 7480 | if (ordinal_table_slice.len > 0 and !coff.export_table.pending_sort) { |
| 7481 | 7481 | const tail_index: ExportTable.Ordinal = |
| 7482 | @enumFromInt(ordinal_table_slice[ordinal_table_slice.len - 1].unbiased_ordinal); | |
| 7482 | @fromBackingInt(@intCast(ordinal_table_slice[ordinal_table_slice.len - 1].unbiased_ordinal)); | |
| 7483 | 7483 | const tail_entry = tail_index.get(coff); |
| 7484 | 7484 | const tail_name = name_table_slice[tail_entry.name_index..][0..tail_entry.name_len]; |
| 7485 | 7485 | coff.export_table.pending_sort = std.mem.lessThan(u8, name, tail_name); |
| ... | ... | @@ -7523,7 +7523,7 @@ fn updateExportsInner( |
| 7523 | 7523 | .si = export_si, |
| 7524 | 7524 | .name_index = @intCast(name_index), |
| 7525 | 7525 | .name_len = @intCast(name.len), |
| 7526 | .export_address_table_ri = @enumFromInt(coff.relocs.items.len), | |
| 7526 | .export_address_table_ri = @fromBackingInt(@intCast(coff.relocs.items.len)), | |
| 7527 | 7527 | }; |
| 7528 | 7528 | |
| 7529 | 7529 | try coff.addReloc( |
| ... | ... | @@ -7583,7 +7583,7 @@ pub fn dump(coff: *Coff, w: *Io.Writer, tid: Zcu.PerThread.Id) !link.File.DumpRe |
| 7583 | 7583 | try coff.printSection(w, name, sec.si); |
| 7584 | 7584 | try w.writeAll("Symbol table:\n"); |
| 7585 | 7585 | for (1..coff.symbols.items.len) |si| |
| 7586 | try coff.printSymbol(w, tid, @enumFromInt(si)); | |
| 7586 | try coff.printSymbol(w, tid, @fromBackingInt(@intCast(si))); | |
| 7587 | 7587 | |
| 7588 | 7588 | return .enabled; |
| 7589 | 7589 | } |
| ... | ... | @@ -7688,7 +7688,7 @@ fn printNodeName( |
| 7688 | 7688 | const comdat_name = if (comdat_sym.gmi != .none) |
| 7689 | 7689 | comdat_sym.gmi.name(coff).toSlice(coff) |
| 7690 | 7690 | else |
| 7691 | coff.input_symbols.items[@intFromEnum(comdat_sym.extra.isli)].name.toSlice(coff); | |
| 7691 | coff.input_symbols.items[@backingInt(comdat_sym.extra.isli)].name.toSlice(coff); | |
| 7692 | 7692 | |
| 7693 | 7693 | try w.print("={s}", .{comdat_name}); |
| 7694 | 7694 | } |
| ... | ... | @@ -7755,10 +7755,10 @@ pub fn printNode( |
| 7755 | 7755 | try w.writeAll(@tagName(node)); |
| 7756 | 7756 | try coff.printNodeName(w, tid, node); |
| 7757 | 7757 | { |
| 7758 | const mf_node = &coff.mf.nodes.items[@intFromEnum(ni)]; | |
| 7758 | const mf_node = &coff.mf.nodes.items[@backingInt(ni)]; | |
| 7759 | 7759 | const off, const size = mf_node.location().resolve(&coff.mf); |
| 7760 | 7760 | try w.print(" index={d} offset=0x{x} size=0x{x} align=0x{x}{s}{s}{s}{s}\n", .{ |
| 7761 | @intFromEnum(ni), | |
| 7761 | @backingInt(ni), | |
| 7762 | 7762 | off, |
| 7763 | 7763 | size, |
| 7764 | 7764 | mf_node.flags.alignment.toByteUnits(), |
src/link/ConstPool.zig+6-6| ... | ... | @@ -40,7 +40,7 @@ pub fn deinit(pool: *ConstPool, gpa: Allocator) void { |
| 40 | 40 | pub const Index = enum(u32) { |
| 41 | 41 | _, |
| 42 | 42 | pub fn val(i: Index, pool: *const ConstPool) InternPool.Index { |
| 43 | return pool.values.keys()[@intFromEnum(i)]; | |
| 43 | return pool.values.keys()[@backingInt(i)]; | |
| 44 | 44 | } |
| 45 | 45 | }; |
| 46 | 46 | |
| ... | ... | @@ -107,15 +107,15 @@ const ContainerDepEntry = extern struct { |
| 107 | 107 | fn unwrap(o: Optional) ?ContainerDepEntry.Index { |
| 108 | 108 | return switch (o) { |
| 109 | 109 | .none => null, |
| 110 | else => @enumFromInt(@intFromEnum(o)), | |
| 110 | else => @fromBackingInt(@intCast(@backingInt(o))), | |
| 111 | 111 | }; |
| 112 | 112 | } |
| 113 | 113 | }; |
| 114 | 114 | fn toOptional(i: ContainerDepEntry.Index) Optional { |
| 115 | return @enumFromInt(@intFromEnum(i)); | |
| 115 | return @fromBackingInt(@intCast(@backingInt(i))); | |
| 116 | 116 | } |
| 117 | 117 | fn ptr(i: ContainerDepEntry.Index, pool: *ConstPool) *ContainerDepEntry { |
| 118 | return &pool.container_dep_entries.items[@intFromEnum(i)]; | |
| 118 | return &pool.container_dep_entries.items[@backingInt(i)]; | |
| 119 | 119 | } |
| 120 | 120 | }; |
| 121 | 121 | }; |
| ... | ... | @@ -148,7 +148,7 @@ pub fn get(pool: *ConstPool, pt: Zcu.PerThread, user: User, val: InternPool.Inde |
| 148 | 148 | const ip = &zcu.intern_pool; |
| 149 | 149 | const gpa = zcu.comp.gpa; |
| 150 | 150 | const gop = try pool.values.getOrPut(gpa, val); |
| 151 | const index: ConstPool.Index = @enumFromInt(gop.index); | |
| 151 | const index: ConstPool.Index = @fromBackingInt(@intCast(gop.index)); | |
| 152 | 152 | if (!gop.found_existing) { |
| 153 | 153 | const ty: Type = switch (ip.typeOf(val)) { |
| 154 | 154 | .type_type => if (ip.isUndef(val)) .type else .fromInterned(val), |
| ... | ... | @@ -272,7 +272,7 @@ fn registerTypeDeps(pool: *ConstPool, root: Index, ty: Type, zcu: *const Zcu) Al |
| 272 | 272 | errdefer comptime unreachable; |
| 273 | 273 | |
| 274 | 274 | const gop = pool.container_deps.getOrPutAssumeCapacity(ty.toIntern()); |
| 275 | const entry: ContainerDepEntry.Index = @enumFromInt(pool.container_dep_entries.items.len); | |
| 275 | const entry: ContainerDepEntry.Index = @fromBackingInt(@intCast(pool.container_dep_entries.items.len)); | |
| 276 | 276 | pool.container_dep_entries.appendAssumeCapacity(.{ |
| 277 | 277 | .next = if (gop.found_existing) gop.value_ptr.toOptional() else .none, |
| 278 | 278 | .depender = root, |
src/link/Dwarf.zig+129-129| ... | ... | @@ -81,11 +81,11 @@ const ModInfo = struct { |
| 81 | 81 | |
| 82 | 82 | const DebugAbbrev = struct { |
| 83 | 83 | section: Section, |
| 84 | const unit: Unit.Index = @enumFromInt(0); | |
| 84 | const unit: Unit.Index = @fromBackingInt(@intCast(0)); | |
| 85 | 85 | |
| 86 | 86 | const header_bytes = 0; |
| 87 | 87 | |
| 88 | const trailer_bytes = uleb128Bytes(@intFromEnum(AbbrevCode.null)); | |
| 88 | const trailer_bytes = uleb128Bytes(@backingInt(AbbrevCode.null)); | |
| 89 | 89 | }; |
| 90 | 90 | |
| 91 | 91 | const DebugAranges = struct { |
| ... | ... | @@ -96,7 +96,7 @@ const DebugAranges = struct { |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | fn trailerBytes(dwarf: *Dwarf) u32 { |
| 99 | return @intFromEnum(dwarf.address_size) * 2; | |
| 99 | return @backingInt(dwarf.address_size) * 2; | |
| 100 | 100 | } |
| 101 | 101 | }; |
| 102 | 102 | |
| ... | ... | @@ -146,8 +146,8 @@ const DebugInfo = struct { |
| 146 | 146 | |
| 147 | 147 | fn headerBytes(dwarf: *Dwarf) u32 { |
| 148 | 148 | return dwarf.unitLengthBytes() + 2 + 1 + 1 + dwarf.sectionOffsetBytes() + |
| 149 | uleb128Bytes(@intFromEnum(AbbrevCode.compile_unit)) + 1 + dwarf.sectionOffsetBytes() * 6 + uleb128Bytes(0) + | |
| 150 | uleb128Bytes(@intFromEnum(AbbrevCode.module)) + dwarf.sectionOffsetBytes() + uleb128Bytes(0); | |
| 149 | uleb128Bytes(@backingInt(AbbrevCode.compile_unit)) + 1 + dwarf.sectionOffsetBytes() * 6 + uleb128Bytes(0) + | |
| 150 | uleb128Bytes(@backingInt(AbbrevCode.module)) + dwarf.sectionOffsetBytes() + uleb128Bytes(0); | |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | fn declEntryLineOff(dwarf: *Dwarf) u32 { |
| ... | ... | @@ -168,9 +168,9 @@ const DebugInfo = struct { |
| 168 | 168 | debug_info.section.off(dwarf) + unit_ptr.off + unit_ptr.header_len + entry_ptr.off, |
| 169 | 169 | ) != abbrev_code_buf.len) return error.InputOutput; |
| 170 | 170 | var abbrev_code_reader: std.Io.Reader = .fixed(&abbrev_code_buf); |
| 171 | return @enumFromInt( | |
| 171 | return @fromBackingInt(@intCast( | |
| 172 | 172 | abbrev_code_reader.takeLeb128(@typeInfo(AbbrevCode).@"enum".tag_type) catch unreachable, |
| 173 | ); | |
| 173 | )); | |
| 174 | 174 | } |
| 175 | 175 | |
| 176 | 176 | const trailer_bytes = 1 + 1; |
| ... | ... | @@ -202,7 +202,7 @@ const DebugLine = struct { |
| 202 | 202 | const dir_index_info = dirIndexInfo(dir_count); |
| 203 | 203 | return dwarf.unitLengthBytes() + 2 + 1 + 1 + dwarf.sectionOffsetBytes() + 1 + 1 + 1 + 1 + 1 + 1 + 1 * (dwarf.debug_line.header.opcode_base - 1) + |
| 204 | 204 | 1 + uleb128Bytes(DW.LNCT.path) + uleb128Bytes(DW.FORM.line_strp) + uleb128Bytes(dir_count) + (dwarf.sectionOffsetBytes()) * dir_count + |
| 205 | 1 + uleb128Bytes(DW.LNCT.path) + uleb128Bytes(DW.FORM.line_strp) + uleb128Bytes(DW.LNCT.directory_index) + uleb128Bytes(@intFromEnum(dir_index_info.form)) + uleb128Bytes(DW.LNCT.LLVM_source) + uleb128Bytes(DW.FORM.line_strp) + uleb128Bytes(file_count) + (dwarf.sectionOffsetBytes() + dir_index_info.bytes + dwarf.sectionOffsetBytes()) * file_count; | |
| 205 | 1 + uleb128Bytes(DW.LNCT.path) + uleb128Bytes(DW.FORM.line_strp) + uleb128Bytes(DW.LNCT.directory_index) + uleb128Bytes(@backingInt(dir_index_info.form)) + uleb128Bytes(DW.LNCT.LLVM_source) + uleb128Bytes(DW.FORM.line_strp) + uleb128Bytes(file_count) + (dwarf.sectionOffsetBytes() + dir_index_info.bytes + dwarf.sectionOffsetBytes()) * file_count; | |
| 206 | 206 | } |
| 207 | 207 | |
| 208 | 208 | const trailer_bytes = 1 + uleb128Bytes(1) + 1; |
| ... | ... | @@ -239,7 +239,7 @@ const StringSection = struct { |
| 239 | 239 | map: std.array_hash_map.Auto(void, void), |
| 240 | 240 | section: Section, |
| 241 | 241 | |
| 242 | const unit: Unit.Index = @enumFromInt(0); | |
| 242 | const unit: Unit.Index = @fromBackingInt(@intCast(0)); | |
| 243 | 243 | |
| 244 | 244 | const init: StringSection = .{ |
| 245 | 245 | .contents = .empty, |
| ... | ... | @@ -255,7 +255,7 @@ const StringSection = struct { |
| 255 | 255 | |
| 256 | 256 | fn addString(str_sec: *StringSection, dwarf: *Dwarf, str: []const u8) UpdateError!Entry.Index { |
| 257 | 257 | const gop = try str_sec.map.getOrPutAdapted(dwarf.gpa, str, Adapter{ .str_sec = str_sec }); |
| 258 | const entry: Entry.Index = @enumFromInt(gop.index); | |
| 258 | const entry: Entry.Index = @fromBackingInt(@intCast(gop.index)); | |
| 259 | 259 | if (!gop.found_existing) { |
| 260 | 260 | errdefer _ = str_sec.map.pop(); |
| 261 | 261 | const unit_ptr = str_sec.section.getUnit(unit); |
| ... | ... | @@ -284,7 +284,7 @@ const StringSection = struct { |
| 284 | 284 | } |
| 285 | 285 | |
| 286 | 286 | pub fn eql(adapter: Adapter, key: []const u8, _: void, rhs_index: usize) bool { |
| 287 | const entry = adapter.str_sec.section.getUnit(unit).getEntry(@enumFromInt(rhs_index)); | |
| 287 | const entry = adapter.str_sec.section.getUnit(unit).getEntry(@fromBackingInt(@intCast(rhs_index))); | |
| 288 | 288 | return std.mem.eql(u8, key, adapter.str_sec.contents.items[entry.off..][0 .. entry.len - 1 :0]); |
| 289 | 289 | } |
| 290 | 290 | }; |
| ... | ... | @@ -345,7 +345,7 @@ pub const Section = struct { |
| 345 | 345 | } |
| 346 | 346 | |
| 347 | 347 | fn addUnit(sec: *Section, header_len: u32, trailer_len: u32, dwarf: *Dwarf) UpdateError!Unit.Index { |
| 348 | const unit: Unit.Index = @enumFromInt(sec.units.items.len); | |
| 348 | const unit: Unit.Index = @fromBackingInt(@intCast(sec.units.items.len)); | |
| 349 | 349 | const unit_ptr = try sec.units.addOne(dwarf.gpa); |
| 350 | 350 | errdefer sec.popUnit(dwarf.gpa); |
| 351 | 351 | const aligned_header_len: u32 = @intCast(sec.alignment.forward(header_len)); |
| ... | ... | @@ -385,14 +385,14 @@ pub const Section = struct { |
| 385 | 385 | } |
| 386 | 386 | |
| 387 | 387 | fn popUnit(sec: *Section, gpa: Allocator) void { |
| 388 | const unit_index: Unit.Index = @enumFromInt(sec.units.items.len - 1); | |
| 388 | const unit_index: Unit.Index = @fromBackingInt(@intCast(sec.units.items.len - 1)); | |
| 389 | 389 | sec.unlinkUnit(unit_index); |
| 390 | 390 | var unit = sec.units.pop().?; |
| 391 | 391 | unit.deinit(gpa); |
| 392 | 392 | } |
| 393 | 393 | |
| 394 | 394 | pub fn getUnit(sec: *Section, unit: Unit.Index) *Unit { |
| 395 | return &sec.units.items[@intFromEnum(unit)]; | |
| 395 | return &sec.units.items[@backingInt(unit)]; | |
| 396 | 396 | } |
| 397 | 397 | |
| 398 | 398 | fn resizeEntry( |
| ... | ... | @@ -548,12 +548,12 @@ const Unit = struct { |
| 548 | 548 | _, |
| 549 | 549 | |
| 550 | 550 | pub fn unwrap(uio: Optional) ?Index { |
| 551 | return if (uio != .none) @enumFromInt(@intFromEnum(uio)) else null; | |
| 551 | return if (uio != .none) @fromBackingInt(@intCast(@backingInt(uio))) else null; | |
| 552 | 552 | } |
| 553 | 553 | }; |
| 554 | 554 | |
| 555 | 555 | fn toOptional(ui: Index) Optional { |
| 556 | return @enumFromInt(@intFromEnum(ui)); | |
| 556 | return @fromBackingInt(@intCast(@backingInt(ui))); | |
| 557 | 557 | } |
| 558 | 558 | }; |
| 559 | 559 | |
| ... | ... | @@ -577,7 +577,7 @@ const Unit = struct { |
| 577 | 577 | entry_ptr.next = .none; |
| 578 | 578 | return entry; |
| 579 | 579 | } |
| 580 | const entry: Entry.Index = @enumFromInt(unit.entries.items.len); | |
| 580 | const entry: Entry.Index = @fromBackingInt(@intCast(unit.entries.items.len)); | |
| 581 | 581 | const entry_ptr = try unit.entries.addOne(gpa); |
| 582 | 582 | entry_ptr.* = .{ |
| 583 | 583 | .prev = .none, |
| ... | ... | @@ -593,7 +593,7 @@ const Unit = struct { |
| 593 | 593 | } |
| 594 | 594 | |
| 595 | 595 | pub fn getEntry(unit: *Unit, entry: Entry.Index) *Entry { |
| 596 | return &unit.entries.items[@intFromEnum(entry)]; | |
| 596 | return &unit.entries.items[@backingInt(entry)]; | |
| 597 | 597 | } |
| 598 | 598 | |
| 599 | 599 | fn resize(unit_ptr: *Unit, sec: *Section, dwarf: *Dwarf, extra_header_len: u32, len: u32) UpdateError!void { |
| ... | ... | @@ -719,11 +719,11 @@ const Unit = struct { |
| 719 | 719 | defer trailer_aw.deinit(); |
| 720 | 720 | const tw = &trailer_aw.writer; |
| 721 | 721 | const fill_byte: u8 = if (sec == &dwarf.debug_abbrev.section) fill: { |
| 722 | tw.writeUleb128(@intFromEnum(AbbrevCode.null)) catch unreachable; | |
| 723 | assert(uleb128Bytes(@intFromEnum(AbbrevCode.null)) == 1); | |
| 724 | break :fill @intFromEnum(AbbrevCode.null); | |
| 722 | tw.writeUleb128(@backingInt(AbbrevCode.null)) catch unreachable; | |
| 723 | assert(uleb128Bytes(@backingInt(AbbrevCode.null)) == 1); | |
| 724 | break :fill @backingInt(AbbrevCode.null); | |
| 725 | 725 | } else if (sec == &dwarf.debug_aranges.section) fill: { |
| 726 | tw.splatByteAll(0, @intFromEnum(dwarf.address_size) * 2) catch unreachable; | |
| 726 | tw.splatByteAll(0, @backingInt(dwarf.address_size) * 2) catch unreachable; | |
| 727 | 727 | break :fill 0; |
| 728 | 728 | } else if (sec == &dwarf.debug_frame.section) fill: { |
| 729 | 729 | switch (dwarf.debug_frame.header.format) { |
| ... | ... | @@ -746,7 +746,7 @@ const Unit = struct { |
| 746 | 746 | } |
| 747 | 747 | tw.writeByte(4) catch unreachable; |
| 748 | 748 | tw.writeAll("\x00") catch unreachable; |
| 749 | tw.writeByte(@intFromEnum(dwarf.address_size)) catch unreachable; | |
| 749 | tw.writeByte(@backingInt(dwarf.address_size)) catch unreachable; | |
| 750 | 750 | tw.writeByte(0) catch unreachable; |
| 751 | 751 | }, |
| 752 | 752 | .eh_frame => { |
| ... | ... | @@ -763,9 +763,9 @@ const Unit = struct { |
| 763 | 763 | tw.splatByteAll(DW.CFA.nop, unit.trailer_len - tw.end) catch unreachable; |
| 764 | 764 | break :fill DW.CFA.nop; |
| 765 | 765 | } else if (sec == &dwarf.debug_info.section) fill: { |
| 766 | for (0..2) |_| tw.writeUleb128(@intFromEnum(AbbrevCode.null)) catch unreachable; | |
| 767 | assert(uleb128Bytes(@intFromEnum(AbbrevCode.null)) == 1); | |
| 768 | break :fill @intFromEnum(AbbrevCode.null); | |
| 766 | for (0..2) |_| tw.writeUleb128(@backingInt(AbbrevCode.null)) catch unreachable; | |
| 767 | assert(uleb128Bytes(@backingInt(AbbrevCode.null)) == 1); | |
| 768 | break :fill @backingInt(AbbrevCode.null); | |
| 769 | 769 | } else if (sec == &dwarf.debug_rnglists.section) fill: { |
| 770 | 770 | tw.writeByte(DW.RLE.end_of_list) catch unreachable; |
| 771 | 771 | break :fill DW.RLE.end_of_list; |
| ... | ... | @@ -843,12 +843,12 @@ const Entry = struct { |
| 843 | 843 | _, |
| 844 | 844 | |
| 845 | 845 | pub fn unwrap(eio: Optional) ?Index { |
| 846 | return if (eio != .none) @enumFromInt(@intFromEnum(eio)) else null; | |
| 846 | return if (eio != .none) @fromBackingInt(@intCast(@backingInt(eio))) else null; | |
| 847 | 847 | } |
| 848 | 848 | }; |
| 849 | 849 | |
| 850 | 850 | fn toOptional(ei: Index) Optional { |
| 851 | return @enumFromInt(@intFromEnum(ei)); | |
| 851 | return @fromBackingInt(@intCast(@backingInt(ei))); | |
| 852 | 852 | } |
| 853 | 853 | }; |
| 854 | 854 | |
| ... | ... | @@ -880,8 +880,8 @@ const Entry = struct { |
| 880 | 880 | const len = unit.getEntry(entry.next.unwrap() orelse return).off - start; |
| 881 | 881 | var buf: [ |
| 882 | 882 | @max( |
| 883 | uleb128Bytes(@intFromEnum(AbbrevCode.pad_1)), | |
| 884 | uleb128Bytes(@intFromEnum(AbbrevCode.pad_n)) + uleb128Bytes(std.math.maxInt(u32)), | |
| 883 | uleb128Bytes(@backingInt(AbbrevCode.pad_1)), | |
| 884 | uleb128Bytes(@backingInt(AbbrevCode.pad_n)) + uleb128Bytes(std.math.maxInt(u32)), | |
| 885 | 885 | 1 + uleb128Bytes(std.math.maxInt(u32)) + 1, |
| 886 | 886 | ) |
| 887 | 887 | ]u8 = undefined; |
| ... | ... | @@ -984,17 +984,17 @@ const Entry = struct { |
| 984 | 984 | defer dwarf.gpa.free(buf); |
| 985 | 985 | _ = try dwarf.getFile().?.readPositionalAll(io, buf, sec.off(dwarf)); |
| 986 | 986 | log.info("Section{{ .first = {}, .last = {}, .off = 0x{x}, .len = 0x{x} }}", .{ |
| 987 | @intFromEnum(sec.first), | |
| 988 | @intFromEnum(sec.last), | |
| 987 | @backingInt(sec.first), | |
| 988 | @backingInt(sec.last), | |
| 989 | 989 | sec.off(dwarf), |
| 990 | 990 | sec.len, |
| 991 | 991 | }); |
| 992 | 992 | for (sec.units.items) |*unit_ptr| { |
| 993 | 993 | log.info(" Unit{{ .prev = {}, .next = {}, .first = {}, .last = {}, .off = 0x{x}, .header_len = 0x{x}, .trailer_len = 0x{x}, .len = 0x{x} }}", .{ |
| 994 | @intFromEnum(unit_ptr.prev), | |
| 995 | @intFromEnum(unit_ptr.next), | |
| 996 | @intFromEnum(unit_ptr.first), | |
| 997 | @intFromEnum(unit_ptr.last), | |
| 994 | @backingInt(unit_ptr.prev), | |
| 995 | @backingInt(unit_ptr.next), | |
| 996 | @backingInt(unit_ptr.first), | |
| 997 | @backingInt(unit_ptr.last), | |
| 998 | 998 | unit_ptr.off, |
| 999 | 999 | unit_ptr.header_len, |
| 1000 | 1000 | unit_ptr.trailer_len, |
| ... | ... | @@ -1002,8 +1002,8 @@ const Entry = struct { |
| 1002 | 1002 | }); |
| 1003 | 1003 | for (unit_ptr.entries.items) |*entry| { |
| 1004 | 1004 | log.info(" Entry{{ .prev = {}, .next = {}, .off = 0x{x}, .len = 0x{x} }}", .{ |
| 1005 | @intFromEnum(entry.prev), | |
| 1006 | @intFromEnum(entry.next), | |
| 1005 | @backingInt(entry.prev), | |
| 1006 | @backingInt(entry.next), | |
| 1007 | 1007 | entry.off, |
| 1008 | 1008 | entry.len, |
| 1009 | 1009 | }); |
| ... | ... | @@ -1017,7 +1017,7 @@ const Entry = struct { |
| 1017 | 1017 | if (entry.len > 0) return entry; |
| 1018 | 1018 | if (std.debug.runtime_safety) { |
| 1019 | 1019 | log.err("missing {} from {s}", .{ |
| 1020 | @as(Entry.Index, @enumFromInt(entry - unit.entries.items.ptr)), | |
| 1020 | @as(Entry.Index, @fromBackingInt(@intCast(entry - unit.entries.items.ptr))), | |
| 1021 | 1021 | std.mem.sliceTo(if (dwarf.bin_file.cast(.elf)) |elf_file| |
| 1022 | 1022 | elf_file.zigObjectPtr().?.symbol(sec.index).name(elf_file) |
| 1023 | 1023 | else if (dwarf.bin_file.cast(.macho)) |macho_file| |
| ... | ... | @@ -1031,19 +1031,19 @@ const Entry = struct { |
| 1031 | 1031 | const zcu = dwarf.bin_file.comp.zcu.?; |
| 1032 | 1032 | const ip = &zcu.intern_pool; |
| 1033 | 1033 | for (0.., dwarf.values.items) |raw_index, unit_and_entry| { |
| 1034 | const index: link.ConstPool.Index = @enumFromInt(raw_index); | |
| 1034 | const index: link.ConstPool.Index = @fromBackingInt(@intCast(raw_index)); | |
| 1035 | 1035 | const val = index.val(&dwarf.const_pool); |
| 1036 | 1036 | const val_unit, const val_entry = unit_and_entry; |
| 1037 | 1037 | if (sec.getUnit(val_unit) == unit and unit.getEntry(val_entry) == entry) |
| 1038 | 1038 | log.err("missing Value({f}({d}))", .{ |
| 1039 | 1039 | Value.fromInterned(val).fmtValue(.{ .tid = .main, .zcu = zcu }), |
| 1040 | @intFromEnum(val), | |
| 1040 | @backingInt(val), | |
| 1041 | 1041 | }); |
| 1042 | 1042 | } |
| 1043 | 1043 | for (dwarf.navs.keys(), dwarf.navs.values()) |nav, other_entry| { |
| 1044 | 1044 | const nav_unit = dwarf.getUnit(zcu.fileByIndex(ip.getNav(nav).srcInst(ip).resolveFile(ip)).mod.?) catch unreachable; |
| 1045 | 1045 | if (sec.getUnit(nav_unit) == unit and unit.getEntry(other_entry) == entry) |
| 1046 | log.err("missing Nav({f}({d}))", .{ ip.getNav(nav).fqn.fmt(ip), @intFromEnum(nav) }); | |
| 1046 | log.err("missing Nav({f}({d}))", .{ ip.getNav(nav).fqn.fmt(ip), @backingInt(nav) }); | |
| 1047 | 1047 | } |
| 1048 | 1048 | } |
| 1049 | 1049 | @panic("missing dwarf relocation target"); |
| ... | ... | @@ -1108,7 +1108,7 @@ const Entry = struct { |
| 1108 | 1108 | entry_off + reloc.source_off, |
| 1109 | 1109 | @bitCast(symbol.address(.{}, elf_file) + @as(i64, @intCast(reloc.target_off)) - |
| 1110 | 1110 | if (symbol.flags.is_tls) elf_file.dtpAddress() else 0), |
| 1111 | @intFromEnum(dwarf.address_size), | |
| 1111 | @backingInt(dwarf.address_size), | |
| 1112 | 1112 | ); |
| 1113 | 1113 | } |
| 1114 | 1114 | } else if (dwarf.bin_file.cast(.macho)) |macho_file| { |
| ... | ... | @@ -1118,7 +1118,7 @@ const Entry = struct { |
| 1118 | 1118 | try dwarf.resolveReloc( |
| 1119 | 1119 | entry_off + reloc.source_off, |
| 1120 | 1120 | ref.getSymbol(macho_file).?.getAddress(.{}, macho_file) + @as(i64, @intCast(reloc.target_off)), |
| 1121 | @intFromEnum(dwarf.address_size), | |
| 1121 | @backingInt(dwarf.address_size), | |
| 1122 | 1122 | ); |
| 1123 | 1123 | } |
| 1124 | 1124 | } |
| ... | ... | @@ -1735,10 +1735,10 @@ pub const WipNav = struct { |
| 1735 | 1735 | }; |
| 1736 | 1736 | } |
| 1737 | 1737 | fn leaveBlockWriterError(wip_nav: *WipNav, code_off: u64) (UpdateError || Writer.Error)!void { |
| 1738 | const block_bytes = comptime uleb128Bytes(@intFromEnum(AbbrevCode.block)); | |
| 1738 | const block_bytes = comptime uleb128Bytes(@backingInt(AbbrevCode.block)); | |
| 1739 | 1739 | const block = wip_nav.blocks.pop().?; |
| 1740 | 1740 | if (wip_nav.any_children) |
| 1741 | try wip_nav.debug_info.writer.writeUleb128(@intFromEnum(AbbrevCode.null)) | |
| 1741 | try wip_nav.debug_info.writer.writeUleb128(@backingInt(AbbrevCode.null)) | |
| 1742 | 1742 | else |
| 1743 | 1743 | std.leb.writeUnsignedFixed( |
| 1744 | 1744 | block_bytes, |
| ... | ... | @@ -1797,10 +1797,10 @@ pub const WipNav = struct { |
| 1797 | 1797 | func: InternPool.Index, |
| 1798 | 1798 | code_off: u64, |
| 1799 | 1799 | ) (UpdateError || Writer.Error)!void { |
| 1800 | const inlined_func_bytes = comptime uleb128Bytes(@intFromEnum(AbbrevCode.inlined_func)); | |
| 1800 | const inlined_func_bytes = comptime uleb128Bytes(@backingInt(AbbrevCode.inlined_func)); | |
| 1801 | 1801 | const block = wip_nav.blocks.pop().?; |
| 1802 | 1802 | if (wip_nav.any_children) |
| 1803 | try wip_nav.debug_info.writer.writeUleb128(@intFromEnum(AbbrevCode.null)) | |
| 1803 | try wip_nav.debug_info.writer.writeUleb128(@backingInt(AbbrevCode.null)) | |
| 1804 | 1804 | else |
| 1805 | 1805 | std.leb.writeUnsignedFixed( |
| 1806 | 1806 | inlined_func_bytes, |
| ... | ... | @@ -1959,7 +1959,7 @@ pub const WipNav = struct { |
| 1959 | 1959 | return @import("builtin").cpu.arch.endian(); |
| 1960 | 1960 | } |
| 1961 | 1961 | fn addrSym(counter: *ExprLocCounter, _: link.File.SymbolId) Writer.Error!void { |
| 1962 | try counter.dw.writer.splatByteAll(undefined, @intFromEnum(counter.address_size)); | |
| 1962 | try counter.dw.writer.splatByteAll(undefined, @backingInt(counter.address_size)); | |
| 1963 | 1963 | } |
| 1964 | 1964 | fn infoEntry(counter: *ExprLocCounter, _: Unit.Index, _: Entry.Index) Writer.Error!void { |
| 1965 | 1965 | try counter.dw.writer.splatByteAll(undefined, counter.section_offset_bytes); |
| ... | ... | @@ -2005,7 +2005,7 @@ pub const WipNav = struct { |
| 2005 | 2005 | .target_sym = sym_index, |
| 2006 | 2006 | .target_off = sym_off, |
| 2007 | 2007 | }); |
| 2008 | try diw.splatByteAll(0, @intFromEnum(wip_nav.dwarf.address_size)); | |
| 2008 | try diw.splatByteAll(0, @backingInt(wip_nav.dwarf.address_size)); | |
| 2009 | 2009 | } |
| 2010 | 2010 | |
| 2011 | 2011 | fn frameExprLoc(wip_nav: *WipNav, loc: Loc) (UpdateError || Writer.Error)!void { |
| ... | ... | @@ -2047,7 +2047,7 @@ pub const WipNav = struct { |
| 2047 | 2047 | .target_sym = sym_index, |
| 2048 | 2048 | .target_off = sym_off, |
| 2049 | 2049 | }); |
| 2050 | try dfw.splatByteAll(0, @intFromEnum(wip_nav.dwarf.address_size)); | |
| 2050 | try dfw.splatByteAll(0, @backingInt(wip_nav.dwarf.address_size)); | |
| 2051 | 2051 | } |
| 2052 | 2052 | |
| 2053 | 2053 | fn refNav( |
| ... | ... | @@ -2073,7 +2073,7 @@ pub const WipNav = struct { |
| 2073 | 2073 | } |
| 2074 | 2074 | const dwarf = wip_nav.dwarf; |
| 2075 | 2075 | const index = try dwarf.const_pool.get(wip_nav.pt, .{ .dwarf = dwarf }, value.toIntern()); |
| 2076 | return dwarf.values.items[@intFromEnum(index)]; | |
| 2076 | return dwarf.values.items[@backingInt(index)]; | |
| 2077 | 2077 | } |
| 2078 | 2078 | |
| 2079 | 2079 | fn refForward(wip_nav: *WipNav) (Allocator.Error || Writer.Error)!u32 { |
| ... | ... | @@ -2438,14 +2438,14 @@ pub fn initMetadata(dwarf: *Dwarf) UpdateError!void { |
| 2438 | 2438 | assert(try dwarf.debug_abbrev.section.addUnit(DebugAbbrev.header_bytes, DebugAbbrev.trailer_bytes, dwarf) == DebugAbbrev.unit); |
| 2439 | 2439 | errdefer dwarf.debug_abbrev.section.popUnit(dwarf.gpa); |
| 2440 | 2440 | for (std.enums.values(AbbrevCode)) |abbrev_code| |
| 2441 | assert(@intFromEnum(try dwarf.debug_abbrev.section.getUnit(DebugAbbrev.unit).addEntry(dwarf.gpa)) == @intFromEnum(abbrev_code)); | |
| 2441 | assert(@backingInt(try dwarf.debug_abbrev.section.getUnit(DebugAbbrev.unit).addEntry(dwarf.gpa)) == @backingInt(abbrev_code)); | |
| 2442 | 2442 | |
| 2443 | 2443 | dwarf.debug_aranges.section.pad_entries_to_ideal = false; |
| 2444 | dwarf.debug_aranges.section.alignment = InternPool.Alignment.fromNonzeroByteUnits(@intFromEnum(dwarf.address_size) * 2); | |
| 2444 | dwarf.debug_aranges.section.alignment = InternPool.Alignment.fromNonzeroByteUnits(@backingInt(dwarf.address_size) * 2); | |
| 2445 | 2445 | |
| 2446 | 2446 | dwarf.debug_frame.section.alignment = switch (dwarf.debug_frame.header.format) { |
| 2447 | 2447 | .none => .@"1", |
| 2448 | .debug_frame => InternPool.Alignment.fromNonzeroByteUnits(@intFromEnum(dwarf.address_size)), | |
| 2448 | .debug_frame => InternPool.Alignment.fromNonzeroByteUnits(@backingInt(dwarf.address_size)), | |
| 2449 | 2449 | .eh_frame => .@"4", |
| 2450 | 2450 | }; |
| 2451 | 2451 | |
| ... | ... | @@ -2499,7 +2499,7 @@ fn getNavEntry( |
| 2499 | 2499 | |
| 2500 | 2500 | fn getUnit(dwarf: *Dwarf, mod: *Module) !Unit.Index { |
| 2501 | 2501 | const mod_gop = try dwarf.mods.getOrPut(dwarf.gpa, mod); |
| 2502 | const unit: Unit.Index = @enumFromInt(mod_gop.index); | |
| 2502 | const unit: Unit.Index = @fromBackingInt(@intCast(mod_gop.index)); | |
| 2503 | 2503 | if (!mod_gop.found_existing) { |
| 2504 | 2504 | errdefer _ = dwarf.mods.pop(); |
| 2505 | 2505 | mod_gop.value_ptr.* = .{ |
| ... | ... | @@ -2550,15 +2550,15 @@ fn getUnit(dwarf: *Dwarf, mod: *Module) !Unit.Index { |
| 2550 | 2550 | } |
| 2551 | 2551 | |
| 2552 | 2552 | fn getUnitIfExists(dwarf: *const Dwarf, mod: *Module) ?Unit.Index { |
| 2553 | return @enumFromInt(dwarf.mods.getIndex(mod) orelse return null); | |
| 2553 | return @fromBackingInt(@intCast(dwarf.mods.getIndex(mod) orelse return null)); | |
| 2554 | 2554 | } |
| 2555 | 2555 | |
| 2556 | 2556 | fn getModInfo(dwarf: *Dwarf, unit: Unit.Index) *ModInfo { |
| 2557 | return &dwarf.mods.values()[@intFromEnum(unit)]; | |
| 2557 | return &dwarf.mods.values()[@backingInt(unit)]; | |
| 2558 | 2558 | } |
| 2559 | 2559 | |
| 2560 | 2560 | fn getUnitModule(dwarf: *Dwarf, unit: Unit.Index) *Module { |
| 2561 | return dwarf.mods.keys()[@intFromEnum(unit)]; | |
| 2561 | return dwarf.mods.keys()[@backingInt(unit)]; | |
| 2562 | 2562 | } |
| 2563 | 2563 | |
| 2564 | 2564 | pub fn initWipNav( |
| ... | ... | @@ -2590,7 +2590,7 @@ fn initWipNavInner( |
| 2590 | 2590 | file.sub_file_path, |
| 2591 | 2591 | decl.src_line + 1, |
| 2592 | 2592 | decl.src_column + 1, |
| 2593 | @intFromEnum(inst_info.inst), | |
| 2593 | @backingInt(inst_info.inst), | |
| 2594 | 2594 | nav.fqn.fmt(ip), |
| 2595 | 2595 | }); |
| 2596 | 2596 | |
| ... | ... | @@ -2650,7 +2650,7 @@ fn initWipNavInner( |
| 2650 | 2650 | try wip_nav.refType(.fromInterned(param_type)); |
| 2651 | 2651 | } |
| 2652 | 2652 | if (func_type.is_var_args) try wip_nav.abbrevCode(.is_var_args); |
| 2653 | try diw.writeUleb128(@intFromEnum(AbbrevCode.null)); | |
| 2653 | try diw.writeUleb128(@backingInt(AbbrevCode.null)); | |
| 2654 | 2654 | } |
| 2655 | 2655 | } else try wip_nav.infoExprLoc(.{ .addr_reloc = sym_index }); |
| 2656 | 2656 | }, |
| ... | ... | @@ -2678,7 +2678,7 @@ fn initWipNavInner( |
| 2678 | 2678 | try wip_nav.refType(.fromInterned(param_type)); |
| 2679 | 2679 | } |
| 2680 | 2680 | if (func_type.is_var_args) try wip_nav.abbrevCode(.is_var_args); |
| 2681 | try diw.writeUleb128(@intFromEnum(AbbrevCode.null)); | |
| 2681 | try diw.writeUleb128(@backingInt(AbbrevCode.null)); | |
| 2682 | 2682 | } |
| 2683 | 2683 | }, |
| 2684 | 2684 | }, |
| ... | ... | @@ -2720,7 +2720,7 @@ fn initWipNavInner( |
| 2720 | 2720 | }); |
| 2721 | 2721 | try dfw.splatByteAll(0, dwarf.sectionOffsetBytes()); |
| 2722 | 2722 | try wip_nav.frameAddrSym(sym_index, 0); |
| 2723 | try dfw.splatByteAll(undefined, @intFromEnum(dwarf.address_size)); | |
| 2723 | try dfw.splatByteAll(undefined, @backingInt(dwarf.address_size)); | |
| 2724 | 2724 | }, |
| 2725 | 2725 | .eh_frame => { |
| 2726 | 2726 | try dfw.writeInt(u32, undefined, dwarf.endian); |
| ... | ... | @@ -2776,13 +2776,13 @@ fn initWipNavInner( |
| 2776 | 2776 | |
| 2777 | 2777 | try wip_nav.advancePCAndLine(func.lbrace_line, 0); |
| 2778 | 2778 | } else { |
| 2779 | try dlw.writeUleb128(1 + @intFromEnum(dwarf.address_size)); | |
| 2779 | try dlw.writeUleb128(1 + @backingInt(dwarf.address_size)); | |
| 2780 | 2780 | try dlw.writeByte(DW.LNE.set_address); |
| 2781 | 2781 | try dwarf.debug_line.section.getUnit(wip_nav.unit).getEntry(wip_nav.entry).external_relocs.append(dwarf.gpa, .{ |
| 2782 | 2782 | .source_off = @intCast(dlw.end), |
| 2783 | 2783 | .target_sym = sym_index, |
| 2784 | 2784 | }); |
| 2785 | try dlw.splatByteAll(0, @intFromEnum(dwarf.address_size)); | |
| 2785 | try dlw.splatByteAll(0, @backingInt(dwarf.address_size)); | |
| 2786 | 2786 | |
| 2787 | 2787 | const file_gop = try dwarf.getModInfo(unit).files.getOrPut(dwarf.gpa, inst_info.file); |
| 2788 | 2788 | try dlw.writeByte(DW.LNS.set_file); |
| ... | ... | @@ -2872,13 +2872,13 @@ fn finishWipNavFuncWriterError( |
| 2872 | 2872 | const external_relocs = &dwarf.debug_aranges.section.getUnit(wip_nav.unit).getEntry(wip_nav.entry).external_relocs; |
| 2873 | 2873 | try external_relocs.append(dwarf.gpa, .{ .target_sym = wip_nav.func_sym_index }); |
| 2874 | 2874 | var entry: [8 + 8]u8 = undefined; |
| 2875 | @memset(entry[0..@intFromEnum(dwarf.address_size)], 0); | |
| 2876 | dwarf.writeInt(entry[@intFromEnum(dwarf.address_size)..][0..@intFromEnum(dwarf.address_size)], code_size); | |
| 2875 | @memset(entry[0..@backingInt(dwarf.address_size)], 0); | |
| 2876 | dwarf.writeInt(entry[@backingInt(dwarf.address_size)..][0..@backingInt(dwarf.address_size)], code_size); | |
| 2877 | 2877 | try dwarf.debug_aranges.section.replaceEntry( |
| 2878 | 2878 | wip_nav.unit, |
| 2879 | 2879 | wip_nav.entry, |
| 2880 | 2880 | dwarf, |
| 2881 | entry[0 .. @intFromEnum(dwarf.address_size) * 2], | |
| 2881 | entry[0 .. @backingInt(dwarf.address_size) * 2], | |
| 2882 | 2882 | ); |
| 2883 | 2883 | } |
| 2884 | 2884 | switch (dwarf.debug_frame.header.format) { |
| ... | ... | @@ -2901,7 +2901,7 @@ fn finishWipNavFuncWriterError( |
| 2901 | 2901 | switch (format) { |
| 2902 | 2902 | .none => unreachable, |
| 2903 | 2903 | .debug_frame => dwarf.writeInt(contents[dwarf.unitLengthBytes() + dwarf.sectionOffsetBytes() + |
| 2904 | @intFromEnum(dwarf.address_size) ..][0..@intFromEnum(dwarf.address_size)], code_size), | |
| 2904 | @backingInt(dwarf.address_size) ..][0..@backingInt(dwarf.address_size)], code_size), | |
| 2905 | 2905 | .eh_frame => { |
| 2906 | 2906 | std.mem.writeInt( |
| 2907 | 2907 | u32, |
| ... | ... | @@ -2919,13 +2919,13 @@ fn finishWipNavFuncWriterError( |
| 2919 | 2919 | std.mem.writeInt(u32, wip_nav.debug_info.written()[wip_nav.func_high_pc..][0..4], @intCast(code_size), dwarf.endian); |
| 2920 | 2920 | if (wip_nav.any_children) { |
| 2921 | 2921 | const diw = &wip_nav.debug_info.writer; |
| 2922 | try diw.writeUleb128(@intFromEnum(AbbrevCode.null)); | |
| 2922 | try diw.writeUleb128(@backingInt(AbbrevCode.null)); | |
| 2923 | 2923 | } else { |
| 2924 | 2924 | const abbrev_code_buf = wip_nav.debug_info.written()[0..AbbrevCode.decl_bytes]; |
| 2925 | 2925 | var abbrev_code_fr: std.Io.Reader = .fixed(abbrev_code_buf); |
| 2926 | const abbrev_code: AbbrevCode = @enumFromInt( | |
| 2926 | const abbrev_code: AbbrevCode = @fromBackingInt(@intCast( | |
| 2927 | 2927 | abbrev_code_fr.takeLeb128(@typeInfo(AbbrevCode).@"enum".tag_type) catch unreachable, |
| 2928 | ); | |
| 2928 | )); | |
| 2929 | 2929 | std.leb.writeUnsignedFixed( |
| 2930 | 2930 | AbbrevCode.decl_bytes, |
| 2931 | 2931 | abbrev_code_buf, |
| ... | ... | @@ -2944,7 +2944,7 @@ fn finishWipNavFuncWriterError( |
| 2944 | 2944 | .target_sym = wip_nav.func_sym_index, |
| 2945 | 2945 | }, |
| 2946 | 2946 | .{ |
| 2947 | .source_off = 1 + @intFromEnum(dwarf.address_size), | |
| 2947 | .source_off = 1 + @backingInt(dwarf.address_size), | |
| 2948 | 2948 | .target_sym = wip_nav.func_sym_index, |
| 2949 | 2949 | .target_off = code_size, |
| 2950 | 2950 | }, |
| ... | ... | @@ -2953,7 +2953,7 @@ fn finishWipNavFuncWriterError( |
| 2953 | 2953 | wip_nav.unit, |
| 2954 | 2954 | wip_nav.entry, |
| 2955 | 2955 | dwarf, |
| 2956 | ([1]u8{DW.RLE.start_end} ++ @as([8 + 8]u8, @splat(0)))[0 .. 1 + @intFromEnum(dwarf.address_size) + @intFromEnum(dwarf.address_size)], | |
| 2956 | ([1]u8{DW.RLE.start_end} ++ @as([8 + 8]u8, @splat(0)))[0 .. 1 + @backingInt(dwarf.address_size) + @backingInt(dwarf.address_size)], | |
| 2957 | 2957 | ); |
| 2958 | 2958 | } |
| 2959 | 2959 | |
| ... | ... | @@ -3015,7 +3015,7 @@ fn updateComptimeNavInner(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPoo |
| 3015 | 3015 | file.sub_file_path, |
| 3016 | 3016 | decl.src_line + 1, |
| 3017 | 3017 | decl.src_column + 1, |
| 3018 | @intFromEnum(inst_info.inst), | |
| 3018 | @backingInt(inst_info.inst), | |
| 3019 | 3019 | nav.fqn.fmt(ip), |
| 3020 | 3020 | }); |
| 3021 | 3021 | |
| ... | ... | @@ -3248,7 +3248,7 @@ fn updateComptimeNavInner(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPoo |
| 3248 | 3248 | try wip_nav.refType(.fromInterned(func_type.param_types.get(ip)[param_index])); |
| 3249 | 3249 | } |
| 3250 | 3250 | if (func_type.is_var_args) try wip_nav.abbrevCode(.is_var_args); |
| 3251 | try diw.writeUleb128(@intFromEnum(AbbrevCode.null)); | |
| 3251 | try diw.writeUleb128(@backingInt(AbbrevCode.null)); | |
| 3252 | 3252 | } |
| 3253 | 3253 | }, |
| 3254 | 3254 | .func_alias => |owner_nav| { |
| ... | ... | @@ -3305,7 +3305,7 @@ fn addConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, index: link.ConstPool.Index, |
| 3305 | 3305 | }, |
| 3306 | 3306 | }; |
| 3307 | 3307 | |
| 3308 | assert(@intFromEnum(index) == dwarf.values.items.len); | |
| 3308 | assert(@backingInt(index) == dwarf.values.items.len); | |
| 3309 | 3309 | try dwarf.values.append(dwarf.gpa, .{ unit, entry }); |
| 3310 | 3310 | } |
| 3311 | 3311 | /// Should only be called by the `link.ConstPool` implementation. |
| ... | ... | @@ -3332,7 +3332,7 @@ fn updateConstIncompleteInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_inde |
| 3332 | 3332 | }), |
| 3333 | 3333 | } |
| 3334 | 3334 | |
| 3335 | const unit, const entry = dwarf.values.items[@intFromEnum(debug_const_index)]; | |
| 3335 | const unit, const entry = dwarf.values.items[@backingInt(debug_const_index)]; | |
| 3336 | 3336 | |
| 3337 | 3337 | for ([_]*Section{ |
| 3338 | 3338 | &dwarf.debug_aranges.section, |
| ... | ... | @@ -3501,7 +3501,7 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co |
| 3501 | 3501 | }), |
| 3502 | 3502 | } |
| 3503 | 3503 | |
| 3504 | const unit, const entry = dwarf.values.items[@intFromEnum(debug_const_index)]; | |
| 3504 | const unit, const entry = dwarf.values.items[@backingInt(debug_const_index)]; | |
| 3505 | 3505 | |
| 3506 | 3506 | for ([_]*Section{ |
| 3507 | 3507 | &dwarf.debug_aranges.section, |
| ... | ... | @@ -3556,7 +3556,7 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co |
| 3556 | 3556 | try wip_nav.strpFmt("{f}", .{val.toType().fmt(pt)}); |
| 3557 | 3557 | if (ptr_type.sentinel != .none) try wip_nav.blockValue(.fromInterned(ptr_type.sentinel)); |
| 3558 | 3558 | if (ptr_type.flags.alignment.toByteUnits()) |a| try diw.writeUleb128(a); |
| 3559 | try diw.writeByte(@intFromEnum(ptr_type.flags.address_space)); | |
| 3559 | try diw.writeByte(@backingInt(ptr_type.flags.address_space)); | |
| 3560 | 3560 | if (ptr_type.flags.is_const or ptr_type.flags.is_volatile) try wip_nav.infoSectionOffset( |
| 3561 | 3561 | .debug_info, |
| 3562 | 3562 | wip_nav.unit, |
| ... | ... | @@ -3592,7 +3592,7 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co |
| 3592 | 3592 | const len_field_type: Type = .usize; |
| 3593 | 3593 | try wip_nav.refType(len_field_type); |
| 3594 | 3594 | try diw.writeUleb128(len_field_type.abiAlignment(zcu).forward(ptr_field_type.abiSize(zcu))); |
| 3595 | try diw.writeUleb128(@intFromEnum(AbbrevCode.null)); | |
| 3595 | try diw.writeUleb128(@backingInt(AbbrevCode.null)); | |
| 3596 | 3596 | }, |
| 3597 | 3597 | }, |
| 3598 | 3598 | .array_type => |array_type| { |
| ... | ... | @@ -3604,7 +3604,7 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co |
| 3604 | 3604 | try wip_nav.abbrevCode(.array_len); |
| 3605 | 3605 | try wip_nav.refType(.usize); |
| 3606 | 3606 | try diw.writeUleb128(array_type.len); |
| 3607 | try diw.writeUleb128(@intFromEnum(AbbrevCode.null)); | |
| 3607 | try diw.writeUleb128(@backingInt(AbbrevCode.null)); | |
| 3608 | 3608 | }, |
| 3609 | 3609 | .vector_type => |vector_type| { |
| 3610 | 3610 | try wip_nav.abbrevCode(.vector_type); |
| ... | ... | @@ -3613,7 +3613,7 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co |
| 3613 | 3613 | try wip_nav.abbrevCode(.array_len); |
| 3614 | 3614 | try wip_nav.refType(.usize); |
| 3615 | 3615 | try diw.writeUleb128(vector_type.len); |
| 3616 | try diw.writeUleb128(@intFromEnum(AbbrevCode.null)); | |
| 3616 | try diw.writeUleb128(@backingInt(AbbrevCode.null)); | |
| 3617 | 3617 | }, |
| 3618 | 3618 | .opt_type => |opt_child_type_index| { |
| 3619 | 3619 | const opt_child_type: Type = .fromInterned(opt_child_type_index); |
| ... | ... | @@ -3671,7 +3671,7 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co |
| 3671 | 3671 | try wip_nav.refType(.null); |
| 3672 | 3672 | try diw.writeUleb128(0); |
| 3673 | 3673 | } |
| 3674 | try diw.writeUleb128(@intFromEnum(AbbrevCode.null)); | |
| 3674 | try diw.writeUleb128(@backingInt(AbbrevCode.null)); | |
| 3675 | 3675 | |
| 3676 | 3676 | try wip_nav.abbrevCode(.tagged_union_default_field); |
| 3677 | 3677 | { |
| ... | ... | @@ -3680,12 +3680,12 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co |
| 3680 | 3680 | try wip_nav.refType(opt_child_type); |
| 3681 | 3681 | try diw.writeUleb128(0); |
| 3682 | 3682 | } |
| 3683 | try diw.writeUleb128(@intFromEnum(AbbrevCode.null)); | |
| 3683 | try diw.writeUleb128(@backingInt(AbbrevCode.null)); | |
| 3684 | 3684 | } |
| 3685 | try diw.writeUleb128(@intFromEnum(AbbrevCode.null)); | |
| 3685 | try diw.writeUleb128(@backingInt(AbbrevCode.null)); | |
| 3686 | 3686 | }, |
| 3687 | 3687 | } |
| 3688 | try diw.writeUleb128(@intFromEnum(AbbrevCode.null)); | |
| 3688 | try diw.writeUleb128(@backingInt(AbbrevCode.null)); | |
| 3689 | 3689 | }, |
| 3690 | 3690 | .anyframe_type => unreachable, |
| 3691 | 3691 | .error_union_type => |error_union_type| { |
| ... | ... | @@ -3736,7 +3736,7 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co |
| 3736 | 3736 | try wip_nav.refType(error_union_payload_type); |
| 3737 | 3737 | try diw.writeUleb128(error_union_payload_offset); |
| 3738 | 3738 | } |
| 3739 | try diw.writeUleb128(@intFromEnum(AbbrevCode.null)); | |
| 3739 | try diw.writeUleb128(@backingInt(AbbrevCode.null)); | |
| 3740 | 3740 | |
| 3741 | 3741 | try wip_nav.abbrevCode(.tagged_union_default_field); |
| 3742 | 3742 | { |
| ... | ... | @@ -3745,11 +3745,11 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co |
| 3745 | 3745 | try wip_nav.refType(error_union_error_set_type); |
| 3746 | 3746 | try diw.writeUleb128(error_union_error_set_offset); |
| 3747 | 3747 | } |
| 3748 | try diw.writeUleb128(@intFromEnum(AbbrevCode.null)); | |
| 3748 | try diw.writeUleb128(@backingInt(AbbrevCode.null)); | |
| 3749 | 3749 | } |
| 3750 | try diw.writeUleb128(@intFromEnum(AbbrevCode.null)); | |
| 3750 | try diw.writeUleb128(@backingInt(AbbrevCode.null)); | |
| 3751 | 3751 | } |
| 3752 | try diw.writeUleb128(@intFromEnum(AbbrevCode.null)); | |
| 3752 | try diw.writeUleb128(@backingInt(AbbrevCode.null)); | |
| 3753 | 3753 | }, |
| 3754 | 3754 | .simple_type => |simple_type| switch (simple_type) { |
| 3755 | 3755 | .f16, |
| ... | ... | @@ -3850,7 +3850,7 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co |
| 3850 | 3850 | else if (has_runtime_bits) |
| 3851 | 3851 | try wip_nav.blockValue(.fromInterned(comptime_value)); |
| 3852 | 3852 | } |
| 3853 | try diw.writeUleb128(@intFromEnum(AbbrevCode.null)); | |
| 3853 | try diw.writeUleb128(@backingInt(AbbrevCode.null)); | |
| 3854 | 3854 | }, |
| 3855 | 3855 | .struct_type => { |
| 3856 | 3856 | const loaded_struct = ip.loadStructType(value_index); |
| ... | ... | @@ -3937,7 +3937,7 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co |
| 3937 | 3937 | else if (has_runtime_bits) |
| 3938 | 3938 | try wip_nav.blockValue(.fromInterned(field_init)); |
| 3939 | 3939 | } |
| 3940 | try diw.writeUleb128(@intFromEnum(AbbrevCode.null)); | |
| 3940 | try diw.writeUleb128(@backingInt(AbbrevCode.null)); | |
| 3941 | 3941 | } |
| 3942 | 3942 | }, |
| 3943 | 3943 | .@"packed" => { |
| ... | ... | @@ -3968,7 +3968,7 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co |
| 3968 | 3968 | try diw.writeUleb128(field_bit_offset); |
| 3969 | 3969 | field_bit_offset += @intCast(field_type.bitSize(zcu)); |
| 3970 | 3970 | } |
| 3971 | if (need_terminator) try diw.writeUleb128(@intFromEnum(AbbrevCode.null)); | |
| 3971 | if (need_terminator) try diw.writeUleb128(@backingInt(AbbrevCode.null)); | |
| 3972 | 3972 | }, |
| 3973 | 3973 | } |
| 3974 | 3974 | }, |
| ... | ... | @@ -4024,10 +4024,10 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co |
| 4024 | 4024 | try diw.writeUleb128(loaded_union.field_aligns.getOrNone(ip, field_index).toByteUnits() orelse |
| 4025 | 4025 | if (field_type.isNoReturn(zcu)) 1 else field_type.abiAlignment(zcu).toByteUnits().?); |
| 4026 | 4026 | } |
| 4027 | try diw.writeUleb128(@intFromEnum(AbbrevCode.null)); | |
| 4027 | try diw.writeUleb128(@backingInt(AbbrevCode.null)); | |
| 4028 | 4028 | } |
| 4029 | 4029 | } |
| 4030 | try diw.writeUleb128(@intFromEnum(AbbrevCode.null)); | |
| 4030 | try diw.writeUleb128(@backingInt(AbbrevCode.null)); | |
| 4031 | 4031 | } else for (0..loaded_union.field_types.len) |field_index| { |
| 4032 | 4032 | try wip_nav.abbrevCode(.field); |
| 4033 | 4033 | try wip_nav.strp(loaded_tag.field_names.get(ip)[field_index].toSlice(ip)); |
| ... | ... | @@ -4037,7 +4037,7 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co |
| 4037 | 4037 | try diw.writeUleb128(loaded_union.field_aligns.getOrNone(ip, field_index).toByteUnits() orelse |
| 4038 | 4038 | if (field_type.isNoReturn(zcu)) 1 else field_type.abiAlignment(zcu).toByteUnits().?); |
| 4039 | 4039 | } |
| 4040 | if (need_terminator) try diw.writeUleb128(@intFromEnum(AbbrevCode.null)); | |
| 4040 | if (need_terminator) try diw.writeUleb128(@backingInt(AbbrevCode.null)); | |
| 4041 | 4041 | }, |
| 4042 | 4042 | .@"packed" => { |
| 4043 | 4043 | const need_terminator: bool = if (loaded_union.name_nav.unwrap()) |nav_index| t: { |
| ... | ... | @@ -4064,7 +4064,7 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co |
| 4064 | 4064 | try wip_nav.refType(.fromInterned(loaded_union.field_types.get(ip)[field_index])); |
| 4065 | 4065 | try diw.writeUleb128(0); |
| 4066 | 4066 | } |
| 4067 | if (need_terminator) try diw.writeUleb128(@intFromEnum(AbbrevCode.null)); | |
| 4067 | if (need_terminator) try diw.writeUleb128(@backingInt(AbbrevCode.null)); | |
| 4068 | 4068 | }, |
| 4069 | 4069 | } |
| 4070 | 4070 | }, |
| ... | ... | @@ -4098,7 +4098,7 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co |
| 4098 | 4098 | try wip_nav.enumConstValue(loaded_enum, field_index); |
| 4099 | 4099 | try wip_nav.strp(loaded_enum.field_names.get(ip)[field_index].toSlice(ip)); |
| 4100 | 4100 | } |
| 4101 | if (loaded_enum.field_names.len > 0) try diw.writeUleb128(@intFromEnum(AbbrevCode.null)); | |
| 4101 | if (loaded_enum.field_names.len > 0) try diw.writeUleb128(@backingInt(AbbrevCode.null)); | |
| 4102 | 4102 | } else { |
| 4103 | 4103 | assert(loaded_enum.owner_union != .none); |
| 4104 | 4104 | try wip_nav.abbrevCode(if (loaded_enum.field_names.len == 0) .generated_empty_enum_type else .generated_enum_type); |
| ... | ... | @@ -4109,7 +4109,7 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co |
| 4109 | 4109 | try wip_nav.enumConstValue(loaded_enum, field_index); |
| 4110 | 4110 | try wip_nav.strp(loaded_enum.field_names.get(ip)[field_index].toSlice(ip)); |
| 4111 | 4111 | } |
| 4112 | if (loaded_enum.field_names.len > 0) try diw.writeUleb128(@intFromEnum(AbbrevCode.null)); | |
| 4112 | if (loaded_enum.field_names.len > 0) try diw.writeUleb128(@backingInt(AbbrevCode.null)); | |
| 4113 | 4113 | } |
| 4114 | 4114 | }, |
| 4115 | 4115 | .opaque_type => { |
| ... | ... | @@ -4204,7 +4204,7 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co |
| 4204 | 4204 | else => .nocall, |
| 4205 | 4205 | }; |
| 4206 | 4206 | }; |
| 4207 | try diw.writeByte(@intFromEnum(cc)); | |
| 4207 | try diw.writeByte(@backingInt(cc)); | |
| 4208 | 4208 | try wip_nav.refType(.fromInterned(func_type.return_type)); |
| 4209 | 4209 | if (!is_nullary) { |
| 4210 | 4210 | for (0..func_type.param_types.len) |param_index| { |
| ... | ... | @@ -4212,7 +4212,7 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co |
| 4212 | 4212 | try wip_nav.refType(.fromInterned(func_type.param_types.get(ip)[param_index])); |
| 4213 | 4213 | } |
| 4214 | 4214 | if (func_type.is_var_args) try wip_nav.abbrevCode(.is_var_args); |
| 4215 | try diw.writeUleb128(@intFromEnum(AbbrevCode.null)); | |
| 4215 | try diw.writeUleb128(@backingInt(AbbrevCode.null)); | |
| 4216 | 4216 | } |
| 4217 | 4217 | }, |
| 4218 | 4218 | .error_set_type => |error_set_type| { |
| ... | ... | @@ -4229,7 +4229,7 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co |
| 4229 | 4229 | try diw.writeUleb128(ip.getErrorValueIfExists(field_name).?); |
| 4230 | 4230 | try wip_nav.strp(field_name.toSlice(ip)); |
| 4231 | 4231 | } |
| 4232 | if (error_set_type.names.len > 0) try diw.writeUleb128(@intFromEnum(AbbrevCode.null)); | |
| 4232 | if (error_set_type.names.len > 0) try diw.writeUleb128(@backingInt(AbbrevCode.null)); | |
| 4233 | 4233 | }, |
| 4234 | 4234 | .inferred_error_set_type => |func| { |
| 4235 | 4235 | try wip_nav.abbrevCode(.inferred_error_set_type); |
| ... | ... | @@ -4311,7 +4311,7 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co |
| 4311 | 4311 | try diw.writeUleb128(err_bytes.len); |
| 4312 | 4312 | try diw.writeAll(err_bytes); |
| 4313 | 4313 | } |
| 4314 | try diw.writeUleb128(@intFromEnum(AbbrevCode.null)); | |
| 4314 | try diw.writeUleb128(@backingInt(AbbrevCode.null)); | |
| 4315 | 4315 | }, |
| 4316 | 4316 | .enum_literal => |enum_literal| { |
| 4317 | 4317 | try wip_nav.abbrevCode(.comptime_value); |
| ... | ... | @@ -4459,7 +4459,7 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co |
| 4459 | 4459 | try wip_nav.strp(field_name); |
| 4460 | 4460 | }, |
| 4461 | 4461 | }; |
| 4462 | try diw.writeUleb128(@intFromEnum(AbbrevCode.null)); | |
| 4462 | try diw.writeUleb128(@backingInt(AbbrevCode.null)); | |
| 4463 | 4463 | } |
| 4464 | 4464 | }, |
| 4465 | 4465 | .slice => |slice| { |
| ... | ... | @@ -4475,7 +4475,7 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co |
| 4475 | 4475 | try wip_nav.strp("len"); |
| 4476 | 4476 | try wip_nav.blockValue(.fromInterned(slice.len)); |
| 4477 | 4477 | } |
| 4478 | try diw.writeUleb128(@intFromEnum(AbbrevCode.null)); | |
| 4478 | try diw.writeUleb128(@backingInt(AbbrevCode.null)); | |
| 4479 | 4479 | }, |
| 4480 | 4480 | .opt => |opt| { |
| 4481 | 4481 | const opt_child_type: Type = .fromInterned(ip.indexToKey(opt.ty).opt_type); |
| ... | ... | @@ -4505,7 +4505,7 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co |
| 4505 | 4505 | else |
| 4506 | 4506 | try wip_nav.blockValue(.fromInterned(opt.val)); |
| 4507 | 4507 | } |
| 4508 | try diw.writeUleb128(@intFromEnum(AbbrevCode.null)); | |
| 4508 | try diw.writeUleb128(@backingInt(AbbrevCode.null)); | |
| 4509 | 4509 | }, |
| 4510 | 4510 | .aggregate => |aggregate| { |
| 4511 | 4511 | try wip_nav.abbrevCode(.aggregate_undefined_comptime_value); |
| ... | ... | @@ -4586,7 +4586,7 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co |
| 4586 | 4586 | }, |
| 4587 | 4587 | else => unreachable, |
| 4588 | 4588 | } |
| 4589 | try diw.writeUleb128(@intFromEnum(AbbrevCode.null)); | |
| 4589 | try diw.writeUleb128(@backingInt(AbbrevCode.null)); | |
| 4590 | 4590 | }, |
| 4591 | 4591 | .un => |un| { |
| 4592 | 4592 | try wip_nav.abbrevCode(.aggregate_undefined_comptime_value); |
| ... | ... | @@ -4611,7 +4611,7 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co |
| 4611 | 4611 | else if (has_runtime_bits) |
| 4612 | 4612 | try wip_nav.blockValue(.fromInterned(un.val)); |
| 4613 | 4613 | } |
| 4614 | try diw.writeUleb128(@intFromEnum(AbbrevCode.null)); | |
| 4614 | try diw.writeUleb128(@backingInt(AbbrevCode.null)); | |
| 4615 | 4615 | }, |
| 4616 | 4616 | .memoized_call => unreachable, // not a value |
| 4617 | 4617 | } |
| ... | ... | @@ -4644,7 +4644,7 @@ pub fn updateLineNumber(dwarf: *Dwarf, zcu: *Zcu, zir_index: InternPool.TrackedI |
| 4644 | 4644 | file.sub_file_path, |
| 4645 | 4645 | decl.src_line + 1, |
| 4646 | 4646 | decl.src_column + 1, |
| 4647 | @intFromEnum(inst_info.inst), | |
| 4647 | @backingInt(inst_info.inst), | |
| 4648 | 4648 | file.zir.?.nullTerminatedString(decl.name), |
| 4649 | 4649 | }); |
| 4650 | 4650 | |
| ... | ... | @@ -4666,19 +4666,19 @@ fn refAbbrevCode( |
| 4666 | 4666 | abbrev_code: AbbrevCode, |
| 4667 | 4667 | ) (UpdateError || Writer.Error)!@typeInfo(AbbrevCode).@"enum".tag_type { |
| 4668 | 4668 | assert(abbrev_code != .null); |
| 4669 | const entry: Entry.Index = @enumFromInt(@intFromEnum(abbrev_code)); | |
| 4670 | if (dwarf.debug_abbrev.section.getUnit(DebugAbbrev.unit).getEntry(entry).len > 0) return @intFromEnum(abbrev_code); | |
| 4669 | const entry: Entry.Index = @fromBackingInt(@intCast(@backingInt(abbrev_code))); | |
| 4670 | if (dwarf.debug_abbrev.section.getUnit(DebugAbbrev.unit).getEntry(entry).len > 0) return @backingInt(abbrev_code); | |
| 4671 | 4671 | var debug_abbrev_aw: Writer.Allocating = .init(dwarf.gpa); |
| 4672 | 4672 | defer debug_abbrev_aw.deinit(); |
| 4673 | 4673 | const daw = &debug_abbrev_aw.writer; |
| 4674 | 4674 | const abbrev = AbbrevCode.abbrevs.get(abbrev_code); |
| 4675 | try daw.writeUleb128(@intFromEnum(abbrev_code)); | |
| 4676 | try daw.writeUleb128(@intFromEnum(abbrev.tag)); | |
| 4675 | try daw.writeUleb128(@backingInt(abbrev_code)); | |
| 4676 | try daw.writeUleb128(@backingInt(abbrev.tag)); | |
| 4677 | 4677 | try daw.writeByte(if (abbrev.children) DW.CHILDREN.yes else DW.CHILDREN.no); |
| 4678 | for (abbrev.attrs) |*attr| inline for (attr) |info| try daw.writeUleb128(@intFromEnum(info)); | |
| 4678 | for (abbrev.attrs) |*attr| inline for (attr) |info| try daw.writeUleb128(@backingInt(info)); | |
| 4679 | 4679 | for (0..2) |_| try daw.writeUleb128(0); |
| 4680 | 4680 | try dwarf.debug_abbrev.section.replaceEntry(DebugAbbrev.unit, entry, dwarf, debug_abbrev_aw.written()); |
| 4681 | return @intFromEnum(abbrev_code); | |
| 4681 | return @backingInt(abbrev_code); | |
| 4682 | 4682 | } |
| 4683 | 4683 | |
| 4684 | 4684 | pub fn flush(dwarf: *Dwarf, pt: Zcu.PerThread) UpdateError!void { |
| ... | ... | @@ -4696,7 +4696,7 @@ fn flushWriterError(dwarf: *Dwarf, pt: Zcu.PerThread) (UpdateError || Writer.Err |
| 4696 | 4696 | // Update `anyerror` based on the finished global error set. |
| 4697 | 4697 | { |
| 4698 | 4698 | const index = try dwarf.const_pool.get(pt, .{ .dwarf = dwarf }, .anyerror_type); |
| 4699 | const unit, const entry = dwarf.values.items[@intFromEnum(index)]; | |
| 4699 | const unit, const entry = dwarf.values.items[@backingInt(index)]; | |
| 4700 | 4700 | var wip_nav: WipNav = .{ |
| 4701 | 4701 | .dwarf = dwarf, |
| 4702 | 4702 | .pt = pt, |
| ... | ... | @@ -4728,7 +4728,7 @@ fn flushWriterError(dwarf: *Dwarf, pt: Zcu.PerThread) (UpdateError || Writer.Err |
| 4728 | 4728 | try diw.writeUleb128(value); |
| 4729 | 4729 | try wip_nav.strp(name.toSlice(ip)); |
| 4730 | 4730 | } |
| 4731 | if (global_error_set_names.len > 0) try diw.writeUleb128(@intFromEnum(AbbrevCode.null)); | |
| 4731 | if (global_error_set_names.len > 0) try diw.writeUleb128(@backingInt(AbbrevCode.null)); | |
| 4732 | 4732 | try dwarf.debug_info.section.replaceEntry(wip_nav.unit, wip_nav.entry, dwarf, wip_nav.debug_info.written()); |
| 4733 | 4733 | try dwarf.const_pool.flushPending(pt, .{ .dwarf = dwarf }); |
| 4734 | 4734 | } |
| ... | ... | @@ -4744,7 +4744,7 @@ fn flushWriterError(dwarf: *Dwarf, pt: Zcu.PerThread) (UpdateError || Writer.Err |
| 4744 | 4744 | const hw = &header_aw.writer; |
| 4745 | 4745 | if (dwarf.debug_aranges.section.dirty) { |
| 4746 | 4746 | for (dwarf.debug_aranges.section.units.items, 0..) |*unit_ptr, unit_index| { |
| 4747 | const unit: Unit.Index = @enumFromInt(unit_index); | |
| 4747 | const unit: Unit.Index = @fromBackingInt(@intCast(unit_index)); | |
| 4748 | 4748 | unit_ptr.clear(); |
| 4749 | 4749 | try unit_ptr.cross_section_relocs.ensureTotalCapacity(dwarf.gpa, 1); |
| 4750 | 4750 | header_aw.clearRetainingCapacity(); |
| ... | ... | @@ -4767,7 +4767,7 @@ fn flushWriterError(dwarf: *Dwarf, pt: Zcu.PerThread) (UpdateError || Writer.Err |
| 4767 | 4767 | .target_unit = unit, |
| 4768 | 4768 | }); |
| 4769 | 4769 | hw.splatByteAll(0, dwarf.sectionOffsetBytes()) catch unreachable; |
| 4770 | hw.writeByte(@intFromEnum(dwarf.address_size)) catch unreachable; | |
| 4770 | hw.writeByte(@backingInt(dwarf.address_size)) catch unreachable; | |
| 4771 | 4771 | hw.writeByte(0) catch unreachable; |
| 4772 | 4772 | hw.splatByteAll(0, unit_ptr.header_len - hw.end) catch unreachable; |
| 4773 | 4773 | try unit_ptr.replaceHeader(&dwarf.debug_aranges.section, dwarf, header_aw.written()); |
| ... | ... | @@ -4820,7 +4820,7 @@ fn flushWriterError(dwarf: *Dwarf, pt: Zcu.PerThread) (UpdateError || Writer.Err |
| 4820 | 4820 | } |
| 4821 | 4821 | if (dwarf.debug_info.section.dirty) { |
| 4822 | 4822 | for (dwarf.mods.keys(), dwarf.mods.values(), dwarf.debug_info.section.units.items, 0..) |mod, mod_info, *unit_ptr, unit_index| { |
| 4823 | const unit: Unit.Index = @enumFromInt(unit_index); | |
| 4823 | const unit: Unit.Index = @fromBackingInt(@intCast(unit_index)); | |
| 4824 | 4824 | unit_ptr.clear(); |
| 4825 | 4825 | try unit_ptr.cross_unit_relocs.ensureTotalCapacity(dwarf.gpa, 1); |
| 4826 | 4826 | try unit_ptr.cross_section_relocs.ensureTotalCapacity(dwarf.gpa, 7); |
| ... | ... | @@ -4839,7 +4839,7 @@ fn flushWriterError(dwarf: *Dwarf, pt: Zcu.PerThread) (UpdateError || Writer.Err |
| 4839 | 4839 | } |
| 4840 | 4840 | hw.writeInt(u16, 5, dwarf.endian) catch unreachable; |
| 4841 | 4841 | hw.writeByte(DW.UT.compile) catch unreachable; |
| 4842 | hw.writeByte(@intFromEnum(dwarf.address_size)) catch unreachable; | |
| 4842 | hw.writeByte(@backingInt(dwarf.address_size)) catch unreachable; | |
| 4843 | 4843 | unit_ptr.cross_section_relocs.appendAssumeCapacity(.{ |
| 4844 | 4844 | .source_off = @intCast(hw.end), |
| 4845 | 4845 | .target_sec = .debug_abbrev, |
| ... | ... | @@ -4938,7 +4938,7 @@ fn flushWriterError(dwarf: *Dwarf, pt: Zcu.PerThread) (UpdateError || Writer.Err |
| 4938 | 4938 | }, |
| 4939 | 4939 | } |
| 4940 | 4940 | hw.writeInt(u16, 5, dwarf.endian) catch unreachable; |
| 4941 | hw.writeByte(@intFromEnum(dwarf.address_size)) catch unreachable; | |
| 4941 | hw.writeByte(@backingInt(dwarf.address_size)) catch unreachable; | |
| 4942 | 4942 | hw.writeByte(0) catch unreachable; |
| 4943 | 4943 | switch (dwarf.format) { |
| 4944 | 4944 | .@"32" => hw.writeInt(u32, @intCast(unit.header_len - hw.end - 4), dwarf.endian) catch unreachable, |
| ... | ... | @@ -4986,7 +4986,7 @@ fn flushWriterError(dwarf: *Dwarf, pt: Zcu.PerThread) (UpdateError || Writer.Err |
| 4986 | 4986 | hw.writeUleb128(DW.LNCT.path) catch unreachable; |
| 4987 | 4987 | hw.writeUleb128(DW.FORM.line_strp) catch unreachable; |
| 4988 | 4988 | hw.writeUleb128(DW.LNCT.directory_index) catch unreachable; |
| 4989 | hw.writeUleb128(@intFromEnum(dir_index_info.form)) catch unreachable; | |
| 4989 | hw.writeUleb128(@backingInt(dir_index_info.form)) catch unreachable; | |
| 4990 | 4990 | hw.writeUleb128(DW.LNCT.LLVM_source) catch unreachable; |
| 4991 | 4991 | hw.writeUleb128(DW.FORM.line_strp) catch unreachable; |
| 4992 | 4992 | hw.writeUleb128(mod_info.files.count()) catch unreachable; |
| ... | ... | @@ -5046,7 +5046,7 @@ fn flushWriterError(dwarf: *Dwarf, pt: Zcu.PerThread) (UpdateError || Writer.Err |
| 5046 | 5046 | }, |
| 5047 | 5047 | } |
| 5048 | 5048 | hw.writeInt(u16, 5, dwarf.endian) catch unreachable; |
| 5049 | hw.writeByte(@intFromEnum(dwarf.address_size)) catch unreachable; | |
| 5049 | hw.writeByte(@backingInt(dwarf.address_size)) catch unreachable; | |
| 5050 | 5050 | hw.writeByte(0) catch unreachable; |
| 5051 | 5051 | hw.writeInt(u32, 1, dwarf.endian) catch unreachable; |
| 5052 | 5052 | switch (dwarf.format) { |
| ... | ... | @@ -5238,11 +5238,11 @@ const AbbrevCode = enum { |
| 5238 | 5238 | comptime_value_elem_runtime_bits, |
| 5239 | 5239 | comptime_value_elem_comptime_state, |
| 5240 | 5240 | |
| 5241 | const decl_bytes = uleb128Bytes(@intFromEnum(AbbrevCode.decl_instance_extern_func)); | |
| 5241 | const decl_bytes = uleb128Bytes(@backingInt(AbbrevCode.decl_instance_extern_func)); | |
| 5242 | 5242 | comptime { |
| 5243 | assert(uleb128Bytes(@intFromEnum(AbbrevCode.pad_1)) == 1); | |
| 5244 | assert(uleb128Bytes(@intFromEnum(AbbrevCode.pad_n)) == 1); | |
| 5245 | assert(uleb128Bytes(@intFromEnum(AbbrevCode.decl_alias)) == decl_bytes); | |
| 5243 | assert(uleb128Bytes(@backingInt(AbbrevCode.pad_1)) == 1); | |
| 5244 | assert(uleb128Bytes(@backingInt(AbbrevCode.pad_n)) == 1); | |
| 5245 | assert(uleb128Bytes(@backingInt(AbbrevCode.decl_alias)) == decl_bytes); | |
| 5246 | 5246 | } |
| 5247 | 5247 | |
| 5248 | 5248 | const Attr = struct { |
src/link/Elf.zig+12-12| ... | ... | @@ -135,12 +135,12 @@ const OptionalProgramHeaderIndex = enum(u16) { |
| 135 | 135 | |
| 136 | 136 | fn unwrap(i: OptionalProgramHeaderIndex) ?ProgramHeaderIndex { |
| 137 | 137 | if (i == .none) return null; |
| 138 | return @enumFromInt(@intFromEnum(i)); | |
| 138 | return @fromBackingInt(@intCast(@backingInt(i))); | |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | fn int(i: OptionalProgramHeaderIndex) ?u16 { |
| 142 | 142 | if (i == .none) return null; |
| 143 | return @intFromEnum(i); | |
| 143 | return @backingInt(i); | |
| 144 | 144 | } |
| 145 | 145 | }; |
| 146 | 146 | |
| ... | ... | @@ -148,13 +148,13 @@ const ProgramHeaderIndex = enum(u16) { |
| 148 | 148 | _, |
| 149 | 149 | |
| 150 | 150 | fn toOptional(i: ProgramHeaderIndex) OptionalProgramHeaderIndex { |
| 151 | const result: OptionalProgramHeaderIndex = @enumFromInt(@intFromEnum(i)); | |
| 151 | const result: OptionalProgramHeaderIndex = @fromBackingInt(@intCast(@backingInt(i))); | |
| 152 | 152 | assert(result != .none); |
| 153 | 153 | return result; |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | fn int(i: ProgramHeaderIndex) u16 { |
| 157 | return @intFromEnum(i); | |
| 157 | return @backingInt(i); | |
| 158 | 158 | } |
| 159 | 159 | }; |
| 160 | 160 | |
| ... | ... | @@ -1531,7 +1531,7 @@ pub fn writeElfHeader(self: *Elf) !void { |
| 1531 | 1531 | hdr_buf[index] = 1; // ELF version |
| 1532 | 1532 | index += 1; |
| 1533 | 1533 | |
| 1534 | hdr_buf[index] = @intFromEnum(@as(elf.OSABI, switch (target.cpu.arch) { | |
| 1534 | hdr_buf[index] = @backingInt(@as(elf.OSABI, switch (target.cpu.arch) { | |
| 1535 | 1535 | .amdgcn => switch (target.os.tag) { |
| 1536 | 1536 | .amdhsa => .AMDGPU_HSA, |
| 1537 | 1537 | .amdpal => .AMDGPU_PAL, |
| ... | ... | @@ -1566,11 +1566,11 @@ pub fn writeElfHeader(self: *Elf) !void { |
| 1566 | 1566 | .dynamic => .DYN, |
| 1567 | 1567 | }, |
| 1568 | 1568 | }; |
| 1569 | mem.writeInt(u16, hdr_buf[index..][0..2], @intFromEnum(elf_type), endian); | |
| 1569 | mem.writeInt(u16, hdr_buf[index..][0..2], @backingInt(elf_type), endian); | |
| 1570 | 1570 | index += 2; |
| 1571 | 1571 | |
| 1572 | 1572 | const machine = target.toElfMachine(); |
| 1573 | mem.writeInt(u16, hdr_buf[index..][0..2], @intFromEnum(machine), endian); | |
| 1573 | mem.writeInt(u16, hdr_buf[index..][0..2], @backingInt(machine), endian); | |
| 1574 | 1574 | index += 2; |
| 1575 | 1575 | |
| 1576 | 1576 | // ELF Version, again |
| ... | ... | @@ -2314,13 +2314,13 @@ fn sortPhdrs( |
| 2314 | 2314 | |
| 2315 | 2315 | inline for (@typeInfo(ProgramHeaderIndexes).@"struct".field_names) |field_name| { |
| 2316 | 2316 | if (@field(special_indexes, field_name).int()) |special_index| { |
| 2317 | @field(special_indexes, field_name) = @enumFromInt(backlinks[special_index]); | |
| 2317 | @field(special_indexes, field_name) = @fromBackingInt(@intCast(backlinks[special_index])); | |
| 2318 | 2318 | } |
| 2319 | 2319 | } |
| 2320 | 2320 | |
| 2321 | 2321 | for (section_indexes) |*opt_phndx| { |
| 2322 | 2322 | if (opt_phndx.int()) |index| { |
| 2323 | opt_phndx.* = @enumFromInt(backlinks[index]); | |
| 2323 | opt_phndx.* = @fromBackingInt(@intCast(backlinks[index])); | |
| 2324 | 2324 | } |
| 2325 | 2325 | } |
| 2326 | 2326 | } |
| ... | ... | @@ -3398,7 +3398,7 @@ fn getPhdr(self: *Elf, opts: struct { |
| 3398 | 3398 | if (phndx == index) continue; |
| 3399 | 3399 | } |
| 3400 | 3400 | if (phdr.p_type == opts.type and phdr.p_flags == opts.flags) |
| 3401 | return @enumFromInt(phndx); | |
| 3401 | return @fromBackingInt(@intCast(phndx)); | |
| 3402 | 3402 | } |
| 3403 | 3403 | return .none; |
| 3404 | 3404 | } |
| ... | ... | @@ -3413,7 +3413,7 @@ fn addPhdr(self: *Elf, opts: struct { |
| 3413 | 3413 | memsz: u64 = 0, |
| 3414 | 3414 | }) error{OutOfMemory}!ProgramHeaderIndex { |
| 3415 | 3415 | const gpa = self.base.comp.gpa; |
| 3416 | const index: ProgramHeaderIndex = @enumFromInt(self.phdrs.items.len); | |
| 3416 | const index: ProgramHeaderIndex = @fromBackingInt(@intCast(self.phdrs.items.len)); | |
| 3417 | 3417 | try self.phdrs.append(gpa, .{ |
| 3418 | 3418 | .p_type = opts.type, |
| 3419 | 3419 | .p_flags = opts.flags, |
| ... | ... | @@ -4345,7 +4345,7 @@ fn createThunks(elf_file: *Elf, atom_list: *AtomList) !void { |
| 4345 | 4345 | for (atom_ptr.relocs(elf_file)) |rel| { |
| 4346 | 4346 | const is_reachable = switch (cpu_arch) { |
| 4347 | 4347 | .aarch64, .aarch64_be => r: { |
| 4348 | const r_type: elf.R_AARCH64 = @enumFromInt(rel.r_type()); | |
| 4348 | const r_type: elf.R_AARCH64 = @fromBackingInt(@intCast(rel.r_type())); | |
| 4349 | 4349 | if (r_type != .CALL26 and r_type != .JUMP26) break :r true; |
| 4350 | 4350 | const target_ref = file_ptr.resolveSymbol(rel.r_sym(), elf_file); |
| 4351 | 4351 | const target = elf_file.symbol(target_ref).?; |
src/link/Elf/Atom.zig+14-14| ... | ... | @@ -288,7 +288,7 @@ pub fn scanRelocsRequiresCode(self: Atom, elf_file: *Elf) bool { |
| 288 | 288 | for (self.relocs(elf_file)) |rel| { |
| 289 | 289 | switch (cpu_arch) { |
| 290 | 290 | .x86_64 => { |
| 291 | const r_type: elf.R_X86_64 = @enumFromInt(rel.r_type()); | |
| 291 | const r_type: elf.R_X86_64 = @fromBackingInt(@intCast(rel.r_type())); | |
| 292 | 292 | if (r_type == .GOTTPOFF) return true; |
| 293 | 293 | }, |
| 294 | 294 | else => {}, |
| ... | ... | @@ -950,7 +950,7 @@ const x86_64 = struct { |
| 950 | 950 | const is_static = elf_file.base.isStatic(); |
| 951 | 951 | const is_dyn_lib = elf_file.isEffectivelyDynLib(); |
| 952 | 952 | |
| 953 | const r_type: elf.R_X86_64 = @enumFromInt(rel.r_type()); | |
| 953 | const r_type: elf.R_X86_64 = @fromBackingInt(@intCast(rel.r_type())); | |
| 954 | 954 | const r_offset = std.math.cast(usize, rel.r_offset) orelse return error.Overflow; |
| 955 | 955 | |
| 956 | 956 | switch (r_type) { |
| ... | ... | @@ -1062,7 +1062,7 @@ const x86_64 = struct { |
| 1062 | 1062 | dev.check(.x86_64_backend); |
| 1063 | 1063 | const t = &elf_file.base.comp.root_mod.resolved_target.result; |
| 1064 | 1064 | const diags = &elf_file.base.comp.link_diags; |
| 1065 | const r_type: elf.R_X86_64 = @enumFromInt(rel.r_type()); | |
| 1065 | const r_type: elf.R_X86_64 = @fromBackingInt(@intCast(rel.r_type())); | |
| 1066 | 1066 | const r_offset = std.math.cast(usize, rel.r_offset) orelse return error.Overflow; |
| 1067 | 1067 | |
| 1068 | 1068 | const P, const A, const S, const GOT, const G, const TP, const DTP = args; |
| ... | ... | @@ -1201,7 +1201,7 @@ const x86_64 = struct { |
| 1201 | 1201 | code: []u8, |
| 1202 | 1202 | ) !void { |
| 1203 | 1203 | dev.check(.x86_64_backend); |
| 1204 | const r_type: elf.R_X86_64 = @enumFromInt(rel.r_type()); | |
| 1204 | const r_type: elf.R_X86_64 = @fromBackingInt(@intCast(rel.r_type())); | |
| 1205 | 1205 | |
| 1206 | 1206 | _, const A, const S, const GOT, _, _, const DTP = args; |
| 1207 | 1207 | |
| ... | ... | @@ -1282,7 +1282,7 @@ const x86_64 = struct { |
| 1282 | 1282 | dev.check(.x86_64_backend); |
| 1283 | 1283 | assert(rels.len == 2); |
| 1284 | 1284 | const diags = &elf_file.base.comp.link_diags; |
| 1285 | const rel: elf.R_X86_64 = @enumFromInt(rels[1].r_type()); | |
| 1285 | const rel: elf.R_X86_64 = @fromBackingInt(@intCast(rels[1].r_type())); | |
| 1286 | 1286 | switch (rel) { |
| 1287 | 1287 | .PC32, |
| 1288 | 1288 | .PLT32, |
| ... | ... | @@ -1322,7 +1322,7 @@ const x86_64 = struct { |
| 1322 | 1322 | dev.check(.x86_64_backend); |
| 1323 | 1323 | assert(rels.len == 2); |
| 1324 | 1324 | const diags = &elf_file.base.comp.link_diags; |
| 1325 | const rel: elf.R_X86_64 = @enumFromInt(rels[1].r_type()); | |
| 1325 | const rel: elf.R_X86_64 = @fromBackingInt(@intCast(rels[1].r_type())); | |
| 1326 | 1326 | switch (rel) { |
| 1327 | 1327 | .PC32, |
| 1328 | 1328 | .PLT32, |
| ... | ... | @@ -1428,7 +1428,7 @@ const x86_64 = struct { |
| 1428 | 1428 | dev.check(.x86_64_backend); |
| 1429 | 1429 | assert(rels.len == 2); |
| 1430 | 1430 | const diags = &elf_file.base.comp.link_diags; |
| 1431 | const rel: elf.R_X86_64 = @enumFromInt(rels[1].r_type()); | |
| 1431 | const rel: elf.R_X86_64 = @fromBackingInt(@intCast(rels[1].r_type())); | |
| 1432 | 1432 | switch (rel) { |
| 1433 | 1433 | .PC32, |
| 1434 | 1434 | .PLT32, |
| ... | ... | @@ -1493,7 +1493,7 @@ const aarch64 = struct { |
| 1493 | 1493 | _ = code; |
| 1494 | 1494 | _ = it; |
| 1495 | 1495 | |
| 1496 | const r_type: elf.R_AARCH64 = @enumFromInt(rel.r_type()); | |
| 1496 | const r_type: elf.R_AARCH64 = @fromBackingInt(@intCast(rel.r_type())); | |
| 1497 | 1497 | const is_dyn_lib = elf_file.isEffectivelyDynLib(); |
| 1498 | 1498 | |
| 1499 | 1499 | switch (r_type) { |
| ... | ... | @@ -1571,7 +1571,7 @@ const aarch64 = struct { |
| 1571 | 1571 | _ = it; |
| 1572 | 1572 | |
| 1573 | 1573 | const diags = &elf_file.base.comp.link_diags; |
| 1574 | const r_type: elf.R_AARCH64 = @enumFromInt(rel.r_type()); | |
| 1574 | const r_type: elf.R_AARCH64 = @fromBackingInt(@intCast(rel.r_type())); | |
| 1575 | 1575 | const r_offset = std.math.cast(usize, rel.r_offset) orelse return error.Overflow; |
| 1576 | 1576 | const code = code_buffer[r_offset..][0..4]; |
| 1577 | 1577 | const file_ptr = atom.file(elf_file).?; |
| ... | ... | @@ -1742,7 +1742,7 @@ const aarch64 = struct { |
| 1742 | 1742 | args: ResolveArgs, |
| 1743 | 1743 | code: []u8, |
| 1744 | 1744 | ) !void { |
| 1745 | const r_type: elf.R_AARCH64 = @enumFromInt(rel.r_type()); | |
| 1745 | const r_type: elf.R_AARCH64 = @fromBackingInt(@intCast(rel.r_type())); | |
| 1746 | 1746 | |
| 1747 | 1747 | _, const A, const S, _, _, _, _ = args; |
| 1748 | 1748 | |
| ... | ... | @@ -1773,7 +1773,7 @@ const riscv = struct { |
| 1773 | 1773 | _ = code; |
| 1774 | 1774 | _ = it; |
| 1775 | 1775 | |
| 1776 | const r_type: elf.R_RISCV = @enumFromInt(rel.r_type()); | |
| 1776 | const r_type: elf.R_RISCV = @fromBackingInt(@intCast(rel.r_type())); | |
| 1777 | 1777 | |
| 1778 | 1778 | switch (r_type) { |
| 1779 | 1779 | .@"32" => try atom.scanReloc(symbol, rel, absRelocAction(symbol, elf_file), elf_file), |
| ... | ... | @@ -1816,7 +1816,7 @@ const riscv = struct { |
| 1816 | 1816 | code: []u8, |
| 1817 | 1817 | ) !void { |
| 1818 | 1818 | const diags = &elf_file.base.comp.link_diags; |
| 1819 | const r_type: elf.R_RISCV = @enumFromInt(rel.r_type()); | |
| 1819 | const r_type: elf.R_RISCV = @fromBackingInt(@intCast(rel.r_type())); | |
| 1820 | 1820 | const r_offset = std.math.cast(usize, rel.r_offset) orelse return error.Overflow; |
| 1821 | 1821 | |
| 1822 | 1822 | const P, const A, const S, const GOT, const G, const TP, const DTP = args; |
| ... | ... | @@ -1893,7 +1893,7 @@ const riscv = struct { |
| 1893 | 1893 | const A_ = pair.r_addend; |
| 1894 | 1894 | const P_ = atom_addr + @as(i64, @intCast(pair.r_offset)); |
| 1895 | 1895 | const G_ = target_.gotAddress(elf_file) - GOT; |
| 1896 | const disp = switch (@as(elf.R_RISCV, @enumFromInt(pair.r_type()))) { | |
| 1896 | const disp = switch (@as(elf.R_RISCV, @fromBackingInt(@intCast(pair.r_type())))) { | |
| 1897 | 1897 | .PCREL_HI20 => math.cast(i32, S_ + A_ - P_) orelse return error.Overflow, |
| 1898 | 1898 | .GOT_HI20 => math.cast(i32, G_ + GOT + A_ - P_) orelse return error.Overflow, |
| 1899 | 1899 | else => unreachable, |
| ... | ... | @@ -1951,7 +1951,7 @@ const riscv = struct { |
| 1951 | 1951 | args: ResolveArgs, |
| 1952 | 1952 | code: []u8, |
| 1953 | 1953 | ) !void { |
| 1954 | const r_type: elf.R_RISCV = @enumFromInt(rel.r_type()); | |
| 1954 | const r_type: elf.R_RISCV = @fromBackingInt(@intCast(rel.r_type())); | |
| 1955 | 1955 | |
| 1956 | 1956 | _, const A, const S, const GOT, _, _, const DTP = args; |
| 1957 | 1957 | _ = GOT; |
src/link/Elf/LinkerDefined.zig+1-1| ... | ... | @@ -48,7 +48,7 @@ fn newSymbolAssumeCapacity(self: *LinkerDefined, name_off: u32, elf_file: *Elf) |
| 48 | 48 | esym.* = .{ |
| 49 | 49 | .st_name = name_off, |
| 50 | 50 | .st_info = @as(u8, elf.STB_WEAK) << 4, |
| 51 | .st_other = @intFromEnum(elf.STV.HIDDEN), | |
| 51 | .st_other = @backingInt(elf.STV.HIDDEN), | |
| 52 | 52 | .st_shndx = elf.SHN_ABS, |
| 53 | 53 | .st_value = 0, |
| 54 | 54 | .st_size = 0, |
src/link/Elf/Object.zig+2-2| ... | ... | @@ -665,7 +665,7 @@ pub fn claimUnresolved(self: *Object, elf_file: *Elf) void { |
| 665 | 665 | |
| 666 | 666 | const is_import = blk: { |
| 667 | 667 | if (!elf_file.isEffectivelyDynLib()) break :blk false; |
| 668 | const vis: elf.STV = @enumFromInt(@as(u3, @truncate(esym.st_other))); | |
| 668 | const vis: elf.STV = @fromBackingInt(@intCast(@as(u3, @truncate(esym.st_other)))); | |
| 669 | 669 | if (vis == .HIDDEN) break :blk false; |
| 670 | 670 | break :blk true; |
| 671 | 671 | }; |
| ... | ... | @@ -737,7 +737,7 @@ pub fn markImportsExports(self: *Object, elf_file: *Elf) void { |
| 737 | 737 | const sym = elf_file.symbol(ref) orelse continue; |
| 738 | 738 | const file = sym.file(elf_file).?; |
| 739 | 739 | if (sym.version_index == elf.Versym.LOCAL) continue; |
| 740 | const vis: elf.STV = @enumFromInt(@as(u3, @truncate(sym.elfSym(elf_file).st_other))); | |
| 740 | const vis: elf.STV = @fromBackingInt(@intCast(@as(u3, @truncate(sym.elfSym(elf_file).st_other)))); | |
| 741 | 741 | if (vis == .HIDDEN) continue; |
| 742 | 742 | if (file == .shared_object and !sym.isAbs(elf_file)) { |
| 743 | 743 | sym.flags.import = true; |
src/link/Elf/SharedObject.zig+4-4| ... | ... | @@ -238,11 +238,11 @@ pub fn parse( |
| 238 | 238 | const verdef = mem.bytesAsValue(elf.Verdef, verdefs[offset..][0..@sizeOf(elf.Verdef)]); |
| 239 | 239 | if (verdef.ndx == .UNSPECIFIED) return error.VerDefSymbolTooLarge; |
| 240 | 240 | |
| 241 | if (verstrings.items.len <= @intFromEnum(verdef.ndx)) | |
| 242 | try verstrings.appendNTimes(gpa, 0, @intFromEnum(verdef.ndx) + 1 - verstrings.items.len); | |
| 241 | if (verstrings.items.len <= @backingInt(verdef.ndx)) | |
| 242 | try verstrings.appendNTimes(gpa, 0, @backingInt(verdef.ndx) + 1 - verstrings.items.len); | |
| 243 | 243 | |
| 244 | 244 | const aux = mem.bytesAsValue(elf.Verdaux, verdefs[offset + verdef.aux ..][0..@sizeOf(elf.Verdaux)]); |
| 245 | verstrings.items[@intFromEnum(verdef.ndx)] = aux.name; | |
| 245 | verstrings.items[@backingInt(verdef.ndx)] = aux.name; | |
| 246 | 246 | |
| 247 | 247 | if (verdef.next == 0) break; |
| 248 | 248 | offset += verdef.next; |
| ... | ... | @@ -380,7 +380,7 @@ pub fn markImportExports(self: *SharedObject, elf_file: *Elf) void { |
| 380 | 380 | const ref = self.resolveSymbol(@intCast(i), elf_file); |
| 381 | 381 | const ref_sym = elf_file.symbol(ref) orelse continue; |
| 382 | 382 | const ref_file = ref_sym.file(elf_file).?; |
| 383 | const vis: elf.STV = @enumFromInt(@as(u3, @truncate(ref_sym.elfSym(elf_file).st_other))); | |
| 383 | const vis: elf.STV = @fromBackingInt(@intCast(@as(u3, @truncate(ref_sym.elfSym(elf_file).st_other)))); | |
| 384 | 384 | if (ref_file != .shared_object and vis != .HIDDEN) ref_sym.flags.@"export" = true; |
| 385 | 385 | } |
| 386 | 386 | } |
src/link/Elf/Symbol.zig+2-2| ... | ... | @@ -310,7 +310,7 @@ pub fn setOutputSym(symbol: Symbol, elf_file: *Elf, out: *elf.Elf64_Sym) void { |
| 310 | 310 | break :blk symbol.address(.{ .plt = false, .trampoline = false }, elf_file); |
| 311 | 311 | }; |
| 312 | 312 | const st_other = blk: { |
| 313 | const vis = @as(elf.STV, @enumFromInt(@as(u3, @truncate(esym.st_other)))); | |
| 313 | const vis = @as(elf.STV, @fromBackingInt(@intCast(@as(u3, @truncate(esym.st_other))))); | |
| 314 | 314 | if (file_ptr != .shared_object or vis != elf.STV.PROTECTED) break :blk esym.st_other; |
| 315 | 315 | // Reset protected visibility to default for symbols originating in shared objects |
| 316 | 316 | break :blk esym.st_other & 0b11111000; |
| ... | ... | @@ -332,7 +332,7 @@ const Format = struct { |
| 332 | 332 | const symbol = f.symbol; |
| 333 | 333 | try writer.writeAll(symbol.name(elf_file)); |
| 334 | 334 | switch (symbol.version_index.VERSION) { |
| 335 | @intFromEnum(elf.VER_NDX.LOCAL), @intFromEnum(elf.VER_NDX.GLOBAL) => {}, | |
| 335 | @backingInt(elf.VER_NDX.LOCAL), @backingInt(elf.VER_NDX.GLOBAL) => {}, | |
| 336 | 336 | else => { |
| 337 | 337 | const file_ptr = symbol.file(elf_file).?; |
| 338 | 338 | assert(file_ptr == .shared_object); |
src/link/Elf/ZigObject.zig+19-19| ... | ... | @@ -458,14 +458,14 @@ pub fn flush(self: *ZigObject, elf_file: *Elf, tid: Zcu.PerThread.Id) !void { |
| 458 | 458 | }, self); |
| 459 | 459 | } |
| 460 | 460 | for (entry.external_relocs.items) |reloc| { |
| 461 | const target_sym = self.symbol(@intFromEnum(reloc.target_sym)); | |
| 461 | const target_sym = self.symbol(@backingInt(reloc.target_sym)); | |
| 462 | 462 | const r_offset = entry_off + reloc.source_off; |
| 463 | 463 | const r_addend: i64 = @intCast(reloc.target_off); |
| 464 | 464 | const r_type = relocation.dwarf.externalRelocType(target_sym.*, sect_index, dwarf.address_size, cpu_arch); |
| 465 | 465 | atom_ptr.addRelocAssumeCapacity(.{ |
| 466 | 466 | .r_offset = r_offset, |
| 467 | 467 | .r_addend = r_addend, |
| 468 | .r_info = (@as(u64, @intCast(@intFromEnum(reloc.target_sym))) << 32) | r_type, | |
| 468 | .r_info = (@as(u64, @intCast(@backingInt(reloc.target_sym))) << 32) | r_type, | |
| 469 | 469 | }, self); |
| 470 | 470 | } |
| 471 | 471 | } |
| ... | ... | @@ -614,7 +614,7 @@ pub fn claimUnresolved(self: *ZigObject, elf_file: *Elf) void { |
| 614 | 614 | |
| 615 | 615 | const is_import = blk: { |
| 616 | 616 | if (!elf_file.isEffectivelyDynLib()) break :blk false; |
| 617 | const vis: elf.STV = @enumFromInt(@as(u3, @truncate(esym.st_other))); | |
| 617 | const vis: elf.STV = @fromBackingInt(@intCast(@as(u3, @truncate(esym.st_other)))); | |
| 618 | 618 | if (vis == .HIDDEN) break :blk false; |
| 619 | 619 | break :blk true; |
| 620 | 620 | }; |
| ... | ... | @@ -691,7 +691,7 @@ pub fn markImportsExports(self: *ZigObject, elf_file: *Elf) void { |
| 691 | 691 | const sym = elf_file.symbol(ref) orelse continue; |
| 692 | 692 | const file = sym.file(elf_file).?; |
| 693 | 693 | if (sym.version_index == elf.Versym.LOCAL) continue; |
| 694 | const vis: elf.STV = @enumFromInt(@as(u3, @truncate(sym.elfSym(elf_file).st_other))); | |
| 694 | const vis: elf.STV = @fromBackingInt(@intCast(@as(u3, @truncate(sym.elfSym(elf_file).st_other)))); | |
| 695 | 695 | if (vis == .HIDDEN) continue; |
| 696 | 696 | if (file == .shared_object and !sym.isAbs(elf_file)) { |
| 697 | 697 | sym.flags.import = true; |
| ... | ... | @@ -938,7 +938,7 @@ pub fn getNavVAddr( |
| 938 | 938 | switch (reloc_info.parent) { |
| 939 | 939 | .none => unreachable, |
| 940 | 940 | .atom_index => |atom_index| { |
| 941 | const parent_atom = self.symbol(@intFromEnum(atom_index)).atom(elf_file).?; | |
| 941 | const parent_atom = self.symbol(@backingInt(atom_index)).atom(elf_file).?; | |
| 942 | 942 | const r_type = relocation.encode(.abs, elf_file.getTarget().cpu.arch); |
| 943 | 943 | try parent_atom.addReloc(elf_file.base.comp.gpa, .{ |
| 944 | 944 | .r_offset = reloc_info.offset, |
| ... | ... | @@ -949,7 +949,7 @@ pub fn getNavVAddr( |
| 949 | 949 | .debug_output => |debug_output| switch (debug_output) { |
| 950 | 950 | .dwarf => |wip_nav| try wip_nav.infoExternalReloc(.{ |
| 951 | 951 | .source_off = @intCast(reloc_info.offset), |
| 952 | .target_sym = @enumFromInt(this_sym_index), | |
| 952 | .target_sym = @fromBackingInt(@intCast(this_sym_index)), | |
| 953 | 953 | .target_off = reloc_info.addend, |
| 954 | 954 | }), |
| 955 | 955 | .none => unreachable, |
| ... | ... | @@ -970,7 +970,7 @@ pub fn getUavVAddr( |
| 970 | 970 | switch (reloc_info.parent) { |
| 971 | 971 | .none => unreachable, |
| 972 | 972 | .atom_index => |atom_index| { |
| 973 | const parent_atom = self.symbol(@intFromEnum(atom_index)).atom(elf_file).?; | |
| 973 | const parent_atom = self.symbol(@backingInt(atom_index)).atom(elf_file).?; | |
| 974 | 974 | const r_type = relocation.encode(.abs, elf_file.getTarget().cpu.arch); |
| 975 | 975 | try parent_atom.addReloc(elf_file.base.comp.gpa, .{ |
| 976 | 976 | .r_offset = reloc_info.offset, |
| ... | ... | @@ -981,7 +981,7 @@ pub fn getUavVAddr( |
| 981 | 981 | .debug_output => |debug_output| switch (debug_output) { |
| 982 | 982 | .dwarf => |wip_nav| try wip_nav.infoExternalReloc(.{ |
| 983 | 983 | .source_off = @intCast(reloc_info.offset), |
| 984 | .target_sym = @enumFromInt(sym_index), | |
| 984 | .target_sym = @fromBackingInt(@intCast(sym_index)), | |
| 985 | 985 | .target_off = reloc_info.addend, |
| 986 | 986 | }), |
| 987 | 987 | .none => unreachable, |
| ... | ... | @@ -1009,7 +1009,7 @@ pub fn lowerUav( |
| 1009 | 1009 | const sym = self.symbol(metadata.symbol_index); |
| 1010 | 1010 | const existing_alignment = sym.atom(elf_file).?.alignment; |
| 1011 | 1011 | if (uav_alignment.order(existing_alignment).compare(.lte)) |
| 1012 | return @enumFromInt(metadata.symbol_index); | |
| 1012 | return @fromBackingInt(@intCast(metadata.symbol_index)); | |
| 1013 | 1013 | } |
| 1014 | 1014 | |
| 1015 | 1015 | const osec = if (self.data_relro_index) |sym_index| |
| ... | ... | @@ -1027,7 +1027,7 @@ pub fn lowerUav( |
| 1027 | 1027 | |
| 1028 | 1028 | var name_buf: [32]u8 = undefined; |
| 1029 | 1029 | const name = std.fmt.bufPrint(&name_buf, "__anon_{d}", .{ |
| 1030 | @intFromEnum(uav), | |
| 1030 | @backingInt(uav), | |
| 1031 | 1031 | }) catch unreachable; |
| 1032 | 1032 | const sym_index = self.lowerConst( |
| 1033 | 1033 | elf_file, |
| ... | ... | @@ -1044,7 +1044,7 @@ pub fn lowerUav( |
| 1044 | 1044 | ), |
| 1045 | 1045 | }; |
| 1046 | 1046 | try self.uavs.put(gpa, uav, .{ |
| 1047 | .symbol_index = @intFromEnum(sym_index), | |
| 1047 | .symbol_index = @backingInt(sym_index), | |
| 1048 | 1048 | .allocated = true, |
| 1049 | 1049 | }); |
| 1050 | 1050 | return sym_index; |
| ... | ... | @@ -1541,7 +1541,7 @@ pub fn updateFunc( |
| 1541 | 1541 | var debug_wip_nav = if (self.dwarf) |*dwarf| try dwarf.initWipNav( |
| 1542 | 1542 | pt, |
| 1543 | 1543 | func.owner_nav, |
| 1544 | @enumFromInt(sym_index), | |
| 1544 | @fromBackingInt(@intCast(sym_index)), | |
| 1545 | 1545 | ) else null; |
| 1546 | 1546 | defer if (debug_wip_nav) |*wip_nav| wip_nav.deinit(); |
| 1547 | 1547 | |
| ... | ... | @@ -1549,7 +1549,7 @@ pub fn updateFunc( |
| 1549 | 1549 | &elf_file.base, |
| 1550 | 1550 | pt, |
| 1551 | 1551 | func_index, |
| 1552 | @enumFromInt(sym_index), | |
| 1552 | @fromBackingInt(@intCast(sym_index)), | |
| 1553 | 1553 | mir, |
| 1554 | 1554 | &aw.writer, |
| 1555 | 1555 | if (debug_wip_nav) |*dn| .{ .dwarf = dn } else .none, |
| ... | ... | @@ -1656,7 +1656,7 @@ pub fn updateNav( |
| 1656 | 1656 | self.symbol(sym_index).flags.is_tls = true; |
| 1657 | 1657 | } |
| 1658 | 1658 | if (self.dwarf) |*dwarf| { |
| 1659 | var debug_wip_nav = try dwarf.initWipNav(pt, nav_index, @enumFromInt(sym_index)); | |
| 1659 | var debug_wip_nav = try dwarf.initWipNav(pt, nav_index, @fromBackingInt(@intCast(sym_index))); | |
| 1660 | 1660 | defer debug_wip_nav.deinit(); |
| 1661 | 1661 | dwarf.finishWipNav(pt, nav_index, &debug_wip_nav) catch |err| switch (err) { |
| 1662 | 1662 | error.OutOfMemory, error.Canceled, error.AlreadyReported => |e| return e, |
| ... | ... | @@ -1674,7 +1674,7 @@ pub fn updateNav( |
| 1674 | 1674 | var aw: std.Io.Writer.Allocating = .init(zcu.gpa); |
| 1675 | 1675 | defer aw.deinit(); |
| 1676 | 1676 | |
| 1677 | var debug_wip_nav = if (self.dwarf) |*dwarf| try dwarf.initWipNav(pt, nav_index, @enumFromInt(sym_index)) else null; | |
| 1677 | var debug_wip_nav = if (self.dwarf) |*dwarf| try dwarf.initWipNav(pt, nav_index, @fromBackingInt(@intCast(sym_index))) else null; | |
| 1678 | 1678 | defer if (debug_wip_nav) |*wip_nav| wip_nav.deinit(); |
| 1679 | 1679 | |
| 1680 | 1680 | codegen.generateSymbol( |
| ... | ... | @@ -1682,7 +1682,7 @@ pub fn updateNav( |
| 1682 | 1682 | pt, |
| 1683 | 1683 | .fromInterned(nav.resolved.?.value), |
| 1684 | 1684 | &aw.writer, |
| 1685 | .{ .atom_index = @enumFromInt(sym_index) }, | |
| 1685 | .{ .atom_index = @fromBackingInt(@intCast(sym_index)) }, | |
| 1686 | 1686 | ) catch |err| switch (err) { |
| 1687 | 1687 | error.WriteFailed => return error.OutOfMemory, |
| 1688 | 1688 | else => |e| return e, |
| ... | ... | @@ -1751,7 +1751,7 @@ fn updateLazySymbol( |
| 1751 | 1751 | &required_alignment, |
| 1752 | 1752 | &aw.writer, |
| 1753 | 1753 | .none, |
| 1754 | .{ .atom_index = @enumFromInt(symbol_index) }, | |
| 1754 | .{ .atom_index = @fromBackingInt(@intCast(symbol_index)) }, | |
| 1755 | 1755 | ) catch |err| switch (err) { |
| 1756 | 1756 | error.WriteFailed => return error.OutOfMemory, |
| 1757 | 1757 | else => |e| return e, |
| ... | ... | @@ -1828,7 +1828,7 @@ fn lowerConst( |
| 1828 | 1828 | pt, |
| 1829 | 1829 | val, |
| 1830 | 1830 | &aw.writer, |
| 1831 | .{ .atom_index = @enumFromInt(sym_index) }, | |
| 1831 | .{ .atom_index = @fromBackingInt(@intCast(sym_index)) }, | |
| 1832 | 1832 | ) catch |err| switch (err) { |
| 1833 | 1833 | error.WriteFailed => return error.OutOfMemory, |
| 1834 | 1834 | else => |e| return e, |
| ... | ... | @@ -1850,7 +1850,7 @@ fn lowerConst( |
| 1850 | 1850 | |
| 1851 | 1851 | try elf_file.pwriteAll(code, atom_ptr.offset(elf_file)); |
| 1852 | 1852 | |
| 1853 | return @enumFromInt(sym_index); | |
| 1853 | return @fromBackingInt(@intCast(sym_index)); | |
| 1854 | 1854 | } |
| 1855 | 1855 | |
| 1856 | 1856 | pub fn updateExports( |
src/link/Elf/eh_frame.zig+3-3| ... | ... | @@ -535,7 +535,7 @@ pub fn writeEhFrameHdr(elf_file: *Elf, writer: anytype) !void { |
| 535 | 535 | |
| 536 | 536 | const x86_64 = struct { |
| 537 | 537 | fn resolveReloc(rec: anytype, elf_file: *Elf, rel: elf.Elf64_Rela, source: i64, target: i64, data: []u8) !void { |
| 538 | const r_type: elf.R_X86_64 = @enumFromInt(rel.r_type()); | |
| 538 | const r_type: elf.R_X86_64 = @fromBackingInt(@intCast(rel.r_type())); | |
| 539 | 539 | switch (r_type) { |
| 540 | 540 | .NONE => {}, |
| 541 | 541 | .@"32" => std.mem.writeInt(i32, data[0..4], @as(i32, @truncate(target)), .little), |
| ... | ... | @@ -549,7 +549,7 @@ const x86_64 = struct { |
| 549 | 549 | |
| 550 | 550 | const aarch64 = struct { |
| 551 | 551 | fn resolveReloc(rec: anytype, elf_file: *Elf, rel: elf.Elf64_Rela, source: i64, target: i64, data: []u8) !void { |
| 552 | const r_type: elf.R_AARCH64 = @enumFromInt(rel.r_type()); | |
| 552 | const r_type: elf.R_AARCH64 = @fromBackingInt(@intCast(rel.r_type())); | |
| 553 | 553 | switch (r_type) { |
| 554 | 554 | .NONE => {}, |
| 555 | 555 | .ABS64 => std.mem.writeInt(i64, data[0..8], target, .little), |
| ... | ... | @@ -562,7 +562,7 @@ const aarch64 = struct { |
| 562 | 562 | |
| 563 | 563 | const riscv = struct { |
| 564 | 564 | fn resolveReloc(rec: anytype, elf_file: *Elf, rel: elf.Elf64_Rela, source: i64, target: i64, data: []u8) !void { |
| 565 | const r_type: elf.R_RISCV = @enumFromInt(rel.r_type()); | |
| 565 | const r_type: elf.R_RISCV = @fromBackingInt(@intCast(rel.r_type())); | |
| 566 | 566 | switch (r_type) { |
| 567 | 567 | .NONE => {}, |
| 568 | 568 | .@"32_PCREL" => std.mem.writeInt(i32, data[0..4], @as(i32, @intCast(target - source)), .little), |
src/link/Elf/relocation.zig+11-11| ... | ... | @@ -17,14 +17,14 @@ fn Table(comptime len: comptime_int, comptime RelType: type, comptime mapping: [ |
| 17 | 17 | return struct { |
| 18 | 18 | fn decode(r_type: u32) Kind { |
| 19 | 19 | inline for (mapping) |entry| { |
| 20 | if (@intFromEnum(entry[1]) == r_type) return entry[0]; | |
| 20 | if (@backingInt(entry[1]) == r_type) return entry[0]; | |
| 21 | 21 | } |
| 22 | 22 | return .other; |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | fn encode(comptime kind: Kind) u32 { |
| 26 | 26 | inline for (mapping) |entry| { |
| 27 | if (entry[0] == kind) return @intFromEnum(entry[1]); | |
| 27 | if (entry[0] == kind) return @backingInt(entry[1]); | |
| 28 | 28 | } |
| 29 | 29 | @panic("encoding .other is ambiguous"); |
| 30 | 30 | } |
| ... | ... | @@ -94,15 +94,15 @@ pub fn encode(comptime kind: Kind, cpu_arch: std.Target.Cpu.Arch) u32 { |
| 94 | 94 | pub const dwarf = struct { |
| 95 | 95 | pub fn crossSectionRelocType(format: DW.Format, cpu_arch: std.Target.Cpu.Arch) u32 { |
| 96 | 96 | return switch (cpu_arch) { |
| 97 | .x86_64 => @intFromEnum(@as(elf.R_X86_64, switch (format) { | |
| 97 | .x86_64 => @backingInt(@as(elf.R_X86_64, switch (format) { | |
| 98 | 98 | .@"32" => .@"32", |
| 99 | 99 | .@"64" => .@"64", |
| 100 | 100 | })), |
| 101 | .aarch64, .aarch64_be => @intFromEnum(@as(elf.R_AARCH64, switch (format) { | |
| 101 | .aarch64, .aarch64_be => @backingInt(@as(elf.R_AARCH64, switch (format) { | |
| 102 | 102 | .@"32" => .ABS32, |
| 103 | 103 | .@"64" => .ABS64, |
| 104 | 104 | })), |
| 105 | .riscv64, .riscv64be => @intFromEnum(@as(elf.R_RISCV, switch (format) { | |
| 105 | .riscv64, .riscv64be => @backingInt(@as(elf.R_RISCV, switch (format) { | |
| 106 | 106 | .@"32" => .@"32", |
| 107 | 107 | .@"64" => .@"64", |
| 108 | 108 | })), |
| ... | ... | @@ -117,7 +117,7 @@ pub const dwarf = struct { |
| 117 | 117 | cpu_arch: std.Target.Cpu.Arch, |
| 118 | 118 | ) u32 { |
| 119 | 119 | return switch (cpu_arch) { |
| 120 | .x86_64 => @intFromEnum(@as(elf.R_X86_64, switch (source_section) { | |
| 120 | .x86_64 => @backingInt(@as(elf.R_X86_64, switch (source_section) { | |
| 121 | 121 | else => switch (address_size) { |
| 122 | 122 | .@"32" => if (target.flags.is_tls) .DTPOFF32 else .@"32", |
| 123 | 123 | .@"64" => if (target.flags.is_tls) .DTPOFF64 else .@"64", |
| ... | ... | @@ -125,7 +125,7 @@ pub const dwarf = struct { |
| 125 | 125 | }, |
| 126 | 126 | .debug_frame => .PC32, |
| 127 | 127 | })), |
| 128 | .aarch64, .aarch64_be => @intFromEnum(@as(elf.R_AARCH64, switch (source_section) { | |
| 128 | .aarch64, .aarch64_be => @backingInt(@as(elf.R_AARCH64, switch (source_section) { | |
| 129 | 129 | else => switch (address_size) { |
| 130 | 130 | .@"32" => .ABS32, |
| 131 | 131 | .@"64" => .ABS64, |
| ... | ... | @@ -133,7 +133,7 @@ pub const dwarf = struct { |
| 133 | 133 | }, |
| 134 | 134 | .debug_frame => .PREL32, |
| 135 | 135 | })), |
| 136 | .riscv64, .riscv64be => @intFromEnum(@as(elf.R_RISCV, switch (source_section) { | |
| 136 | .riscv64, .riscv64be => @backingInt(@as(elf.R_RISCV, switch (source_section) { | |
| 137 | 137 | else => switch (address_size) { |
| 138 | 138 | .@"32" => .@"32", |
| 139 | 139 | .@"64" => .@"64", |
| ... | ... | @@ -163,9 +163,9 @@ pub fn fmtRelocType(r_type: u32, cpu_arch: std.Target.Cpu.Arch) std.fmt.Alt(Form |
| 163 | 163 | fn formatRelocType(ctx: FormatRelocTypeCtx, writer: *std.Io.Writer) std.Io.Writer.Error!void { |
| 164 | 164 | const r_type = ctx.r_type; |
| 165 | 165 | switch (ctx.cpu_arch) { |
| 166 | .x86_64 => try writer.print("R_X86_64_{s}", .{@tagName(@as(elf.R_X86_64, @enumFromInt(r_type)))}), | |
| 167 | .aarch64, .aarch64_be => try writer.print("R_AARCH64_{s}", .{@tagName(@as(elf.R_AARCH64, @enumFromInt(r_type)))}), | |
| 168 | .riscv64, .riscv64be => try writer.print("R_RISCV_{s}", .{@tagName(@as(elf.R_RISCV, @enumFromInt(r_type)))}), | |
| 166 | .x86_64 => try writer.print("R_X86_64_{s}", .{@tagName(@as(elf.R_X86_64, @fromBackingInt(@intCast(r_type))))}), | |
| 167 | .aarch64, .aarch64_be => try writer.print("R_AARCH64_{s}", .{@tagName(@as(elf.R_AARCH64, @fromBackingInt(@intCast(r_type))))}), | |
| 168 | .riscv64, .riscv64be => try writer.print("R_RISCV_{s}", .{@tagName(@as(elf.R_RISCV, @fromBackingInt(@intCast(r_type))))}), | |
| 169 | 169 | else => unreachable, |
| 170 | 170 | } |
| 171 | 171 | } |
src/link/Elf2.zig+172-172| ... | ... | @@ -212,26 +212,26 @@ const Node = union(enum) { |
| 212 | 212 | _, |
| 213 | 213 | |
| 214 | 214 | pub fn path(ii: InputIndex, elf: *const Elf) std.Build.Cache.Path { |
| 215 | return elf.inputs.items[@intFromEnum(ii)].path; | |
| 215 | return elf.inputs.items[@backingInt(ii)].path; | |
| 216 | 216 | } |
| 217 | 217 | |
| 218 | 218 | pub fn member(ii: InputIndex, elf: *const Elf) ?[]const u8 { |
| 219 | return elf.inputs.items[@intFromEnum(ii)].member; | |
| 219 | return elf.inputs.items[@backingInt(ii)].member; | |
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | pub fn fileSymbol(ii: InputIndex, elf: *const Elf) Symbol.LocalIndex { |
| 223 | return elf.inputs.items[@intFromEnum(ii)].file_symbol; | |
| 223 | return elf.inputs.items[@backingInt(ii)].file_symbol; | |
| 224 | 224 | } |
| 225 | 225 | |
| 226 | 226 | pub fn localSymbolRange(ii: InputIndex, elf: *Elf) [2]Symbol.LocalIndex { |
| 227 | if (@intFromEnum(ii) + 1 < elf.inputs.items.len) { | |
| 228 | const next_ii: InputIndex = @enumFromInt(@intFromEnum(ii) + 1); | |
| 227 | if (@backingInt(ii) + 1 < elf.inputs.items.len) { | |
| 228 | const next_ii: InputIndex = @fromBackingInt(@intCast(@backingInt(ii) + 1)); | |
| 229 | 229 | return .{ ii.fileSymbol(elf), next_ii.fileSymbol(elf) }; |
| 230 | 230 | } else { |
| 231 | 231 | const local_symbols_len = switch (elf.shdrPtr(.symtab)) { |
| 232 | 232 | inline else => |shdr| elf.targetLoad(&shdr.info), |
| 233 | 233 | }; |
| 234 | return .{ ii.fileSymbol(elf), @enumFromInt(local_symbols_len) }; | |
| 234 | return .{ ii.fileSymbol(elf), @fromBackingInt(@intCast(local_symbols_len)) }; | |
| 235 | 235 | } |
| 236 | 236 | } |
| 237 | 237 | }; |
| ... | ... | @@ -240,18 +240,18 @@ const Node = union(enum) { |
| 240 | 240 | _, |
| 241 | 241 | |
| 242 | 242 | pub fn navIndex(nmi: NavMapIndex, elf: *const Elf) InternPool.Nav.Index { |
| 243 | return elf.navs.keys()[@intFromEnum(nmi)]; | |
| 243 | return elf.navs.keys()[@backingInt(nmi)]; | |
| 244 | 244 | } |
| 245 | 245 | |
| 246 | 246 | pub fn symbol(nmi: NavMapIndex, elf: *const Elf) Symbol.LocalIndex { |
| 247 | return elf.navs.values()[@intFromEnum(nmi)].lsi; | |
| 247 | return elf.navs.values()[@backingInt(nmi)].lsi; | |
| 248 | 248 | } |
| 249 | 249 | |
| 250 | 250 | fn firstSymbolReloc(nmi: NavMapIndex, elf: *const Elf) SymbolReloc.Index { |
| 251 | return elf.navs.values()[@intFromEnum(nmi)].first_symbol_reloc; | |
| 251 | return elf.navs.values()[@backingInt(nmi)].first_symbol_reloc; | |
| 252 | 252 | } |
| 253 | 253 | fn firstGotReloc(nmi: NavMapIndex, elf: *const Elf) GotReloc.Index { |
| 254 | return elf.navs.values()[@intFromEnum(nmi)].first_got_reloc; | |
| 254 | return elf.navs.values()[@backingInt(nmi)].first_got_reloc; | |
| 255 | 255 | } |
| 256 | 256 | }; |
| 257 | 257 | |
| ... | ... | @@ -259,15 +259,15 @@ const Node = union(enum) { |
| 259 | 259 | _, |
| 260 | 260 | |
| 261 | 261 | pub fn uavValue(umi: UavMapIndex, elf: *const Elf) InternPool.Index { |
| 262 | return elf.uavs.keys()[@intFromEnum(umi)]; | |
| 262 | return elf.uavs.keys()[@backingInt(umi)]; | |
| 263 | 263 | } |
| 264 | 264 | |
| 265 | 265 | pub fn symbol(umi: UavMapIndex, elf: *const Elf) Symbol.LocalIndex { |
| 266 | return elf.uavs.values()[@intFromEnum(umi)].lsi; | |
| 266 | return elf.uavs.values()[@backingInt(umi)].lsi; | |
| 267 | 267 | } |
| 268 | 268 | |
| 269 | 269 | fn firstSymbolReloc(umi: UavMapIndex, elf: *const Elf) SymbolReloc.Index { |
| 270 | return elf.uavs.values()[@intFromEnum(umi)].first_symbol_reloc; | |
| 270 | return elf.uavs.values()[@backingInt(umi)].first_symbol_reloc; | |
| 271 | 271 | } |
| 272 | 272 | fn firstGotReloc(umi: UavMapIndex, elf: *const Elf) GotReloc.Index { |
| 273 | 273 | _ = umi; |
| ... | ... | @@ -285,7 +285,7 @@ const Node = union(enum) { |
| 285 | 285 | _, |
| 286 | 286 | |
| 287 | 287 | pub fn ref(lmi: @This()) LazyMapRef { |
| 288 | return .{ .kind = kind, .index = @intFromEnum(lmi) }; | |
| 288 | return .{ .kind = kind, .index = @backingInt(lmi) }; | |
| 289 | 289 | } |
| 290 | 290 | |
| 291 | 291 | pub fn lazySymbol(lmi: @This(), elf: *const Elf) link.File.LazySymbol { |
| ... | ... | @@ -297,10 +297,10 @@ const Node = union(enum) { |
| 297 | 297 | } |
| 298 | 298 | |
| 299 | 299 | fn firstSymbolReloc(lmi: @This(), elf: *const Elf) SymbolReloc.Index { |
| 300 | return elf.lazy.getPtrConst(kind).map.values()[@intFromEnum(lmi)].first_symbol_reloc; | |
| 300 | return elf.lazy.getPtrConst(kind).map.values()[@backingInt(lmi)].first_symbol_reloc; | |
| 301 | 301 | } |
| 302 | 302 | fn firstGotReloc(lmi: @This(), elf: *const Elf) GotReloc.Index { |
| 303 | return elf.lazy.getPtrConst(kind).map.values()[@intFromEnum(lmi)].first_got_reloc; | |
| 303 | return elf.lazy.getPtrConst(kind).map.values()[@backingInt(lmi)].first_got_reloc; | |
| 304 | 304 | } |
| 305 | 305 | }; |
| 306 | 306 | } |
| ... | ... | @@ -316,13 +316,13 @@ const Node = union(enum) { |
| 316 | 316 | |
| 317 | 317 | pub const Known = struct { |
| 318 | 318 | comptime file: MappedFile.Node.Index = .root, |
| 319 | comptime ehdr: MappedFile.Node.Index = @enumFromInt(1), | |
| 320 | comptime shdr: MappedFile.Node.Index = @enumFromInt(2), | |
| 321 | comptime rodata: MappedFile.Node.Index = @enumFromInt(3), | |
| 322 | comptime phdr: MappedFile.Node.Index = @enumFromInt(4), | |
| 323 | comptime text: MappedFile.Node.Index = @enumFromInt(5), | |
| 324 | comptime data: MappedFile.Node.Index = @enumFromInt(6), | |
| 325 | comptime data_rel_ro: MappedFile.Node.Index = @enumFromInt(7), | |
| 319 | comptime ehdr: MappedFile.Node.Index = @fromBackingInt(@intCast(1)), | |
| 320 | comptime shdr: MappedFile.Node.Index = @fromBackingInt(@intCast(2)), | |
| 321 | comptime rodata: MappedFile.Node.Index = @fromBackingInt(@intCast(3)), | |
| 322 | comptime phdr: MappedFile.Node.Index = @fromBackingInt(@intCast(4)), | |
| 323 | comptime text: MappedFile.Node.Index = @fromBackingInt(@intCast(5)), | |
| 324 | comptime data: MappedFile.Node.Index = @fromBackingInt(@intCast(6)), | |
| 325 | comptime data_rel_ro: MappedFile.Node.Index = @fromBackingInt(@intCast(7)), | |
| 326 | 326 | |
| 327 | 327 | tls: MappedFile.Node.Index, |
| 328 | 328 | }; |
| ... | ... | @@ -333,11 +333,11 @@ const Node = union(enum) { |
| 333 | 333 | |
| 334 | 334 | /// In this linker implementation, `link.File.AtomId` is a type-erased `MappedFile.Node.Index`. |
| 335 | 335 | fn toAtom(ni: MappedFile.Node.Index) link.File.AtomId { |
| 336 | return @enumFromInt(@intFromEnum(ni)); | |
| 336 | return @fromBackingInt(@intCast(@backingInt(ni))); | |
| 337 | 337 | } |
| 338 | 338 | /// In this linker implementation, `link.File.AtomId` is a type-erased `MappedFile.Node.Index`. |
| 339 | 339 | fn fromAtom(atom: link.File.AtomId) MappedFile.Node.Index { |
| 340 | return @enumFromInt(@intFromEnum(atom)); | |
| 340 | return @fromBackingInt(@intCast(@backingInt(atom))); | |
| 341 | 341 | } |
| 342 | 342 | }; |
| 343 | 343 | |
| ... | ... | @@ -356,11 +356,11 @@ const InputSection = struct { |
| 356 | 356 | _, |
| 357 | 357 | |
| 358 | 358 | fn ptr(isi: InputSection.Index, elf: *Elf) *InputSection { |
| 359 | return &elf.input_sections.items[@intFromEnum(isi)]; | |
| 359 | return &elf.input_sections.items[@backingInt(isi)]; | |
| 360 | 360 | } |
| 361 | 361 | |
| 362 | 362 | fn ptrConst(isi: InputSection.Index, elf: *const Elf) *const InputSection { |
| 363 | return &elf.input_sections.items[@intFromEnum(isi)]; | |
| 363 | return &elf.input_sections.items[@backingInt(isi)]; | |
| 364 | 364 | } |
| 365 | 365 | |
| 366 | 366 | fn input(isi: InputSection.Index, elf: *const Elf) Node.InputIndex { |
| ... | ... | @@ -424,13 +424,13 @@ const Section = struct { |
| 424 | 424 | fn unwrap(opt: RelaIndex.Optional) ?RelaIndex { |
| 425 | 425 | return switch (opt) { |
| 426 | 426 | .none => null, |
| 427 | _ => @enumFromInt(@intFromEnum(opt)), | |
| 427 | _ => @fromBackingInt(@intCast(@backingInt(opt))), | |
| 428 | 428 | }; |
| 429 | 429 | } |
| 430 | 430 | }; |
| 431 | 431 | |
| 432 | 432 | fn toOptional(i: RelaIndex) RelaIndex.Optional { |
| 433 | return @enumFromInt(@intFromEnum(i)); | |
| 433 | return @fromBackingInt(@intCast(@backingInt(i))); | |
| 434 | 434 | } |
| 435 | 435 | }; |
| 436 | 436 | |
| ... | ... | @@ -455,7 +455,7 @@ const Section = struct { |
| 455 | 455 | pub const LORESERVE: Index = .fromSection(std.elf.SHN_LORESERVE); |
| 456 | 456 | pub const HIRESERVE: Index = .fromSection(std.elf.SHN_HIRESERVE); |
| 457 | 457 | comptime { |
| 458 | assert(@intFromEnum(HIRESERVE) == std.math.maxInt(Tag)); | |
| 458 | assert(@backingInt(HIRESERVE) == std.math.maxInt(Tag)); | |
| 459 | 459 | } |
| 460 | 460 | |
| 461 | 461 | fn reserve(sec: std.elf.Section) Tag { |
| ... | ... | @@ -465,12 +465,12 @@ const Section = struct { |
| 465 | 465 | |
| 466 | 466 | pub fn fromSection(sec: std.elf.Section) Index { |
| 467 | 467 | return switch (sec) { |
| 468 | std.elf.SHN_UNDEF...std.elf.SHN_LORESERVE - 1 => @enumFromInt(sec), | |
| 469 | std.elf.SHN_LORESERVE...std.elf.SHN_HIRESERVE => @enumFromInt(reserve(sec)), | |
| 468 | std.elf.SHN_UNDEF...std.elf.SHN_LORESERVE - 1 => @fromBackingInt(@intCast(sec)), | |
| 469 | std.elf.SHN_LORESERVE...std.elf.SHN_HIRESERVE => @fromBackingInt(@intCast(reserve(sec))), | |
| 470 | 470 | }; |
| 471 | 471 | } |
| 472 | 472 | pub fn toSection(s: Index) ?std.elf.Section { |
| 473 | return switch (@intFromEnum(s)) { | |
| 473 | return switch (@backingInt(s)) { | |
| 474 | 474 | std.elf.SHN_UNDEF...std.elf.SHN_LORESERVE - 1 => |sec| @intCast(sec), |
| 475 | 475 | std.elf.SHN_LORESERVE...reserve(std.elf.SHN_LORESERVE) - 1 => null, |
| 476 | 476 | reserve(std.elf.SHN_LORESERVE)...reserve(std.elf.SHN_HIRESERVE) => |sec| @intCast( |
| ... | ... | @@ -480,12 +480,12 @@ const Section = struct { |
| 480 | 480 | } |
| 481 | 481 | |
| 482 | 482 | fn get(s: Index, elf: *Elf) *Section { |
| 483 | return &elf.shdrs.items[@intFromEnum(s)]; | |
| 483 | return &elf.shdrs.items[@backingInt(s)]; | |
| 484 | 484 | } |
| 485 | 485 | |
| 486 | 486 | fn name(s: Index, elf: *Elf) String(.shstrtab) { |
| 487 | 487 | return switch (elf.shdrPtr(s)) { |
| 488 | inline else => |shdr| @enumFromInt(elf.targetLoad(&shdr.name)), | |
| 488 | inline else => |shdr| @fromBackingInt(@intCast(elf.targetLoad(&shdr.name))), | |
| 489 | 489 | }; |
| 490 | 490 | } |
| 491 | 491 | |
| ... | ... | @@ -510,7 +510,7 @@ const Section = struct { |
| 510 | 510 | fn rename(shndx: Index, elf: *Elf, new_name: []const u8) Error!void { |
| 511 | 511 | const shstrtab_entry = try elf.string(.shstrtab, new_name); |
| 512 | 512 | switch (elf.shdrPtr(shndx)) { |
| 513 | inline else => |shdr| elf.targetStore(&shdr.name, @intFromEnum(shstrtab_entry)), | |
| 513 | inline else => |shdr| elf.targetStore(&shdr.name, @backingInt(shstrtab_entry)), | |
| 514 | 514 | } |
| 515 | 515 | } |
| 516 | 516 | |
| ... | ... | @@ -530,7 +530,7 @@ const Section = struct { |
| 530 | 530 | const relas: []const class.ElfN().Rela = @ptrCast(@alignCast( |
| 531 | 531 | node.slice(&elf.mf)[0..@intCast(cur_size)], |
| 532 | 532 | )); |
| 533 | const free_len = elf.targetLoad(&relas[@intFromEnum(free_head)].addend); | |
| 533 | const free_len = elf.targetLoad(&relas[@backingInt(free_head)].addend); | |
| 534 | 534 | assert(free_len > 0); |
| 535 | 535 | break :free_len @intCast(free_len); |
| 536 | 536 | }; |
| ... | ... | @@ -555,17 +555,17 @@ const Section = struct { |
| 555 | 555 | const opt_free_head = rela_shndx.get(elf).rela.free_head; |
| 556 | 556 | const old_free_len: u32 = free_len: { |
| 557 | 557 | const free_head = opt_free_head.unwrap() orelse break :free_len 0; |
| 558 | const free_len = elf.targetLoad(&relas[@intFromEnum(free_head)].addend); | |
| 558 | const free_len = elf.targetLoad(&relas[@backingInt(free_head)].addend); | |
| 559 | 559 | assert(free_len > 0); |
| 560 | 560 | break :free_len @intCast(free_len); |
| 561 | 561 | }; |
| 562 | 562 | const none_reloc_type = MachineRelocType.none(elf).unwrap(elf); |
| 563 | 563 | { |
| 564 | const old_type = elf.targetLoad(&relas[@intFromEnum(index)].info).type; | |
| 564 | const old_type = elf.targetLoad(&relas[@backingInt(index)].info).type; | |
| 565 | 565 | assert(old_type != none_reloc_type); // bug: `index` is already in the free-list |
| 566 | 566 | } |
| 567 | relas[@intFromEnum(index)] = .{ | |
| 568 | .offset = @intFromEnum(opt_free_head), // next | |
| 567 | relas[@backingInt(index)] = .{ | |
| 568 | .offset = @backingInt(opt_free_head), // next | |
| 569 | 569 | .info = .{ |
| 570 | 570 | .type = @intCast(none_reloc_type), |
| 571 | 571 | .sym = 0, |
| ... | ... | @@ -573,7 +573,7 @@ const Section = struct { |
| 573 | 573 | .addend = @intCast(old_free_len + 1), // list length |
| 574 | 574 | }; |
| 575 | 575 | if (elf.targetEndian() != native_endian) { |
| 576 | std.mem.byteSwapAllFields(class.ElfN().Rela, &relas[@intFromEnum(index)]); | |
| 576 | std.mem.byteSwapAllFields(class.ElfN().Rela, &relas[@backingInt(index)]); | |
| 577 | 577 | } |
| 578 | 578 | }, |
| 579 | 579 | } |
| ... | ... | @@ -600,16 +600,16 @@ const Section = struct { |
| 600 | 600 | const relas: []class.ElfN().Rela = @ptrCast(@alignCast( |
| 601 | 601 | rela_shndx.get(elf).ni.slice(&elf.mf)[0..@intCast(elf.targetLoad(&shdr.size))], |
| 602 | 602 | )); |
| 603 | const next: RelaIndex.Optional = @enumFromInt(elf.targetLoad( | |
| 604 | &relas[@intFromEnum(free_head)].offset, | |
| 605 | )); | |
| 603 | const next: RelaIndex.Optional = @fromBackingInt(@intCast(elf.targetLoad( | |
| 604 | &relas[@backingInt(free_head)].offset, | |
| 605 | ))); | |
| 606 | 606 | rela_shndx.get(elf).rela.free_head = next; |
| 607 | 607 | |
| 608 | 608 | const old_free_len: u32 = @intCast( |
| 609 | elf.targetLoad(&relas[@intFromEnum(free_head)].addend), | |
| 609 | elf.targetLoad(&relas[@backingInt(free_head)].addend), | |
| 610 | 610 | ); |
| 611 | 611 | const new_free_len: u32 = if (next.unwrap()) |i| @intCast( |
| 612 | elf.targetLoad(&relas[@intFromEnum(i)].addend), | |
| 612 | elf.targetLoad(&relas[@backingInt(i)].addend), | |
| 613 | 613 | ) else 0; |
| 614 | 614 | assert(new_free_len == old_free_len - 1); |
| 615 | 615 | |
| ... | ... | @@ -623,12 +623,12 @@ const Section = struct { |
| 623 | 623 | } else if (rela_shndx == elf.shndx.rela_plt) { |
| 624 | 624 | elf.updateDynamicEntry(std.elf.DT_PLTRELSZ, new_size); |
| 625 | 625 | } |
| 626 | break :new_index @enumFromInt(@divExact(old_size, ent_size)); | |
| 626 | break :new_index @fromBackingInt(@intCast(@divExact(old_size, ent_size))); | |
| 627 | 627 | }; |
| 628 | 628 | const relas: []class.ElfN().Rela = @ptrCast(@alignCast( |
| 629 | 629 | rela_shndx.get(elf).ni.slice(&elf.mf)[0..@intCast(elf.targetLoad(&shdr.size))], |
| 630 | 630 | )); |
| 631 | relas[@intFromEnum(new_index)] = .{ | |
| 631 | relas[@backingInt(new_index)] = .{ | |
| 632 | 632 | .offset = @intCast(opts.offset), |
| 633 | 633 | .info = .{ |
| 634 | 634 | .type = @intCast(opts.type.unwrap(elf)), |
| ... | ... | @@ -637,7 +637,7 @@ const Section = struct { |
| 637 | 637 | .addend = @intCast(opts.addend), |
| 638 | 638 | }; |
| 639 | 639 | if (elf.targetEndian() != native_endian) { |
| 640 | std.mem.byteSwapAllFields(class.ElfN().Rela, &relas[@intFromEnum(new_index)]); | |
| 640 | std.mem.byteSwapAllFields(class.ElfN().Rela, &relas[@backingInt(new_index)]); | |
| 641 | 641 | } |
| 642 | 642 | return new_index; |
| 643 | 643 | }, |
| ... | ... | @@ -656,12 +656,12 @@ const Section = struct { |
| 656 | 656 | const relas: []class.ElfN().Rela = @ptrCast(@alignCast( |
| 657 | 657 | rela_shndx.get(elf).ni.slice(&elf.mf)[0..@intCast(elf.targetLoad(&shdr.size))], |
| 658 | 658 | )); |
| 659 | const rela_info = elf.targetLoad(&relas[@intFromEnum(index)].info); | |
| 659 | const rela_info = elf.targetLoad(&relas[@backingInt(index)].info); | |
| 660 | 660 | { |
| 661 | 661 | const none_reloc_type = MachineRelocType.none(elf).unwrap(elf); |
| 662 | 662 | assert(rela_info.type != none_reloc_type); // bug: `index` is in the free-list |
| 663 | 663 | } |
| 664 | elf.targetStore(&relas[@intFromEnum(index)].info, .{ | |
| 664 | elf.targetStore(&relas[@backingInt(index)].info, .{ | |
| 665 | 665 | .type = rela_info.type, |
| 666 | 666 | .sym = @intCast(raw_sym_index), |
| 667 | 667 | }); |
| ... | ... | @@ -681,11 +681,11 @@ const Section = struct { |
| 681 | 681 | rela_shndx.get(elf).ni.slice(&elf.mf)[0..@intCast(elf.targetLoad(&shdr.size))], |
| 682 | 682 | )); |
| 683 | 683 | { |
| 684 | const rela_info = elf.targetLoad(&relas[@intFromEnum(index)].info); | |
| 684 | const rela_info = elf.targetLoad(&relas[@backingInt(index)].info); | |
| 685 | 685 | const none_reloc_type = MachineRelocType.none(elf).unwrap(elf); |
| 686 | 686 | assert(rela_info.type != none_reloc_type); // bug: `index` is in the free-list |
| 687 | 687 | } |
| 688 | elf.targetStore(&relas[@intFromEnum(index)].offset, @intCast(new_offset)); | |
| 688 | elf.targetStore(&relas[@backingInt(index)].offset, @intCast(new_offset)); | |
| 689 | 689 | }, |
| 690 | 690 | } |
| 691 | 691 | } |
| ... | ... | @@ -702,12 +702,12 @@ const Section = struct { |
| 702 | 702 | rela_shndx.get(elf).ni.slice(&elf.mf)[0..@intCast(elf.targetLoad(&shdr.size))], |
| 703 | 703 | )); |
| 704 | 704 | { |
| 705 | const rela_info = elf.targetLoad(&relas[@intFromEnum(index)].info); | |
| 705 | const rela_info = elf.targetLoad(&relas[@backingInt(index)].info); | |
| 706 | 706 | const none_reloc_type = MachineRelocType.none(elf).unwrap(elf); |
| 707 | 707 | assert(rela_info.type != none_reloc_type); // bug: `index` is in the free-list |
| 708 | 708 | } |
| 709 | const old_offset = elf.targetLoad(&relas[@intFromEnum(index)].offset); | |
| 710 | elf.targetStore(&relas[@intFromEnum(index)].offset, @intCast( | |
| 709 | const old_offset = elf.targetLoad(&relas[@backingInt(index)].offset); | |
| 710 | elf.targetStore(&relas[@backingInt(index)].offset, @intCast( | |
| 711 | 711 | old_offset - old_base + new_base, |
| 712 | 712 | )); |
| 713 | 713 | }, |
| ... | ... | @@ -726,12 +726,12 @@ const Section = struct { |
| 726 | 726 | rela_shndx.get(elf).ni.slice(&elf.mf)[0..@intCast(elf.targetLoad(&shdr.size))], |
| 727 | 727 | )); |
| 728 | 728 | { |
| 729 | const rela_info = elf.targetLoad(&relas[@intFromEnum(index)].info); | |
| 729 | const rela_info = elf.targetLoad(&relas[@backingInt(index)].info); | |
| 730 | 730 | const none_reloc_type = MachineRelocType.none(elf).unwrap(elf); |
| 731 | 731 | assert(rela_info.type != none_reloc_type); // bug: `index` is in the free-list |
| 732 | 732 | } |
| 733 | 733 | const unsigned: class.ElfN().Addr = @intCast(new_addend); |
| 734 | elf.targetStore(&relas[@intFromEnum(index)].addend, @bitCast(unsigned)); | |
| 734 | elf.targetStore(&relas[@backingInt(index)].addend, @bitCast(unsigned)); | |
| 735 | 735 | }, |
| 736 | 736 | } |
| 737 | 737 | } |
| ... | ... | @@ -896,7 +896,7 @@ const GotReloc = struct { |
| 896 | 896 | _, |
| 897 | 897 | |
| 898 | 898 | fn get(index: GotReloc.Index, elf: *Elf) *GotReloc { |
| 899 | return &elf.got_relocs.items[@intFromEnum(index)]; | |
| 899 | return &elf.got_relocs.items[@backingInt(index)]; | |
| 900 | 900 | } |
| 901 | 901 | }; |
| 902 | 902 | |
| ... | ... | @@ -1131,22 +1131,22 @@ pub const MachineRelocType = union { |
| 1131 | 1131 | |
| 1132 | 1132 | pub fn wrap(int: u32, elf: *const Elf) MachineRelocType { |
| 1133 | 1133 | return switch (elf.ehdrMachine()) { |
| 1134 | .AARCH64 => .{ .AARCH64 = @enumFromInt(int) }, | |
| 1135 | .LOONGARCH => .{ .LARCH = @enumFromInt(int) }, | |
| 1136 | .PPC64 => .{ .PPC64 = @enumFromInt(int) }, | |
| 1137 | .RISCV => .{ .RISCV = @enumFromInt(int) }, | |
| 1138 | .SPARCV9 => .{ .SPARC = @enumFromInt(int) }, | |
| 1139 | .X86_64 => .{ .X86_64 = @enumFromInt(int) }, | |
| 1134 | .AARCH64 => .{ .AARCH64 = @fromBackingInt(@intCast(int)) }, | |
| 1135 | .LOONGARCH => .{ .LARCH = @fromBackingInt(@intCast(int)) }, | |
| 1136 | .PPC64 => .{ .PPC64 = @fromBackingInt(@intCast(int)) }, | |
| 1137 | .RISCV => .{ .RISCV = @fromBackingInt(@intCast(int)) }, | |
| 1138 | .SPARCV9 => .{ .SPARC = @fromBackingInt(@intCast(int)) }, | |
| 1139 | .X86_64 => .{ .X86_64 = @fromBackingInt(@intCast(int)) }, | |
| 1140 | 1140 | }; |
| 1141 | 1141 | } |
| 1142 | 1142 | pub fn unwrap(rt: MachineRelocType, elf: *const Elf) u32 { |
| 1143 | 1143 | return switch (elf.ehdrMachine()) { |
| 1144 | .AARCH64 => @intFromEnum(rt.AARCH64), | |
| 1145 | .LOONGARCH => @intFromEnum(rt.LARCH), | |
| 1146 | .PPC64 => @intFromEnum(rt.PPC64), | |
| 1147 | .RISCV => @intFromEnum(rt.RISCV), | |
| 1148 | .SPARCV9 => @intFromEnum(rt.SPARC), | |
| 1149 | .X86_64 => @intFromEnum(rt.X86_64), | |
| 1144 | .AARCH64 => @backingInt(rt.AARCH64), | |
| 1145 | .LOONGARCH => @backingInt(rt.LARCH), | |
| 1146 | .PPC64 => @backingInt(rt.PPC64), | |
| 1147 | .RISCV => @backingInt(rt.RISCV), | |
| 1148 | .SPARCV9 => @backingInt(rt.SPARC), | |
| 1149 | .X86_64 => @backingInt(rt.X86_64), | |
| 1150 | 1150 | }; |
| 1151 | 1151 | } |
| 1152 | 1152 | }; |
| ... | ... | @@ -1209,7 +1209,7 @@ const SymbolReloc = struct { |
| 1209 | 1209 | _, |
| 1210 | 1210 | |
| 1211 | 1211 | fn get(index: SymbolReloc.Index, elf: *Elf) *SymbolReloc { |
| 1212 | return &elf.symbol_relocs.items[@intFromEnum(index)]; | |
| 1212 | return &elf.symbol_relocs.items[@backingInt(index)]; | |
| 1213 | 1213 | } |
| 1214 | 1214 | }; |
| 1215 | 1215 | |
| ... | ... | @@ -1875,17 +1875,17 @@ fn addLocalSymbolAssumeCapacity(elf: *Elf, opts: AddLocalSymbolOptions) Symbol.L |
| 1875 | 1875 | |
| 1876 | 1876 | // `shdr.info` stores the index of the first global symbol. We will replace it with our |
| 1877 | 1877 | // new local symbol, and move the global symbol to a new index at the end of the symtab. |
| 1878 | const target_index: Symbol.Index = @enumFromInt(elf.targetLoad(&shdr.info)); | |
| 1878 | const target_index: Symbol.Index = @fromBackingInt(@intCast(elf.targetLoad(&shdr.info))); | |
| 1879 | 1879 | |
| 1880 | 1880 | const old_size = elf.targetLoad(&shdr.size); |
| 1881 | 1881 | const new_size = old_size + ent_size; |
| 1882 | 1882 | |
| 1883 | 1883 | assert(elf.symtab.items.len == @divExact(old_size, ent_size)); |
| 1884 | 1884 | |
| 1885 | elf.targetStore(&shdr.info, @intFromEnum(target_index) + 1); | |
| 1885 | elf.targetStore(&shdr.info, @backingInt(target_index) + 1); | |
| 1886 | 1886 | elf.targetStore(&shdr.size, new_size); |
| 1887 | 1887 | |
| 1888 | const new_index: Symbol.Index = @enumFromInt(elf.symtab.items.len); | |
| 1888 | const new_index: Symbol.Index = @fromBackingInt(@intCast(elf.symtab.items.len)); | |
| 1889 | 1889 | elf.symtab.appendAssumeCapacity(undefined); |
| 1890 | 1890 | |
| 1891 | 1891 | const target_sym = @field(elf.symPtr(target_index), @tagName(class)); |
| ... | ... | @@ -1897,7 +1897,7 @@ fn addLocalSymbolAssumeCapacity(elf: *Elf, opts: AddLocalSymbolOptions) Symbol.L |
| 1897 | 1897 | // ...then the `elf.symtab` metadata... |
| 1898 | 1898 | new_index.ptr(elf).* = target_index.ptr(elf).*; |
| 1899 | 1899 | // ...then update the `elf.globals` tracking. |
| 1900 | const global_name: String(.strtab) = @enumFromInt(elf.targetLoad(&new_sym.name)); | |
| 1900 | const global_name: String(.strtab) = @fromBackingInt(@intCast(elf.targetLoad(&new_sym.name))); | |
| 1901 | 1901 | elf.globalByName(global_name).?.symtab_index = new_index; |
| 1902 | 1902 | |
| 1903 | 1903 | if (elf.ehdrType() == .REL and target_index.ptr(elf).first_target_reloc != .none) { |
| ... | ... | @@ -1912,7 +1912,7 @@ fn addLocalSymbolAssumeCapacity(elf: *Elf, opts: AddLocalSymbolOptions) Symbol.L |
| 1912 | 1912 | }; |
| 1913 | 1913 | |
| 1914 | 1914 | target_sym.* = .{ |
| 1915 | .name = @intFromEnum(opts.name), | |
| 1915 | .name = @backingInt(opts.name), | |
| 1916 | 1916 | .value = @intCast(opts.value), |
| 1917 | 1917 | .size = @intCast(opts.size), |
| 1918 | 1918 | .info = .{ .type = opts.type, .bind = .LOCAL }, |
| ... | ... | @@ -1923,7 +1923,7 @@ fn addLocalSymbolAssumeCapacity(elf: *Elf, opts: AddLocalSymbolOptions) Symbol.L |
| 1923 | 1923 | std.mem.byteSwapAllFields(class.ElfN().Sym, target_sym); |
| 1924 | 1924 | } |
| 1925 | 1925 | |
| 1926 | return @enumFromInt(@intFromEnum(target_index)); | |
| 1926 | return @fromBackingInt(@intCast(@backingInt(target_index))); | |
| 1927 | 1927 | }, |
| 1928 | 1928 | } |
| 1929 | 1929 | } |
| ... | ... | @@ -2082,7 +2082,7 @@ fn addGlobalSymbolAssumeCapacity(elf: *Elf, opts: AddGlobalSymbolOptions) error{ |
| 2082 | 2082 | else => |t| t, |
| 2083 | 2083 | }; |
| 2084 | 2084 | |
| 2085 | const sym_index: Symbol.Index = @enumFromInt(elf.symtab.items.len); | |
| 2085 | const sym_index: Symbol.Index = @fromBackingInt(@intCast(elf.symtab.items.len)); | |
| 2086 | 2086 | elf.symtab.appendAssumeCapacity(.{ |
| 2087 | 2087 | .node = opts.node, |
| 2088 | 2088 | .first_target_reloc = .none, |
| ... | ... | @@ -2092,12 +2092,12 @@ fn addGlobalSymbolAssumeCapacity(elf: *Elf, opts: AddGlobalSymbolOptions) error{ |
| 2092 | 2092 | const Sym = class.ElfN().Sym; |
| 2093 | 2093 | // Increase the symtab size... |
| 2094 | 2094 | const old_size = elf.targetLoad(&shdr.size); |
| 2095 | assert(old_size == @intFromEnum(sym_index) * @sizeOf(Sym)); | |
| 2095 | assert(old_size == @backingInt(sym_index) * @sizeOf(Sym)); | |
| 2096 | 2096 | elf.targetStore(&shdr.size, old_size + @sizeOf(Sym)); |
| 2097 | 2097 | // ...then populate the newly-valid symbol pointer |
| 2098 | 2098 | const sym = @field(elf.symPtr(sym_index), @tagName(class)); |
| 2099 | 2099 | sym.* = .{ |
| 2100 | .name = @intFromEnum(opts.name.strtab), | |
| 2100 | .name = @backingInt(opts.name.strtab), | |
| 2101 | 2101 | .value = @intCast(opts.value), |
| 2102 | 2102 | .size = @intCast(opts.size), |
| 2103 | 2103 | .info = .{ .type = @"type", .bind = bind }, |
| ... | ... | @@ -2133,7 +2133,7 @@ fn addGlobalSymbolAssumeCapacity(elf: *Elf, opts: AddGlobalSymbolOptions) error{ |
| 2133 | 2133 | // ...then populate the newly-valid symbol pointer |
| 2134 | 2134 | const sym = @field(elf.dynsymPtr(dynsym_index), @tagName(class)); |
| 2135 | 2135 | sym.* = .{ |
| 2136 | .name = @intFromEnum(opts.name.dynstr), | |
| 2136 | .name = @backingInt(opts.name.dynstr), | |
| 2137 | 2137 | .value = @intCast(opts.value), |
| 2138 | 2138 | .size = @intCast(opts.size), |
| 2139 | 2139 | .info = .{ .type = @"type", .bind = bind }, |
| ... | ... | @@ -2285,7 +2285,7 @@ fn setGlobalSymbolValue( |
| 2285 | 2285 | if (!elf.pltEntryIsDead(plt_index) and |
| 2286 | 2286 | elf.classifySymbolValue(.global(global_name)) != .dynamic) |
| 2287 | 2287 | { |
| 2288 | elf.shndx.rela_plt.relaDeleteOne(elf, @enumFromInt(plt_index)); | |
| 2288 | elf.shndx.rela_plt.relaDeleteOne(elf, @fromBackingInt(@intCast(plt_index))); | |
| 2289 | 2289 | assert(elf.pltEntryIsDead(plt_index)); |
| 2290 | 2290 | } |
| 2291 | 2291 | } |
| ... | ... | @@ -2371,14 +2371,14 @@ fn moveDemotedGlobal(elf: *Elf, global_ptr: *Symbol.Global) void { |
| 2371 | 2371 | inline else => |shdr, class| { |
| 2372 | 2372 | // `shdr.info` stores the index of the first global symbol. We are going to swap the |
| 2373 | 2373 | // demoted symbol with that first global symbol, then increment that start index. |
| 2374 | const dest_index: Symbol.Index = @enumFromInt(elf.targetLoad(&shdr.info)); | |
| 2374 | const dest_index: Symbol.Index = @fromBackingInt(@intCast(elf.targetLoad(&shdr.info))); | |
| 2375 | 2375 | const src_index = global_ptr.symtab_index; |
| 2376 | 2376 | |
| 2377 | 2377 | // This global should currently be in the "global symbols" part of the symtab, since our |
| 2378 | 2378 | // job is to move it *out* of that part: |
| 2379 | assert(@intFromEnum(src_index) >= @intFromEnum(dest_index)); | |
| 2379 | assert(@backingInt(src_index) >= @backingInt(dest_index)); | |
| 2380 | 2380 | |
| 2381 | elf.targetStore(&shdr.info, @intFromEnum(dest_index) + 1); | |
| 2381 | elf.targetStore(&shdr.info, @backingInt(dest_index) + 1); | |
| 2382 | 2382 | |
| 2383 | 2383 | if (src_index != dest_index) { |
| 2384 | 2384 | // The demoted global was not the first global in the symtab, so we need to swap it |
| ... | ... | @@ -2387,10 +2387,10 @@ fn moveDemotedGlobal(elf: *Elf, global_ptr: *Symbol.Global) void { |
| 2387 | 2387 | const src_sym_ptr = @field(elf.symPtr(src_index), @tagName(class)); |
| 2388 | 2388 | const dest_sym_ptr = @field(elf.symPtr(dest_index), @tagName(class)); |
| 2389 | 2389 | |
| 2390 | const this_name: String(.strtab) = @enumFromInt(elf.targetLoad(&src_sym_ptr.name)); | |
| 2390 | const this_name: String(.strtab) = @fromBackingInt(@intCast(elf.targetLoad(&src_sym_ptr.name))); | |
| 2391 | 2391 | assert(elf.globalByName(this_name).? == global_ptr); |
| 2392 | 2392 | |
| 2393 | const other_name: String(.strtab) = @enumFromInt(elf.targetLoad(&dest_sym_ptr.name)); | |
| 2393 | const other_name: String(.strtab) = @fromBackingInt(@intCast(elf.targetLoad(&dest_sym_ptr.name))); | |
| 2394 | 2394 | const other_global_ptr = elf.globalByName(other_name).?; |
| 2395 | 2395 | assert(other_global_ptr.symtab_index == dest_index); |
| 2396 | 2396 | |
| ... | ... | @@ -2426,7 +2426,7 @@ fn moveDemotedGlobal(elf: *Elf, global_ptr: *Symbol.Global) void { |
| 2426 | 2426 | const src_dynsym_ptr = @field(elf.dynsymPtr(remove_dynsym_index), @tagName(class)); |
| 2427 | 2427 | const dest_dynsym_ptr = @field(elf.dynsymPtr(free_dynsym_index), @tagName(class)); |
| 2428 | 2428 | |
| 2429 | const moved_name_dynstr: String(.dynstr) = @enumFromInt(elf.targetLoad(&src_dynsym_ptr.name)); | |
| 2429 | const moved_name_dynstr: String(.dynstr) = @fromBackingInt(@intCast(elf.targetLoad(&src_dynsym_ptr.name))); | |
| 2430 | 2430 | const moved_name = elf.stringExisting(.strtab, moved_name_dynstr.slice(elf)); |
| 2431 | 2431 | const moved_global_ptr = elf.globalByName(moved_name).?; |
| 2432 | 2432 | |
| ... | ... | @@ -2486,7 +2486,7 @@ const Symbol = struct { |
| 2486 | 2486 | _, |
| 2487 | 2487 | |
| 2488 | 2488 | fn ptr(si: Symbol.Index, elf: *Elf) *Symbol { |
| 2489 | return &elf.symtab.items[@intFromEnum(si)]; | |
| 2489 | return &elf.symtab.items[@backingInt(si)]; | |
| 2490 | 2490 | } |
| 2491 | 2491 | }; |
| 2492 | 2492 | |
| ... | ... | @@ -2505,7 +2505,7 @@ const Symbol = struct { |
| 2505 | 2505 | _, |
| 2506 | 2506 | |
| 2507 | 2507 | fn index(li: LocalIndex) Index { |
| 2508 | return @enumFromInt(@intFromEnum(li)); | |
| 2508 | return @fromBackingInt(@intCast(@backingInt(li))); | |
| 2509 | 2509 | } |
| 2510 | 2510 | }; |
| 2511 | 2511 | |
| ... | ... | @@ -2517,26 +2517,26 @@ const Symbol = struct { |
| 2517 | 2517 | const @"null": Symbol.Id = .local(.null); |
| 2518 | 2518 | |
| 2519 | 2519 | fn local(lsi: Symbol.LocalIndex) Symbol.Id { |
| 2520 | return .{ .kind = .local, .raw = @intCast(@intFromEnum(lsi)) }; | |
| 2520 | return .{ .kind = .local, .raw = @intCast(@backingInt(lsi)) }; | |
| 2521 | 2521 | } |
| 2522 | 2522 | fn global(name: String(.strtab)) Symbol.Id { |
| 2523 | return .{ .kind = .global, .raw = @intCast(@intFromEnum(name)) }; | |
| 2523 | return .{ .kind = .global, .raw = @intCast(@backingInt(name)) }; | |
| 2524 | 2524 | } |
| 2525 | 2525 | fn unwrap(s: Symbol.Id) union(enum) { |
| 2526 | 2526 | local: Symbol.LocalIndex, |
| 2527 | 2527 | global: String(.strtab), |
| 2528 | 2528 | } { |
| 2529 | 2529 | return switch (s.kind) { |
| 2530 | .local => .{ .local = @enumFromInt(s.raw) }, | |
| 2531 | .global => .{ .global = @enumFromInt(s.raw) }, | |
| 2530 | .local => .{ .local = @fromBackingInt(@intCast(s.raw)) }, | |
| 2531 | .global => .{ .global = @fromBackingInt(@intCast(s.raw)) }, | |
| 2532 | 2532 | }; |
| 2533 | 2533 | } |
| 2534 | 2534 | |
| 2535 | 2535 | fn toTypeErased(s: Symbol.Id) link.File.SymbolId { |
| 2536 | return @enumFromInt(@as(u32, @bitCast(s))); | |
| 2536 | return @fromBackingInt(@intCast(@as(u32, @bitCast(s)))); | |
| 2537 | 2537 | } |
| 2538 | 2538 | fn fromTypeErased(s: link.File.SymbolId) Symbol.Id { |
| 2539 | return @bitCast(@intFromEnum(s)); | |
| 2539 | return @bitCast(@backingInt(s)); | |
| 2540 | 2540 | } |
| 2541 | 2541 | |
| 2542 | 2542 | fn index(s: Symbol.Id, elf: *const Elf) Symbol.Index { |
| ... | ... | @@ -2814,7 +2814,7 @@ fn lazySymbolInner(elf: *Elf, lazy: link.File.LazySymbol) Error!link.File.Symbol |
| 2814 | 2814 | const name = std.fmt.bufPrint( |
| 2815 | 2815 | &name_buf, |
| 2816 | 2816 | "__lazy_{t}_{d}", |
| 2817 | .{ lazy.kind, @intFromEnum(lazy.ty) }, | |
| 2817 | .{ lazy.kind, @backingInt(lazy.ty) }, | |
| 2818 | 2818 | ) catch unreachable; |
| 2819 | 2819 | gop.value_ptr.* = .{ |
| 2820 | 2820 | .lsi = elf.addLocalSymbolAssumeCapacity(.{ |
| ... | ... | @@ -2829,8 +2829,8 @@ fn lazySymbolInner(elf: *Elf, lazy: link.File.LazySymbol) Error!link.File.Symbol |
| 2829 | 2829 | .first_got_reloc = .none, |
| 2830 | 2830 | }; |
| 2831 | 2831 | elf.nodes.appendAssumeCapacity(switch (lazy.kind) { |
| 2832 | .code => .{ .lazy_code = @enumFromInt(gop.index) }, | |
| 2833 | .const_data => .{ .lazy_const_data = @enumFromInt(gop.index) }, | |
| 2832 | .code => .{ .lazy_code = @fromBackingInt(@intCast(gop.index)) }, | |
| 2833 | .const_data => .{ .lazy_const_data = @fromBackingInt(@intCast(gop.index)) }, | |
| 2834 | 2834 | }); |
| 2835 | 2835 | elf.synth_prog_node.increaseEstimatedTotalItems(1); |
| 2836 | 2836 | } |
| ... | ... | @@ -2994,19 +2994,19 @@ fn String(section: StringSection) type { |
| 2994 | 2994 | |
| 2995 | 2995 | fn slice(str: @This(), elf: *Elf) [:0]const u8 { |
| 2996 | 2996 | const section_node = section.shndx(elf).get(elf).ni; |
| 2997 | const overlong = section_node.sliceConst(&elf.mf)[@intFromEnum(str)..]; | |
| 2997 | const overlong = section_node.sliceConst(&elf.mf)[@backingInt(str)..]; | |
| 2998 | 2998 | return overlong[0..std.mem.findScalar(u8, overlong, 0).? :0]; |
| 2999 | 2999 | } |
| 3000 | 3000 | }; |
| 3001 | 3001 | } |
| 3002 | 3002 | fn string(elf: *Elf, comptime section: StringSection, key: []const u8) Error!String(section) { |
| 3003 | 3003 | const st: *StringTable = &@field(elf, @tagName(section)); |
| 3004 | return @enumFromInt(try st.get(elf, section.shndx(elf), key)); | |
| 3004 | return @fromBackingInt(@intCast(try st.get(elf, section.shndx(elf), key))); | |
| 3005 | 3005 | } |
| 3006 | 3006 | /// Like `string`, but asserts that the string is already in `section`. |
| 3007 | 3007 | fn stringExisting(elf: *Elf, comptime section: StringSection, key: []const u8) String(section) { |
| 3008 | 3008 | const st: *StringTable = &@field(elf, @tagName(section)); |
| 3009 | return @enumFromInt(st.getExisting(elf, section.shndx(elf), key)); | |
| 3009 | return @fromBackingInt(@intCast(st.getExisting(elf, section.shndx(elf), key))); | |
| 3010 | 3010 | } |
| 3011 | 3011 | |
| 3012 | 3012 | const StringTable = struct { |
| ... | ... | @@ -3688,7 +3688,7 @@ fn initHeaders( |
| 3688 | 3688 | |
| 3689 | 3689 | const sh_undef: *ElfN.Shdr = @ptrCast(@alignCast(elf.ni.shdr.slice(&elf.mf))); |
| 3690 | 3690 | sh_undef.* = .{ |
| 3691 | .name = @intFromEnum(String(.shstrtab).empty), | |
| 3691 | .name = @backingInt(String(.shstrtab).empty), | |
| 3692 | 3692 | .type = .NULL, |
| 3693 | 3693 | .flags = .{ .shf = .{} }, |
| 3694 | 3694 | .addr = 0, |
| ... | ... | @@ -3716,7 +3716,7 @@ fn initHeaders( |
| 3716 | 3716 | })); |
| 3717 | 3717 | const symtab_null = @field(elf.symPtr(.null), @tagName(ct_class)); |
| 3718 | 3718 | symtab_null.* = .{ |
| 3719 | .name = @intFromEnum(String(.strtab).empty), | |
| 3719 | .name = @backingInt(String(.strtab).empty), | |
| 3720 | 3720 | .value = 0, |
| 3721 | 3721 | .size = 0, |
| 3722 | 3722 | .info = .{ .type = .NOTYPE, .bind = .LOCAL }, |
| ... | ... | @@ -3749,7 +3749,7 @@ fn initHeaders( |
| 3749 | 3749 | })); |
| 3750 | 3750 | Section.Index.get(.strtab, elf).ni.slice(&elf.mf)[0] = 0; |
| 3751 | 3751 | switch (elf.shdrPtr(.symtab)) { |
| 3752 | inline else => |shdr| elf.targetStore(&shdr.link, @intFromEnum(Section.Index.strtab)), | |
| 3752 | inline else => |shdr| elf.targetStore(&shdr.link, @backingInt(Section.Index.strtab)), | |
| 3753 | 3753 | } |
| 3754 | 3754 | |
| 3755 | 3755 | assert(.rodata == try elf.addSection(elf.ni.rodata, .{ |
| ... | ... | @@ -3872,7 +3872,7 @@ fn initHeaders( |
| 3872 | 3872 | }); |
| 3873 | 3873 | const dynsym_null = @field(elf.dynsymPtr(0), @tagName(ct_class)); |
| 3874 | 3874 | dynsym_null.* = .{ |
| 3875 | .name = @intFromEnum(String(.dynstr).empty), | |
| 3875 | .name = @backingInt(String(.dynstr).empty), | |
| 3876 | 3876 | .value = 0, |
| 3877 | 3877 | .size = 0, |
| 3878 | 3878 | .info = .{ .type = .NOTYPE, .bind = .LOCAL }, |
| ... | ... | @@ -3926,7 +3926,7 @@ fn initHeaders( |
| 3926 | 3926 | 0xff, 0x25, 0x00, 0x00, 0x00, 0x00, // jmp *0x0(%rip) |
| 3927 | 3927 | 0x0f, 0x1f, 0x40, 0x00, // nopl 0x0(%rax) |
| 3928 | 3928 | }); |
| 3929 | elf.plt_first_symbol_reloc = @enumFromInt(elf.symbol_relocs.items.len); | |
| 3929 | elf.plt_first_symbol_reloc = @fromBackingInt(@intCast(elf.symbol_relocs.items.len)); | |
| 3930 | 3930 | try elf.ensureUnusedRelocCapacity(plt_ni, 2); |
| 3931 | 3931 | try elf.addSymbolRelocAssumeCapacity( |
| 3932 | 3932 | plt_ni, |
| ... | ... | @@ -3969,7 +3969,7 @@ fn initHeaders( |
| 3969 | 3969 | 0x4c, 0x00, 0x01, 0xe0, // jr $t3 |
| 3970 | 3970 | }, |
| 3971 | 3971 | }); |
| 3972 | elf.plt_first_symbol_reloc = @enumFromInt(elf.symbol_relocs.items.len); | |
| 3972 | elf.plt_first_symbol_reloc = @fromBackingInt(@intCast(elf.symbol_relocs.items.len)); | |
| 3973 | 3973 | try elf.ensureUnusedRelocCapacity(plt_ni, 3); |
| 3974 | 3974 | elf.addRelocAssumeCapacity(plt_ni, 0, got_plt_sym, 0, .{ .LARCH = .PCALA_HI20 }) catch |err| switch (err) { |
| 3975 | 3975 | error.UnknownRelocation => unreachable, |
| ... | ... | @@ -4184,7 +4184,7 @@ fn initHeaders( |
| 4184 | 4184 | assert(elf.shdrs.items.len == shnum); |
| 4185 | 4185 | |
| 4186 | 4186 | for (0..shnum) |shndx_raw| { |
| 4187 | const shndx: Section.Index = @enumFromInt(shndx_raw); | |
| 4187 | const shndx: Section.Index = @fromBackingInt(@intCast(shndx_raw)); | |
| 4188 | 4188 | elf.section_by_name.putAssumeCapacityNoClobber(shndx.name(elf), {}); |
| 4189 | 4189 | } |
| 4190 | 4190 | |
| ... | ... | @@ -4239,7 +4239,7 @@ pub fn endProgress(elf: *Elf) void { |
| 4239 | 4239 | } |
| 4240 | 4240 | |
| 4241 | 4241 | fn getNode(elf: *const Elf, ni: MappedFile.Node.Index) Node { |
| 4242 | return elf.nodes.get(@intFromEnum(ni)); | |
| 4242 | return elf.nodes.get(@backingInt(ni)); | |
| 4243 | 4243 | } |
| 4244 | 4244 | /// Asserts that `ni` is a section, input section, copied global, NAV, UAV, or lazy code/data. |
| 4245 | 4245 | fn getNodeShndx(elf: *const Elf, ni: MappedFile.Node.Index) Section.Index { |
| ... | ... | @@ -4290,15 +4290,15 @@ fn resetNodeRelocs(elf: *Elf, ni: MappedFile.Node.Index) void { |
| 4290 | 4290 | .section => unreachable, // cannot contain relocs (.plt and .dynamic unsupported) |
| 4291 | 4291 | .copied_global => unreachable, // cannot contain relocs |
| 4292 | 4292 | .input_section => |isi| .{ |
| 4293 | &elf.input_sections.items[@intFromEnum(isi)].first_symbol_reloc, | |
| 4294 | &elf.input_sections.items[@intFromEnum(isi)].first_got_reloc, | |
| 4293 | &elf.input_sections.items[@backingInt(isi)].first_symbol_reloc, | |
| 4294 | &elf.input_sections.items[@backingInt(isi)].first_got_reloc, | |
| 4295 | 4295 | }, |
| 4296 | 4296 | .nav => |nmi| .{ |
| 4297 | &elf.navs.values()[@intFromEnum(nmi)].first_symbol_reloc, | |
| 4298 | &elf.navs.values()[@intFromEnum(nmi)].first_got_reloc, | |
| 4297 | &elf.navs.values()[@backingInt(nmi)].first_symbol_reloc, | |
| 4298 | &elf.navs.values()[@backingInt(nmi)].first_got_reloc, | |
| 4299 | 4299 | }, |
| 4300 | 4300 | .uav => |umi| .{ |
| 4301 | &elf.uavs.values()[@intFromEnum(umi)].first_symbol_reloc, | |
| 4301 | &elf.uavs.values()[@backingInt(umi)].first_symbol_reloc, | |
| 4302 | 4302 | null, |
| 4303 | 4303 | }, |
| 4304 | 4304 | inline .lazy_code, .lazy_const_data => |lmi| .{ |
| ... | ... | @@ -4309,23 +4309,23 @@ fn resetNodeRelocs(elf: *Elf, ni: MappedFile.Node.Index) void { |
| 4309 | 4309 | |
| 4310 | 4310 | if (symbol_relocs.* != .none) { |
| 4311 | 4311 | for ( |
| 4312 | elf.symbol_relocs.items[@intFromEnum(symbol_relocs.*)..], | |
| 4313 | @intFromEnum(symbol_relocs.*).., | |
| 4312 | elf.symbol_relocs.items[@backingInt(symbol_relocs.*)..], | |
| 4313 | @backingInt(symbol_relocs.*).., | |
| 4314 | 4314 | ) |*reloc, index| { |
| 4315 | 4315 | if (reloc.node != ni) break; |
| 4316 | reloc.delete(elf, @enumFromInt(index)); | |
| 4316 | reloc.delete(elf, @fromBackingInt(@intCast(index))); | |
| 4317 | 4317 | } |
| 4318 | 4318 | } |
| 4319 | symbol_relocs.* = @enumFromInt(elf.symbol_relocs.items.len); | |
| 4319 | symbol_relocs.* = @fromBackingInt(@intCast(elf.symbol_relocs.items.len)); | |
| 4320 | 4320 | |
| 4321 | 4321 | if (got_relocs) |ptr| { |
| 4322 | 4322 | if (ptr.* != .none) { |
| 4323 | for (elf.got_relocs.items[@intFromEnum(ptr.*)..]) |*reloc| { | |
| 4323 | for (elf.got_relocs.items[@backingInt(ptr.*)..]) |*reloc| { | |
| 4324 | 4324 | if (reloc.node != ni) break; |
| 4325 | 4325 | reloc.delete(elf); |
| 4326 | 4326 | } |
| 4327 | 4327 | } |
| 4328 | ptr.* = @enumFromInt(elf.got_relocs.items.len); | |
| 4328 | ptr.* = @fromBackingInt(@intCast(elf.got_relocs.items.len)); | |
| 4329 | 4329 | } |
| 4330 | 4330 | } |
| 4331 | 4331 | |
| ... | ... | @@ -4339,7 +4339,7 @@ fn flushMovedNodeRelocs( |
| 4339 | 4339 | first_got_reloc: GotReloc.Index, |
| 4340 | 4340 | ) void { |
| 4341 | 4341 | if (first_symbol_reloc != .none) { |
| 4342 | for (elf.symbol_relocs.items[@intFromEnum(first_symbol_reloc)..]) |*reloc| { | |
| 4342 | for (elf.symbol_relocs.items[@backingInt(first_symbol_reloc)..]) |*reloc| { | |
| 4343 | 4343 | if (reloc.node != node) break; |
| 4344 | 4344 | if (reloc.rela_index.unwrap()) |rela_index| { |
| 4345 | 4345 | // The node has moved, so the offset of the relocation within the section might have |
| ... | ... | @@ -4351,7 +4351,7 @@ fn flushMovedNodeRelocs( |
| 4351 | 4351 | } |
| 4352 | 4352 | |
| 4353 | 4353 | if (first_got_reloc != .none) { |
| 4354 | for (elf.got_relocs.items[@intFromEnum(first_got_reloc)..]) |*reloc| { | |
| 4354 | for (elf.got_relocs.items[@backingInt(first_got_reloc)..]) |*reloc| { | |
| 4355 | 4355 | if (reloc.node != node) break; |
| 4356 | 4356 | reloc.apply(elf); |
| 4357 | 4357 | } |
| ... | ... | @@ -4359,33 +4359,33 @@ fn flushMovedNodeRelocs( |
| 4359 | 4359 | } |
| 4360 | 4360 | |
| 4361 | 4361 | fn identClass(elf: *const Elf) std.elf.CLASS { |
| 4362 | return @enumFromInt(elf.mf.memory_map.memory[std.elf.EI.CLASS]); | |
| 4362 | return @fromBackingInt(@intCast(elf.mf.memory_map.memory[std.elf.EI.CLASS])); | |
| 4363 | 4363 | } |
| 4364 | 4364 | |
| 4365 | 4365 | /// Like `std.elf.ET`, but only includes the ELF machine architectures we support, so that we can |
| 4366 | 4366 | /// use exhaustive `switch` statements in the linker implementation. |
| 4367 | 4367 | const EhdrMachine = enum(u16) { |
| 4368 | AARCH64 = @intFromEnum(std.elf.EM.AARCH64), | |
| 4369 | LOONGARCH = @intFromEnum(std.elf.EM.LOONGARCH), | |
| 4370 | PPC64 = @intFromEnum(std.elf.EM.PPC64), | |
| 4371 | RISCV = @intFromEnum(std.elf.EM.RISCV), | |
| 4372 | SPARCV9 = @intFromEnum(std.elf.EM.SPARCV9), | |
| 4373 | X86_64 = @intFromEnum(std.elf.EM.X86_64), | |
| 4368 | AARCH64 = @backingInt(std.elf.EM.AARCH64), | |
| 4369 | LOONGARCH = @backingInt(std.elf.EM.LOONGARCH), | |
| 4370 | PPC64 = @backingInt(std.elf.EM.PPC64), | |
| 4371 | RISCV = @backingInt(std.elf.EM.RISCV), | |
| 4372 | SPARCV9 = @backingInt(std.elf.EM.SPARCV9), | |
| 4373 | X86_64 = @backingInt(std.elf.EM.X86_64), | |
| 4374 | 4374 | |
| 4375 | 4375 | fn toElf(m: EhdrMachine) std.elf.EM { |
| 4376 | 4376 | return @bitCast(m); |
| 4377 | 4377 | } |
| 4378 | 4378 | /// Returns `null` if `m` is not a supported ELF machine architecture. |
| 4379 | 4379 | fn fromElf(m: std.elf.EM) ?EhdrMachine { |
| 4380 | return std.enums.fromInt(EhdrMachine, @intFromEnum(m)); | |
| 4380 | return std.enums.fromInt(EhdrMachine, @backingInt(m)); | |
| 4381 | 4381 | } |
| 4382 | 4382 | }; |
| 4383 | 4383 | /// Like `std.elf.ET`, but only includes the types of ELF file we can produce, so that we can use |
| 4384 | 4384 | /// exhaustive `switch` statements in the linker implementation. |
| 4385 | 4385 | const EhdrType = enum(u16) { |
| 4386 | REL = @intFromEnum(std.elf.ET.REL), | |
| 4387 | EXEC = @intFromEnum(std.elf.ET.EXEC), | |
| 4388 | DYN = @intFromEnum(std.elf.ET.DYN), | |
| 4386 | REL = @backingInt(std.elf.ET.REL), | |
| 4387 | EXEC = @backingInt(std.elf.ET.EXEC), | |
| 4388 | DYN = @backingInt(std.elf.ET.DYN), | |
| 4389 | 4389 | fn toElf(t: EhdrType) std.elf.ET { |
| 4390 | 4390 | return @bitCast(t); |
| 4391 | 4391 | } |
| ... | ... | @@ -4415,7 +4415,7 @@ fn targetPtrSize(elf: *const Elf) u8 { |
| 4415 | 4415 | return elf.identClass().size(); |
| 4416 | 4416 | } |
| 4417 | 4417 | fn targetEndian(elf: *const Elf) std.lang.Endian { |
| 4418 | const ident_data: std.elf.DATA = @enumFromInt(elf.mf.memory_map.memory[std.elf.EI.DATA]); | |
| 4418 | const ident_data: std.elf.DATA = @fromBackingInt(@intCast(elf.mf.memory_map.memory[std.elf.EI.DATA])); | |
| 4419 | 4419 | return ident_data.endian(); |
| 4420 | 4420 | } |
| 4421 | 4421 | fn targetTlsVariant(elf: *const Elf) union(enum) { |
| ... | ... | @@ -4487,7 +4487,7 @@ fn targetLoad(elf: *const Elf, ptr: anytype) @typeInfo(@TypeOf(ptr)).pointer.chi |
| 4487 | 4487 | return switch (@typeInfo(Child)) { |
| 4488 | 4488 | else => @compileError(@typeName(Child)), |
| 4489 | 4489 | .int => std.mem.toNative(Child, ptr.*, elf.targetEndian()), |
| 4490 | .@"enum" => |@"enum"| @enumFromInt(elf.targetLoad(@as(*align(alignment) const @"enum".tag_type, @ptrCast(ptr)))), | |
| 4490 | .@"enum" => |@"enum"| @fromBackingInt(@intCast(elf.targetLoad(@as(*align(alignment) const @"enum".tag_type, @ptrCast(ptr))))), | |
| 4491 | 4491 | .@"struct" => |@"struct"| @bitCast( |
| 4492 | 4492 | elf.targetLoad(@as(*align(alignment) @"struct".backing_integer.?, @ptrCast(ptr))), |
| 4493 | 4493 | ), |
| ... | ... | @@ -4502,7 +4502,7 @@ fn targetStore(elf: *const Elf, ptr: anytype, val: @typeInfo(@TypeOf(ptr)).point |
| 4502 | 4502 | .int => ptr.* = std.mem.nativeTo(Child, val, elf.targetEndian()), |
| 4503 | 4503 | .@"enum" => |@"enum"| elf.targetStore( |
| 4504 | 4504 | @as(*align(alignment) @"enum".tag_type, @ptrCast(ptr)), |
| 4505 | @intFromEnum(val), | |
| 4505 | @backingInt(val), | |
| 4506 | 4506 | ), |
| 4507 | 4507 | .@"struct" => |@"struct"| elf.targetStore( |
| 4508 | 4508 | @as(*align(alignment) @"struct".backing_integer.?, @ptrCast(ptr)), |
| ... | ... | @@ -4557,7 +4557,7 @@ fn shdrPtr(elf: *Elf, shndx: Section.Index) ShdrPtr { |
| 4557 | 4557 | .NONE, _ => unreachable, |
| 4558 | 4558 | inline else => |class| { |
| 4559 | 4559 | const shdr_slice: []class.ElfN().Shdr = @ptrCast(@alignCast(raw_slice)); |
| 4560 | const shdr_ptr = &shdr_slice[@intFromEnum(shndx)]; | |
| 4560 | const shdr_ptr = &shdr_slice[@backingInt(shndx)]; | |
| 4561 | 4561 | return @unionInit(ShdrPtr, @tagName(class), shdr_ptr); |
| 4562 | 4562 | }, |
| 4563 | 4563 | } |
| ... | ... | @@ -4574,7 +4574,7 @@ fn symPtr(elf: *Elf, index: Symbol.Index) SymPtr { |
| 4574 | 4574 | inline else => |shdr, class| { |
| 4575 | 4575 | const size = elf.targetLoad(&shdr.size); |
| 4576 | 4576 | const slice: []class.ElfN().Sym = @ptrCast(@alignCast(raw_slice[0..@intCast(size)])); |
| 4577 | return @unionInit(SymPtr, @tagName(class), &slice[@intFromEnum(index)]); | |
| 4577 | return @unionInit(SymPtr, @tagName(class), &slice[@backingInt(index)]); | |
| 4578 | 4578 | }, |
| 4579 | 4579 | } |
| 4580 | 4580 | } |
| ... | ... | @@ -4653,7 +4653,7 @@ fn mapInputSection(elf: *Elf, opts: struct { |
| 4653 | 4653 | const name_shstrtab = try elf.string(.shstrtab, name); |
| 4654 | 4654 | const gop = try elf.section_by_name.getOrPut(gpa, name_shstrtab); |
| 4655 | 4655 | if (gop.found_existing) { |
| 4656 | break :existing @enumFromInt(gop.index); | |
| 4656 | break :existing @fromBackingInt(@intCast(gop.index)); | |
| 4657 | 4657 | } |
| 4658 | 4658 | errdefer assert(elf.section_by_name.pop().?.key == name_shstrtab); |
| 4659 | 4659 | const parent_node: MappedFile.Node.Index = parent: { |
| ... | ... | @@ -4736,7 +4736,7 @@ fn navMapIndex(elf: *Elf, zcu: *Zcu, nav_index: InternPool.Nav.Index) Error!Node |
| 4736 | 4736 | try elf.navs.ensureUnusedCapacity(gpa, 1); |
| 4737 | 4737 | |
| 4738 | 4738 | const nav_gop = elf.navs.getOrPutAssumeCapacity(nav_index); |
| 4739 | const nmi: Node.NavMapIndex = @enumFromInt(nav_gop.index); | |
| 4739 | const nmi: Node.NavMapIndex = @fromBackingInt(@intCast(nav_gop.index)); | |
| 4740 | 4740 | if (!nav_gop.found_existing) { |
| 4741 | 4741 | const shndx: Section.Index = section: { |
| 4742 | 4742 | if (nav.resolved.?.@"linksection".toSlice(ip)) |@"linksection"| { |
| ... | ... | @@ -4835,7 +4835,7 @@ fn uavMapIndex( |
| 4835 | 4835 | }; |
| 4836 | 4836 | |
| 4837 | 4837 | const uav_gop = elf.uavs.getOrPutAssumeCapacity(uav_val); |
| 4838 | const umi: Node.UavMapIndex = @enumFromInt(uav_gop.index); | |
| 4838 | const umi: Node.UavMapIndex = @fromBackingInt(@intCast(uav_gop.index)); | |
| 4839 | 4839 | if (!uav_gop.found_existing) { |
| 4840 | 4840 | const shndx: Section.Index = .data_rel_ro; // TODO: it would be better to use `.rodata` if the UAV value doesn't have relocs |
| 4841 | 4841 | const node = try elf.mf.addLastChildNode(gpa, shndx.get(elf).ni, .{ |
| ... | ... | @@ -4846,7 +4846,7 @@ fn uavMapIndex( |
| 4846 | 4846 | const name = std.fmt.bufPrint( |
| 4847 | 4847 | &name_buf, |
| 4848 | 4848 | "__anon_{d}", |
| 4849 | .{@intFromEnum(uav_val)}, | |
| 4849 | .{@backingInt(uav_val)}, | |
| 4850 | 4850 | ) catch unreachable; |
| 4851 | 4851 | uav_gop.value_ptr.* = .{ |
| 4852 | 4852 | .lsi = elf.addLocalSymbolAssumeCapacity(.{ |
| ... | ... | @@ -5061,7 +5061,7 @@ fn loadObject( |
| 5061 | 5061 | const diags = &comp.link_diags; |
| 5062 | 5062 | const r = &fr.interface; |
| 5063 | 5063 | |
| 5064 | const input_index: Node.InputIndex = @enumFromInt(elf.inputs.items.len); | |
| 5064 | const input_index: Node.InputIndex = @fromBackingInt(@intCast(elf.inputs.items.len)); | |
| 5065 | 5065 | log.debug("loadObject({f}{f})", .{ path.fmtEscapeString(), fmtMemberString(member) }); |
| 5066 | 5066 | elf.checkInputIdent(path, r) catch |err| switch (err) { |
| 5067 | 5067 | else => |e| return e, |
| ... | ... | @@ -5251,9 +5251,9 @@ fn loadObject( |
| 5251 | 5251 | .fixed = opts.node_fixed, |
| 5252 | 5252 | }); |
| 5253 | 5253 | elf.nodes.appendAssumeCapacity(.{ |
| 5254 | .input_section = @enumFromInt(elf.input_sections.items.len), | |
| 5254 | .input_section = @fromBackingInt(@intCast(elf.input_sections.items.len)), | |
| 5255 | 5255 | }); |
| 5256 | section.isi = @enumFromInt(elf.input_sections.items.len); | |
| 5256 | section.isi = @fromBackingInt(@intCast(elf.input_sections.items.len)); | |
| 5257 | 5257 | elf.input_sections.addOneAssumeCapacity().* = .{ |
| 5258 | 5258 | .input = input_index, |
| 5259 | 5259 | .file_location = .{ |
| ... | ... | @@ -5598,7 +5598,7 @@ fn loadDso(elf: *Elf, path: std.Build.Cache.Path, fr: *Io.File.Reader) (LoadPars |
| 5598 | 5598 | // insane---refer to the doc comment on `alignment` in `Elf.dso_globals`. |
| 5599 | 5599 | const sym_align: std.mem.Alignment = switch (sym.value) { |
| 5600 | 5600 | 0 => section_aligns[sym.shndx], |
| 5601 | else => section_aligns[sym.shndx].min(@enumFromInt(@ctz(sym.value))), | |
| 5601 | else => section_aligns[sym.shndx].min(@fromBackingInt(@intCast(@ctz(sym.value)))), | |
| 5602 | 5602 | }; |
| 5603 | 5603 | |
| 5604 | 5604 | const name = try elf.string(.strtab, std.mem.sliceTo(dynstr[sym.name..], 0)); |
| ... | ... | @@ -5900,16 +5900,16 @@ fn flushDynamic(elf: *Elf) void { |
| 5900 | 5900 | dynamic_entries[dynamic_index..][0..elf.needed.count()], |
| 5901 | 5901 | elf.needed.keys(), |
| 5902 | 5902 | ) |*dynamic_entry, needed| { |
| 5903 | dynamic_entry.* = .{ std.elf.DT_NEEDED, @intFromEnum(needed) }; | |
| 5903 | dynamic_entry.* = .{ std.elf.DT_NEEDED, @backingInt(needed) }; | |
| 5904 | 5904 | } |
| 5905 | 5905 | dynamic_index += elf.needed.count(); |
| 5906 | 5906 | |
| 5907 | 5907 | if (elf.dynamic.soname != .empty) { |
| 5908 | dynamic_entries[dynamic_index] = .{ std.elf.DT_SONAME, @intFromEnum(elf.dynamic.soname) }; | |
| 5908 | dynamic_entries[dynamic_index] = .{ std.elf.DT_SONAME, @backingInt(elf.dynamic.soname) }; | |
| 5909 | 5909 | dynamic_index += 1; |
| 5910 | 5910 | } |
| 5911 | 5911 | if (elf.dynamic.rpath != .empty) { |
| 5912 | dynamic_entries[dynamic_index] = .{ std.elf.DT_RUNPATH, @intFromEnum(elf.dynamic.rpath) }; | |
| 5912 | dynamic_entries[dynamic_index] = .{ std.elf.DT_RUNPATH, @backingInt(elf.dynamic.rpath) }; | |
| 5913 | 5913 | dynamic_index += 1; |
| 5914 | 5914 | } |
| 5915 | 5915 | if (elf.dynamic.flags != 0) { |
| ... | ... | @@ -6033,8 +6033,8 @@ fn addSection(elf: *Elf, segment_ni: MappedFile.Node.Index, opts: struct { |
| 6033 | 6033 | break :alloc_shndx .{ shndx, shnum }; |
| 6034 | 6034 | }, |
| 6035 | 6035 | }; |
| 6036 | assert(shndx < @intFromEnum(Section.Index.LORESERVE)); | |
| 6037 | break :shndx .{ @enumFromInt(shndx), @as(u64, elf.targetLoad(&ehdr.shentsize)) * @as(u64, shnum) }; | |
| 6036 | assert(shndx < @backingInt(Section.Index.LORESERVE)); | |
| 6037 | break :shndx .{ @fromBackingInt(@intCast(shndx)), @as(u64, elf.targetLoad(&ehdr.shentsize)) * @as(u64, shnum) }; | |
| 6038 | 6038 | }, |
| 6039 | 6039 | }; |
| 6040 | 6040 | try elf.ensureNodeSize(elf.ni.shdr, new_shdr_size); |
| ... | ... | @@ -6066,7 +6066,7 @@ fn addSection(elf: *Elf, segment_ni: MappedFile.Node.Index, opts: struct { |
| 6066 | 6066 | switch (elf.shdrPtr(shndx)) { |
| 6067 | 6067 | inline else => |shdr, class| { |
| 6068 | 6068 | shdr.* = .{ |
| 6069 | .name = @intFromEnum(shstrtab_entry), | |
| 6069 | .name = @backingInt(shstrtab_entry), | |
| 6070 | 6070 | .type = opts.type, |
| 6071 | 6071 | .flags = .{ .shf = opts.flags }, |
| 6072 | 6072 | .addr = @intCast(addr), |
| ... | ... | @@ -6105,7 +6105,7 @@ fn ensureUnusedRelocCapacity(elf: *Elf, node: MappedFile.Node.Index, len: usize) |
| 6105 | 6105 | const rela_shndx = try elf.addSection(.none, .{ |
| 6106 | 6106 | .name = rela_name, |
| 6107 | 6107 | .type = .RELA, |
| 6108 | .link = @intFromEnum(Section.Index.symtab), | |
| 6108 | .link = @backingInt(Section.Index.symtab), | |
| 6109 | 6109 | .info = shndx.toSection().?, |
| 6110 | 6110 | .addralign = switch (class) { |
| 6111 | 6111 | .NONE, _ => unreachable, |
| ... | ... | @@ -6160,10 +6160,10 @@ fn addRelocAssumeCapacity( |
| 6160 | 6160 | // the section offset now, but there's no point, because `flushMovedNodeRelocs` will |
| 6161 | 6161 | // eventually do it for us anyway, so just init to 0. |
| 6162 | 6162 | .offset = 0, |
| 6163 | .raw_sym_index = @intFromEnum(target.index(elf)), | |
| 6163 | .raw_sym_index = @backingInt(target.index(elf)), | |
| 6164 | 6164 | .addend = addend, |
| 6165 | 6165 | }); |
| 6166 | const ri: SymbolReloc.Index = @enumFromInt(elf.symbol_relocs.items.len); | |
| 6166 | const ri: SymbolReloc.Index = @fromBackingInt(@intCast(elf.symbol_relocs.items.len)); | |
| 6167 | 6167 | const next: SymbolReloc.Index = next: { |
| 6168 | 6168 | const target_ptr = target.index(elf).ptr(elf); |
| 6169 | 6169 | const next = target_ptr.first_target_reloc; |
| ... | ... | @@ -6621,7 +6621,7 @@ fn addSymbolRelocAssumeCapacity( |
| 6621 | 6621 | } |
| 6622 | 6622 | }; |
| 6623 | 6623 | |
| 6624 | const ri: SymbolReloc.Index = @enumFromInt(elf.symbol_relocs.items.len); | |
| 6624 | const ri: SymbolReloc.Index = @fromBackingInt(@intCast(elf.symbol_relocs.items.len)); | |
| 6625 | 6625 | const target_ptr = target.index(elf).ptr(elf); |
| 6626 | 6626 | const next = target_ptr.first_target_reloc; |
| 6627 | 6627 | target_ptr.first_target_reloc = ri; |
| ... | ... | @@ -7125,7 +7125,7 @@ pub fn idle(elf: *Elf, tid: Zcu.PerThread.Id) link.Error!bool { |
| 7125 | 7125 | |
| 7126 | 7126 | task: { |
| 7127 | 7127 | if (elf.input_section_pending_index < elf.input_sections.items.len) { |
| 7128 | const isi: InputSection.Index = @enumFromInt(elf.input_section_pending_index); | |
| 7128 | const isi: InputSection.Index = @fromBackingInt(@intCast(elf.input_section_pending_index)); | |
| 7129 | 7129 | elf.input_section_pending_index += 1; |
| 7130 | 7130 | const sub_prog_node = elf.idleProgNode(tid, elf.input_prog_node, elf.getNode(isi.node(elf))); |
| 7131 | 7131 | defer sub_prog_node.end(); |
| ... | ... | @@ -7148,7 +7148,7 @@ pub fn idle(elf: *Elf, tid: Zcu.PerThread.Id) link.Error!bool { |
| 7148 | 7148 | .REL => { |
| 7149 | 7149 | // Index in `.symtab` has changed. Relocatables are easy, we just need to update |
| 7150 | 7150 | // all of the output relocations. |
| 7151 | const symtab_index = @intFromEnum(global.symtab_index); | |
| 7151 | const symtab_index = @backingInt(global.symtab_index); | |
| 7152 | 7152 | var ri = sym.first_target_reloc; |
| 7153 | 7153 | while (ri != .none) { |
| 7154 | 7154 | const reloc = ri.get(elf); |
| ... | ... | @@ -7190,7 +7190,7 @@ pub fn idle(elf: *Elf, tid: Zcu.PerThread.Id) link.Error!bool { |
| 7190 | 7190 | // Update the PLT entry's reloc if there is one: |
| 7191 | 7191 | if (elf.plt.getIndex(global_name)) |plt_index| { |
| 7192 | 7192 | // PLT indices exactly match `.rela.plt` relocation indices. |
| 7193 | elf.shndx.rela_plt.relaUpdateSym(elf, @enumFromInt(plt_index), global.dynsym_index); | |
| 7193 | elf.shndx.rela_plt.relaUpdateSym(elf, @fromBackingInt(@intCast(plt_index)), global.dynsym_index); | |
| 7194 | 7194 | } |
| 7195 | 7195 | |
| 7196 | 7196 | // Update relocs for any relevant GOT entries: |
| ... | ... | @@ -7526,7 +7526,7 @@ fn flushMoved(elf: *Elf, ni: MappedFile.Node.Index) std.mem.Allocator.Error!void |
| 7526 | 7526 | // Update local symbols |
| 7527 | 7527 | const ii = isi.input(elf); |
| 7528 | 7528 | var lsi, const end_lsi = ii.localSymbolRange(elf); |
| 7529 | while (lsi != end_lsi) : (lsi = @enumFromInt(@intFromEnum(lsi) + 1)) { | |
| 7529 | while (lsi != end_lsi) : (lsi = @fromBackingInt(@intCast(@backingInt(lsi) + 1))) { | |
| 7530 | 7530 | if (lsi.index().ptr(elf).node != ni) continue; |
| 7531 | 7531 | const visibility: std.elf.STV = switch (elf.symPtr(lsi.index())) { |
| 7532 | 7532 | inline else => |sym| elf.targetLoad(&sym.other).visibility, |
| ... | ... | @@ -7672,7 +7672,7 @@ fn flushResized(elf: *Elf, ni: MappedFile.Node.Index) std.mem.Allocator.Error!vo |
| 7672 | 7672 | std.mem.swap(@TypeOf(ph.*), &phdr[new_phndx], next_ph); |
| 7673 | 7673 | const next_ni = elf.phdrs.items[next_phndx]; |
| 7674 | 7674 | elf.phdrs.items[new_phndx] = next_ni; |
| 7675 | elf.nodes.items(.data)[@intFromEnum(next_ni)] = .{ .segment = new_phndx }; | |
| 7675 | elf.nodes.items(.data)[@backingInt(next_ni)] = .{ .segment = new_phndx }; | |
| 7676 | 7676 | new_phndx = @intCast(next_phndx); |
| 7677 | 7677 | } |
| 7678 | 7678 | if (new_phndx != phndx) { |
| ... | ... | @@ -7680,7 +7680,7 @@ fn flushResized(elf: *Elf, ni: MappedFile.Node.Index) std.mem.Allocator.Error!vo |
| 7680 | 7680 | elf.targetStore(&new_ph.vaddr, vaddr); |
| 7681 | 7681 | new_ph.paddr = new_ph.vaddr; |
| 7682 | 7682 | elf.phdrs.items[new_phndx] = ni; |
| 7683 | elf.nodes.items(.data)[@intFromEnum(ni)] = .{ .segment = new_phndx }; | |
| 7683 | elf.nodes.items(.data)[@backingInt(ni)] = .{ .segment = new_phndx }; | |
| 7684 | 7684 | try ni.childrenMoved(elf.base.comp.gpa, &elf.mf); |
| 7685 | 7685 | } |
| 7686 | 7686 | } |
| ... | ... | @@ -7736,7 +7736,7 @@ fn addPltEntry(elf: *Elf, global_name: String(.strtab), dynsym_index: u32) void |
| 7736 | 7736 | |
| 7737 | 7737 | // We use the existing free-list tracking of the `.rela.plt` section to also behave as a |
| 7738 | 7738 | // free-list for the PLT itself---see `pltEntryIsDead` for details. |
| 7739 | const plt_index: u32 = @intFromEnum(elf.shndx.rela_plt.relaAddOneAssumeCapacity(elf, .{ | |
| 7739 | const plt_index: u32 = @backingInt(elf.shndx.rela_plt.relaAddOneAssumeCapacity(elf, .{ | |
| 7740 | 7740 | .type = .jumpSlot(elf), |
| 7741 | 7741 | .offset = 0, // populated later |
| 7742 | 7742 | .raw_sym_index = dynsym_index, |
| ... | ... | @@ -7756,7 +7756,7 @@ fn addPltEntry(elf: *Elf, global_name: String(.strtab), dynsym_index: u32) void |
| 7756 | 7756 | }; |
| 7757 | 7757 | |
| 7758 | 7758 | // Now that we know the index, we can set the relocation's offset. |
| 7759 | elf.shndx.rela_plt.relaSetOffset(elf, @enumFromInt(plt_index), got_plt_section.vaddr(elf) + got_plt_offset); | |
| 7759 | elf.shndx.rela_plt.relaSetOffset(elf, @fromBackingInt(@intCast(plt_index)), got_plt_section.vaddr(elf) + got_plt_offset); | |
| 7760 | 7760 | |
| 7761 | 7761 | if (plt_index < elf.plt.count()) { |
| 7762 | 7762 | // We reused a free entry, so we're already done! |
| ... | ... | @@ -7951,7 +7951,7 @@ fn flushMovedPltSection(elf: *Elf, which: enum { plt, plt_sec, got_plt }, old_ad |
| 7951 | 7951 | const rela_plt_shndx = elf.shndx.rela_plt; |
| 7952 | 7952 | for (0..elf.plt.count()) |plt_index| { |
| 7953 | 7953 | if (elf.pltEntryIsDead(plt_index)) continue; |
| 7954 | rela_plt_shndx.relaAdjustOffset(elf, @enumFromInt(plt_index), old_addr, addr); | |
| 7954 | rela_plt_shndx.relaAdjustOffset(elf, @fromBackingInt(@intCast(plt_index)), old_addr, addr); | |
| 7955 | 7955 | } |
| 7956 | 7956 | // We also need to update all of the references from `.plt.sec` to `.got.plt`. |
| 7957 | 7957 | // However, if there's also a flush pending for `.plt.sec`, don't bother doing |
| ... | ... | @@ -8002,7 +8002,7 @@ fn flushMovedPltSection(elf: *Elf, which: enum { plt, plt_sec, got_plt }, old_ad |
| 8002 | 8002 | const rela_plt_shndx = elf.shndx.rela_plt; |
| 8003 | 8003 | for (0..elf.plt.count()) |plt_index| { |
| 8004 | 8004 | if (elf.pltEntryIsDead(plt_index)) continue; |
| 8005 | rela_plt_shndx.relaAdjustOffset(elf, @enumFromInt(plt_index), old_addr, addr); | |
| 8005 | rela_plt_shndx.relaAdjustOffset(elf, @fromBackingInt(@intCast(plt_index)), old_addr, addr); | |
| 8006 | 8006 | } |
| 8007 | 8007 | // We also need to update all of the references from `.plt` to `.got.plt`. |
| 8008 | 8008 | // However, if there's also a flush pending for `.plt`, don't bother doing |
| ... | ... | @@ -8052,7 +8052,7 @@ fn flushMovedPltSection(elf: *Elf, which: enum { plt, plt_sec, got_plt }, old_ad |
| 8052 | 8052 | const rela_plt_shndx = elf.shndx.rela_plt; |
| 8053 | 8053 | for (0..elf.plt.count()) |plt_index| { |
| 8054 | 8054 | if (elf.pltEntryIsDead(plt_index)) continue; |
| 8055 | rela_plt_shndx.relaAdjustOffset(elf, @enumFromInt(plt_index), old_addr, addr); | |
| 8055 | rela_plt_shndx.relaAdjustOffset(elf, @fromBackingInt(@intCast(plt_index)), old_addr, addr); | |
| 8056 | 8056 | } |
| 8057 | 8057 | }, |
| 8058 | 8058 | .plt_sec, .got_plt => unreachable, |
| ... | ... | @@ -8225,10 +8225,10 @@ pub fn printNode( |
| 8225 | 8225 | }), |
| 8226 | 8226 | } |
| 8227 | 8227 | { |
| 8228 | const mf_node = &elf.mf.nodes.items[@intFromEnum(ni)]; | |
| 8228 | const mf_node = &elf.mf.nodes.items[@backingInt(ni)]; | |
| 8229 | 8229 | const off, const size = mf_node.location().resolve(&elf.mf); |
| 8230 | 8230 | try w.print(" index={d} offset=0x{x} size=0x{x} align=0x{x}{s}{s}{s}{s}\n", .{ |
| 8231 | @intFromEnum(ni), | |
| 8231 | @backingInt(ni), | |
| 8232 | 8232 | off, |
| 8233 | 8233 | size, |
| 8234 | 8234 | mf_node.flags.alignment.toByteUnits(), |
src/link/MachO.zig+4-4| ... | ... | @@ -4676,7 +4676,7 @@ pub const MachTask = extern struct { |
| 4676 | 4676 | var out_port: std.c.mach_port_name_t = undefined; |
| 4677 | 4677 | switch (getKernError(std.c.mach_port_allocate( |
| 4678 | 4678 | self.port, |
| 4679 | @intFromEnum(right), | |
| 4679 | @backingInt(right), | |
| 4680 | 4680 | &out_port, |
| 4681 | 4681 | ))) { |
| 4682 | 4682 | .SUCCESS => return .{ .port = out_port }, |
| ... | ... | @@ -4694,7 +4694,7 @@ pub const MachTask = extern struct { |
| 4694 | 4694 | self.port, |
| 4695 | 4695 | port.port, |
| 4696 | 4696 | port.port, |
| 4697 | @intFromEnum(msg), | |
| 4697 | @backingInt(msg), | |
| 4698 | 4698 | ))) { |
| 4699 | 4699 | .SUCCESS => return, |
| 4700 | 4700 | .FAILURE => return error.PermissionDenied, |
| ... | ... | @@ -5119,12 +5119,12 @@ pub fn machTaskForSelf() MachTask { |
| 5119 | 5119 | } |
| 5120 | 5120 | |
| 5121 | 5121 | pub fn getKernError(err: std.c.kern_return_t) KernE { |
| 5122 | return @as(KernE, @enumFromInt(@as(u32, @truncate(@as(usize, @intCast(err)))))); | |
| 5122 | return @as(KernE, @fromBackingInt(@intCast(@as(u32, @truncate(@as(usize, @intCast(err))))))); | |
| 5123 | 5123 | } |
| 5124 | 5124 | |
| 5125 | 5125 | pub fn unexpectedKernError(err: KernE) std.posix.UnexpectedError { |
| 5126 | 5126 | if (std.options.unexpected_error_tracing) { |
| 5127 | std.debug.print("unexpected error: {d}\n", .{@intFromEnum(err)}); | |
| 5127 | std.debug.print("unexpected error: {d}\n", .{@backingInt(err)}); | |
| 5128 | 5128 | std.debug.dumpCurrentStackTrace(.{}); |
| 5129 | 5129 | } |
| 5130 | 5130 | return error.Unexpected; |
src/link/MachO/Atom.zig+5-5| ... | ... | @@ -797,8 +797,8 @@ fn resolveRelocInner( |
| 797 | 797 | .data_processing_immediate => aarch64.writeAddImmInst(@truncate(target), inst_code), |
| 798 | 798 | .load_store => |load_store| { |
| 799 | 799 | inst.load_store.register_unsigned_immediate.group.imm12 = switch (load_store.register_unsigned_immediate.decode()) { |
| 800 | .integer => |integer| try divExact(self, rel, @truncate(target), @as(u4, 1) << @intFromEnum(integer.group.size), macho_file), | |
| 801 | .vector => |vector| try divExact(self, rel, @truncate(target), @as(u5, 1) << @intFromEnum(vector.group.opc1.decode(vector.group.size)), macho_file), | |
| 800 | .integer => |integer| try divExact(self, rel, @truncate(target), @as(u4, 1) << @backingInt(integer.group.size), macho_file), | |
| 801 | .vector => |vector| try divExact(self, rel, @truncate(target), @as(u5, 1) << @backingInt(vector.group.opc1.decode(vector.group.size)), macho_file), | |
| 802 | 802 | }; |
| 803 | 803 | try writer.writeInt(u32, @bitCast(inst), .little); |
| 804 | 804 | }, |
| ... | ... | @@ -990,7 +990,7 @@ pub fn writeRelocs(self: Atom, macho_file: *MachO, code: []u8, buffer: []macho.r |
| 990 | 990 | .r_pcrel = 0, |
| 991 | 991 | .r_length = 2, |
| 992 | 992 | .r_extern = 0, |
| 993 | .r_type = @intFromEnum(macho.reloc_type_arm64.ARM64_RELOC_ADDEND), | |
| 993 | .r_type = @backingInt(macho.reloc_type_arm64.ARM64_RELOC_ADDEND), | |
| 994 | 994 | }; |
| 995 | 995 | i += 1; |
| 996 | 996 | } |
| ... | ... | @@ -1021,7 +1021,7 @@ pub fn writeRelocs(self: Atom, macho_file: *MachO, code: []u8, buffer: []macho.r |
| 1021 | 1021 | .r_pcrel = @intFromBool(rel.meta.pcrel), |
| 1022 | 1022 | .r_extern = @intFromBool(r_extern), |
| 1023 | 1023 | .r_length = rel.meta.length, |
| 1024 | .r_type = @intFromEnum(r_type), | |
| 1024 | .r_type = @backingInt(r_type), | |
| 1025 | 1025 | }; |
| 1026 | 1026 | }, |
| 1027 | 1027 | .x86_64 => { |
| ... | ... | @@ -1064,7 +1064,7 @@ pub fn writeRelocs(self: Atom, macho_file: *MachO, code: []u8, buffer: []macho.r |
| 1064 | 1064 | .r_pcrel = @intFromBool(rel.meta.pcrel), |
| 1065 | 1065 | .r_extern = @intFromBool(r_extern), |
| 1066 | 1066 | .r_length = rel.meta.length, |
| 1067 | .r_type = @intFromEnum(r_type), | |
| 1067 | .r_type = @backingInt(r_type), | |
| 1068 | 1068 | }; |
| 1069 | 1069 | }, |
| 1070 | 1070 | else => unreachable, |
src/link/MachO/Object.zig+11-11| ... | ... | @@ -979,7 +979,7 @@ fn initSymbolStabs(self: *Object, allocator: Allocator, nlists: anytype, macho_f |
| 979 | 979 | const open = syms[i]; |
| 980 | 980 | if (open.n_type.stab != .so) { |
| 981 | 981 | try macho_file.reportParseError2(self.index, "unexpected symbol stab type 0x{x} as the first entry", .{ |
| 982 | @intFromEnum(open.n_type.stab), | |
| 982 | @backingInt(open.n_type.stab), | |
| 983 | 983 | }); |
| 984 | 984 | return error.MalformedObject; |
| 985 | 985 | } |
| ... | ... | @@ -1009,7 +1009,7 @@ fn initSymbolStabs(self: *Object, allocator: Allocator, nlists: anytype, macho_f |
| 1009 | 1009 | stab.index = sym_lookup.find(nlist.n_value); |
| 1010 | 1010 | }, |
| 1011 | 1011 | _ => { |
| 1012 | try macho_file.reportParseError2(self.index, "unhandled symbol stab type 0x{x}", .{@intFromEnum(nlist.n_type.stab)}); | |
| 1012 | try macho_file.reportParseError2(self.index, "unhandled symbol stab type 0x{x}", .{@backingInt(nlist.n_type.stab)}); | |
| 1013 | 1013 | return error.MalformedObject; |
| 1014 | 1014 | }, |
| 1015 | 1015 | else => { |
| ... | ... | @@ -2032,8 +2032,8 @@ fn addReloc(offset: u32, arch: std.Target.Cpu.Arch) !macho.relocation_info { |
| 2032 | 2032 | .r_length = 3, |
| 2033 | 2033 | .r_extern = 0, |
| 2034 | 2034 | .r_type = switch (arch) { |
| 2035 | .aarch64 => @intFromEnum(macho.reloc_type_arm64.ARM64_RELOC_UNSIGNED), | |
| 2036 | .x86_64 => @intFromEnum(macho.reloc_type_x86_64.X86_64_RELOC_UNSIGNED), | |
| 2035 | .aarch64 => @backingInt(macho.reloc_type_arm64.ARM64_RELOC_UNSIGNED), | |
| 2036 | .x86_64 => @backingInt(macho.reloc_type_x86_64.X86_64_RELOC_UNSIGNED), | |
| 2037 | 2037 | else => unreachable, |
| 2038 | 2038 | }, |
| 2039 | 2039 | }; |
| ... | ... | @@ -2844,7 +2844,7 @@ const x86_64 = struct { |
| 2844 | 2844 | var i: usize = 0; |
| 2845 | 2845 | while (i < relocs.len) : (i += 1) { |
| 2846 | 2846 | const rel = relocs[i]; |
| 2847 | const rel_type: macho.reloc_type_x86_64 = @enumFromInt(rel.r_type); | |
| 2847 | const rel_type: macho.reloc_type_x86_64 = @fromBackingInt(@intCast(rel.r_type)); | |
| 2848 | 2848 | const rel_offset = @as(u32, @intCast(rel.r_address)); |
| 2849 | 2849 | |
| 2850 | 2850 | var addend = switch (rel.r_length) { |
| ... | ... | @@ -2853,7 +2853,7 @@ const x86_64 = struct { |
| 2853 | 2853 | 2 => mem.readInt(i32, code[rel_offset..][0..4], .little), |
| 2854 | 2854 | 3 => mem.readInt(i64, code[rel_offset..][0..8], .little), |
| 2855 | 2855 | }; |
| 2856 | addend += switch (@as(macho.reloc_type_x86_64, @enumFromInt(rel.r_type))) { | |
| 2856 | addend += switch (@as(macho.reloc_type_x86_64, @fromBackingInt(@intCast(rel.r_type)))) { | |
| 2857 | 2857 | .X86_64_RELOC_SIGNED_1 => 1, |
| 2858 | 2858 | .X86_64_RELOC_SIGNED_2 => 2, |
| 2859 | 2859 | .X86_64_RELOC_SIGNED_4 => 4, |
| ... | ... | @@ -2884,7 +2884,7 @@ const x86_64 = struct { |
| 2884 | 2884 | } else rel.r_symbolnum; |
| 2885 | 2885 | |
| 2886 | 2886 | const has_subtractor = if (i > 0 and |
| 2887 | @as(macho.reloc_type_x86_64, @enumFromInt(relocs[i - 1].r_type)) == .X86_64_RELOC_SUBTRACTOR) | |
| 2887 | @as(macho.reloc_type_x86_64, @fromBackingInt(@intCast(relocs[i - 1].r_type))) == .X86_64_RELOC_SUBTRACTOR) | |
| 2888 | 2888 | blk: { |
| 2889 | 2889 | if (rel_type != .X86_64_RELOC_UNSIGNED) { |
| 2890 | 2890 | try macho_file.reportParseError2(self.index, "{s},{s}: 0x{x}: X86_64_RELOC_SUBTRACTOR followed by {s}", .{ |
| ... | ... | @@ -3017,7 +3017,7 @@ const aarch64 = struct { |
| 3017 | 3017 | |
| 3018 | 3018 | var addend: i64 = 0; |
| 3019 | 3019 | |
| 3020 | switch (@as(macho.reloc_type_arm64, @enumFromInt(rel.r_type))) { | |
| 3020 | switch (@as(macho.reloc_type_arm64, @fromBackingInt(@intCast(rel.r_type)))) { | |
| 3021 | 3021 | .ARM64_RELOC_ADDEND => { |
| 3022 | 3022 | addend = rel.r_symbolnum; |
| 3023 | 3023 | i += 1; |
| ... | ... | @@ -3028,7 +3028,7 @@ const aarch64 = struct { |
| 3028 | 3028 | return error.MalformedObject; |
| 3029 | 3029 | } |
| 3030 | 3030 | rel = relocs[i]; |
| 3031 | switch (@as(macho.reloc_type_arm64, @enumFromInt(rel.r_type))) { | |
| 3031 | switch (@as(macho.reloc_type_arm64, @fromBackingInt(@intCast(rel.r_type)))) { | |
| 3032 | 3032 | .ARM64_RELOC_PAGE21, .ARM64_RELOC_PAGEOFF12 => {}, |
| 3033 | 3033 | else => |x| { |
| 3034 | 3034 | try macho_file.reportParseError2( |
| ... | ... | @@ -3051,7 +3051,7 @@ const aarch64 = struct { |
| 3051 | 3051 | else => {}, |
| 3052 | 3052 | } |
| 3053 | 3053 | |
| 3054 | const rel_type: macho.reloc_type_arm64 = @enumFromInt(rel.r_type); | |
| 3054 | const rel_type: macho.reloc_type_arm64 = @fromBackingInt(@intCast(rel.r_type)); | |
| 3055 | 3055 | var is_extern = rel.r_extern == 1; |
| 3056 | 3056 | |
| 3057 | 3057 | const target = if (!is_extern) blk: { |
| ... | ... | @@ -3077,7 +3077,7 @@ const aarch64 = struct { |
| 3077 | 3077 | } else rel.r_symbolnum; |
| 3078 | 3078 | |
| 3079 | 3079 | const has_subtractor = if (i > 0 and |
| 3080 | @as(macho.reloc_type_arm64, @enumFromInt(relocs[i - 1].r_type)) == .ARM64_RELOC_SUBTRACTOR) | |
| 3080 | @as(macho.reloc_type_arm64, @fromBackingInt(@intCast(relocs[i - 1].r_type))) == .ARM64_RELOC_SUBTRACTOR) | |
| 3081 | 3081 | blk: { |
| 3082 | 3082 | if (rel_type != .ARM64_RELOC_UNSIGNED) { |
| 3083 | 3083 | try macho_file.reportParseError2(self.index, "{s},{s}: 0x{x}: ARM64_RELOC_SUBTRACTOR followed by {s}", .{ |
src/link/MachO/UnwindInfo.zig+5-5| ... | ... | @@ -30,8 +30,8 @@ fn canFold(macho_file: *MachO, lhs_ref: Record.Ref, rhs_ref: Record.Ref) bool { |
| 30 | 30 | const lhs = lhs_ref.getUnwindRecord(macho_file); |
| 31 | 31 | const rhs = rhs_ref.getUnwindRecord(macho_file); |
| 32 | 32 | if (cpu_arch == .x86_64) { |
| 33 | if (lhs.enc.getMode() == @intFromEnum(macho.UNWIND_X86_64_MODE.STACK_IND) or | |
| 34 | rhs.enc.getMode() == @intFromEnum(macho.UNWIND_X86_64_MODE.STACK_IND)) return false; | |
| 33 | if (lhs.enc.getMode() == @backingInt(macho.UNWIND_X86_64_MODE.STACK_IND) or | |
| 34 | rhs.enc.getMode() == @backingInt(macho.UNWIND_X86_64_MODE.STACK_IND)) return false; | |
| 35 | 35 | } |
| 36 | 36 | const lhs_per = lhs.personality orelse 0; |
| 37 | 37 | const rhs_per = rhs.personality orelse 0; |
| ... | ... | @@ -412,8 +412,8 @@ pub const Encoding = extern struct { |
| 412 | 412 | pub fn isDwarf(enc: Encoding, macho_file: *MachO) bool { |
| 413 | 413 | const mode = enc.getMode(); |
| 414 | 414 | return switch (macho_file.getTarget().cpu.arch) { |
| 415 | .aarch64 => @as(macho.UNWIND_ARM64_MODE, @enumFromInt(mode)) == .DWARF, | |
| 416 | .x86_64 => @as(macho.UNWIND_X86_64_MODE, @enumFromInt(mode)) == .DWARF, | |
| 415 | .aarch64 => @as(macho.UNWIND_ARM64_MODE, @fromBackingInt(@intCast(mode))) == .DWARF, | |
| 416 | .x86_64 => @as(macho.UNWIND_X86_64_MODE, @fromBackingInt(@intCast(mode))) == .DWARF, | |
| 417 | 417 | else => unreachable, |
| 418 | 418 | }; |
| 419 | 419 | } |
| ... | ... | @@ -421,7 +421,7 @@ pub const Encoding = extern struct { |
| 421 | 421 | pub fn setMode(enc: *Encoding, mode: anytype) void { |
| 422 | 422 | comptime assert(macho.UNWIND_ARM64_MODE_MASK == macho.UNWIND_X86_64_MODE_MASK); |
| 423 | 423 | const shift = comptime @ctz(macho.UNWIND_ARM64_MODE_MASK); |
| 424 | enc.enc |= @as(u32, @intCast(@intFromEnum(mode))) << shift; | |
| 424 | enc.enc |= @as(u32, @intCast(@backingInt(mode))) << shift; | |
| 425 | 425 | } |
| 426 | 426 | |
| 427 | 427 | pub fn hasLsda(enc: Encoding) bool { |
src/link/MachO/ZigObject.zig+15-15| ... | ... | @@ -632,7 +632,7 @@ pub fn getNavVAddr( |
| 632 | 632 | switch (reloc_info.parent) { |
| 633 | 633 | .none => unreachable, |
| 634 | 634 | .atom_index => |atom_index| { |
| 635 | const parent_atom = self.symbols.items[@intFromEnum(atom_index)].getAtom(macho_file).?; | |
| 635 | const parent_atom = self.symbols.items[@backingInt(atom_index)].getAtom(macho_file).?; | |
| 636 | 636 | try parent_atom.addReloc(macho_file, .{ |
| 637 | 637 | .tag = .@"extern", |
| 638 | 638 | .offset = @intCast(reloc_info.offset), |
| ... | ... | @@ -650,7 +650,7 @@ pub fn getNavVAddr( |
| 650 | 650 | .debug_output => |debug_output| switch (debug_output) { |
| 651 | 651 | .dwarf => |wip_nav| try wip_nav.infoExternalReloc(.{ |
| 652 | 652 | .source_off = @intCast(reloc_info.offset), |
| 653 | .target_sym = @enumFromInt(sym_index), | |
| 653 | .target_sym = @fromBackingInt(@intCast(sym_index)), | |
| 654 | 654 | .target_off = reloc_info.addend, |
| 655 | 655 | }), |
| 656 | 656 | .none => unreachable, |
| ... | ... | @@ -671,7 +671,7 @@ pub fn getUavVAddr( |
| 671 | 671 | switch (reloc_info.parent) { |
| 672 | 672 | .none => unreachable, |
| 673 | 673 | .atom_index => |atom_index| { |
| 674 | const parent_atom = self.symbols.items[@intFromEnum(atom_index)].getAtom(macho_file).?; | |
| 674 | const parent_atom = self.symbols.items[@backingInt(atom_index)].getAtom(macho_file).?; | |
| 675 | 675 | try parent_atom.addReloc(macho_file, .{ |
| 676 | 676 | .tag = .@"extern", |
| 677 | 677 | .offset = @intCast(reloc_info.offset), |
| ... | ... | @@ -689,7 +689,7 @@ pub fn getUavVAddr( |
| 689 | 689 | .debug_output => |debug_output| switch (debug_output) { |
| 690 | 690 | .dwarf => |wip_nav| try wip_nav.infoExternalReloc(.{ |
| 691 | 691 | .source_off = @intCast(reloc_info.offset), |
| 692 | .target_sym = @enumFromInt(sym_index), | |
| 692 | .target_sym = @fromBackingInt(@intCast(sym_index)), | |
| 693 | 693 | .target_off = reloc_info.addend, |
| 694 | 694 | }), |
| 695 | 695 | .none => unreachable, |
| ... | ... | @@ -716,12 +716,12 @@ pub fn lowerUav( |
| 716 | 716 | const sym = self.symbols.items[metadata.symbol_index]; |
| 717 | 717 | const existing_alignment = sym.getAtom(macho_file).?.alignment; |
| 718 | 718 | if (uav_alignment.order(existing_alignment).compare(.lte)) |
| 719 | return @enumFromInt(metadata.symbol_index); | |
| 719 | return @fromBackingInt(@intCast(metadata.symbol_index)); | |
| 720 | 720 | } |
| 721 | 721 | |
| 722 | 722 | var name_buf: [32]u8 = undefined; |
| 723 | 723 | const name = std.fmt.bufPrint(&name_buf, "__anon_{d}", .{ |
| 724 | @intFromEnum(uav), | |
| 724 | @backingInt(uav), | |
| 725 | 725 | }) catch unreachable; |
| 726 | 726 | const sym_index = self.lowerConst( |
| 727 | 727 | macho_file, |
| ... | ... | @@ -737,7 +737,7 @@ pub fn lowerUav( |
| 737 | 737 | .{e}, |
| 738 | 738 | ), |
| 739 | 739 | }; |
| 740 | try self.uavs.put(gpa, uav, .{ .symbol_index = @intFromEnum(sym_index) }); | |
| 740 | try self.uavs.put(gpa, uav, .{ .symbol_index = @backingInt(sym_index) }); | |
| 741 | 741 | return sym_index; |
| 742 | 742 | } |
| 743 | 743 | |
| ... | ... | @@ -783,14 +783,14 @@ pub fn updateFunc( |
| 783 | 783 | var aw: std.Io.Writer.Allocating = .init(gpa); |
| 784 | 784 | defer aw.deinit(); |
| 785 | 785 | |
| 786 | var debug_wip_nav = if (self.dwarf) |*dwarf| try dwarf.initWipNav(pt, func.owner_nav, @enumFromInt(sym_index)) else null; | |
| 786 | var debug_wip_nav = if (self.dwarf) |*dwarf| try dwarf.initWipNav(pt, func.owner_nav, @fromBackingInt(@intCast(sym_index))) else null; | |
| 787 | 787 | defer if (debug_wip_nav) |*wip_nav| wip_nav.deinit(); |
| 788 | 788 | |
| 789 | 789 | codegen.emitFunction( |
| 790 | 790 | &macho_file.base, |
| 791 | 791 | pt, |
| 792 | 792 | func_index, |
| 793 | @enumFromInt(sym_index), | |
| 793 | @fromBackingInt(@intCast(sym_index)), | |
| 794 | 794 | mir, |
| 795 | 795 | &aw.writer, |
| 796 | 796 | if (debug_wip_nav) |*wip_nav| .{ .dwarf = wip_nav } else .none, |
| ... | ... | @@ -876,7 +876,7 @@ pub fn updateNav( |
| 876 | 876 | const sym_index = try self.getGlobalSymbol(macho_file, name, lib_name); |
| 877 | 877 | if (nav.resolved.?.@"threadlocal" and macho_file.base.comp.config.any_non_single_threaded) self.symbols.items[sym_index].flags.tlv = true; |
| 878 | 878 | if (self.dwarf) |*dwarf| { |
| 879 | var debug_wip_nav = try dwarf.initWipNav(pt, nav_index, @enumFromInt(sym_index)); | |
| 879 | var debug_wip_nav = try dwarf.initWipNav(pt, nav_index, @fromBackingInt(@intCast(sym_index))); | |
| 880 | 880 | defer debug_wip_nav.deinit(); |
| 881 | 881 | dwarf.finishWipNav(pt, nav_index, &debug_wip_nav) catch |err| switch (err) { |
| 882 | 882 | error.OutOfMemory, error.Canceled, error.AlreadyReported => |e| return e, |
| ... | ... | @@ -894,7 +894,7 @@ pub fn updateNav( |
| 894 | 894 | var aw: std.Io.Writer.Allocating = .init(zcu.gpa); |
| 895 | 895 | defer aw.deinit(); |
| 896 | 896 | |
| 897 | var debug_wip_nav = if (self.dwarf) |*dwarf| try dwarf.initWipNav(pt, nav_index, @enumFromInt(sym_index)) else null; | |
| 897 | var debug_wip_nav = if (self.dwarf) |*dwarf| try dwarf.initWipNav(pt, nav_index, @fromBackingInt(@intCast(sym_index))) else null; | |
| 898 | 898 | defer if (debug_wip_nav) |*wip_nav| wip_nav.deinit(); |
| 899 | 899 | |
| 900 | 900 | codegen.generateSymbol( |
| ... | ... | @@ -902,7 +902,7 @@ pub fn updateNav( |
| 902 | 902 | pt, |
| 903 | 903 | .fromInterned(nav.resolved.?.value), |
| 904 | 904 | &aw.writer, |
| 905 | .{ .atom_index = @enumFromInt(sym_index) }, | |
| 905 | .{ .atom_index = @fromBackingInt(@intCast(sym_index)) }, | |
| 906 | 906 | ) catch |err| switch (err) { |
| 907 | 907 | error.WriteFailed => return error.OutOfMemory, |
| 908 | 908 | else => |e| return e, |
| ... | ... | @@ -1203,7 +1203,7 @@ fn lowerConst( |
| 1203 | 1203 | pt, |
| 1204 | 1204 | val, |
| 1205 | 1205 | &aw.writer, |
| 1206 | .{ .atom_index = @enumFromInt(sym_index) }, | |
| 1206 | .{ .atom_index = @fromBackingInt(@intCast(sym_index)) }, | |
| 1207 | 1207 | ) catch |err| switch (err) { |
| 1208 | 1208 | error.WriteFailed => return error.OutOfMemory, |
| 1209 | 1209 | else => |e| return e, |
| ... | ... | @@ -1231,7 +1231,7 @@ fn lowerConst( |
| 1231 | 1231 | const file_offset = sect.offset + atom.value; |
| 1232 | 1232 | try macho_file.pwriteAll(code, file_offset); |
| 1233 | 1233 | |
| 1234 | return @enumFromInt(sym_index); | |
| 1234 | return @fromBackingInt(@intCast(sym_index)); | |
| 1235 | 1235 | } |
| 1236 | 1236 | |
| 1237 | 1237 | pub fn updateExports( |
| ... | ... | @@ -1353,7 +1353,7 @@ fn updateLazySymbol( |
| 1353 | 1353 | &required_alignment, |
| 1354 | 1354 | &aw.writer, |
| 1355 | 1355 | .none, |
| 1356 | .{ .atom_index = @enumFromInt(symbol_index) }, | |
| 1356 | .{ .atom_index = @fromBackingInt(@intCast(symbol_index)) }, | |
| 1357 | 1357 | ); |
| 1358 | 1358 | const code = aw.written(); |
| 1359 | 1359 |
src/link/MachO/eh_frame.zig+2-2| ... | ... | @@ -464,8 +464,8 @@ pub fn writeRelocs(macho_file: *MachO, code: []u8, relocs: []macho.relocation_in |
| 464 | 464 | .r_extern = 1, |
| 465 | 465 | .r_pcrel = 1, |
| 466 | 466 | .r_type = switch (cpu_arch) { |
| 467 | .aarch64 => @intFromEnum(macho.reloc_type_arm64.ARM64_RELOC_POINTER_TO_GOT), | |
| 468 | .x86_64 => @intFromEnum(macho.reloc_type_x86_64.X86_64_RELOC_GOT), | |
| 467 | .aarch64 => @backingInt(macho.reloc_type_arm64.ARM64_RELOC_POINTER_TO_GOT), | |
| 468 | .x86_64 => @backingInt(macho.reloc_type_x86_64.X86_64_RELOC_GOT), | |
| 469 | 469 | else => unreachable, |
| 470 | 470 | }, |
| 471 | 471 | }; |
src/link/MappedFile.zig+2-2| ... | ... | @@ -181,7 +181,7 @@ pub const Node = extern struct { |
| 181 | 181 | pub const root: Node.Index = .none; |
| 182 | 182 | |
| 183 | 183 | fn get(ni: Node.Index, mf: *const MappedFile) *Node { |
| 184 | return &mf.nodes.items[@intFromEnum(ni)]; | |
| 184 | return &mf.nodes.items[@backingInt(ni)]; | |
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 | pub fn parent(ni: Node.Index, mf: *const MappedFile) Node.Index { |
| ... | ... | @@ -561,7 +561,7 @@ fn addNode(mf: *MappedFile, gpa: std.mem.Allocator, opts: struct { |
| 561 | 561 | break :location .{ .large, .{ .large = .{ .index = mf.large.items.len } } }; |
| 562 | 562 | }; |
| 563 | 563 | const free_ni: Node.Index, const free_node = free: switch (mf.free_ni) { |
| 564 | .none => .{ @enumFromInt(mf.nodes.items.len), mf.nodes.addOneAssumeCapacity() }, | |
| 564 | .none => .{ @fromBackingInt(@intCast(mf.nodes.items.len)), mf.nodes.addOneAssumeCapacity() }, | |
| 565 | 565 | else => |free_ni| { |
| 566 | 566 | const free_node = free_ni.get(mf); |
| 567 | 567 | mf.free_ni = free_node.next; |
src/link/SpirV.zig+21-21| ... | ... | @@ -153,7 +153,7 @@ pub fn loadInput(linker: *Linker, input: link.Input) !void { |
| 153 | 153 | var it: BinaryModule.Instruction.Iterator = .init(instructions, 0); |
| 154 | 154 | const has_linkage = while (it.next()) |inst| switch (inst.opcode) { |
| 155 | 155 | .OpCapability => { |
| 156 | const cap: spec.Capability = @enumFromInt(inst.operands[0]); | |
| 156 | const cap: spec.Capability = @fromBackingInt(@intCast(inst.operands[0])); | |
| 157 | 157 | if (cap == .linkage) break true; |
| 158 | 158 | }, |
| 159 | 159 | else => break false, |
| ... | ... | @@ -343,7 +343,7 @@ fn mergeFragments(linker: *Linker, gpa: Allocator, arena: Allocator) error{OutOf |
| 343 | 343 | const id_offset = next_id - 1; |
| 344 | 344 | frag_infos.appendAssumeCapacity(.{ .id_offset = id_offset }); |
| 345 | 345 | if (mir.decl_result_id != .none) { |
| 346 | try nav_final_ids.put(gpa, nav, @enumFromInt(@intFromEnum(mir.decl_result_id) + id_offset)); | |
| 346 | try nav_final_ids.put(gpa, nav, @fromBackingInt(@intCast(@backingInt(mir.decl_result_id) + id_offset))); | |
| 347 | 347 | } |
| 348 | 348 | next_id += mir.id_bound - 1; |
| 349 | 349 | } |
| ... | ... | @@ -351,13 +351,13 @@ fn mergeFragments(linker: *Linker, gpa: Allocator, arena: Allocator) error{OutOf |
| 351 | 351 | for (linker.fragments.values(), frag_infos.items) |*mir, frag_info| { |
| 352 | 352 | for (mir.nav_refs) |ref| { |
| 353 | 353 | if (!nav_final_ids.contains(ref.nav)) { |
| 354 | try nav_final_ids.put(gpa, ref.nav, @enumFromInt(@intFromEnum(ref.local_id) + frag_info.id_offset)); | |
| 354 | try nav_final_ids.put(gpa, ref.nav, @fromBackingInt(@intCast(@backingInt(ref.local_id) + frag_info.id_offset))); | |
| 355 | 355 | } |
| 356 | 356 | } |
| 357 | 357 | for (mir.uav_refs) |ref| { |
| 358 | 358 | const key = .{ ref.val, ref.storage_class }; |
| 359 | 359 | if (!uav_final_ids.contains(key)) { |
| 360 | try uav_final_ids.put(gpa, key, @enumFromInt(@intFromEnum(ref.local_id) + frag_info.id_offset)); | |
| 360 | try uav_final_ids.put(gpa, key, @fromBackingInt(@intCast(@backingInt(ref.local_id) + frag_info.id_offset))); | |
| 361 | 361 | } |
| 362 | 362 | } |
| 363 | 363 | } |
| ... | ... | @@ -391,10 +391,10 @@ fn mergeFragments(linker: *Linker, gpa: Allocator, arena: Allocator) error{OutOf |
| 391 | 391 | while (it.next()) |inst| { |
| 392 | 392 | const ld = LinkageDecoration.parse(inst) orelse continue; |
| 393 | 393 | if (ld.linkage_type != .@"export") continue; |
| 394 | const remapped_id: Id = @enumFromInt(@intFromEnum(ld.target_id) + id_offset); | |
| 394 | const remapped_id: Id = @fromBackingInt(@intCast(@backingInt(ld.target_id) + id_offset)); | |
| 395 | 395 | |
| 396 | 396 | if (extern_name_map.get(ld.name)) |nav_index| { |
| 397 | log.debug("extern resolve: '{s}' -> ext_fn_id={d}", .{ ld.name, @intFromEnum(remapped_id) }); | |
| 397 | log.debug("extern resolve: '{s}' -> ext_fn_id={d}", .{ ld.name, @backingInt(remapped_id) }); | |
| 398 | 398 | nav_final_ids.getPtr(nav_index).?.* = remapped_id; |
| 399 | 399 | _ = extern_name_map.swapRemove(ld.name); |
| 400 | 400 | try resolved_ids.put(gpa, remapped_id, {}); |
| ... | ... | @@ -579,7 +579,7 @@ fn remapFilteredInsts( |
| 579 | 579 | switch (mode) { |
| 580 | 580 | .skip_functions => { |
| 581 | 581 | if (inst.opcode == .OpFunction) { |
| 582 | skip_function = skip_ids.contains(@enumFromInt(inst.operands[1])); | |
| 582 | skip_function = skip_ids.contains(@fromBackingInt(@intCast(inst.operands[1]))); | |
| 583 | 583 | } |
| 584 | 584 | if (skip_function) { |
| 585 | 585 | if (inst.opcode == .OpFunctionEnd) skip_function = false; |
| ... | ... | @@ -593,7 +593,7 @@ fn remapFilteredInsts( |
| 593 | 593 | }, |
| 594 | 594 | .skip_names => { |
| 595 | 595 | if (inst.opcode == .OpName and inst.operands.len >= 1) { |
| 596 | if (skip_ids.contains(@enumFromInt(inst.operands[0]))) continue; | |
| 596 | if (skip_ids.contains(@fromBackingInt(@intCast(inst.operands[0])))) continue; | |
| 597 | 597 | } |
| 598 | 598 | }, |
| 599 | 599 | } |
| ... | ... | @@ -817,11 +817,11 @@ const LinkageDecoration = struct { |
| 817 | 817 | fn parse(inst: BinaryModule.Instruction) ?LinkageDecoration { |
| 818 | 818 | if (inst.opcode != .OpDecorate) return null; |
| 819 | 819 | if (inst.operands.len < 3) return null; |
| 820 | if (inst.operands[1] != @intFromEnum(spec.Decoration.linkage_attributes)) return null; | |
| 820 | if (inst.operands[1] != @backingInt(spec.Decoration.linkage_attributes)) return null; | |
| 821 | 821 | return .{ |
| 822 | .target_id = @enumFromInt(inst.operands[0]), | |
| 822 | .target_id = @fromBackingInt(@intCast(inst.operands[0])), | |
| 823 | 823 | .name = std.mem.sliceTo(std.mem.sliceAsBytes(inst.operands[2 .. inst.operands.len - 1]), 0), |
| 824 | .linkage_type = @enumFromInt(inst.operands[inst.operands.len - 1]), | |
| 824 | .linkage_type = @fromBackingInt(@intCast(inst.operands[inst.operands.len - 1])), | |
| 825 | 825 | }; |
| 826 | 826 | } |
| 827 | 827 | }; |
| ... | ... | @@ -897,7 +897,7 @@ fn appendExternalObjects( |
| 897 | 897 | while (it.next()) |inst| { |
| 898 | 898 | const ld = LinkageDecoration.parse(inst) orelse continue; |
| 899 | 899 | if (ld.linkage_type != .@"export") continue; |
| 900 | try export_map.put(gpa, ld.name, @enumFromInt(@intFromEnum(ld.target_id) + id_offset)); | |
| 900 | try export_map.put(gpa, ld.name, @fromBackingInt(@intCast(@backingInt(ld.target_id) + id_offset))); | |
| 901 | 901 | } |
| 902 | 902 | } |
| 903 | 903 | |
| ... | ... | @@ -920,14 +920,14 @@ fn appendExternalObjects( |
| 920 | 920 | while (it.next()) |inst| { |
| 921 | 921 | const ld = LinkageDecoration.parse(inst) orelse continue; |
| 922 | 922 | if (ld.linkage_type != .import) continue; |
| 923 | const remapped_import: Id = @enumFromInt(@intFromEnum(ld.target_id) + id_offset); | |
| 923 | const remapped_import: Id = @fromBackingInt(@intCast(@backingInt(ld.target_id) + id_offset)); | |
| 924 | 924 | |
| 925 | 925 | if (export_map.get(ld.name)) |export_id| { |
| 926 | 926 | try per_obj_remaps[obj_idx].put(gpa, ld.target_id, export_id); |
| 927 | 927 | try resolved_linkage_ids.put(gpa, remapped_import, {}); |
| 928 | 928 | try resolved_linkage_ids.put(gpa, export_id, {}); |
| 929 | 929 | log.debug("cross-object resolve: '{s}' import={d} -> export={d}", .{ |
| 930 | ld.name, @intFromEnum(remapped_import), @intFromEnum(export_id), | |
| 930 | ld.name, @backingInt(remapped_import), @backingInt(export_id), | |
| 931 | 931 | }); |
| 932 | 932 | } else { |
| 933 | 933 | has_linkage.* = true; |
| ... | ... | @@ -968,7 +968,7 @@ fn appendExternalObjects( |
| 968 | 968 | } |
| 969 | 969 | |
| 970 | 970 | if (LinkageDecoration.parse(inst)) |ld| { |
| 971 | const remapped: Id = @enumFromInt(@intFromEnum(ld.target_id) + id_offset); | |
| 971 | const remapped: Id = @fromBackingInt(@intCast(@backingInt(ld.target_id) + id_offset)); | |
| 972 | 972 | if (resolved_linkage_ids.contains(remapped)) { |
| 973 | 973 | if (ld.linkage_type == .@"export" and is_obj) { |
| 974 | 974 | has_linkage.* = true; |
| ... | ... | @@ -979,7 +979,7 @@ fn appendExternalObjects( |
| 979 | 979 | } |
| 980 | 980 | |
| 981 | 981 | if (inst.opcode == .OpName and inst.operands.len >= 1) { |
| 982 | if (id_remap.contains(@enumFromInt(inst.operands[0]))) continue; | |
| 982 | if (id_remap.contains(@fromBackingInt(@intCast(inst.operands[0])))) continue; | |
| 983 | 983 | } |
| 984 | 984 | |
| 985 | 985 | const dest = sections.getSection(Sections.classifyPreambleInst(inst.opcode)); |
| ... | ... | @@ -990,7 +990,7 @@ fn appendExternalObjects( |
| 990 | 990 | var skip_function = false; |
| 991 | 991 | while (fn_it.next()) |inst| { |
| 992 | 992 | if (inst.opcode == .OpFunction) { |
| 993 | skip_function = id_remap.contains(@enumFromInt(inst.operands[1])); | |
| 993 | skip_function = id_remap.contains(@fromBackingInt(@intCast(inst.operands[1]))); | |
| 994 | 994 | } |
| 995 | 995 | if (!skip_function) { |
| 996 | 996 | try remapAndAppendInst(gpa, &sections.functions, ext_obj.instructions, inst, id_offset, id_remap, parser); |
| ... | ... | @@ -1034,7 +1034,7 @@ fn collectEntryPointInterface( |
| 1034 | 1034 | } |
| 1035 | 1035 | |
| 1036 | 1036 | for (mir.internal_globals) |local_id| { |
| 1037 | const global_id: Id = @enumFromInt(@intFromEnum(local_id) + id_offset); | |
| 1037 | const global_id: Id = @fromBackingInt(@intCast(@backingInt(local_id) + id_offset)); | |
| 1038 | 1038 | try interface.append(gpa, global_id); |
| 1039 | 1039 | } |
| 1040 | 1040 | |
| ... | ... | @@ -1206,11 +1206,11 @@ fn operandLiteralWordCount(kind: spec.OperandKind, inst: BinaryModule.Instructio |
| 1206 | 1206 | } |
| 1207 | 1207 | |
| 1208 | 1208 | fn remapSingleId(word: *Word, id_offset: Word, id_remap: *const std.AutoHashMapUnmanaged(Id, Id)) void { |
| 1209 | const id: Id = @enumFromInt(word.*); | |
| 1209 | const id: Id = @fromBackingInt(@intCast(word.*)); | |
| 1210 | 1210 | if (id == .none) return; |
| 1211 | 1211 | if (id_remap.get(id)) |final_id| { |
| 1212 | word.* = @intFromEnum(final_id); | |
| 1212 | word.* = @backingInt(final_id); | |
| 1213 | 1213 | } else { |
| 1214 | word.* = @intFromEnum(id) + id_offset; | |
| 1214 | word.* = @backingInt(id) + id_offset; | |
| 1215 | 1215 | } |
| 1216 | 1216 | } |
src/link/SpirV/BinaryModule.zig+12-12| ... | ... | @@ -58,7 +58,7 @@ pub const Instruction = struct { |
| 58 | 58 | assert(it.offset < it.words.len); |
| 59 | 59 | |
| 60 | 60 | return Instruction{ |
| 61 | .opcode = @enumFromInt(it.words[it.offset] & 0xFFFF), | |
| 61 | .opcode = @fromBackingInt(@intCast(it.words[it.offset] & 0xFFFF)), | |
| 62 | 62 | .offset = it.offset, |
| 63 | 63 | .operands = it.words[it.offset..][1..instruction_len], |
| 64 | 64 | }; |
| ... | ... | @@ -97,11 +97,11 @@ pub const Parser = struct { |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | fn mapSetAndOpcode(set: InstructionSet, opcode: u16) u32 { |
| 100 | return (@as(u32, @intFromEnum(set)) << 16) | opcode; | |
| 100 | return (@as(u32, @backingInt(set)) << 16) | opcode; | |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | pub fn getInstSpec(parser: Parser, opcode: Opcode) ?spec.Instruction { |
| 104 | const index = parser.opcode_table.get(mapSetAndOpcode(.core, @intFromEnum(opcode))) orelse return null; | |
| 104 | const index = parser.opcode_table.get(mapSetAndOpcode(.core, @backingInt(opcode))) orelse return null; | |
| 105 | 105 | return InstructionSet.core.instructions()[index]; |
| 106 | 106 | } |
| 107 | 107 | |
| ... | ... | @@ -127,10 +127,10 @@ pub const Parser = struct { |
| 127 | 127 | const set_name = std.mem.sliceTo(std.mem.sliceAsBytes(operands[1..]), 0); |
| 128 | 128 | const set = std.meta.stringToEnum(InstructionSet, set_name) orelse continue; |
| 129 | 129 | if (set == .core) continue; |
| 130 | try binary.ext_inst_map.put(parser.gpa, @enumFromInt(operands[0]), set); | |
| 130 | try binary.ext_inst_map.put(parser.gpa, @fromBackingInt(@intCast(operands[0])), set); | |
| 131 | 131 | }, |
| 132 | 132 | .OpTypeInt, .OpTypeFloat => { |
| 133 | try binary.arith_type_width.put(parser.gpa, @enumFromInt(operands[0]), @intCast(operands[1])); | |
| 133 | try binary.arith_type_width.put(parser.gpa, @fromBackingInt(@intCast(operands[0])), @intCast(operands[1])); | |
| 134 | 134 | }, |
| 135 | 135 | .OpFunction => if (maybe_function_section == null) { |
| 136 | 136 | maybe_function_section = inst.offset; |
| ... | ... | @@ -145,8 +145,8 @@ pub const Parser = struct { |
| 145 | 145 | spec_operands[1].kind == .id_result) |
| 146 | 146 | { |
| 147 | 147 | if (operands.len >= 2) { |
| 148 | if (binary.arith_type_width.get(@enumFromInt(operands[0]))) |width| { | |
| 149 | try binary.arith_type_width.put(parser.gpa, @enumFromInt(operands[1]), width); | |
| 148 | if (binary.arith_type_width.get(@fromBackingInt(@intCast(operands[0])))) |width| { | |
| 149 | try binary.arith_type_width.put(parser.gpa, @fromBackingInt(@intCast(operands[1])), width); | |
| 150 | 150 | } |
| 151 | 151 | } |
| 152 | 152 | } |
| ... | ... | @@ -165,7 +165,7 @@ pub const Parser = struct { |
| 165 | 165 | inst: Instruction, |
| 166 | 166 | offsets: *std.ArrayList(u16), |
| 167 | 167 | ) !void { |
| 168 | const index = parser.opcode_table.get(mapSetAndOpcode(.core, @intFromEnum(inst.opcode))).?; | |
| 168 | const index = parser.opcode_table.get(mapSetAndOpcode(.core, @backingInt(inst.opcode))).?; | |
| 169 | 169 | const operands = InstructionSet.core.instructions()[index].operands; |
| 170 | 170 | |
| 171 | 171 | var offset: usize = 0; |
| ... | ... | @@ -190,10 +190,10 @@ pub const Parser = struct { |
| 190 | 190 | offset = try parser.parseOperandsResultIds(binary, inst, operands[0..2], offset, offsets); |
| 191 | 191 | |
| 192 | 192 | if (offset + 1 >= inst.operands.len) return error.InvalidPhysicalFormat; |
| 193 | const set_id: ResultId = @enumFromInt(inst.operands[offset]); | |
| 193 | const set_id: ResultId = @fromBackingInt(@intCast(inst.operands[offset])); | |
| 194 | 194 | try offsets.append(parser.gpa, @intCast(offset)); |
| 195 | 195 | const set = binary.ext_inst_map.get(set_id) orelse { |
| 196 | log.err("invalid instruction set {}", .{@intFromEnum(set_id)}); | |
| 196 | log.err("invalid instruction set {}", .{@backingInt(set_id)}); | |
| 197 | 197 | return error.InvalidId; |
| 198 | 198 | }; |
| 199 | 199 | const ext_opcode = std.math.cast(u16, inst.operands[offset + 1]) orelse return error.InvalidPhysicalFormat; |
| ... | ... | @@ -304,7 +304,7 @@ pub const Parser = struct { |
| 304 | 304 | }, |
| 305 | 305 | .literal_context_dependent_number => { |
| 306 | 306 | assert(inst.opcode == .OpConstant or inst.opcode == .OpSpecConstant); |
| 307 | const bit_width = binary.arith_type_width.get(@enumFromInt(inst.operands[0])) orelse { | |
| 307 | const bit_width = binary.arith_type_width.get(@fromBackingInt(@intCast(inst.operands[0]))) orelse { | |
| 308 | 308 | log.err("invalid LiteralContextDependentNumber type {}", .{inst.operands[0]}); |
| 309 | 309 | return error.InvalidId; |
| 310 | 310 | }; |
| ... | ... | @@ -318,7 +318,7 @@ pub const Parser = struct { |
| 318 | 318 | .literal_spec_constant_op_integer => unreachable, |
| 319 | 319 | .pair_literal_integer_id_ref => { |
| 320 | 320 | assert(inst.opcode == .OpSwitch); |
| 321 | const bit_width = binary.arith_type_width.get(@enumFromInt(inst.operands[0])) orelse { | |
| 321 | const bit_width = binary.arith_type_width.get(@fromBackingInt(@intCast(inst.operands[0]))) orelse { | |
| 322 | 322 | log.err("invalid OpSwitch type {}", .{inst.operands[0]}); |
| 323 | 323 | return error.InvalidId; |
| 324 | 324 | }; |
src/link/SpirV/dedup_types.zig+10-10| ... | ... | @@ -35,7 +35,7 @@ pub fn run(parser: *BinaryModule.Parser, binary: *BinaryModule) !void { |
| 35 | 35 | }, |
| 36 | 36 | } |
| 37 | 37 | if (inst.operands.len == 0) continue; |
| 38 | const target_id: Id = @enumFromInt(inst.operands[0]); | |
| 38 | const target_id: Id = @fromBackingInt(@intCast(inst.operands[0])); | |
| 39 | 39 | |
| 40 | 40 | const gop = try decorations_by_id.getOrPut(gpa, target_id); |
| 41 | 41 | if (!gop.found_existing) gop.value_ptr.* = .empty; |
| ... | ... | @@ -75,10 +75,10 @@ pub fn run(parser: *BinaryModule.Parser, binary: *BinaryModule) !void { |
| 75 | 75 | else => continue, |
| 76 | 76 | }; |
| 77 | 77 | if (result_id_index >= inst.operands.len) continue; |
| 78 | const result_id: Id = @enumFromInt(inst.operands[result_id_index]); | |
| 78 | const result_id: Id = @fromBackingInt(@intCast(inst.operands[result_id_index])); | |
| 79 | 79 | |
| 80 | 80 | key_words.items.len = 0; |
| 81 | try key_words.append(gpa, @intFromEnum(inst.opcode)); | |
| 81 | try key_words.append(gpa, @backingInt(inst.opcode)); | |
| 82 | 82 | |
| 83 | 83 | id_offsets.items.len = 0; |
| 84 | 84 | parser.parseInstructionResultIds(binary.*, inst, &id_offsets) catch continue; |
| ... | ... | @@ -86,8 +86,8 @@ pub fn run(parser: *BinaryModule.Parser, binary: *BinaryModule) !void { |
| 86 | 86 | for (inst.operands, 0..) |word, i| { |
| 87 | 87 | if (i == result_id_index) continue; |
| 88 | 88 | if (std.mem.indexOfScalar(u16, id_offsets.items, @intCast(i)) != null) { |
| 89 | const canonical = id_remap.get(@enumFromInt(word)) orelse @as(Id, @enumFromInt(word)); | |
| 90 | try key_words.append(gpa, @intFromEnum(canonical)); | |
| 89 | const canonical = id_remap.get(@fromBackingInt(@intCast(word))) orelse @as(Id, @fromBackingInt(@intCast(word))); | |
| 90 | try key_words.append(gpa, @backingInt(canonical)); | |
| 91 | 91 | } else { |
| 92 | 92 | try key_words.append(gpa, word); |
| 93 | 93 | } |
| ... | ... | @@ -100,7 +100,7 @@ pub fn run(parser: *BinaryModule.Parser, binary: *BinaryModule) !void { |
| 100 | 100 | var hasher = std.hash.Wyhash.init(0); |
| 101 | 101 | hasher.update(std.mem.asBytes(&dec_words[0])); |
| 102 | 102 | for (dec_words[2..]) |w| { |
| 103 | const w_val = if (id_remap.get(@enumFromInt(w))) |c| @intFromEnum(c) else w; | |
| 103 | const w_val = if (id_remap.get(@fromBackingInt(@intCast(w)))) |c| @backingInt(c) else w; | |
| 104 | 104 | hasher.update(std.mem.asBytes(&w_val)); |
| 105 | 105 | } |
| 106 | 106 | try dec_hashes.append(gpa, hasher.final()); |
| ... | ... | @@ -151,7 +151,7 @@ pub fn run(parser: *BinaryModule.Parser, binary: *BinaryModule) !void { |
| 151 | 151 | else => unreachable, |
| 152 | 152 | }; |
| 153 | 153 | if (result_id_index < inst.operands.len) { |
| 154 | const result_id: Id = @enumFromInt(inst.operands[result_id_index]); | |
| 154 | const result_id: Id = @fromBackingInt(@intCast(inst.operands[result_id_index])); | |
| 155 | 155 | if (id_remap.contains(result_id)) continue; |
| 156 | 156 | } |
| 157 | 157 | } |
| ... | ... | @@ -159,7 +159,7 @@ pub fn run(parser: *BinaryModule.Parser, binary: *BinaryModule) !void { |
| 159 | 159 | switch (inst.opcode.class()) { |
| 160 | 160 | .annotation, .debug => { |
| 161 | 161 | if (inst.operands.len > 0) { |
| 162 | const target: Id = @enumFromInt(inst.operands[0]); | |
| 162 | const target: Id = @fromBackingInt(@intCast(inst.operands[0])); | |
| 163 | 163 | if (id_remap.contains(target)) continue; |
| 164 | 164 | } |
| 165 | 165 | }, |
| ... | ... | @@ -186,8 +186,8 @@ pub fn run(parser: *BinaryModule.Parser, binary: *BinaryModule) !void { |
| 186 | 186 | max_id = @max(max_id, word.*); |
| 187 | 187 | if (maybe_result_id_index != null and i == maybe_result_id_index.?) continue; |
| 188 | 188 | |
| 189 | if (id_remap.get(@enumFromInt(word.*))) |canonical| { | |
| 190 | word.* = @intFromEnum(canonical); | |
| 189 | if (id_remap.get(@fromBackingInt(@intCast(word.*)))) |canonical| { | |
| 190 | word.* = @backingInt(canonical); | |
| 191 | 191 | max_id = @max(max_id, word.*); |
| 192 | 192 | } |
| 193 | 193 | } |
src/link/SpirV/lower_invocation_globals.zig+33-33| ... | ... | @@ -94,7 +94,7 @@ const ModuleInfo = struct { |
| 94 | 94 | |
| 95 | 95 | switch (inst.opcode) { |
| 96 | 96 | .OpEntryPoint => { |
| 97 | const entry_point: ResultId = @enumFromInt(inst.operands[1]); | |
| 97 | const entry_point: ResultId = @fromBackingInt(@intCast(inst.operands[1])); | |
| 98 | 98 | const entry = try entry_points.getOrPut(arena, entry_point); |
| 99 | 99 | if (entry.found_existing) { |
| 100 | 100 | log.err("Entry point type {f} has duplicate definition", .{entry_point}); |
| ... | ... | @@ -102,8 +102,8 @@ const ModuleInfo = struct { |
| 102 | 102 | } |
| 103 | 103 | }, |
| 104 | 104 | .OpTypeFunction => { |
| 105 | const fn_type: ResultId = @enumFromInt(inst.operands[0]); | |
| 106 | const return_type: ResultId = @enumFromInt(inst.operands[1]); | |
| 105 | const fn_type: ResultId = @fromBackingInt(@intCast(inst.operands[0])); | |
| 106 | const return_type: ResultId = @fromBackingInt(@intCast(inst.operands[1])); | |
| 107 | 107 | const param_types: []const ResultId = @ptrCast(inst.operands[2..]); |
| 108 | 108 | |
| 109 | 109 | const entry = try fn_types.getOrPut(fn_type); |
| ... | ... | @@ -119,15 +119,15 @@ const ModuleInfo = struct { |
| 119 | 119 | }, |
| 120 | 120 | .OpExtInst => { |
| 121 | 121 | // Note: format and set are already verified by parseInstructionResultIds(). |
| 122 | const global_type: ResultId = @enumFromInt(inst.operands[0]); | |
| 123 | const result_id: ResultId = @enumFromInt(inst.operands[1]); | |
| 124 | const set_id: ResultId = @enumFromInt(inst.operands[2]); | |
| 122 | const global_type: ResultId = @fromBackingInt(@intCast(inst.operands[0])); | |
| 123 | const result_id: ResultId = @fromBackingInt(@intCast(inst.operands[1])); | |
| 124 | const set_id: ResultId = @fromBackingInt(@intCast(inst.operands[2])); | |
| 125 | 125 | const set_inst = inst.operands[3]; |
| 126 | 126 | |
| 127 | 127 | const set = binary.ext_inst_map.get(set_id).?; |
| 128 | 128 | if (set == .zig and set_inst == 0) { |
| 129 | 129 | const initializer: ResultId = if (inst.operands.len >= 5) |
| 130 | @enumFromInt(inst.operands[4]) | |
| 130 | @fromBackingInt(@intCast(inst.operands[4])) | |
| 131 | 131 | else |
| 132 | 132 | .none; |
| 133 | 133 | |
| ... | ... | @@ -144,12 +144,12 @@ const ModuleInfo = struct { |
| 144 | 144 | return error.InvalidPhysicalFormat; |
| 145 | 145 | } |
| 146 | 146 | |
| 147 | maybe_current_function = @enumFromInt(inst.operands[1]); | |
| 148 | fn_ty_id = @enumFromInt(inst.operands[3]); | |
| 147 | maybe_current_function = @fromBackingInt(@intCast(inst.operands[1])); | |
| 148 | fn_ty_id = @fromBackingInt(@intCast(inst.operands[3])); | |
| 149 | 149 | function_invocation_globals.clearRetainingCapacity(); |
| 150 | 150 | }, |
| 151 | 151 | .OpFunctionCall => { |
| 152 | const callee: ResultId = @enumFromInt(inst.operands[2]); | |
| 152 | const callee: ResultId = @fromBackingInt(@intCast(inst.operands[2])); | |
| 153 | 153 | try calls.put(arena, callee, {}); |
| 154 | 154 | }, |
| 155 | 155 | .OpFunctionEnd => { |
| ... | ... | @@ -184,7 +184,7 @@ const ModuleInfo = struct { |
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | for (result_id_offsets.items) |off| { |
| 187 | const result_id: ResultId = @enumFromInt(inst.operands[off]); | |
| 187 | const result_id: ResultId = @fromBackingInt(@intCast(inst.operands[off])); | |
| 188 | 188 | if (invocation_globals.contains(result_id)) { |
| 189 | 189 | try function_invocation_globals.put(arena, result_id, {}); |
| 190 | 190 | } |
| ... | ... | @@ -355,7 +355,7 @@ const ModuleBuilder = struct { |
| 355 | 355 | global_id_base: u32, |
| 356 | 356 | |
| 357 | 357 | fn invocationGlobalId(self: FunctionNewInfo, index: usize) ResultId { |
| 358 | return @enumFromInt(self.global_id_base + @as(u32, @intCast(index))); | |
| 358 | return @fromBackingInt(@intCast(self.global_id_base + @as(u32, @intCast(index)))); | |
| 359 | 359 | } |
| 360 | 360 | }; |
| 361 | 361 | |
| ... | ... | @@ -384,7 +384,7 @@ const ModuleBuilder = struct { |
| 384 | 384 | .entry_point_new_id_base = undefined, |
| 385 | 385 | .new_functions_section = null, |
| 386 | 386 | }; |
| 387 | self.entry_point_new_id_base = @intFromEnum(self.allocIds(@intCast(info.entry_points.count()))); | |
| 387 | self.entry_point_new_id_base = @backingInt(self.allocIds(@intCast(info.entry_points.count()))); | |
| 388 | 388 | return self; |
| 389 | 389 | } |
| 390 | 390 | |
| ... | ... | @@ -394,7 +394,7 @@ const ModuleBuilder = struct { |
| 394 | 394 | |
| 395 | 395 | fn allocIds(self: *ModuleBuilder, n: u32) ResultId { |
| 396 | 396 | defer self.id_bound += n; |
| 397 | return @enumFromInt(self.id_bound); | |
| 397 | return @fromBackingInt(@intCast(self.id_bound)); | |
| 398 | 398 | } |
| 399 | 399 | |
| 400 | 400 | fn finalize(self: *ModuleBuilder, arena: Allocator, binary: *BinaryModule) !void { |
| ... | ... | @@ -435,7 +435,7 @@ const ModuleBuilder = struct { |
| 435 | 435 | |
| 436 | 436 | switch (inst.opcode) { |
| 437 | 437 | .OpName => { |
| 438 | const id: ResultId = @enumFromInt(inst.operands[0]); | |
| 438 | const id: ResultId = @fromBackingInt(@intCast(inst.operands[0])); | |
| 439 | 439 | if (info.invocation_globals.contains(id)) { |
| 440 | 440 | try self.global_names.put(self.arena, id, inst.operands[1..]); |
| 441 | 441 | continue; |
| ... | ... | @@ -443,12 +443,12 @@ const ModuleBuilder = struct { |
| 443 | 443 | if (info.dead_initializers.contains(id)) continue; |
| 444 | 444 | }, |
| 445 | 445 | .OpExtInstImport => { |
| 446 | const set_id: ResultId = @enumFromInt(inst.operands[0]); | |
| 446 | const set_id: ResultId = @fromBackingInt(@intCast(inst.operands[0])); | |
| 447 | 447 | const set = binary.ext_inst_map.get(set_id).?; |
| 448 | 448 | if (set == .zig) continue; |
| 449 | 449 | }, |
| 450 | 450 | .OpExtInst => { |
| 451 | const set_id: ResultId = @enumFromInt(inst.operands[2]); | |
| 451 | const set_id: ResultId = @fromBackingInt(@intCast(inst.operands[2])); | |
| 452 | 452 | const set_inst = inst.operands[3]; |
| 453 | 453 | const set = binary.ext_inst_map.get(set_id).?; |
| 454 | 454 | if (set == .zig and set_inst == 0) { |
| ... | ... | @@ -456,11 +456,11 @@ const ModuleBuilder = struct { |
| 456 | 456 | } |
| 457 | 457 | }, |
| 458 | 458 | .OpEntryPoint => { |
| 459 | const original_id: ResultId = @enumFromInt(inst.operands[1]); | |
| 459 | const original_id: ResultId = @fromBackingInt(@intCast(inst.operands[1])); | |
| 460 | 460 | const fn_info = info.functions.get(original_id).?; |
| 461 | 461 | if (fn_info.invocation_globals.count() > 0) { |
| 462 | 462 | const new_id_index = info.entry_points.getIndex(original_id).?; |
| 463 | const new_id: ResultId = @enumFromInt(self.entry_point_new_id_base + new_id_index); | |
| 463 | const new_id: ResultId = @fromBackingInt(@intCast(self.entry_point_new_id_base + new_id_index)); | |
| 464 | 464 | try self.section.emitRaw(self.arena, .OpEntryPoint, inst.operands.len); |
| 465 | 465 | self.section.writeWord(inst.operands[0]); |
| 466 | 466 | self.section.writeOperand(ResultId, new_id); |
| ... | ... | @@ -471,11 +471,11 @@ const ModuleBuilder = struct { |
| 471 | 471 | continue; |
| 472 | 472 | }, |
| 473 | 473 | .OpExecutionMode, .OpExecutionModeId => { |
| 474 | const original_id: ResultId = @enumFromInt(inst.operands[0]); | |
| 474 | const original_id: ResultId = @fromBackingInt(@intCast(inst.operands[0])); | |
| 475 | 475 | const fn_info = info.functions.get(original_id).?; |
| 476 | 476 | if (fn_info.invocation_globals.count() > 0) { |
| 477 | 477 | const new_id_index = info.entry_points.getIndex(original_id).?; |
| 478 | const new_id: ResultId = @enumFromInt(self.entry_point_new_id_base + new_id_index); | |
| 478 | const new_id: ResultId = @fromBackingInt(@intCast(self.entry_point_new_id_base + new_id_index)); | |
| 479 | 479 | try self.section.emitRaw(self.arena, inst.opcode, inst.operands.len); |
| 480 | 480 | self.section.writeOperand(ResultId, new_id); |
| 481 | 481 | self.section.writeWords(inst.operands[1..]); |
| ... | ... | @@ -512,7 +512,7 @@ const ModuleBuilder = struct { |
| 512 | 512 | const new_type = try self.internFunctionType(fn_info.return_type, new_param_types); |
| 513 | 513 | try self.function_new_info.put(self.arena, func, .{ |
| 514 | 514 | .new_function_type = new_type, |
| 515 | .global_id_base = @intFromEnum(self.allocIds(@intCast(invocation_global_count))), | |
| 515 | .global_id_base = @backingInt(self.allocIds(@intCast(invocation_global_count))), | |
| 516 | 516 | }); |
| 517 | 517 | } |
| 518 | 518 | } |
| ... | ... | @@ -583,20 +583,20 @@ const ModuleBuilder = struct { |
| 583 | 583 | |
| 584 | 584 | // Replace the result-ids with the global's new result-id if required. |
| 585 | 585 | for (result_id_offsets.items) |off| { |
| 586 | const result_id: ResultId = @enumFromInt(operands.items[off]); | |
| 586 | const result_id: ResultId = @fromBackingInt(@intCast(operands.items[off])); | |
| 587 | 587 | if (info.invocation_globals.contains(result_id)) { |
| 588 | 588 | const func = maybe_current_function.?; |
| 589 | 589 | const new_info = self.function_new_info.get(func).?; |
| 590 | 590 | const fn_info = info.functions.get(func).?; |
| 591 | 591 | const index = fn_info.invocation_globals.getIndex(result_id).?; |
| 592 | operands.items[off] = @intFromEnum(new_info.invocationGlobalId(index)); | |
| 592 | operands.items[off] = @backingInt(new_info.invocationGlobalId(index)); | |
| 593 | 593 | } |
| 594 | 594 | } |
| 595 | 595 | |
| 596 | 596 | switch (inst.opcode) { |
| 597 | 597 | .OpFunction => { |
| 598 | 598 | // Re-declare the function with the new parameters. |
| 599 | const func: ResultId = @enumFromInt(operands.items[1]); | |
| 599 | const func: ResultId = @fromBackingInt(@intCast(operands.items[1])); | |
| 600 | 600 | if (info.dead_initializers.contains(func)) { |
| 601 | 601 | skip_until_end = true; |
| 602 | 602 | continue; |
| ... | ... | @@ -628,7 +628,7 @@ const ModuleBuilder = struct { |
| 628 | 628 | .OpFunctionCall => { |
| 629 | 629 | // Add the required invocation globals to the function's new parameter list. |
| 630 | 630 | const caller = maybe_current_function.?; |
| 631 | const callee: ResultId = @enumFromInt(operands.items[2]); | |
| 631 | const callee: ResultId = @fromBackingInt(@intCast(operands.items[2])); | |
| 632 | 632 | const caller_info = info.functions.get(caller).?; |
| 633 | 633 | const callee_info = info.functions.get(callee).?; |
| 634 | 634 | const caller_new_info = self.function_new_info.get(caller).?; |
| ... | ... | @@ -663,7 +663,7 @@ const ModuleBuilder = struct { |
| 663 | 663 | for (info.entry_points.keys(), 0..) |func, entry_point_index| { |
| 664 | 664 | const fn_info = info.functions.get(func).?; |
| 665 | 665 | if (fn_info.invocation_globals.count() == 0) continue; |
| 666 | const ep_id: ResultId = @enumFromInt(self.entry_point_new_id_base + @as(u32, @intCast(entry_point_index))); | |
| 666 | const ep_id: ResultId = @fromBackingInt(@intCast(self.entry_point_new_id_base + @as(u32, @intCast(entry_point_index)))); | |
| 667 | 667 | const fn_type = self.function_types.get(.{ |
| 668 | 668 | .return_type = fn_info.return_type, |
| 669 | 669 | .param_types = fn_info.param_types, |
| ... | ... | @@ -677,9 +677,9 @@ const ModuleBuilder = struct { |
| 677 | 677 | }); |
| 678 | 678 | |
| 679 | 679 | // Emit OpFunctionParameter instructions for the original kernel's parameters. |
| 680 | const params_id_base: u32 = @intFromEnum(self.allocIds(@intCast(fn_info.param_types.len))); | |
| 680 | const params_id_base: u32 = @backingInt(self.allocIds(@intCast(fn_info.param_types.len))); | |
| 681 | 681 | for (fn_info.param_types, 0..) |param_type, i| { |
| 682 | const id: ResultId = @enumFromInt(params_id_base + @as(u32, @intCast(i))); | |
| 682 | const id: ResultId = @fromBackingInt(@intCast(params_id_base + @as(u32, @intCast(i)))); | |
| 683 | 683 | try self.section.emit(arena, .OpFunctionParameter, .{ |
| 684 | 684 | .id_result_type = param_type, |
| 685 | 685 | .id_result = id, |
| ... | ... | @@ -703,11 +703,11 @@ const ModuleBuilder = struct { |
| 703 | 703 | } |
| 704 | 704 | |
| 705 | 705 | // Declare the IDs of the invocation globals. |
| 706 | const global_id_base: u32 = @intFromEnum(self.allocIds(@intCast(all_function_invocation_globals.count()))); | |
| 706 | const global_id_base: u32 = @backingInt(self.allocIds(@intCast(all_function_invocation_globals.count()))); | |
| 707 | 707 | for (all_function_invocation_globals.keys(), 0..) |global, i| { |
| 708 | 708 | const global_info = info.invocation_globals.get(global).?; |
| 709 | 709 | |
| 710 | const id: ResultId = @enumFromInt(global_id_base + @as(u32, @intCast(i))); | |
| 710 | const id: ResultId = @fromBackingInt(@intCast(global_id_base + @as(u32, @intCast(i)))); | |
| 711 | 711 | try self.section.emit(arena, .OpVariable, .{ |
| 712 | 712 | .id_result_type = global_info.ty, |
| 713 | 713 | .id_result = id, |
| ... | ... | @@ -764,13 +764,13 @@ const ModuleBuilder = struct { |
| 764 | 764 | // Add the invocation globals |
| 765 | 765 | for (callee_info.invocation_globals.keys()) |global| { |
| 766 | 766 | const index = all_globals.getIndex(global).?; |
| 767 | const id: ResultId = @enumFromInt(global_id_base + @as(u32, @intCast(index))); | |
| 767 | const id: ResultId = @fromBackingInt(@intCast(global_id_base + @as(u32, @intCast(index)))); | |
| 768 | 768 | self.section.writeOperand(ResultId, id); |
| 769 | 769 | } |
| 770 | 770 | |
| 771 | 771 | // Add the arguments |
| 772 | 772 | for (0..callee_info.param_types.len) |index| { |
| 773 | const id: ResultId = @enumFromInt(params_id_base + @as(u32, @intCast(index))); | |
| 773 | const id: ResultId = @fromBackingInt(@intCast(params_id_base + @as(u32, @intCast(index)))); | |
| 774 | 774 | self.section.writeOperand(ResultId, id); |
| 775 | 775 | } |
| 776 | 776 | } |
src/link/SpirV/prune_unused.zig+7-7| ... | ... | @@ -59,11 +59,11 @@ pub fn run(parser: *BinaryModule.Parser, binary: *BinaryModule) !void { |
| 59 | 59 | while (it.next()) |inst| { |
| 60 | 60 | if (inst.offset >= binary.functions_start) break; |
| 61 | 61 | if (inst.opcode == .OpDecorate and inst.operands.len >= 2 and |
| 62 | inst.operands[1] == @intFromEnum(spec.Decoration.linkage_attributes)) | |
| 62 | inst.operands[1] == @backingInt(spec.Decoration.linkage_attributes)) | |
| 63 | 63 | { |
| 64 | 64 | // Last word after the string is the linkage type; Export = 0. |
| 65 | if (inst.operands[inst.operands.len - 1] == @intFromEnum(spec.LinkageType.@"export")) { | |
| 66 | const target: ResultId = @enumFromInt(inst.operands[0]); | |
| 65 | if (inst.operands[inst.operands.len - 1] == @backingInt(spec.LinkageType.@"export")) { | |
| 66 | const target: ResultId = @fromBackingInt(@intCast(inst.operands[0])); | |
| 67 | 67 | if (id_to_index.get(target)) |index| { |
| 68 | 68 | alive.set(index); |
| 69 | 69 | } |
| ... | ... | @@ -133,7 +133,7 @@ pub fn run(parser: *BinaryModule.Parser, binary: *BinaryModule) !void { |
| 133 | 133 | } else { |
| 134 | 134 | // annotation-style: emit only if the target id is alive |
| 135 | 135 | if (inst.operands.len > 0) { |
| 136 | const target: ResultId = @enumFromInt(inst.operands[0]); | |
| 136 | const target: ResultId = @fromBackingInt(@intCast(inst.operands[0])); | |
| 137 | 137 | if (id_to_index.get(target)) |idx| { |
| 138 | 138 | if (!alive.isSet(idx)) continue; |
| 139 | 139 | } else continue; |
| ... | ... | @@ -199,14 +199,14 @@ fn markAlive( |
| 199 | 199 | var i = start; |
| 200 | 200 | while (i < end) : (i += 1) { |
| 201 | 201 | const off = id_offset_buf.items[i]; |
| 202 | const id: ResultId = @enumFromInt(inst.operands[off]); | |
| 202 | const id: ResultId = @fromBackingInt(@intCast(inst.operands[off])); | |
| 203 | 203 | const index = id_to_index.get(id) orelse continue; |
| 204 | 204 | if (alive.isSet(index)) continue; |
| 205 | 205 | alive.set(index); |
| 206 | 206 | |
| 207 | 207 | const offset = code_offsets.items[index]; |
| 208 | 208 | const ref_inst = BinaryModule.Instruction{ |
| 209 | .opcode = @enumFromInt(binary.instructions[offset] & 0xFFFF), | |
| 209 | .opcode = @fromBackingInt(@intCast(binary.instructions[offset] & 0xFFFF)), | |
| 210 | 210 | .offset = offset, |
| 211 | 211 | .operands = blk: { |
| 212 | 212 | const l = binary.instructions[offset] >> 16; |
| ... | ... | @@ -231,7 +231,7 @@ fn markAlive( |
| 231 | 231 | fn getResultId(inst: BinaryModule.Instruction, inst_spec: spec.Instruction) ?ResultId { |
| 232 | 232 | for (0..@min(2, inst_spec.operands.len)) |i| { |
| 233 | 233 | if (inst_spec.operands[i].kind == .id_result) { |
| 234 | if (i < inst.operands.len) return @enumFromInt(inst.operands[i]); | |
| 234 | if (i < inst.operands.len) return @fromBackingInt(@intCast(inst.operands[i])); | |
| 235 | 235 | } |
| 236 | 236 | } |
| 237 | 237 | return null; |
src/link/Wasm.zig+161-161| ... | ... | @@ -332,7 +332,7 @@ pub const ObjectIndex = enum(u32) { |
| 332 | 332 | _, |
| 333 | 333 | |
| 334 | 334 | pub fn ptr(index: ObjectIndex, wasm: *const Wasm) *Object { |
| 335 | return &wasm.objects.items[@intFromEnum(index)]; | |
| 335 | return &wasm.objects.items[@backingInt(index)]; | |
| 336 | 336 | } |
| 337 | 337 | }; |
| 338 | 338 | |
| ... | ... | @@ -341,7 +341,7 @@ pub const FunctionIndex = enum(u32) { |
| 341 | 341 | _, |
| 342 | 342 | |
| 343 | 343 | pub fn ptr(index: FunctionIndex, wasm: *const Wasm) *FunctionImport.Resolution { |
| 344 | return &wasm.functions.keys()[@intFromEnum(index)]; | |
| 344 | return &wasm.functions.keys()[@backingInt(index)]; | |
| 345 | 345 | } |
| 346 | 346 | |
| 347 | 347 | pub fn fromIpNav(wasm: *const Wasm, nav_index: InternPool.Nav.Index) ?FunctionIndex { |
| ... | ... | @@ -349,7 +349,7 @@ pub const FunctionIndex = enum(u32) { |
| 349 | 349 | } |
| 350 | 350 | |
| 351 | 351 | pub fn fromTagIndexType(wasm: *const Wasm, tag_type: InternPool.Index) ?FunctionIndex { |
| 352 | const zcu_func: ZcuFunc.Index = @enumFromInt(wasm.zcu_funcs.getIndex(tag_type) orelse return null); | |
| 352 | const zcu_func: ZcuFunc.Index = @fromBackingInt(@intCast(wasm.zcu_funcs.getIndex(tag_type) orelse return null)); | |
| 353 | 353 | return fromResolution(wasm, .pack(wasm, .{ .zcu_func = zcu_func })); |
| 354 | 354 | } |
| 355 | 355 | |
| ... | ... | @@ -364,7 +364,7 @@ pub const FunctionIndex = enum(u32) { |
| 364 | 364 | |
| 365 | 365 | pub fn fromResolution(wasm: *const Wasm, resolution: FunctionImport.Resolution) ?FunctionIndex { |
| 366 | 366 | const i = wasm.functions.getIndex(resolution) orelse return null; |
| 367 | return @enumFromInt(i); | |
| 367 | return @fromBackingInt(@intCast(i)); | |
| 368 | 368 | } |
| 369 | 369 | }; |
| 370 | 370 | |
| ... | ... | @@ -386,7 +386,7 @@ pub const OutputFunctionIndex = enum(u32) { |
| 386 | 386 | } |
| 387 | 387 | |
| 388 | 388 | pub fn fromFunctionIndex(wasm: *const Wasm, index: FunctionIndex) OutputFunctionIndex { |
| 389 | return @enumFromInt(wasm.flush_buffer.function_imports.entries.len + @intFromEnum(index)); | |
| 389 | return @fromBackingInt(@intCast(wasm.flush_buffer.function_imports.entries.len + @backingInt(index))); | |
| 390 | 390 | } |
| 391 | 391 | |
| 392 | 392 | pub fn fromObjectFunction(wasm: *const Wasm, index: ObjectFunctionIndex) OutputFunctionIndex { |
| ... | ... | @@ -428,7 +428,7 @@ pub const OutputFunctionIndex = enum(u32) { |
| 428 | 428 | } |
| 429 | 429 | |
| 430 | 430 | pub fn fromSymbolName(wasm: *const Wasm, name: String) OutputFunctionIndex { |
| 431 | if (wasm.flush_buffer.function_imports.getIndex(name)) |i| return @enumFromInt(i); | |
| 431 | if (wasm.flush_buffer.function_imports.getIndex(name)) |i| return @fromBackingInt(@intCast(i)); | |
| 432 | 432 | return fromFunctionIndex(wasm, FunctionIndex.fromSymbolName(wasm, name) orelse { |
| 433 | 433 | if (std.debug.runtime_safety) { |
| 434 | 434 | std.debug.panic("function index for symbol not found: {s}", .{name.slice(wasm)}); |
| ... | ... | @@ -442,7 +442,7 @@ pub const GlobalIndex = enum(u32) { |
| 442 | 442 | _, |
| 443 | 443 | |
| 444 | 444 | /// This is only accurate when not emitting an object and there is a Zcu. |
| 445 | pub const stack_pointer: GlobalIndex = @enumFromInt(0); | |
| 445 | pub const stack_pointer: GlobalIndex = @fromBackingInt(@intCast(0)); | |
| 446 | 446 | |
| 447 | 447 | /// Same as `stack_pointer` but with a safety assertion. |
| 448 | 448 | pub fn stackPointer(wasm: *const Wasm) ObjectGlobal.Index { |
| ... | ... | @@ -453,16 +453,16 @@ pub const GlobalIndex = enum(u32) { |
| 453 | 453 | } |
| 454 | 454 | |
| 455 | 455 | pub fn ptr(index: GlobalIndex, f: *const Flush) *Wasm.GlobalImport.Resolution { |
| 456 | return &f.globals.items[@intFromEnum(index)]; | |
| 456 | return &f.globals.items[@backingInt(index)]; | |
| 457 | 457 | } |
| 458 | 458 | |
| 459 | 459 | pub fn fromIpNav(wasm: *const Wasm, nav_index: InternPool.Nav.Index) ?GlobalIndex { |
| 460 | 460 | const i = wasm.globals.getIndex(.fromIpNav(wasm, nav_index)) orelse return null; |
| 461 | return @enumFromInt(i); | |
| 461 | return @fromBackingInt(@intCast(i)); | |
| 462 | 462 | } |
| 463 | 463 | |
| 464 | 464 | pub fn fromObjectGlobal(wasm: *const Wasm, i: ObjectGlobalIndex) GlobalIndex { |
| 465 | return @enumFromInt(wasm.globals.getIndex(.fromObjectGlobal(wasm, i)).?); | |
| 465 | return @fromBackingInt(@intCast(wasm.globals.getIndex(.fromObjectGlobal(wasm, i)).?)); | |
| 466 | 466 | } |
| 467 | 467 | |
| 468 | 468 | pub fn fromObjectGlobalHandlingWeak(wasm: *const Wasm, index: ObjectGlobalIndex) GlobalIndex { |
| ... | ... | @@ -475,7 +475,7 @@ pub const GlobalIndex = enum(u32) { |
| 475 | 475 | |
| 476 | 476 | pub fn fromSymbolName(wasm: *const Wasm, name: String) GlobalIndex { |
| 477 | 477 | const import = wasm.object_global_imports.getPtr(name).?; |
| 478 | return @enumFromInt(wasm.globals.getIndex(import.resolution).?); | |
| 478 | return @fromBackingInt(@intCast(wasm.globals.getIndex(import.resolution).?)); | |
| 479 | 479 | } |
| 480 | 480 | }; |
| 481 | 481 | |
| ... | ... | @@ -484,16 +484,16 @@ pub const TableIndex = enum(u32) { |
| 484 | 484 | _, |
| 485 | 485 | |
| 486 | 486 | pub fn ptr(index: TableIndex, f: *const Flush) *Wasm.TableImport.Resolution { |
| 487 | return &f.tables.items[@intFromEnum(index)]; | |
| 487 | return &f.tables.items[@backingInt(index)]; | |
| 488 | 488 | } |
| 489 | 489 | |
| 490 | 490 | pub fn fromObjectTable(wasm: *const Wasm, i: ObjectTableIndex) TableIndex { |
| 491 | return @enumFromInt(wasm.tables.getIndex(.fromObjectTable(i)).?); | |
| 491 | return @fromBackingInt(@intCast(wasm.tables.getIndex(.fromObjectTable(i)).?)); | |
| 492 | 492 | } |
| 493 | 493 | |
| 494 | 494 | pub fn fromSymbolName(wasm: *const Wasm, name: String) TableIndex { |
| 495 | 495 | const import = wasm.object_table_imports.getPtr(name).?; |
| 496 | return @enumFromInt(wasm.tables.getIndex(import.resolution).?); | |
| 496 | return @fromBackingInt(@intCast(wasm.tables.getIndex(import.resolution).?)); | |
| 497 | 497 | } |
| 498 | 498 | }; |
| 499 | 499 | |
| ... | ... | @@ -524,7 +524,7 @@ pub const SourceLocation = enum(u32) { |
| 524 | 524 | return switch (unpacked) { |
| 525 | 525 | .zig_object_nofile => .zig_object_nofile, |
| 526 | 526 | .none => .none, |
| 527 | .object_index => |object_index| @enumFromInt(@intFromEnum(object_index)), | |
| 527 | .object_index => |object_index| @fromBackingInt(@intCast(@backingInt(object_index))), | |
| 528 | 528 | .source_location_index => @panic("TODO"), |
| 529 | 529 | }; |
| 530 | 530 | } |
| ... | ... | @@ -534,8 +534,8 @@ pub const SourceLocation = enum(u32) { |
| 534 | 534 | .zig_object_nofile => .zig_object_nofile, |
| 535 | 535 | .none => .none, |
| 536 | 536 | _ => { |
| 537 | const i = @intFromEnum(sl); | |
| 538 | if (i < wasm.objects.items.len) return .{ .object_index = @enumFromInt(i) }; | |
| 537 | const i = @backingInt(sl); | |
| 538 | if (i < wasm.objects.items.len) return .{ .object_index = @fromBackingInt(@intCast(i)) }; | |
| 539 | 539 | const sl_index = i - wasm.objects.items.len; |
| 540 | 540 | _ = sl_index; |
| 541 | 541 | @panic("TODO"); |
| ... | ... | @@ -748,11 +748,11 @@ pub const NavsObjIndex = enum(u32) { |
| 748 | 748 | _, |
| 749 | 749 | |
| 750 | 750 | pub fn key(i: @This(), wasm: *const Wasm) *InternPool.Nav.Index { |
| 751 | return &wasm.navs_obj.keys()[@intFromEnum(i)]; | |
| 751 | return &wasm.navs_obj.keys()[@backingInt(i)]; | |
| 752 | 752 | } |
| 753 | 753 | |
| 754 | 754 | pub fn value(i: @This(), wasm: *const Wasm) *ZcuDataObj { |
| 755 | return &wasm.navs_obj.values()[@intFromEnum(i)]; | |
| 755 | return &wasm.navs_obj.values()[@backingInt(i)]; | |
| 756 | 756 | } |
| 757 | 757 | |
| 758 | 758 | pub fn name(i: @This(), wasm: *const Wasm) [:0]const u8 { |
| ... | ... | @@ -768,11 +768,11 @@ pub const NavsExeIndex = enum(u32) { |
| 768 | 768 | _, |
| 769 | 769 | |
| 770 | 770 | pub fn key(i: @This(), wasm: *const Wasm) *InternPool.Nav.Index { |
| 771 | return &wasm.navs_exe.keys()[@intFromEnum(i)]; | |
| 771 | return &wasm.navs_exe.keys()[@backingInt(i)]; | |
| 772 | 772 | } |
| 773 | 773 | |
| 774 | 774 | pub fn value(i: @This(), wasm: *const Wasm) *ZcuDataExe { |
| 775 | return &wasm.navs_exe.values()[@intFromEnum(i)]; | |
| 775 | return &wasm.navs_exe.values()[@backingInt(i)]; | |
| 776 | 776 | } |
| 777 | 777 | |
| 778 | 778 | pub fn name(i: @This(), wasm: *const Wasm) [:0]const u8 { |
| ... | ... | @@ -788,11 +788,11 @@ pub const UavsObjIndex = enum(u32) { |
| 788 | 788 | _, |
| 789 | 789 | |
| 790 | 790 | pub fn key(i: @This(), wasm: *const Wasm) *InternPool.Index { |
| 791 | return &wasm.uavs_obj.keys()[@intFromEnum(i)]; | |
| 791 | return &wasm.uavs_obj.keys()[@backingInt(i)]; | |
| 792 | 792 | } |
| 793 | 793 | |
| 794 | 794 | pub fn value(i: @This(), wasm: *const Wasm) *ZcuDataObj { |
| 795 | return &wasm.uavs_obj.values()[@intFromEnum(i)]; | |
| 795 | return &wasm.uavs_obj.values()[@backingInt(i)]; | |
| 796 | 796 | } |
| 797 | 797 | }; |
| 798 | 798 | |
| ... | ... | @@ -801,11 +801,11 @@ pub const UavsExeIndex = enum(u32) { |
| 801 | 801 | _, |
| 802 | 802 | |
| 803 | 803 | pub fn key(i: @This(), wasm: *const Wasm) *InternPool.Index { |
| 804 | return &wasm.uavs_exe.keys()[@intFromEnum(i)]; | |
| 804 | return &wasm.uavs_exe.keys()[@backingInt(i)]; | |
| 805 | 805 | } |
| 806 | 806 | |
| 807 | 807 | pub fn value(i: @This(), wasm: *const Wasm) *ZcuDataExe { |
| 808 | return &wasm.uavs_exe.values()[@intFromEnum(i)]; | |
| 808 | return &wasm.uavs_exe.values()[@backingInt(i)]; | |
| 809 | 809 | } |
| 810 | 810 | }; |
| 811 | 811 | |
| ... | ... | @@ -899,11 +899,11 @@ pub const ZcuFunc = union { |
| 899 | 899 | _, |
| 900 | 900 | |
| 901 | 901 | pub fn key(i: @This(), wasm: *const Wasm) *InternPool.Index { |
| 902 | return &wasm.zcu_funcs.keys()[@intFromEnum(i)]; | |
| 902 | return &wasm.zcu_funcs.keys()[@backingInt(i)]; | |
| 903 | 903 | } |
| 904 | 904 | |
| 905 | 905 | pub fn value(i: @This(), wasm: *const Wasm) *ZcuFunc { |
| 906 | return &wasm.zcu_funcs.values()[@intFromEnum(i)]; | |
| 906 | return &wasm.zcu_funcs.values()[@backingInt(i)]; | |
| 907 | 907 | } |
| 908 | 908 | |
| 909 | 909 | pub fn name(i: @This(), wasm: *const Wasm) [:0]const u8 { |
| ... | ... | @@ -972,7 +972,7 @@ pub const FunctionImport = extern struct { |
| 972 | 972 | // Next, index into `zcu_funcs`. |
| 973 | 973 | _, |
| 974 | 974 | |
| 975 | const first_object_function = @intFromEnum(Resolution.__wasm_init_tls) + 1; | |
| 975 | const first_object_function = @backingInt(Resolution.__wasm_init_tls) + 1; | |
| 976 | 976 | |
| 977 | 977 | pub const Unpacked = union(enum) { |
| 978 | 978 | unresolved, |
| ... | ... | @@ -992,14 +992,14 @@ pub const FunctionImport = extern struct { |
| 992 | 992 | .__wasm_init_memory => .__wasm_init_memory, |
| 993 | 993 | .__wasm_init_tls => .__wasm_init_tls, |
| 994 | 994 | _ => { |
| 995 | const object_function_index = @intFromEnum(r) - first_object_function; | |
| 995 | const object_function_index = @backingInt(r) - first_object_function; | |
| 996 | 996 | |
| 997 | 997 | const zcu_func_index = if (object_function_index < wasm.object_functions.items.len) |
| 998 | return .{ .object_function = @enumFromInt(object_function_index) } | |
| 998 | return .{ .object_function = @fromBackingInt(@intCast(object_function_index)) } | |
| 999 | 999 | else |
| 1000 | 1000 | object_function_index - wasm.object_functions.items.len; |
| 1001 | 1001 | |
| 1002 | return .{ .zcu_func = @enumFromInt(zcu_func_index) }; | |
| 1002 | return .{ .zcu_func = @fromBackingInt(@intCast(zcu_func_index)) }; | |
| 1003 | 1003 | }, |
| 1004 | 1004 | }; |
| 1005 | 1005 | } |
| ... | ... | @@ -1011,8 +1011,8 @@ pub const FunctionImport = extern struct { |
| 1011 | 1011 | .__wasm_call_ctors => .__wasm_call_ctors, |
| 1012 | 1012 | .__wasm_init_memory => .__wasm_init_memory, |
| 1013 | 1013 | .__wasm_init_tls => .__wasm_init_tls, |
| 1014 | .object_function => |i| @enumFromInt(first_object_function + @intFromEnum(i)), | |
| 1015 | .zcu_func => |i| @enumFromInt(first_object_function + wasm.object_functions.items.len + @intFromEnum(i)), | |
| 1014 | .object_function => |i| @fromBackingInt(@intCast(first_object_function + @backingInt(i))), | |
| 1015 | .zcu_func => |i| @fromBackingInt(@intCast(first_object_function + wasm.object_functions.items.len + @backingInt(i))), | |
| 1016 | 1016 | }; |
| 1017 | 1017 | } |
| 1018 | 1018 | |
| ... | ... | @@ -1027,7 +1027,7 @@ pub const FunctionImport = extern struct { |
| 1027 | 1027 | } |
| 1028 | 1028 | |
| 1029 | 1029 | pub fn fromIpIndex(wasm: *const Wasm, ip_index: InternPool.Index) Resolution { |
| 1030 | return fromZcuFunc(wasm, @enumFromInt(wasm.zcu_funcs.getIndex(ip_index).?)); | |
| 1030 | return fromZcuFunc(wasm, @fromBackingInt(@intCast(wasm.zcu_funcs.getIndex(ip_index).?))); | |
| 1031 | 1031 | } |
| 1032 | 1032 | |
| 1033 | 1033 | pub fn fromObjectFunction(wasm: *const Wasm, object_function: ObjectFunctionIndex) Resolution { |
| ... | ... | @@ -1072,11 +1072,11 @@ pub const FunctionImport = extern struct { |
| 1072 | 1072 | _, |
| 1073 | 1073 | |
| 1074 | 1074 | pub fn key(index: Index, wasm: *const Wasm) *String { |
| 1075 | return &wasm.object_function_imports.keys()[@intFromEnum(index)]; | |
| 1075 | return &wasm.object_function_imports.keys()[@backingInt(index)]; | |
| 1076 | 1076 | } |
| 1077 | 1077 | |
| 1078 | 1078 | pub fn value(index: Index, wasm: *const Wasm) *FunctionImport { |
| 1079 | return &wasm.object_function_imports.values()[@intFromEnum(index)]; | |
| 1079 | return &wasm.object_function_imports.values()[@backingInt(index)]; | |
| 1080 | 1080 | } |
| 1081 | 1081 | |
| 1082 | 1082 | pub fn symbolName(index: Index, wasm: *const Wasm) String { |
| ... | ... | @@ -1139,7 +1139,7 @@ pub const GlobalImport = extern struct { |
| 1139 | 1139 | // Next, index into `navs_obj` or `navs_exe` depending on whether emitting an object. |
| 1140 | 1140 | _, |
| 1141 | 1141 | |
| 1142 | const first_object_global = @intFromEnum(Resolution.__tls_size) + 1; | |
| 1142 | const first_object_global = @backingInt(Resolution.__tls_size) + 1; | |
| 1143 | 1143 | |
| 1144 | 1144 | pub const Unpacked = union(enum) { |
| 1145 | 1145 | unresolved, |
| ... | ... | @@ -1164,17 +1164,17 @@ pub const GlobalImport = extern struct { |
| 1164 | 1164 | .__tls_base => .__tls_base, |
| 1165 | 1165 | .__tls_size => .__tls_size, |
| 1166 | 1166 | _ => { |
| 1167 | const i: u32 = @intFromEnum(r); | |
| 1167 | const i: u32 = @backingInt(r); | |
| 1168 | 1168 | const object_global_index = i - first_object_global; |
| 1169 | 1169 | if (object_global_index < wasm.object_globals.items.len) |
| 1170 | return .{ .object_global = @enumFromInt(object_global_index) }; | |
| 1170 | return .{ .object_global = @fromBackingInt(@intCast(object_global_index)) }; | |
| 1171 | 1171 | const comp = wasm.base.comp; |
| 1172 | 1172 | const is_obj = comp.config.output_mode == .Obj; |
| 1173 | 1173 | const nav_index = object_global_index - wasm.object_globals.items.len; |
| 1174 | 1174 | return if (is_obj) .{ |
| 1175 | .nav_obj = @enumFromInt(nav_index), | |
| 1175 | .nav_obj = @fromBackingInt(@intCast(nav_index)), | |
| 1176 | 1176 | } else .{ |
| 1177 | .nav_exe = @enumFromInt(nav_index), | |
| 1177 | .nav_exe = @fromBackingInt(@intCast(nav_index)), | |
| 1178 | 1178 | }; |
| 1179 | 1179 | }, |
| 1180 | 1180 | }; |
| ... | ... | @@ -1189,9 +1189,9 @@ pub const GlobalImport = extern struct { |
| 1189 | 1189 | .__tls_align => .__tls_align, |
| 1190 | 1190 | .__tls_base => .__tls_base, |
| 1191 | 1191 | .__tls_size => .__tls_size, |
| 1192 | .object_global => |i| @enumFromInt(first_object_global + @intFromEnum(i)), | |
| 1193 | .nav_obj => |i| @enumFromInt(first_object_global + wasm.object_globals.items.len + @intFromEnum(i)), | |
| 1194 | .nav_exe => |i| @enumFromInt(first_object_global + wasm.object_globals.items.len + @intFromEnum(i)), | |
| 1192 | .object_global => |i| @fromBackingInt(@intCast(first_object_global + @backingInt(i))), | |
| 1193 | .nav_obj => |i| @fromBackingInt(@intCast(first_object_global + wasm.object_globals.items.len + @backingInt(i))), | |
| 1194 | .nav_exe => |i| @fromBackingInt(@intCast(first_object_global + wasm.object_globals.items.len + @backingInt(i))), | |
| 1195 | 1195 | }; |
| 1196 | 1196 | } |
| 1197 | 1197 | |
| ... | ... | @@ -1199,9 +1199,9 @@ pub const GlobalImport = extern struct { |
| 1199 | 1199 | const comp = wasm.base.comp; |
| 1200 | 1200 | const is_obj = comp.config.output_mode == .Obj; |
| 1201 | 1201 | return pack(wasm, if (is_obj) .{ |
| 1202 | .nav_obj = @enumFromInt(wasm.navs_obj.getIndex(ip_nav).?), | |
| 1202 | .nav_obj = @fromBackingInt(@intCast(wasm.navs_obj.getIndex(ip_nav).?)), | |
| 1203 | 1203 | } else .{ |
| 1204 | .nav_exe = @enumFromInt(wasm.navs_exe.getIndex(ip_nav).?), | |
| 1204 | .nav_exe = @fromBackingInt(@intCast(wasm.navs_exe.getIndex(ip_nav).?)), | |
| 1205 | 1205 | }); |
| 1206 | 1206 | } |
| 1207 | 1207 | |
| ... | ... | @@ -1230,11 +1230,11 @@ pub const GlobalImport = extern struct { |
| 1230 | 1230 | _, |
| 1231 | 1231 | |
| 1232 | 1232 | pub fn key(index: Index, wasm: *const Wasm) *String { |
| 1233 | return &wasm.object_global_imports.keys()[@intFromEnum(index)]; | |
| 1233 | return &wasm.object_global_imports.keys()[@backingInt(index)]; | |
| 1234 | 1234 | } |
| 1235 | 1235 | |
| 1236 | 1236 | pub fn value(index: Index, wasm: *const Wasm) *GlobalImport { |
| 1237 | return &wasm.object_global_imports.values()[@intFromEnum(index)]; | |
| 1237 | return &wasm.object_global_imports.values()[@backingInt(index)]; | |
| 1238 | 1238 | } |
| 1239 | 1239 | |
| 1240 | 1240 | pub fn symbolName(index: Index, wasm: *const Wasm) String { |
| ... | ... | @@ -1321,7 +1321,7 @@ pub const TableImport = extern struct { |
| 1321 | 1321 | // Next, index into `object_tables`. |
| 1322 | 1322 | _, |
| 1323 | 1323 | |
| 1324 | const first_object_table = @intFromEnum(Resolution.__indirect_function_table) + 1; | |
| 1324 | const first_object_table = @backingInt(Resolution.__indirect_function_table) + 1; | |
| 1325 | 1325 | |
| 1326 | 1326 | pub const Unpacked = union(enum) { |
| 1327 | 1327 | unresolved, |
| ... | ... | @@ -1333,7 +1333,7 @@ pub const TableImport = extern struct { |
| 1333 | 1333 | return switch (r) { |
| 1334 | 1334 | .unresolved => .unresolved, |
| 1335 | 1335 | .__indirect_function_table => .__indirect_function_table, |
| 1336 | _ => .{ .object_table = @enumFromInt(@intFromEnum(r) - first_object_table) }, | |
| 1336 | _ => .{ .object_table = @fromBackingInt(@intCast(@backingInt(r) - first_object_table)) }, | |
| 1337 | 1337 | }; |
| 1338 | 1338 | } |
| 1339 | 1339 | |
| ... | ... | @@ -1341,7 +1341,7 @@ pub const TableImport = extern struct { |
| 1341 | 1341 | return switch (unpacked) { |
| 1342 | 1342 | .unresolved => .unresolved, |
| 1343 | 1343 | .__indirect_function_table => .__indirect_function_table, |
| 1344 | .object_table => |i| @enumFromInt(first_object_table + @intFromEnum(i)), | |
| 1344 | .object_table => |i| @fromBackingInt(@intCast(first_object_table + @backingInt(i))), | |
| 1345 | 1345 | }; |
| 1346 | 1346 | } |
| 1347 | 1347 | |
| ... | ... | @@ -1375,11 +1375,11 @@ pub const TableImport = extern struct { |
| 1375 | 1375 | _, |
| 1376 | 1376 | |
| 1377 | 1377 | pub fn key(index: Index, wasm: *const Wasm) *String { |
| 1378 | return &wasm.object_table_imports.keys()[@intFromEnum(index)]; | |
| 1378 | return &wasm.object_table_imports.keys()[@backingInt(index)]; | |
| 1379 | 1379 | } |
| 1380 | 1380 | |
| 1381 | 1381 | pub fn value(index: Index, wasm: *const Wasm) *TableImport { |
| 1382 | return &wasm.object_table_imports.values()[@intFromEnum(index)]; | |
| 1382 | return &wasm.object_table_imports.values()[@backingInt(index)]; | |
| 1383 | 1383 | } |
| 1384 | 1384 | |
| 1385 | 1385 | pub fn name(index: Index, wasm: *const Wasm) String { |
| ... | ... | @@ -1434,7 +1434,7 @@ pub const ObjectTableIndex = enum(u32) { |
| 1434 | 1434 | _, |
| 1435 | 1435 | |
| 1436 | 1436 | pub fn ptr(index: ObjectTableIndex, wasm: *const Wasm) *Table { |
| 1437 | return &wasm.object_tables.items[@intFromEnum(index)]; | |
| 1437 | return &wasm.object_tables.items[@backingInt(index)]; | |
| 1438 | 1438 | } |
| 1439 | 1439 | |
| 1440 | 1440 | pub fn chaseWeak(i: ObjectTableIndex, wasm: *const Wasm) ObjectTableIndex { |
| ... | ... | @@ -1452,7 +1452,7 @@ pub const ObjectGlobalIndex = enum(u32) { |
| 1452 | 1452 | _, |
| 1453 | 1453 | |
| 1454 | 1454 | pub fn ptr(index: ObjectGlobalIndex, wasm: *const Wasm) *ObjectGlobal { |
| 1455 | return &wasm.object_globals.items[@intFromEnum(index)]; | |
| 1455 | return &wasm.object_globals.items[@backingInt(index)]; | |
| 1456 | 1456 | } |
| 1457 | 1457 | |
| 1458 | 1458 | pub fn name(index: ObjectGlobalIndex, wasm: *const Wasm) OptionalString { |
| ... | ... | @@ -1480,7 +1480,7 @@ pub const ObjectMemory = extern struct { |
| 1480 | 1480 | _, |
| 1481 | 1481 | |
| 1482 | 1482 | pub fn ptr(index: Index, wasm: *const Wasm) *ObjectMemory { |
| 1483 | return &wasm.object_memories.items[@intFromEnum(index)]; | |
| 1483 | return &wasm.object_memories.items[@backingInt(index)]; | |
| 1484 | 1484 | } |
| 1485 | 1485 | }; |
| 1486 | 1486 | |
| ... | ... | @@ -1501,11 +1501,11 @@ pub const ObjectFunctionIndex = enum(u32) { |
| 1501 | 1501 | _, |
| 1502 | 1502 | |
| 1503 | 1503 | pub fn ptr(index: ObjectFunctionIndex, wasm: *const Wasm) *ObjectFunction { |
| 1504 | return &wasm.object_functions.items[@intFromEnum(index)]; | |
| 1504 | return &wasm.object_functions.items[@backingInt(index)]; | |
| 1505 | 1505 | } |
| 1506 | 1506 | |
| 1507 | 1507 | pub fn toOptional(i: ObjectFunctionIndex) OptionalObjectFunctionIndex { |
| 1508 | const result: OptionalObjectFunctionIndex = @enumFromInt(@intFromEnum(i)); | |
| 1508 | const result: OptionalObjectFunctionIndex = @fromBackingInt(@intCast(@backingInt(i))); | |
| 1509 | 1509 | assert(result != .none); |
| 1510 | 1510 | return result; |
| 1511 | 1511 | } |
| ... | ... | @@ -1527,7 +1527,7 @@ pub const OptionalObjectFunctionIndex = enum(u32) { |
| 1527 | 1527 | |
| 1528 | 1528 | pub fn unwrap(i: OptionalObjectFunctionIndex) ?ObjectFunctionIndex { |
| 1529 | 1529 | if (i == .none) return null; |
| 1530 | return @enumFromInt(@intFromEnum(i)); | |
| 1530 | return @fromBackingInt(@intCast(@backingInt(i))); | |
| 1531 | 1531 | } |
| 1532 | 1532 | }; |
| 1533 | 1533 | |
| ... | ... | @@ -1562,7 +1562,7 @@ pub const ObjectDataSegment = extern struct { |
| 1562 | 1562 | _, |
| 1563 | 1563 | |
| 1564 | 1564 | pub fn ptr(i: Index, wasm: *const Wasm) *ObjectDataSegment { |
| 1565 | return &wasm.object_data_segments.items[@intFromEnum(i)]; | |
| 1565 | return &wasm.object_data_segments.items[@backingInt(i)]; | |
| 1566 | 1566 | } |
| 1567 | 1567 | }; |
| 1568 | 1568 | |
| ... | ... | @@ -1588,7 +1588,7 @@ pub const ObjectData = extern struct { |
| 1588 | 1588 | _, |
| 1589 | 1589 | |
| 1590 | 1590 | pub fn ptr(i: Index, wasm: *const Wasm) *ObjectData { |
| 1591 | return &wasm.object_datas.items[@intFromEnum(i)]; | |
| 1591 | return &wasm.object_datas.items[@backingInt(i)]; | |
| 1592 | 1592 | } |
| 1593 | 1593 | }; |
| 1594 | 1594 | }; |
| ... | ... | @@ -1609,7 +1609,7 @@ pub const ObjectDataImport = extern struct { |
| 1609 | 1609 | /// Next, index into `navs_obj` or `navs_exe` depending on whether emitting an object. |
| 1610 | 1610 | _, |
| 1611 | 1611 | |
| 1612 | const first_object = @intFromEnum(Resolution.__heap_end) + 1; | |
| 1612 | const first_object = @backingInt(Resolution.__heap_end) + 1; | |
| 1613 | 1613 | |
| 1614 | 1614 | pub const Unpacked = union(enum) { |
| 1615 | 1615 | unresolved, |
| ... | ... | @@ -1632,10 +1632,10 @@ pub const ObjectDataImport = extern struct { |
| 1632 | 1632 | .__heap_base => .__heap_base, |
| 1633 | 1633 | .__heap_end => .__heap_end, |
| 1634 | 1634 | _ => { |
| 1635 | const object_index = @intFromEnum(r) - first_object; | |
| 1635 | const object_index = @backingInt(r) - first_object; | |
| 1636 | 1636 | |
| 1637 | 1637 | const uav_index = if (object_index < wasm.object_datas.items.len) |
| 1638 | return .{ .object = @enumFromInt(object_index) } | |
| 1638 | return .{ .object = @fromBackingInt(@intCast(object_index)) } | |
| 1639 | 1639 | else |
| 1640 | 1640 | object_index - wasm.object_datas.items.len; |
| 1641 | 1641 | |
| ... | ... | @@ -1643,18 +1643,18 @@ pub const ObjectDataImport = extern struct { |
| 1643 | 1643 | const is_obj = comp.config.output_mode == .Obj; |
| 1644 | 1644 | if (is_obj) { |
| 1645 | 1645 | const nav_index = if (uav_index < wasm.uavs_obj.entries.len) |
| 1646 | return .{ .uav_obj = @enumFromInt(uav_index) } | |
| 1646 | return .{ .uav_obj = @fromBackingInt(@intCast(uav_index)) } | |
| 1647 | 1647 | else |
| 1648 | 1648 | uav_index - wasm.uavs_obj.entries.len; |
| 1649 | 1649 | |
| 1650 | return .{ .nav_obj = @enumFromInt(nav_index) }; | |
| 1650 | return .{ .nav_obj = @fromBackingInt(@intCast(nav_index)) }; | |
| 1651 | 1651 | } else { |
| 1652 | 1652 | const nav_index = if (uav_index < wasm.uavs_exe.entries.len) |
| 1653 | return .{ .uav_exe = @enumFromInt(uav_index) } | |
| 1653 | return .{ .uav_exe = @fromBackingInt(@intCast(uav_index)) } | |
| 1654 | 1654 | else |
| 1655 | 1655 | uav_index - wasm.uavs_exe.entries.len; |
| 1656 | 1656 | |
| 1657 | return .{ .nav_exe = @enumFromInt(nav_index) }; | |
| 1657 | return .{ .nav_exe = @fromBackingInt(@intCast(nav_index)) }; | |
| 1658 | 1658 | } |
| 1659 | 1659 | }, |
| 1660 | 1660 | }; |
| ... | ... | @@ -1667,10 +1667,10 @@ pub const ObjectDataImport = extern struct { |
| 1667 | 1667 | .__zig_error_name_table => .__zig_error_name_table, |
| 1668 | 1668 | .__heap_base => .__heap_base, |
| 1669 | 1669 | .__heap_end => .__heap_end, |
| 1670 | .object => |i| @enumFromInt(first_object + @intFromEnum(i)), | |
| 1671 | inline .uav_exe, .uav_obj => |i| @enumFromInt(first_object + wasm.object_datas.items.len + @intFromEnum(i)), | |
| 1672 | .nav_exe => |i| @enumFromInt(first_object + wasm.object_datas.items.len + wasm.uavs_exe.entries.len + @intFromEnum(i)), | |
| 1673 | .nav_obj => |i| @enumFromInt(first_object + wasm.object_datas.items.len + wasm.uavs_obj.entries.len + @intFromEnum(i)), | |
| 1670 | .object => |i| @fromBackingInt(@intCast(first_object + @backingInt(i))), | |
| 1671 | inline .uav_exe, .uav_obj => |i| @fromBackingInt(@intCast(first_object + wasm.object_datas.items.len + @backingInt(i))), | |
| 1672 | .nav_exe => |i| @fromBackingInt(@intCast(first_object + wasm.object_datas.items.len + wasm.uavs_exe.entries.len + @backingInt(i))), | |
| 1673 | .nav_obj => |i| @fromBackingInt(@intCast(first_object + wasm.object_datas.items.len + wasm.uavs_obj.entries.len + @backingInt(i))), | |
| 1674 | 1674 | }; |
| 1675 | 1675 | } |
| 1676 | 1676 | |
| ... | ... | @@ -1721,11 +1721,11 @@ pub const ObjectDataImport = extern struct { |
| 1721 | 1721 | _, |
| 1722 | 1722 | |
| 1723 | 1723 | pub fn value(i: @This(), wasm: *const Wasm) *ObjectDataImport { |
| 1724 | return &wasm.object_data_imports.values()[@intFromEnum(i)]; | |
| 1724 | return &wasm.object_data_imports.values()[@backingInt(i)]; | |
| 1725 | 1725 | } |
| 1726 | 1726 | |
| 1727 | 1727 | pub fn fromSymbolName(wasm: *const Wasm, name: String) ?Index { |
| 1728 | return @enumFromInt(wasm.object_data_imports.getIndex(name) orelse return null); | |
| 1728 | return @fromBackingInt(@intCast(wasm.object_data_imports.getIndex(name) orelse return null)); | |
| 1729 | 1729 | } |
| 1730 | 1730 | }; |
| 1731 | 1731 | }; |
| ... | ... | @@ -1742,7 +1742,7 @@ pub const DataPayload = extern struct { |
| 1742 | 1742 | _, |
| 1743 | 1743 | |
| 1744 | 1744 | pub fn unwrap(off: Off) ?u32 { |
| 1745 | return if (off == .none) null else @intFromEnum(off); | |
| 1745 | return if (off == .none) null else @backingInt(off); | |
| 1746 | 1746 | } |
| 1747 | 1747 | }; |
| 1748 | 1748 | |
| ... | ... | @@ -1769,7 +1769,7 @@ pub const DataSegmentId = enum(u32) { |
| 1769 | 1769 | /// Next, index into `navs_obj` or `navs_exe` depending on whether emitting an object. |
| 1770 | 1770 | _, |
| 1771 | 1771 | |
| 1772 | const first_object = @intFromEnum(DataSegmentId.__heap_end) + 1; | |
| 1772 | const first_object = @backingInt(DataSegmentId.__heap_end) + 1; | |
| 1773 | 1773 | |
| 1774 | 1774 | pub const Category = enum { |
| 1775 | 1775 | /// Thread-local variables. |
| ... | ... | @@ -1803,10 +1803,10 @@ pub const DataSegmentId = enum(u32) { |
| 1803 | 1803 | .__zig_tag_name_table => .__zig_tag_name_table, |
| 1804 | 1804 | .__heap_base => .__heap_base, |
| 1805 | 1805 | .__heap_end => .__heap_end, |
| 1806 | .object => |i| @enumFromInt(first_object + @intFromEnum(i)), | |
| 1807 | inline .uav_exe, .uav_obj => |i| @enumFromInt(first_object + wasm.object_data_segments.items.len + @intFromEnum(i)), | |
| 1808 | .nav_exe => |i| @enumFromInt(first_object + wasm.object_data_segments.items.len + wasm.uavs_exe.entries.len + @intFromEnum(i)), | |
| 1809 | .nav_obj => |i| @enumFromInt(first_object + wasm.object_data_segments.items.len + wasm.uavs_obj.entries.len + @intFromEnum(i)), | |
| 1806 | .object => |i| @fromBackingInt(@intCast(first_object + @backingInt(i))), | |
| 1807 | inline .uav_exe, .uav_obj => |i| @fromBackingInt(@intCast(first_object + wasm.object_data_segments.items.len + @backingInt(i))), | |
| 1808 | .nav_exe => |i| @fromBackingInt(@intCast(first_object + wasm.object_data_segments.items.len + wasm.uavs_exe.entries.len + @backingInt(i))), | |
| 1809 | .nav_obj => |i| @fromBackingInt(@intCast(first_object + wasm.object_data_segments.items.len + wasm.uavs_obj.entries.len + @backingInt(i))), | |
| 1810 | 1810 | }; |
| 1811 | 1811 | } |
| 1812 | 1812 | |
| ... | ... | @@ -1819,10 +1819,10 @@ pub const DataSegmentId = enum(u32) { |
| 1819 | 1819 | .__heap_base => .__heap_base, |
| 1820 | 1820 | .__heap_end => .__heap_end, |
| 1821 | 1821 | _ => { |
| 1822 | const object_index = @intFromEnum(id) - first_object; | |
| 1822 | const object_index = @backingInt(id) - first_object; | |
| 1823 | 1823 | |
| 1824 | 1824 | const uav_index = if (object_index < wasm.object_data_segments.items.len) |
| 1825 | return .{ .object = @enumFromInt(object_index) } | |
| 1825 | return .{ .object = @fromBackingInt(@intCast(object_index)) } | |
| 1826 | 1826 | else |
| 1827 | 1827 | object_index - wasm.object_data_segments.items.len; |
| 1828 | 1828 | |
| ... | ... | @@ -1830,18 +1830,18 @@ pub const DataSegmentId = enum(u32) { |
| 1830 | 1830 | const is_obj = comp.config.output_mode == .Obj; |
| 1831 | 1831 | if (is_obj) { |
| 1832 | 1832 | const nav_index = if (uav_index < wasm.uavs_obj.entries.len) |
| 1833 | return .{ .uav_obj = @enumFromInt(uav_index) } | |
| 1833 | return .{ .uav_obj = @fromBackingInt(@intCast(uav_index)) } | |
| 1834 | 1834 | else |
| 1835 | 1835 | uav_index - wasm.uavs_obj.entries.len; |
| 1836 | 1836 | |
| 1837 | return .{ .nav_obj = @enumFromInt(nav_index) }; | |
| 1837 | return .{ .nav_obj = @fromBackingInt(@intCast(nav_index)) }; | |
| 1838 | 1838 | } else { |
| 1839 | 1839 | const nav_index = if (uav_index < wasm.uavs_exe.entries.len) |
| 1840 | return .{ .uav_exe = @enumFromInt(uav_index) } | |
| 1840 | return .{ .uav_exe = @fromBackingInt(@intCast(uav_index)) } | |
| 1841 | 1841 | else |
| 1842 | 1842 | uav_index - wasm.uavs_exe.entries.len; |
| 1843 | 1843 | |
| 1844 | return .{ .nav_exe = @enumFromInt(nav_index) }; | |
| 1844 | return .{ .nav_exe = @fromBackingInt(@intCast(nav_index)) }; | |
| 1845 | 1845 | } |
| 1846 | 1846 | }, |
| 1847 | 1847 | }; |
| ... | ... | @@ -1851,9 +1851,9 @@ pub const DataSegmentId = enum(u32) { |
| 1851 | 1851 | const comp = wasm.base.comp; |
| 1852 | 1852 | const is_obj = comp.config.output_mode == .Obj; |
| 1853 | 1853 | return pack(wasm, if (is_obj) .{ |
| 1854 | .nav_obj = @enumFromInt(wasm.navs_obj.getIndex(nav_index).?), | |
| 1854 | .nav_obj = @fromBackingInt(@intCast(wasm.navs_obj.getIndex(nav_index).?)), | |
| 1855 | 1855 | } else .{ |
| 1856 | .nav_exe = @enumFromInt(wasm.navs_exe.getIndex(nav_index).?), | |
| 1856 | .nav_exe = @fromBackingInt(@intCast(wasm.navs_exe.getIndex(nav_index).?)), | |
| 1857 | 1857 | }); |
| 1858 | 1858 | } |
| 1859 | 1859 | |
| ... | ... | @@ -2086,10 +2086,10 @@ pub const CustomSegment = extern struct { |
| 2086 | 2086 | pub const Expr = enum(u32) { |
| 2087 | 2087 | _, |
| 2088 | 2088 | |
| 2089 | pub const end = @intFromEnum(std.wasm.Opcode.end); | |
| 2089 | pub const end = @backingInt(std.wasm.Opcode.end); | |
| 2090 | 2090 | |
| 2091 | 2091 | pub fn slice(index: Expr, wasm: *const Wasm) [:end]const u8 { |
| 2092 | const start_slice = wasm.string_bytes.items[@intFromEnum(index)..]; | |
| 2092 | const start_slice = wasm.string_bytes.items[@backingInt(index)..]; | |
| 2093 | 2093 | const end_pos = Object.exprEndPos(start_slice, 0) catch |err| switch (err) { |
| 2094 | 2094 | error.InvalidInitOpcode => unreachable, |
| 2095 | 2095 | }; |
| ... | ... | @@ -2106,7 +2106,7 @@ pub const FunctionType = extern struct { |
| 2106 | 2106 | _, |
| 2107 | 2107 | |
| 2108 | 2108 | pub fn ptr(i: Index, wasm: *const Wasm) *FunctionType { |
| 2109 | return &wasm.func_types.keys()[@intFromEnum(i)]; | |
| 2109 | return &wasm.func_types.keys()[@backingInt(i)]; | |
| 2110 | 2110 | } |
| 2111 | 2111 | |
| 2112 | 2112 | pub fn fmt(i: Index, wasm: *const Wasm) Formatter { |
| ... | ... | @@ -2197,7 +2197,7 @@ pub const String = enum(u32) { |
| 2197 | 2197 | } |
| 2198 | 2198 | |
| 2199 | 2199 | pub fn hash(ctx: @This(), key: String) u64 { |
| 2200 | return std.hash_map.hashString(mem.sliceTo(ctx.bytes[@intFromEnum(key)..], 0)); | |
| 2200 | return std.hash_map.hashString(mem.sliceTo(ctx.bytes[@backingInt(key)..], 0)); | |
| 2201 | 2201 | } |
| 2202 | 2202 | }; |
| 2203 | 2203 | |
| ... | ... | @@ -2205,7 +2205,7 @@ pub const String = enum(u32) { |
| 2205 | 2205 | bytes: []const u8, |
| 2206 | 2206 | |
| 2207 | 2207 | pub fn eql(ctx: @This(), a: []const u8, b: String) bool { |
| 2208 | return mem.eql(u8, a, mem.sliceTo(ctx.bytes[@intFromEnum(b)..], 0)); | |
| 2208 | return mem.eql(u8, a, mem.sliceTo(ctx.bytes[@backingInt(b)..], 0)); | |
| 2209 | 2209 | } |
| 2210 | 2210 | |
| 2211 | 2211 | pub fn hash(_: @This(), adapted_key: []const u8) u64 { |
| ... | ... | @@ -2215,12 +2215,12 @@ pub const String = enum(u32) { |
| 2215 | 2215 | }; |
| 2216 | 2216 | |
| 2217 | 2217 | pub fn slice(index: String, wasm: *const Wasm) [:0]const u8 { |
| 2218 | const start_slice = wasm.string_bytes.items[@intFromEnum(index)..]; | |
| 2218 | const start_slice = wasm.string_bytes.items[@backingInt(index)..]; | |
| 2219 | 2219 | return start_slice[0..mem.indexOfScalar(u8, start_slice, 0).? :0]; |
| 2220 | 2220 | } |
| 2221 | 2221 | |
| 2222 | 2222 | pub fn toOptional(i: String) OptionalString { |
| 2223 | const result: OptionalString = @enumFromInt(@intFromEnum(i)); | |
| 2223 | const result: OptionalString = @fromBackingInt(@intCast(@backingInt(i))); | |
| 2224 | 2224 | assert(result != .none); |
| 2225 | 2225 | return result; |
| 2226 | 2226 | } |
| ... | ... | @@ -2232,7 +2232,7 @@ pub const OptionalString = enum(u32) { |
| 2232 | 2232 | |
| 2233 | 2233 | pub fn unwrap(i: OptionalString) ?String { |
| 2234 | 2234 | if (i == .none) return null; |
| 2235 | return @enumFromInt(@intFromEnum(i)); | |
| 2235 | return @fromBackingInt(@intCast(@backingInt(i))); | |
| 2236 | 2236 | } |
| 2237 | 2237 | |
| 2238 | 2238 | pub fn slice(index: OptionalString, wasm: *const Wasm) ?[:0]const u8 { |
| ... | ... | @@ -2246,11 +2246,11 @@ pub const ValtypeList = enum(u32) { |
| 2246 | 2246 | _, |
| 2247 | 2247 | |
| 2248 | 2248 | pub fn fromString(s: String) ValtypeList { |
| 2249 | return @enumFromInt(@intFromEnum(s)); | |
| 2249 | return @fromBackingInt(@intCast(@backingInt(s))); | |
| 2250 | 2250 | } |
| 2251 | 2251 | |
| 2252 | 2252 | pub fn slice(index: ValtypeList, wasm: *const Wasm) []const std.wasm.Valtype { |
| 2253 | return @ptrCast(String.slice(@enumFromInt(@intFromEnum(index)), wasm)); | |
| 2253 | return @ptrCast(String.slice(@fromBackingInt(@intCast(@backingInt(index))), wasm)); | |
| 2254 | 2254 | } |
| 2255 | 2255 | }; |
| 2256 | 2256 | |
| ... | ... | @@ -2259,7 +2259,7 @@ pub const ZcuImportIndex = enum(u32) { |
| 2259 | 2259 | _, |
| 2260 | 2260 | |
| 2261 | 2261 | pub fn ptr(index: ZcuImportIndex, wasm: *const Wasm) *InternPool.Nav.Index { |
| 2262 | return &wasm.imports.keys()[@intFromEnum(index)]; | |
| 2262 | return &wasm.imports.keys()[@backingInt(index)]; | |
| 2263 | 2263 | } |
| 2264 | 2264 | |
| 2265 | 2265 | pub fn importName(index: ZcuImportIndex, wasm: *const Wasm) String { |
| ... | ... | @@ -2310,16 +2310,16 @@ pub const FunctionImportId = enum(u32) { |
| 2310 | 2310 | |
| 2311 | 2311 | pub fn pack(unpacked: Unpacked, wasm: *const Wasm) FunctionImportId { |
| 2312 | 2312 | return switch (unpacked) { |
| 2313 | .object_function_import => |i| @enumFromInt(@intFromEnum(i)), | |
| 2314 | .zcu_import => |i| @enumFromInt(@intFromEnum(i) + wasm.object_function_imports.entries.len), | |
| 2313 | .object_function_import => |i| @fromBackingInt(@intCast(@backingInt(i))), | |
| 2314 | .zcu_import => |i| @fromBackingInt(@intCast(@backingInt(i) + wasm.object_function_imports.entries.len)), | |
| 2315 | 2315 | }; |
| 2316 | 2316 | } |
| 2317 | 2317 | |
| 2318 | 2318 | pub fn unpack(id: FunctionImportId, wasm: *const Wasm) Unpacked { |
| 2319 | const i = @intFromEnum(id); | |
| 2320 | if (i < wasm.object_function_imports.entries.len) return .{ .object_function_import = @enumFromInt(i) }; | |
| 2319 | const i = @backingInt(id); | |
| 2320 | if (i < wasm.object_function_imports.entries.len) return .{ .object_function_import = @fromBackingInt(@intCast(i)) }; | |
| 2321 | 2321 | const zcu_import_i = i - wasm.object_function_imports.entries.len; |
| 2322 | return .{ .zcu_import = @enumFromInt(zcu_import_i) }; | |
| 2322 | return .{ .zcu_import = @fromBackingInt(@intCast(zcu_import_i)) }; | |
| 2323 | 2323 | } |
| 2324 | 2324 | |
| 2325 | 2325 | pub fn fromObject(function_import_index: FunctionImport.Index, wasm: *const Wasm) FunctionImportId { |
| ... | ... | @@ -2337,10 +2337,10 @@ pub const FunctionImportId = enum(u32) { |
| 2337 | 2337 | .object_function_import => |obj_func_index| { |
| 2338 | 2338 | // TODO binary search |
| 2339 | 2339 | for (wasm.objects.items, 0..) |o, i| { |
| 2340 | if (o.function_imports.off <= @intFromEnum(obj_func_index) and | |
| 2341 | o.function_imports.off + o.function_imports.len > @intFromEnum(obj_func_index)) | |
| 2340 | if (o.function_imports.off <= @backingInt(obj_func_index) and | |
| 2341 | o.function_imports.off + o.function_imports.len > @backingInt(obj_func_index)) | |
| 2342 | 2342 | { |
| 2343 | return .pack(.{ .object_index = @enumFromInt(i) }, wasm); | |
| 2343 | return .pack(.{ .object_index = @fromBackingInt(@intCast(i)) }, wasm); | |
| 2344 | 2344 | } |
| 2345 | 2345 | } else unreachable; |
| 2346 | 2346 | }, |
| ... | ... | @@ -2397,16 +2397,16 @@ pub const GlobalImportId = enum(u32) { |
| 2397 | 2397 | |
| 2398 | 2398 | pub fn pack(unpacked: Unpacked, wasm: *const Wasm) GlobalImportId { |
| 2399 | 2399 | return switch (unpacked) { |
| 2400 | .object_global_import => |i| @enumFromInt(@intFromEnum(i)), | |
| 2401 | .zcu_import => |i| @enumFromInt(@intFromEnum(i) + wasm.object_global_imports.entries.len), | |
| 2400 | .object_global_import => |i| @fromBackingInt(@intCast(@backingInt(i))), | |
| 2401 | .zcu_import => |i| @fromBackingInt(@intCast(@backingInt(i) + wasm.object_global_imports.entries.len)), | |
| 2402 | 2402 | }; |
| 2403 | 2403 | } |
| 2404 | 2404 | |
| 2405 | 2405 | pub fn unpack(id: GlobalImportId, wasm: *const Wasm) Unpacked { |
| 2406 | const i = @intFromEnum(id); | |
| 2407 | if (i < wasm.object_global_imports.entries.len) return .{ .object_global_import = @enumFromInt(i) }; | |
| 2406 | const i = @backingInt(id); | |
| 2407 | if (i < wasm.object_global_imports.entries.len) return .{ .object_global_import = @fromBackingInt(@intCast(i)) }; | |
| 2408 | 2408 | const zcu_import_i = i - wasm.object_global_imports.entries.len; |
| 2409 | return .{ .zcu_import = @enumFromInt(zcu_import_i) }; | |
| 2409 | return .{ .zcu_import = @fromBackingInt(@intCast(zcu_import_i)) }; | |
| 2410 | 2410 | } |
| 2411 | 2411 | |
| 2412 | 2412 | pub fn fromObject(object_global_import: GlobalImport.Index, wasm: *const Wasm) GlobalImportId { |
| ... | ... | @@ -2420,10 +2420,10 @@ pub const GlobalImportId = enum(u32) { |
| 2420 | 2420 | .object_global_import => |obj_global_index| { |
| 2421 | 2421 | // TODO binary search |
| 2422 | 2422 | for (wasm.objects.items, 0..) |o, i| { |
| 2423 | if (o.global_imports.off <= @intFromEnum(obj_global_index) and | |
| 2424 | o.global_imports.off + o.global_imports.len > @intFromEnum(obj_global_index)) | |
| 2423 | if (o.global_imports.off <= @backingInt(obj_global_index) and | |
| 2424 | o.global_imports.off + o.global_imports.len > @backingInt(obj_global_index)) | |
| 2425 | 2425 | { |
| 2426 | return .pack(.{ .object_index = @enumFromInt(i) }, wasm); | |
| 2426 | return .pack(.{ .object_index = @fromBackingInt(@intCast(i)) }, wasm); | |
| 2427 | 2427 | } |
| 2428 | 2428 | } else unreachable; |
| 2429 | 2429 | }, |
| ... | ... | @@ -2462,16 +2462,16 @@ pub const DataImportId = enum(u32) { |
| 2462 | 2462 | |
| 2463 | 2463 | pub fn pack(unpacked: Unpacked, wasm: *const Wasm) DataImportId { |
| 2464 | 2464 | return switch (unpacked) { |
| 2465 | .object_data_import => |i| @enumFromInt(@intFromEnum(i)), | |
| 2466 | .zcu_import => |i| @enumFromInt(@intFromEnum(i) + wasm.object_data_imports.entries.len), | |
| 2465 | .object_data_import => |i| @fromBackingInt(@intCast(@backingInt(i))), | |
| 2466 | .zcu_import => |i| @fromBackingInt(@intCast(@backingInt(i) + wasm.object_data_imports.entries.len)), | |
| 2467 | 2467 | }; |
| 2468 | 2468 | } |
| 2469 | 2469 | |
| 2470 | 2470 | pub fn unpack(id: DataImportId, wasm: *const Wasm) Unpacked { |
| 2471 | const i = @intFromEnum(id); | |
| 2472 | if (i < wasm.object_data_imports.entries.len) return .{ .object_data_import = @enumFromInt(i) }; | |
| 2471 | const i = @backingInt(id); | |
| 2472 | if (i < wasm.object_data_imports.entries.len) return .{ .object_data_import = @fromBackingInt(@intCast(i)) }; | |
| 2473 | 2473 | const zcu_import_i = i - wasm.object_data_imports.entries.len; |
| 2474 | return .{ .zcu_import = @enumFromInt(zcu_import_i) }; | |
| 2474 | return .{ .zcu_import = @fromBackingInt(@intCast(zcu_import_i)) }; | |
| 2475 | 2475 | } |
| 2476 | 2476 | |
| 2477 | 2477 | pub fn fromZcuImport(zcu_import: ZcuImportIndex, wasm: *const Wasm) DataImportId { |
| ... | ... | @@ -2487,10 +2487,10 @@ pub const DataImportId = enum(u32) { |
| 2487 | 2487 | .object_data_import => |obj_data_index| { |
| 2488 | 2488 | // TODO binary search |
| 2489 | 2489 | for (wasm.objects.items, 0..) |o, i| { |
| 2490 | if (o.data_imports.off <= @intFromEnum(obj_data_index) and | |
| 2491 | o.data_imports.off + o.data_imports.len > @intFromEnum(obj_data_index)) | |
| 2490 | if (o.data_imports.off <= @backingInt(obj_data_index) and | |
| 2491 | o.data_imports.off + o.data_imports.len > @backingInt(obj_data_index)) | |
| 2492 | 2492 | { |
| 2493 | return .pack(.{ .object_index = @enumFromInt(i) }, wasm); | |
| 2493 | return .pack(.{ .object_index = @fromBackingInt(@intCast(i)) }, wasm); | |
| 2494 | 2494 | } |
| 2495 | 2495 | } else unreachable; |
| 2496 | 2496 | }, |
| ... | ... | @@ -2504,7 +2504,7 @@ pub const SymbolTableIndex = enum(u32) { |
| 2504 | 2504 | _, |
| 2505 | 2505 | |
| 2506 | 2506 | pub fn key(i: @This(), wasm: *const Wasm) *String { |
| 2507 | return &wasm.symbol_table.keys()[@intFromEnum(i)]; | |
| 2507 | return &wasm.symbol_table.keys()[@backingInt(i)]; | |
| 2508 | 2508 | } |
| 2509 | 2509 | }; |
| 2510 | 2510 | |
| ... | ... | @@ -2755,7 +2755,7 @@ pub const InitFunc = extern struct { |
| 2755 | 2755 | pub fn lessThan(ctx: void, lhs: InitFunc, rhs: InitFunc) bool { |
| 2756 | 2756 | _ = ctx; |
| 2757 | 2757 | if (lhs.priority == rhs.priority) { |
| 2758 | return @intFromEnum(lhs.function_index) < @intFromEnum(rhs.function_index); | |
| 2758 | return @backingInt(lhs.function_index) < @backingInt(rhs.function_index); | |
| 2759 | 2759 | } else { |
| 2760 | 2760 | return lhs.priority < rhs.priority; |
| 2761 | 2761 | } |
| ... | ... | @@ -2805,11 +2805,11 @@ pub const Feature = packed struct(u8) { |
| 2805 | 2805 | _, |
| 2806 | 2806 | |
| 2807 | 2807 | pub fn fromString(s: String) Set { |
| 2808 | return @enumFromInt(@intFromEnum(s)); | |
| 2808 | return @fromBackingInt(@intCast(@backingInt(s))); | |
| 2809 | 2809 | } |
| 2810 | 2810 | |
| 2811 | 2811 | pub fn string(s: Set) String { |
| 2812 | return @enumFromInt(@intFromEnum(s)); | |
| 2812 | return @fromBackingInt(@intCast(@backingInt(s))); | |
| 2813 | 2813 | } |
| 2814 | 2814 | |
| 2815 | 2815 | pub fn slice(s: Set, wasm: *const Wasm) [:sentinel]const Feature { |
| ... | ... | @@ -3246,7 +3246,7 @@ pub fn updateFunc( |
| 3246 | 3246 | .locals_len = @intCast(mir.locals.len), |
| 3247 | 3247 | .prologue = mir.prologue, |
| 3248 | 3248 | } }); |
| 3249 | wasm.functions.putAssumeCapacity(.pack(wasm, .{ .zcu_func = @enumFromInt(wasm.zcu_funcs.entries.len - 1) }), {}); | |
| 3249 | wasm.functions.putAssumeCapacity(.pack(wasm, .{ .zcu_func = @fromBackingInt(@intCast(wasm.zcu_funcs.entries.len - 1)) }), {}); | |
| 3250 | 3250 | } |
| 3251 | 3251 | |
| 3252 | 3252 | // Generate code for the "Nav", storing it in memory to be later written to |
| ... | ... | @@ -3335,7 +3335,7 @@ pub fn deleteExport( |
| 3335 | 3335 | const export_name = wasm.getExistingString(name_slice).?; |
| 3336 | 3336 | switch (exported) { |
| 3337 | 3337 | .nav => |nav_index| { |
| 3338 | log.debug("deleteExport '{s}' nav={d}", .{ name_slice, @intFromEnum(nav_index) }); | |
| 3338 | log.debug("deleteExport '{s}' nav={d}", .{ name_slice, @backingInt(nav_index) }); | |
| 3339 | 3339 | assert(wasm.nav_exports.swapRemove(.{ .nav_index = nav_index, .name = export_name })); |
| 3340 | 3340 | }, |
| 3341 | 3341 | .uav => |uav_index| assert(wasm.uav_exports.swapRemove(.{ .uav_index = uav_index, .name = export_name })), |
| ... | ... | @@ -3357,7 +3357,7 @@ pub fn updateExports( |
| 3357 | 3357 | const name = try wasm.internString(name_slice); |
| 3358 | 3358 | switch (exported) { |
| 3359 | 3359 | .nav => |nav_index| { |
| 3360 | log.debug("updateExports '{s}' nav={d}", .{ name_slice, @intFromEnum(nav_index) }); | |
| 3360 | log.debug("updateExports '{s}' nav={d}", .{ name_slice, @backingInt(nav_index) }); | |
| 3361 | 3361 | try wasm.nav_exports.put(gpa, .{ .nav_index = nav_index, .name = name }, export_idx); |
| 3362 | 3362 | }, |
| 3363 | 3363 | .uav => |uav_index| try wasm.uav_exports.put(gpa, .{ .uav_index = uav_index, .name = name }, export_idx), |
| ... | ... | @@ -3446,7 +3446,7 @@ pub fn prelink(wasm: *Wasm, prog_node: std.Progress.Node) link.Error!void { |
| 3446 | 3446 | @panic("TODO"); |
| 3447 | 3447 | } else { |
| 3448 | 3448 | try wasm.globals.put(gpa, .__stack_pointer, {}); |
| 3449 | assert(wasm.globals.entries.len - 1 == @intFromEnum(GlobalIndex.stack_pointer)); | |
| 3449 | assert(wasm.globals.entries.len - 1 == @backingInt(GlobalIndex.stack_pointer)); | |
| 3450 | 3450 | } |
| 3451 | 3451 | } |
| 3452 | 3452 | |
| ... | ... | @@ -3454,7 +3454,7 @@ pub fn prelink(wasm: *Wasm, prog_node: std.Progress.Node) link.Error!void { |
| 3454 | 3454 | // At the end, output functions and globals will be populated. |
| 3455 | 3455 | for (wasm.object_function_imports.keys(), wasm.object_function_imports.values(), 0..) |name, *import, i| { |
| 3456 | 3456 | if (import.flags.isIncluded(rdynamic)) { |
| 3457 | try markFunctionImport(wasm, name, import, @enumFromInt(i)); | |
| 3457 | try markFunctionImport(wasm, name, import, @fromBackingInt(@intCast(i))); | |
| 3458 | 3458 | } |
| 3459 | 3459 | } |
| 3460 | 3460 | // Also treat init functions as roots. |
| ... | ... | @@ -3468,7 +3468,7 @@ pub fn prelink(wasm: *Wasm, prog_node: std.Progress.Node) link.Error!void { |
| 3468 | 3468 | |
| 3469 | 3469 | for (wasm.object_global_imports.keys(), wasm.object_global_imports.values(), 0..) |name, *import, i| { |
| 3470 | 3470 | if (import.flags.isIncluded(rdynamic)) { |
| 3471 | try markGlobalImport(wasm, name, import, @enumFromInt(i)); | |
| 3471 | try markGlobalImport(wasm, name, import, @fromBackingInt(@intCast(i))); | |
| 3472 | 3472 | } |
| 3473 | 3473 | } |
| 3474 | 3474 | wasm.globals_end_prelink = @intCast(wasm.globals.entries.len); |
| ... | ... | @@ -3476,13 +3476,13 @@ pub fn prelink(wasm: *Wasm, prog_node: std.Progress.Node) link.Error!void { |
| 3476 | 3476 | |
| 3477 | 3477 | for (wasm.object_table_imports.keys(), wasm.object_table_imports.values(), 0..) |name, *import, i| { |
| 3478 | 3478 | if (import.flags.isIncluded(rdynamic)) { |
| 3479 | try markTableImport(wasm, name, import, @enumFromInt(i)); | |
| 3479 | try markTableImport(wasm, name, import, @fromBackingInt(@intCast(i))); | |
| 3480 | 3480 | } |
| 3481 | 3481 | } |
| 3482 | 3482 | |
| 3483 | 3483 | for (wasm.object_data_imports.keys(), wasm.object_data_imports.values(), 0..) |name, *import, i| { |
| 3484 | 3484 | if (import.flags.isIncluded(rdynamic)) { |
| 3485 | try markDataImport(wasm, name, import, @enumFromInt(i)); | |
| 3485 | try markDataImport(wasm, name, import, @fromBackingInt(@intCast(i))); | |
| 3486 | 3486 | } |
| 3487 | 3487 | } |
| 3488 | 3488 | |
| ... | ... | @@ -3548,9 +3548,9 @@ fn markFunction(wasm: *Wasm, i: ObjectFunctionIndex, override_export: bool) link |
| 3548 | 3548 | if (!is_obj and (override_export or function.flags.isExported(rdynamic))) { |
| 3549 | 3549 | const symbol_name = function.name.unwrap().?; |
| 3550 | 3550 | if (!override_export and function.flags.visibility_hidden) { |
| 3551 | try wasm.hidden_function_exports.put(gpa, symbol_name, @enumFromInt(gop.index)); | |
| 3551 | try wasm.hidden_function_exports.put(gpa, symbol_name, @fromBackingInt(@intCast(gop.index))); | |
| 3552 | 3552 | } else { |
| 3553 | try wasm.function_exports.put(gpa, symbol_name, @enumFromInt(gop.index)); | |
| 3553 | try wasm.function_exports.put(gpa, symbol_name, @fromBackingInt(@intCast(gop.index))); | |
| 3554 | 3554 | } |
| 3555 | 3555 | } |
| 3556 | 3556 | |
| ... | ... | @@ -3619,7 +3619,7 @@ fn markGlobal(wasm: *Wasm, i: ObjectGlobalIndex, override_export: bool) link.Err |
| 3619 | 3619 | |
| 3620 | 3620 | if (!is_obj and (override_export or global.flags.isExported(rdynamic))) try wasm.global_exports.append(gpa, .{ |
| 3621 | 3621 | .name = global.name.unwrap().?, |
| 3622 | .global_index = @enumFromInt(gop.index), | |
| 3622 | .global_index = @fromBackingInt(@intCast(gop.index)), | |
| 3623 | 3623 | }); |
| 3624 | 3624 | |
| 3625 | 3625 | try wasm.markRelocations(global.relocations(wasm)); |
| ... | ... | @@ -3703,7 +3703,7 @@ fn markRelocations(wasm: *Wasm, relocs: ObjectRelocation.IterableSlice) link.Err |
| 3703 | 3703 | .function_import_offset_i64, |
| 3704 | 3704 | => { |
| 3705 | 3705 | const name = pointee.symbol_name; |
| 3706 | const i: FunctionImport.Index = @enumFromInt(wasm.object_function_imports.getIndex(name).?); | |
| 3706 | const i: FunctionImport.Index = @fromBackingInt(@intCast(wasm.object_function_imports.getIndex(name).?)); | |
| 3707 | 3707 | try markFunctionImport(wasm, name, i.value(wasm), i); |
| 3708 | 3708 | }, |
| 3709 | 3709 | .table_import_index_sleb, |
| ... | ... | @@ -3715,17 +3715,17 @@ fn markRelocations(wasm: *Wasm, relocs: ObjectRelocation.IterableSlice) link.Err |
| 3715 | 3715 | => { |
| 3716 | 3716 | const name = pointee.symbol_name; |
| 3717 | 3717 | try wasm.object_indirect_function_import_set.put(gpa, name, {}); |
| 3718 | const i: FunctionImport.Index = @enumFromInt(wasm.object_function_imports.getIndex(name).?); | |
| 3718 | const i: FunctionImport.Index = @fromBackingInt(@intCast(wasm.object_function_imports.getIndex(name).?)); | |
| 3719 | 3719 | try markFunctionImport(wasm, name, i.value(wasm), i); |
| 3720 | 3720 | }, |
| 3721 | 3721 | .global_import_index_leb, .global_import_index_i32 => { |
| 3722 | 3722 | const name = pointee.symbol_name; |
| 3723 | const i: GlobalImport.Index = @enumFromInt(wasm.object_global_imports.getIndex(name).?); | |
| 3723 | const i: GlobalImport.Index = @fromBackingInt(@intCast(wasm.object_global_imports.getIndex(name).?)); | |
| 3724 | 3724 | try markGlobalImport(wasm, name, i.value(wasm), i); |
| 3725 | 3725 | }, |
| 3726 | 3726 | .table_import_number_leb => { |
| 3727 | 3727 | const name = pointee.symbol_name; |
| 3728 | const i: TableImport.Index = @enumFromInt(wasm.object_table_imports.getIndex(name).?); | |
| 3728 | const i: TableImport.Index = @fromBackingInt(@intCast(wasm.object_table_imports.getIndex(name).?)); | |
| 3729 | 3729 | try markTableImport(wasm, name, i.value(wasm), i); |
| 3730 | 3730 | }, |
| 3731 | 3731 | .memory_addr_import_leb, |
| ... | ... | @@ -3871,7 +3871,7 @@ pub fn internString(wasm: *Wasm, bytes: []const u8) Allocator.Error!String { |
| 3871 | 3871 | if (gop.found_existing) return gop.key_ptr.*; |
| 3872 | 3872 | |
| 3873 | 3873 | try wasm.string_bytes.ensureUnusedCapacity(gpa, bytes.len + 1); |
| 3874 | const new_off: String = @enumFromInt(wasm.string_bytes.items.len); | |
| 3874 | const new_off: String = @fromBackingInt(@intCast(wasm.string_bytes.items.len)); | |
| 3875 | 3875 | |
| 3876 | 3876 | wasm.string_bytes.appendSliceAssumeCapacity(bytes); |
| 3877 | 3877 | wasm.string_bytes.appendAssumeCapacity(0); |
| ... | ... | @@ -3906,12 +3906,12 @@ pub fn getExistingValtypeList(wasm: *const Wasm, valtype_list: []const std.wasm. |
| 3906 | 3906 | pub fn addFuncType(wasm: *Wasm, ft: FunctionType) Allocator.Error!FunctionType.Index { |
| 3907 | 3907 | const gpa = wasm.base.comp.gpa; |
| 3908 | 3908 | const gop = try wasm.func_types.getOrPut(gpa, ft); |
| 3909 | return @enumFromInt(gop.index); | |
| 3909 | return @fromBackingInt(@intCast(gop.index)); | |
| 3910 | 3910 | } |
| 3911 | 3911 | |
| 3912 | 3912 | pub fn getExistingFuncType(wasm: *const Wasm, ft: FunctionType) ?FunctionType.Index { |
| 3913 | 3913 | const index = wasm.func_types.getIndex(ft) orelse return null; |
| 3914 | return @enumFromInt(index); | |
| 3914 | return @fromBackingInt(@intCast(index)); | |
| 3915 | 3915 | } |
| 3916 | 3916 | |
| 3917 | 3917 | pub fn getExistingFuncType2(wasm: *const Wasm, params: []const std.wasm.Valtype, returns: []const std.wasm.Valtype) FunctionType.Index { |
| ... | ... | @@ -3960,14 +3960,14 @@ pub fn addExpr(wasm: *Wasm, bytes: []const u8) Allocator.Error!Expr { |
| 3960 | 3960 | // it is likely for globals to share initialization values. Then again |
| 3961 | 3961 | // there may not be very many globals in total. |
| 3962 | 3962 | try wasm.string_bytes.appendSlice(gpa, bytes); |
| 3963 | return @enumFromInt(wasm.string_bytes.items.len - bytes.len); | |
| 3963 | return @fromBackingInt(@intCast(wasm.string_bytes.items.len - bytes.len)); | |
| 3964 | 3964 | } |
| 3965 | 3965 | |
| 3966 | 3966 | pub fn addRelocatableDataPayload(wasm: *Wasm, bytes: []const u8) Allocator.Error!DataPayload { |
| 3967 | 3967 | const gpa = wasm.base.comp.gpa; |
| 3968 | 3968 | try wasm.string_bytes.appendSlice(gpa, bytes); |
| 3969 | 3969 | return .{ |
| 3970 | .off = @enumFromInt(wasm.string_bytes.items.len - bytes.len), | |
| 3970 | .off = @fromBackingInt(@intCast(wasm.string_bytes.items.len - bytes.len)), | |
| 3971 | 3971 | .len = @intCast(bytes.len), |
| 3972 | 3972 | }; |
| 3973 | 3973 | } |
| ... | ... | @@ -3976,10 +3976,10 @@ pub fn uavSymbolIndex(wasm: *Wasm, ip_index: InternPool.Index) Allocator.Error!S |
| 3976 | 3976 | const comp = wasm.base.comp; |
| 3977 | 3977 | assert(comp.config.output_mode == .Obj); |
| 3978 | 3978 | const gpa = comp.gpa; |
| 3979 | const name = try wasm.internStringFmt("__anon_{d}", .{@intFromEnum(ip_index)}); | |
| 3979 | const name = try wasm.internStringFmt("__anon_{d}", .{@backingInt(ip_index)}); | |
| 3980 | 3980 | const gop = try wasm.symbol_table.getOrPut(gpa, name); |
| 3981 | 3981 | gop.value_ptr.* = {}; |
| 3982 | return @enumFromInt(gop.index); | |
| 3982 | return @fromBackingInt(@intCast(gop.index)); | |
| 3983 | 3983 | } |
| 3984 | 3984 | |
| 3985 | 3985 | pub fn navSymbolIndex(wasm: *Wasm, nav_index: InternPool.Nav.Index) Allocator.Error!SymbolTableIndex { |
| ... | ... | @@ -3992,7 +3992,7 @@ pub fn navSymbolIndex(wasm: *Wasm, nav_index: InternPool.Nav.Index) Allocator.Er |
| 3992 | 3992 | const name = try wasm.internString(nav.fqn.toSlice(ip)); |
| 3993 | 3993 | const gop = try wasm.symbol_table.getOrPut(gpa, name); |
| 3994 | 3994 | gop.value_ptr.* = {}; |
| 3995 | return @enumFromInt(gop.index); | |
| 3995 | return @fromBackingInt(@intCast(gop.index)); | |
| 3996 | 3996 | } |
| 3997 | 3997 | |
| 3998 | 3998 | pub fn errorNameTableSymbolIndex(wasm: *Wasm) Allocator.Error!SymbolTableIndex { |
| ... | ... | @@ -4001,7 +4001,7 @@ pub fn errorNameTableSymbolIndex(wasm: *Wasm) Allocator.Error!SymbolTableIndex { |
| 4001 | 4001 | const gpa = comp.gpa; |
| 4002 | 4002 | const gop = try wasm.symbol_table.getOrPut(gpa, wasm.preloaded_strings.__zig_error_name_table); |
| 4003 | 4003 | gop.value_ptr.* = {}; |
| 4004 | return @enumFromInt(gop.index); | |
| 4004 | return @fromBackingInt(@intCast(gop.index)); | |
| 4005 | 4005 | } |
| 4006 | 4006 | |
| 4007 | 4007 | pub fn stackPointerSymbolIndex(wasm: *Wasm) Allocator.Error!SymbolTableIndex { |
| ... | ... | @@ -4010,7 +4010,7 @@ pub fn stackPointerSymbolIndex(wasm: *Wasm) Allocator.Error!SymbolTableIndex { |
| 4010 | 4010 | const gpa = comp.gpa; |
| 4011 | 4011 | const gop = try wasm.symbol_table.getOrPut(gpa, wasm.preloaded_strings.__stack_pointer); |
| 4012 | 4012 | gop.value_ptr.* = {}; |
| 4013 | return @enumFromInt(gop.index); | |
| 4013 | return @fromBackingInt(@intCast(gop.index)); | |
| 4014 | 4014 | } |
| 4015 | 4015 | |
| 4016 | 4016 | pub fn tagTableIndexSymbolIndex(wasm: *Wasm, ip_index: InternPool.Index) Allocator.Error!SymbolTableIndex { |
| ... | ... | @@ -4020,7 +4020,7 @@ pub fn tagTableIndexSymbolIndex(wasm: *Wasm, ip_index: InternPool.Index) Allocat |
| 4020 | 4020 | const name = try wasm.internStringFmt("__zig_tag_name_{d}", .{ip_index}); |
| 4021 | 4021 | const gop = try wasm.symbol_table.getOrPut(gpa, name); |
| 4022 | 4022 | gop.value_ptr.* = {}; |
| 4023 | return @enumFromInt(gop.index); | |
| 4023 | return @fromBackingInt(@intCast(gop.index)); | |
| 4024 | 4024 | } |
| 4025 | 4025 | |
| 4026 | 4026 | pub fn symbolNameIndex(wasm: *Wasm, name: String) Allocator.Error!SymbolTableIndex { |
| ... | ... | @@ -4029,7 +4029,7 @@ pub fn symbolNameIndex(wasm: *Wasm, name: String) Allocator.Error!SymbolTableInd |
| 4029 | 4029 | const gpa = comp.gpa; |
| 4030 | 4030 | const gop = try wasm.symbol_table.getOrPut(gpa, name); |
| 4031 | 4031 | gop.value_ptr.* = {}; |
| 4032 | return @enumFromInt(gop.index); | |
| 4032 | return @fromBackingInt(@intCast(gop.index)); | |
| 4033 | 4033 | } |
| 4034 | 4034 | |
| 4035 | 4035 | pub fn addUavReloc( |
| ... | ... | @@ -4075,7 +4075,7 @@ pub fn addUavReloc( |
| 4075 | 4075 | }; |
| 4076 | 4076 | gop.value_ptr.count += 1; |
| 4077 | 4077 | try wasm.uav_fixups.append(gpa, .{ |
| 4078 | .uavs_exe_index = @enumFromInt(gop.index), | |
| 4078 | .uavs_exe_index = @fromBackingInt(@intCast(gop.index)), | |
| 4079 | 4079 | .offset = @intCast(reloc_offset), |
| 4080 | 4080 | .addend = addend, |
| 4081 | 4081 | }); |
| ... | ... | @@ -4092,7 +4092,7 @@ pub fn refNavObj(wasm: *Wasm, nav_index: InternPool.Nav.Index) !NavsObjIndex { |
| 4092 | 4092 | .code = undefined, |
| 4093 | 4093 | .relocs = undefined, |
| 4094 | 4094 | }; |
| 4095 | return @enumFromInt(gop.index); | |
| 4095 | return @fromBackingInt(@intCast(gop.index)); | |
| 4096 | 4096 | } |
| 4097 | 4097 | |
| 4098 | 4098 | pub fn refNavExe(wasm: *Wasm, nav_index: InternPool.Nav.Index) !NavsExeIndex { |
| ... | ... | @@ -4109,7 +4109,7 @@ pub fn refNavExe(wasm: *Wasm, nav_index: InternPool.Nav.Index) !NavsExeIndex { |
| 4109 | 4109 | .count = 0, |
| 4110 | 4110 | }; |
| 4111 | 4111 | } |
| 4112 | return @enumFromInt(gop.index); | |
| 4112 | return @fromBackingInt(@intCast(gop.index)); | |
| 4113 | 4113 | } |
| 4114 | 4114 | |
| 4115 | 4115 | /// Asserts it is called after `Flush.data_segments` is fully populated and sorted. |
| ... | ... | @@ -4117,7 +4117,7 @@ pub fn uavAddr(wasm: *Wasm, ip_index: InternPool.Index) u32 { |
| 4117 | 4117 | assert(wasm.flush_buffer.memory_layout_finished); |
| 4118 | 4118 | const comp = wasm.base.comp; |
| 4119 | 4119 | assert(comp.config.output_mode != .Obj); |
| 4120 | const uav_index: UavsExeIndex = @enumFromInt(wasm.uavs_exe.getIndex(ip_index).?); | |
| 4120 | const uav_index: UavsExeIndex = @fromBackingInt(@intCast(wasm.uavs_exe.getIndex(ip_index).?)); | |
| 4121 | 4121 | const ds_id: DataSegmentId = .pack(wasm, .{ .uav_exe = uav_index }); |
| 4122 | 4122 | return wasm.flush_buffer.data_segments.get(ds_id).?; |
| 4123 | 4123 | } |
| ... | ... | @@ -4128,7 +4128,7 @@ pub fn navAddr(wasm: *Wasm, nav_index: InternPool.Nav.Index) u32 { |
| 4128 | 4128 | const comp = wasm.base.comp; |
| 4129 | 4129 | assert(comp.config.output_mode != .Obj); |
| 4130 | 4130 | if (wasm.navs_exe.getIndex(nav_index)) |i| { |
| 4131 | const navs_exe_index: NavsExeIndex = @enumFromInt(i); | |
| 4131 | const navs_exe_index: NavsExeIndex = @fromBackingInt(@intCast(i)); | |
| 4132 | 4132 | log.debug("navAddr {s} {}", .{ navs_exe_index.name(wasm), nav_index }); |
| 4133 | 4133 | const ds_id: DataSegmentId = .pack(wasm, .{ .nav_exe = navs_exe_index }); |
| 4134 | 4134 | return wasm.flush_buffer.data_segments.get(ds_id).?; |
| ... | ... | @@ -4279,7 +4279,7 @@ fn lowerZcuData(wasm: *Wasm, pt: Zcu.PerThread, ip_index: InternPool.Index) !Zcu |
| 4279 | 4279 | wasm.string_bytes_lock.unlock(); |
| 4280 | 4280 | |
| 4281 | 4281 | const naive_code: DataPayload = .{ |
| 4282 | .off = @enumFromInt(code_start), | |
| 4282 | .off = @fromBackingInt(@intCast(code_start)), | |
| 4283 | 4283 | .len = code_len, |
| 4284 | 4284 | }; |
| 4285 | 4285 | |
| ... | ... | @@ -4329,7 +4329,7 @@ fn pointerSize(wasm: *const Wasm) u32 { |
| 4329 | 4329 | fn addZcuImportReserved(wasm: *Wasm, nav_index: InternPool.Nav.Index) ZcuImportIndex { |
| 4330 | 4330 | const gop = wasm.imports.getOrPutAssumeCapacity(nav_index); |
| 4331 | 4331 | gop.value_ptr.* = {}; |
| 4332 | return @enumFromInt(gop.index); | |
| 4332 | return @fromBackingInt(@intCast(gop.index)); | |
| 4333 | 4333 | } |
| 4334 | 4334 | |
| 4335 | 4335 | fn resolveFunctionSynthetic( |
src/link/Wasm/Flush.zig+131-131| ... | ... | @@ -51,7 +51,7 @@ pub const FuncTypeIndex = enum(u32) { |
| 51 | 51 | _, |
| 52 | 52 | |
| 53 | 53 | pub fn fromTypeIndex(i: Wasm.FunctionType.Index, f: *const Flush) FuncTypeIndex { |
| 54 | return @enumFromInt(f.func_types.getIndex(i).?); | |
| 54 | return @fromBackingInt(@intCast(f.func_types.getIndex(i).?)); | |
| 55 | 55 | } |
| 56 | 56 | }; |
| 57 | 57 | |
| ... | ... | @@ -68,16 +68,16 @@ const IndirectFunctionTableIndex = enum(u32) { |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | fn fromOutputFunctionIndex(f: *const Flush, i: Wasm.OutputFunctionIndex) IndirectFunctionTableIndex { |
| 71 | return @enumFromInt(f.indirect_function_table.getIndex(i).?); | |
| 71 | return @fromBackingInt(@intCast(f.indirect_function_table.getIndex(i).?)); | |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | fn fromZcuIndirectFunctionSetIndex(i: Wasm.ZcuIndirectFunctionSetIndex) IndirectFunctionTableIndex { |
| 75 | 75 | // These are the same since those are added to the table first. |
| 76 | return @enumFromInt(@intFromEnum(i)); | |
| 76 | return @fromBackingInt(@intCast(@backingInt(i))); | |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | fn toAbi(i: IndirectFunctionTableIndex) u32 { |
| 80 | return @intFromEnum(i) + 1; | |
| 80 | return @backingInt(i) + 1; | |
| 81 | 81 | } |
| 82 | 82 | }; |
| 83 | 83 | |
| ... | ... | @@ -139,11 +139,11 @@ pub fn finish(f: *Flush, wasm: *Wasm) !void { |
| 139 | 139 | for (wasm.mir_instructions.items(.tag), wasm.mir_instructions.items(.data)) |tag, *data| switch (tag) { |
| 140 | 140 | .call_intrinsic => { |
| 141 | 141 | const symbol_name = try wasm.internString(@tagName(data.intrinsic)); |
| 142 | const i: Wasm.FunctionImport.Index = @enumFromInt(wasm.object_function_imports.getIndex(symbol_name) orelse { | |
| 142 | const i: Wasm.FunctionImport.Index = @fromBackingInt(@intCast(wasm.object_function_imports.getIndex(symbol_name) orelse { | |
| 143 | 143 | return diags.fail("missing compiler runtime intrinsic '{t}' (undefined linker symbol)", .{ |
| 144 | 144 | data.intrinsic, |
| 145 | 145 | }); |
| 146 | }); | |
| 146 | })); | |
| 147 | 147 | try wasm.markFunctionImport(symbol_name, i.value(wasm), i); |
| 148 | 148 | log.debug("markFunctionImport intrinsic {d}={t}", .{ i, data.intrinsic }); |
| 149 | 149 | }, |
| ... | ... | @@ -157,7 +157,7 @@ pub fn finish(f: *Flush, wasm: *Wasm) !void { |
| 157 | 157 | .type_index = try wasm.internFunctionType(.auto, &.{int_tag_ty.ip_index}, .u32, false, target), |
| 158 | 158 | } }; |
| 159 | 159 | } |
| 160 | try wasm.functions.put(gpa, .fromZcuFunc(wasm, @enumFromInt(gop.index)), {}); | |
| 160 | try wasm.functions.put(gpa, .fromZcuFunc(wasm, @fromBackingInt(@intCast(gop.index))), {}); | |
| 161 | 161 | }, |
| 162 | 162 | .enum_tag_name_table_ref => { |
| 163 | 163 | assert(ip.indexToKey(data.ip_index) == .enum_type); |
| ... | ... | @@ -181,7 +181,7 @@ pub fn finish(f: *Flush, wasm: *Wasm) !void { |
| 181 | 181 | while (i < f.function_imports.entries.len) { |
| 182 | 182 | const symbol_name = f.function_imports.keys()[i]; |
| 183 | 183 | if (wasm.object_function_imports.getIndex(symbol_name)) |import_index_usize| { |
| 184 | const import_index: Wasm.FunctionImport.Index = @enumFromInt(import_index_usize); | |
| 184 | const import_index: Wasm.FunctionImport.Index = @fromBackingInt(@intCast(import_index_usize)); | |
| 185 | 185 | try wasm.markFunctionImport(symbol_name, import_index.value(wasm), import_index); |
| 186 | 186 | f.function_imports.swapRemoveAt(i); |
| 187 | 187 | continue; |
| ... | ... | @@ -195,7 +195,7 @@ pub fn finish(f: *Flush, wasm: *Wasm) !void { |
| 195 | 195 | while (i < f.data_imports.entries.len) { |
| 196 | 196 | const symbol_name = f.data_imports.keys()[i]; |
| 197 | 197 | if (wasm.object_data_imports.getIndex(symbol_name)) |import_index_usize| { |
| 198 | const import_index: Wasm.ObjectDataImport.Index = @enumFromInt(import_index_usize); | |
| 198 | const import_index: Wasm.ObjectDataImport.Index = @fromBackingInt(@intCast(import_index_usize)); | |
| 199 | 199 | try wasm.markDataImport(symbol_name, import_index.value(wasm), import_index); |
| 200 | 200 | f.data_imports.swapRemoveAt(i); |
| 201 | 201 | continue; |
| ... | ... | @@ -313,16 +313,16 @@ pub fn finish(f: *Flush, wasm: *Wasm) !void { |
| 313 | 313 | if (!is_obj) assert(wasm.uavs_obj.entries.len == 0); |
| 314 | 314 | if (!is_obj) assert(wasm.navs_obj.entries.len == 0); |
| 315 | 315 | for (0..wasm.uavs_obj.entries.len) |uavs_index| f.data_segments.putAssumeCapacityNoClobber(.pack(wasm, .{ |
| 316 | .uav_obj = @enumFromInt(uavs_index), | |
| 316 | .uav_obj = @fromBackingInt(@intCast(uavs_index)), | |
| 317 | 317 | }), @as(u32, undefined)); |
| 318 | 318 | for (0..wasm.navs_obj.entries.len) |navs_index| f.data_segments.putAssumeCapacityNoClobber(.pack(wasm, .{ |
| 319 | .nav_obj = @enumFromInt(navs_index), | |
| 319 | .nav_obj = @fromBackingInt(@intCast(navs_index)), | |
| 320 | 320 | }), @as(u32, undefined)); |
| 321 | 321 | for (0..wasm.uavs_exe.entries.len) |uavs_index| f.data_segments.putAssumeCapacityNoClobber(.pack(wasm, .{ |
| 322 | .uav_exe = @enumFromInt(uavs_index), | |
| 322 | .uav_exe = @fromBackingInt(@intCast(uavs_index)), | |
| 323 | 323 | }), @as(u32, undefined)); |
| 324 | 324 | for (0..wasm.navs_exe.entries.len) |navs_index| f.data_segments.putAssumeCapacityNoClobber(.pack(wasm, .{ |
| 325 | .nav_exe = @enumFromInt(navs_index), | |
| 325 | .nav_exe = @fromBackingInt(@intCast(navs_index)), | |
| 326 | 326 | }), @as(u32, undefined)); |
| 327 | 327 | if (wasm.error_name_table_ref_count > 0) { |
| 328 | 328 | f.data_segments.putAssumeCapacity(.__zig_error_names, @as(u32, undefined)); |
| ... | ... | @@ -371,8 +371,8 @@ pub fn finish(f: *Flush, wasm: *Wasm) !void { |
| 371 | 371 | pub fn lessThan(ctx: @This(), lhs: usize, rhs: usize) bool { |
| 372 | 372 | const lhs_segment = ctx.segments[lhs]; |
| 373 | 373 | const rhs_segment = ctx.segments[rhs]; |
| 374 | const lhs_category = @intFromEnum(lhs_segment.category(ctx.wasm)); | |
| 375 | const rhs_category = @intFromEnum(rhs_segment.category(ctx.wasm)); | |
| 374 | const lhs_category = @backingInt(lhs_segment.category(ctx.wasm)); | |
| 375 | const rhs_category = @backingInt(rhs_segment.category(ctx.wasm)); | |
| 376 | 376 | switch (std.math.order(lhs_category, rhs_category)) { |
| 377 | 377 | .lt => return true, |
| 378 | 378 | .gt => return false, |
| ... | ... | @@ -404,7 +404,7 @@ pub fn finish(f: *Flush, wasm: *Wasm) !void { |
| 404 | 404 | .gt => return false, |
| 405 | 405 | .eq => {}, |
| 406 | 406 | } |
| 407 | return @intFromEnum(lhs_segment) < @intFromEnum(rhs_segment); | |
| 407 | return @backingInt(lhs_segment) < @backingInt(rhs_segment); | |
| 408 | 408 | } |
| 409 | 409 | }; |
| 410 | 410 | f.data_segments.sortUnstable(@as(Sort, .{ |
| ... | ... | @@ -486,7 +486,7 @@ pub fn finish(f: *Flush, wasm: *Wasm) !void { |
| 486 | 486 | |
| 487 | 487 | const size = segment_id.size(wasm); |
| 488 | 488 | segment_vaddr.* = @intCast(start_addr); |
| 489 | log.debug("0x{x} {d} {s}", .{ start_addr, @intFromEnum(segment_id), segment_id.name(wasm) }); | |
| 489 | log.debug("0x{x} {d} {s}", .{ start_addr, @backingInt(segment_id), segment_id.name(wasm) }); | |
| 490 | 490 | memory_ptr = start_addr + size; |
| 491 | 491 | } |
| 492 | 492 | if (category != .zero) try f.data_segment_groups.append(gpa, .{ |
| ... | ... | @@ -593,12 +593,12 @@ pub fn finish(f: *Flush, wasm: *Wasm) !void { |
| 593 | 593 | const params = func_type.params.slice(wasm); |
| 594 | 594 | try appendLeb128(gpa, binary_bytes, @as(u32, @intCast(params.len))); |
| 595 | 595 | for (params) |param_ty| { |
| 596 | try appendLeb128(gpa, binary_bytes, @intFromEnum(param_ty)); | |
| 596 | try appendLeb128(gpa, binary_bytes, @backingInt(param_ty)); | |
| 597 | 597 | } |
| 598 | 598 | const returns = func_type.returns.slice(wasm); |
| 599 | 599 | try appendLeb128(gpa, binary_bytes, @as(u32, @intCast(returns.len))); |
| 600 | 600 | for (returns) |ret_ty| { |
| 601 | try appendLeb128(gpa, binary_bytes, @intFromEnum(ret_ty)); | |
| 601 | try appendLeb128(gpa, binary_bytes, @backingInt(ret_ty)); | |
| 602 | 602 | } |
| 603 | 603 | } |
| 604 | 604 | replaceVecSectionHeader(binary_bytes, header_offset, .type, @intCast(f.func_types.entries.len)); |
| ... | ... | @@ -625,9 +625,9 @@ pub fn finish(f: *Flush, wasm: *Wasm) !void { |
| 625 | 625 | try appendLeb128(gpa, binary_bytes, @as(u32, @intCast(name.len))); |
| 626 | 626 | try binary_bytes.appendSlice(gpa, name); |
| 627 | 627 | |
| 628 | try binary_bytes.append(gpa, @intFromEnum(std.wasm.ExternalKind.function)); | |
| 628 | try binary_bytes.append(gpa, @backingInt(std.wasm.ExternalKind.function)); | |
| 629 | 629 | const type_index: FuncTypeIndex = .fromTypeIndex(id.functionType(wasm), f); |
| 630 | try appendLeb128(gpa, binary_bytes, @intFromEnum(type_index)); | |
| 630 | try appendLeb128(gpa, binary_bytes, @backingInt(type_index)); | |
| 631 | 631 | } |
| 632 | 632 | total_imports += f.function_imports.entries.len; |
| 633 | 633 | |
| ... | ... | @@ -641,8 +641,8 @@ pub fn finish(f: *Flush, wasm: *Wasm) !void { |
| 641 | 641 | try appendLeb128(gpa, binary_bytes, @as(u32, @intCast(name.len))); |
| 642 | 642 | try binary_bytes.appendSlice(gpa, name); |
| 643 | 643 | |
| 644 | try binary_bytes.append(gpa, @intFromEnum(std.wasm.ExternalKind.table)); | |
| 645 | try appendLeb128(gpa, binary_bytes, @intFromEnum(@as(std.wasm.RefType, table_import.flags.ref_type.to()))); | |
| 644 | try binary_bytes.append(gpa, @backingInt(std.wasm.ExternalKind.table)); | |
| 645 | try appendLeb128(gpa, binary_bytes, @backingInt(@as(std.wasm.RefType, table_import.flags.ref_type.to()))); | |
| 646 | 646 | try emitLimits(gpa, binary_bytes, table_import.limits()); |
| 647 | 647 | } |
| 648 | 648 | total_imports += wasm.table_imports.entries.len; |
| ... | ... | @@ -670,9 +670,9 @@ pub fn finish(f: *Flush, wasm: *Wasm) !void { |
| 670 | 670 | try appendLeb128(gpa, binary_bytes, @as(u32, @intCast(name.len))); |
| 671 | 671 | try binary_bytes.appendSlice(gpa, name); |
| 672 | 672 | |
| 673 | try binary_bytes.append(gpa, @intFromEnum(std.wasm.ExternalKind.global)); | |
| 673 | try binary_bytes.append(gpa, @backingInt(std.wasm.ExternalKind.global)); | |
| 674 | 674 | const global_type = id.globalType(wasm); |
| 675 | try appendLeb128(gpa, binary_bytes, @intFromEnum(@as(std.wasm.Valtype, global_type.valtype))); | |
| 675 | try appendLeb128(gpa, binary_bytes, @backingInt(@as(std.wasm.Valtype, global_type.valtype))); | |
| 676 | 676 | try binary_bytes.append(gpa, @intFromBool(global_type.mutable)); |
| 677 | 677 | } |
| 678 | 678 | total_imports += f.global_imports.entries.len; |
| ... | ... | @@ -690,7 +690,7 @@ pub fn finish(f: *Flush, wasm: *Wasm) !void { |
| 690 | 690 | const header_offset = try reserveVecSectionHeader(gpa, binary_bytes); |
| 691 | 691 | for (wasm.functions.keys()) |function| { |
| 692 | 692 | const index: FuncTypeIndex = .fromTypeIndex(function.typeIndex(wasm), f); |
| 693 | try appendLeb128(gpa, binary_bytes, @intFromEnum(index)); | |
| 693 | try appendLeb128(gpa, binary_bytes, @backingInt(index)); | |
| 694 | 694 | } |
| 695 | 695 | |
| 696 | 696 | replaceVecSectionHeader(binary_bytes, header_offset, .function, @intCast(wasm.functions.count())); |
| ... | ... | @@ -702,7 +702,7 @@ pub fn finish(f: *Flush, wasm: *Wasm) !void { |
| 702 | 702 | const header_offset = try reserveVecSectionHeader(gpa, binary_bytes); |
| 703 | 703 | |
| 704 | 704 | for (wasm.tables.keys()) |table| { |
| 705 | try appendLeb128(gpa, binary_bytes, @intFromEnum(@as(std.wasm.RefType, table.refType(wasm)))); | |
| 705 | try appendLeb128(gpa, binary_bytes, @backingInt(@as(std.wasm.RefType, table.refType(wasm)))); | |
| 706 | 706 | try emitLimits(gpa, binary_bytes, table.limits(wasm)); |
| 707 | 707 | } |
| 708 | 708 | |
| ... | ... | @@ -735,7 +735,7 @@ pub fn finish(f: *Flush, wasm: *Wasm) !void { |
| 735 | 735 | .object_global => |i| { |
| 736 | 736 | const global = i.ptr(wasm); |
| 737 | 737 | try binary_bytes.appendSlice(gpa, &.{ |
| 738 | @intFromEnum(@as(std.wasm.Valtype, global.flags.global_type.valtype.to())), | |
| 738 | @backingInt(@as(std.wasm.Valtype, global.flags.global_type.valtype.to())), | |
| 739 | 739 | @intFromBool(global.flags.global_type.mutable), |
| 740 | 740 | }); |
| 741 | 741 | try emitExpr(wasm, binary_bytes, global.expr); |
| ... | ... | @@ -758,9 +758,9 @@ pub fn finish(f: *Flush, wasm: *Wasm) !void { |
| 758 | 758 | const name = exp_name.slice(wasm); |
| 759 | 759 | try appendLeb128(gpa, binary_bytes, @as(u32, @intCast(name.len))); |
| 760 | 760 | try binary_bytes.appendSlice(gpa, name); |
| 761 | try binary_bytes.append(gpa, @intFromEnum(std.wasm.ExternalKind.function)); | |
| 761 | try binary_bytes.append(gpa, @backingInt(std.wasm.ExternalKind.function)); | |
| 762 | 762 | const func_index = Wasm.OutputFunctionIndex.fromFunctionIndex(wasm, function_index); |
| 763 | try appendLeb128(gpa, binary_bytes, @intFromEnum(func_index)); | |
| 763 | try appendLeb128(gpa, binary_bytes, @backingInt(func_index)); | |
| 764 | 764 | } |
| 765 | 765 | exports_len += wasm.function_exports.entries.len; |
| 766 | 766 | |
| ... | ... | @@ -769,7 +769,7 @@ pub fn finish(f: *Flush, wasm: *Wasm) !void { |
| 769 | 769 | const index: u32 = @intCast(wasm.tables.getIndex(.__indirect_function_table).?); |
| 770 | 770 | try appendLeb128(gpa, binary_bytes, @as(u32, @intCast(name.len))); |
| 771 | 771 | try binary_bytes.appendSlice(gpa, name); |
| 772 | try binary_bytes.append(gpa, @intFromEnum(std.wasm.ExternalKind.table)); | |
| 772 | try binary_bytes.append(gpa, @backingInt(std.wasm.ExternalKind.table)); | |
| 773 | 773 | try appendLeb128(gpa, binary_bytes, index); |
| 774 | 774 | exports_len += 1; |
| 775 | 775 | } |
| ... | ... | @@ -778,7 +778,7 @@ pub fn finish(f: *Flush, wasm: *Wasm) !void { |
| 778 | 778 | const name = "memory"; |
| 779 | 779 | try appendLeb128(gpa, binary_bytes, @as(u32, @intCast(name.len))); |
| 780 | 780 | try binary_bytes.appendSlice(gpa, name); |
| 781 | try binary_bytes.append(gpa, @intFromEnum(std.wasm.ExternalKind.memory)); | |
| 781 | try binary_bytes.append(gpa, @backingInt(std.wasm.ExternalKind.memory)); | |
| 782 | 782 | try appendLeb128(gpa, binary_bytes, @as(u32, 0)); |
| 783 | 783 | exports_len += 1; |
| 784 | 784 | } |
| ... | ... | @@ -787,8 +787,8 @@ pub fn finish(f: *Flush, wasm: *Wasm) !void { |
| 787 | 787 | const name = exp.name.slice(wasm); |
| 788 | 788 | try appendLeb128(gpa, binary_bytes, @as(u32, @intCast(name.len))); |
| 789 | 789 | try binary_bytes.appendSlice(gpa, name); |
| 790 | try binary_bytes.append(gpa, @intFromEnum(std.wasm.ExternalKind.global)); | |
| 791 | try appendLeb128(gpa, binary_bytes, @intFromEnum(exp.global_index)); | |
| 790 | try binary_bytes.append(gpa, @backingInt(std.wasm.ExternalKind.global)); | |
| 791 | try appendLeb128(gpa, binary_bytes, @backingInt(exp.global_index)); | |
| 792 | 792 | } |
| 793 | 793 | exports_len += wasm.global_exports.items.len; |
| 794 | 794 | |
| ... | ... | @@ -802,7 +802,7 @@ pub fn finish(f: *Flush, wasm: *Wasm) !void { |
| 802 | 802 | |
| 803 | 803 | // start section |
| 804 | 804 | if (wasm.functions.getIndex(.__wasm_init_memory)) |func_index| { |
| 805 | try emitStartSection(gpa, binary_bytes, .fromFunctionIndex(wasm, @enumFromInt(func_index))); | |
| 805 | try emitStartSection(gpa, binary_bytes, .fromFunctionIndex(wasm, @fromBackingInt(@intCast(func_index)))); | |
| 806 | 806 | } else if (Wasm.OutputFunctionIndex.fromResolution(wasm, wasm.entry_resolution)) |func_index| { |
| 807 | 807 | try emitStartSection(gpa, binary_bytes, func_index); |
| 808 | 808 | } |
| ... | ... | @@ -830,7 +830,7 @@ pub fn finish(f: *Flush, wasm: *Wasm) !void { |
| 830 | 830 | } |
| 831 | 831 | try appendLeb128(gpa, binary_bytes, @as(u32, @intCast(f.indirect_function_table.entries.len))); |
| 832 | 832 | for (f.indirect_function_table.keys()) |func_index| { |
| 833 | try appendLeb128(gpa, binary_bytes, @intFromEnum(func_index)); | |
| 833 | try appendLeb128(gpa, binary_bytes, @backingInt(func_index)); | |
| 834 | 834 | } |
| 835 | 835 | |
| 836 | 836 | replaceVecSectionHeader(binary_bytes, header_offset, .element, 1); |
| ... | ... | @@ -966,7 +966,7 @@ pub fn finish(f: *Flush, wasm: *Wasm) !void { |
| 966 | 966 | const group_size = group_end_addr - group_start_addr; |
| 967 | 967 | log.debug("emit data section group, {d} bytes", .{group_size}); |
| 968 | 968 | const flags: Object.DataSegmentFlags = if (segment_id.isPassive(wasm)) .passive else .active; |
| 969 | try appendLeb128(gpa, binary_bytes, @intFromEnum(flags)); | |
| 969 | try appendLeb128(gpa, binary_bytes, @backingInt(flags)); | |
| 970 | 970 | // Passive segments are initialized at runtime. |
| 971 | 971 | if (flags != .passive) { |
| 972 | 972 | var aw: std.Io.Writer.Allocating = .fromArrayList(gpa, binary_bytes); |
| ... | ... | @@ -1119,7 +1119,7 @@ fn emitNameSection( |
| 1119 | 1119 | |
| 1120 | 1120 | { |
| 1121 | 1121 | const sub_offset = try reserveCustomSectionHeader(gpa, binary_bytes); |
| 1122 | defer replaceHeader(binary_bytes, sub_offset, @intFromEnum(std.wasm.NameSubsection.function)); | |
| 1122 | defer replaceHeader(binary_bytes, sub_offset, @backingInt(std.wasm.NameSubsection.function)); | |
| 1123 | 1123 | |
| 1124 | 1124 | const total_functions: u32 = @intCast(f.function_imports.entries.len + wasm.functions.entries.len); |
| 1125 | 1125 | try appendLeb128(gpa, binary_bytes, total_functions); |
| ... | ... | @@ -1140,7 +1140,7 @@ fn emitNameSection( |
| 1140 | 1140 | |
| 1141 | 1141 | { |
| 1142 | 1142 | const sub_offset = try reserveCustomSectionHeader(gpa, binary_bytes); |
| 1143 | defer replaceHeader(binary_bytes, sub_offset, @intFromEnum(std.wasm.NameSubsection.global)); | |
| 1143 | defer replaceHeader(binary_bytes, sub_offset, @backingInt(std.wasm.NameSubsection.global)); | |
| 1144 | 1144 | |
| 1145 | 1145 | const total_globals: u32 = @intCast(f.global_imports.entries.len + wasm.globals.entries.len); |
| 1146 | 1146 | try appendLeb128(gpa, binary_bytes, total_globals); |
| ... | ... | @@ -1161,7 +1161,7 @@ fn emitNameSection( |
| 1161 | 1161 | |
| 1162 | 1162 | { |
| 1163 | 1163 | const sub_offset = try reserveCustomSectionHeader(gpa, binary_bytes); |
| 1164 | defer replaceHeader(binary_bytes, sub_offset, @intFromEnum(std.wasm.NameSubsection.data_segment)); | |
| 1164 | defer replaceHeader(binary_bytes, sub_offset, @backingInt(std.wasm.NameSubsection.data_segment)); | |
| 1165 | 1165 | |
| 1166 | 1166 | const total_data_segments: u32 = @intCast(data_segment_groups.len); |
| 1167 | 1167 | try appendLeb128(gpa, binary_bytes, total_data_segments); |
| ... | ... | @@ -1194,7 +1194,7 @@ fn emitFeaturesSection( |
| 1194 | 1194 | |
| 1195 | 1195 | var safety_count = feature_count; |
| 1196 | 1196 | for (target.cpu.arch.allFeaturesList(), 0..) |*feature, i| { |
| 1197 | if (!target.cpu.has(.wasm, @as(std.Target.wasm.Feature, @enumFromInt(i)))) continue; | |
| 1197 | if (!target.cpu.has(.wasm, @as(std.Target.wasm.Feature, @fromBackingInt(@intCast(i))))) continue; | |
| 1198 | 1198 | safety_count -= 1; |
| 1199 | 1199 | |
| 1200 | 1200 | try appendLeb128(gpa, binary_bytes, @as(u32, '+')); |
| ... | ... | @@ -1318,7 +1318,7 @@ fn replaceVecSectionHeader( |
| 1318 | 1318 | const size: u32 = @intCast(bytes.items.len - offset - section_header_reserve_size + uleb128size(n_items)); |
| 1319 | 1319 | var buf: [section_header_reserve_size]u8 = undefined; |
| 1320 | 1320 | var w: std.Io.Writer = .fixed(&buf); |
| 1321 | w.writeByte(@intFromEnum(section)) catch unreachable; | |
| 1321 | w.writeByte(@backingInt(section)) catch unreachable; | |
| 1322 | 1322 | w.writeUleb128(size) catch unreachable; |
| 1323 | 1323 | w.writeUleb128(n_items) catch unreachable; |
| 1324 | 1324 | bytes.replaceRangeAssumeCapacity(offset, section_header_reserve_size, w.buffered()); |
| ... | ... | @@ -1382,34 +1382,34 @@ fn emitMemoryImport( |
| 1382 | 1382 | try appendLeb128(gpa, binary_bytes, @as(u32, @intCast(name.len))); |
| 1383 | 1383 | try binary_bytes.appendSlice(gpa, name); |
| 1384 | 1384 | |
| 1385 | try binary_bytes.append(gpa, @intFromEnum(std.wasm.ExternalKind.memory)); | |
| 1385 | try binary_bytes.append(gpa, @backingInt(std.wasm.ExternalKind.memory)); | |
| 1386 | 1386 | try emitLimits(gpa, binary_bytes, memory_import.limits()); |
| 1387 | 1387 | } |
| 1388 | 1388 | |
| 1389 | 1389 | fn emitInit(writer: *std.Io.Writer, init_expr: std.wasm.InitExpression) !void { |
| 1390 | 1390 | switch (init_expr) { |
| 1391 | 1391 | .i32_const => |val| { |
| 1392 | try writer.writeByte(@intFromEnum(std.wasm.Opcode.i32_const)); | |
| 1392 | try writer.writeByte(@backingInt(std.wasm.Opcode.i32_const)); | |
| 1393 | 1393 | try writer.writeSleb128(val); |
| 1394 | 1394 | }, |
| 1395 | 1395 | .i64_const => |val| { |
| 1396 | try writer.writeByte(@intFromEnum(std.wasm.Opcode.i64_const)); | |
| 1396 | try writer.writeByte(@backingInt(std.wasm.Opcode.i64_const)); | |
| 1397 | 1397 | try writer.writeSleb128(val); |
| 1398 | 1398 | }, |
| 1399 | 1399 | .f32_const => |val| { |
| 1400 | try writer.writeByte(@intFromEnum(std.wasm.Opcode.f32_const)); | |
| 1400 | try writer.writeByte(@backingInt(std.wasm.Opcode.f32_const)); | |
| 1401 | 1401 | try writer.writeInt(u32, @bitCast(val), .little); |
| 1402 | 1402 | }, |
| 1403 | 1403 | .f64_const => |val| { |
| 1404 | try writer.writeByte(@intFromEnum(std.wasm.Opcode.f64_const)); | |
| 1404 | try writer.writeByte(@backingInt(std.wasm.Opcode.f64_const)); | |
| 1405 | 1405 | try writer.writeInt(u64, @bitCast(val), .little); |
| 1406 | 1406 | }, |
| 1407 | 1407 | .global_get => |val| { |
| 1408 | try writer.writeByte(@intFromEnum(std.wasm.Opcode.global_get)); | |
| 1408 | try writer.writeByte(@backingInt(std.wasm.Opcode.global_get)); | |
| 1409 | 1409 | try writer.writeUleb128(val); |
| 1410 | 1410 | }, |
| 1411 | 1411 | } |
| 1412 | try writer.writeByte(@intFromEnum(std.wasm.Opcode.end)); | |
| 1412 | try writer.writeByte(@backingInt(std.wasm.Opcode.end)); | |
| 1413 | 1413 | } |
| 1414 | 1414 | |
| 1415 | 1415 | pub fn emitExpr(wasm: *const Wasm, binary_bytes: *ArrayList(u8), expr: Wasm.Expr) Allocator.Error!void { |
| ... | ... | @@ -1420,7 +1420,7 @@ pub fn emitExpr(wasm: *const Wasm, binary_bytes: *ArrayList(u8), expr: Wasm.Expr |
| 1420 | 1420 | |
| 1421 | 1421 | fn emitSegmentInfo(wasm: *Wasm, binary_bytes: *std.array_list.Managed(u8)) !void { |
| 1422 | 1422 | const gpa = wasm.base.comp.gpa; |
| 1423 | try appendLeb128(gpa, binary_bytes, @intFromEnum(Wasm.SubsectionType.segment_info)); | |
| 1423 | try appendLeb128(gpa, binary_bytes, @backingInt(Wasm.SubsectionType.segment_info)); | |
| 1424 | 1424 | const segment_offset = binary_bytes.items.len; |
| 1425 | 1425 | |
| 1426 | 1426 | try appendLeb128(gpa, binary_bytes, @as(u32, @intCast(wasm.segment_info.count()))); |
| ... | ... | @@ -1554,19 +1554,19 @@ fn reloc_sleb64_table_index(code: []u8, i: IndirectFunctionTableIndex) void { |
| 1554 | 1554 | } |
| 1555 | 1555 | |
| 1556 | 1556 | fn reloc_u32_function(code: []u8, function: Wasm.OutputFunctionIndex) void { |
| 1557 | mem.writeInt(u32, code[0..4], @intFromEnum(function), .little); | |
| 1557 | mem.writeInt(u32, code[0..4], @backingInt(function), .little); | |
| 1558 | 1558 | } |
| 1559 | 1559 | |
| 1560 | 1560 | fn reloc_leb_function(code: []u8, function: Wasm.OutputFunctionIndex) void { |
| 1561 | leb.writeUnsignedFixed(5, code[0..5], @intFromEnum(function)); | |
| 1561 | leb.writeUnsignedFixed(5, code[0..5], @backingInt(function)); | |
| 1562 | 1562 | } |
| 1563 | 1563 | |
| 1564 | 1564 | fn reloc_u32_global(code: []u8, global: Wasm.GlobalIndex) void { |
| 1565 | mem.writeInt(u32, code[0..4], @intFromEnum(global), .little); | |
| 1565 | mem.writeInt(u32, code[0..4], @backingInt(global), .little); | |
| 1566 | 1566 | } |
| 1567 | 1567 | |
| 1568 | 1568 | fn reloc_leb_global(code: []u8, global: Wasm.GlobalIndex) void { |
| 1569 | leb.writeUnsignedFixed(5, code[0..5], @intFromEnum(global)); | |
| 1569 | leb.writeUnsignedFixed(5, code[0..5], @backingInt(global)); | |
| 1570 | 1570 | } |
| 1571 | 1571 | |
| 1572 | 1572 | const RelocAddr = struct { |
| ... | ... | @@ -1618,11 +1618,11 @@ fn reloc_sleb64_addr(code: []u8, ra: RelocAddr) void { |
| 1618 | 1618 | } |
| 1619 | 1619 | |
| 1620 | 1620 | fn reloc_leb_table(code: []u8, table: Wasm.TableIndex) void { |
| 1621 | leb.writeUnsignedFixed(5, code[0..5], @intFromEnum(table)); | |
| 1621 | leb.writeUnsignedFixed(5, code[0..5], @backingInt(table)); | |
| 1622 | 1622 | } |
| 1623 | 1623 | |
| 1624 | 1624 | fn reloc_leb_type(code: []u8, index: FuncTypeIndex) void { |
| 1625 | leb.writeUnsignedFixed(5, code[0..5], @intFromEnum(index)); | |
| 1625 | leb.writeUnsignedFixed(5, code[0..5], @backingInt(index)); | |
| 1626 | 1626 | } |
| 1627 | 1627 | |
| 1628 | 1628 | fn emitCallCtorsFunction(wasm: *const Wasm, binary_bytes: *ArrayList(u8)) Allocator.Error!void { |
| ... | ... | @@ -1640,14 +1640,14 @@ fn emitCallCtorsFunction(wasm: *const Wasm, binary_bytes: *ArrayList(u8)) Alloca |
| 1640 | 1640 | // Call function by its function index |
| 1641 | 1641 | try binary_bytes.ensureUnusedCapacity(gpa, 1 + 5 + n_returns + 1); |
| 1642 | 1642 | const call_index: Wasm.OutputFunctionIndex = .fromObjectFunction(wasm, init_func.function_index); |
| 1643 | binary_bytes.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.call)); | |
| 1644 | appendReservedUleb32(binary_bytes, @intFromEnum(call_index)); | |
| 1643 | binary_bytes.appendAssumeCapacity(@backingInt(std.wasm.Opcode.call)); | |
| 1644 | appendReservedUleb32(binary_bytes, @backingInt(call_index)); | |
| 1645 | 1645 | |
| 1646 | 1646 | // drop all returned values from the stack as __wasm_call_ctors has no return value |
| 1647 | binary_bytes.appendNTimesAssumeCapacity(@intFromEnum(std.wasm.Opcode.drop), n_returns); | |
| 1647 | binary_bytes.appendNTimesAssumeCapacity(@backingInt(std.wasm.Opcode.drop), n_returns); | |
| 1648 | 1648 | } |
| 1649 | 1649 | |
| 1650 | binary_bytes.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.end)); // end function body | |
| 1650 | binary_bytes.appendAssumeCapacity(@backingInt(std.wasm.Opcode.end)); // end function body | |
| 1651 | 1651 | } |
| 1652 | 1652 | |
| 1653 | 1653 | fn emitInitMemoryFunction( |
| ... | ... | @@ -1674,31 +1674,31 @@ fn emitInitMemoryFunction( |
| 1674 | 1674 | try binary_bytes.ensureUnusedCapacity(gpa, 2 * 3 + 6 * 3 + 1 + 6 * 3 + 1 + 5 * 4 + 1 + 1); |
| 1675 | 1675 | // destination blocks |
| 1676 | 1676 | // based on values we jump to corresponding label |
| 1677 | binary_bytes.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.block)); // $drop | |
| 1678 | binary_bytes.appendAssumeCapacity(@intFromEnum(std.wasm.BlockType.empty)); | |
| 1677 | binary_bytes.appendAssumeCapacity(@backingInt(std.wasm.Opcode.block)); // $drop | |
| 1678 | binary_bytes.appendAssumeCapacity(@backingInt(std.wasm.BlockType.empty)); | |
| 1679 | 1679 | |
| 1680 | binary_bytes.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.block)); // $wait | |
| 1681 | binary_bytes.appendAssumeCapacity(@intFromEnum(std.wasm.BlockType.empty)); | |
| 1680 | binary_bytes.appendAssumeCapacity(@backingInt(std.wasm.Opcode.block)); // $wait | |
| 1681 | binary_bytes.appendAssumeCapacity(@backingInt(std.wasm.BlockType.empty)); | |
| 1682 | 1682 | |
| 1683 | binary_bytes.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.block)); // $init | |
| 1684 | binary_bytes.appendAssumeCapacity(@intFromEnum(std.wasm.BlockType.empty)); | |
| 1683 | binary_bytes.appendAssumeCapacity(@backingInt(std.wasm.Opcode.block)); // $init | |
| 1684 | binary_bytes.appendAssumeCapacity(@backingInt(std.wasm.BlockType.empty)); | |
| 1685 | 1685 | |
| 1686 | 1686 | // atomically check |
| 1687 | 1687 | appendReservedI32Const(binary_bytes, flag_address); |
| 1688 | 1688 | appendReservedI32Const(binary_bytes, 0); |
| 1689 | 1689 | appendReservedI32Const(binary_bytes, 1); |
| 1690 | binary_bytes.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.atomics_prefix)); | |
| 1691 | appendReservedUleb32(binary_bytes, @intFromEnum(std.wasm.AtomicsOpcode.i32_atomic_rmw_cmpxchg)); | |
| 1690 | binary_bytes.appendAssumeCapacity(@backingInt(std.wasm.Opcode.atomics_prefix)); | |
| 1691 | appendReservedUleb32(binary_bytes, @backingInt(std.wasm.AtomicsOpcode.i32_atomic_rmw_cmpxchg)); | |
| 1692 | 1692 | appendReservedUleb32(binary_bytes, 2); // alignment |
| 1693 | 1693 | appendReservedUleb32(binary_bytes, 0); // offset |
| 1694 | 1694 | |
| 1695 | 1695 | // based on the value from the atomic check, jump to the label. |
| 1696 | binary_bytes.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.br_table)); | |
| 1696 | binary_bytes.appendAssumeCapacity(@backingInt(std.wasm.Opcode.br_table)); | |
| 1697 | 1697 | appendReservedUleb32(binary_bytes, 2); // length of the table (we have 3 blocks but because of the mandatory default the length is 2). |
| 1698 | 1698 | appendReservedUleb32(binary_bytes, 0); // $init |
| 1699 | 1699 | appendReservedUleb32(binary_bytes, 1); // $wait |
| 1700 | 1700 | appendReservedUleb32(binary_bytes, 2); // $drop |
| 1701 | binary_bytes.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.end)); | |
| 1701 | binary_bytes.appendAssumeCapacity(@backingInt(std.wasm.Opcode.end)); | |
| 1702 | 1702 | } |
| 1703 | 1703 | |
| 1704 | 1704 | const segment_groups = wasm.flush_buffer.data_segment_groups.items; |
| ... | ... | @@ -1723,19 +1723,19 @@ fn emitInitMemoryFunction( |
| 1723 | 1723 | // global. This allows the runtime to use this static copy of the |
| 1724 | 1724 | // TLS data for the first/main thread. |
| 1725 | 1725 | appendReservedI32Const(binary_bytes, start_addr); |
| 1726 | binary_bytes.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.global_set)); | |
| 1726 | binary_bytes.appendAssumeCapacity(@backingInt(std.wasm.Opcode.global_set)); | |
| 1727 | 1727 | appendReservedUleb32(binary_bytes, virtual_addrs.tls_base.?); |
| 1728 | 1728 | } |
| 1729 | 1729 | |
| 1730 | 1730 | appendReservedI32Const(binary_bytes, 0); |
| 1731 | 1731 | appendReservedI32Const(binary_bytes, segment_size); |
| 1732 | binary_bytes.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.misc_prefix)); | |
| 1732 | binary_bytes.appendAssumeCapacity(@backingInt(std.wasm.Opcode.misc_prefix)); | |
| 1733 | 1733 | if (segment.isBss(wasm)) { |
| 1734 | 1734 | // fill bss segment with zeroes |
| 1735 | appendReservedUleb32(binary_bytes, @intFromEnum(std.wasm.MiscOpcode.memory_fill)); | |
| 1735 | appendReservedUleb32(binary_bytes, @backingInt(std.wasm.MiscOpcode.memory_fill)); | |
| 1736 | 1736 | } else { |
| 1737 | 1737 | // initialize the segment |
| 1738 | appendReservedUleb32(binary_bytes, @intFromEnum(std.wasm.MiscOpcode.memory_init)); | |
| 1738 | appendReservedUleb32(binary_bytes, @backingInt(std.wasm.MiscOpcode.memory_init)); | |
| 1739 | 1739 | appendReservedUleb32(binary_bytes, @intCast(segment_index)); |
| 1740 | 1740 | } |
| 1741 | 1741 | binary_bytes.appendAssumeCapacity(0); // memory index immediate |
| ... | ... | @@ -1747,38 +1747,38 @@ fn emitInitMemoryFunction( |
| 1747 | 1747 | // we set the init memory flag to value '2' |
| 1748 | 1748 | appendReservedI32Const(binary_bytes, flag_address); |
| 1749 | 1749 | appendReservedI32Const(binary_bytes, 2); |
| 1750 | binary_bytes.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.atomics_prefix)); | |
| 1751 | appendReservedUleb32(binary_bytes, @intFromEnum(std.wasm.AtomicsOpcode.i32_atomic_store)); | |
| 1750 | binary_bytes.appendAssumeCapacity(@backingInt(std.wasm.Opcode.atomics_prefix)); | |
| 1751 | appendReservedUleb32(binary_bytes, @backingInt(std.wasm.AtomicsOpcode.i32_atomic_store)); | |
| 1752 | 1752 | appendReservedUleb32(binary_bytes, @as(u32, 2)); // alignment |
| 1753 | 1753 | appendReservedUleb32(binary_bytes, @as(u32, 0)); // offset |
| 1754 | 1754 | |
| 1755 | 1755 | // notify any waiters for segment initialization completion |
| 1756 | 1756 | appendReservedI32Const(binary_bytes, flag_address); |
| 1757 | binary_bytes.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.i32_const)); | |
| 1757 | binary_bytes.appendAssumeCapacity(@backingInt(std.wasm.Opcode.i32_const)); | |
| 1758 | 1758 | appendReservedLeb128(binary_bytes, @as(i32, -1)); // number of waiters |
| 1759 | binary_bytes.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.atomics_prefix)); | |
| 1760 | appendReservedUleb32(binary_bytes, @intFromEnum(std.wasm.AtomicsOpcode.memory_atomic_notify)); | |
| 1759 | binary_bytes.appendAssumeCapacity(@backingInt(std.wasm.Opcode.atomics_prefix)); | |
| 1760 | appendReservedUleb32(binary_bytes, @backingInt(std.wasm.AtomicsOpcode.memory_atomic_notify)); | |
| 1761 | 1761 | appendReservedUleb32(binary_bytes, @as(u32, 2)); // alignment |
| 1762 | 1762 | appendReservedUleb32(binary_bytes, @as(u32, 0)); // offset |
| 1763 | binary_bytes.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.drop)); | |
| 1763 | binary_bytes.appendAssumeCapacity(@backingInt(std.wasm.Opcode.drop)); | |
| 1764 | 1764 | |
| 1765 | 1765 | // branch and drop segments |
| 1766 | binary_bytes.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.br)); | |
| 1766 | binary_bytes.appendAssumeCapacity(@backingInt(std.wasm.Opcode.br)); | |
| 1767 | 1767 | appendReservedUleb32(binary_bytes, @as(u32, 1)); |
| 1768 | 1768 | |
| 1769 | 1769 | // wait for thread to initialize memory segments |
| 1770 | binary_bytes.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.end)); // end $wait | |
| 1770 | binary_bytes.appendAssumeCapacity(@backingInt(std.wasm.Opcode.end)); // end $wait | |
| 1771 | 1771 | appendReservedI32Const(binary_bytes, flag_address); |
| 1772 | 1772 | appendReservedI32Const(binary_bytes, 1); // expected flag value |
| 1773 | binary_bytes.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.i64_const)); | |
| 1773 | binary_bytes.appendAssumeCapacity(@backingInt(std.wasm.Opcode.i64_const)); | |
| 1774 | 1774 | appendReservedLeb128(binary_bytes, @as(i64, -1)); // timeout |
| 1775 | binary_bytes.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.atomics_prefix)); | |
| 1776 | appendReservedUleb32(binary_bytes, @intFromEnum(std.wasm.AtomicsOpcode.memory_atomic_wait32)); | |
| 1775 | binary_bytes.appendAssumeCapacity(@backingInt(std.wasm.Opcode.atomics_prefix)); | |
| 1776 | appendReservedUleb32(binary_bytes, @backingInt(std.wasm.AtomicsOpcode.memory_atomic_wait32)); | |
| 1777 | 1777 | appendReservedUleb32(binary_bytes, @as(u32, 2)); // alignment |
| 1778 | 1778 | appendReservedUleb32(binary_bytes, @as(u32, 0)); // offset |
| 1779 | binary_bytes.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.drop)); | |
| 1779 | binary_bytes.appendAssumeCapacity(@backingInt(std.wasm.Opcode.drop)); | |
| 1780 | 1780 | |
| 1781 | binary_bytes.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.end)); // end $drop | |
| 1781 | binary_bytes.appendAssumeCapacity(@backingInt(std.wasm.Opcode.end)); // end $drop | |
| 1782 | 1782 | } |
| 1783 | 1783 | |
| 1784 | 1784 | for (segment_groups, 0..) |group, segment_index| { |
| ... | ... | @@ -1791,13 +1791,13 @@ fn emitInitMemoryFunction( |
| 1791 | 1791 | |
| 1792 | 1792 | try binary_bytes.ensureUnusedCapacity(gpa, 1 + 5 + 5 + 1); |
| 1793 | 1793 | |
| 1794 | binary_bytes.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.misc_prefix)); | |
| 1795 | appendReservedUleb32(binary_bytes, @intFromEnum(std.wasm.MiscOpcode.data_drop)); | |
| 1794 | binary_bytes.appendAssumeCapacity(@backingInt(std.wasm.Opcode.misc_prefix)); | |
| 1795 | appendReservedUleb32(binary_bytes, @backingInt(std.wasm.MiscOpcode.data_drop)); | |
| 1796 | 1796 | appendReservedUleb32(binary_bytes, @intCast(segment_index)); |
| 1797 | 1797 | } |
| 1798 | 1798 | |
| 1799 | 1799 | // End of the function body |
| 1800 | binary_bytes.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.end)); | |
| 1800 | binary_bytes.appendAssumeCapacity(@backingInt(std.wasm.Opcode.end)); | |
| 1801 | 1801 | } |
| 1802 | 1802 | |
| 1803 | 1803 | fn emitInitTlsFunction(wasm: *const Wasm, bytes: *ArrayList(u8)) Allocator.Error!void { |
| ... | ... | @@ -1821,28 +1821,28 @@ fn emitInitTlsFunction(wasm: *const Wasm, bytes: *ArrayList(u8)) Allocator.Error |
| 1821 | 1821 | |
| 1822 | 1822 | const param_local: u32 = 0; |
| 1823 | 1823 | |
| 1824 | bytes.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.local_get)); | |
| 1824 | bytes.appendAssumeCapacity(@backingInt(std.wasm.Opcode.local_get)); | |
| 1825 | 1825 | appendReservedUleb32(bytes, param_local); |
| 1826 | 1826 | |
| 1827 | const tls_base_global_index: Wasm.GlobalIndex = @enumFromInt(wasm.globals.getIndex(.__tls_base).?); | |
| 1828 | bytes.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.global_set)); | |
| 1829 | appendReservedUleb32(bytes, @intFromEnum(tls_base_global_index)); | |
| 1827 | const tls_base_global_index: Wasm.GlobalIndex = @fromBackingInt(@intCast(wasm.globals.getIndex(.__tls_base).?)); | |
| 1828 | bytes.appendAssumeCapacity(@backingInt(std.wasm.Opcode.global_set)); | |
| 1829 | appendReservedUleb32(bytes, @backingInt(tls_base_global_index)); | |
| 1830 | 1830 | |
| 1831 | 1831 | // load stack values for the bulk-memory operation |
| 1832 | 1832 | { |
| 1833 | bytes.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.local_get)); | |
| 1833 | bytes.appendAssumeCapacity(@backingInt(std.wasm.Opcode.local_get)); | |
| 1834 | 1834 | appendReservedUleb32(bytes, param_local); |
| 1835 | 1835 | |
| 1836 | bytes.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.i32_const)); | |
| 1836 | bytes.appendAssumeCapacity(@backingInt(std.wasm.Opcode.i32_const)); | |
| 1837 | 1837 | appendReservedUleb32(bytes, 0); //segment offset |
| 1838 | 1838 | |
| 1839 | bytes.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.i32_const)); | |
| 1839 | bytes.appendAssumeCapacity(@backingInt(std.wasm.Opcode.i32_const)); | |
| 1840 | 1840 | appendReservedUleb32(bytes, group_size); //segment offset |
| 1841 | 1841 | } |
| 1842 | 1842 | |
| 1843 | 1843 | // perform the bulk-memory operation to initialize the data segment |
| 1844 | bytes.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.misc_prefix)); | |
| 1845 | appendReservedUleb32(bytes, @intFromEnum(std.wasm.MiscOpcode.memory_init)); | |
| 1844 | bytes.appendAssumeCapacity(@backingInt(std.wasm.Opcode.misc_prefix)); | |
| 1845 | appendReservedUleb32(bytes, @backingInt(std.wasm.MiscOpcode.memory_init)); | |
| 1846 | 1846 | // segment immediate |
| 1847 | 1847 | appendReservedUleb32(bytes, data_segment_index); |
| 1848 | 1848 | // memory index immediate (always 0) |
| ... | ... | @@ -1853,17 +1853,17 @@ fn emitInitTlsFunction(wasm: *const Wasm, bytes: *ArrayList(u8)) Allocator.Error |
| 1853 | 1853 | // which performs all runtime TLS relocations. This is a synthetic function, |
| 1854 | 1854 | // generated by the linker. |
| 1855 | 1855 | if (wasm.functions.getIndex(.__wasm_apply_global_tls_relocs)) |function_index| { |
| 1856 | const output_function_index: Wasm.OutputFunctionIndex = .fromFunctionIndex(wasm, @enumFromInt(function_index)); | |
| 1857 | bytes.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.call)); | |
| 1858 | appendReservedUleb32(bytes, @intFromEnum(output_function_index)); | |
| 1856 | const output_function_index: Wasm.OutputFunctionIndex = .fromFunctionIndex(wasm, @fromBackingInt(@intCast(function_index))); | |
| 1857 | bytes.appendAssumeCapacity(@backingInt(std.wasm.Opcode.call)); | |
| 1858 | appendReservedUleb32(bytes, @backingInt(output_function_index)); | |
| 1859 | 1859 | } |
| 1860 | 1860 | |
| 1861 | bytes.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.end)); | |
| 1861 | bytes.appendAssumeCapacity(@backingInt(std.wasm.Opcode.end)); | |
| 1862 | 1862 | } |
| 1863 | 1863 | |
| 1864 | 1864 | fn emitStartSection(gpa: Allocator, bytes: *ArrayList(u8), i: Wasm.OutputFunctionIndex) !void { |
| 1865 | 1865 | const header_offset = try reserveVecSectionHeader(gpa, bytes); |
| 1866 | replaceVecSectionHeader(bytes, header_offset, .start, @intFromEnum(i)); | |
| 1866 | replaceVecSectionHeader(bytes, header_offset, .start, @backingInt(i)); | |
| 1867 | 1867 | } |
| 1868 | 1868 | |
| 1869 | 1869 | fn emitTagIndexFunction( |
| ... | ... | @@ -1887,31 +1887,31 @@ fn emitTagIndexFunction( |
| 1887 | 1887 | |
| 1888 | 1888 | appendReservedUleb32(code, 0); // no locals |
| 1889 | 1889 | |
| 1890 | code.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.block)); | |
| 1891 | code.appendAssumeCapacity(@intFromEnum(std.wasm.BlockType.empty)); | |
| 1890 | code.appendAssumeCapacity(@backingInt(std.wasm.Opcode.block)); | |
| 1891 | code.appendAssumeCapacity(@backingInt(std.wasm.BlockType.empty)); | |
| 1892 | 1892 | |
| 1893 | code.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.local_get)); | |
| 1893 | code.appendAssumeCapacity(@backingInt(std.wasm.Opcode.local_get)); | |
| 1894 | 1894 | appendReservedUleb32(code, 0); |
| 1895 | 1895 | |
| 1896 | 1896 | appendReservedI32Const(code, len); |
| 1897 | 1897 | |
| 1898 | 1898 | // if < len -> break out of block |
| 1899 | code.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.i32_lt_u)); | |
| 1899 | code.appendAssumeCapacity(@backingInt(std.wasm.Opcode.i32_lt_u)); | |
| 1900 | 1900 | |
| 1901 | code.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.br_if)); | |
| 1901 | code.appendAssumeCapacity(@backingInt(std.wasm.Opcode.br_if)); | |
| 1902 | 1902 | appendReservedUleb32(code, 0); |
| 1903 | 1903 | |
| 1904 | 1904 | // invalid -> return -1 |
| 1905 | 1905 | appendReservedI32Const(code, ~@as(u32, 0)); |
| 1906 | code.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.@"return")); | |
| 1906 | code.appendAssumeCapacity(@backingInt(std.wasm.Opcode.@"return")); | |
| 1907 | 1907 | |
| 1908 | code.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.end)); | |
| 1908 | code.appendAssumeCapacity(@backingInt(std.wasm.Opcode.end)); | |
| 1909 | 1909 | |
| 1910 | 1910 | // valid -> return input |
| 1911 | code.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.local_get)); | |
| 1911 | code.appendAssumeCapacity(@backingInt(std.wasm.Opcode.local_get)); | |
| 1912 | 1912 | appendReservedUleb32(code, 0); |
| 1913 | 1913 | |
| 1914 | code.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.end)); | |
| 1914 | code.appendAssumeCapacity(@backingInt(std.wasm.Opcode.end)); | |
| 1915 | 1915 | |
| 1916 | 1916 | return; |
| 1917 | 1917 | } |
| ... | ... | @@ -1931,8 +1931,8 @@ fn emitTagIndexFunction( |
| 1931 | 1931 | |
| 1932 | 1932 | for (tag_values, 0..) |tag_value, tag_index| { |
| 1933 | 1933 | // block for this if case |
| 1934 | code.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.block)); | |
| 1935 | code.appendAssumeCapacity(@intFromEnum(std.wasm.BlockType.empty)); | |
| 1934 | code.appendAssumeCapacity(@backingInt(std.wasm.Opcode.block)); | |
| 1935 | code.appendAssumeCapacity(@backingInt(std.wasm.BlockType.empty)); | |
| 1936 | 1936 | |
| 1937 | 1937 | const val: Zcu.Value = .fromInterned(tag_value); |
| 1938 | 1938 | if (is_big_int) { |
| ... | ... | @@ -1947,21 +1947,21 @@ fn emitTagIndexFunction( |
| 1947 | 1947 | try code.ensureUnusedCapacity(gpa, 35 * num_limbs); |
| 1948 | 1948 | |
| 1949 | 1949 | for (0..num_limbs) |limb_index| { |
| 1950 | code.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.local_get)); | |
| 1950 | code.appendAssumeCapacity(@backingInt(std.wasm.Opcode.local_get)); | |
| 1951 | 1951 | appendReservedUleb32(code, 0); |
| 1952 | 1952 | |
| 1953 | code.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.i64_load)); | |
| 1953 | code.appendAssumeCapacity(@backingInt(std.wasm.Opcode.i64_load)); | |
| 1954 | 1954 | appendReservedUleb32(code, @ctz(@as(u32, 8))); |
| 1955 | 1955 | appendReservedUleb32(code, @intCast(limb_index * 8)); |
| 1956 | 1956 | |
| 1957 | 1957 | appendReservedI64Const(code, limbs[limb_index]); |
| 1958 | code.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.i64_ne)); | |
| 1958 | code.appendAssumeCapacity(@backingInt(std.wasm.Opcode.i64_ne)); | |
| 1959 | 1959 | |
| 1960 | code.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.br_if)); | |
| 1960 | code.appendAssumeCapacity(@backingInt(std.wasm.Opcode.br_if)); | |
| 1961 | 1961 | appendReservedUleb32(code, 0); |
| 1962 | 1962 | } |
| 1963 | 1963 | } else { |
| 1964 | code.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.local_get)); | |
| 1964 | code.appendAssumeCapacity(@backingInt(std.wasm.Opcode.local_get)); | |
| 1965 | 1965 | appendReservedUleb32(code, 0); |
| 1966 | 1966 | |
| 1967 | 1967 | switch (int_info.bits) { |
| ... | ... | @@ -1971,7 +1971,7 @@ fn emitTagIndexFunction( |
| 1971 | 1971 | .unsigned => @intCast(val.toUnsignedInt(zcu)), |
| 1972 | 1972 | }; |
| 1973 | 1973 | appendReservedI32Const(code, x); |
| 1974 | code.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.i32_ne)); | |
| 1974 | code.appendAssumeCapacity(@backingInt(std.wasm.Opcode.i32_ne)); | |
| 1975 | 1975 | }, |
| 1976 | 1976 | 33...64 => { |
| 1977 | 1977 | const x: u64 = switch (int_info.signedness) { |
| ... | ... | @@ -1979,30 +1979,30 @@ fn emitTagIndexFunction( |
| 1979 | 1979 | .unsigned => val.toUnsignedInt(zcu), |
| 1980 | 1980 | }; |
| 1981 | 1981 | appendReservedI64Const(code, x); |
| 1982 | code.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.i64_ne)); | |
| 1982 | code.appendAssumeCapacity(@backingInt(std.wasm.Opcode.i64_ne)); | |
| 1983 | 1983 | }, |
| 1984 | 1984 | else => unreachable, |
| 1985 | 1985 | } |
| 1986 | 1986 | |
| 1987 | code.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.br_if)); | |
| 1987 | code.appendAssumeCapacity(@backingInt(std.wasm.Opcode.br_if)); | |
| 1988 | 1988 | appendReservedUleb32(code, 0); |
| 1989 | 1989 | } |
| 1990 | 1990 | |
| 1991 | 1991 | appendReservedI32Const(code, @intCast(tag_index)); |
| 1992 | 1992 | |
| 1993 | code.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.@"return")); | |
| 1993 | code.appendAssumeCapacity(@backingInt(std.wasm.Opcode.@"return")); | |
| 1994 | 1994 | // end the block for this case |
| 1995 | code.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.end)); | |
| 1995 | code.appendAssumeCapacity(@backingInt(std.wasm.Opcode.end)); | |
| 1996 | 1996 | } |
| 1997 | 1997 | |
| 1998 | 1998 | appendReservedI32Const(code, ~@as(u32, 0)); |
| 1999 | 1999 | |
| 2000 | code.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.end)); | |
| 2000 | code.appendAssumeCapacity(@backingInt(std.wasm.Opcode.end)); | |
| 2001 | 2001 | } |
| 2002 | 2002 | |
| 2003 | 2003 | /// Writes an unsigned 32-bit integer as a LEB128-encoded 'i32.const' value. |
| 2004 | 2004 | fn appendReservedI32Const(bytes: *ArrayList(u8), val: u32) void { |
| 2005 | bytes.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.i32_const)); | |
| 2005 | bytes.appendAssumeCapacity(@backingInt(std.wasm.Opcode.i32_const)); | |
| 2006 | 2006 | var w: std.Io.Writer = .fromArrayList(bytes); |
| 2007 | 2007 | defer bytes.* = w.toArrayList(); |
| 2008 | 2008 | return w.writeSleb128(@as(i32, @bitCast(val))) catch |err| switch (err) { |
| ... | ... | @@ -2012,7 +2012,7 @@ fn appendReservedI32Const(bytes: *ArrayList(u8), val: u32) void { |
| 2012 | 2012 | |
| 2013 | 2013 | /// Writes an unsigned 64-bit integer as a LEB128-encoded 'i64.const' value. |
| 2014 | 2014 | fn appendReservedI64Const(bytes: *ArrayList(u8), val: u64) void { |
| 2015 | bytes.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.i64_const)); | |
| 2015 | bytes.appendAssumeCapacity(@backingInt(std.wasm.Opcode.i64_const)); | |
| 2016 | 2016 | var w: std.Io.Writer = .fromArrayList(bytes); |
| 2017 | 2017 | defer bytes.* = w.toArrayList(); |
| 2018 | 2018 | return w.writeSleb128(@as(i64, @bitCast(val))) catch |err| switch (err) { |
| ... | ... | @@ -2030,11 +2030,11 @@ fn appendReservedUleb32(bytes: *ArrayList(u8), val: u32) void { |
| 2030 | 2030 | |
| 2031 | 2031 | fn appendGlobal(gpa: Allocator, bytes: *ArrayList(u8), mutable: u8, val: u32) Allocator.Error!void { |
| 2032 | 2032 | try bytes.ensureUnusedCapacity(gpa, 9); |
| 2033 | bytes.appendAssumeCapacity(@intFromEnum(std.wasm.Valtype.i32)); | |
| 2033 | bytes.appendAssumeCapacity(@backingInt(std.wasm.Valtype.i32)); | |
| 2034 | 2034 | bytes.appendAssumeCapacity(mutable); |
| 2035 | bytes.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.i32_const)); | |
| 2035 | bytes.appendAssumeCapacity(@backingInt(std.wasm.Opcode.i32_const)); | |
| 2036 | 2036 | appendReservedUleb32(bytes, val); |
| 2037 | bytes.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.end)); | |
| 2037 | bytes.appendAssumeCapacity(@backingInt(std.wasm.Opcode.end)); | |
| 2038 | 2038 | } |
| 2039 | 2039 | |
| 2040 | 2040 | fn appendLeb128(gpa: Allocator, bytes: *ArrayList(u8), value: anytype) Allocator.Error!void { |
src/link/Wasm/Object.zig+34-34| ... | ... | @@ -195,7 +195,7 @@ pub const ScratchSpace = struct { |
| 195 | 195 | _, |
| 196 | 196 | |
| 197 | 197 | fn ptr(index: FuncImportIndex, ss: *const ScratchSpace) *FunctionImport { |
| 198 | return &ss.func_imports.items[@intFromEnum(index)]; | |
| 198 | return &ss.func_imports.items[@backingInt(index)]; | |
| 199 | 199 | } |
| 200 | 200 | }; |
| 201 | 201 | |
| ... | ... | @@ -204,7 +204,7 @@ pub const ScratchSpace = struct { |
| 204 | 204 | _, |
| 205 | 205 | |
| 206 | 206 | fn ptr(index: GlobalImportIndex, ss: *const ScratchSpace) *GlobalImport { |
| 207 | return &ss.global_imports.items[@intFromEnum(index)]; | |
| 207 | return &ss.global_imports.items[@backingInt(index)]; | |
| 208 | 208 | } |
| 209 | 209 | }; |
| 210 | 210 | |
| ... | ... | @@ -213,7 +213,7 @@ pub const ScratchSpace = struct { |
| 213 | 213 | _, |
| 214 | 214 | |
| 215 | 215 | fn ptr(index: TableImportIndex, ss: *const ScratchSpace) *TableImport { |
| 216 | return &ss.table_imports.items[@intFromEnum(index)]; | |
| 216 | return &ss.table_imports.items[@backingInt(index)]; | |
| 217 | 217 | } |
| 218 | 218 | }; |
| 219 | 219 | |
| ... | ... | @@ -222,7 +222,7 @@ pub const ScratchSpace = struct { |
| 222 | 222 | _, |
| 223 | 223 | |
| 224 | 224 | fn ptr(index: FuncTypeIndex, ss: *const ScratchSpace) *Wasm.FunctionType.Index { |
| 225 | return &ss.func_types.items[@intFromEnum(index)]; | |
| 225 | return &ss.func_types.items[@backingInt(index)]; | |
| 226 | 226 | } |
| 227 | 227 | }; |
| 228 | 228 | |
| ... | ... | @@ -285,7 +285,7 @@ pub fn parse( |
| 285 | 285 | const table_imports_start: u32 = @intCast(wasm.object_table_imports.entries.len); |
| 286 | 286 | const data_imports_start: u32 = @intCast(wasm.object_data_imports.entries.len); |
| 287 | 287 | const local_section_index_base = wasm.object_total_sections; |
| 288 | const object_index: Wasm.ObjectIndex = @enumFromInt(wasm.objects.items.len); | |
| 288 | const object_index: Wasm.ObjectIndex = @fromBackingInt(@intCast(wasm.objects.items.len)); | |
| 289 | 289 | const source_location: Wasm.SourceLocation = .fromObject(object_index, wasm); |
| 290 | 290 | |
| 291 | 291 | ss.clear(); |
| ... | ... | @@ -299,9 +299,9 @@ pub fn parse( |
| 299 | 299 | var global_section_index: ?Wasm.ObjectSectionIndex = null; |
| 300 | 300 | var data_section_index: ?Wasm.ObjectSectionIndex = null; |
| 301 | 301 | while (pos < bytes.len) : (wasm.object_total_sections += 1) { |
| 302 | const section_index: Wasm.ObjectSectionIndex = @enumFromInt(wasm.object_total_sections); | |
| 302 | const section_index: Wasm.ObjectSectionIndex = @fromBackingInt(@intCast(wasm.object_total_sections)); | |
| 303 | 303 | |
| 304 | const section_tag: std.wasm.Section = @enumFromInt(bytes[pos]); | |
| 304 | const section_tag: std.wasm.Section = @fromBackingInt(@intCast(bytes[pos])); | |
| 305 | 305 | pos += 1; |
| 306 | 306 | |
| 307 | 307 | const len, pos = readLeb(u32, bytes, pos); |
| ... | ... | @@ -316,13 +316,13 @@ pub fn parse( |
| 316 | 316 | if (section_version != 2) return error.UnsupportedVersion; |
| 317 | 317 | while (pos < section_end) { |
| 318 | 318 | const sub_type, pos = readLeb(u8, bytes, pos); |
| 319 | log.debug("found subsection: {s}", .{@tagName(@as(SubsectionType, @enumFromInt(sub_type)))}); | |
| 319 | log.debug("found subsection: {s}", .{@tagName(@as(SubsectionType, @fromBackingInt(@intCast(sub_type))))}); | |
| 320 | 320 | const payload_len, pos = readLeb(u32, bytes, pos); |
| 321 | 321 | if (payload_len == 0) break; |
| 322 | 322 | |
| 323 | 323 | const count, pos = readLeb(u32, bytes, pos); |
| 324 | 324 | |
| 325 | switch (@as(SubsectionType, @enumFromInt(sub_type))) { | |
| 325 | switch (@as(SubsectionType, @fromBackingInt(@intCast(sub_type)))) { | |
| 326 | 326 | .segment_info => { |
| 327 | 327 | for (try ss.segment_info.addManyAsSlice(gpa, count)) |*segment| { |
| 328 | 328 | const name, pos = readBytes(bytes, pos); |
| ... | ... | @@ -340,7 +340,7 @@ pub fn parse( |
| 340 | 340 | .flags = .{ |
| 341 | 341 | .strings = flags.strings, |
| 342 | 342 | .tls = tls, |
| 343 | .alignment = @enumFromInt(alignment), | |
| 343 | .alignment = @fromBackingInt(@intCast(alignment)), | |
| 344 | 344 | .retain = flags.retain, |
| 345 | 345 | }, |
| 346 | 346 | }; |
| ... | ... | @@ -418,27 +418,27 @@ pub fn parse( |
| 418 | 418 | const segment_offset, pos = readLeb(u32, bytes, pos); |
| 419 | 419 | const size, pos = readLeb(u32, bytes, pos); |
| 420 | 420 | try wasm.object_datas.append(gpa, .{ |
| 421 | .segment = @enumFromInt(data_segment_start + segment_index), | |
| 421 | .segment = @fromBackingInt(@intCast(data_segment_start + segment_index)), | |
| 422 | 422 | .offset = segment_offset, |
| 423 | 423 | .size = size, |
| 424 | 424 | .name = interned_name, |
| 425 | 425 | .flags = symbol.flags, |
| 426 | 426 | }); |
| 427 | 427 | symbol.pointee = .{ |
| 428 | .data = @enumFromInt(wasm.object_datas.items.len - 1), | |
| 428 | .data = @fromBackingInt(@intCast(wasm.object_datas.items.len - 1)), | |
| 429 | 429 | }; |
| 430 | 430 | } |
| 431 | 431 | }, |
| 432 | 432 | .section => { |
| 433 | 433 | const local_section, pos = readLeb(u32, bytes, pos); |
| 434 | const section: Wasm.ObjectSectionIndex = @enumFromInt(local_section_index_base + local_section); | |
| 434 | const section: Wasm.ObjectSectionIndex = @fromBackingInt(@intCast(local_section_index_base + local_section)); | |
| 435 | 435 | symbol.pointee = .{ .section = section }; |
| 436 | 436 | }, |
| 437 | 437 | |
| 438 | 438 | .function => { |
| 439 | 439 | const local_index, pos = readLeb(u32, bytes, pos); |
| 440 | 440 | if (symbol.flags.undefined) { |
| 441 | const function_import: ScratchSpace.FuncImportIndex = @enumFromInt(local_index); | |
| 441 | const function_import: ScratchSpace.FuncImportIndex = @fromBackingInt(@intCast(local_index)); | |
| 442 | 442 | symbol.pointee = .{ .function_import = function_import }; |
| 443 | 443 | if (symbol.flags.explicit_name) { |
| 444 | 444 | const name, pos = readBytes(bytes, pos); |
| ... | ... | @@ -447,7 +447,7 @@ pub fn parse( |
| 447 | 447 | symbol.name = function_import.ptr(ss).name.toOptional(); |
| 448 | 448 | } |
| 449 | 449 | } else { |
| 450 | symbol.pointee = .{ .function = @enumFromInt(functions_start + (local_index - ss.func_imports.items.len)) }; | |
| 450 | symbol.pointee = .{ .function = @fromBackingInt(@intCast(functions_start + (local_index - ss.func_imports.items.len))) }; | |
| 451 | 451 | const name, pos = readBytes(bytes, pos); |
| 452 | 452 | symbol.name = (try wasm.internString(name)).toOptional(); |
| 453 | 453 | } |
| ... | ... | @@ -455,7 +455,7 @@ pub fn parse( |
| 455 | 455 | .global => { |
| 456 | 456 | const local_index, pos = readLeb(u32, bytes, pos); |
| 457 | 457 | if (symbol.flags.undefined) { |
| 458 | const global_import: ScratchSpace.GlobalImportIndex = @enumFromInt(local_index); | |
| 458 | const global_import: ScratchSpace.GlobalImportIndex = @fromBackingInt(@intCast(local_index)); | |
| 459 | 459 | symbol.pointee = .{ .global_import = global_import }; |
| 460 | 460 | if (symbol.flags.explicit_name) { |
| 461 | 461 | const name, pos = readBytes(bytes, pos); |
| ... | ... | @@ -464,7 +464,7 @@ pub fn parse( |
| 464 | 464 | symbol.name = global_import.ptr(ss).name.toOptional(); |
| 465 | 465 | } |
| 466 | 466 | } else { |
| 467 | symbol.pointee = .{ .global = @enumFromInt(globals_start + (local_index - ss.global_imports.items.len)) }; | |
| 467 | symbol.pointee = .{ .global = @fromBackingInt(@intCast(globals_start + (local_index - ss.global_imports.items.len))) }; | |
| 468 | 468 | const name, pos = readBytes(bytes, pos); |
| 469 | 469 | symbol.name = (try wasm.internString(name)).toOptional(); |
| 470 | 470 | } |
| ... | ... | @@ -473,7 +473,7 @@ pub fn parse( |
| 473 | 473 | const local_index, pos = readLeb(u32, bytes, pos); |
| 474 | 474 | if (symbol.flags.undefined) { |
| 475 | 475 | table_import_symbol_count += 1; |
| 476 | const table_import: ScratchSpace.TableImportIndex = @enumFromInt(local_index); | |
| 476 | const table_import: ScratchSpace.TableImportIndex = @fromBackingInt(@intCast(local_index)); | |
| 477 | 477 | symbol.pointee = .{ .table_import = table_import }; |
| 478 | 478 | if (symbol.flags.explicit_name) { |
| 479 | 479 | const name, pos = readBytes(bytes, pos); |
| ... | ... | @@ -482,13 +482,13 @@ pub fn parse( |
| 482 | 482 | symbol.name = table_import.ptr(ss).name.toOptional(); |
| 483 | 483 | } |
| 484 | 484 | } else { |
| 485 | symbol.pointee = .{ .table = @enumFromInt(tables_start + (local_index - ss.table_imports.items.len)) }; | |
| 485 | symbol.pointee = .{ .table = @fromBackingInt(@intCast(tables_start + (local_index - ss.table_imports.items.len))) }; | |
| 486 | 486 | const name, pos = readBytes(bytes, pos); |
| 487 | 487 | symbol.name = (try wasm.internString(name)).toOptional(); |
| 488 | 488 | } |
| 489 | 489 | }, |
| 490 | 490 | else => { |
| 491 | log.debug("unrecognized symbol type tag: {x}", .{@intFromEnum(tag)}); | |
| 491 | log.debug("unrecognized symbol type tag: {x}", .{@backingInt(tag)}); | |
| 492 | 492 | return error.UnrecognizedSymbolType; |
| 493 | 493 | }, |
| 494 | 494 | } |
| ... | ... | @@ -506,14 +506,14 @@ pub fn parse( |
| 506 | 506 | // "Relocation sections can only target code, data and custom sections." |
| 507 | 507 | const local_section, pos = readLeb(u32, bytes, pos); |
| 508 | 508 | const count, pos = readLeb(u32, bytes, pos); |
| 509 | const section: Wasm.ObjectSectionIndex = @enumFromInt(local_section_index_base + local_section); | |
| 509 | const section: Wasm.ObjectSectionIndex = @fromBackingInt(@intCast(local_section_index_base + local_section)); | |
| 510 | 510 | |
| 511 | 511 | log.debug("found {d} relocations for section={d}", .{ count, section }); |
| 512 | 512 | |
| 513 | 513 | var prev_offset: u32 = 0; |
| 514 | 514 | try wasm.object_relocations.ensureUnusedCapacity(gpa, count); |
| 515 | 515 | for (0..count) |_| { |
| 516 | const tag: RelocationType = @enumFromInt(bytes[pos]); | |
| 516 | const tag: RelocationType = @fromBackingInt(@intCast(bytes[pos])); | |
| 517 | 517 | pos += 1; |
| 518 | 518 | const offset, pos = readLeb(u32, bytes, pos); |
| 519 | 519 | const index, pos = readLeb(u32, bytes, pos); |
| ... | ... | @@ -668,7 +668,7 @@ pub fn parse( |
| 668 | 668 | |
| 669 | 669 | try wasm.object_custom_segments.put(gpa, section_index, .{ |
| 670 | 670 | .payload = .{ |
| 671 | .off = @enumFromInt(data_off), | |
| 671 | .off = @fromBackingInt(@intCast(data_off)), | |
| 672 | 672 | .len = @intCast(debug_content.len), |
| 673 | 673 | }, |
| 674 | 674 | .flags = .{}, |
| ... | ... | @@ -706,7 +706,7 @@ pub fn parse( |
| 706 | 706 | try ss.func_imports.append(gpa, .{ |
| 707 | 707 | .module_name = interned_module_name, |
| 708 | 708 | .name = interned_name, |
| 709 | .function_index = @enumFromInt(function), | |
| 709 | .function_index = @fromBackingInt(@intCast(function)), | |
| 710 | 710 | }); |
| 711 | 711 | }, |
| 712 | 712 | .memory => { |
| ... | ... | @@ -766,7 +766,7 @@ pub fn parse( |
| 766 | 766 | const functions_len, pos = readLeb(u32, bytes, pos); |
| 767 | 767 | for (try ss.func_type_indexes.addManyAsSlice(gpa, functions_len)) |*func_type_index| { |
| 768 | 768 | const i, pos = readLeb(u32, bytes, pos); |
| 769 | func_type_index.* = @enumFromInt(i); | |
| 769 | func_type_index.* = @fromBackingInt(@intCast(i)); | |
| 770 | 770 | } |
| 771 | 771 | }, |
| 772 | 772 | .table => { |
| ... | ... | @@ -837,23 +837,23 @@ pub fn parse( |
| 837 | 837 | // existing symbol table data if the name matches. |
| 838 | 838 | for (try ss.exports.addManyAsSlice(gpa, exports_len)) |*exp| { |
| 839 | 839 | const name, pos = readBytes(bytes, pos); |
| 840 | const kind: std.wasm.ExternalKind = @enumFromInt(bytes[pos]); | |
| 840 | const kind: std.wasm.ExternalKind = @fromBackingInt(@intCast(bytes[pos])); | |
| 841 | 841 | pos += 1; |
| 842 | 842 | const index, pos = readLeb(u32, bytes, pos); |
| 843 | 843 | exp.* = .{ |
| 844 | 844 | .name = try wasm.internString(name), |
| 845 | 845 | .pointee = switch (kind) { |
| 846 | .function => .{ .function = @enumFromInt(functions_start + (index - ss.func_imports.items.len)) }, | |
| 847 | .table => .{ .table = @enumFromInt(tables_start + (index - ss.table_imports.items.len)) }, | |
| 848 | .memory => .{ .memory = @enumFromInt(memories_start + index) }, | |
| 849 | .global => .{ .global = @enumFromInt(globals_start + (index - ss.global_imports.items.len)) }, | |
| 846 | .function => .{ .function = @fromBackingInt(@intCast(functions_start + (index - ss.func_imports.items.len))) }, | |
| 847 | .table => .{ .table = @fromBackingInt(@intCast(tables_start + (index - ss.table_imports.items.len))) }, | |
| 848 | .memory => .{ .memory = @fromBackingInt(@intCast(memories_start + index)) }, | |
| 849 | .global => .{ .global = @fromBackingInt(@intCast(globals_start + (index - ss.global_imports.items.len))) }, | |
| 850 | 850 | }, |
| 851 | 851 | }; |
| 852 | 852 | } |
| 853 | 853 | }, |
| 854 | 854 | .start => { |
| 855 | 855 | const index, pos = readLeb(u32, bytes, pos); |
| 856 | start_function = @enumFromInt(functions_start + index); | |
| 856 | start_function = @fromBackingInt(@intCast(functions_start + index)); | |
| 857 | 857 | }, |
| 858 | 858 | .element => { |
| 859 | 859 | log.warn("unimplemented: element section in {f} {?s}", .{ path, archive_member_name }); |
| ... | ... | @@ -1000,7 +1000,7 @@ pub fn parse( |
| 1000 | 1000 | .no_strip = true, |
| 1001 | 1001 | }, |
| 1002 | 1002 | .name = table_import_name.toOptional(), |
| 1003 | .pointee = .{ .table_import = @enumFromInt(0) }, | |
| 1003 | .pointee = .{ .table_import = @fromBackingInt(@intCast(0)) }, | |
| 1004 | 1004 | }); |
| 1005 | 1005 | } |
| 1006 | 1006 | |
| ... | ... | @@ -1482,7 +1482,7 @@ fn readBytes(bytes: []const u8, start_pos: usize) struct { []const u8, usize } { |
| 1482 | 1482 | fn readEnum(comptime T: type, bytes: []const u8, pos: usize) struct { T, usize } { |
| 1483 | 1483 | const Tag = @typeInfo(T).@"enum".tag_type; |
| 1484 | 1484 | const int, const new_pos = readLeb(Tag, bytes, pos); |
| 1485 | return .{ @enumFromInt(int), new_pos }; | |
| 1485 | return .{ @fromBackingInt(@intCast(int)), new_pos }; | |
| 1486 | 1486 | } |
| 1487 | 1487 | |
| 1488 | 1488 | fn readLimits(bytes: []const u8, start_pos: usize) struct { std.wasm.Limits, usize } { |
| ... | ... | @@ -1503,7 +1503,7 @@ fn readInit(wasm: *Wasm, bytes: []const u8, pos: usize) !struct { Wasm.Expr, usi |
| 1503 | 1503 | |
| 1504 | 1504 | pub fn exprEndPos(bytes: []const u8, pos: usize) error{InvalidInitOpcode}!usize { |
| 1505 | 1505 | const opcode = bytes[pos]; |
| 1506 | return switch (@as(std.wasm.Opcode, @enumFromInt(opcode))) { | |
| 1506 | return switch (@as(std.wasm.Opcode, @fromBackingInt(@intCast(opcode)))) { | |
| 1507 | 1507 | .i32_const => readLeb(i32, bytes, pos + 1)[1], |
| 1508 | 1508 | .i64_const => readLeb(i64, bytes, pos + 1)[1], |
| 1509 | 1509 | .f32_const => pos + 5, |
src/main.zig+5-5| ... | ... | @@ -140,8 +140,8 @@ pub fn log( |
| 140 | 140 | // Hide debug messages unless: |
| 141 | 141 | // * logging enabled with `-Dlog`. |
| 142 | 142 | // * the --debug-log arg for the scope has been provided |
| 143 | if (@intFromEnum(level) > @intFromEnum(std.options.log_level) or | |
| 144 | @intFromEnum(level) > @intFromEnum(std.log.Level.info)) | |
| 143 | if (@backingInt(level) > @backingInt(std.options.log_level) or | |
| 144 | @backingInt(level) > @backingInt(std.log.Level.info)) | |
| 145 | 145 | { |
| 146 | 146 | if (!build_options.enable_logging) return; |
| 147 | 147 | |
| ... | ... | @@ -4420,7 +4420,7 @@ fn serve( |
| 4420 | 4420 | } |
| 4421 | 4421 | }, |
| 4422 | 4422 | else => { |
| 4423 | fatal("unrecognized message from client: 0x{x}", .{@intFromEnum(hdr.tag)}); | |
| 4423 | fatal("unrecognized message from client: 0x{x}", .{@backingInt(hdr.tag)}); | |
| 4424 | 4424 | }, |
| 4425 | 4425 | } |
| 4426 | 4426 | } |
| ... | ... | @@ -5732,8 +5732,8 @@ fn cmdChangelist(arena: Allocator, io: Io, args: []const []const u8, environ_map |
| 5732 | 5732 | var it = inst_map.iterator(); |
| 5733 | 5733 | while (it.next()) |entry| { |
| 5734 | 5734 | try stdout_bw.print(" %{d} => %{d}\n", .{ |
| 5735 | @intFromEnum(entry.key_ptr.*), | |
| 5736 | @intFromEnum(entry.value_ptr.*), | |
| 5735 | @backingInt(entry.key_ptr.*), | |
| 5736 | @backingInt(entry.value_ptr.*), | |
| 5737 | 5737 | }); |
| 5738 | 5738 | } |
| 5739 | 5739 | } |
src/print_zir.zig+99-99| ... | ... | @@ -26,10 +26,10 @@ pub fn renderAsText(gpa: Allocator, tree: ?Ast, zir: Zir, bw: *std.Io.Writer) !v |
| 26 | 26 | }; |
| 27 | 27 | |
| 28 | 28 | const main_struct_inst: Zir.Inst.Index = .main_struct_inst; |
| 29 | try bw.print("%{d} ", .{@intFromEnum(main_struct_inst)}); | |
| 29 | try bw.print("%{d} ", .{@backingInt(main_struct_inst)}); | |
| 30 | 30 | try writer.writeInstToStream(bw, main_struct_inst); |
| 31 | 31 | try bw.writeAll("\n"); |
| 32 | const imports_index = zir.extra[@intFromEnum(Zir.ExtraIndex.imports)]; | |
| 32 | const imports_index = zir.extra[@backingInt(Zir.ExtraIndex.imports)]; | |
| 33 | 33 | if (imports_index != 0) { |
| 34 | 34 | try bw.writeAll("Imports:\n"); |
| 35 | 35 | |
| ... | ... | @@ -75,7 +75,7 @@ pub fn renderInstructionContext( |
| 75 | 75 | |
| 76 | 76 | try writer.writeBody(bw, block[0..block_index]); |
| 77 | 77 | try bw.splatByteAll(' ', writer.indent - 2); |
| 78 | try bw.print("> %{d} ", .{@intFromEnum(block[block_index])}); | |
| 78 | try bw.print("> %{d} ", .{@backingInt(block[block_index])}); | |
| 79 | 79 | try writer.writeInstToStream(bw, block[block_index]); |
| 80 | 80 | try bw.writeByte('\n'); |
| 81 | 81 | if (block_index + 1 < block.len) { |
| ... | ... | @@ -105,7 +105,7 @@ pub fn renderSingleInstruction( |
| 105 | 105 | .recurse_blocks = false, |
| 106 | 106 | }; |
| 107 | 107 | |
| 108 | try bw.print("%{d} ", .{@intFromEnum(inst)}); | |
| 108 | try bw.print("%{d} ", .{@backingInt(inst)}); | |
| 109 | 109 | try writer.writeInstToStream(bw, inst); |
| 110 | 110 | } |
| 111 | 111 | |
| ... | ... | @@ -184,8 +184,8 @@ const Writer = struct { |
| 184 | 184 | inst: Zir.Inst.Index, |
| 185 | 185 | ) Error!void { |
| 186 | 186 | const tags = self.code.instructions.items(.tag); |
| 187 | const tag = tags[@intFromEnum(inst)]; | |
| 188 | try stream.print("= {s}(", .{@tagName(tags[@intFromEnum(inst)])}); | |
| 187 | const tag = tags[@backingInt(inst)]; | |
| 188 | try stream.print("= {s}(", .{@tagName(tags[@backingInt(inst)])}); | |
| 189 | 189 | switch (tag) { |
| 190 | 190 | .alloc, |
| 191 | 191 | .alloc_mut, |
| ... | ... | @@ -510,7 +510,7 @@ const Writer = struct { |
| 510 | 510 | } |
| 511 | 511 | |
| 512 | 512 | fn writeExtended(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { |
| 513 | const extended = self.code.instructions.items(.data)[@intFromEnum(inst)].extended; | |
| 513 | const extended = self.code.instructions.items(.data)[@backingInt(inst)].extended; | |
| 514 | 514 | try stream.print("{s}(", .{@tagName(extended.opcode)}); |
| 515 | 515 | switch (extended.opcode) { |
| 516 | 516 | .this, |
| ... | ... | @@ -593,7 +593,7 @@ const Writer = struct { |
| 593 | 593 | }, |
| 594 | 594 | |
| 595 | 595 | .round_op => { |
| 596 | const round_op: Zir.Inst.RoundOp = @enumFromInt(extended.small); | |
| 596 | const round_op: Zir.Inst.RoundOp = @fromBackingInt(@intCast(extended.small)); | |
| 597 | 597 | const inst_data = self.code.extraData(Zir.Inst.BinNode, extended.operand).data; |
| 598 | 598 | try stream.print("{s}, ", .{@tagName(round_op)}); |
| 599 | 599 | try self.writeInstRef(stream, inst_data.lhs); |
| ... | ... | @@ -604,7 +604,7 @@ const Writer = struct { |
| 604 | 604 | }, |
| 605 | 605 | |
| 606 | 606 | .reify_slice_arg_ty => { |
| 607 | const reify_slice_arg_info: Zir.Inst.ReifySliceArgInfo = @enumFromInt(extended.small); | |
| 607 | const reify_slice_arg_info: Zir.Inst.ReifySliceArgInfo = @fromBackingInt(@intCast(extended.small)); | |
| 608 | 608 | const extra = self.code.extraData(Zir.Inst.UnNode, extended.operand).data; |
| 609 | 609 | try stream.print("{t}, ", .{reify_slice_arg_info}); |
| 610 | 610 | try self.writeInstRef(stream, extra.operand); |
| ... | ... | @@ -638,7 +638,7 @@ const Writer = struct { |
| 638 | 638 | }, |
| 639 | 639 | .reify_struct => { |
| 640 | 640 | const extra = self.code.extraData(Zir.Inst.ReifyStruct, extended.operand).data; |
| 641 | const name_strat: Zir.Inst.NameStrategy = @enumFromInt(extended.small); | |
| 641 | const name_strat: Zir.Inst.NameStrategy = @fromBackingInt(@intCast(extended.small)); | |
| 642 | 642 | try stream.print("line({d}), {t}, ", .{ extra.src_line, name_strat }); |
| 643 | 643 | try self.writeInstRef(stream, extra.layout); |
| 644 | 644 | try stream.writeAll(", "); |
| ... | ... | @@ -657,7 +657,7 @@ const Writer = struct { |
| 657 | 657 | }, |
| 658 | 658 | .reify_union => { |
| 659 | 659 | const extra = self.code.extraData(Zir.Inst.ReifyUnion, extended.operand).data; |
| 660 | const name_strat: Zir.Inst.NameStrategy = @enumFromInt(extended.small); | |
| 660 | const name_strat: Zir.Inst.NameStrategy = @fromBackingInt(@intCast(extended.small)); | |
| 661 | 661 | try stream.print("line({d}), {t}, ", .{ extra.src_line, name_strat }); |
| 662 | 662 | try self.writeInstRef(stream, extra.layout); |
| 663 | 663 | try stream.writeAll(", "); |
| ... | ... | @@ -676,7 +676,7 @@ const Writer = struct { |
| 676 | 676 | }, |
| 677 | 677 | .reify_enum => { |
| 678 | 678 | const extra = self.code.extraData(Zir.Inst.ReifyEnum, extended.operand).data; |
| 679 | const name_strat: Zir.Inst.NameStrategy = @enumFromInt(extended.small); | |
| 679 | const name_strat: Zir.Inst.NameStrategy = @fromBackingInt(@intCast(extended.small)); | |
| 680 | 680 | try stream.print("line({d}), {t}, ", .{ extra.src_line, name_strat }); |
| 681 | 681 | try self.writeInstRef(stream, extra.tag_ty); |
| 682 | 682 | try stream.writeAll(", "); |
| ... | ... | @@ -719,14 +719,14 @@ const Writer = struct { |
| 719 | 719 | |
| 720 | 720 | fn writeExtNode(self: *Writer, stream: *std.Io.Writer, extended: Zir.Inst.Extended.InstData) !void { |
| 721 | 721 | try stream.writeAll(")) "); |
| 722 | const src_node: Ast.Node.Offset = @enumFromInt(@as(i32, @bitCast(extended.operand))); | |
| 722 | const src_node: Ast.Node.Offset = @fromBackingInt(@intCast(@as(i32, @bitCast(extended.operand)))); | |
| 723 | 723 | try self.writeSrcNode(stream, src_node); |
| 724 | 724 | } |
| 725 | 725 | |
| 726 | 726 | fn writeArrayInitElemType(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { |
| 727 | const inst_data = self.code.instructions.items(.data)[@intFromEnum(inst)].bin; | |
| 727 | const inst_data = self.code.instructions.items(.data)[@backingInt(inst)].bin; | |
| 728 | 728 | try self.writeInstRef(stream, inst_data.lhs); |
| 729 | try stream.print(", {d})", .{@intFromEnum(inst_data.rhs)}); | |
| 729 | try stream.print(", {d})", .{@backingInt(inst_data.rhs)}); | |
| 730 | 730 | } |
| 731 | 731 | |
| 732 | 732 | fn writeUnNode( |
| ... | ... | @@ -734,7 +734,7 @@ const Writer = struct { |
| 734 | 734 | stream: *std.Io.Writer, |
| 735 | 735 | inst: Zir.Inst.Index, |
| 736 | 736 | ) Error!void { |
| 737 | const inst_data = self.code.instructions.items(.data)[@intFromEnum(inst)].un_node; | |
| 737 | const inst_data = self.code.instructions.items(.data)[@backingInt(inst)].un_node; | |
| 738 | 738 | try self.writeInstRef(stream, inst_data.operand); |
| 739 | 739 | try stream.writeAll(") "); |
| 740 | 740 | try self.writeSrcNode(stream, inst_data.src_node); |
| ... | ... | @@ -745,7 +745,7 @@ const Writer = struct { |
| 745 | 745 | stream: *std.Io.Writer, |
| 746 | 746 | inst: Zir.Inst.Index, |
| 747 | 747 | ) Error!void { |
| 748 | const inst_data = self.code.instructions.items(.data)[@intFromEnum(inst)].un_tok; | |
| 748 | const inst_data = self.code.instructions.items(.data)[@backingInt(inst)].un_tok; | |
| 749 | 749 | try self.writeInstRef(stream, inst_data.operand); |
| 750 | 750 | try stream.writeAll(") "); |
| 751 | 751 | try self.writeSrcTok(stream, inst_data.src_tok); |
| ... | ... | @@ -756,7 +756,7 @@ const Writer = struct { |
| 756 | 756 | stream: *std.Io.Writer, |
| 757 | 757 | inst: Zir.Inst.Index, |
| 758 | 758 | ) Error!void { |
| 759 | const inst_data = self.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 759 | const inst_data = self.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 760 | 760 | const extra = self.code.extraData(Zir.Inst.ValidateDestructure, inst_data.payload_index).data; |
| 761 | 761 | try self.writeInstRef(stream, extra.operand); |
| 762 | 762 | try stream.print(", {d}) (destructure=", .{extra.expect_len}); |
| ... | ... | @@ -770,7 +770,7 @@ const Writer = struct { |
| 770 | 770 | stream: *std.Io.Writer, |
| 771 | 771 | inst: Zir.Inst.Index, |
| 772 | 772 | ) Error!void { |
| 773 | const inst_data = self.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 773 | const inst_data = self.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 774 | 774 | const extra = self.code.extraData(Zir.Inst.ArrayInit, inst_data.payload_index).data; |
| 775 | 775 | try self.writeInstRef(stream, extra.ty); |
| 776 | 776 | try stream.print(", {d}) ", .{extra.init_count}); |
| ... | ... | @@ -782,7 +782,7 @@ const Writer = struct { |
| 782 | 782 | stream: *std.Io.Writer, |
| 783 | 783 | inst: Zir.Inst.Index, |
| 784 | 784 | ) Error!void { |
| 785 | const inst_data = self.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 785 | const inst_data = self.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 786 | 786 | const extra = self.code.extraData(Zir.Inst.ArrayTypeSentinel, inst_data.payload_index).data; |
| 787 | 787 | try self.writeInstRef(stream, extra.len); |
| 788 | 788 | try stream.writeAll(", "); |
| ... | ... | @@ -798,7 +798,7 @@ const Writer = struct { |
| 798 | 798 | stream: *std.Io.Writer, |
| 799 | 799 | inst: Zir.Inst.Index, |
| 800 | 800 | ) Error!void { |
| 801 | const inst_data = self.code.instructions.items(.data)[@intFromEnum(inst)].ptr_type; | |
| 801 | const inst_data = self.code.instructions.items(.data)[@backingInt(inst)].ptr_type; | |
| 802 | 802 | const str_allowzero = if (inst_data.flags.is_allowzero) "allowzero, " else ""; |
| 803 | 803 | const str_const = if (!inst_data.flags.is_mutable) "const, " else ""; |
| 804 | 804 | const str_volatile = if (inst_data.flags.is_volatile) "volatile, " else ""; |
| ... | ... | @@ -813,25 +813,25 @@ const Writer = struct { |
| 813 | 813 | var extra_index = extra.end; |
| 814 | 814 | if (inst_data.flags.has_sentinel) { |
| 815 | 815 | try stream.writeAll(", "); |
| 816 | try self.writeInstRef(stream, @as(Zir.Inst.Ref, @enumFromInt(self.code.extra[extra_index]))); | |
| 816 | try self.writeInstRef(stream, @as(Zir.Inst.Ref, @fromBackingInt(@intCast(self.code.extra[extra_index])))); | |
| 817 | 817 | extra_index += 1; |
| 818 | 818 | } |
| 819 | 819 | if (inst_data.flags.has_align) { |
| 820 | 820 | try stream.writeAll(", align("); |
| 821 | try self.writeInstRef(stream, @as(Zir.Inst.Ref, @enumFromInt(self.code.extra[extra_index]))); | |
| 821 | try self.writeInstRef(stream, @as(Zir.Inst.Ref, @fromBackingInt(@intCast(self.code.extra[extra_index])))); | |
| 822 | 822 | extra_index += 1; |
| 823 | 823 | if (inst_data.flags.has_bit_range) { |
| 824 | 824 | const bit_start = extra_index + @intFromBool(inst_data.flags.has_addrspace); |
| 825 | 825 | try stream.writeAll(":"); |
| 826 | try self.writeInstRef(stream, @as(Zir.Inst.Ref, @enumFromInt(self.code.extra[bit_start]))); | |
| 826 | try self.writeInstRef(stream, @as(Zir.Inst.Ref, @fromBackingInt(@intCast(self.code.extra[bit_start])))); | |
| 827 | 827 | try stream.writeAll(":"); |
| 828 | try self.writeInstRef(stream, @as(Zir.Inst.Ref, @enumFromInt(self.code.extra[bit_start + 1]))); | |
| 828 | try self.writeInstRef(stream, @as(Zir.Inst.Ref, @fromBackingInt(@intCast(self.code.extra[bit_start + 1])))); | |
| 829 | 829 | } |
| 830 | 830 | try stream.writeAll(")"); |
| 831 | 831 | } |
| 832 | 832 | if (inst_data.flags.has_addrspace) { |
| 833 | 833 | try stream.writeAll(", addrspace("); |
| 834 | try self.writeInstRef(stream, @as(Zir.Inst.Ref, @enumFromInt(self.code.extra[extra_index]))); | |
| 834 | try self.writeInstRef(stream, @as(Zir.Inst.Ref, @fromBackingInt(@intCast(self.code.extra[extra_index])))); | |
| 835 | 835 | try stream.writeAll(")"); |
| 836 | 836 | } |
| 837 | 837 | try stream.writeAll(") "); |
| ... | ... | @@ -839,14 +839,14 @@ const Writer = struct { |
| 839 | 839 | } |
| 840 | 840 | |
| 841 | 841 | fn writeInt(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { |
| 842 | const inst_data = self.code.instructions.items(.data)[@intFromEnum(inst)].int; | |
| 842 | const inst_data = self.code.instructions.items(.data)[@backingInt(inst)].int; | |
| 843 | 843 | try stream.print("{d})", .{inst_data}); |
| 844 | 844 | } |
| 845 | 845 | |
| 846 | 846 | fn writeIntBig(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { |
| 847 | const inst_data = self.code.instructions.items(.data)[@intFromEnum(inst)].str; | |
| 847 | const inst_data = self.code.instructions.items(.data)[@backingInt(inst)].str; | |
| 848 | 848 | const byte_count = inst_data.len * @sizeOf(std.math.big.Limb); |
| 849 | const limb_bytes = self.code.string_bytes[@intFromEnum(inst_data.start)..][0..byte_count]; | |
| 849 | const limb_bytes = self.code.string_bytes[@backingInt(inst_data.start)..][0..byte_count]; | |
| 850 | 850 | // limb_bytes is not aligned properly; we must allocate and copy the bytes |
| 851 | 851 | // in order to accomplish this. |
| 852 | 852 | const limbs = try self.gpa.alloc(std.math.big.Limb, inst_data.len); |
| ... | ... | @@ -863,12 +863,12 @@ const Writer = struct { |
| 863 | 863 | } |
| 864 | 864 | |
| 865 | 865 | fn writeFloat(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { |
| 866 | const number = self.code.instructions.items(.data)[@intFromEnum(inst)].float; | |
| 866 | const number = self.code.instructions.items(.data)[@backingInt(inst)].float; | |
| 867 | 867 | try stream.print("{d})", .{number}); |
| 868 | 868 | } |
| 869 | 869 | |
| 870 | 870 | fn writeFloat128(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { |
| 871 | const inst_data = self.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 871 | const inst_data = self.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 872 | 872 | const extra = self.code.extraData(Zir.Inst.Float128, inst_data.payload_index).data; |
| 873 | 873 | const number = extra.get(); |
| 874 | 874 | // TODO improve std.format to be able to print f128 values |
| ... | ... | @@ -881,13 +881,13 @@ const Writer = struct { |
| 881 | 881 | stream: *std.Io.Writer, |
| 882 | 882 | inst: Zir.Inst.Index, |
| 883 | 883 | ) Error!void { |
| 884 | const inst_data = self.code.instructions.items(.data)[@intFromEnum(inst)].str; | |
| 884 | const inst_data = self.code.instructions.items(.data)[@backingInt(inst)].str; | |
| 885 | 885 | const str = inst_data.get(self.code); |
| 886 | 886 | try stream.print("\"{f}\")", .{std.zig.fmtString(str)}); |
| 887 | 887 | } |
| 888 | 888 | |
| 889 | 889 | fn writeSliceStart(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { |
| 890 | const inst_data = self.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 890 | const inst_data = self.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 891 | 891 | const extra = self.code.extraData(Zir.Inst.SliceStart, inst_data.payload_index).data; |
| 892 | 892 | try self.writeInstRef(stream, extra.lhs); |
| 893 | 893 | try stream.writeAll(", "); |
| ... | ... | @@ -897,7 +897,7 @@ const Writer = struct { |
| 897 | 897 | } |
| 898 | 898 | |
| 899 | 899 | fn writeSliceEnd(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { |
| 900 | const inst_data = self.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 900 | const inst_data = self.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 901 | 901 | const extra = self.code.extraData(Zir.Inst.SliceEnd, inst_data.payload_index).data; |
| 902 | 902 | try self.writeInstRef(stream, extra.lhs); |
| 903 | 903 | try stream.writeAll(", "); |
| ... | ... | @@ -909,7 +909,7 @@ const Writer = struct { |
| 909 | 909 | } |
| 910 | 910 | |
| 911 | 911 | fn writeSliceSentinel(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { |
| 912 | const inst_data = self.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 912 | const inst_data = self.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 913 | 913 | const extra = self.code.extraData(Zir.Inst.SliceSentinel, inst_data.payload_index).data; |
| 914 | 914 | try self.writeInstRef(stream, extra.lhs); |
| 915 | 915 | try stream.writeAll(", "); |
| ... | ... | @@ -923,7 +923,7 @@ const Writer = struct { |
| 923 | 923 | } |
| 924 | 924 | |
| 925 | 925 | fn writeSliceLength(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { |
| 926 | const inst_data = self.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 926 | const inst_data = self.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 927 | 927 | const extra = self.code.extraData(Zir.Inst.SliceLength, inst_data.payload_index).data; |
| 928 | 928 | try self.writeInstRef(stream, extra.lhs); |
| 929 | 929 | try stream.writeAll(", "); |
| ... | ... | @@ -939,7 +939,7 @@ const Writer = struct { |
| 939 | 939 | } |
| 940 | 940 | |
| 941 | 941 | fn writeUnionInit(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { |
| 942 | const inst_data = self.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 942 | const inst_data = self.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 943 | 943 | const extra = self.code.extraData(Zir.Inst.UnionInit, inst_data.payload_index).data; |
| 944 | 944 | try self.writeInstRef(stream, extra.union_type); |
| 945 | 945 | try stream.writeAll(", "); |
| ... | ... | @@ -951,7 +951,7 @@ const Writer = struct { |
| 951 | 951 | } |
| 952 | 952 | |
| 953 | 953 | fn writeShuffle(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { |
| 954 | const inst_data = self.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 954 | const inst_data = self.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 955 | 955 | const extra = self.code.extraData(Zir.Inst.Shuffle, inst_data.payload_index).data; |
| 956 | 956 | try self.writeInstRef(stream, extra.elem_type); |
| 957 | 957 | try stream.writeAll(", "); |
| ... | ... | @@ -978,7 +978,7 @@ const Writer = struct { |
| 978 | 978 | } |
| 979 | 979 | |
| 980 | 980 | fn writeMulAdd(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { |
| 981 | const inst_data = self.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 981 | const inst_data = self.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 982 | 982 | const extra = self.code.extraData(Zir.Inst.MulAdd, inst_data.payload_index).data; |
| 983 | 983 | try self.writeInstRef(stream, extra.mulend1); |
| 984 | 984 | try stream.writeAll(", "); |
| ... | ... | @@ -990,7 +990,7 @@ const Writer = struct { |
| 990 | 990 | } |
| 991 | 991 | |
| 992 | 992 | fn writeFromBackingInt(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { |
| 993 | const inst_data = self.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 993 | const inst_data = self.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 994 | 994 | const extra = self.code.extraData(Zir.Inst.FromBackingInt, inst_data.payload_index); |
| 995 | 995 | try self.writeInstRef(stream, extra.data.result_type); |
| 996 | 996 | try stream.writeAll(", "); |
| ... | ... | @@ -1000,7 +1000,7 @@ const Writer = struct { |
| 1000 | 1000 | } |
| 1001 | 1001 | |
| 1002 | 1002 | fn writeBuiltinCall(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { |
| 1003 | const inst_data = self.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 1003 | const inst_data = self.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 1004 | 1004 | const extra = self.code.extraData(Zir.Inst.BuiltinCall, inst_data.payload_index).data; |
| 1005 | 1005 | |
| 1006 | 1006 | try self.writeFlag(stream, "nodiscard ", extra.flags.ensure_result_used); |
| ... | ... | @@ -1033,7 +1033,7 @@ const Writer = struct { |
| 1033 | 1033 | } |
| 1034 | 1034 | |
| 1035 | 1035 | fn writeParam(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { |
| 1036 | const inst_data = self.code.instructions.items(.data)[@intFromEnum(inst)].pl_tok; | |
| 1036 | const inst_data = self.code.instructions.items(.data)[@backingInt(inst)].pl_tok; | |
| 1037 | 1037 | const extra = self.code.extraData(Zir.Inst.Param, inst_data.payload_index); |
| 1038 | 1038 | const body = self.code.bodySlice(extra.end, extra.data.type.body_len); |
| 1039 | 1039 | try stream.print("\"{f}\", ", .{ |
| ... | ... | @@ -1048,7 +1048,7 @@ const Writer = struct { |
| 1048 | 1048 | } |
| 1049 | 1049 | |
| 1050 | 1050 | fn writePlNodeBin(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { |
| 1051 | const inst_data = self.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 1051 | const inst_data = self.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 1052 | 1052 | const extra = self.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; |
| 1053 | 1053 | try self.writeInstRef(stream, extra.lhs); |
| 1054 | 1054 | try stream.writeAll(", "); |
| ... | ... | @@ -1058,7 +1058,7 @@ const Writer = struct { |
| 1058 | 1058 | } |
| 1059 | 1059 | |
| 1060 | 1060 | fn writePlNodeMultiOp(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { |
| 1061 | const inst_data = self.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 1061 | const inst_data = self.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 1062 | 1062 | const extra = self.code.extraData(Zir.Inst.MultiOp, inst_data.payload_index); |
| 1063 | 1063 | const args = self.code.refSlice(extra.end, extra.data.operands_len); |
| 1064 | 1064 | try stream.writeAll("{"); |
| ... | ... | @@ -1071,13 +1071,13 @@ const Writer = struct { |
| 1071 | 1071 | } |
| 1072 | 1072 | |
| 1073 | 1073 | fn writeElemValImm(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { |
| 1074 | const inst_data = self.code.instructions.items(.data)[@intFromEnum(inst)].elem_val_imm; | |
| 1074 | const inst_data = self.code.instructions.items(.data)[@backingInt(inst)].elem_val_imm; | |
| 1075 | 1075 | try self.writeInstRef(stream, inst_data.operand); |
| 1076 | 1076 | try stream.print(", {d})", .{inst_data.idx}); |
| 1077 | 1077 | } |
| 1078 | 1078 | |
| 1079 | 1079 | fn writeArrayInitElemPtr(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { |
| 1080 | const inst_data = self.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 1080 | const inst_data = self.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 1081 | 1081 | const extra = self.code.extraData(Zir.Inst.ElemPtrImm, inst_data.payload_index).data; |
| 1082 | 1082 | |
| 1083 | 1083 | try self.writeInstRef(stream, extra.ptr); |
| ... | ... | @@ -1086,7 +1086,7 @@ const Writer = struct { |
| 1086 | 1086 | } |
| 1087 | 1087 | |
| 1088 | 1088 | fn writePlNodeExport(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { |
| 1089 | const inst_data = self.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 1089 | const inst_data = self.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 1090 | 1090 | const extra = self.code.extraData(Zir.Inst.Export, inst_data.payload_index).data; |
| 1091 | 1091 | |
| 1092 | 1092 | try self.writeInstRef(stream, extra.exported); |
| ... | ... | @@ -1097,7 +1097,7 @@ const Writer = struct { |
| 1097 | 1097 | } |
| 1098 | 1098 | |
| 1099 | 1099 | fn writeValidateArrayInitRefTy(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { |
| 1100 | const inst_data = self.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 1100 | const inst_data = self.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 1101 | 1101 | const extra = self.code.extraData(Zir.Inst.ArrayInitRefTy, inst_data.payload_index).data; |
| 1102 | 1102 | |
| 1103 | 1103 | try self.writeInstRef(stream, extra.ptr_ty); |
| ... | ... | @@ -1107,7 +1107,7 @@ const Writer = struct { |
| 1107 | 1107 | } |
| 1108 | 1108 | |
| 1109 | 1109 | fn writeStructInit(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { |
| 1110 | const inst_data = self.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 1110 | const inst_data = self.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 1111 | 1111 | const extra = self.code.extraData(Zir.Inst.StructInit, inst_data.payload_index); |
| 1112 | 1112 | var field_i: u32 = 0; |
| 1113 | 1113 | var extra_index = extra.end; |
| ... | ... | @@ -1174,7 +1174,7 @@ const Writer = struct { |
| 1174 | 1174 | } |
| 1175 | 1175 | |
| 1176 | 1176 | fn writeAtomicLoad(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { |
| 1177 | const inst_data = self.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 1177 | const inst_data = self.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 1178 | 1178 | const extra = self.code.extraData(Zir.Inst.AtomicLoad, inst_data.payload_index).data; |
| 1179 | 1179 | |
| 1180 | 1180 | try self.writeInstRef(stream, extra.elem_type); |
| ... | ... | @@ -1187,7 +1187,7 @@ const Writer = struct { |
| 1187 | 1187 | } |
| 1188 | 1188 | |
| 1189 | 1189 | fn writeAtomicStore(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { |
| 1190 | const inst_data = self.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 1190 | const inst_data = self.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 1191 | 1191 | const extra = self.code.extraData(Zir.Inst.AtomicStore, inst_data.payload_index).data; |
| 1192 | 1192 | |
| 1193 | 1193 | try self.writeInstRef(stream, extra.ptr); |
| ... | ... | @@ -1200,7 +1200,7 @@ const Writer = struct { |
| 1200 | 1200 | } |
| 1201 | 1201 | |
| 1202 | 1202 | fn writeAtomicRmw(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { |
| 1203 | const inst_data = self.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 1203 | const inst_data = self.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 1204 | 1204 | const extra = self.code.extraData(Zir.Inst.AtomicRmw, inst_data.payload_index).data; |
| 1205 | 1205 | |
| 1206 | 1206 | try self.writeInstRef(stream, extra.ptr); |
| ... | ... | @@ -1215,7 +1215,7 @@ const Writer = struct { |
| 1215 | 1215 | } |
| 1216 | 1216 | |
| 1217 | 1217 | fn writeStructInitAnon(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { |
| 1218 | const inst_data = self.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 1218 | const inst_data = self.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 1219 | 1219 | const extra = self.code.extraData(Zir.Inst.StructInitAnon, inst_data.payload_index); |
| 1220 | 1220 | var field_i: u32 = 0; |
| 1221 | 1221 | var extra_index = extra.end; |
| ... | ... | @@ -1236,7 +1236,7 @@ const Writer = struct { |
| 1236 | 1236 | } |
| 1237 | 1237 | |
| 1238 | 1238 | fn writeStructInitFieldType(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { |
| 1239 | const inst_data = self.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 1239 | const inst_data = self.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 1240 | 1240 | const extra = self.code.extraData(Zir.Inst.FieldType, inst_data.payload_index).data; |
| 1241 | 1241 | try self.writeInstRef(stream, extra.container_type); |
| 1242 | 1242 | const field_name = self.code.nullTerminatedString(extra.name_start); |
| ... | ... | @@ -1245,7 +1245,7 @@ const Writer = struct { |
| 1245 | 1245 | } |
| 1246 | 1246 | |
| 1247 | 1247 | fn writeFieldTypeRef(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { |
| 1248 | const inst_data = self.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 1248 | const inst_data = self.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 1249 | 1249 | const extra = self.code.extraData(Zir.Inst.FieldTypeRef, inst_data.payload_index).data; |
| 1250 | 1250 | try self.writeInstRef(stream, extra.container_type); |
| 1251 | 1251 | try stream.writeAll(", "); |
| ... | ... | @@ -1271,7 +1271,7 @@ const Writer = struct { |
| 1271 | 1271 | stream: *std.Io.Writer, |
| 1272 | 1272 | inst: Zir.Inst.Index, |
| 1273 | 1273 | ) Error!void { |
| 1274 | const inst_data = self.code.instructions.items(.data)[@intFromEnum(inst)].inst_node; | |
| 1274 | const inst_data = self.code.instructions.items(.data)[@backingInt(inst)].inst_node; | |
| 1275 | 1275 | try self.writeInstIndex(stream, inst_data.inst); |
| 1276 | 1276 | try stream.writeAll(") "); |
| 1277 | 1277 | try self.writeSrcNode(stream, inst_data.src_node); |
| ... | ... | @@ -1288,7 +1288,7 @@ const Writer = struct { |
| 1288 | 1288 | |
| 1289 | 1289 | try self.writeFlag(stream, "volatile, ", small.is_volatile); |
| 1290 | 1290 | if (tmpl_is_expr) { |
| 1291 | try self.writeInstRef(stream, @enumFromInt(@intFromEnum(extra.data.asm_source))); | |
| 1291 | try self.writeInstRef(stream, @fromBackingInt(@intCast(@backingInt(extra.data.asm_source)))); | |
| 1292 | 1292 | } else { |
| 1293 | 1293 | const asm_source = self.code.nullTerminatedString(extra.data.asm_source); |
| 1294 | 1294 | try stream.print("\"{f}\"", .{std.zig.fmtString(asm_source)}); |
| ... | ... | @@ -1354,7 +1354,7 @@ const Writer = struct { |
| 1354 | 1354 | inst: Zir.Inst.Index, |
| 1355 | 1355 | comptime kind: enum { direct, field }, |
| 1356 | 1356 | ) !void { |
| 1357 | const inst_data = self.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 1357 | const inst_data = self.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 1358 | 1358 | const ExtraType = switch (kind) { |
| 1359 | 1359 | .direct => Zir.Inst.Call, |
| 1360 | 1360 | .field => Zir.Inst.FieldCall, |
| ... | ... | @@ -1366,7 +1366,7 @@ const Writer = struct { |
| 1366 | 1366 | if (extra.data.flags.ensure_result_used) { |
| 1367 | 1367 | try stream.writeAll("nodiscard "); |
| 1368 | 1368 | } |
| 1369 | try stream.print(".{s}, ", .{@tagName(@as(std.lang.CallModifier, @enumFromInt(extra.data.flags.packed_modifier)))}); | |
| 1369 | try stream.print(".{s}, ", .{@tagName(@as(std.lang.CallModifier, @fromBackingInt(@intCast(extra.data.flags.packed_modifier))))}); | |
| 1370 | 1370 | switch (kind) { |
| 1371 | 1371 | .direct => try self.writeInstRef(stream, extra.data.callee), |
| 1372 | 1372 | .field => { |
| ... | ... | @@ -1402,7 +1402,7 @@ const Writer = struct { |
| 1402 | 1402 | } |
| 1403 | 1403 | |
| 1404 | 1404 | fn writeBlock(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { |
| 1405 | const inst_data = self.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 1405 | const inst_data = self.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 1406 | 1406 | const extra = self.code.extraData(Zir.Inst.Block, inst_data.payload_index); |
| 1407 | 1407 | const body = self.code.bodySlice(extra.end, extra.data.body_len); |
| 1408 | 1408 | try self.writeBracedBody(stream, body); |
| ... | ... | @@ -1411,7 +1411,7 @@ const Writer = struct { |
| 1411 | 1411 | } |
| 1412 | 1412 | |
| 1413 | 1413 | fn writeBlockComptime(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { |
| 1414 | const inst_data = self.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 1414 | const inst_data = self.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 1415 | 1415 | const extra = self.code.extraData(Zir.Inst.BlockComptime, inst_data.payload_index); |
| 1416 | 1416 | const body = self.code.bodySlice(extra.end, extra.data.body_len); |
| 1417 | 1417 | try stream.print("reason={s}, ", .{@tagName(extra.data.reason)}); |
| ... | ... | @@ -1421,7 +1421,7 @@ const Writer = struct { |
| 1421 | 1421 | } |
| 1422 | 1422 | |
| 1423 | 1423 | fn writeCondBr(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { |
| 1424 | const inst_data = self.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 1424 | const inst_data = self.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 1425 | 1425 | const extra = self.code.extraData(Zir.Inst.CondBr, inst_data.payload_index); |
| 1426 | 1426 | const then_body = self.code.bodySlice(extra.end, extra.data.then_body_len); |
| 1427 | 1427 | const else_body = self.code.bodySlice(extra.end + then_body.len, extra.data.else_body_len); |
| ... | ... | @@ -1435,7 +1435,7 @@ const Writer = struct { |
| 1435 | 1435 | } |
| 1436 | 1436 | |
| 1437 | 1437 | fn writeTry(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { |
| 1438 | const inst_data = self.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 1438 | const inst_data = self.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 1439 | 1439 | const extra = self.code.extraData(Zir.Inst.Try, inst_data.payload_index); |
| 1440 | 1440 | const body = self.code.bodySlice(extra.end, extra.data.body_len); |
| 1441 | 1441 | try self.writeInstRef(stream, extra.data.operand); |
| ... | ... | @@ -1661,9 +1661,9 @@ const Writer = struct { |
| 1661 | 1661 | extra_index += 2; |
| 1662 | 1662 | |
| 1663 | 1663 | try stream.print("@\"{d}\": ", .{field_idx}); |
| 1664 | try self.writeInstRef(stream, @enumFromInt(field_ty)); | |
| 1664 | try self.writeInstRef(stream, @fromBackingInt(@intCast(field_ty))); | |
| 1665 | 1665 | try stream.writeAll(" = "); |
| 1666 | try self.writeInstRef(stream, @enumFromInt(field_init)); | |
| 1666 | try self.writeInstRef(stream, @fromBackingInt(@intCast(field_init))); | |
| 1667 | 1667 | } |
| 1668 | 1668 | |
| 1669 | 1669 | try stream.writeAll(" }) "); |
| ... | ... | @@ -1676,7 +1676,7 @@ const Writer = struct { |
| 1676 | 1676 | stream: *std.Io.Writer, |
| 1677 | 1677 | inst: Zir.Inst.Index, |
| 1678 | 1678 | ) !void { |
| 1679 | const inst_data = self.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 1679 | const inst_data = self.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 1680 | 1680 | const extra = self.code.extraData(Zir.Inst.ErrorSetDecl, inst_data.payload_index); |
| 1681 | 1681 | |
| 1682 | 1682 | try stream.writeAll("{\n"); |
| ... | ... | @@ -1685,7 +1685,7 @@ const Writer = struct { |
| 1685 | 1685 | var extra_index = @as(u32, @intCast(extra.end)); |
| 1686 | 1686 | const extra_index_end = extra_index + extra.data.fields_len; |
| 1687 | 1687 | while (extra_index < extra_index_end) : (extra_index += 1) { |
| 1688 | const name_index: Zir.NullTerminatedString = @enumFromInt(self.code.extra[extra_index]); | |
| 1688 | const name_index: Zir.NullTerminatedString = @fromBackingInt(@intCast(self.code.extra[extra_index])); | |
| 1689 | 1689 | const name = self.code.nullTerminatedString(name_index); |
| 1690 | 1690 | try stream.splatByteAll(' ', self.indent); |
| 1691 | 1691 | try stream.print("{f},\n", .{std.zig.fmtIdP(name)}); |
| ... | ... | @@ -1835,7 +1835,7 @@ const Writer = struct { |
| 1835 | 1835 | } |
| 1836 | 1836 | |
| 1837 | 1837 | fn writePlNodeField(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { |
| 1838 | const inst_data = self.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 1838 | const inst_data = self.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 1839 | 1839 | const extra = self.code.extraData(Zir.Inst.Field, inst_data.payload_index).data; |
| 1840 | 1840 | const name = self.code.nullTerminatedString(extra.field_name_start); |
| 1841 | 1841 | try self.writeInstRef(stream, extra.lhs); |
| ... | ... | @@ -1844,7 +1844,7 @@ const Writer = struct { |
| 1844 | 1844 | } |
| 1845 | 1845 | |
| 1846 | 1846 | fn writePlNodeFieldNamed(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { |
| 1847 | const inst_data = self.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 1847 | const inst_data = self.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 1848 | 1848 | const extra = self.code.extraData(Zir.Inst.FieldNamed, inst_data.payload_index).data; |
| 1849 | 1849 | try self.writeInstRef(stream, extra.lhs); |
| 1850 | 1850 | try stream.writeAll(", "); |
| ... | ... | @@ -1854,7 +1854,7 @@ const Writer = struct { |
| 1854 | 1854 | } |
| 1855 | 1855 | |
| 1856 | 1856 | fn writeAs(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { |
| 1857 | const inst_data = self.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 1857 | const inst_data = self.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 1858 | 1858 | const extra = self.code.extraData(Zir.Inst.As, inst_data.payload_index).data; |
| 1859 | 1859 | try self.writeInstRef(stream, extra.dest_type); |
| 1860 | 1860 | try stream.writeAll(", "); |
| ... | ... | @@ -1868,7 +1868,7 @@ const Writer = struct { |
| 1868 | 1868 | stream: *std.Io.Writer, |
| 1869 | 1869 | inst: Zir.Inst.Index, |
| 1870 | 1870 | ) Error!void { |
| 1871 | const src_node = self.code.instructions.items(.data)[@intFromEnum(inst)].node; | |
| 1871 | const src_node = self.code.instructions.items(.data)[@backingInt(inst)].node; | |
| 1872 | 1872 | try stream.writeAll(") "); |
| 1873 | 1873 | try self.writeSrcNode(stream, src_node); |
| 1874 | 1874 | } |
| ... | ... | @@ -1878,14 +1878,14 @@ const Writer = struct { |
| 1878 | 1878 | stream: *std.Io.Writer, |
| 1879 | 1879 | inst: Zir.Inst.Index, |
| 1880 | 1880 | ) Error!void { |
| 1881 | const inst_data = self.code.instructions.items(.data)[@intFromEnum(inst)].str_tok; | |
| 1881 | const inst_data = self.code.instructions.items(.data)[@backingInt(inst)].str_tok; | |
| 1882 | 1882 | const str = inst_data.get(self.code); |
| 1883 | 1883 | try stream.print("\"{f}\") ", .{std.zig.fmtString(str)}); |
| 1884 | 1884 | try self.writeSrcTok(stream, inst_data.src_tok); |
| 1885 | 1885 | } |
| 1886 | 1886 | |
| 1887 | 1887 | fn writeStrOp(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { |
| 1888 | const inst_data = self.code.instructions.items(.data)[@intFromEnum(inst)].str_op; | |
| 1888 | const inst_data = self.code.instructions.items(.data)[@backingInt(inst)].str_op; | |
| 1889 | 1889 | const str = inst_data.getStr(self.code); |
| 1890 | 1890 | try self.writeInstRef(stream, inst_data.operand); |
| 1891 | 1891 | try stream.print(", \"{f}\")", .{std.zig.fmtString(str)}); |
| ... | ... | @@ -1897,7 +1897,7 @@ const Writer = struct { |
| 1897 | 1897 | inst: Zir.Inst.Index, |
| 1898 | 1898 | inferred_error_set: bool, |
| 1899 | 1899 | ) !void { |
| 1900 | const inst_data = self.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 1900 | const inst_data = self.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 1901 | 1901 | const extra = self.code.extraData(Zir.Inst.Func, inst_data.payload_index); |
| 1902 | 1902 | |
| 1903 | 1903 | var extra_index = extra.end; |
| ... | ... | @@ -1909,7 +1909,7 @@ const Writer = struct { |
| 1909 | 1909 | ret_ty_ref = .void_type; |
| 1910 | 1910 | }, |
| 1911 | 1911 | 1 => { |
| 1912 | ret_ty_ref = @as(Zir.Inst.Ref, @enumFromInt(self.code.extra[extra_index])); | |
| 1912 | ret_ty_ref = @as(Zir.Inst.Ref, @fromBackingInt(@intCast(self.code.extra[extra_index]))); | |
| 1913 | 1913 | extra_index += 1; |
| 1914 | 1914 | }, |
| 1915 | 1915 | else => { |
| ... | ... | @@ -1945,7 +1945,7 @@ const Writer = struct { |
| 1945 | 1945 | } |
| 1946 | 1946 | |
| 1947 | 1947 | fn writeFuncFancy(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { |
| 1948 | const inst_data = self.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 1948 | const inst_data = self.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 1949 | 1949 | const extra = self.code.extraData(Zir.Inst.FuncFancy, inst_data.payload_index); |
| 1950 | 1950 | |
| 1951 | 1951 | var extra_index: usize = extra.end; |
| ... | ... | @@ -1960,7 +1960,7 @@ const Writer = struct { |
| 1960 | 1960 | cc_body = self.code.bodySlice(extra_index, body_len); |
| 1961 | 1961 | extra_index += cc_body.len; |
| 1962 | 1962 | } else if (extra.data.bits.has_cc_ref) { |
| 1963 | cc_ref = @as(Zir.Inst.Ref, @enumFromInt(self.code.extra[extra_index])); | |
| 1963 | cc_ref = @as(Zir.Inst.Ref, @fromBackingInt(@intCast(self.code.extra[extra_index]))); | |
| 1964 | 1964 | extra_index += 1; |
| 1965 | 1965 | } |
| 1966 | 1966 | if (extra.data.bits.has_ret_ty_body) { |
| ... | ... | @@ -1969,7 +1969,7 @@ const Writer = struct { |
| 1969 | 1969 | ret_ty_body = self.code.bodySlice(extra_index, body_len); |
| 1970 | 1970 | extra_index += ret_ty_body.len; |
| 1971 | 1971 | } else if (extra.data.bits.has_ret_ty_ref) { |
| 1972 | ret_ty_ref = @as(Zir.Inst.Ref, @enumFromInt(self.code.extra[extra_index])); | |
| 1972 | ret_ty_ref = @as(Zir.Inst.Ref, @fromBackingInt(@intCast(self.code.extra[extra_index]))); | |
| 1973 | 1973 | extra_index += 1; |
| 1974 | 1974 | } |
| 1975 | 1975 | |
| ... | ... | @@ -2009,12 +2009,12 @@ const Writer = struct { |
| 2009 | 2009 | |
| 2010 | 2010 | var extra_index: usize = extra.end; |
| 2011 | 2011 | const type_inst: Zir.Inst.Ref = if (!small.has_type) .none else blk: { |
| 2012 | const type_inst = @as(Zir.Inst.Ref, @enumFromInt(self.code.extra[extra_index])); | |
| 2012 | const type_inst = @as(Zir.Inst.Ref, @fromBackingInt(@intCast(self.code.extra[extra_index]))); | |
| 2013 | 2013 | extra_index += 1; |
| 2014 | 2014 | break :blk type_inst; |
| 2015 | 2015 | }; |
| 2016 | 2016 | const align_inst: Zir.Inst.Ref = if (!small.has_align) .none else blk: { |
| 2017 | const align_inst = @as(Zir.Inst.Ref, @enumFromInt(self.code.extra[extra_index])); | |
| 2017 | const align_inst = @as(Zir.Inst.Ref, @fromBackingInt(@intCast(self.code.extra[extra_index]))); | |
| 2018 | 2018 | extra_index += 1; |
| 2019 | 2019 | break :blk align_inst; |
| 2020 | 2020 | }; |
| ... | ... | @@ -2040,7 +2040,7 @@ const Writer = struct { |
| 2040 | 2040 | } |
| 2041 | 2041 | |
| 2042 | 2042 | fn writeBoolBr(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { |
| 2043 | const inst_data = self.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 2043 | const inst_data = self.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 2044 | 2044 | const extra = self.code.extraData(Zir.Inst.BoolBr, inst_data.payload_index); |
| 2045 | 2045 | const body = self.code.bodySlice(extra.end, extra.data.body_len); |
| 2046 | 2046 | try self.writeInstRef(stream, extra.data.lhs); |
| ... | ... | @@ -2051,7 +2051,7 @@ const Writer = struct { |
| 2051 | 2051 | } |
| 2052 | 2052 | |
| 2053 | 2053 | fn writeIntType(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { |
| 2054 | const int_type = self.code.instructions.items(.data)[@intFromEnum(inst)].int_type; | |
| 2054 | const int_type = self.code.instructions.items(.data)[@backingInt(inst)].int_type; | |
| 2055 | 2055 | const prefix: u8 = switch (int_type.signedness) { |
| 2056 | 2056 | .signed => 'i', |
| 2057 | 2057 | .unsigned => 'u', |
| ... | ... | @@ -2061,7 +2061,7 @@ const Writer = struct { |
| 2061 | 2061 | } |
| 2062 | 2062 | |
| 2063 | 2063 | fn writeSaveErrRetIndex(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { |
| 2064 | const inst_data = self.code.instructions.items(.data)[@intFromEnum(inst)].save_err_ret_index; | |
| 2064 | const inst_data = self.code.instructions.items(.data)[@backingInt(inst)].save_err_ret_index; | |
| 2065 | 2065 | |
| 2066 | 2066 | try self.writeInstRef(stream, inst_data.operand); |
| 2067 | 2067 | |
| ... | ... | @@ -2079,7 +2079,7 @@ const Writer = struct { |
| 2079 | 2079 | } |
| 2080 | 2080 | |
| 2081 | 2081 | fn writeBreak(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { |
| 2082 | const inst_data = self.code.instructions.items(.data)[@intFromEnum(inst)].@"break"; | |
| 2082 | const inst_data = self.code.instructions.items(.data)[@backingInt(inst)].@"break"; | |
| 2083 | 2083 | const extra = self.code.extraData(Zir.Inst.Break, inst_data.payload_index).data; |
| 2084 | 2084 | |
| 2085 | 2085 | try self.writeInstIndex(stream, extra.block_inst); |
| ... | ... | @@ -2089,7 +2089,7 @@ const Writer = struct { |
| 2089 | 2089 | } |
| 2090 | 2090 | |
| 2091 | 2091 | fn writeArrayInit(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { |
| 2092 | const inst_data = self.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 2092 | const inst_data = self.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 2093 | 2093 | |
| 2094 | 2094 | const extra = self.code.extraData(Zir.Inst.MultiOp, inst_data.payload_index); |
| 2095 | 2095 | const args = self.code.refSlice(extra.end, extra.data.operands_len); |
| ... | ... | @@ -2105,7 +2105,7 @@ const Writer = struct { |
| 2105 | 2105 | } |
| 2106 | 2106 | |
| 2107 | 2107 | fn writeArrayInitAnon(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { |
| 2108 | const inst_data = self.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 2108 | const inst_data = self.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 2109 | 2109 | |
| 2110 | 2110 | const extra = self.code.extraData(Zir.Inst.MultiOp, inst_data.payload_index); |
| 2111 | 2111 | const args = self.code.refSlice(extra.end, extra.data.operands_len); |
| ... | ... | @@ -2120,7 +2120,7 @@ const Writer = struct { |
| 2120 | 2120 | } |
| 2121 | 2121 | |
| 2122 | 2122 | fn writeArrayInitSent(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { |
| 2123 | const inst_data = self.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | |
| 2123 | const inst_data = self.code.instructions.items(.data)[@backingInt(inst)].pl_node; | |
| 2124 | 2124 | |
| 2125 | 2125 | const extra = self.code.extraData(Zir.Inst.MultiOp, inst_data.payload_index); |
| 2126 | 2126 | const args = self.code.refSlice(extra.end, extra.data.operands_len); |
| ... | ... | @@ -2140,7 +2140,7 @@ const Writer = struct { |
| 2140 | 2140 | } |
| 2141 | 2141 | |
| 2142 | 2142 | fn writeUnreachable(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { |
| 2143 | const inst_data = self.code.instructions.items(.data)[@intFromEnum(inst)].@"unreachable"; | |
| 2143 | const inst_data = self.code.instructions.items(.data)[@backingInt(inst)].@"unreachable"; | |
| 2144 | 2144 | try stream.writeAll(") "); |
| 2145 | 2145 | try self.writeSrcNode(stream, inst_data.src_node); |
| 2146 | 2146 | } |
| ... | ... | @@ -2185,12 +2185,12 @@ const Writer = struct { |
| 2185 | 2185 | } |
| 2186 | 2186 | |
| 2187 | 2187 | fn writeDbgStmt(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { |
| 2188 | const inst_data = self.code.instructions.items(.data)[@intFromEnum(inst)].dbg_stmt; | |
| 2188 | const inst_data = self.code.instructions.items(.data)[@backingInt(inst)].dbg_stmt; | |
| 2189 | 2189 | try stream.print("{d}, {d})", .{ inst_data.line + 1, inst_data.column + 1 }); |
| 2190 | 2190 | } |
| 2191 | 2191 | |
| 2192 | 2192 | fn writeDefer(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { |
| 2193 | const inst_data = self.code.instructions.items(.data)[@intFromEnum(inst)].@"defer"; | |
| 2193 | const inst_data = self.code.instructions.items(.data)[@backingInt(inst)].@"defer"; | |
| 2194 | 2194 | const body = self.code.bodySlice(inst_data.index, inst_data.len); |
| 2195 | 2195 | try self.writeBracedBody(stream, body); |
| 2196 | 2196 | try stream.writeByte(')'); |
| ... | ... | @@ -2254,20 +2254,20 @@ const Writer = struct { |
| 2254 | 2254 | |
| 2255 | 2255 | fn writeClosureGet(self: *Writer, stream: *std.Io.Writer, extended: Zir.Inst.Extended.InstData) !void { |
| 2256 | 2256 | try stream.print("{d})) ", .{extended.small}); |
| 2257 | const src_node: Ast.Node.Offset = @enumFromInt(@as(i32, @bitCast(extended.operand))); | |
| 2257 | const src_node: Ast.Node.Offset = @fromBackingInt(@intCast(@as(i32, @bitCast(extended.operand)))); | |
| 2258 | 2258 | try self.writeSrcNode(stream, src_node); |
| 2259 | 2259 | } |
| 2260 | 2260 | |
| 2261 | 2261 | fn writeStdLangValue(self: *Writer, stream: *std.Io.Writer, extended: Zir.Inst.Extended.InstData) !void { |
| 2262 | const val: Zir.Inst.StdLangValue = @enumFromInt(extended.small); | |
| 2262 | const val: Zir.Inst.StdLangValue = @fromBackingInt(@intCast(extended.small)); | |
| 2263 | 2263 | try stream.print("{s})) ", .{@tagName(val)}); |
| 2264 | const src_node: Ast.Node.Offset = @enumFromInt(@as(i32, @bitCast(extended.operand))); | |
| 2264 | const src_node: Ast.Node.Offset = @fromBackingInt(@intCast(@as(i32, @bitCast(extended.operand)))); | |
| 2265 | 2265 | try self.writeSrcNode(stream, src_node); |
| 2266 | 2266 | } |
| 2267 | 2267 | |
| 2268 | 2268 | fn writeInplaceArithResultTy(self: *Writer, stream: *std.Io.Writer, extended: Zir.Inst.Extended.InstData) !void { |
| 2269 | const op: Zir.Inst.InplaceOp = @enumFromInt(extended.small); | |
| 2270 | try self.writeInstRef(stream, @enumFromInt(extended.operand)); | |
| 2269 | const op: Zir.Inst.InplaceOp = @fromBackingInt(@intCast(extended.small)); | |
| 2270 | try self.writeInstRef(stream, @fromBackingInt(@intCast(extended.operand))); | |
| 2271 | 2271 | try stream.print(", {s}))", .{@tagName(op)}); |
| 2272 | 2272 | } |
| 2273 | 2273 | |
| ... | ... | @@ -2277,14 +2277,14 @@ const Writer = struct { |
| 2277 | 2277 | } else if (ref.toIndex()) |i| { |
| 2278 | 2278 | return self.writeInstIndex(stream, i); |
| 2279 | 2279 | } else { |
| 2280 | const val: InternPool.Index = @enumFromInt(@intFromEnum(ref)); | |
| 2280 | const val: InternPool.Index = @fromBackingInt(@intCast(@backingInt(ref))); | |
| 2281 | 2281 | return stream.print("@{s}", .{@tagName(val)}); |
| 2282 | 2282 | } |
| 2283 | 2283 | } |
| 2284 | 2284 | |
| 2285 | 2285 | fn writeInstIndex(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { |
| 2286 | 2286 | _ = self; |
| 2287 | return stream.print("%{d}", .{@intFromEnum(inst)}); | |
| 2287 | return stream.print("%{d}", .{@backingInt(inst)}); | |
| 2288 | 2288 | } |
| 2289 | 2289 | |
| 2290 | 2290 | fn writeCaptures(self: *Writer, stream: *std.Io.Writer, captures: []const Zir.Inst.Capture, capture_names: []const Zir.NullTerminatedString) !void { |
| ... | ... | @@ -2436,14 +2436,14 @@ const Writer = struct { |
| 2436 | 2436 | fn writeBody(self: *Writer, stream: *std.Io.Writer, body: []const Zir.Inst.Index) !void { |
| 2437 | 2437 | for (body) |inst| { |
| 2438 | 2438 | try stream.splatByteAll(' ', self.indent); |
| 2439 | try stream.print("%{d} ", .{@intFromEnum(inst)}); | |
| 2439 | try stream.print("%{d} ", .{@backingInt(inst)}); | |
| 2440 | 2440 | try self.writeInstToStream(stream, inst); |
| 2441 | 2441 | try stream.writeByte('\n'); |
| 2442 | 2442 | } |
| 2443 | 2443 | } |
| 2444 | 2444 | |
| 2445 | 2445 | fn writeImport(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { |
| 2446 | const inst_data = self.code.instructions.items(.data)[@intFromEnum(inst)].pl_tok; | |
| 2446 | const inst_data = self.code.instructions.items(.data)[@backingInt(inst)].pl_tok; | |
| 2447 | 2447 | const extra = self.code.extraData(Zir.Inst.Import, inst_data.payload_index).data; |
| 2448 | 2448 | try self.writeInstRef(stream, extra.res_ty); |
| 2449 | 2449 | const import_path = self.code.nullTerminatedString(extra.path); |
src/print_zoir.zig+1-1| ... | ... | @@ -55,7 +55,7 @@ const PrintZon = struct { |
| 55 | 55 | |
| 56 | 56 | fn renderNode(pz: *PrintZon, node: Zoir.Node.Index) Error!void { |
| 57 | 57 | const zoir = pz.zoir; |
| 58 | try pz.w.print("%{d} = ", .{@intFromEnum(node)}); | |
| 58 | try pz.w.print("%{d} = ", .{@backingInt(node)}); | |
| 59 | 59 | switch (node.get(zoir)) { |
| 60 | 60 | .true => try pz.w.writeAll("true"), |
| 61 | 61 | .false => try pz.w.writeAll("false"), |
src/register_manager.zig+6-6| ... | ... | @@ -381,7 +381,7 @@ const MockRegister1 = enum(u2) { |
| 381 | 381 | r3, |
| 382 | 382 | |
| 383 | 383 | pub fn id(reg: MockRegister1) u2 { |
| 384 | return @intFromEnum(reg); | |
| 384 | return @backingInt(reg); | |
| 385 | 385 | } |
| 386 | 386 | |
| 387 | 387 | const allocatable_registers = [_]MockRegister1{ .r2, .r3 }; |
| ... | ... | @@ -409,7 +409,7 @@ const MockRegister2 = enum(u2) { |
| 409 | 409 | r3, |
| 410 | 410 | |
| 411 | 411 | pub fn id(reg: MockRegister2) u2 { |
| 412 | return @intFromEnum(reg); | |
| 412 | return @backingInt(reg); | |
| 413 | 413 | } |
| 414 | 414 | |
| 415 | 415 | const allocatable_registers = [_]MockRegister2{ .r0, .r1, .r2, .r3 }; |
| ... | ... | @@ -441,14 +441,14 @@ const MockRegister3 = enum(u3) { |
| 441 | 441 | x3, |
| 442 | 442 | |
| 443 | 443 | pub fn id(reg: MockRegister3) u3 { |
| 444 | return switch (@intFromEnum(reg)) { | |
| 445 | 0...3 => @as(u3, @as(u2, @truncate(@intFromEnum(reg)))), | |
| 446 | 4...7 => @intFromEnum(reg), | |
| 444 | return switch (@backingInt(reg)) { | |
| 445 | 0...3 => @as(u3, @as(u2, @truncate(@backingInt(reg)))), | |
| 446 | 4...7 => @backingInt(reg), | |
| 447 | 447 | }; |
| 448 | 448 | } |
| 449 | 449 | |
| 450 | 450 | pub fn enc(reg: MockRegister3) u2 { |
| 451 | return @as(u2, @truncate(@intFromEnum(reg))); | |
| 451 | return @as(u2, @truncate(@backingInt(reg))); | |
| 452 | 452 | } |
| 453 | 453 | |
| 454 | 454 | const gp_regs = [_]MockRegister3{ .r0, .r1, .r2, .r3 }; |
src/target.zig+3-3| ... | ... | @@ -636,8 +636,8 @@ pub fn shouldBlockPointerOps(target: *const std.Target, as: AddressSpace) bool { |
| 636 | 636 | // Physical pointers always support operations |
| 637 | 637 | .global, .physical_storage_buffer => false, |
| 638 | 638 | // Logical pointers that support operations with VariablePointers capability |
| 639 | .shared => !target.cpu.features.isEnabled(@intFromEnum(std.Target.spirv.Feature.variable_pointers)), | |
| 640 | .storage_buffer => !target.cpu.features.isEnabled(@intFromEnum(std.Target.spirv.Feature.variable_pointers)), | |
| 639 | .shared => !target.cpu.features.isEnabled(@backingInt(std.Target.spirv.Feature.variable_pointers)), | |
| 640 | .storage_buffer => !target.cpu.features.isEnabled(@backingInt(std.Target.spirv.Feature.variable_pointers)), | |
| 641 | 641 | // Logical pointers that never support operations |
| 642 | 642 | .constant, |
| 643 | 643 | .local, |
| ... | ... | @@ -678,7 +678,7 @@ pub fn isDynamicAMDGCNFeature(target: *const std.Target, feature: std.Target.Cpu |
| 678 | 678 | &std.Target.amdgcn.cpu.gfx1200, |
| 679 | 679 | &std.Target.amdgcn.cpu.gfx1201, |
| 680 | 680 | }; |
| 681 | const feature_tag: std.Target.amdgcn.Feature = @enumFromInt(feature.index); | |
| 681 | const feature_tag: std.Target.amdgcn.Feature = @fromBackingInt(@intCast(feature.index)); | |
| 682 | 682 | |
| 683 | 683 | if (feature_tag == .sramecc) { |
| 684 | 684 | if (std.mem.indexOfScalar( |
test/behavior/call.zig+2-2| ... | ... | @@ -372,11 +372,11 @@ test "Enum constructed by @Enum passed as generic argument" { |
| 372 | 372 | alive: bool, |
| 373 | 373 | }); |
| 374 | 374 | fn foo(comptime a: E, b: u32) !void { |
| 375 | try expect(@intFromEnum(a) == b); | |
| 375 | try expect(@backingInt(a) == b); | |
| 376 | 376 | } |
| 377 | 377 | }; |
| 378 | 378 | inline for (@typeInfo(S.E).@"enum".field_names, 0..) |_, i| { |
| 379 | try S.foo(@as(S.E, @enumFromInt(i)), i); | |
| 379 | try S.foo(@as(S.E, @fromBackingInt(@intCast(i))), i); | |
| 380 | 380 | } |
| 381 | 381 | } |
| 382 | 382 |
test/behavior/cast.zig+7-7| ... | ... | @@ -440,7 +440,7 @@ test "*usize to *void" { |
| 440 | 440 | |
| 441 | 441 | test "@enumFromInt passed a comptime_int to an enum with one item" { |
| 442 | 442 | const E = enum { A }; |
| 443 | const x = @as(E, @enumFromInt(0)); | |
| 443 | const x = @as(E, @fromBackingInt(@intCast(0))); | |
| 444 | 444 | try expect(x == E.A); |
| 445 | 445 | } |
| 446 | 446 | |
| ... | ... | @@ -2709,7 +2709,7 @@ test "cast builtins can wrap result in optional" { |
| 2709 | 2709 | const S = struct { |
| 2710 | 2710 | const MyEnum = enum(u32) { _ }; |
| 2711 | 2711 | fn a() ?MyEnum { |
| 2712 | return @enumFromInt(123); | |
| 2712 | return @fromBackingInt(@intCast(123)); | |
| 2713 | 2713 | } |
| 2714 | 2714 | fn b() ?u32 { |
| 2715 | 2715 | return @intFromFloat(42.50); |
| ... | ... | @@ -2728,7 +2728,7 @@ test "cast builtins can wrap result in optional" { |
| 2728 | 2728 | comptime assert(@TypeOf(rb) == u32); |
| 2729 | 2729 | comptime assert(@TypeOf(rc) == *const f32); |
| 2730 | 2730 | |
| 2731 | try expect(@intFromEnum(ra) == 123); | |
| 2731 | try expect(@backingInt(ra) == 123); | |
| 2732 | 2732 | try expect(rb == 42); |
| 2733 | 2733 | try expect(@as(*const u32, @ptrCast(rc)).* == 1); |
| 2734 | 2734 | } |
| ... | ... | @@ -2747,7 +2747,7 @@ test "cast builtins can wrap result in error union" { |
| 2747 | 2747 | const MyEnum = enum(u32) { _ }; |
| 2748 | 2748 | const E = error{ImpossibleError}; |
| 2749 | 2749 | fn a() E!MyEnum { |
| 2750 | return @enumFromInt(123); | |
| 2750 | return @fromBackingInt(@intCast(123)); | |
| 2751 | 2751 | } |
| 2752 | 2752 | fn b() E!u32 { |
| 2753 | 2753 | return @intFromFloat(42.50); |
| ... | ... | @@ -2766,7 +2766,7 @@ test "cast builtins can wrap result in error union" { |
| 2766 | 2766 | comptime assert(@TypeOf(rb) == u32); |
| 2767 | 2767 | comptime assert(@TypeOf(rc) == *const f32); |
| 2768 | 2768 | |
| 2769 | try expect(@intFromEnum(ra) == 123); | |
| 2769 | try expect(@backingInt(ra) == 123); | |
| 2770 | 2770 | try expect(rb == 42); |
| 2771 | 2771 | try expect(@as(*const u32, @ptrCast(rc)).* == 1); |
| 2772 | 2772 | } |
| ... | ... | @@ -2785,7 +2785,7 @@ test "cast builtins can wrap result in error union and optional" { |
| 2785 | 2785 | const MyEnum = enum(u32) { _ }; |
| 2786 | 2786 | const E = error{ImpossibleError}; |
| 2787 | 2787 | fn a() E!?MyEnum { |
| 2788 | return @enumFromInt(123); | |
| 2788 | return @fromBackingInt(@intCast(123)); | |
| 2789 | 2789 | } |
| 2790 | 2790 | fn b() E!?u32 { |
| 2791 | 2791 | return @intFromFloat(42.50); |
| ... | ... | @@ -2804,7 +2804,7 @@ test "cast builtins can wrap result in error union and optional" { |
| 2804 | 2804 | comptime assert(@TypeOf(rb) == u32); |
| 2805 | 2805 | comptime assert(@TypeOf(rc) == *const f32); |
| 2806 | 2806 | |
| 2807 | try expect(@intFromEnum(ra) == 123); | |
| 2807 | try expect(@backingInt(ra) == 123); | |
| 2808 | 2808 | try expect(rb == 42); |
| 2809 | 2809 | try expect(@as(*const u32, @ptrCast(rc)).* == 1); |
| 2810 | 2810 | } |
test/behavior/enum.zig+54-54| ... | ... | @@ -8,7 +8,7 @@ const Tag = std.meta.Tag; |
| 8 | 8 | const Number = enum { Zero, One, Two, Three, Four }; |
| 9 | 9 | |
| 10 | 10 | fn shouldEqual(n: Number, expected: u3) !void { |
| 11 | try expect(@intFromEnum(n) == expected); | |
| 11 | try expect(@backingInt(n) == expected); | |
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | test "enum to int" { |
| ... | ... | @@ -20,7 +20,7 @@ test "enum to int" { |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | fn testEnumFromIntEval(x: i32) !void { |
| 23 | try expect(@as(EnumFromIntNumber, @enumFromInt(x)) == EnumFromIntNumber.Three); | |
| 23 | try expect(@as(EnumFromIntNumber, @fromBackingInt(@intCast(x))) == EnumFromIntNumber.Three); | |
| 24 | 24 | } |
| 25 | 25 | const EnumFromIntNumber = enum { Zero, One, Two, Three, Four }; |
| 26 | 26 | |
| ... | ... | @@ -597,7 +597,7 @@ const MultipleChoice = enum(u32) { |
| 597 | 597 | }; |
| 598 | 598 | |
| 599 | 599 | fn testEnumWithSpecifiedTagValues(x: MultipleChoice) !void { |
| 600 | try expect(@intFromEnum(x) == 60); | |
| 600 | try expect(@backingInt(x) == 60); | |
| 601 | 601 | try expect(1234 == switch (x) { |
| 602 | 602 | MultipleChoice.A => 1, |
| 603 | 603 | MultipleChoice.B => 2, |
| ... | ... | @@ -626,7 +626,7 @@ test "non-exhaustive enum" { |
| 626 | 626 | .b => true, |
| 627 | 627 | _ => false, |
| 628 | 628 | }); |
| 629 | e = @as(E, @enumFromInt(12)); | |
| 629 | e = @as(E, @fromBackingInt(@intCast(12))); | |
| 630 | 630 | try expect(switch (e) { |
| 631 | 631 | .a => false, |
| 632 | 632 | .b => false, |
| ... | ... | @@ -645,10 +645,10 @@ test "non-exhaustive enum" { |
| 645 | 645 | }); |
| 646 | 646 | |
| 647 | 647 | try expect(@typeInfo(E).@"enum".field_names.len == 2); |
| 648 | e = @as(E, @enumFromInt(12)); | |
| 649 | try expect(@intFromEnum(e) == 12); | |
| 650 | e = @as(E, @enumFromInt(y)); | |
| 651 | try expect(@intFromEnum(e) == 52); | |
| 648 | e = @as(E, @fromBackingInt(@intCast(12))); | |
| 649 | try expect(@backingInt(e) == 12); | |
| 650 | e = @as(E, @fromBackingInt(@intCast(y))); | |
| 651 | try expect(@backingInt(e) == 52); | |
| 652 | 652 | try expect(@typeInfo(E).@"enum".mode == .nonexhaustive); |
| 653 | 653 | } |
| 654 | 654 | }; |
| ... | ... | @@ -661,12 +661,12 @@ test "empty non-exhaustive enum" { |
| 661 | 661 | const E = enum(u8) { _ }; |
| 662 | 662 | |
| 663 | 663 | fn doTheTest(y: u8) !void { |
| 664 | var e: E = @enumFromInt(y); | |
| 664 | var e: E = @fromBackingInt(@intCast(y)); | |
| 665 | 665 | _ = &e; |
| 666 | 666 | try expect(switch (e) { |
| 667 | 667 | _ => true, |
| 668 | 668 | }); |
| 669 | try expect(@intFromEnum(e) == y); | |
| 669 | try expect(@backingInt(e) == y); | |
| 670 | 670 | |
| 671 | 671 | try expect(@typeInfo(E).@"enum".field_names.len == 0); |
| 672 | 672 | try expect(@typeInfo(E).@"enum".field_values.len == 0); |
| ... | ... | @@ -688,7 +688,7 @@ test "single field non-exhaustive enum" { |
| 688 | 688 | .a => true, |
| 689 | 689 | _ => false, |
| 690 | 690 | }); |
| 691 | e = @as(E, @enumFromInt(12)); | |
| 691 | e = @as(E, @fromBackingInt(@intCast(12))); | |
| 692 | 692 | try expect(switch (e) { |
| 693 | 693 | .a => false, |
| 694 | 694 | _ => true, |
| ... | ... | @@ -704,7 +704,7 @@ test "single field non-exhaustive enum" { |
| 704 | 704 | else => false, |
| 705 | 705 | }); |
| 706 | 706 | |
| 707 | try expect(@intFromEnum(@as(E, @enumFromInt(y))) == y); | |
| 707 | try expect(@backingInt(@as(E, @fromBackingInt(@intCast(y)))) == y); | |
| 708 | 708 | try expect(@typeInfo(E).@"enum".field_names.len == 1); |
| 709 | 709 | try expect(@typeInfo(E).@"enum".field_values.len == 1); |
| 710 | 710 | try expect(@typeInfo(E).@"enum".mode == .nonexhaustive); |
| ... | ... | @@ -721,7 +721,7 @@ const EnumWithTagValues = enum(u4) { |
| 721 | 721 | D = 1 << 3, |
| 722 | 722 | }; |
| 723 | 723 | test "enum with tag values don't require parens" { |
| 724 | try expect(@intFromEnum(EnumWithTagValues.C) == 0b0100); | |
| 724 | try expect(@backingInt(EnumWithTagValues.C) == 0b0100); | |
| 725 | 725 | } |
| 726 | 726 | |
| 727 | 727 | const MultipleChoice2 = enum(u32) { |
| ... | ... | @@ -737,8 +737,8 @@ const MultipleChoice2 = enum(u32) { |
| 737 | 737 | }; |
| 738 | 738 | |
| 739 | 739 | test "cast integer literal to enum" { |
| 740 | try expect(@as(MultipleChoice2, @enumFromInt(0)) == MultipleChoice2.Unspecified1); | |
| 741 | try expect(@as(MultipleChoice2, @enumFromInt(40)) == MultipleChoice2.B); | |
| 740 | try expect(@as(MultipleChoice2, @fromBackingInt(@intCast(0))) == MultipleChoice2.Unspecified1); | |
| 741 | try expect(@as(MultipleChoice2, @fromBackingInt(@intCast(40))) == MultipleChoice2.B); | |
| 742 | 742 | } |
| 743 | 743 | |
| 744 | 744 | test "enum with specified and unspecified tag values" { |
| ... | ... | @@ -749,7 +749,7 @@ test "enum with specified and unspecified tag values" { |
| 749 | 749 | } |
| 750 | 750 | |
| 751 | 751 | fn testEnumWithSpecifiedAndUnspecifiedTagValues(x: MultipleChoice2) !void { |
| 752 | try expect(@intFromEnum(x) == 1000); | |
| 752 | try expect(@backingInt(x) == 1000); | |
| 753 | 753 | try expect(1234 == switch (x) { |
| 754 | 754 | MultipleChoice2.A => 1, |
| 755 | 755 | MultipleChoice2.B => 2, |
| ... | ... | @@ -785,7 +785,7 @@ test "casting enum to its tag type" { |
| 785 | 785 | } |
| 786 | 786 | |
| 787 | 787 | fn testCastEnumTag(value: Small2) !void { |
| 788 | try expect(@intFromEnum(value) == 1); | |
| 788 | try expect(@backingInt(value) == 1); | |
| 789 | 789 | } |
| 790 | 790 | |
| 791 | 791 | test "enum with 1 field but explicit tag type should still have the tag type" { |
| ... | ... | @@ -802,27 +802,27 @@ test "signed integer as enum tag" { |
| 802 | 802 | A2 = 1, |
| 803 | 803 | }; |
| 804 | 804 | |
| 805 | try expect(@intFromEnum(SignedEnum.A0) == -1); | |
| 806 | try expect(@intFromEnum(SignedEnum.A1) == 0); | |
| 807 | try expect(@intFromEnum(SignedEnum.A2) == 1); | |
| 805 | try expect(@backingInt(SignedEnum.A0) == -1); | |
| 806 | try expect(@backingInt(SignedEnum.A1) == 0); | |
| 807 | try expect(@backingInt(SignedEnum.A2) == 1); | |
| 808 | 808 | } |
| 809 | 809 | |
| 810 | 810 | test "enum with one member and custom tag type" { |
| 811 | 811 | const E = enum(u2) { |
| 812 | 812 | One, |
| 813 | 813 | }; |
| 814 | try expect(@intFromEnum(E.One) == 0); | |
| 814 | try expect(@backingInt(E.One) == 0); | |
| 815 | 815 | const E2 = enum(u2) { |
| 816 | 816 | One = 2, |
| 817 | 817 | }; |
| 818 | try expect(@intFromEnum(E2.One) == 2); | |
| 818 | try expect(@backingInt(E2.One) == 2); | |
| 819 | 819 | } |
| 820 | 820 | |
| 821 | 821 | test "enum with one member and u1 tag type @intFromEnum" { |
| 822 | 822 | const Enum = enum(u1) { |
| 823 | 823 | Test, |
| 824 | 824 | }; |
| 825 | try expect(@intFromEnum(Enum.Test) == 0); | |
| 825 | try expect(@backingInt(Enum.Test) == 0); | |
| 826 | 826 | } |
| 827 | 827 | |
| 828 | 828 | test "enum with one member default to u0 tag type" { |
| ... | ... | @@ -886,9 +886,9 @@ test "enum value allocation" { |
| 886 | 886 | A2, |
| 887 | 887 | }; |
| 888 | 888 | |
| 889 | try expect(@intFromEnum(LargeEnum.A0) == 0x80000000); | |
| 890 | try expect(@intFromEnum(LargeEnum.A1) == 0x80000001); | |
| 891 | try expect(@intFromEnum(LargeEnum.A2) == 0x80000002); | |
| 889 | try expect(@backingInt(LargeEnum.A0) == 0x80000000); | |
| 890 | try expect(@backingInt(LargeEnum.A1) == 0x80000001); | |
| 891 | try expect(@backingInt(LargeEnum.A2) == 0x80000002); | |
| 892 | 892 | } |
| 893 | 893 | |
| 894 | 894 | test "enum literal casting to tagged union" { |
| ... | ... | @@ -1068,8 +1068,8 @@ test "tag name with large enum values" { |
| 1068 | 1068 | var kdf: Kdf = .aes_kdf; |
| 1069 | 1069 | try expect(mem.eql(u8, @tagName(kdf), "aes_kdf")); |
| 1070 | 1070 | var argon2d_value: u128 = undefined; |
| 1071 | argon2d_value = @intFromEnum(Kdf.argon2d); | |
| 1072 | kdf = @enumFromInt(argon2d_value); | |
| 1071 | argon2d_value = @backingInt(Kdf.argon2d); | |
| 1072 | kdf = @fromBackingInt(@intCast(argon2d_value)); | |
| 1073 | 1073 | try expect(mem.eql(u8, @tagName(kdf), "argon2d")); |
| 1074 | 1074 | kdf = .argon2id; |
| 1075 | 1075 | try expect(mem.eql(u8, @tagName(kdf), "argon2id")); |
| ... | ... | @@ -1343,7 +1343,7 @@ test "runtime int to enum with one possible value" { |
| 1343 | 1343 | const E = enum { one }; |
| 1344 | 1344 | var runtime: usize = 0; |
| 1345 | 1345 | _ = &runtime; |
| 1346 | if (@as(E, @enumFromInt(runtime)) != .one) { | |
| 1346 | if (@as(E, @fromBackingInt(@intCast(runtime))) != .one) { | |
| 1347 | 1347 | @compileError("test failed"); |
| 1348 | 1348 | } |
| 1349 | 1349 | } |
| ... | ... | @@ -1354,8 +1354,8 @@ test "enum tag from a local variable" { |
| 1354 | 1354 | return enum(Inner) { _ }; |
| 1355 | 1355 | } |
| 1356 | 1356 | }; |
| 1357 | const i = @as(S.Int(u32), @enumFromInt(0)); | |
| 1358 | try std.testing.expect(@intFromEnum(i) == 0); | |
| 1357 | const i = @as(S.Int(u32), @fromBackingInt(@intCast(0))); | |
| 1358 | try std.testing.expect(@backingInt(i) == 0); | |
| 1359 | 1359 | } |
| 1360 | 1360 | |
| 1361 | 1361 | test "auto-numbered enum with signed tag type" { |
| ... | ... | @@ -1363,14 +1363,14 @@ test "auto-numbered enum with signed tag type" { |
| 1363 | 1363 | |
| 1364 | 1364 | const E = enum(i32) { a, b }; |
| 1365 | 1365 | |
| 1366 | try std.testing.expectEqual(@as(i32, 0), @intFromEnum(E.a)); | |
| 1367 | try std.testing.expectEqual(@as(i32, 1), @intFromEnum(E.b)); | |
| 1368 | try std.testing.expectEqual(E.a, @as(E, @enumFromInt(0))); | |
| 1369 | try std.testing.expectEqual(E.b, @as(E, @enumFromInt(1))); | |
| 1370 | try std.testing.expectEqual(E.a, @as(E, @enumFromInt(@as(i32, 0)))); | |
| 1371 | try std.testing.expectEqual(E.b, @as(E, @enumFromInt(@as(i32, 1)))); | |
| 1372 | try std.testing.expectEqual(E.a, @as(E, @enumFromInt(@as(u32, 0)))); | |
| 1373 | try std.testing.expectEqual(E.b, @as(E, @enumFromInt(@as(u32, 1)))); | |
| 1366 | try std.testing.expectEqual(@as(i32, 0), @backingInt(E.a)); | |
| 1367 | try std.testing.expectEqual(@as(i32, 1), @backingInt(E.b)); | |
| 1368 | try std.testing.expectEqual(E.a, @as(E, @fromBackingInt(@intCast(0)))); | |
| 1369 | try std.testing.expectEqual(E.b, @as(E, @fromBackingInt(@intCast(1)))); | |
| 1370 | try std.testing.expectEqual(E.a, @as(E, @fromBackingInt(@intCast(@as(i32, 0))))); | |
| 1371 | try std.testing.expectEqual(E.b, @as(E, @fromBackingInt(@intCast(@as(i32, 1))))); | |
| 1372 | try std.testing.expectEqual(E.a, @as(E, @fromBackingInt(@intCast(@as(u32, 0))))); | |
| 1373 | try std.testing.expectEqual(E.b, @as(E, @fromBackingInt(@intCast(@as(u32, 1))))); | |
| 1374 | 1374 | try std.testing.expectEqualStrings("a", @tagName(E.a)); |
| 1375 | 1375 | try std.testing.expectEqualStrings("b", @tagName(E.b)); |
| 1376 | 1376 | } |
| ... | ... | @@ -1382,7 +1382,7 @@ test "lazy initialized field" { |
| 1382 | 1382 | fn getLazyInitialized(param: enum(u8) { |
| 1383 | 1383 | a = @bitCast(packed struct(u8) { a: u8 }{ .a = @alignOf(struct {}) }), |
| 1384 | 1384 | }) u8 { |
| 1385 | return @intFromEnum(param); | |
| 1385 | return @backingInt(param); | |
| 1386 | 1386 | } |
| 1387 | 1387 | |
| 1388 | 1388 | test "matching captures causes enum equivalence" { |
| ... | ... | @@ -1397,10 +1397,10 @@ test "matching captures causes enum equivalence" { |
| 1397 | 1397 | comptime assert(S.Nonexhaustive(u16) == S.Nonexhaustive(i16)); |
| 1398 | 1398 | comptime assert(S.Nonexhaustive(u8) != S.Nonexhaustive(u16)); |
| 1399 | 1399 | |
| 1400 | const a: S.Nonexhaustive(u8) = @enumFromInt(123); | |
| 1401 | const b: S.Nonexhaustive(i8) = @enumFromInt(123); | |
| 1400 | const a: S.Nonexhaustive(u8) = @fromBackingInt(@intCast(123)); | |
| 1401 | const b: S.Nonexhaustive(i8) = @fromBackingInt(@intCast(123)); | |
| 1402 | 1402 | comptime assert(@TypeOf(a) == @TypeOf(b)); |
| 1403 | try expect(@intFromEnum(a) == @intFromEnum(b)); | |
| 1403 | try expect(@backingInt(a) == @backingInt(b)); | |
| 1404 | 1404 | } |
| 1405 | 1405 | |
| 1406 | 1406 | test "large enum field values" { |
| ... | ... | @@ -1410,45 +1410,45 @@ test "large enum field values" { |
| 1410 | 1410 | const E = enum(u64) { min = std.math.minInt(u64), max = std.math.maxInt(u64) }; |
| 1411 | 1411 | var e: E = .min; |
| 1412 | 1412 | try expect(e == .min); |
| 1413 | try expect(@intFromEnum(e) == std.math.minInt(u64)); | |
| 1413 | try expect(@backingInt(e) == std.math.minInt(u64)); | |
| 1414 | 1414 | e = .max; |
| 1415 | 1415 | try expect(e == .max); |
| 1416 | try expect(@intFromEnum(e) == std.math.maxInt(u64)); | |
| 1416 | try expect(@backingInt(e) == std.math.maxInt(u64)); | |
| 1417 | 1417 | } |
| 1418 | 1418 | { |
| 1419 | 1419 | const E = enum(i64) { min = std.math.minInt(i64), max = std.math.maxInt(i64) }; |
| 1420 | 1420 | var e: E = .min; |
| 1421 | 1421 | try expect(e == .min); |
| 1422 | try expect(@intFromEnum(e) == std.math.minInt(i64)); | |
| 1422 | try expect(@backingInt(e) == std.math.minInt(i64)); | |
| 1423 | 1423 | e = .max; |
| 1424 | 1424 | try expect(e == .max); |
| 1425 | try expect(@intFromEnum(e) == std.math.maxInt(i64)); | |
| 1425 | try expect(@backingInt(e) == std.math.maxInt(i64)); | |
| 1426 | 1426 | } |
| 1427 | 1427 | { |
| 1428 | 1428 | const E = enum(u128) { min = std.math.minInt(u128), max = std.math.maxInt(u128) }; |
| 1429 | 1429 | var e: E = .min; |
| 1430 | 1430 | try expect(e == .min); |
| 1431 | try expect(@intFromEnum(e) == std.math.minInt(u128)); | |
| 1431 | try expect(@backingInt(e) == std.math.minInt(u128)); | |
| 1432 | 1432 | e = .max; |
| 1433 | 1433 | try expect(e == .max); |
| 1434 | try expect(@intFromEnum(e) == std.math.maxInt(u128)); | |
| 1434 | try expect(@backingInt(e) == std.math.maxInt(u128)); | |
| 1435 | 1435 | } |
| 1436 | 1436 | { |
| 1437 | 1437 | const E = enum(i128) { min = std.math.minInt(i128), max = std.math.maxInt(i128) }; |
| 1438 | 1438 | var e: E = .min; |
| 1439 | 1439 | try expect(e == .min); |
| 1440 | try expect(@intFromEnum(e) == std.math.minInt(i128)); | |
| 1440 | try expect(@backingInt(e) == std.math.minInt(i128)); | |
| 1441 | 1441 | e = .max; |
| 1442 | 1442 | try expect(e == .max); |
| 1443 | try expect(@intFromEnum(e) == std.math.maxInt(i128)); | |
| 1443 | try expect(@backingInt(e) == std.math.maxInt(i128)); | |
| 1444 | 1444 | } |
| 1445 | 1445 | } |
| 1446 | 1446 | |
| 1447 | 1447 | test "comptime @enumFromInt with signed arithmetic" { |
| 1448 | 1448 | const E = enum(i8) { foo = -1, bar = 0 }; |
| 1449 | const x: E = @enumFromInt(@as(i8, -1) * 0); | |
| 1449 | const x: E = @fromBackingInt(@intCast(@as(i8, -1) * 0)); | |
| 1450 | 1450 | comptime assert(x == .bar); |
| 1451 | comptime assert(@intFromEnum(x) == 0); | |
| 1451 | comptime assert(@backingInt(x) == 0); | |
| 1452 | 1452 | } |
| 1453 | 1453 | |
| 1454 | 1454 | test "enum int tag type uses declaration inside the enum" { |
| ... | ... | @@ -1463,7 +1463,7 @@ test "enum int tag type uses declaration inside the enum" { |
| 1463 | 1463 | try expect(@sizeOf(static.E) == @sizeOf(u8)); |
| 1464 | 1464 | const val: static.E = .b; |
| 1465 | 1465 | try expect(val == .b); |
| 1466 | try expect(@intFromEnum(val) == 1); | |
| 1466 | try expect(@backingInt(val) == 1); | |
| 1467 | 1467 | } |
| 1468 | 1468 | |
| 1469 | 1469 | test "convert from/to backing int" { |
test/behavior/generics.zig+2-2| ... | ... | @@ -259,8 +259,8 @@ test "generic function instantiation turns into comptime call" { |
| 259 | 259 | else => void, |
| 260 | 260 | } { |
| 261 | 261 | return .{ |
| 262 | .name = @typeInfo(T).@"enum".field_names[@intFromEnum(field)], | |
| 263 | .value = @typeInfo(T).@"enum".field_values[@intFromEnum(field)], | |
| 262 | .name = @typeInfo(T).@"enum".field_names[@backingInt(field)], | |
| 263 | .value = @typeInfo(T).@"enum".field_values[@backingInt(field)], | |
| 264 | 264 | }; |
| 265 | 265 | } |
| 266 | 266 |
test/behavior/inline_switch.zig+1-1| ... | ... | @@ -98,7 +98,7 @@ test "inline else enum" { |
| 98 | 98 | _ = &a; |
| 99 | 99 | switch (a) { |
| 100 | 100 | .a, .b => {}, |
| 101 | inline else => |val| comptime if (@intFromEnum(val) < 4) @compileError("bad"), | |
| 101 | inline else => |val| comptime if (@backingInt(val) < 4) @compileError("bad"), | |
| 102 | 102 | } |
| 103 | 103 | } |
| 104 | 104 |
test/behavior/struct.zig+1-1| ... | ... | @@ -1873,7 +1873,7 @@ test "runtime call in nested initializer" { |
| 1873 | 1873 | B, |
| 1874 | 1874 | |
| 1875 | 1875 | fn letter(e: @This()) u8 { |
| 1876 | return @intFromEnum(e); | |
| 1876 | return @backingInt(e); | |
| 1877 | 1877 | } |
| 1878 | 1878 | }; |
| 1879 | 1879 |
test/behavior/switch.zig+8-8| ... | ... | @@ -777,10 +777,10 @@ test "enum value without tag name used as switch item" { |
| 777 | 777 | b = 2, |
| 778 | 778 | _, |
| 779 | 779 | }; |
| 780 | var e: E = @enumFromInt(0); | |
| 780 | var e: E = @fromBackingInt(@intCast(0)); | |
| 781 | 781 | _ = &e; |
| 782 | 782 | switch (e) { |
| 783 | @as(E, @enumFromInt(0)) => {}, | |
| 783 | @as(E, @fromBackingInt(@intCast(0))) => {}, | |
| 784 | 784 | .a => return error.TestFailed, |
| 785 | 785 | .b => return error.TestFailed, |
| 786 | 786 | _ => return error.TestFailed, |
| ... | ... | @@ -1117,7 +1117,7 @@ test "decl literals as switch cases" { |
| 1117 | 1117 | bar = 3, |
| 1118 | 1118 | _, |
| 1119 | 1119 | |
| 1120 | const foo: @This() = @enumFromInt(0xa); | |
| 1120 | const foo: @This() = @fromBackingInt(@intCast(0xa)); | |
| 1121 | 1121 | |
| 1122 | 1122 | fn doTheTest(e: @This()) !void { |
| 1123 | 1123 | switch (e) { |
| ... | ... | @@ -1185,7 +1185,7 @@ test "switch with tag capture" { |
| 1185 | 1185 | .a => |nothing, tag| { |
| 1186 | 1186 | comptime assert(nothing == {}); |
| 1187 | 1187 | comptime assert(tag == .a); |
| 1188 | try expect(@intFromEnum(tag) == @intFromEnum(@This().a)); | |
| 1188 | try expect(@backingInt(tag) == @backingInt(@This().a)); | |
| 1189 | 1189 | }, |
| 1190 | 1190 | .b, .d => |_, tag| { |
| 1191 | 1191 | try expect(tag == .b or tag == .d); |
| ... | ... | @@ -1226,8 +1226,8 @@ test "switch with complex item expressions" { |
| 1226 | 1226 | try doTheSwitch(2000, 10); |
| 1227 | 1227 | try doTheSwitch(2000, 5); |
| 1228 | 1228 | |
| 1229 | try doTheOtherSwitch(@enumFromInt(123)); | |
| 1230 | try doTheOtherSwitch(@enumFromInt(456)); | |
| 1229 | try doTheOtherSwitch(@fromBackingInt(@intCast(123))); | |
| 1230 | try doTheOtherSwitch(@fromBackingInt(@intCast(456))); | |
| 1231 | 1231 | } |
| 1232 | 1232 | fn doTheSwitch(x: u32, comptime factor: u32) !void { |
| 1233 | 1233 | const ok = switch (x) { |
| ... | ... | @@ -1252,8 +1252,8 @@ test "switch with complex item expressions" { |
| 1252 | 1252 | const E = enum(u32) { _ }; |
| 1253 | 1253 | fn doTheOtherSwitch(e: E) !void { |
| 1254 | 1254 | const ok = switch (e) { |
| 1255 | @enumFromInt(123) => true, | |
| 1256 | @enumFromInt(456) => true, | |
| 1255 | @fromBackingInt(@intCast(123)) => true, | |
| 1256 | @fromBackingInt(@intCast(456)) => true, | |
| 1257 | 1257 | else => false, |
| 1258 | 1258 | }; |
| 1259 | 1259 | try expect(ok); |
test/behavior/switch_loop.zig+3-3| ... | ... | @@ -256,8 +256,8 @@ test "switch loop on non-exhaustive enum" { |
| 256 | 256 | start = .a; |
| 257 | 257 | const result: u32 = s: switch (start) { |
| 258 | 258 | .a => continue :s .c, |
| 259 | else => continue :s @enumFromInt(123), | |
| 260 | .b, _ => |x| break :s @intFromEnum(x), | |
| 259 | else => continue :s @fromBackingInt(@intCast(123)), | |
| 260 | .b, _ => |x| break :s @backingInt(x), | |
| 261 | 261 | }; |
| 262 | 262 | try expect(result == 123); |
| 263 | 263 | } |
| ... | ... | @@ -407,7 +407,7 @@ test "switch loop with tag capture" { |
| 407 | 407 | .a => |nothing, tag| { |
| 408 | 408 | comptime assert(nothing == {}); |
| 409 | 409 | comptime assert(tag == .a); |
| 410 | try expect(@intFromEnum(tag) == @intFromEnum(@This().a)); | |
| 410 | try expect(@backingInt(tag) == @backingInt(@This().a)); | |
| 411 | 411 | continue :label .{ .d = 456 }; |
| 412 | 412 | }, |
| 413 | 413 | .b, .d => |_, tag| { |
test/behavior/type.zig+5-5| ... | ... | @@ -197,13 +197,13 @@ test "Type.Enum" { |
| 197 | 197 | |
| 198 | 198 | const Foo = @Enum(u8, .exhaustive, &.{ "a", "b" }, &.{ 1, 5 }); |
| 199 | 199 | try testing.expectEqual(std.builtin.Type.Enum.Mode.exhaustive, @typeInfo(Foo).@"enum".mode); |
| 200 | try testing.expectEqual(@as(u8, 1), @intFromEnum(Foo.a)); | |
| 201 | try testing.expectEqual(@as(u8, 5), @intFromEnum(Foo.b)); | |
| 200 | try testing.expectEqual(@as(u8, 1), @backingInt(Foo.a)); | |
| 201 | try testing.expectEqual(@as(u8, 5), @backingInt(Foo.b)); | |
| 202 | 202 | const Bar = @Enum(u32, .nonexhaustive, &.{ "a", "b" }, &.{ 1, 5 }); |
| 203 | 203 | try testing.expectEqual(std.builtin.Type.Enum.Mode.nonexhaustive, @typeInfo(Bar).@"enum".mode); |
| 204 | try testing.expectEqual(@as(u32, 1), @intFromEnum(Bar.a)); | |
| 205 | try testing.expectEqual(@as(u32, 5), @intFromEnum(Bar.b)); | |
| 206 | try testing.expectEqual(@as(u32, 6), @intFromEnum(@as(Bar, @enumFromInt(6)))); | |
| 204 | try testing.expectEqual(@as(u32, 1), @backingInt(Bar.a)); | |
| 205 | try testing.expectEqual(@as(u32, 5), @backingInt(Bar.b)); | |
| 206 | try testing.expectEqual(@as(u32, 6), @backingInt(@as(Bar, @fromBackingInt(@intCast(6))))); | |
| 207 | 207 | |
| 208 | 208 | { // from https://github.com/ziglang/zig/issues/19985 |
| 209 | 209 | { // enum with single field can be initialized. |
test/behavior/union.zig+8-8| ... | ... | @@ -337,7 +337,7 @@ test "simple union(enum(u32))" { |
| 337 | 337 | var x = MultipleChoice.C; |
| 338 | 338 | _ = &x; |
| 339 | 339 | try expect(x == MultipleChoice.C); |
| 340 | try expect(@intFromEnum(@as(Tag(MultipleChoice), x)) == 60); | |
| 340 | try expect(@backingInt(@as(Tag(MultipleChoice), x)) == 60); | |
| 341 | 341 | } |
| 342 | 342 | |
| 343 | 343 | test "packed union size" { |
| ... | ... | @@ -639,7 +639,7 @@ const MultipleChoice2 = union(enum(u32)) { |
| 639 | 639 | }; |
| 640 | 640 | |
| 641 | 641 | fn testEnumWithSpecifiedAndUnspecifiedTagValues(x: MultipleChoice2) !void { |
| 642 | try expect(@intFromEnum(@as(Tag(MultipleChoice2), x)) == 60); | |
| 642 | try expect(@backingInt(@as(Tag(MultipleChoice2), x)) == 60); | |
| 643 | 643 | try expect(1123 == switch (x) { |
| 644 | 644 | MultipleChoice2.A => 1, |
| 645 | 645 | MultipleChoice2.B => 2, |
| ... | ... | @@ -701,9 +701,9 @@ test "union with only 1 field casted to its enum type which has enum value speci |
| 701 | 701 | |
| 702 | 702 | const t: ExprTag = e; |
| 703 | 703 | comptime assert(t == Expr.literal); |
| 704 | comptime assert(@intFromEnum(t) == 33); | |
| 704 | comptime assert(@backingInt(t) == 33); | |
| 705 | 705 | try expect(t == Expr.literal); |
| 706 | try expect(@intFromEnum(t) == 33); | |
| 706 | try expect(@backingInt(t) == 33); | |
| 707 | 707 | } |
| 708 | 708 | |
| 709 | 709 | test "@intFromEnum works on unions" { |
| ... | ... | @@ -721,9 +721,9 @@ test "@intFromEnum works on unions" { |
| 721 | 721 | var b = Bar{ .B = undefined }; |
| 722 | 722 | var c = Bar.C; |
| 723 | 723 | _ = .{ &b, &c }; |
| 724 | try expect(@intFromEnum(a) == 0); | |
| 725 | try expect(@intFromEnum(b) == 1); | |
| 726 | try expect(@intFromEnum(c) == 2); | |
| 724 | try expect(@backingInt(a) == 0); | |
| 725 | try expect(@backingInt(b) == 1); | |
| 726 | try expect(@backingInt(c) == 2); | |
| 727 | 727 | } |
| 728 | 728 | |
| 729 | 729 | test "comptime union field value equality" { |
| ... | ... | @@ -1278,7 +1278,7 @@ test "@unionInit uses tag value instead of field index" { |
| 1278 | 1278 | _ = &a; |
| 1279 | 1279 | try expect(a.* == i); |
| 1280 | 1280 | } |
| 1281 | try expect(@intFromEnum(u) == 255); | |
| 1281 | try expect(@backingInt(u) == 255); | |
| 1282 | 1282 | } |
| 1283 | 1283 | |
| 1284 | 1284 | test "union field ptr - zero sized payload" { |
test/c.zig+5-5| ... | ... | @@ -15,14 +15,14 @@ test { |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | pub fn expectErrno(expected_errno: c.E) !void { |
| 18 | try std.testing.expectEqual(expected_errno, @as(c.E, @enumFromInt(c._errno().*))); | |
| 19 | c._errno().* = @intFromEnum(c.E.SUCCESS); | |
| 18 | try std.testing.expectEqual(expected_errno, @as(c.E, @fromBackingInt(@intCast(c._errno().*)))); | |
| 19 | c._errno().* = @backingInt(c.E.SUCCESS); | |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | pub fn expectErrnoAny(expected_errnos: []const c.E) !void { |
| 23 | 23 | const errno = c._errno().*; |
| 24 | 24 | for (expected_errnos) |expected_errno| { |
| 25 | if (errno == @intFromEnum(expected_errno)) break; | |
| 25 | if (errno == @backingInt(expected_errno)) break; | |
| 26 | 26 | } else { |
| 27 | 27 | var buffer: [64]u8 = undefined; |
| 28 | 28 | const stderr = std.debug.lockStderr(&buffer); |
| ... | ... | @@ -31,8 +31,8 @@ pub fn expectErrnoAny(expected_errnos: []const c.E) !void { |
| 31 | 31 | for (expected_errnos[1..]) |expected_errno| { |
| 32 | 32 | try stderr.file_writer.interface.print(", {t}", .{expected_errno}); |
| 33 | 33 | } |
| 34 | try stderr.file_writer.interface.print(", found {t}\n", .{@as(c.E, @enumFromInt(errno))}); | |
| 34 | try stderr.file_writer.interface.print(", found {t}\n", .{@as(c.E, @fromBackingInt(@intCast(errno)))}); | |
| 35 | 35 | return error.TestExpectedEqual; |
| 36 | 36 | } |
| 37 | c._errno().* = @intFromEnum(c.E.SUCCESS); | |
| 37 | c._errno().* = @backingInt(c.E.SUCCESS); | |
| 38 | 38 | } |
test/c/pthread.zig+4-4| ... | ... | @@ -13,9 +13,9 @@ test "pthread_spinlock_t" { |
| 13 | 13 | _ = c.pthread_spin_init(&spin, c.PTHREAD_PROCESS_PRIVATE); |
| 14 | 14 | defer _ = c.pthread_spin_destroy(&spin); |
| 15 | 15 | |
| 16 | try std.testing.expectEqual(@intFromEnum(c.E.SUCCESS), c.pthread_spin_trylock(&spin)); | |
| 17 | try std.testing.expectEqual(@intFromEnum(c.E.SUCCESS), c.pthread_spin_unlock(&spin)); | |
| 16 | try std.testing.expectEqual(@backingInt(c.E.SUCCESS), c.pthread_spin_trylock(&spin)); | |
| 17 | try std.testing.expectEqual(@backingInt(c.E.SUCCESS), c.pthread_spin_unlock(&spin)); | |
| 18 | 18 | |
| 19 | try std.testing.expectEqual(@intFromEnum(c.E.SUCCESS), c.pthread_spin_lock(&spin)); | |
| 20 | try std.testing.expectEqual(@intFromEnum(c.E.SUCCESS), c.pthread_spin_unlock(&spin)); | |
| 19 | try std.testing.expectEqual(@backingInt(c.E.SUCCESS), c.pthread_spin_lock(&spin)); | |
| 20 | try std.testing.expectEqual(@backingInt(c.E.SUCCESS), c.pthread_spin_unlock(&spin)); | |
| 21 | 21 | } |
test/c/stdlib.zig+6-6| ... | ... | @@ -133,7 +133,7 @@ fn testStrToLLikeFunctionAnyErrno( |
| 133 | 133 | test "strtol" { |
| 134 | 134 | if (builtin.target.cpu.arch.isX86() and builtin.target.os.tag == .windows and builtin.target.abi == .msvc) return error.SkipZigTest; // TODO |
| 135 | 135 | |
| 136 | c._errno().* = @intFromEnum(c.E.SUCCESS); | |
| 136 | c._errno().* = @backingInt(c.E.SUCCESS); | |
| 137 | 137 | try testStrToLLikeFunctionAnyErrno(c.strtol, @ptrCast("stop42true"), 0, 0, 0, &.{ .SUCCESS, .INVAL }); |
| 138 | 138 | try testStrToLLikeFunction(c.strtol, @ptrCast("42true"), 0, 42, 2, .SUCCESS); |
| 139 | 139 | try testStrToLLikeFunction(c.strtol, @ptrCast("-01"), 0, -1, 3, .SUCCESS); |
| ... | ... | @@ -173,7 +173,7 @@ test "strtol" { |
| 173 | 173 | test "strtoll" { |
| 174 | 174 | if (builtin.target.cpu.arch.isX86() and builtin.target.os.tag == .windows and builtin.target.abi == .msvc) return error.SkipZigTest; // TODO |
| 175 | 175 | |
| 176 | c._errno().* = @intFromEnum(c.E.SUCCESS); | |
| 176 | c._errno().* = @backingInt(c.E.SUCCESS); | |
| 177 | 177 | try testStrToLLikeFunctionAnyErrno(c.strtoll, @ptrCast("stop42true"), 0, 0, 0, &.{ .SUCCESS, .INVAL }); |
| 178 | 178 | try testStrToLLikeFunction(c.strtoll, @ptrCast("42true"), 0, 42, 2, .SUCCESS); |
| 179 | 179 | try testStrToLLikeFunction(c.strtoll, @ptrCast("-01"), 0, -1, 3, .SUCCESS); |
| ... | ... | @@ -213,7 +213,7 @@ test "strtoll" { |
| 213 | 213 | test "strtoul" { |
| 214 | 214 | if (builtin.target.cpu.arch.isX86() and builtin.target.os.tag == .windows and builtin.target.abi == .msvc) return error.SkipZigTest; // TODO |
| 215 | 215 | |
| 216 | c._errno().* = @intFromEnum(c.E.SUCCESS); | |
| 216 | c._errno().* = @backingInt(c.E.SUCCESS); | |
| 217 | 217 | try testStrToLLikeFunctionAnyErrno(c.strtoul, @ptrCast("stop42true"), 0, 0, 0, &.{ .SUCCESS, .INVAL }); |
| 218 | 218 | try testStrToLLikeFunction(c.strtoul, @ptrCast("42true"), 0, 42, 2, .SUCCESS); |
| 219 | 219 | try testStrToLLikeFunction(c.strtoul, @ptrCast("-01"), 0, math.maxInt(c_ulong), 3, .SUCCESS); |
| ... | ... | @@ -251,7 +251,7 @@ test "strtoul" { |
| 251 | 251 | test "strtoull" { |
| 252 | 252 | if (builtin.target.cpu.arch.isX86() and builtin.target.os.tag == .windows and builtin.target.abi == .msvc) return error.SkipZigTest; // TODO |
| 253 | 253 | |
| 254 | c._errno().* = @intFromEnum(c.E.SUCCESS); | |
| 254 | c._errno().* = @backingInt(c.E.SUCCESS); | |
| 255 | 255 | try testStrToLLikeFunctionAnyErrno(c.strtoull, @ptrCast("stop42true"), 0, 0, 0, &.{ .SUCCESS, .INVAL }); |
| 256 | 256 | try testStrToLLikeFunction(c.strtoull, @ptrCast("42true"), 0, 42, 2, .SUCCESS); |
| 257 | 257 | try testStrToLLikeFunction(c.strtoull, @ptrCast("-01"), 0, math.maxInt(c_ulonglong), 3, .SUCCESS); |
| ... | ... | @@ -289,7 +289,7 @@ test "strtoull" { |
| 289 | 289 | test "strtoimax" { |
| 290 | 290 | if (builtin.target.cpu.arch.isX86() and builtin.target.os.tag == .windows and builtin.target.abi == .msvc) return error.SkipZigTest; // TODO |
| 291 | 291 | |
| 292 | c._errno().* = @intFromEnum(c.E.SUCCESS); | |
| 292 | c._errno().* = @backingInt(c.E.SUCCESS); | |
| 293 | 293 | try testStrToLLikeFunctionAnyErrno(c.strtoimax, @ptrCast("stop42true"), 0, 0, 0, &.{ .SUCCESS, .INVAL }); |
| 294 | 294 | try testStrToLLikeFunction(c.strtoimax, @ptrCast("42true"), 0, 42, 2, .SUCCESS); |
| 295 | 295 | try testStrToLLikeFunction(c.strtoimax, @ptrCast("-01"), 0, -1, 3, .SUCCESS); |
| ... | ... | @@ -329,7 +329,7 @@ test "strtoimax" { |
| 329 | 329 | test "strtoumax" { |
| 330 | 330 | if (builtin.target.cpu.arch.isX86() and builtin.target.os.tag == .windows and builtin.target.abi == .msvc) return error.SkipZigTest; // TODO |
| 331 | 331 | |
| 332 | c._errno().* = @intFromEnum(c.E.SUCCESS); | |
| 332 | c._errno().* = @backingInt(c.E.SUCCESS); | |
| 333 | 333 | try testStrToLLikeFunctionAnyErrno(c.strtoumax, @ptrCast("stop42true"), 0, 0, 0, &.{ .SUCCESS, .INVAL }); |
| 334 | 334 | try testStrToLLikeFunction(c.strtoumax, @ptrCast("42true"), 0, 42, 2, .SUCCESS); |
| 335 | 335 | try testStrToLLikeFunction(c.strtoumax, @ptrCast("-01"), 0, math.maxInt(c.uintmax_t), 3, .SUCCESS); |
test/src/StackTrace.zig+1-1| ... | ... | @@ -229,7 +229,7 @@ fn addCaseInstance( |
| 229 | 229 | run.addCheck(.{ .expect_term = term: { |
| 230 | 230 | if (!expect_panic) break :term .{ .exited = 0 }; |
| 231 | 231 | if (target.result.os.tag == .windows) break :term .{ .exited = 3 }; |
| 232 | break :term .{ .signal = @enumFromInt(6) }; | |
| 232 | break :term .{ .signal = @fromBackingInt(@intCast(6)) }; | |
| 233 | 233 | } }); |
| 234 | 234 | run.expectStdOutEqual(""); |
| 235 | 235 |
test/standalone/windows_argv/fuzz.zig+1-1| ... | ... | @@ -162,7 +162,7 @@ fn spawnVerify(verify_path: [:0]const u16, cmd_line: [:0]const u16) !windows.DWO |
| 162 | 162 | @sizeOf(windows.PROCESS.BASIC_INFORMATION), |
| 163 | 163 | null, |
| 164 | 164 | )) { |
| 165 | .SUCCESS => return @intFromEnum(info.ExitStatus), | |
| 165 | .SUCCESS => return @backingInt(info.ExitStatus), | |
| 166 | 166 | else => return error.UnableToGetExitCode, |
| 167 | 167 | } |
| 168 | 168 | } |
tools/fetch_them_macos_headers.zig+2-2| ... | ... | @@ -44,7 +44,7 @@ const Target = struct { |
| 44 | 44 | return std.fmt.allocPrint(allocator, "{s}-{s}.{d}-{s}", .{ |
| 45 | 45 | @tagName(self.arch), |
| 46 | 46 | @tagName(self.os), |
| 47 | @intFromEnum(self.os_ver), | |
| 47 | @backingInt(self.os_ver), | |
| 48 | 48 | @tagName(self.abi), |
| 49 | 49 | }); |
| 50 | 50 | } |
| ... | ... | @@ -97,7 +97,7 @@ pub fn main(init: std.process.Init) !void { |
| 97 | 97 | fatal("don't know how to parse SDK version: {s}", .{ |
| 98 | 98 | parsed_json.value.DefaultProperties.MACOSX_DEPLOYMENT_TARGET, |
| 99 | 99 | }); |
| 100 | const os_ver: OsVer = @enumFromInt(version.major); | |
| 100 | const os_ver: OsVer = @fromBackingInt(@intCast(version.major)); | |
| 101 | 101 | info("found SDK deployment target macOS {f} aka '{t}'", .{ version, os_ver }); |
| 102 | 102 | |
| 103 | 103 | const tmp_dir: Io.Dir = .cwd(); |
tools/gen_outline_atomics.zig+3-3| ... | ... | @@ -145,11 +145,11 @@ const N = enum(u8) { |
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | fn register(n: N) []const u8 { |
| 148 | return if (@intFromEnum(n) < 8) "w" else "x"; | |
| 148 | return if (@backingInt(n) < 8) "w" else "x"; | |
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | fn toBytes(n: N) u8 { |
| 152 | return @intFromEnum(n); | |
| 152 | return @backingInt(n); | |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | fn toBits(n: N) u8 { |
| ... | ... | @@ -213,7 +213,7 @@ fn generateCas(arena: Allocator, n: N, order: Ordering) ![]const u8 { |
| 213 | 213 | |
| 214 | 214 | const reg = n.register(); |
| 215 | 215 | |
| 216 | if (@intFromEnum(n) < 16) { | |
| 216 | if (@backingInt(n) < 16) { | |
| 217 | 217 | const cas = try std.fmt.allocPrint(arena, ".inst 0x08a07c41 + {s} + {s}", .{ s_def.b, o_def.m }); |
| 218 | 218 | const ldxr = try std.fmt.allocPrint(arena, "ld{s}xr{s}", .{ o_def.a, s_def.s }); |
| 219 | 219 | const stxr = try std.fmt.allocPrint(arena, "st{s}xr{s}", .{ o_def.l, s_def.s }); |
tools/gen_parser_oracle.zig+2-2| ... | ... | @@ -398,7 +398,7 @@ const Parser = struct { |
| 398 | 398 | _, |
| 399 | 399 | |
| 400 | 400 | fn get(index: Index, p: *const Parser) Node { |
| 401 | return p.nodes.items[@intFromEnum(index)]; | |
| 401 | return p.nodes.items[@backingInt(index)]; | |
| 402 | 402 | } |
| 403 | 403 | }; |
| 404 | 404 | |
| ... | ... | @@ -750,7 +750,7 @@ const Parser = struct { |
| 750 | 750 | |
| 751 | 751 | fn addNode(p: *Parser, node: Node) !Node.Index { |
| 752 | 752 | try p.nodes.append(p.gpa, node); |
| 753 | return @enumFromInt(p.nodes.items.len - 1); | |
| 753 | return @fromBackingInt(@intCast(p.nodes.items.len - 1)); | |
| 754 | 754 | } |
| 755 | 755 | |
| 756 | 756 | fn addExtra(p: *Parser, nodes: []const Node.Index) !Node.Slice { |
tools/gen_stubs.zig+9-9| ... | ... | @@ -144,7 +144,7 @@ const Family = enum { |
| 144 | 144 | const arches: [@typeInfo(Arch).@"enum".field_names.len]Arch = blk: { |
| 145 | 145 | var result: [@typeInfo(Arch).@"enum".field_names.len]Arch = undefined; |
| 146 | 146 | for (@typeInfo(Arch).@"enum".field_values) |field_value| { |
| 147 | const arch: Arch = @enumFromInt(field_value); | |
| 147 | const arch: Arch = @fromBackingInt(@intCast(field_value)); | |
| 148 | 148 | result[archIndex(arch)] = arch; |
| 149 | 149 | } |
| 150 | 150 | break :blk result; |
| ... | ... | @@ -161,7 +161,7 @@ const MultiSym = struct { |
| 161 | 161 | fn isSingleArch(ms: MultiSym) ?Arch { |
| 162 | 162 | var result: ?Arch = null; |
| 163 | 163 | inline for (@typeInfo(Arch).@"enum".field_values) |field_value| { |
| 164 | const arch: Arch = @enumFromInt(field_value); | |
| 164 | const arch: Arch = @fromBackingInt(@intCast(field_value)); | |
| 165 | 165 | if (ms.present[archIndex(arch)]) { |
| 166 | 166 | if (result != null) return null; |
| 167 | 167 | result = arch; |
| ... | ... | @@ -173,7 +173,7 @@ const MultiSym = struct { |
| 173 | 173 | fn isFamily(ms: MultiSym) ?Family { |
| 174 | 174 | var result: ?Family = null; |
| 175 | 175 | inline for (@typeInfo(Arch).@"enum".field_values) |field_value| { |
| 176 | const arch: Arch = @enumFromInt(field_value); | |
| 176 | const arch: Arch = @fromBackingInt(@intCast(field_value)); | |
| 177 | 177 | if (ms.present[archIndex(arch)]) { |
| 178 | 178 | const family = arch.family(); |
| 179 | 179 | if (result) |r| if (family != r) return null; |
| ... | ... | @@ -194,7 +194,7 @@ const MultiSym = struct { |
| 194 | 194 | |
| 195 | 195 | fn isTime32Only(ms: MultiSym) bool { |
| 196 | 196 | inline for (@typeInfo(Arch).@"enum".field_values) |field_value| { |
| 197 | const arch: Arch = @enumFromInt(field_value); | |
| 197 | const arch: Arch = @fromBackingInt(@intCast(field_value)); | |
| 198 | 198 | if (ms.present[archIndex(arch)] != arch.isTime32()) { |
| 199 | 199 | return false; |
| 200 | 200 | } |
| ... | ... | @@ -234,7 +234,7 @@ const MultiSym = struct { |
| 234 | 234 | |
| 235 | 235 | fn isPtrSize(ms: MultiSym, mult: u16) bool { |
| 236 | 236 | inline for (@typeInfo(Arch).@"enum".field_values) |field_value| { |
| 237 | const arch: Arch = @enumFromInt(field_value); | |
| 237 | const arch: Arch = @fromBackingInt(@intCast(field_value)); | |
| 238 | 238 | const arch_index = archIndex(arch); |
| 239 | 239 | if (ms.present[arch_index] and ms.size[arch_index] != arch.ptrSize() * mult) { |
| 240 | 240 | return false; |
| ... | ... | @@ -245,7 +245,7 @@ const MultiSym = struct { |
| 245 | 245 | |
| 246 | 246 | fn isWeak64(ms: MultiSym) bool { |
| 247 | 247 | inline for (@typeInfo(Arch).@"enum".field_values) |field_value| { |
| 248 | const arch: Arch = @enumFromInt(field_value); | |
| 248 | const arch: Arch = @fromBackingInt(@intCast(field_value)); | |
| 249 | 249 | const arch_index = archIndex(arch); |
| 250 | 250 | const binding: u4 = switch (arch.ptrSize()) { |
| 251 | 251 | 4 => std.elf.STB_GLOBAL, |
| ... | ... | @@ -261,7 +261,7 @@ const MultiSym = struct { |
| 261 | 261 | |
| 262 | 262 | fn isWeakTime64(ms: MultiSym) bool { |
| 263 | 263 | inline for (@typeInfo(Arch).@"enum".field_values) |field_value| { |
| 264 | const arch: Arch = @enumFromInt(field_value); | |
| 264 | const arch: Arch = @fromBackingInt(@intCast(field_value)); | |
| 265 | 265 | const arch_index = archIndex(arch); |
| 266 | 266 | const binding: u4 = if (arch.isTime32()) std.elf.STB_GLOBAL else std.elf.STB_WEAK; |
| 267 | 267 | if (ms.present[arch_index] and ms.binding[arch_index] != binding) { |
| ... | ... | @@ -605,7 +605,7 @@ fn parseElf(parse: Parse, comptime is_64: bool, comptime endian: std.builtin.End |
| 605 | 605 | const name = try arena.dupe(u8, mem.sliceTo(dynstr[s(sym.st_name)..], 0)); |
| 606 | 606 | const ty = @as(u4, @truncate(sym.st_info)); |
| 607 | 607 | const binding = @as(u4, @truncate(sym.st_info >> 4)); |
| 608 | const visib = @as(elf.STV, @enumFromInt(@as(u3, @truncate(sym.st_other)))); | |
| 608 | const visib = @as(elf.STV, @fromBackingInt(@intCast(@as(u3, @truncate(sym.st_other))))); | |
| 609 | 609 | const size = s(sym.st_size); |
| 610 | 610 | |
| 611 | 611 | if (size == 0) { |
| ... | ... | @@ -717,7 +717,7 @@ fn parseElf(parse: Parse, comptime is_64: bool, comptime endian: std.builtin.End |
| 717 | 717 | } |
| 718 | 718 | |
| 719 | 719 | fn archIndex(arch: Arch) u8 { |
| 720 | return @intFromEnum(arch); | |
| 720 | return @backingInt(arch); | |
| 721 | 721 | } |
| 722 | 722 | |
| 723 | 723 | fn archSetName(arch_set: [arches.len]bool) []const u8 { |
tools/generate_c_size_and_align_checks.zig+1-1| ... | ... | @@ -44,7 +44,7 @@ pub fn main(init: std.process.Init) !void { |
| 44 | 44 | var stdout_writer = Io.File.stdout().writerStreaming(io, &buffer); |
| 45 | 45 | const w = &stdout_writer.interface; |
| 46 | 46 | inline for (@typeInfo(std.Target.CType).@"enum".field_values) |field_value| { |
| 47 | const c_type: std.Target.CType = @enumFromInt(field_value); | |
| 47 | const c_type: std.Target.CType = @fromBackingInt(@intCast(field_value)); | |
| 48 | 48 | try w.print("_Static_assert(sizeof({0s}) == {1d}, \"sizeof({0s}) == {1d}\");\n", .{ |
| 49 | 49 | cName(c_type), |
| 50 | 50 | target.cTypeByteSize(c_type), |
tools/update-linux-headers.zig+1-1| ... | ... | @@ -39,7 +39,7 @@ const MultiArch = union(enum) { |
| 39 | 39 | specific: Arch, |
| 40 | 40 | |
| 41 | 41 | fn eql(a: MultiArch, b: MultiArch) bool { |
| 42 | if (@intFromEnum(a) != @intFromEnum(b)) | |
| 42 | if (@backingInt(a) != @backingInt(b)) | |
| 43 | 43 | return false; |
| 44 | 44 | if (a != .specific) |
| 45 | 45 | return true; |
tools/update_clang_options.zig+1-1| ... | ... | @@ -666,7 +666,7 @@ pub fn main(init: std.process.Init) !void { |
| 666 | 666 | |
| 667 | 667 | for (all_features, 0..) |feat, i| { |
| 668 | 668 | const llvm_name = feat.llvm_name orelse continue; |
| 669 | const zig_feat = @as(Feature, @enumFromInt(i)); | |
| 669 | const zig_feat = @as(Feature, @fromBackingInt(@intCast(i))); | |
| 670 | 670 | const zig_name = @tagName(zig_feat); |
| 671 | 671 | try llvm_to_zig_cpu_features.put(llvm_name, zig_name); |
| 672 | 672 | } |
tools/update_cpu_features.zig+1-1| ... | ... | @@ -76,7 +76,7 @@ const spirv_extra_features: []const Feature = blk: { |
| 76 | 76 | .zig_name = name, |
| 77 | 77 | .desc = "Enable " ++ name ++ " capability", |
| 78 | 78 | .deps = &struct { |
| 79 | const extensions = spirv_spec.Capability.dependencies(@enumFromInt(value)); | |
| 79 | const extensions = spirv_spec.Capability.dependencies(@fromBackingInt(@intCast(value))); | |
| 80 | 80 | const deps: [extensions.len][]const u8 = inner: { |
| 81 | 81 | var out: [extensions.len][]const u8 = undefined; |
| 82 | 82 | for (extensions, 0..) |ext, i| out[i] = @tagName(ext); |